diff options
author | Ken Moore <ken@ixsystems.com> | 2018-05-15 06:16:10 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-05-15 06:16:10 -0400 |
commit | f41126e16125f607b5eaba98fe883e316c5708d8 (patch) | |
tree | 891340fde03e0e176a76a12beac5d326e267ed93 /src-qt5/core/lumina-desktop-unified | |
parent | Get the screen reservation work finished up and committed. (diff) | |
download | lumina-f41126e16125f607b5eaba98fe883e316c5708d8.tar.gz lumina-f41126e16125f607b5eaba98fe883e316c5708d8.tar.bz2 lumina-f41126e16125f607b5eaba98fe883e316c5708d8.zip |
Quick update for some of the Lumina unified files. Getting plugins ready to go.
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
6 files changed, 68 insertions, 5 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp index 3f75e8c8..5b2a8a08 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp @@ -35,8 +35,7 @@ Plugin* Panel::findPlugin(QString id){ } Plugin* Panel::createPlugin(QString id){ - - return 0; + return Plugin::createPlugin(this, id, true); } // PRIVATE SLOTS diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp new file mode 100644 index 00000000..7c60b407 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp @@ -0,0 +1,27 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "Plugin.h" + +//Add includes for individual plugin files here +#include <ClockPlugin.h> + +QStringList Plugin::built_in_plugins(){ + QStringList list; + list << "clock"; + return list; +} + +Plugin* Plugin::createPlugin(QWidget *parent, QString id, bool panelplug){ + Plugin *plug = 0; + //QString id_extra; + //if(id.contains("--")){ id_extra = id.section("--",1,-1); id = id.section("--",0,0); } + if(id=="clock"){ + plug = new ClockPlugin(parent, id, panelplug); + } + + return plug; +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h index 4a81d79b..1bc0476f 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h @@ -25,6 +25,10 @@ public: bool isPanelPlugin; bool isVertical; //only used for panel plugins + //These static functions are defined in "Plugin.cpp" + static QStringList built_in_plugins(); + static Plugin* createPlugin(QWidget *parent, QString id, bool panelplug = false); + Plugin(QWidget *parent, QString id, bool panelplug = false) : QWidget(parent){ isPanelPlugin = panelplug; isVertical = false; @@ -51,10 +55,9 @@ private slots: //Special subclass for a button-based plugin class PluginButton : public Plugin{ Q_OBJECT -private: - QToolButton *button; public: + QToolButton *button; PluginButton(QWidget *parent, QString id, bool panelplug=false) : Plugin(parent, id, panelplug) { button = new QToolButton(this); this->layout()->addWidget(button); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h new file mode 100644 index 00000000..b5510ad7 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h @@ -0,0 +1,25 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include <Plugin.h> +#include <RootDesktopObject.h> + +class ClockPlugin : public PluginButton{ + Q_OBJECT +private: + +public: + ClockPlugin(QWidget *parent, QString id, bool panelplug) : PluginButton(parent, id, panelplug){ + connect(RootDesktopObject::instance(), SIGNAL(currentTimeChanged()), this, SLOT(updateTime()) ); + } + ~ClockPlugin(){ } + +private slots: + void updateTime(){ + this->button->setText(RootDesktopObject::instance()->currentTime() ); + } + +}; diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri new file mode 100644 index 00000000..6031a0d4 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri @@ -0,0 +1,6 @@ +#update the includepath so we can just #include as needed without paths +INCLUDEPATH *= $${PWD} + +#SOURCES *= + +HEADERS *= $${PWD}/ClockPlugin.h diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri index 5ed94f1b..8465b5f9 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/src-widgets.pri @@ -4,7 +4,8 @@ INCLUDEPATH *= $${PWD} SOURCES *= $${PWD}/RootDesktop.cpp \ $${PWD}/ContextMenu.cpp \ $${PWD}/NativeWindow.cpp \ - $${PWD}/Panel.cpp + $${PWD}/Panel.cpp \ + $${PWD}/Plugin.cpp HEADERS *= $${PWD}/RootDesktop.h \ $${PWD}/ContextMenu.h \ @@ -12,3 +13,5 @@ HEADERS *= $${PWD}/RootDesktop.h \ $${PWD}/NativeEmbedWidget.h \ $${PWD}/Panel.h \ $${PWD}/Plugin.h + +include("plugins/plugins.pri") |