aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-09-10 12:38:20 -0400
committerKen Moore <moorekou@gmail.com>2015-09-10 12:38:20 -0400
commit86543e806e27b8317eddce54fee9e0b04a031b51 (patch)
tree5f9046202839cbc6dc7b9b2aa9d6ad088ed811f9 /lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
parentMerge pull request #154 from harcobbit/issue/11233 (diff)
downloadlumina-86543e806e27b8317eddce54fee9e0b04a031b51.tar.gz
lumina-86543e806e27b8317eddce54fee9e0b04a031b51.tar.bz2
lumina-86543e806e27b8317eddce54fee9e0b04a031b51.zip
Add a new panel plugin: systemstart
This plugins is an overall "start" menu for the system, combining the functionality of the userbutton and the system dashboard into a single unified interface.
Diffstat (limited to 'lumina-desktop/panel-plugins/systemstart/LStartButton.cpp')
-rw-r--r--lumina-desktop/panel-plugins/systemstart/LStartButton.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
new file mode 100644
index 00000000..cb43b7c3
--- /dev/null
+++ b/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
@@ -0,0 +1,52 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "LStartButton.h"
+#include "../../LSession.h"
+
+LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
+ button = new QToolButton(this);
+ button->setAutoRaise(true);
+ button->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ button->setPopupMode(QToolButton::DelayedPopup); //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);
+ menu = new QMenu(this);
+ menu->setContentsMargins(1,1,1,1);
+ startmenu = new StartMenu(this);
+ connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
+ mact = new QWidgetAction(this);
+ mact->setDefaultWidget(startmenu);
+ menu->addAction(mact);
+
+ button->setMenu(menu);
+ connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
+ QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
+}
+
+LStartButtonPlugin::~LStartButtonPlugin(){
+
+}
+
+void LStartButtonPlugin::updateButtonVisuals(){
+ button->setToolTip(tr(""));
+ button->setText( SYSTEM::user() );
+ button->setIcon( LXDG::findIcon("pcbsd","Lumina-DE") ); //force icon refresh
+}
+
+// ========================
+// PRIVATE FUNCTIONS
+// ========================
+void LStartButtonPlugin::openMenu(){
+ startmenu->UpdateMenu();
+ button->showMenu();
+}
+
+void LStartButtonPlugin::closeMenu(){
+ menu->hide();
+}
+
bgstack15