aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/userbutton
diff options
context:
space:
mode:
authorKris Moore <kris@pcbsd.org>2014-09-04 11:42:13 -0400
committerKris Moore <kris@pcbsd.org>2014-09-04 11:42:13 -0400
commit71737f70949bd25f9aa8bc4e7d03039ba83c6cb1 (patch)
treeab29e864d1ae59d10cc6875af9541e3ad306b2fb /lumina-desktop/panel-plugins/userbutton
parentInitial commit (diff)
downloadlumina-71737f70949bd25f9aa8bc4e7d03039ba83c6cb1.tar.gz
lumina-71737f70949bd25f9aa8bc4e7d03039ba83c6cb1.tar.bz2
lumina-71737f70949bd25f9aa8bc4e7d03039ba83c6cb1.zip
Initial import of the lumina code from pcbsd git repo
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton')
-rw-r--r--lumina-desktop/panel-plugins/userbutton/LUserButton.cpp45
-rw-r--r--lumina-desktop/panel-plugins/userbutton/LUserButton.h64
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp111
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.h56
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp215
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.h82
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.ui385
7 files changed, 958 insertions, 0 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/LUserButton.cpp b/lumina-desktop/panel-plugins/userbutton/LUserButton.cpp
new file mode 100644
index 00000000..74509920
--- /dev/null
+++ b/lumina-desktop/panel-plugins/userbutton/LUserButton.cpp
@@ -0,0 +1,45 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "LUserButton.h"
+#include "../../LSession.h"
+
+LUserButtonPlugin::LUserButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
+ button = new QToolButton(this);
+ button->setAutoRaise(true);
+ button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ button->setToolTip(QString("Quickly launch applications or open files"));
+ button->setText( SYSTEM::user() );
+ 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);
+ usermenu = new UserWidget(this);
+ connect(usermenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
+ mact = new QWidgetAction(this);
+ mact->setDefaultWidget(usermenu);
+ menu->addAction(mact);
+
+ QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
+}
+
+LUserButtonPlugin::~LUserButtonPlugin(){
+
+}
+
+// ========================
+// PRIVATE FUNCTIONS
+// ========================
+void LUserButtonPlugin::openMenu(){
+ usermenu->UpdateMenu();
+ menu->popup(this->mapToGlobal(QPoint(0,0)));
+}
+
+void LUserButtonPlugin::closeMenu(){
+ menu->hide();
+}
+
diff --git a/lumina-desktop/panel-plugins/userbutton/LUserButton.h b/lumina-desktop/panel-plugins/userbutton/LUserButton.h
new file mode 100644
index 00000000..e6a1830d
--- /dev/null
+++ b/lumina-desktop/panel-plugins/userbutton/LUserButton.h
@@ -0,0 +1,64 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This panel plugin is the main button that allow the user to run
+// applications or logout of the desktop
+//===========================================
+#ifndef _LUMINA_DESKTOP_USER_MENU_PLUGIN_H
+#define _LUMINA_DESKTOP_USER_MENU_PLUGIN_H
+
+// Qt includes
+#include <QMenu>
+#include <QWidgetAction>
+#include <QToolButton>
+#include <QString>
+#include <QWidget>
+
+
+// Lumina-desktop includes
+#include "../../Globals.h"
+#include "../LPPlugin.h" //main plugin widget
+
+// libLumina includes
+#include "LuminaXDG.h"
+
+#include "UserWidget.h"
+
+// PANEL PLUGIN BUTTON
+class LUserButtonPlugin : public LPPlugin{
+ Q_OBJECT
+
+public:
+ LUserButtonPlugin(QWidget *parent = 0, QString id = "userbutton", bool horizontal=true);
+ ~LUserButtonPlugin();
+
+private:
+ QMenu *menu;
+ QWidgetAction *mact;
+ UserWidget *usermenu;
+ QToolButton *button;
+
+
+
+private slots:
+ void openMenu();
+ void closeMenu();
+
+public slots:
+ 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()) );
+ }
+ button->setIcon( LXDG::findIcon("user-identity", ":/images/default-user.png") ); //force icon refresh
+ this->layout()->update();
+ }
+};
+
+#endif \ No newline at end of file
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
new file mode 100644
index 00000000..c279a2a4
--- /dev/null
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
@@ -0,0 +1,111 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "UserItemWidget.h"
+
+UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, bool isDir) : QFrame(parent){
+ createWidget();
+ //Now fill it appropriately
+ if(itemPath.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop item = LXDG::loadDesktopFile(itemPath, ok);
+ if(ok){
+ icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(30,30) );
+ name->setText( item.name );
+ icon->setWhatsThis(item.filePath);
+ }else{
+ icon->setPixmap( LXDG::findIcon("unknown","").pixmap(30,30) );
+ name->setText( itemPath.section("/",-1) );
+ icon->setWhatsThis(itemPath);
+ }
+ }else if(isDir){
+ if(itemPath.endsWith("/")){ itemPath.chop(1); }
+ icon->setPixmap( LXDG::findIcon("folder","").pixmap(30,30) );
+ name->setText( itemPath.section("/",-1) );
+ icon->setWhatsThis(itemPath);
+ }else{
+ if(itemPath.endsWith("/")){ itemPath.chop(1); }
+ icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1).section(".",-1)).pixmap(30,30) );
+ name->setText( itemPath.section("/",-1) );
+ icon->setWhatsThis(itemPath);
+ }
+ if(isDir && !QFile::symLinkTarget(itemPath).isEmpty()){ isDir = false; } //not a real directory - just a sym link
+ isDirectory = isDir; //save this for later
+ //Now setup the button appropriately
+ setupButton();
+}
+
+UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent){
+ createWidget();
+ isDirectory = false;
+ //Now fill it appropriately
+ icon->setPixmap( LXDG::findIcon(item.icon,"preferences-system-windows-actions").pixmap(30,30) );
+ name->setText( item.name );
+ icon->setWhatsThis(item.filePath);
+ //Now setup the button appropriately
+ setupButton();
+
+}
+
+UserItemWidget::~UserItemWidget(){
+ delete button;
+ delete icon;
+ delete name;
+}
+
+
+void UserItemWidget::createWidget(){
+ //Initialize the widgets
+ this->setContentsMargins(0,0,0,0);
+ button = new QToolButton(this);
+ button->setIconSize( QSize(14,14) );
+ button->setAutoRaise(true);
+ icon = new QLabel(this);
+ icon->setFixedSize( QSize(30,30) );
+ name = new QLabel(this);
+ //Add them to the layout
+ this->setLayout(new QHBoxLayout());
+ this->layout()->setContentsMargins(1,1,1,1);
+ this->layout()->addWidget(icon);
+ this->layout()->addWidget(name);
+ this->layout()->addWidget(button);
+ //Install the stylesheet
+ this->setStyleSheet("UserItemWidget{ background: transparent; border-radius: 5px;} UserItemWidget::hover{ background: rgba(255,255,255,200); border-radius: 5px; }");
+}
+
+void UserItemWidget::setupButton(){
+ if( !isDirectory && icon->whatsThis().contains("/home/") && icon->whatsThis().contains("/Desktop/")){
+ //This is a current desktop shortcut -- allow the user to remove it
+ button->setWhatsThis("remove");
+ button->setIcon( LXDG::findIcon("list-remove","") );
+ button->setToolTip(tr("Remove Shortcut"));
+ connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
+ }else if( !isDirectory && !QFile::exists( QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1) ) ){
+ //This file does not have a desktop shortcut yet -- allow the user to add it
+ button->setWhatsThis("add");
+ button->setIcon( LXDG::findIcon("favorites","") );
+ button->setToolTip(tr("Create Shortcut"));
+ connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
+ }else{
+ //This already has a desktop shortcut -- no special actions
+ button->setVisible(false);
+ }
+}
+
+void UserItemWidget::buttonClicked(){
+ button->setVisible(false);
+ if(button->whatsThis()=="add"){
+ QFile::link(icon->whatsThis(), QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1) );
+ emit NewShortcut();
+ }else if(button->whatsThis()=="remove"){
+ QFile::remove(icon->whatsThis());
+ emit RemovedShortcut();
+ }
+}
+
+void UserItemWidget::ItemClicked(){
+ emit RunItem("lumina-open \""+icon->whatsThis()+"\"" );
+} \ No newline at end of file
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h
new file mode 100644
index 00000000..3a4406ac
--- /dev/null
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h
@@ -0,0 +1,56 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This item widget manages a single file/directory
+//===========================================
+#ifndef _LUMINA_PANEL_USER_ITEM_WIDGET_H
+#define _LUMINA_PANEL_USER_ITEM_WIDGET_H
+
+#include <QFrame>
+#include <QLabel>
+#include <QToolButton>
+#include <QString>
+#include <QHBoxLayout>
+#include <QSize>
+#include <QDir>
+#include <QFile>
+#include <QMouseEvent>
+
+
+#include <LuminaXDG.h>
+
+class UserItemWidget : public QFrame{
+ Q_OBJECT
+public:
+ UserItemWidget(QWidget *parent=0, QString itemPath="", bool isDir=false);
+ UserItemWidget(QWidget *parent=0, XDGDesktop item= XDGDesktop());
+ ~UserItemWidget();
+
+private:
+ QToolButton *button;
+ QLabel *icon, *name;
+ bool isDirectory;
+
+ void createWidget();
+ void setupButton();
+
+private slots:
+ void buttonClicked();
+ void ItemClicked();
+
+protected:
+ void mouseReleaseEvent(QMouseEvent *event){
+ if(event->button() != Qt::NoButton){ ItemClicked(); }
+ }
+
+signals:
+ void NewShortcut();
+ void RemovedShortcut();
+ void RunItem(QString cmd);
+
+};
+
+#endif \ No newline at end of file
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
new file mode 100644
index 00000000..f3dcad38
--- /dev/null
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -0,0 +1,215 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "UserWidget.h"
+#include "ui_UserWidget.h"
+#include "../../LSession.h"
+#include "../../AppMenu.h"
+
+UserWidget::UserWidget(QWidget* parent) : QWidget(parent), ui(new Ui::UserWidget){
+ ui->setupUi(this);
+ this->setContentsMargins(0,0,0,0);
+ sysapps = LSession::applicationMenu()->currentAppHash(); //get the raw info
+ //Setup the Icons
+ // - favorites tab
+ ui->tabWidget->setTabIcon(0, LXDG::findIcon("favorites","") );
+ ui->tabWidget->setTabText(0,"");
+ // - apps tab
+ ui->tabWidget->setTabIcon(1, LXDG::findIcon("system-run","") );
+ ui->tabWidget->setTabText(1,"");
+ // - home tab
+ ui->tabWidget->setTabIcon(2, LXDG::findIcon("user-home","") );
+ ui->tabWidget->setTabText(2,"");
+ // - config tab
+ ui->tabWidget->setTabIcon(3, LXDG::findIcon("preferences-system","") );
+ ui->tabWidget->setTabText(3,"");
+ ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") );
+ ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") );
+ ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") );
+ ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") );
+ ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") );
+
+ //Connect the signals/slots
+ connect(ui->tool_desktopsettings, SIGNAL(clicked()), this, SLOT(openDeskSettings()) );
+ connect(ui->tool_config_screensaver, SIGNAL(clicked()), this, SLOT(openScreenSaverConfig()) );
+ connect(ui->tool_fav_apps, SIGNAL(clicked()), this, SLOT(FavChanged()) );
+ connect(ui->tool_fav_files, SIGNAL(clicked()), this, SLOT(FavChanged()) );
+ connect(ui->tool_fav_dirs, SIGNAL(clicked()), this, SLOT(FavChanged()) );
+ connect(ui->combo_app_cats, SIGNAL(currentIndexChanged(int)), this, SLOT(updateApps()) );
+ //Setup the special buttons
+ if(QFile::exists(APPSTORE)){
+ //Now load the info
+ bool ok = false;
+ XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok);
+ if(ok){
+ ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") );
+ ui->tool_app_store->setText( store.name );
+ connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) );
+ }
+ ui->tool_app_store->setVisible(ok); //availability
+ }else{
+ ui->tool_app_store->setVisible(false); //not available
+ }
+ if(QFile::exists(CONTROLPANEL)){
+ //Now load the info
+ bool ok = false;
+ XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok);
+ if(ok){
+ ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") );
+ connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) );
+ }
+ ui->tool_controlpanel->setVisible(ok); //availability
+ }else{
+ ui->tool_controlpanel->setVisible(false); //not available
+ }
+ if(QFile::exists(QTCONFIG)){
+ ui->tool_qtconfig->setVisible(true);
+ ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") );
+ connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) );
+ }else{
+ ui->tool_qtconfig->setVisible(false);
+ }
+
+}
+
+UserWidget::~UserWidget(){
+}
+
+//===========
+// PRIVATE
+//===========
+void UserWidget::ClearScrollArea(QScrollArea *area){
+ QWidget *wgt = area->takeWidget();
+ delete wgt; //delete the widget and all children
+ area->setWidget( new QWidget() ); //create a new widget in the scroll area
+ area->widget()->setContentsMargins(0,0,0,0);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->setSpacing(2);
+ layout->setContentsMargins(3,1,3,1);
+ layout->setDirection(QBoxLayout::TopToBottom);
+ area->widget()->setLayout(layout);
+}
+
+//============
+// PRIVATE SLOTS
+//============
+void UserWidget::UpdateMenu(){
+ ui->tabWidget->setCurrentWidget(ui->tab_fav);
+ ui->tool_fav_apps->setChecked(true);
+ ui->tool_fav_dirs->setChecked(false);
+ ui->tool_fav_files->setChecked(false);
+ cfav = 0; //favorite apps
+ updateFavItems();
+ updateHome();
+ updateAppCategories();
+ updateApps();
+}
+
+void UserWidget::LaunchItem(QString cmd){
+ if(!cmd.isEmpty()){
+ qDebug() << "Launch Application:" << cmd;
+ LSession::LaunchApplication(cmd);
+ emit CloseMenu(); //so the menu container will close
+ }
+}
+
+void UserWidget::FavChanged(){
+ //uncheck the current item for a moment
+ if(cfav==0){ ui->tool_fav_apps->setChecked(false); }
+ else if(cfav==1){ ui->tool_fav_dirs->setChecked(false); }
+ if(cfav==2){ ui->tool_fav_files->setChecked(false); }
+ //Now check what other item is now the only one checked
+ if(ui->tool_fav_apps->isChecked() && !ui->tool_fav_dirs->isChecked() && !ui->tool_fav_files->isChecked() ){
+ cfav = 0;
+ }else if(!ui->tool_fav_apps->isChecked() && ui->tool_fav_dirs->isChecked() && !ui->tool_fav_files->isChecked() ){
+ cfav = 1;
+ }else if(!ui->tool_fav_apps->isChecked() && !ui->tool_fav_dirs->isChecked() && ui->tool_fav_files->isChecked() ){
+ cfav = 2;
+ }else{
+ //Re-check the old item (something invalid)
+ ui->tool_fav_apps->setChecked(cfav==0);
+ ui->tool_fav_dirs->setChecked(cfav==1);
+ ui->tool_fav_files->setChecked(cfav==2);
+ }
+ updateFavItems();
+}
+
+void UserWidget::updateFavItems(){
+ ClearScrollArea(ui->scroll_fav);
+ QStringList items;
+ QDir homedir = QDir( QDir::homePath()+"/Desktop");
+ if(ui->tool_fav_apps->isChecked()){ items = homedir.entryList(QStringList()<<"*.desktop", QDir::Files | QDir::NoDotAndDotDot, QDir::Name); }
+ else if(ui->tool_fav_dirs->isChecked()){ items = homedir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); }
+ else{
+ //Files
+ items = homedir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ for(int i=0; i<items.length(); i++){
+ if(items[i].endsWith(".desktop")){ items.removeAt(i); i--; }
+ }
+ }
+ for(int i=0; i<items.length(); i++){
+ UserItemWidget *it = new UserItemWidget(ui->scroll_fav->widget(), homedir.absoluteFilePath(items[i]), ui->tool_fav_dirs->isChecked());
+ ui->scroll_fav->widget()->layout()->addWidget(it);
+ connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
+ connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) );
+ connect(it, SIGNAL(RemovedShortcut()), this, SLOT(updateFavItems()) );
+ }
+ static_cast<QBoxLayout*>(ui->scroll_fav->widget()->layout())->addStretch();
+}
+
+//Apps Tab
+void UserWidget::updateAppCategories(){
+ ui->combo_app_cats->clear();
+ QStringList cats = sysapps->keys();
+ cats.sort();
+ for(int i=0; i<cats.length(); i++){
+ QString name, icon;
+ if(cats[i] == "Multimedia"){ name = tr("Multimedia"); icon = "applications-multimedia"; }
+ else if(cats[i] == "Development"){ name = tr("Development"); icon = "applications-development"; }
+ else if(cats[i] == "Education"){ name = tr("Education"); icon = "applications-education"; }
+ else if(cats[i] == "Game"){ name = tr("Games"); icon = "applications-games"; }
+ else if(cats[i] == "Graphics"){ name = tr("Graphics"); icon = "applications-graphics"; }
+ else if(cats[i] == "Network"){ name = tr("Network"); icon = "applications-internet"; }
+ else if(cats[i] == "Office"){ name = tr("Office"); icon = "applications-office"; }
+ else if(cats[i] == "Science"){ name = tr("Science"); icon = "applications-science"; }
+ else if(cats[i] == "Settings"){ name = tr("Settings"); icon = "preferences-system"; }
+ else if(cats[i] == "System"){ name = tr("System"); icon = "applications-system"; }
+ else if(cats[i] == "Utility"){ name = tr("Utility"); icon = "applications-utilities"; }
+ else{ name = tr("Unsorted"); icon = "applications-other"; }
+ ui->combo_app_cats->addItem( LXDG::findIcon(icon,""), name, cats[i] );
+ }
+}
+
+void UserWidget::updateApps(){
+ if(ui->combo_app_cats->currentIndex() < 0){ return; } //no cat
+ QString cat = ui->combo_app_cats->itemData( ui->combo_app_cats->currentIndex() ).toString();
+ QList<XDGDesktop> items = sysapps->value(cat);
+ ClearScrollArea(ui->scroll_apps);
+ for(int i=0; i<items.length(); i++){
+ UserItemWidget *it = new UserItemWidget(ui->scroll_apps->widget(), items[i]);
+ ui->scroll_apps->widget()->layout()->addWidget(it);
+ connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
+ connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) );
+ connect(it, SIGNAL(RemovedShortcut()), this, SLOT(updateFavItems()) );
+ }
+ static_cast<QBoxLayout*>(ui->scroll_apps->widget()->layout())->addStretch();
+}
+
+//Home Tab
+void UserWidget::updateHome(){
+ ClearScrollArea(ui->scroll_home);
+ QDir homedir = QDir::home();
+ QStringList items = homedir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ for(int i=0; i<items.length(); i++){
+ //qDebug() << "New Home subdir:" << homedir.absoluteFilePath(items[i]);
+ UserItemWidget *it = new UserItemWidget(ui->scroll_home->widget(), homedir.absoluteFilePath(items[i]), true);
+ ui->scroll_home->widget()->layout()->addWidget(it);
+ connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
+ connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) );
+ connect(it, SIGNAL(RemovedShortcut()), this, SLOT(updateFavItems()) );
+ }
+ static_cast<QBoxLayout*>(ui->scroll_home->widget()->layout())->addStretch();
+}
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
new file mode 100644
index 00000000..5bc737a1
--- /dev/null
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
@@ -0,0 +1,82 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This panel plugin allows the user to quickly access user favorites and applications
+//===========================================
+#ifndef _LUMINA_PANEL_USER_BUTTON_WIDGET_H
+#define _LUMINA_PANEL_USER_BUTTON_WIDGET_H
+
+#include <QWidget>
+#include <QString>
+#include <QList>
+#include <QHash>
+#include <QVBoxLayout>
+#include <QScrollArea>
+
+#include <LuminaXDG.h>
+
+#include "UserItemWidget.h"
+
+#define APPSTORE QString("/usr/local/share/applications/softmanager.desktop")
+#define CONTROLPANEL QString("/usr/local/share/applications/pccontrol.desktop")
+#define QTCONFIG QString("/usr/local/bin/qtconfig-qt4")
+#define SSAVER QString("xscreensaver-demo")
+
+namespace Ui{
+ class UserWidget;
+};
+
+class UserWidget : public QWidget{
+ Q_OBJECT
+public:
+ UserWidget(QWidget *parent=0);
+ ~UserWidget();
+
+ void UpdateMenu();
+
+private:
+ Ui::UserWidget *ui;
+ QHash<QString, QList<XDGDesktop> > *sysapps;
+ int cfav; //current favorite category
+ void ClearScrollArea(QScrollArea *area);
+
+private slots:
+ void LaunchItem(QString cmd);
+
+ //Favorites Tab
+ void FavChanged(); //for ensuring radio-button-like behaviour
+ void updateFavItems();
+
+ //Apps Tab
+ void updateAppCategories();
+ void updateApps();
+
+ //Home Tab
+ void updateHome();
+
+ //Slots for the special buttons
+ void openStore(){
+ LaunchItem("lumina-open \""+APPSTORE+"\"");
+ }
+ void openControlPanel(){
+ LaunchItem("lumina-open \""+CONTROLPANEL+"\"");
+ }
+ void openDeskSettings(){
+ LaunchItem("lumina-config");
+ }
+ void openQtConfig(){
+ LaunchItem(QTCONFIG);
+ }
+ void openScreenSaverConfig(){
+ LaunchItem(SSAVER);
+ }
+
+signals:
+ void CloseMenu();
+
+};
+
+#endif \ No newline at end of file
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
new file mode 100644
index 00000000..30625735
--- /dev/null
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
@@ -0,0 +1,385 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UserWidget</class>
+ <widget class="QWidget" name="UserWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>237</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QWidget#UserWidget{background: transparent; }
+QWidget#tab_apps,#tab_fav,#tab_home,#tab_config{background: rgba(192,192,182,100); }</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_fav">
+ <attribute name="title">
+ <string notr="true">Favorites</string>
+ </attribute>
+ <attribute name="toolTip">
+ <string>Favorites</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QToolButton" name="tool_fav_apps">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Favorite Applications</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_fav_dirs">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Favorite Directories</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_fav_files">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Favorite FIles</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QScrollArea" name="scroll_fav">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>205</width>
+ <height>210</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_apps">
+ <attribute name="title">
+ <string notr="true">Apps</string>
+ </attribute>
+ <attribute name="toolTip">
+ <string>System Applications</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QComboBox" name="combo_app_cats">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_app_store">
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QScrollArea" name="scroll_apps">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents_2">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>96</width>
+ <height>26</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_home">
+ <attribute name="title">
+ <string notr="true">Home</string>
+ </attribute>
+ <attribute name="toolTip">
+ <string>Home</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QScrollArea" name="scroll_home">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents_3">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>96</width>
+ <height>26</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_config">
+ <attribute name="title">
+ <string notr="true">Config</string>
+ </attribute>
+ <attribute name="toolTip">
+ <string>Desktop Preferences</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QToolButton" name="tool_controlpanel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Control Panel</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_desktopsettings">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Desktop Appearance/Plugins</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_qtconfig">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Application Appearance</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_config_screensaver">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Screensaver Settings</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>141</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
bgstack15