Permalink
Browse files

Initial WorldClock plugin skeleton

  • Loading branch information...
1 parent fd8ef70 commit 60d09baa341815646f6c273afd2bf5d59995f02f @kuzmas kuzmas committed Oct 21, 2012
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -41,6 +41,8 @@ setByDefault(VOLUME_USE_ALSA Yes)
setByDefault(KBINDICATOR_PLUGIN Yes)
setByDefault(SYSSTAT_PLUGIN Yes)
+setByDefault(KBINDICATOR_PLUGIN Yes)
+setByDefault(WORLDCLOCK_PLUGIN Yes)
# *******************************************************************
@@ -205,6 +207,20 @@ if (SYSSTAT_PLUGIN)
add_subdirectory(plugin-sysstat)
endif (SYSSTAT_PLUGIN)
+if (WORLDCLOCK_PLUGIN)
+ FIND_PACKAGE(ICU)
+
+ if(ICU_FOUND)
+ set(ENABLED_PLUGINS ${ENABLED_PLUGINS} "WorldClock")
+ add_subdirectory(plugin-worldclock)
+ else ()
+ message(STATUS "")
+ message(STATUS "WorldClock plugin requires ICU")
+ message(STATUS "")
+ endif (ICU_FOUND)
+
+endif (WORLDCLOCK_PLUGIN)
+
message(STATUS "**************** The following plugins will be built ****************")
foreach (PLUGIN_STR ${ENABLED_PLUGINS})
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 2.6)
+
+set(PLUGIN "panelworldclock")
+
+
+set(HEADERS
+ razorworldclock.h
+ razorworldclockconfiguration.h
+)
+
+set(SOURCES
+ razorworldclock.cpp
+ razorworldclockconfiguration.cpp
+)
+
+set(MOCS
+ razorworldclock.h
+ razorworldclockconfiguration.h
+)
+
+set(UIS
+ razorworldclockconfiguration.ui
+)
+
+
+include_directories(${ICU_INCLUDE_DIRS})
+LINK_LIBRARIES(${PLUGIN} ${ICU_LIBRARIES})
+
+#*******************************************
+include ("../BuildPlugin.cmake")
+BUILD_RAZOR_PLUGIN(${PLUGIN})
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@@ -0,0 +1,66 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2012 Razor team
+ * Authors:
+ * Kuzma Shapran <kuzma.shapran@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+#include "razorworldclock.h"
+
+#include <QtGui/QLabel>
+
+
+EXPORT_RAZOR_PANEL_PLUGIN_CPP(RazorWorldClock)
+
+
+RazorWorldClock::RazorWorldClock(const RazorPanelPluginStartInfo *startInfo, QWidget *parent):
+ RazorPanelPlugin(startInfo, parent),
+ content(new QLabel(this))
+{
+ setObjectName("WorldClock");
+
+ addWidget(content);
+
+ settingsChanged();
+}
+
+RazorWorldClock::~RazorWorldClock()
+{
+}
+
+void RazorWorldClock::settingsChanged()
+{
+// ... = settings().value("...", 0).toInt();
+}
+
+void RazorWorldClock::showConfigureDialog()
+{
+ RazorWorldClockConfiguration *confWindow = this->findChild<RazorWorldClockConfiguration*>("WorldClockConfigurationWindow");
+
+ if (!confWindow)
+ confWindow = new RazorWorldClockConfiguration(settings(), this);
+
+ confWindow->show();
+ confWindow->raise();
+ confWindow->activateWindow();
+}
@@ -0,0 +1,58 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2012 Razor team
+ * Authors:
+ * Kuzma Shapran <kuzma.shapran@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+#ifndef RAZORPANELWORLDCLOCK_H
+#define RAZORPANELWORLDCLOCK_H
+
+#include "../panel/razorpanelplugin.h"
+#include "razorworldclockconfiguration.h"
+
+
+class QLabel;
+class RazorWorldClockEventFilter;
+
+class RazorWorldClock : public RazorPanelPlugin
+{
+ Q_OBJECT
+public:
+ RazorWorldClock(const RazorPanelPluginStartInfo* startInfo, QWidget *parent = NULL);
+ ~RazorWorldClock();
+
+ virtual RazorPanelPlugin::Flags flags() const { return PreferRightAlignment | HaveConfigDialog; }
+
+protected slots:
+ virtual void settingsChanged();
+ virtual void showConfigureDialog();
+
+private:
+ QLabel *content;
+};
+
+
+EXPORT_RAZOR_PANEL_PLUGIN_H
+
+#endif // RAZORPANELWORLDCLOCK_H
@@ -0,0 +1,74 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2012 Razor team
+ * Authors:
+ * Kuzma Shapran <kuzma.shapran@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+
+#include "razorworldclockconfiguration.h"
+#include "ui_razorworldclockconfiguration.h"
+
+
+RazorWorldClockConfiguration::RazorWorldClockConfiguration(QSettings &settings, QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::RazorWorldClockConfiguration),
+ mSettings(settings),
+ oldSettings(settings)
+{
+ setAttribute(Qt::WA_DeleteOnClose);
+ setObjectName("WorldClockConfigurationWindow");
+ ui->setupUi(this);
+
+ connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*)));
+
+// connect(ui->..., SIGNAL(...), this, SLOT(saveSettings()));
+
+ loadSettings();
+}
+
+RazorWorldClockConfiguration::~RazorWorldClockConfiguration()
+{
+ delete ui;
+}
+
+void RazorWorldClockConfiguration::loadSettings()
+{
+// ui->...->setValue( mSettings.value("...", 0).toInt() );
+}
+
+void RazorWorldClockConfiguration::saveSettings()
+{
+// mSettings.setValue("...", ui->...->...());
+}
+
+void RazorWorldClockConfiguration::dialogButtonsAction(QAbstractButton *btn)
+{
+ if (ui->buttons->buttonRole(btn) == QDialogButtonBox::ResetRole)
+ {
+ oldSettings.loadToSettings();
+ loadSettings();
+ }
+ else
+ close();
+}
@@ -0,0 +1,79 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2012 Razor team
+ * Authors:
+ * Kuzma Shapran <kuzma.shapran@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+
+#ifndef RAZORWORLDCLOCKCONFIGURATION_H
+#define RAZORWORLDCLOCKCONFIGURATION_H
+
+#include "razorqt/razorsettings.h"
+
+#include <QtGui/QDialog>
+#include <QtGui/QAbstractButton>
+#include <QtGui/QFont>
+#include <QtCore/QMap>
+
+
+namespace Ui {
+ class RazorWorldClockConfiguration;
+}
+
+namespace WorldClock {
+ class BaseStat;
+}
+
+class QSignalMapper;
+class QFrame;
+
+class RazorWorldClockConfiguration : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit RazorWorldClockConfiguration(QSettings &settings, QWidget *parent = 0);
+ ~RazorWorldClockConfiguration();
+
+public slots:
+ void saveSettings();
+
+private:
+ Ui::RazorWorldClockConfiguration *ui;
+ QSettings &mSettings;
+ RazorSettingsCache oldSettings;
+
+ /*
+ Read settings from conf file and put data into controls.
+ */
+ void loadSettings();
+
+private slots:
+ /*
+ Saves settings in conf file.
+ */
+ void dialogButtonsAction(QAbstractButton *btn);
+};
+
+#endif // RAZORWORLDCLOCKCONFIGURATION_H
Oops, something went wrong.

0 comments on commit 60d09ba

Please sign in to comment.