aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/panel-plugins/jsonmenu
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-11-11 09:14:40 -0500
committerKen Moore <ken@ixsystems.com>2016-11-11 09:14:40 -0500
commit4a73dcc40afd2257588cee0656119dfe985efa3e (patch)
treeb0d592767b4a1b701fa06553547cdf4f1198157a /src-qt5/core/lumina-desktop/panel-plugins/jsonmenu
parentIf lumina-textedit is opened without any arguments, automatically open a blan... (diff)
downloadlumina-4a73dcc40afd2257588cee0656119dfe985efa3e.tar.gz
lumina-4a73dcc40afd2257588cee0656119dfe985efa3e.tar.bz2
lumina-4a73dcc40afd2257588cee0656119dfe985efa3e.zip
Oops - forgot to add some files to the previous commits.
Diffstat (limited to 'src-qt5/core/lumina-desktop/panel-plugins/jsonmenu')
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.cpp35
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.h42
2 files changed, 77 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.cpp
new file mode 100644
index 00000000..14880f9b
--- /dev/null
+++ b/src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.cpp
@@ -0,0 +1,35 @@
+//===========================================
+// Lumina Desktop source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "PPJsonMenu.h"
+#include "../../JsonMenu.h"
+
+LPJsonMenu::LPJsonMenu(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
+ //Setup the button
+ button = new QToolButton(this);
+ button->setAutoRaise(true);
+ button->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ button->setPopupMode(QToolButton::InstantPopup); //make sure it runs the update routine first
+ //connect(button, SIGNAL(clicked()), this, SLOT(openMenu()));
+ this->layout()->setContentsMargins(0,0,0,0);
+ this->layout()->addWidget(button);
+ //Parse the id and get the extra information needed for the plugin
+ QStringList info = id.section("---",0,0).split("::::"); //FORMAT:[ "jsonmenu---<number>",exec,name, icon(optional)]
+ if(info.length()>=3){
+ qDebug() << "Custom JSON Menu Loaded:" << info;
+ JsonMenu *menu = new JsonMenu(info[1], button);
+ button->setText(info[2]);
+ //connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
+ if(info.length()>=4){ button->setIcon( LXDG::findIcon(info[3],"run-build") ); }
+ else{ button->setIcon( LXDG::findIcon("run-build","") ); }
+ button->setMenu(menu);
+ }
+ //Now start up the widgets
+ QTimer::singleShot(0,this,SLOT(OrientationChange()) ); //update the sizing/icon
+}
+
+LPJsonMenu::~LPJsonMenu(){
+}
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.h b/src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.h
new file mode 100644
index 00000000..d0827fd2
--- /dev/null
+++ b/src-qt5/core/lumina-desktop/panel-plugins/jsonmenu/PPJsonMenu.h
@@ -0,0 +1,42 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_PANEL_JSON_PLUGIN_H
+#define _LUMINA_PANEL_JSON_PLUGIN_H
+
+#include "../../Globals.h"
+#include "../LPPlugin.h"
+
+
+class LPJsonMenu : public LPPlugin{
+ Q_OBJECT
+public:
+ LPJsonMenu(QWidget *parent = 0, QString id = "jsonmenu", bool horizontal=true);
+ ~LPJsonMenu();
+
+private:
+ QToolButton *button;
+
+private slots:
+ //void SystemApplication(QAction*);
+
+public slots:
+ void LocaleChange(){
+ }
+
+ void OrientationChange(){
+ if(this->layout()->direction()==QBoxLayout::LeftToRight){
+ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
+ button->setIconSize( QSize(this->height(), this->height()) );
+ }else{
+ this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+ button->setIconSize( QSize(this->width(), this->width()) );
+ }
+ this->layout()->update();
+ }
+};
+
+#endif
bgstack15