diff options
author | Weblate <noreply@weblate.org> | 2017-09-20 10:04:33 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2017-09-20 10:04:33 +0000 |
commit | 6a570a2c9648c47c3c58d96f139feab6596105ae (patch) | |
tree | a61a7e3e8149c96474db636b282559ddd9d90ed9 /src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins | |
parent | Translated using Weblate (Finnish) (diff) | |
parent | Get the window embed routine cleaned up and demo-ready. (diff) | |
download | lumina-6a570a2c9648c47c3c58d96f139feab6596105ae.tar.gz lumina-6a570a2c9648c47c3c58d96f139feab6596105ae.tar.bz2 lumina-6a570a2c9648c47c3c58d96f139feab6596105ae.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins')
57 files changed, 0 insertions, 8507 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LPPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LPPlugin.h deleted file mode 100644 index c4c76297..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LPPlugin.h +++ /dev/null @@ -1,77 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is the generic container layout for all panel plugins -// Simply subclass this when creating a new plugin to enable correct -// visibility and usage within a panel -//=========================================== -#ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_H -#define _LUMINA_DESKTOP_PANEL_PLUGIN_H - -#include <QObject> -#include <QWidget> -#include <QString> -#include <QBoxLayout> -#include <QApplication> - -class LPPlugin : public QWidget{ - Q_OBJECT - -private: - QBoxLayout *LY; - QString plugintype; - -public: - LPPlugin(QWidget *parent = 0, QString ptype="unknown", bool horizontal = true) : QWidget(parent){ - plugintype=ptype; - this->setContentsMargins(1,1,1,1); - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - this->setFocusPolicy(Qt::NoFocus); //no keyboard focus on the panel/plugins - if(horizontal){LY = new QBoxLayout(QBoxLayout::LeftToRight, this); } - else{ LY = new QBoxLayout(QBoxLayout::TopToBottom, this); } - this->setObjectName(ptype.section("---",0,0)); - LY->setContentsMargins(0,0,0,0); - LY->setSpacing(1); - this->setLayout(LY); - connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); - connect(QApplication::instance(), SIGNAL(IconThemeChanged()), this, SLOT(ThemeChange()) ); - } - - ~LPPlugin(){ - } - - QBoxLayout* layout(){ - return LY; - } - - QString type(){ - return plugintype; - } - - virtual void AboutToClose(){ - //This needs to be re-implemented in the subclasses plugin - //This is for any last-minute cleanup before the plugin gets deleted - } - -public slots: - virtual void LocaleChange(){ - //This needs to be re-implemented in the subclassed plugin - //This is where all text is set/translated - } - virtual void ThemeChange(){ - //This needs to be re-implemented in the subclasses plugin - //This is where all the visuals are set if using Theme-dependant icons. - } - virtual void OrientationChange(){ - //This needs to be re-implemented in the subclasses plugin - //This is where any horizontal/vertical orientations can be changed appropriately - } - -signals: - void MenuClosed(); //This needs to be emitted when any plugin's menu is closed for some reason (check/set focus properly) -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h deleted file mode 100644 index 560e5811..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/LTBWidget.h +++ /dev/null @@ -1,71 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2013, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_TOOLBAR_WIDGET_H -#define _LUMINA_TOOLBAR_WIDGET_H - -#include <QToolButton> -#include <QEvent> -#include <QWheelEvent> - -#include "Globals.h" -#include <LuminaX11.h> - -class LTBWidget : public QToolButton{ - Q_OBJECT - -private: - LXCB::WINDOWVISIBILITY cstate; - //QString rawstyle; - void updateBackground(){ - //QString background = "background: transparent; "; //default value - //QString border = "border: 1px solid transparent;"; - if(cstate == LXCB::IGNORE){ this->setObjectName(""); } //just use the defaults - else if(cstate == LXCB::VISIBLE){ this->setObjectName("WindowVisible"); }//background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(255, 255, 255, 240), stop:0.505682 rgba(240, 240, 240, 150), stop:1 rgba(210, 210, 210, 55));"; border="border: 1px solid transparent;"; } - else if(cstate == LXCB::INVISIBLE){this->setObjectName("WindowInvisible"); } //background = "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(215, 215, 215, 240), stop:0.505682 rgba(184, 185, 186, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } - else if(cstate == LXCB::ACTIVE){ this->setObjectName("WindowActive"); }//background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(241, 233, 156, 240), stop:0.355682 rgba(255, 243, 127, 150), stop:1 rgba(221, 246, 255, 55));"; border ="border: 1px solid transparent;"; } - else if(cstate == LXCB::ATTENTION){ this->setObjectName("WindowAttention"); }//background= "background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(252, 187, 127, 240), stop:0.505682 rgba(255, 222, 197, 150), stop:1 rgba(221, 246, 255, 55));"; border="border: 1px solid transparent;"; } - this->setStyleSheet(""); //force the object to re-evaluate the current theme stylesheet and update visuals - //QString raw = rawstyle; - //this->setStyleSheet( raw.replace("%1",background).replace("%2", border) ); - } - -signals: - - void wheelScroll(int change); - -public: - LTBWidget(QWidget* parent) : QToolButton(parent){ - //this->setStyleSheet( this->styleSheet()+" LTBWidget::menu-indicator{image: none;}"); - cstate = LXCB::IGNORE; - - this->setPopupMode(QToolButton::InstantPopup); - this->setAutoRaise(true); - - //rawstyle = "LTBWidget{ %1 %2 border-radius: 5px;} LTBWidget::menu-indicator{image: none;} LTBWidget::hover{ %1 border: 1px solid black; border-radius: 5px; } LTBWidget::menu-button{ background: transparent; width: 15px; } LTBWidget[popupMode=\"1\"]{%1 %2 border-radius: 5px; padding-right: 15px;} LTBWidget[popupMode=\"1\"]::hover{%1 border: 1px solid black; border-radius: 5px; padding-right: 15px}"; - updateBackground(); - } - - ~LTBWidget(){ - } - - void setState(LXCB::WINDOWVISIBILITY newstate){ - cstate = newstate; - updateBackground(); - } - -public slots: - - -protected: - void wheelEvent(QWheelEvent *event){ - int change = event->delta()/120; // 1/15th of a rotation (delta/120) is usually one "click" of the wheel - emit wheelScroll(change); - } - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/NewPP.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/NewPP.h deleted file mode 100644 index 3a5f6a5b..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/NewPP.h +++ /dev/null @@ -1,82 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is the interface to load all the different panel plugins -//=========================================== -#ifndef _LUMINA_DESKTOP_NEW_PANEL_PLUGIN_H -#define _LUMINA_DESKTOP_NEW_PANEL_PLUGIN_H - -#include <QDebug> - -//List all the individual plugin includes here -#include "LPPlugin.h" -#include "userbutton/LUserButton.h" -#include "desktopbar/LDeskBar.h" -#include "spacer/LSpacer.h" -#include "line/LLine.h" -#include "clock/LClock.h" -#include "battery/LBattery.h" -#include "desktopswitcher/LDesktopSwitcher.h" -#include "taskmanager/LTaskManagerPlugin.h" -#include "systemdashboard/LSysDashboard.h" -#include "showdesktop/LHomeButton.h" -#include "appmenu/LAppMenuPlugin.h" -#include "applauncher/AppLaunchButton.h" -#include "systemstart/LStartButton.h" -#include "audioplayer/LPAudioPlayer.h" -#include "jsonmenu/PPJsonMenu.h" -//#include "quickcontainer/QuickPPlugin.h" -#include "systemtray/LSysTray.h" //must be last due to X11 compile issues - - -class NewPP{ -public: - static LPPlugin* createPlugin(QString plugin, QWidget* parent = 0, bool horizontal = true){ - LPPlugin *plug = 0; - if(plugin.startsWith("userbutton---")){ - plug = new LUserButtonPlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("homebutton---")){ - plug = new LHomeButtonPlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("desktopbar---")){ - plug = new LDeskBarPlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("spacer---")){ - plug = new LSpacerPlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("line---")){ - plug = new LLinePlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("taskmanager")){ - //This one can be "taskmanager[-nogroups]---" - plug = new LTaskManagerPlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("systemtray---")){ - plug = new LSysTray(parent, plugin, horizontal); - }else if(plugin.startsWith("desktopswitcher---")){ - plug = new LDesktopSwitcher(parent, plugin, horizontal); - }else if(plugin.startsWith("battery---") && LOS::hasBattery()){ - plug = new LBattery(parent, plugin, horizontal); - }else if(plugin.startsWith("clock---")){ - plug = new LClock(parent, plugin, horizontal); - }else if(plugin.startsWith("systemdashboard---")){ - plug = new LSysDashboard(parent, plugin, horizontal); - }else if(plugin.startsWith("appmenu---")){ - plug = new LAppMenuPlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("systemstart---")){ - plug = new LStartButtonPlugin(parent, plugin, horizontal); - }else if(plugin.startsWith("audioplayer---")){ - plug = new LPAudioPlayer(parent, plugin, horizontal); - }else if(plugin.section("::::",0,0)=="jsonmenu" && plugin.split("::::").length()>=3 ){ - plug = new LPJsonMenu(parent, plugin, horizontal); - }else if(plugin.section("---",0,0).section("::",0,0)=="applauncher"){ - plug = new AppLaunchButtonPlugin(parent, plugin, horizontal); - //}else if( plugin.section("---",0,0).startsWith("quick-") && LUtils::validQuickPlugin(plugin.section("---",0,0)) ){ - //plug = new QuickPPlugin(parent, plugin, horizontal); - }else{ - qWarning() << "Invalid Panel Plugin:"<<plugin << " -- Ignored"; - } - return plug; - } - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/RotateToolButton.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/RotateToolButton.h deleted file mode 100644 index 1c8085f6..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/RotateToolButton.h +++ /dev/null @@ -1,58 +0,0 @@ -//=========================================== -// Lumina Desktop source code -// Copyright (c) 2016, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This is a simple subclass of a QToolButton so it can -// provice text rotated vertically as needed -//=========================================== -#ifndef _LUMINA_DESKTOP_ROTATE_TOOLBUTTON_H -#define _LUMINA_DESKTOP_ROTATE_TOOLBUTTON_H - -#include <QStylePainter> -#include <QStyleOptionToolButton> -#include <QToolButton> -#include <QTransform> - -class RotateToolButton : public QToolButton{ - Q_OBJECT - -private: - int rotate_degrees; - void paintEvent(QPaintEvent*){ - /* NOTE: This is what a standard QToolButton performs (peeked at Qt source code for this tidbit) - QStylePainter p(this); - QStyleOptionToolButton opt; - initStyleOption(&opt); - p.drawComplexControl(QStyle::CC_ToolButton, opt); - */ - QStylePainter p(this); - QStyleOptionToolButton opt; - initStyleOption(&opt); - //Apply the rotation matrix to the painter before starting the paint - QTransform trans = QTransform( p.transform() ).rotate(rotate_degrees); - p.setTransform(trans, false); //merging already taken care of - //Now do the normal painting procedure - p.drawComplexControl(QStyle::CC_ToolButton, opt); - } - -public: - RotateToolButton(QWidget *parent = Q_NULLPTR) : QToolButton(parent){ - rotate_degrees = 0; //no rotation initially - } - - void setRotation(int degrees){ - rotate_degrees = degrees; - this->update(); //trigger a paint event - } - - /*virtual void setText(QString text){ - this->setText(text); - if(rotate_degrees !=0){ - this->setSizeHint( this->sizeHint() - } - }*/ -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/applauncher/AppLaunchButton.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/applauncher/AppLaunchButton.cpp deleted file mode 100644 index 1fd819b5..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/applauncher/AppLaunchButton.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "AppLaunchButton.h" -#include "../../LSession.h" - -#include <LuminaXDG.h> -#include <LUtils.h> -#include <QInputDialog> - -AppLaunchButtonPlugin::AppLaunchButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - button = new QToolButton(this); - button->setAutoRaise(true); - button->setToolButtonStyle(Qt::ToolButtonIconOnly); - appfile = id.section("---",0,0).section("::",1,1); - if(!QFile::exists(appfile) && appfile.endsWith(".desktop")){ - //might be a relative path - try to find the file - appfile = LUtils::AppToAbsolute(appfile.section("/",-1) ); - } - if(!QFile::exists(appfile)){ appfile.clear(); } - connect(button, SIGNAL(clicked()), this, SLOT(AppClicked())); - this->layout()->setContentsMargins(0,0,0,0); - this->layout()->addWidget(button); - - QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes -} - -AppLaunchButtonPlugin::~AppLaunchButtonPlugin(){ - -} - -void AppLaunchButtonPlugin::updateButtonVisuals(){ - QIcon icon; - QString tooltip = tr("Click to assign an application"); - if(appfile.endsWith(".desktop")){ - XDGDesktop desk(appfile); - if(desk.isValid()){ - icon = LXDG::findIcon(desk.icon, "unknown"); - tooltip = QString(tr("Launch %1")).arg(desk.name); - }else{ - icon = LXDG::findIcon("task-attention",""); - appfile.clear(); - } - }else if(QFile::exists(appfile)){ - icon = LXDG::findMimeIcon(appfile.section("/",-1)); - tooltip = QString(tr("Open %1")).arg(appfile.section("/",-1)); - }else{ - icon = LXDG::findIcon("task-attention", ""); - } - button->setIcon( icon ); - button->setToolTip(tooltip); -} - -// ======================== -// PRIVATE FUNCTIONS -// ======================== -void AppLaunchButtonPlugin::AppClicked(){ - if(appfile.isEmpty()){ - //No App File selected - QList<XDGDesktop*> apps = LSession::handle()->applicationMenu()->currentAppHash()->value("All"); - QStringList names; - for(int i=0; i<apps.length(); i++){ names << apps[i]->name; } - bool ok = false; - QString app = QInputDialog::getItem(this, tr("Select Application"), tr("Name:"), names, 0, false, &ok); - if(!ok || names.indexOf(app)<0){ return; } //cancelled - appfile = apps[ names.indexOf(app) ]->filePath; - //Still need to find a way to set this value persistently - // --- perhaps replace the plugin in the desktop settings file with the new path? - // --- "applauncher::broken---<something>" -> "applauncher::fixed---<something>" ? - QTimer::singleShot(0,this, SLOT(updateButtonVisuals())); - }else{ - LSession::LaunchApplication("lumina-open \""+appfile+"\""); - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/applauncher/AppLaunchButton.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/applauncher/AppLaunchButton.h deleted file mode 100644 index 3aa3c7ad..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/applauncher/AppLaunchButton.h +++ /dev/null @@ -1,63 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This panel plugin is a simple button to launch a single application -//=========================================== -#ifndef _LUMINA_DESKTOP_LAUNCH_APP_PANEL_PLUGIN_H -#define _LUMINA_DESKTOP_LAUNCH_APP_PANEL_PLUGIN_H - -// Qt includes -#include <QToolButton> -#include <QString> -#include <QWidget> - - -// Lumina-desktop includes -#include "../LPPlugin.h" //main plugin widget - -// libLumina includes -#include "LuminaXDG.h" - -// PANEL PLUGIN BUTTON -class AppLaunchButtonPlugin : public LPPlugin{ - Q_OBJECT - -public: - AppLaunchButtonPlugin(QWidget *parent = 0, QString id = "applauncher", bool horizontal=true); - ~AppLaunchButtonPlugin(); - -private: - QToolButton *button; - QString appfile; - - void updateButtonVisuals(); - -private slots: - void AppClicked(); - -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()) ); - } - this->layout()->update(); - updateButtonVisuals(); - } - - void LocaleChange(){ - updateButtonVisuals(); - } - - void ThemeChange(){ - updateButtonVisuals(); - } -}; - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/appmenu/LAppMenuPlugin.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/appmenu/LAppMenuPlugin.cpp deleted file mode 100644 index e3be55c2..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/appmenu/LAppMenuPlugin.cpp +++ /dev/null @@ -1,142 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LAppMenuPlugin.h" -#include "../../LSession.h" - -#include <LuminaXDG.h> - -LAppMenuPlugin::LAppMenuPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - button = new QToolButton(this); - button->setAutoRaise(true); - button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - mainmenu = new QMenu(this); - button->setMenu( mainmenu ); - button->setPopupMode(QToolButton::InstantPopup); - this->layout()->setContentsMargins(0,0,0,0); - this->layout()->addWidget(button); - - connect(mainmenu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - connect(mainmenu, SIGNAL(triggered(QAction*)), this, SLOT(LaunchItem(QAction*)) ); - connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateMenu())); - QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes - QTimer::singleShot(0,this, SLOT(UpdateMenu()) ); - //Setup the global shortcut handling for opening the start menu - connect(QApplication::instance(), SIGNAL(StartButtonActivated()), this, SLOT(shortcutActivated()) ); - LSession::handle()->registerStartButton(this->type()); -} - -LAppMenuPlugin::~LAppMenuPlugin(){ - -} - -void LAppMenuPlugin::updateButtonVisuals(){ - button->setToolTip( tr("Quickly launch applications or open files")); - button->setText( tr("Applications") ); - //Use the TrueOS icon by default (or the Lumina icon for non-TrueOS systems) - button->setIcon( LXDG::findIcon("start-here-lumina","Lumina-DE") ); -} - -// ======================== -// PRIVATE FUNCTIONS -// ======================== -void LAppMenuPlugin::shortcutActivated(){ - if(LSession::handle()->registerStartButton(this->type())){ - if(button->menu()->isVisible()){ button->menu()->hide(); } - else{ button->showMenu(); } - } -} - -void LAppMenuPlugin::LaunchItem(QAction* item){ - QString appFile = item->whatsThis(); - if(appFile.startsWith("internal::")){ - appFile = appFile.section("::",1,50); //cut off the "internal" flag - if(appFile=="logout"){ LSession::handle()->systemWindow(); } - }else if(!appFile.isEmpty()){ - LSession::LaunchApplication("lumina-open "+appFile); - } -} - -void LAppMenuPlugin::UpdateMenu(){ - mainmenu->clear(); - QHash<QString, QList<XDGDesktop*> > *HASH = LSession::handle()->applicationMenu()->currentAppHash(); - //Now Re-create the menu (orignally copied from the AppMenu class) - //Add link to the file manager - QAction *tmpact = mainmenu->addAction( LXDG::findIcon("user-home", ""), tr("Browse Files") ); - tmpact->setWhatsThis("\""+QDir::homePath()+"\""); - //--Look for the app store - XDGDesktop store(LOS::AppStoreShortcut()); - if(store.isValid()){ - tmpact = mainmenu->addAction( LXDG::findIcon(store.icon, ""), tr("Install Applications") ); - tmpact->setWhatsThis("\""+store.filePath+"\""); - } - //--Look for the control panel - XDGDesktop controlp(LOS::ControlPanelShortcut()); - if(controlp.isValid()){ - tmpact = mainmenu->addAction( LXDG::findIcon(controlp.icon, ""), tr("Control Panel") ); - tmpact->setWhatsThis("\""+controlp.filePath+"\""); - } - mainmenu->addSeparator(); - //--Now create the sub-menus - QStringList cats = HASH->keys(); - cats.sort(); //make sure they are alphabetical - for(int i=0; i<cats.length(); i++){ - //Make sure they are translated and have the right icons - QString name, icon; - if(cats[i]=="All"){continue; } //skip this listing for the menu - else 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 if(cats[i] == "Wine"){ name = tr("Wine"); icon = "wine"; } - else{ name = tr("Unsorted"); icon = "applications-other"; } - - QMenu *menu = new QMenu(name, this); - menu->setIcon(LXDG::findIcon(icon,"")); - QList<XDGDesktop*> appL = HASH->value(cats[i]); - for( int a=0; a<appL.length(); a++){ - if(appL[a]->actions.isEmpty()){ - //Just a single entry point - no extra actions - QAction *act = new QAction(LXDG::findIcon(appL[a]->icon, ""), appL[a]->name, menu); - act->setToolTip(appL[a]->comment); - act->setWhatsThis("\""+appL[a]->filePath+"\""); - menu->addAction(act); - }else{ - //This app has additional actions - make this a sub menu - // - first the main menu/action - QMenu *submenu = new QMenu(appL[a]->name, menu); - submenu->setIcon( LXDG::findIcon(appL[a]->icon,"") ); - //This is the normal behavior - not a special sub-action (although it needs to be at the top of the new menu) - QAction *act = new QAction(LXDG::findIcon(appL[a]->icon, ""), appL[a]->name, submenu); - act->setToolTip(appL[a]->comment); - act->setWhatsThis(appL[a]->filePath); - submenu->addAction(act); - //Now add entries for every sub-action listed - for(int sa=0; sa<appL[a]->actions.length(); sa++){ - QAction *sact = new QAction(LXDG::findIcon(appL[a]->actions[sa].icon, appL[a]->icon), appL[a]->actions[sa].name, this); - sact->setToolTip(appL[a]->comment); - sact->setWhatsThis("-action \""+appL[a]->actions[sa].ID+"\" \""+appL[a]->filePath+"\""); - submenu->addAction(sact); - } - menu->addMenu(submenu); - } - }//end loop over apps within this category - mainmenu->addMenu(menu); - } //end loop over categories - //Now add any logout options - mainmenu->addSeparator(); - //QMenu *tmpmenu = mainmenu->addMenu(LXDG::findIcon("system-log-out",""), tr("Leave")); - tmpact =mainmenu->addAction(LXDG::findIcon("system-log-out"),tr("Leave")); - tmpact->setWhatsThis("internal::logout"); - -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/appmenu/LAppMenuPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/appmenu/LAppMenuPlugin.h deleted file mode 100644 index 659d781f..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/appmenu/LAppMenuPlugin.h +++ /dev/null @@ -1,64 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This panel plugin is a re-creation of the classic "start" menu -//=========================================== -#ifndef _LUMINA_DESKTOP_APP_MENU_PANEL_PLUGIN_H -#define _LUMINA_DESKTOP_APP_MENU_PANEL_PLUGIN_H - -// Qt includes -#include <QMenu> -#include <QToolButton> -#include <QString> -#include <QWidget> - - -// Lumina-desktop includes -#include "../LPPlugin.h" //main plugin widget - - -// PANEL PLUGIN BUTTON -class LAppMenuPlugin : public LPPlugin{ - Q_OBJECT - -public: - LAppMenuPlugin(QWidget *parent = 0, QString id = "appmenu", bool horizontal=true); - ~LAppMenuPlugin(); - -private: - QToolButton *button; - QMenu *mainmenu; - - void updateButtonVisuals(); - -private slots: - void shortcutActivated(); - void LaunchItem(QAction* item); - void UpdateMenu(); - -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()) ); - } - this->layout()->update(); - updateButtonVisuals(); - } - - void LocaleChange(){ - updateButtonVisuals(); - } - - void ThemeChange(){ - updateButtonVisuals(); - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/LPAudioPlayer.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/LPAudioPlayer.cpp deleted file mode 100644 index 5669aaf5..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/LPAudioPlayer.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Susanne Jaeckel -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LPAudioPlayer.h" -#include "LSession.h" - -LPAudioPlayer::LPAudioPlayer(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); - wact = new QWidgetAction(this); - aplayer = new PPlayerWidget(this); - button ->setMenu(new QMenu(this) ); - wact->setDefaultWidget(aplayer); - button->menu()->addAction(wact); - //Now start up the widgets - button->setIcon( LXDG::findIcon("audio-volume-high","") ); - QTimer::singleShot(0,this,SLOT(OrientationChange()) ); //update the sizing/icon -} - -LPAudioPlayer::~LPAudioPlayer(){ -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/LPAudioPlayer.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/LPAudioPlayer.h deleted file mode 100644 index e5132b1f..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/LPAudioPlayer.h +++ /dev/null @@ -1,49 +0,0 @@ -//=========================================== -// 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_AUDIO_PLAYER_PLUGIN_H -#define _LUMINA_PANEL_AUDIO_PLAYER_PLUGIN_H - -#include "../../Globals.h" -#include "../LTBWidget.h" -#include "../LPPlugin.h" -#include "PPlayerWidget.h" - -class LPAudioPlayer : public LPPlugin{ - Q_OBJECT -public: - LPAudioPlayer(QWidget *parent = 0, QString id = "audioplayer", bool horizontal=true); - ~LPAudioPlayer(); - -private: - QToolButton *button; - QWidgetAction *wact; - PPlayerWidget *aplayer; - - //int iconOld; - -private slots: - //void updateBattery(bool force = false); - //QString getRemainingTime(); - -public slots: - void LocaleChange(){ - //updateBattery(true); - } - - 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 diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.cpp deleted file mode 100644 index 023e20c7..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.cpp +++ /dev/null @@ -1,258 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "PPlayerWidget.h" -#include "ui_PPlayerWidget.h" - -#include <QDir> -#include <QUrl> -#include <QInputDialog> -#include <QFileDialog> -#include <LuminaXDG.h> -#include <QDebug> -#include <QDesktopWidget> - -PPlayerWidget::PPlayerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::PPlayerWidget()){ - ui->setupUi(this); //load the designer form - PLAYER = new QMediaPlayer(this); - PLAYER->setVolume(100); - PLAYER->setNotifyInterval(1000); //1 second interval (just needs to be a rough estimate) - PLAYLIST = new QMediaPlaylist(this); - PLAYLIST->setPlaybackMode(QMediaPlaylist::Sequential); - PLAYER->setPlaylist(PLAYLIST); - - configMenu = new QMenu(this); - ui->tool_config->setMenu(configMenu); - addMenu = new QMenu(this); - ui->tool_add->setMenu(addMenu); - - updatinglists = false; //start off as false - - ui->combo_playlist->setContextMenuPolicy(Qt::NoContextMenu); - - LoadIcons(); - playerStateChanged(); //update button visibility - currentSongChanged(); - //Connect all the signals/slots - //connect(infoTimer, SIGNAL(timeout()), this, SLOT(rotateTrackInfo()) ); - connect(PLAYER, SIGNAL(positionChanged(qint64)),this, SLOT(updateProgress(qint64)) ); - connect(PLAYER, SIGNAL(durationChanged(qint64)), this, SLOT(updateMaxProgress(qint64)) ); - connect(PLAYLIST, SIGNAL(mediaChanged(int, int)), this, SLOT(playlistChanged()) ); - connect(PLAYER, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged()) ); - connect(PLAYLIST, SIGNAL(currentMediaChanged(const QMediaContent&)), this, SLOT(currentSongChanged()) ); - connect(ui->combo_playlist, SIGNAL(currentIndexChanged(int)), this, SLOT(userlistSelectionChanged()) ); - connect(ui->tool_play, SIGNAL(clicked()), this, SLOT(playClicked()) ); - connect(ui->tool_pause, SIGNAL(clicked()), this, SLOT(pauseClicked()) ); - connect(ui->tool_stop, SIGNAL(clicked()), this, SLOT(stopClicked()) ); - connect(ui->tool_next, SIGNAL(clicked()), this, SLOT(nextClicked()) ); - connect(ui->tool_prev, SIGNAL(clicked()), this, SLOT(prevClicked()) ); - -} - -PPlayerWidget::~PPlayerWidget(){ - //qDebug() << "Removing PPlayerWidget"; -} - -void PPlayerWidget::LoadIcons(){ - ui->tool_stop->setIcon( LXDG::findIcon("media-playback-stop","") ); - ui->tool_play->setIcon( LXDG::findIcon("media-playback-start","") ); - ui->tool_pause->setIcon( LXDG::findIcon("media-playback-pause","") ); - ui->tool_next->setIcon( LXDG::findIcon("media-skip-forward","") ); - ui->tool_prev->setIcon( LXDG::findIcon("media-skip-backward","") ); - ui->tool_add->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_config->setIcon( LXDG::findIcon("configure","") ); - //Now re-assemble the menus as well - configMenu->clear(); - configMenu->addAction(LXDG::findIcon("media-eject",""), tr("Clear Playlist"), this, SLOT(ClearPlaylist())); - configMenu->addAction(LXDG::findIcon("roll",""), tr("Shuffle Playlist"), this, SLOT(ShufflePlaylist())); - addMenu->clear(); - addMenu->addAction(LXDG::findIcon("document-new",""), tr("Add Files"), this, SLOT(AddFilesToPlaylist())); - addMenu->addAction(LXDG::findIcon("folder-new",""), tr("Add Directory"), this, SLOT(AddDirToPlaylist())); - addMenu->addAction(LXDG::findIcon("download",""), tr("Add URL"), this, SLOT(AddURLToPlaylist())); -} - -void PPlayerWidget::playClicked(){ - PLAYER->play(); -} - -void PPlayerWidget::pauseClicked(){ - PLAYER->pause(); -} - -void PPlayerWidget::stopClicked(){ - PLAYER->stop(); -} - -void PPlayerWidget::nextClicked(){ - PLAYLIST->next(); -} - -void PPlayerWidget::prevClicked(){ - PLAYLIST->previous(); -} - -void PPlayerWidget::AddFilesToPlaylist(){ - //Prompt the user to select multimedia files - QFileDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setFileMode(QFileDialog::ExistingFiles); - dlg.setAcceptMode(QFileDialog::AcceptOpen); - dlg.setNameFilter( tr("Multimedia Files")+" ("+LXDG::findAVFileExtensions().join(" ")+")"); - dlg.setWindowTitle(tr("Select Multimedia Files")); - dlg.setWindowIcon( LXDG::findIcon("file-open","") ); - dlg.setDirectory(QDir::homePath()); //start in the home directory - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - QApplication::processEvents(); - } - QList<QUrl> files = dlg.selectedUrls(); - if(files.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled - //Make this use show/processEvents later - //QList<QUrl> files = QFileDialog::getOpenFileUrls(0, tr("Select Multimedia Files"), QDir::homePath(), "Multimedia Files ("+LXDG::findAVFileExtensions().join(" ")+")"); - QList<QMediaContent> urls; - for(int i=0; i<files.length(); i++){ - urls << QMediaContent(files[i]); - } - PLAYLIST->addMedia(urls); - playlistChanged(); -} - -void PPlayerWidget::AddDirToPlaylist(){ - QFileDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setFileMode(QFileDialog::Directory); - dlg.setOption(QFileDialog::ShowDirsOnly, true); - dlg.setAcceptMode(QFileDialog::AcceptOpen); - dlg.setWindowTitle(tr("Select Multimedia Directory")); - dlg.setWindowIcon( LXDG::findIcon("folder-open","") ); - dlg.setDirectory(QDir::homePath()); //start in the home directory - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - QApplication::processEvents(); - } - if(dlg.result() != QDialog::Accepted){ return; } //cancelled - QStringList sel = dlg.selectedFiles(); - if(sel.isEmpty()){ return; } //cancelled - QString dirpath = sel.first(); //QFileDialog::getExistingDirectory(0, tr("Select a Multimedia Directory"), QDir::homePath() ); - if(dirpath.isEmpty()){ return; } //cancelled - QDir dir(dirpath); - QFileInfoList files = dir.entryInfoList(LXDG::findAVFileExtensions(), QDir::Files | QDir::NoDotAndDotDot, QDir::Name); - if(files.isEmpty()){ return; } //nothing in this directory - QList<QMediaContent> urls; - for(int i=0; i<files.length(); i++){ - urls << QMediaContent(QUrl::fromLocalFile(files[i].absoluteFilePath()) ); - } - PLAYLIST->addMedia(urls); - playlistChanged(); -} - -void PPlayerWidget::AddURLToPlaylist(){ - QInputDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setInputMode(QInputDialog::TextInput); - dlg.setLabelText(tr("Enter a valid URL for a multimedia file or stream:")); - dlg.setTextEchoMode(QLineEdit::Normal); - dlg.setWindowTitle(tr("Multimedia URL")); - dlg.setWindowIcon( LXDG::findIcon("download","") ); - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - QApplication::processEvents(); - } - QString url = dlg.textValue(); - if(url.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled - - //QString url = QInputDialog::getText(0, tr("Multimedia URL"), tr("Enter a valid URL for a multimedia file or stream"), QLineEdit::Normal); - //if(url.isEmpty()){ return; } - QUrl newurl(url); - if(!newurl.isValid()){ return; } //invalid URL - PLAYLIST->addMedia(newurl); - playlistChanged(); -} - -void PPlayerWidget::ClearPlaylist(){ - PLAYER->stop(); - PLAYLIST->clear(); - playlistChanged(); -} - -void PPlayerWidget::ShufflePlaylist(){ - PLAYLIST->shuffle(); -} - - -void PPlayerWidget::userlistSelectionChanged(){ //front-end combobox was changed by the user - if(updatinglists){ return; } - PLAYLIST->setCurrentIndex( ui->combo_playlist->currentIndex() ); -} - -void PPlayerWidget::playerStateChanged(){ - switch( PLAYER->state() ){ - case QMediaPlayer::StoppedState: - ui->tool_stop->setVisible(false); - ui->tool_play->setVisible(true); - ui->tool_pause->setVisible(false); - ui->progressBar->setVisible(false); - break; - case QMediaPlayer::PausedState: - ui->tool_stop->setVisible(true); - ui->tool_play->setVisible(true); - ui->tool_pause->setVisible(false); - ui->progressBar->setVisible(true); - break; - case QMediaPlayer::PlayingState: - ui->tool_stop->setVisible(true); - ui->tool_play->setVisible(false); - ui->tool_pause->setVisible(true); - ui->progressBar->setVisible(true); - break; - } - -} - -void PPlayerWidget::playlistChanged(){ - updatinglists = true; - ui->combo_playlist->clear(); - for(int i=0; i<PLAYLIST->mediaCount(); i++){ - QUrl url = PLAYLIST->media(i).canonicalUrl(); - if(url.isLocalFile()){ - ui->combo_playlist->addItem(LXDG::findMimeIcon(url.fileName().section(".",-1)), url.fileName() ); - }else{ - ui->combo_playlist->addItem(LXDG::findIcon("download",""), url.toString() ); - } - } - if(PLAYLIST->currentIndex()<0 && PLAYLIST->mediaCount()>0){ PLAYLIST->setCurrentIndex(0); } - ui->combo_playlist->setCurrentIndex(PLAYLIST->currentIndex()); - - updatinglists = false; -} - -void PPlayerWidget::currentSongChanged(){ - if(PLAYLIST->currentIndex() != ui->combo_playlist->currentIndex()){ - updatinglists = true; - ui->combo_playlist->setCurrentIndex(PLAYLIST->currentIndex()); - updatinglists = false; - } - ui->tool_next->setEnabled( PLAYLIST->nextIndex() >= 0 ); - ui->tool_prev->setEnabled( PLAYLIST->previousIndex() >= 0); - ui->label_num->setText( QString::number( PLAYLIST->currentIndex()+1)+"/"+QString::number(PLAYLIST->mediaCount()) ); - ui->progressBar->setRange(0, PLAYER->duration() ); - ui->progressBar->setValue(0); -} - -void PPlayerWidget::updateProgress(qint64 val){ - //qDebug() << "Update Progress Bar:" << val; - ui->progressBar->setValue(val); -} - -void PPlayerWidget::updateMaxProgress(qint64 val){ - ui->progressBar->setRange(0,val); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.h deleted file mode 100644 index a551d74f..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.h +++ /dev/null @@ -1,59 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin is a simple audio player on the desktop -//=========================================== -#ifndef _LUMINA_PANEL_PLUGIN_AUDIO_PLAYER_WIDGET_H -#define _LUMINA_PANEL_PLUGIN_AUDIO_PLAYER_WIDGET_H - -#include <QMediaPlaylist> -#include <QMediaPlayer> -#include <QTimer> -#include <QWidget> -#include <QMenu> - - -namespace Ui{ - class PPlayerWidget; -}; - -class PPlayerWidget : public QWidget{ - Q_OBJECT -public: - PPlayerWidget(QWidget *parent = 0); - ~PPlayerWidget(); - -public slots: - void LoadIcons(); - -private: - Ui::PPlayerWidget *ui; - QMediaPlaylist *PLAYLIST; - QMediaPlayer *PLAYER; - QMenu *configMenu, *addMenu; - bool updatinglists; - -private slots: - void playClicked(); - void pauseClicked(); - void stopClicked(); - void nextClicked(); - void prevClicked(); - - void AddFilesToPlaylist(); - void AddDirToPlaylist(); - void AddURLToPlaylist(); - void ClearPlaylist(); - void ShufflePlaylist(); - void userlistSelectionChanged(); //front-end combobox was changed by the user - void playerStateChanged(); - void playlistChanged(); //list of items changed - void currentSongChanged(); - void updateProgress(qint64 val); - void updateMaxProgress(qint64 val); -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.ui b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.ui deleted file mode 100644 index 2d2450be..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/audioplayer/PPlayerWidget.ui +++ /dev/null @@ -1,182 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PPlayerWidget</class> - <widget class="QWidget" name="PPlayerWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>346</width> - <height>90</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <property name="styleSheet"> - <string notr="true">QToolButton::menu-indicator{ image: none; }</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QToolButton" name="tool_config"> - <property name="text"> - <string notr="true">Config</string> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_add"> - <property name="text"> - <string notr="true">Add</string> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </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_prev"> - <property name="text"> - <string notr="true">prev</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_num"> - <property name="text"> - <string notr="true">1/10</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_next"> - <property name="text"> - <string notr="true">next</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QComboBox" name="combo_playlist"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QToolButton" name="tool_play"> - <property name="text"> - <string notr="true">Play</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_pause"> - <property name="text"> - <string notr="true">Pause</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_stop"> - <property name="text"> - <string notr="true">Stop</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <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="QProgressBar" name="progressBar"> - <property name="value"> - <number>24</number> - </property> - <property name="textVisible"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/LBattery.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/LBattery.cpp deleted file mode 100644 index ee379613..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/LBattery.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Susanne Jaeckel, 2015-2016 Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LBattery.h" -#include "LSession.h" - -LBattery::LBattery(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - iconOld = -1; - //Setup the widget - label = new QLabel(this); - label->setScaledContents(true); - //label->setAlignment(Qt::AlignCenter); - this->layout()->addWidget(label); - //Setup the timer - timer = new QTimer(); - timer->setInterval(5000); //update every 5 seconds - connect(timer,SIGNAL(timeout()), this, SLOT(updateBattery()) ); - timer->start(); - QTimer::singleShot(0,this,SLOT(OrientationChange()) ); //update the sizing/icon -} - -LBattery::~LBattery(){ - timer->stop(); - delete timer; -} - -void LBattery::updateBattery(bool force){ - // Get current state of charge - //QStringList result = LUtils::getCmdOutput("/usr/sbin/apm", QStringList() << "-al"); - int charge = LOS::batteryCharge(); //result.at(1).toInt(); -//qDebug() << "1: " << result.at(0).toInt() << " 2: " << result.at(1).toInt(); - int icon = -1; - if (charge > 90) { icon = 4; } - else if (charge > 70) { icon = 3; } - else if (charge > 20) { icon = 2; } - else if (charge > 5) { icon = 1; } - else if (charge > 0 ) { icon = 0; } - if(LOS::batteryIsCharging()){ icon = icon+10; } - //icon = icon + result.at(0).toInt() * 10; - if (icon != iconOld || force) { - switch (icon) { - case 0: - label->setPixmap( LXDG::findIcon("battery-caution", "").pixmap(label->size()) ); - break; - case 1: - label->setPixmap( LXDG::findIcon("battery-040", "").pixmap(label->size()) ); - break; - case 2: - label->setPixmap( LXDG::findIcon("battery-060", "").pixmap(label->size()) ); - break; - case 3: - label->setPixmap( LXDG::findIcon("battery-080", "").pixmap(label->size()) ); - break; - case 4: - label->setPixmap( LXDG::findIcon("battery-100", "").pixmap(label->size()) ); - break; - case 10: - label->setPixmap( LXDG::findIcon("battery-charging-caution", "").pixmap(label->size()) ); - break; - case 11: - label->setPixmap( LXDG::findIcon("battery-charging-040", "").pixmap(label->size()) ); - break; - case 12: - label->setPixmap( LXDG::findIcon("battery-charging-060", "").pixmap(label->size()) ); - break; - case 13: - label->setPixmap( LXDG::findIcon("battery-charging-080", "").pixmap(label->size()) ); - break; - case 14: - label->setPixmap( LXDG::findIcon("battery-charging", "").pixmap(label->size()) ); - break; - default: - label->setPixmap( LXDG::findIcon("battery-missing", "").pixmap(label->size()) ); - break; - } - if(icon<iconOld && icon==0){ - //Play some audio warning chime when - LSession::handle()->playAudioFile(LOS::LuminaShare()+"low-battery.ogg"); - } - if(icon==0){ label->setStyleSheet("QLabel{ background: red;}"); } - else if(icon==14 && charge>98){ label->setStyleSheet("QLabel{ background: green;}"); } - else{ label->setStyleSheet("QLabel{ background: transparent;}"); } - iconOld = icon; - - } - //Now update the display - QString tt; - //Make sure the tooltip can be properly translated as necessary (Ken Moore 5/9/14) - if(icon > 9 && icon < 15){ tt = QString(tr("%1 % (Charging)")).arg(QString::number(charge)); } - else{ tt = QString( tr("%1 % (%2 Remaining)") ).arg(QString::number(charge), getRemainingTime() ); } - label->setToolTip(tt); -} - -QString LBattery::getRemainingTime(){ - int secs = LOS::batterySecondsLeft(); - if(secs < 0){ return "??"; } - QString rem; //remaining - if(secs > 3600){ - int hours = secs/3600; - rem.append( QString::number(hours)+"h "); - secs = secs - (hours*3600); - } - if(secs > 60){ - int min = secs/60; - rem.append( QString::number(min)+"m "); - secs = secs - (min*60); - } - if(secs > 0){ - rem.append(QString::number(secs)+"s"); - } - return rem; -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/LBattery.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/LBattery.h deleted file mode 100644 index 29562d5d..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/LBattery.h +++ /dev/null @@ -1,53 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Susanne Jaeckel -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_BATTERY_H -#define _LUMINA_DESKTOP_BATTERY_H - -#include <QTimer> -#include <QWidget> -#include <QString> -#include <QLabel> - -#include <LUtils.h> -#include <LuminaXDG.h> -#include <LuminaOS.h> - -#include "../../Globals.h" -//#include "../LTBWidget.h" -#include "../LPPlugin.h" - -class LBattery : public LPPlugin{ - Q_OBJECT -public: - LBattery(QWidget *parent = 0, QString id = "battery", bool horizontal=true); - ~LBattery(); - -private: - QTimer *timer; - QLabel *label; - int iconOld; - -private slots: - void updateBattery(bool force = false); - QString getRemainingTime(); - -public slots: - void LocaleChange(){ - updateBattery(true); - } - - void OrientationChange(){ - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - label->setFixedSize( QSize(this->height(), this->height()) ); - }else{ - label->setFixedSize( QSize(this->width(), this->width()) ); - } - updateBattery(true); //force icon refresh - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/NOTES b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/NOTES deleted file mode 100644 index 3d93267e..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/battery/NOTES +++ /dev/null @@ -1,49 +0,0 @@ -Eventuell mit einem Menü implementieren, mit Einträgen für: -Anzeige des kompletten Status und Infos -Herunterfahren des Systems etc. - -apm -a - Zeigt den AC line status an - 0 = off-line - 1 = on-line - 2 = backup-power - -apm -b - Zeigt - 0 = high - 1 = low - 2 = critical - 3 = charging - -apm -l - Zeit die prozentuale Kapazitaet - 255 = nicht unterstuetzt - -apm -t - Zeigt die verbleibende Zeit in Sekunden - -Aufruf Systemfunktionen: LUtils.h - -mit der Methode: -QStringList LUtils::getCmdOutput(QString cmd, QStringList args) - -Icons: -/usr/local/share/icons/oxygen/22x22/status -oder unter: -/usr/local/share/icons/oxygen/16x16/status - -battery-040.png // 40 % -battery-060.png -battery-080.png -battery-100.png - -battery-caution.png -battery-charging.png -battery-charging-040.png -battery-charging-060.png -battery-charging-080.png -battery-charging-caution.png - -battery-charging-log.png -battery-log.png -battery-missing.png diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/clock/LClock.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/clock/LClock.cpp deleted file mode 100644 index b370c536..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/clock/LClock.cpp +++ /dev/null @@ -1,230 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2012-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LClock.h" -#include "LSession.h" -#include <LuminaThemes.h> -#include <LuminaXDG.h> - -LClock::LClock(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - button = new QToolButton(this); //RotateToolButton(this); - button->setAutoRaise(true); - button->setToolButtonStyle(Qt::ToolButtonTextOnly); - button->setStyleSheet("font-weight: bold;"); - button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first - button->setMenu(new QMenu()); - //button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - //this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - connect(button, SIGNAL(clicked()), this, SLOT(openMenu())); - connect(button->menu(), SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - calendar = new QCalendarWidget(this); - calAct = new QWidgetAction(this); - calAct->setDefaultWidget(calendar); - TZMenu = new QMenu(this); - connect(TZMenu, SIGNAL(triggered(QAction*)), this, SLOT(ChangeTZ(QAction*)) ); - - //Now assemble the menu - button->menu()->addAction(calAct); - button->menu()->addMenu(TZMenu); - - this->layout()->setContentsMargins(0,0,0,0); //reserve some space on left/right - this->layout()->addWidget(button); - - //Setup the timer - timer = new QTimer(); - //Load all the initial settings - updateFormats(); - LocaleChange(); - ThemeChange(); - OrientationChange(); - //Now connect/start the timer - connect(timer,SIGNAL(timeout()), this, SLOT(updateTime()) ); - connect(QApplication::instance(), SIGNAL(SessionConfigChanged()), this, SLOT(updateFormats()) ); - timer->start(); -} - -LClock::~LClock(){ - timer->stop(); - delete timer; -} - - -void LClock::updateTime(bool adjustformat){ - QDateTime CT = QDateTime::currentDateTime(); - //Now update the display - QString label; - QString timelabel; - QString datelabel; - if(deftime){ timelabel = CT.time().toString(Qt::DefaultLocaleShortDate) ; } - else{ timelabel=CT.toString(timefmt); } - if(defdate){ datelabel = CT.date().toString(Qt::DefaultLocaleShortDate); } - else{ datelabel = CT.toString(datefmt); } - if(datetimeorder == "dateonly"){ - label = datelabel; - button->setToolTip(timelabel); - }else if(datetimeorder == "timedate"){ - label = timelabel + "\n" + datelabel; - button->setToolTip(""); - }else if(datetimeorder == "datetime"){ - label = datelabel + "\n" + timelabel; - button->setToolTip(""); - }else{ - label = timelabel; - button->setToolTip(datelabel); - } - if( this->layout()->direction() == QBoxLayout::TopToBottom ){ - //different routine for vertical text (need newlines instead of spaces) - for(int i=0; i<label.count("\n")+1; i++){ - if(this->size().width() < (this->fontMetrics().width(label.section("\n",i,i))+10 )&& label.section("\n",i,i).contains(" ")){ - label.replace(label.section("\n",i,i), label.section("\n",i,i).replace(" ", "\n")); - i--; - } - } - //label.replace(" ","\n"); - }else if( this->size().height() < 2*this->fontMetrics().height() ){ - label.replace("\n",", "); - } - if(adjustformat){ - //Check the font/spacing for the display and adjust as necessary - /*double efflines = label.count("\n")+1; //effective lines (with wordwrap) - if( (button->fontMetrics().height()*efflines) > button->height() ){ - //Force a pixel metric font size to fit everything - int szH = qRound( (button->height() - button->fontMetrics().lineSpacing() )/efflines ); - //Need to supply a *width* pixel, not a height metric - int szW = qRound( (szH*button->fontMetrics().maxWidth())/( (double) button->fontMetrics().height()) ); - qDebug() << "Change Clock font:" << button->height() << szH << szW << efflines << button->fontMetrics().height() << button->fontMetrics().lineSpacing(); - button->setStyleSheet("font-weight: bold; font-size: "+QString::number(szW)+"px;"); - }else{ - button->setStyleSheet("font-weight: bold;"); - }*/ - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - //horizontal layout - this->setFixedWidth( this->sizeHint().width() +6); - }else{ - //vertical layout - this->setMaximumWidth(100000); - } - } - button->setText(label); -} - -void LClock::updateFormats(){ - qDebug() << "Updating clock format"; - timefmt = LSession::handle()->sessionSettings()->value("TimeFormat","").toString(); - datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString(); - deftime = timefmt.simplified().isEmpty(); - defdate = datefmt.simplified().isEmpty(); - //Adjust the timer interval based on the smallest unit displayed - if(deftime){ timer->setInterval(500); } //1/2 second - else if(timefmt.contains("z")){ timer->setInterval(1); } //every millisecond (smallest unit) - else if(timefmt.contains("s")){ timer->setInterval(500); } //1/2 second - else if(timefmt.contains("m")){ timer->setInterval(2000); } //2 seconds - else{ timer->setInterval(1000); } //unknown format - use 1 second interval - datetimeorder = LSession::handle()->sessionSettings()->value("DateTimeOrder", "timeonly").toString().toLower(); - //this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - updateTime(true); - //Now fix the size of the widget with the new size hint - //this->setFixedWidth( this->sizeHint().width() +6); -} - -void LClock::updateMenu(){ - QDateTime cdt = QDateTime::currentDateTime(); - TZMenu->setTitle(QString(tr("Time Zone (%1)")).arg(cdt.timeZoneAbbreviation()) ); - calendar->showToday(); //make sure the current month is visible - calendar->setSelectedDate(QDate::currentDate()); //select the actual date for today -} - -void LClock::openMenu(){ - updateMenu(); - button->showMenu(); -} - -void LClock::closeMenu(){ - button->menu()->hide(); -} - -void LClock::ChangeTZ(QAction *act){ - LTHEME::setCustomEnvSetting("TZ",act->whatsThis()); - QTimer::singleShot(500, this, SLOT(updateTime()) ); -} - -void LClock::LocaleChange(){ - //Refresh all the time zone information - TZMenu->clear(); - TZMenu->addAction(tr("Use System Time")); - TZMenu->addSeparator(); - QList<QByteArray> TZList = QTimeZone::availableTimeZoneIds(); - //Orgnize time zones for smaller menus (Continent/Country/City) - // Note: id = Continent/City - QStringList info; - for(int i=0; i<TZList.length(); i++){ - QTimeZone tz(TZList[i]); - if(!QString(tz.id()).contains("/")){ continue; } - info << "::::"+QString(tz.id()).section("/",0,0)+"::::"+QLocale::countryToString(tz.country())+"::::"+QString(tz.id()).section("/",1,100).replace("_"," ")+"::::"+QString(tz.id()); - } - //Now sort alphabetically - info.sort(); - //Now create the menu tree - QString continent, country; //current continent/country - QMenu *tmpC=0; //continent menu - QMenu *tmpCM=0; //country menu - for(int i=0; i<info.length(); i++){ - //Check if different continent - if(info[i].section("::::",1,1)!=continent){ - if(tmpC!=0){ - if(tmpCM!=0 && !tmpCM->isEmpty()){ - tmpC->addMenu(tmpCM); - } - if(!tmpC->isEmpty()){ TZMenu->addMenu(tmpC); } - } - tmpC = new QMenu(this); - tmpC->setTitle(info[i].section("::::",1,1)); - tmpCM = new QMenu(this); - tmpCM->setTitle(info[i].section("::::",2,2)); - //Check if different country - }else if(info[i].section("::::",2,2)!=country){ - if(tmpC!=0 && tmpCM!=0 && !tmpCM->isEmpty()){ - tmpC->addMenu(tmpCM); - } - tmpCM = new QMenu(this); - tmpCM->setTitle(info[i].section("::::",2,2)); - } - //Now create the entry within the country menu - if(tmpCM!=0){ - QAction *act = new QAction(info[i].section("::::",3,3), this); - act->setWhatsThis(info[i].section("::::",4,4) ); - tmpCM->addAction(act); - } - //Save the values for the next run - continent = info[i].section("::::",1,1); - country = info[i].section("::::",2,2); - - if(i== info.length()-1){ - //last go through - save all menus - if(tmpCM!=0 && tmpC!=0 && !tmpCM->isEmpty()){ tmpC->addMenu(tmpCM); } - if(tmpC!=0 && !tmpC->isEmpty()){ TZMenu->addMenu(tmpC); } - } - } - -} - -void LClock::ThemeChange(){ - TZMenu->setIcon(LXDG::findIcon("clock","")); -} - -void LClock::OrientationChange(){ - if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal panel - //button->setRotation(0); //no rotation of text - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - }else{ //vertical panel - //button->setRotation(90); //90 degree rotation - this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - } - updateTime(true); //re-adjust the font/spacings - this->layout()->update(); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/clock/LClock.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/clock/LClock.h deleted file mode 100644 index eddf782c..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/clock/LClock.h +++ /dev/null @@ -1,58 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2012-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_CLOCK_H -#define _LUMINA_DESKTOP_CLOCK_H - -#include <QTimer> -#include <QDateTime> -#include <QLabel> -#include <QWidget> -#include <QString> -#include <QLocale> -#include <QTimeZone> -#include <QCalendarWidget> -#include <QWidgetAction> -#include <QAction> -#include <QToolButton> -#include <QMenu> - -#include "../LPPlugin.h" - -//#include "../RotateToolButton.h" - -class LClock : public LPPlugin{ - Q_OBJECT -public: - LClock(QWidget *parent = 0, QString id = "clock", bool horizontal=true); - ~LClock(); - -private: - QTimer *timer; - QToolButton *button; //RotateToolButton - QString timefmt, datefmt, datetimeorder; - bool deftime, defdate; - QMenu *TZMenu; - QCalendarWidget *calendar; - QWidgetAction *calAct; - -private slots: - void updateTime(bool adjustformat = false); - void updateFormats(); - - void updateMenu(); - void openMenu(); - void closeMenu(); - - void ChangeTZ(QAction*); - -public slots: - void LocaleChange(); - void ThemeChange(); - void OrientationChange(); -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopbar/LDeskBar.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopbar/LDeskBar.cpp deleted file mode 100644 index 90d942de..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopbar/LDeskBar.cpp +++ /dev/null @@ -1,207 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2012-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LDeskBar.h" -#include "../../LSession.h" - -LDeskBarPlugin::LDeskBarPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - this->layout()->setContentsMargins(0,0,0,0); - this->setStyleSheet( "QToolButton::menu-indicator{ image: none; } QToolButton{ padding: 0px; }"); - - //initialize the desktop bar items - initializeDesktop(); - //setup the directory watcher - QString fav = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list"; - if(!QFile::exists(fav)){ QProcess::execute("touch \""+fav+"\""); } - watcher = new QFileSystemWatcher(this); - watcher->addPath( fav ); - connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(filechanged(QString)) ); - QTimer::singleShot(1,this, SLOT(updateFiles()) ); //make sure to load it the first time - QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust sizes/layout - connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFiles()) ); -} - -LDeskBarPlugin::~LDeskBarPlugin(){ -} - -// ======================= -// PRIVATE FUNCTIONS -// ======================= -void LDeskBarPlugin::initializeDesktop(){ - //Applications on the desktop - appB = new QToolButton(this); - appB->setToolButtonStyle(Qt::ToolButtonIconOnly); - appB->setAutoRaise(true); - appB->setPopupMode(QToolButton::InstantPopup); - appM = new QMenu(this); - appB->setMenu(appM); - this->layout()->addWidget(appB); - connect(appM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - connect(appM, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - //Directories on the desktop - dirB = new QToolButton(this); - dirB->setToolButtonStyle(Qt::ToolButtonIconOnly); - dirB->setAutoRaise(true); - dirB->setPopupMode(QToolButton::InstantPopup); - dirM = new QMenu(this); - dirB->setMenu(dirM); - this->layout()->addWidget(dirB); - connect(dirM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - connect(dirM, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - //Audio Files on the desktop - audioM = new QMenu(this); - connect(audioM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - //Video Files on the desktop - videoM = new QMenu(this); - connect(videoM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - //Picture Files on the desktop - pictureM = new QMenu(this); - connect(pictureM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - //Other Files on the desktop - otherM = new QMenu(this); - connect(otherM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - docM = new QMenu(this); - connect(docM,SIGNAL(triggered(QAction*)), this,SLOT(ActionTriggered(QAction*)) ); - //All Files Button - fileB = new QToolButton(this); - fileB->setToolButtonStyle(Qt::ToolButtonIconOnly); - fileB->setAutoRaise(true); - fileB->setPopupMode(QToolButton::InstantPopup); - fileM = new QMenu(this); - fileB->setMenu(fileM); - this->layout()->addWidget(fileB); - - updateIcons(); //set all the text/icons -} - -QAction* LDeskBarPlugin::newAction(QString filepath, QString name, QString iconpath){ - return newAction(filepath, name, QIcon(iconpath)); -} - -QAction* LDeskBarPlugin::newAction(QString filepath, QString name, QIcon icon){ - QAction *act = new QAction(icon, name, this); - act->setWhatsThis(filepath); - return act; -} - -// ======================= -// PRIVATE SLOTS -// ======================= -void LDeskBarPlugin::ActionTriggered(QAction* act){ - //Open up the file with the appropriate application - QString cmd = "lumina-open \""+act->whatsThis()+"\""; - qDebug() << "Open File:" << cmd; - LSession::LaunchApplication(cmd); -} -void LDeskBarPlugin::filechanged(QString file){ - updateFiles(); - if(!watcher->files().contains(file)){ watcher->addPath(file); } //make sure the file does not get removed from the watcher -} -void LDeskBarPlugin::updateFiles(){ - QFileInfoList homefiles = LSession::handle()->DesktopFiles(); - QStringList favitems = LDesktopUtils::listFavorites(); - //Remember for format for favorites: <name>::::[app/dir/<mimetype>]::::<full path> - for(int i=0; i<homefiles.length(); i++){ - if( !favitems.filter(homefiles[i].canonicalFilePath()).isEmpty() ){ continue; } //duplicate entry - QString type; - if(homefiles[i].isDir()){ type="dir"; } - else if(homefiles[i].fileName().endsWith(".desktop")){ type="app"; } - else{ type=LXDG::findAppMimeForFile(homefiles[i].fileName()); } - favitems << homefiles[i].fileName()+"::::"+type+"::::"+homefiles[i].absoluteFilePath(); - //qDebug() << "Desktop Item:" << favitems.last(); - } - - favitems.sort(); //sort them alphabetically - //Now add the items to the lists - appM->clear(); - dirM->clear(); - audioM->clear(); - videoM->clear(); - pictureM->clear(); - docM->clear(); - otherM->clear(); - for(int i=0; i<favitems.length(); i++){ - QString type = favitems[i].section("::::",1,1); - QString name = favitems[i].section("::::",0,0); - QString path = favitems[i].section("::::",2,50); - if(type=="app"){ - //Add it to appM - bool ok = false; - XDGDesktop df(path); - if(df.isValid() && !df.isHidden){ - appM->addAction( newAction(df.filePath, df.name, LXDG::findIcon(df.icon, ":/images/default-application.png")) ); - } - }else if(type=="dir"){ - //Add it to dirM - dirM->addAction( newAction(path, name, LXDG::findIcon("folder","")) ); - }else if(type.startsWith("audio/")){ - //Add it to audioM - audioM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) ); - }else if(type.startsWith("video/")){ - //Add it to videoM - videoM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) ); - }else if(type.startsWith("image/")){ - //Add it to pictureM - if(LUtils::imageExtensions().contains(path.section("/",-1).section(".",-1).toLower()) ){ - pictureM->addAction( newAction(path, name, QIcon(path)) ); - }else{ - pictureM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) ); - } - }else if(type.startsWith("text/")){ - //Add it to docM - docM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) ); - }else{ - //Add it to otherM - otherM->addAction( newAction(path, name, LXDG::findMimeIcon(type)) ); - } - - } - - //Now update the file menu as appropriate - fileM->clear(); - if(!audioM->isEmpty()){ fileM->addMenu(audioM); } - if(!docM->isEmpty()){ fileM->addMenu(docM); } - if(!pictureM->isEmpty()){ fileM->addMenu(pictureM); } - if(!videoM->isEmpty()){ fileM->addMenu(videoM); } - if(!otherM->isEmpty()){ fileM->addMenu(otherM); } - //Check for a single submenu, and skip the main if need be - disconnect(fileB->menu(), SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()) ); - if(fileM->actions().length()==1){ - if(!audioM->isEmpty()){ fileB->setMenu(audioM); } - else if(!pictureM->isEmpty()){ fileB->setMenu(pictureM); } - else if(!videoM->isEmpty()){ fileB->setMenu(videoM); } - else if(!docM->isEmpty()){ fileB->setMenu(docM); } - else if(!otherM->isEmpty()){ fileB->setMenu(otherM); } - }else{ - fileB->setMenu(fileM); - } - connect(fileB->menu(), SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - - //Setup the visibility of the buttons - appB->setVisible( !appM->isEmpty() ); - dirB->setVisible( !dirM->isEmpty() ); - fileB->setVisible( !fileM->isEmpty() ); -} - -void LDeskBarPlugin::updateIcons(){ - //Set all the text/icons - appB->setIcon( LXDG::findIcon("favorites", "") ); - appB->setToolTip(tr("Favorite Applications")); - dirB->setIcon( LXDG::findIcon("folder", "") ); - dirB->setToolTip(tr("Favorite Folders")); - audioM->setTitle( tr("Audio") ); - audioM->setIcon( LXDG::findIcon("audio-x-generic","") ); - videoM->setTitle( tr("Video") ); - videoM->setIcon( LXDG::findIcon("video-x-generic","") ); - pictureM->setTitle( tr("Pictures") ); - pictureM->setIcon( LXDG::findIcon("image-x-generic","") ); - otherM->setTitle( tr("Other Files") ); - otherM->setIcon( LXDG::findIcon("unknown","") ); - docM->setTitle( tr("Documents") ); - docM->setIcon( LXDG::findIcon("x-office-document","") ); - fileB->setIcon( LXDG::findIcon("document-multiple", "") ); - fileB->setToolTip(tr("Favorite Files") ); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopbar/LDeskBar.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopbar/LDeskBar.h deleted file mode 100644 index 74f41230..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopbar/LDeskBar.h +++ /dev/null @@ -1,88 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2012, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin displays the contents of the user's home directory -// as organized within a couple buttons on the panel (apps, dirs, files) -//=========================================== -#ifndef _LUMINA_DESKTOP_DESKBAR_H -#define _LUMINA_DESKTOP_DESKBAR_H - -// Qt includes -#include <QWidget> -#include <QString> -#include <QAction> -#include <QMenu> -#include <QProcess> -#include <QTimer> -#include <QFileSystemWatcher> -#include <QHBoxLayout> -#include <QIcon> -#include <QToolButton> -#include <QDebug> - -// libLumina includes -#include <LuminaXDG.h> - -// local includes -//#include "../LTBWidget.h" -#include "../LPPlugin.h" - -class LDeskBarPlugin : public LPPlugin{ - Q_OBJECT -public: - LDeskBarPlugin(QWidget* parent=0, QString id = "desktopbar", bool horizontal=true); - ~LDeskBarPlugin(); - -private: - QFileSystemWatcher *watcher; - //Special toolbuttons and menus - QToolButton *appB, *fileB, *dirB; - QMenu *appM, *dirM, *audioM, *videoM, *pictureM, *fileM, *otherM, *docM; - QList<QToolButton*> APPLIST; - QDateTime lastHomeUpdate; - - void initializeDesktop(); - //bool readDesktopFile(QString path, QString &name, QString &iconpath); - - QAction* newAction(QString filepath, QString name, QString iconpath); - QAction* newAction(QString filepath, QString name, QIcon icon); - - //void updateMenu(QMenu* menu, QFileInfoList files, bool trim = true); - - -private slots: - void ActionTriggered(QAction* act); - void filechanged(QString); - void updateFiles(); - void updateIcons(); - -public slots: - void LocaleChange(){ - updateIcons(); - updateFiles(); - } - - void OrientationChange(){ - QSize sz; - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); - sz = QSize(this->height(), this->height()); - }else{ - this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - sz = QSize(this->width(), this->width()); - } - appB->setIconSize(sz); - fileB->setIconSize(sz); - dirB->setIconSize(sz); - for(int i=0; i<APPLIST.length(); i++){ - APPLIST[i]->setIconSize(sz); - } - this->layout()->update(); - } -}; - - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp deleted file mode 100644 index 8e0a9d28..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Susanne Jaeckel -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LDesktopSwitcher.h" -#include <LSession.h> - -LDesktopSwitcher::LDesktopSwitcher(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal) { - iconOld = -1; - this->setStyleSheet( "QToolButton::menu-indicator{ image: none; } QToolButton{padding: 0px;}"); - //Setup the widget - label = new QToolButton(this); - label->setPopupMode(QToolButton::DelayedPopup); - label->setAutoRaise(true); - label->setToolButtonStyle(Qt::ToolButtonIconOnly); - label->setIcon( LXDG::findIcon("format-view-carousel", "preferences-desktop-display") ); - label->setToolTip(QString("Workspace 1")); - connect(label, SIGNAL(clicked()), this, SLOT(openMenu())); - menu = new QMenu(this); - connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(menuActionTriggered(QAction*))); - connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - label->setMenu(menu); - this->layout()->addWidget(label); - - // Maybe a timer should be set to set the toolTip of the button, - // becasue the workspace could be switched via Keyboard-shortcuts ... - - QTimer::singleShot(500, this, SLOT(createMenu()) ); //needs a delay to make sure it works right the first time - QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust icon size - - //Process the signal which is sent when the workspace is changed via keyboard-shortcuts - connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(updateWorkspaceMenu())); -} - -LDesktopSwitcher::~LDesktopSwitcher(){ -} -/* MOVED THESE FUNCTIONS TO LIBLUMINA (LuminaX11.h) -- Ken Moore 5/9/14 -void LDesktopSwitcher::setNumberOfDesktops(int number) { - Display *display = QX11Info::display(); - Window rootWindow = QX11Info::appRootWindow(); - - Atom atom = XInternAtom(display, "_NET_NUMBER_OF_DESKTOPS", False); - XEvent xevent; - xevent.type = ClientMessage; - xevent.xclient.type = ClientMessage; - xevent.xclient.display = display; - xevent.xclient.window = rootWindow; - xevent.xclient.message_type = atom; - xevent.xclient.format = 32; - xevent.xclient.data.l[0] = number; - xevent.xclient.data.l[1] = CurrentTime; - xevent.xclient.data.l[2] = 0; - xevent.xclient.data.l[3] = 0; - xevent.xclient.data.l[4] = 0; - XSendEvent(display, rootWindow, False, SubstructureNotifyMask | SubstructureRedirectMask, &xevent); - - XFlush(display); -} - -void LDesktopSwitcher::setCurrentDesktop(int number) { - Display *display = QX11Info::display(); - Window rootWindow = QX11Info::appRootWindow(); - - Atom atom = XInternAtom(display, "_NET_CURRENT_DESKTOP", False); - XEvent xevent; - xevent.type = ClientMessage; - xevent.xclient.type = ClientMessage; - xevent.xclient.display = display; - xevent.xclient.window = rootWindow; - xevent.xclient.message_type = atom; - xevent.xclient.format = 32; - xevent.xclient.data.l[0] = number; - xevent.xclient.data.l[1] = CurrentTime; - xevent.xclient.data.l[2] = 0; - xevent.xclient.data.l[3] = 0; - xevent.xclient.data.l[4] = 0; - XSendEvent(display, rootWindow, False, SubstructureNotifyMask | SubstructureRedirectMask, &xevent); - - XFlush(display); -} - -int LDesktopSwitcher::getNumberOfDesktops() { - int number = -1; - Atom a = XInternAtom(QX11Info::display(), "_NET_NUMBER_OF_DESKTOPS", true); - Atom realType; - int format; - unsigned long num, bytes; - unsigned char *data = 0; - int status = XGetWindowProperty(QX11Info::display(), QX11Info::appRootWindow(), a, 0L, (~0L), - false, AnyPropertyType, &realType, &format, &num, &bytes, &data); - if( (status >= Success) && (num > 0) ){ - number = *data; - XFree(data); - } - return number; -} - -int LDesktopSwitcher::getCurrentDesktop() { - int number = -1; - Atom a = XInternAtom(QX11Info::display(), "_NET_CURRENT_DESKTOP", true); - Atom realType; - int format; - unsigned long num, bytes; - unsigned char *data = 0; - int status = XGetWindowProperty(QX11Info::display(), QX11Info::appRootWindow(), a, 0L, (~0L), - false, AnyPropertyType, &realType, &format, &num, &bytes, &data); - if( (status >= Success) && (num > 0) ){ - number = *data; - XFree(data); - } - return number; -} */ - -void LDesktopSwitcher::openMenu(){ - //Make sure the menu is refreshed right before it opens - createMenu(); - label->showMenu(); -} - -QAction* LDesktopSwitcher::newAction(int what, QString name) { - QAction *act = new QAction(LXDG::findIcon("preferences-desktop-display", ""), name, this); - act->setWhatsThis(QString::number(what)); - return act; -} - -void LDesktopSwitcher::createMenu() { - int cur = LSession::handle()->XCB->CurrentWorkspace(); //current desktop number - int tot = LSession::handle()->XCB->NumberOfWorkspaces(); //total number of desktops - //qDebug() << "-- vor getCurrentDesktop SWITCH"; - qDebug() << "Virtual Desktops:" << tot << cur; - menu->clear(); - for (int i = 0; i < tot; i++) { - QString name = QString(tr("Workspace %1")).arg( QString::number(i+1) ); - if(i == cur){ name.prepend("*"); name.append("*");} //identify which desktop this is currently - menu->addAction(newAction(i, name)); - } - label->setToolTip(QString(tr("Workspace %1")).arg(QString::number(cur + 1))); -} - -void LDesktopSwitcher::menuActionTriggered(QAction* act) { - LSession::handle()->XCB->SetCurrentWorkspace(act->whatsThis().toInt()); -} - -void LDesktopSwitcher::updateWorkspaceMenu() { - createMenu(); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.h deleted file mode 100644 index 69fe46da..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/desktopswitcher/LDesktopSwitcher.h +++ /dev/null @@ -1,73 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Susanne Jaeckel -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_SWITCHER_H -#define _LUMINA_DESKTOP_SWITCHER_H - -#include <QTimer> -#include <QWidget> -#include <QString> -//#include <QX11Info> -#include <QMenu> -#include <QToolButton> - -#include <LUtils.h> -#include <LuminaXDG.h> -#include <LuminaX11.h> - -//#include "../LTBWidget.h" -#include "../LPPlugin.h" - -//#include <X11/Xlib.h> -//#include <X11/Xutil.h> -//#include <X11/Xatom.h> - -class LDesktopSwitcher : public LPPlugin{ - Q_OBJECT -public: - LDesktopSwitcher(QWidget *parent = 0, QString id = "desktopswitcher", bool horizontal=true); - ~LDesktopSwitcher(); - -private: - QTimer *timer; - QToolButton *label; - QMenu *menu; - int iconOld; - - //void setNumberOfDesktops(int); - //void setCurrentDesktop(int); - //int getNumberOfDesktops(); - //int getCurrentDesktop(); - - - QAction* newAction(int, QString); - -private slots: - void openMenu(); - void createMenu(); - void menuActionTriggered(QAction*); - void updateWorkspaceMenu(); - -public slots: - void LocaleChange(){ - createMenu(); - } - - void OrientationChange(){ - QSize sz; - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); - sz = QSize(this->height(), this->height()); - }else{ - this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - sz = QSize(this->width(), this->width()); - } - label->setIconSize(sz); - this->layout()->update(); - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/jsonmenu/PPJsonMenu.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/jsonmenu/PPJsonMenu.cpp deleted file mode 100644 index 14880f9b..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/jsonmenu/PPJsonMenu.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//=========================================== -// 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-unified/src-DE/panel-plugins/jsonmenu/PPJsonMenu.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/jsonmenu/PPJsonMenu.h deleted file mode 100644 index d0827fd2..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/jsonmenu/PPJsonMenu.h +++ /dev/null @@ -1,42 +0,0 @@ -//=========================================== -// 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 diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/line/LLine.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/line/LLine.h deleted file mode 100644 index 94de486e..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/line/LLine.h +++ /dev/null @@ -1,40 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is a generic line separator for the panel -//=========================================== -#ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_LINE_H -#define _LUMINA_DESKTOP_PANEL_PLUGIN_LINE_H - -#include "../LPPlugin.h" -#include <QFrame> - -class LLinePlugin : public LPPlugin{ - Q_OBJECT -private: - QFrame *line; - -public: - LLinePlugin(QWidget *parent=0, QString id="spacer", bool horizontal=true) : LPPlugin(parent, id, horizontal){ - line = new QFrame(this); - line->setObjectName("LuminaPanelLine"); - this->layout()->addWidget(line); - OrientationChange(); - } - ~LLinePlugin(){} - -public slots: - void OrientationChange(){ - if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal - line->setFrameShape(QFrame::VLine); - }else{ //vertical - line->setFrameShape(QFrame::HLine); - } - } -}; - - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/panel-plugins.pri b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/panel-plugins.pri deleted file mode 100644 index c40c4725..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/panel-plugins.pri +++ /dev/null @@ -1,57 +0,0 @@ -#Lumina Desktop Panel Plugin files - -SOURCES += $$PWD/userbutton/LUserButton.cpp \ - $$PWD/userbutton/UserWidget.cpp \ - $$PWD/userbutton/UserItemWidget.cpp \ - $$PWD/desktopbar/LDeskBar.cpp \ - $$PWD/taskmanager/LTaskManagerPlugin.cpp \ - $$PWD/taskmanager/LTaskButton.cpp \ - $$PWD/systemtray/LSysTray.cpp \ - $$PWD/systemtray/TrayIcon.cpp \ - $$PWD/clock/LClock.cpp \ - $$PWD/battery/LBattery.cpp \ - $$PWD/desktopswitcher/LDesktopSwitcher.cpp \ - $$PWD/systemdashboard/LSysDashboard.cpp \ - $$PWD/systemdashboard/SysMenuQuick.cpp \ - $$PWD/showdesktop/LHomeButton.cpp \ - $$PWD/appmenu/LAppMenuPlugin.cpp \ - $$PWD/applauncher/AppLaunchButton.cpp \ - $$PWD/systemstart/LStartButton.cpp \ - $$PWD/systemstart/StartMenu.cpp \ - $$PWD/systemstart/ItemWidget.cpp \ - $$PWD/audioplayer/LPAudioPlayer.cpp \ - $$PWD/audioplayer/PPlayerWidget.cpp \ - $$PWD/jsonmenu/PPJsonMenu.cpp - -HEADERS += $$PWD/RotateToolButton.h \ - $$PWD/userbutton/LUserButton.h \ - $$PWD/userbutton/UserWidget.h \ - $$PWD/userbutton/UserItemWidget.h \ - $$PWD/desktopbar/LDeskBar.h \ - $$PWD/systemtray/LSysTray.h \ - $$PWD/systemtray/TrayIcon.h \ - $$PWD/spacer/LSpacer.h \ - $$PWD/line/LLine.h \ - $$PWD/clock/LClock.h \ - $$PWD/battery/LBattery.h \ - $$PWD/desktopswitcher/LDesktopSwitcher.h \ - $$PWD/taskmanager/LTaskManagerPlugin.h \ - $$PWD/taskmanager/LTaskButton.h \ - $$PWD/systemdashboard/LSysDashboard.h \ - $$PWD/systemdashboard/SysMenuQuick.h \ - $$PWD/showdesktop/LHomeButton.h \ - $$PWD/appmenu/LAppMenuPlugin.h \ - $$PWD/applauncher/AppLaunchButton.h \ - $$PWD/systemstart/LStartButton.h \ - $$PWD/systemstart/StartMenu.h \ - $$PWD/systemstart/ItemWidget.h \ - $$PWD/audioplayer/LPAudioPlayer.h \ - $$PWD/audioplayer/PPlayerWidget.h \ - $$PWD/jsonmenu/PPJsonMenu.h -# $$PWD/quickcontainer/QuickPPlugin.h - -FORMS += $$PWD/userbutton/UserWidget.ui \ - $$PWD/systemdashboard/SysMenuQuick.ui \ - $$PWD/systemstart/StartMenu.ui \ - $$PWD/audioplayer/PPlayerWidget.ui - diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/quickcontainer/QuickPPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/quickcontainer/QuickPPlugin.h deleted file mode 100644 index 6f61c4d5..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/quickcontainer/QuickPPlugin.h +++ /dev/null @@ -1,43 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is a simple container for a QtQuick plugin -//=========================================== -#ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_QUICK_H -#define _LUMINA_DESKTOP_PANEL_PLUGIN_QUICK_H - -#include <QQuickWidget> -#include <QVBoxLayout> -#include "../LPPlugin.h" - -#include <LUtils.h> -#include <QDebug> - -class QuickPPlugin : public LPPlugin{ - Q_OBJECT -public: - QuickPPlugin(QWidget* parent, QString ID, bool horizontal) : LPPlugin(parent, ID){ - container = new QQuickWidget(this); - container->setResizeMode(QQuickWidget::SizeRootObjectToView); - this->layout()->addWidget(container); - horizontal = true; //just to silence compiler warning - container->setSource(QUrl::fromLocalFile( LUtils::findQuickPluginFile(ID.section("---",0,0)) )); - } - - ~QuickPPlugin(){} - -private: - QQuickWidget *container; - -private slots: - void statusChange(QQuickWidget::Status status){ - if(status == QQuickWidget::Error){ - qDebug() << "Quick Widget Error:" << this->type(); - } - } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/showdesktop/LHomeButton.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/showdesktop/LHomeButton.cpp deleted file mode 100644 index 6c259b16..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/showdesktop/LHomeButton.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LHomeButton.h" -#include "../../LSession.h" - -#include <LuminaX11.h> - -LHomeButtonPlugin::LHomeButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - button = new QToolButton(this); - button->setAutoRaise(true); - button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - - connect(button, SIGNAL(clicked()), this, SLOT(showDesktop())); - this->layout()->setContentsMargins(0,0,0,0); - this->layout()->addWidget(button); - - QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes -} - -LHomeButtonPlugin::~LHomeButtonPlugin(){ - -} - -void LHomeButtonPlugin::updateButtonVisuals(){ - button->setIcon( LXDG::findIcon("user-desktop", "") ); -} - -// ======================== -// PRIVATE FUNCTIONS -// ======================== -void LHomeButtonPlugin::showDesktop(){ - QList<WId> wins = LSession::handle()->XCB->WindowList(); - for(int i=0; i<wins.length(); i++){ - if( LXCB::INVISIBLE != LSession::handle()->XCB->WindowState(wins[i]) ){ - LSession::handle()->XCB->MinimizeWindow(wins[i]); - } - } -} - diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/showdesktop/LHomeButton.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/showdesktop/LHomeButton.h deleted file mode 100644 index 74aaf4fb..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/showdesktop/LHomeButton.h +++ /dev/null @@ -1,62 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This panel plugin is a simple button to hide all windows so the desktop is visible -//=========================================== -#ifndef _LUMINA_DESKTOP_GO_HOME_PLUGIN_H -#define _LUMINA_DESKTOP_GO_HOME_PLUGIN_H - -// Qt includes -#include <QToolButton> -#include <QString> -#include <QWidget> - - -// Lumina-desktop includes -#include "../LPPlugin.h" //main plugin widget - -// libLumina includes -#include "LuminaXDG.h" - -// PANEL PLUGIN BUTTON -class LHomeButtonPlugin : public LPPlugin{ - Q_OBJECT - -public: - LHomeButtonPlugin(QWidget *parent = 0, QString id = "homebutton", bool horizontal=true); - ~LHomeButtonPlugin(); - -private: - QToolButton *button; - - void updateButtonVisuals(); - -private slots: - void showDesktop(); - -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()) ); - } - this->layout()->update(); - updateButtonVisuals(); - } - - void LocaleChange(){ - updateButtonVisuals(); - } - - void ThemeChange(){ - updateButtonVisuals(); - } -}; - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/spacer/LSpacer.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/spacer/LSpacer.h deleted file mode 100644 index 1e60c519..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/spacer/LSpacer.h +++ /dev/null @@ -1,34 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is a generic invisible spacer for the panel -//=========================================== -#ifndef _LUMINA_DESKTOP_PANEL_PLUGIN_SPACER_H -#define _LUMINA_DESKTOP_PANEL_PLUGIN_SPACER_H - -#include "../LPPlugin.h" - -class LSpacerPlugin : public LPPlugin{ - Q_OBJECT -public: - LSpacerPlugin(QWidget *parent=0, QString id="spacer", bool horizontal=true) : LPPlugin(parent, id, horizontal){ - if(horizontal){ this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); } - else{ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); } - } - ~LSpacerPlugin(){} - -public slots: - void OrientationChange(){ - if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal - this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - }else{ //vertical - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - } - } -}; - - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/LSysDashboard.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/LSysDashboard.cpp deleted file mode 100644 index b9d70e97..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/LSysDashboard.cpp +++ /dev/null @@ -1,91 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LSysDashboard.h" - -LSysDashboard::LSysDashboard(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - upTimer = new QTimer(this); - upTimer->setInterval(10000); //10 second update ping - connect(upTimer, SIGNAL(timeout()), this, SLOT(updateIcon())); - 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); - connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - sysmenu = new LSysMenuQuick(this); - connect(sysmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) ); - mact = new QWidgetAction(this); - mact->setDefaultWidget(sysmenu); - menu->addAction(mact); - - button->setMenu(menu); - QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes -} - -LSysDashboard::~LSysDashboard(){ - -} - -// ======================== -// PRIVATE FUNCTIONS -// ======================== -void LSysDashboard::updateIcon(bool force){ - //For the visual, show battery state only if important - static bool batcharging = false; - QPixmap pix; - button->setToolTip(tr("System Dashboard")); - if(LOS::hasBattery()){ - int bat = LOS::batteryCharge(); - bool charging = LOS::batteryIsCharging(); - //Set the icon as necessary - if(charging && !batcharging){ - //Charging and just plugged in - if(bat < 15){ button->setIcon( LXDG::findIcon("battery-charging-low","") ); QTimer::singleShot(5000, this, SLOT(resetIcon()));} - else if(bat < 30){ button->setIcon( LXDG::findIcon("battery-charging-caution","") ); QTimer::singleShot(5000, this, SLOT(resetIcon()));} - else if(force || button->icon().isNull()){ resetIcon(); } - }else if(!charging){ - //Not charging (critical level or just unplugged) - if(bat<5){ button->setIcon( LXDG::findIcon("battery-missing","") ); } - else if(bat < 15){ button->setIcon( LXDG::findIcon("battery-low","") ); QTimer::singleShot(5000, this, SLOT(resetIcon())); } - else if(bat < 30 && batcharging){ button->setIcon( LXDG::findIcon("battery-caution","") ); QTimer::singleShot(5000, this, SLOT(resetIcon()));} - else if(bat < 50 && batcharging){ button->setIcon( LXDG::findIcon("battery-040","")); QTimer::singleShot(5000, this, SLOT(resetIcon()));} - else if(bat < 70 && batcharging){ button->setIcon( LXDG::findIcon("battery-060","")); QTimer::singleShot(5000, this, SLOT(resetIcon()));} - else if(bat < 90 && batcharging){ button->setIcon( LXDG::findIcon("battery-080","")); QTimer::singleShot(5000, this, SLOT(resetIcon()));} - else if(batcharging){ button->setIcon( LXDG::findIcon("battery-100","")); QTimer::singleShot(5000, this, SLOT(resetIcon()));} - else if(force || button->icon().isNull()){ resetIcon(); } - }else if(force || button->icon().isNull()){ - //Otherwise just use the default icon - resetIcon(); - } - //Save the values for comparison later - batcharging = charging; - if( !upTimer->isActive() ){ upTimer->start(); } //only use the timer if a battery is present - - // No battery - just use/set the normal icon - }else if(force || button->icon().isNull()){ - resetIcon(); - if(upTimer->isActive() ){ upTimer->stop(); } //no battery available - no refresh timer needed - } - -} - -void LSysDashboard::resetIcon(){ - button->setIcon( LXDG::findIcon("arrow-down-drop-circle","")); -} - -void LSysDashboard::openMenu(){ - sysmenu->UpdateMenu(); - button->showMenu(); -} - -void LSysDashboard::closeMenu(){ - menu->hide(); -} - diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/LSysDashboard.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/LSysDashboard.h deleted file mode 100644 index 782fc4e6..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/LSysDashboard.h +++ /dev/null @@ -1,76 +0,0 @@ -//=========================================== -// 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 control different system settings -// For example: screen brightness, audio volume, workspace, and battery -//=========================================== -#ifndef _LUMINA_DESKTOP_SYSTEM_DASHBOARD_H -#define _LUMINA_DESKTOP_SYSTEM_DASHBOARD_H - -//Qt includes - -#include <QHBoxLayout> -#include <QDebug> -#include <QCoreApplication> -#include <QPainter> -#include <QPixmap> -#include <QWidgetAction> -#include <QMenu> -#include <QTimer> -#include <QToolButton> - -//libLumina includes -#include <LuminaOS.h> -#include <LuminaXDG.h> - -//Local includes -#include "../LPPlugin.h" -#include "SysMenuQuick.h" - -class LSysDashboard : public LPPlugin{ - Q_OBJECT -public: - LSysDashboard(QWidget *parent = 0, QString id="systemdashboard", bool horizontal=true); - ~LSysDashboard(); - -private: - QMenu *menu; - QWidgetAction *mact; - LSysMenuQuick *sysmenu; - QToolButton *button; - QTimer *upTimer; - -private slots: - void updateIcon(bool force = false); - void resetIcon(); - void openMenu(); - void closeMenu(); - -public slots: - void LocaleChange(){ - updateIcon(true); - sysmenu->UpdateMenu(); - } - - void ThemeChange(){ - updateIcon(true); - sysmenu->UpdateMenu(); - } - - 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()) ); - } - updateIcon(true); //force icon refresh - this->layout()->update(); - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.cpp deleted file mode 100644 index 1d699ea9..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.cpp +++ /dev/null @@ -1,211 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "SysMenuQuick.h" -#include "ui_SysMenuQuick.h" - -#include "../../LSession.h" -#include <LuminaX11.h> - -LSysMenuQuick::LSysMenuQuick(QWidget *parent) : QWidget(parent), ui(new Ui::LSysMenuQuick){ - ui->setupUi(this); - brighttimer = new QTimer(this); - brighttimer->setSingleShot(true); - brighttimer->setInterval(50); //50ms delay in setting the new value - //Now reset the initial saved settings (this is handles by the LOS/session now - 4/22/15) - firstrun = true; - UpdateMenu(); //do this once before all the signals/slots are connected below - firstrun = false; - //Now setup the connections - connect(ui->slider_volume, SIGNAL(valueChanged(int)), this, SLOT(volSliderChanged()) ); - connect(ui->slider_brightness, SIGNAL(valueChanged(int)), this, SLOT(brightSliderChanged()) ); - connect(ui->tool_wk_prev, SIGNAL(clicked()), this, SLOT(prevWorkspace()) ); - connect(ui->tool_wk_next, SIGNAL(clicked()), this, SLOT(nextWorkspace()) ); - connect(ui->tool_logout, SIGNAL(clicked()), this, SLOT(startLogout()) ); - connect(ui->tool_vol_mixer, SIGNAL(clicked()), this, SLOT(startMixer()) ); - connect(brighttimer, SIGNAL(timeout()), this, SLOT(setCurrentBrightness()) ); - connect(ui->combo_locale, SIGNAL(currentIndexChanged(int)), this, SLOT(changeLocale()) ); - //And setup the default icons - ui->label_bright_icon->setPixmap( LXDG::findIcon("preferences-system-power-management","").pixmap(ui->label_bright_icon->maximumSize()) ); - ui->tool_wk_prev->setIcon( LXDG::findIcon("go-previous-view","")); - ui->tool_wk_next->setIcon( LXDG::findIcon("go-next-view","") ); - ui->tool_logout->setIcon( LXDG::findIcon("system-log-out","") ); -} - -LSysMenuQuick::~LSysMenuQuick(){ - -} - -void LSysMenuQuick::UpdateMenu(){ - ui->retranslateUi(this); - //Audio Volume - int val = LOS::audioVolume(); - QIcon ico; - if(val > 66){ ico= LXDG::findIcon("audio-volume-high",""); } - else if(val > 33){ ico= LXDG::findIcon("audio-volume-medium",""); } - else if(val > 0){ ico= LXDG::findIcon("audio-volume-low",""); } - else{ ico= LXDG::findIcon("audio-volume-muted",""); } - bool hasMixer = LOS::hasMixerUtility(); - ui->label_vol_icon->setVisible(!hasMixer); - ui->tool_vol_mixer->setVisible(hasMixer); - if(!hasMixer){ ui->label_vol_icon->setPixmap( ico.pixmap(ui->label_vol_icon->maximumSize()) ); } - else{ ui->tool_vol_mixer->setIcon(ico); } - QString txt = QString::number(val)+"%"; - if(val<100){ txt.prepend(" "); } //make sure no widget resizing - ui->label_vol_text->setText(txt); - if(ui->slider_volume->value()!= val){ ui->slider_volume->setValue(val); } - //Screen Brightness - val = LOS::ScreenBrightness(); - if(val < 0){ - //No brightness control - hide it - ui->group_brightness->setVisible(false); - }else{ - ui->group_brightness->setVisible(true); - txt = QString::number(val)+"%"; - if(val<100){ txt.prepend(" "); } //make sure no widget resizing - ui->label_bright_text->setText(txt); - if(ui->slider_brightness->value()!=val){ ui->slider_brightness->setValue(val); } - } - - //Do any one-time checks - if(firstrun){ - hasBat = LOS::hasBattery(); //No need to check this more than once - will not change in the middle of a session - //Current Locale - QStringList locales = LUtils::knownLocales(); - ui->combo_locale->clear(); - QLocale curr; - for(int i=0; i<locales.length(); i++){ - QLocale loc( (locales[i]=="pt") ? "pt_PT" : locales[i] ); - ui->combo_locale->addItem(loc.nativeLanguageName()+" ("+locales[i]+")", locales[i]); //Make the display text prettier later - if(locales[i] == curr.name() || locales[i] == curr.name().section("_",0,0) ){ - //Current Locale - ui->combo_locale->setCurrentIndex(ui->combo_locale->count()-1); //the last item in the list right now - } - } - ui->group_locale->setVisible(locales.length() > 1); - } - - //Battery Status - if(hasBat){ - ui->group_battery->setVisible(true); - val = LOS::batteryCharge(); - if(LOS::batteryIsCharging()){ - if(val < 15){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-low","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 30){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-caution","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 50){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-040","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 70){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-060","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 90){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-080","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else{ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging","").pixmap(ui->label_bat_icon->maximumSize()) ); } - ui->label_bat_text->setText( QString("%1%\n(%2)").arg(QString::number(val), tr("connected")) ); - }else{ - if(val < 1){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-missing","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 15){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-low","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 30){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-caution","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 50){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-040","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 70){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-060","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 90){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-080","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else{ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-100","").pixmap(ui->label_bat_icon->maximumSize()) ); } - ui->label_bat_text->setText( QString("%1%\n(%2)").arg(QString::number(val), getRemainingTime()) ); - } - }else{ - ui->group_battery->setVisible(false); - } - //Workspace - val = LSession::handle()->XCB->CurrentWorkspace(); - int tot = LSession::handle()->XCB->NumberOfWorkspaces(); - ui->group_workspace->setVisible(val>=0 && tot>1); - ui->label_wk_text->setText( QString(tr("%1 of %2")).arg(QString::number(val+1), QString::number(tot)) ); -} - -void LSysMenuQuick::volSliderChanged(){ - int val = ui->slider_volume->value(); - LOS::setAudioVolume(val); - QString txt = QString::number(val)+"%"; - if(val<100){ txt.prepend(" "); } //make sure no widget resizing - ui->label_vol_text->setText( txt ); - if(val > 66){ ui->label_vol_icon->setPixmap( LXDG::findIcon("audio-volume-high","").pixmap(ui->label_vol_icon->maximumSize()) ); } - else if(val > 33){ ui->label_vol_icon->setPixmap( LXDG::findIcon("audio-volume-medium","").pixmap(ui->label_vol_icon->maximumSize()) ); } - else if(val > 0){ ui->label_vol_icon->setPixmap( LXDG::findIcon("audio-volume-low","").pixmap(ui->label_vol_icon->maximumSize()) ); } - else{ ui->label_vol_icon->setPixmap( LXDG::findIcon("audio-volume-muted","").pixmap(ui->label_vol_icon->maximumSize()) ); } -} - -void LSysMenuQuick::startMixer(){ - emit CloseMenu(); - LOS::startMixerUtility(); -} - -void LSysMenuQuick::brightSliderChanged(){ - //Brightness controls cannot operate extremely quickly - combine calls as necessary - if(brighttimer->isActive()){ brighttimer->stop(); } - brighttimer->start(); - //*DO* update the label right away - int val = ui->slider_brightness->value(); - QString txt = QString::number(val)+"%"; - if(val<100){ txt.prepend(" "); } //make sure no widget resizing - ui->label_bright_text->setText( txt ); -} - -void LSysMenuQuick::setCurrentBrightness(){ - int val = ui->slider_brightness->value(); - LOS::setScreenBrightness(val); - QString txt = QString::number(val)+"%"; - if(val<100){ txt.prepend(" "); } //make sure no widget resizing - ui->label_bright_text->setText( txt ); -} - -void LSysMenuQuick::nextWorkspace(){ - int cur = LSession::handle()->XCB->CurrentWorkspace(); - int tot = LSession::handle()->XCB->NumberOfWorkspaces(); - //qDebug()<< "Next Workspace:" << cur << tot; - cur++; - if(cur>=tot){ cur = 0; } //back to beginning - //qDebug() << " - New Current:" << cur; - LSession::handle()->XCB->SetCurrentWorkspace(cur); -ui->label_wk_text->setText( QString(tr("%1 of %2")).arg(QString::number(cur+1), QString::number(tot)) ); -} - -void LSysMenuQuick::prevWorkspace(){ - int cur = LSession::handle()->XCB->CurrentWorkspace(); - int tot = LSession::handle()->XCB->NumberOfWorkspaces(); - cur--; - if(cur<0){ cur = tot-1; } //back to last - LSession::handle()->XCB->SetCurrentWorkspace(cur); - ui->label_wk_text->setText( QString(tr("%1 of %2")).arg(QString::number(cur+1), QString::number(tot)) ); -} - -QString LSysMenuQuick::getRemainingTime(){ - int secs = LOS::batterySecondsLeft(); - if(secs < 0){ return "??"; } - QString rem; //remaining - if(secs > 3600){ - int hours = secs/3600; - rem.append( QString::number(hours)+"h "); - secs = secs - (hours*3600); - } - if(secs > 60){ - int min = secs/60; - rem.append( QString::number(min)+"m "); - secs = secs - (min*60); - } - if(secs > 0){ - rem.append( QString::number(secs)+"s"); - }else{ - rem.append( "0s" ); - } - return rem; -} - -void LSysMenuQuick::startLogout(){ - emit CloseMenu(); - LSession::handle()->systemWindow(); -} - -void LSysMenuQuick::changeLocale(){ - //Get the currently selected Locale - QString locale = ui->combo_locale->currentData().toString(); - emit CloseMenu(); - LSession::handle()->switchLocale(locale); -}
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.h deleted file mode 100644 index a300b5b1..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.h +++ /dev/null @@ -1,54 +0,0 @@ -//=========================================== -// 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 control different system settings -// For example: screen brightness, audio volume, workspace, and battery -//=========================================== -#ifndef _LUMINA_PANEL_QUICK_SYSTEM_MENU_H -#define _LUMINA_PANEL_QUICK_SYSTEM_MENU_H - -#include <QWidget> -#include <QSettings> -#include <QString> - -#include <LuminaOS.h> -#include <LuminaXDG.h> - -namespace Ui{ - class LSysMenuQuick; -}; - -class LSysMenuQuick : public QWidget{ - Q_OBJECT -public: - LSysMenuQuick(QWidget *parent=0); - ~LSysMenuQuick(); - - void UpdateMenu(); - -private: - Ui::LSysMenuQuick *ui; - QTimer *brighttimer; - bool firstrun, hasBat; - QString getRemainingTime(); //battery time left - -private slots: - void volSliderChanged(); - void brightSliderChanged(); //start the delay/collection timer - void setCurrentBrightness(); //perform the change - void startMixer(); - void nextWorkspace(); - void prevWorkspace(); - void startLogout(); - void changeLocale(); - - -signals: - void CloseMenu(); - -}; - -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.ui b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.ui deleted file mode 100644 index 26c32c74..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemdashboard/SysMenuQuick.ui +++ /dev/null @@ -1,400 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>LSysMenuQuick</class> - <widget class="QWidget" name="LSysMenuQuick"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>171</width> - <height>317</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <property name="styleSheet"> - <string notr="true">/*QGroupBox{ -border-radius: 5px; -border: 1px solid grey; -margin-top: 1ex; -} -QGroupBox::title{ -subcontrol-origin: margin; -subcontrol-position: top center; -padding: 0 3px; -background-color: rgba(255,255,255,255); -border-radius: 5px; -font: bold; -}*/</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>1</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>1</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <item> - <widget class="QGroupBox" name="group_volume"> - <property name="title"> - <string>System Volume</string> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QLabel" name="label_vol_icon"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="text"> - <string notr="true"/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_vol_mixer"> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolTip"> - <string>Launch Audio Mixer</string> - </property> - <property name="text"> - <string/> - </property> - <property name="iconSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="slider_volume"> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_vol_text"> - <property name="text"> - <string notr="true">100%</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="group_brightness"> - <property name="title"> - <string>Screen Brightness</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QLabel" name="label_bright_icon"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="text"> - <string notr="true"/> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="slider_brightness"> - <property name="minimum"> - <number>10</number> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_bright_text"> - <property name="text"> - <string notr="true">100%</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="group_battery"> - <property name="title"> - <string>Battery Status</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QLabel" name="label_bat_icon"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="text"> - <string notr="true"/> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_bat_text"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string notr="true">100% (Plugged in)</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="group_workspace"> - <property name="title"> - <string>Workspace</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QToolButton" name="tool_wk_prev"> - <property name="text"> - <string notr="true">prev</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_wk_text"> - <property name="text"> - <string notr="true">1 of 2</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_wk_next"> - <property name="text"> - <string notr="true">next</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="group_locale"> - <property name="title"> - <string>Locale</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QComboBox" name="combo_locale"/> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QToolButton" name="tool_logout"> - <property name="font"> - <font> - <pointsize>9</pointsize> - </font> - </property> - <property name="text"> - <string>Log Out</string> - </property> - <property name="iconSize"> - <size> - <width>22</width> - <height>22</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/ItemWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/ItemWidget.cpp deleted file mode 100644 index ea074a59..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/ItemWidget.cpp +++ /dev/null @@ -1,279 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "ItemWidget.h" -#include <LUtils.h> -#include <QMenu> -#include "../../LSession.h" - - -ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool goback) : QFrame(parent){ - createWidget(); - //Now fill it appropriately - bool inHome = type.endsWith("-home"); //internal code - if(inHome){ type = type.remove("-home"); } - if(itemPath.endsWith(".desktop") || type=="app"){ - XDGDesktop item(itemPath, this); - gooditem = item.isValid(); - //qDebug() << "Good Item:" << gooditem << itemPath; - if(gooditem){ - icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); - iconPath = item.icon; - text = item.name; - if(!item.genericName.isEmpty() && item.name!=item.genericName){ text.append("<br><i> -- "+item.genericName+"</i>"); } - name->setText(text); - name->setToolTip(item.comment); - setupActions(&item); - }else{ - return; - } - }else if(type=="dir"){ - actButton->setVisible(false); - if(itemPath.endsWith("/")){ itemPath.chop(1); } - if(goback){ - icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(64,64) ); - iconPath = "go-previous"; - text = tr("Go Back"); - name->setText( text ); - }else{ - icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); - iconPath = "folder"; - name->setText( itemPath.section("/",-1)); - text = itemPath.section("/",-1); - } - }else if(type.startsWith("chcat::::")){ - //Category given - actButton->setVisible(false); - iconPath = LXDG::DesktopCatToIcon(type.section("::::",1,50)); - if(goback){ iconPath = "go-previous"; type = "chcat::::"; itemPath = "<B>("+itemPath+")</B>"; } - icon->setPixmap( LXDG::findIcon(iconPath,"applications-other").pixmap(64,64) ); - name->setText(itemPath); - text = itemPath; - icon->setWhatsThis(type); - linkPath = type; - }else{ - actButton->setVisible(false); - if(itemPath.endsWith("/")){ itemPath.chop(1); } - if(QFileInfo(itemPath).isDir()){ - type = "dir"; - icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); - iconPath = "folder"; - }else if(LUtils::imageExtensions().contains(itemPath.section("/",-1).section(".",-1).toLower()) ){ - icon->setPixmap( QIcon(itemPath).pixmap(64,64) ); - }else{ - if( LUtils::isValidBinary(itemPath) ){ icon->setPixmap( LXDG::findIcon(type, "application-x-executable").pixmap(64,64) ); } - else{ icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1)).pixmap(64,64) ); } - } - name->setText( itemPath.section("/",-1) ); //this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); - text = itemPath.section("/",-1) ; - } - icon->setWhatsThis(itemPath); - if(!goback){ this->setWhatsThis(name->text()); } - isDirectory = (type=="dir"); //save this for later - if(LDesktopUtils::isFavorite(itemPath)){ - linkPath = itemPath; - isShortcut=true; - }else if( inHome ){//|| itemPath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ - isShortcut = true; - }else{ - isShortcut = false; - } - if(isShortcut && name->toolTip().isEmpty()){ - name->setToolTip(icon->whatsThis()); //also allow the user to see the full shortcut path - } - //Now setup the button appropriately - setupContextMenu(); -} - -// - Application constructor -ItemWidget::ItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(parent){ - createWidget(); - if(item==0){ gooditem = false; return; } - isDirectory = false; - if(LDesktopUtils::isFavorite(item->filePath)){ - linkPath = item->filePath; - isShortcut=true; - }else if( item->filePath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ - isShortcut = true; - }else{ - isShortcut = false; - } - if(isShortcut){ - name->setToolTip(icon->whatsThis()); //also allow the user to see the full shortcut path - } - //Now fill it appropriately - icon->setPixmap( LXDG::findIcon(item->icon,"preferences-system-windows-actions").pixmap(64,64) ); - text = item->name; - if(!item->genericName.isEmpty() && item->name!=item->genericName){ text.append("<br><i> -- "+item->genericName+"</i>"); } - name->setText(text); - name->setToolTip(item->comment); - this->setWhatsThis(item->name); - icon->setWhatsThis(item->filePath); - iconPath = item->icon; - //Now setup the buttons appropriately - setupContextMenu(); - setupActions(item); -} - -ItemWidget::~ItemWidget(){ - icon->setPixmap(QPixmap()); //make sure the pixmap is cleared from memory too - actButton->deleteLater(); - contextMenu->clear(); - contextMenu->deleteLater(); - if(actButton->menu()!=0){ - for(int i=0; i<actButton->menu()->actions().length(); i++){ - actButton->menu()->actions().at(i)->deleteLater(); - } - actButton->menu()->deleteLater(); - } - actButton->deleteLater(); - icon->deleteLater(); - name->deleteLater(); - menureset->deleteLater(); - linkPath.clear(); iconPath.clear(); text.clear(); -} - -void ItemWidget::triggerItem(){ - ItemClicked(); -} - -void ItemWidget::createWidget(){ - //Initialize the widgets - gooditem = true; - menuopen = false; - menureset = new QTimer(this); - menureset->setSingleShot(true); - menureset->setInterval(1000); //1 second - this->setContentsMargins(0,0,0,0); - contextMenu = new QMenu(this); - connect(contextMenu, SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) ); - connect(contextMenu, SIGNAL(aboutToHide()), this, SLOT(actionMenuClosed()) ); - actButton = new QToolButton(this); - actButton->setPopupMode(QToolButton::InstantPopup); - actButton->setArrowType(Qt::DownArrow); - icon = new QLabel(this); - name = new QLabel(this); - name->setWordWrap(true); - name->setTextFormat(Qt::RichText); - name->setTextInteractionFlags(Qt::NoTextInteraction); - //Add them to the layout - this->setLayout(new QHBoxLayout(this)); - this->layout()->setContentsMargins(1,1,1,1); - this->layout()->addWidget(icon); - this->layout()->addWidget(actButton); - this->layout()->addWidget(name); - //Set a custom object name so this can be tied into the Lumina Theme stylesheets - this->setObjectName("LuminaItemWidget"); -} - -void ItemWidget::setupContextMenu(){ - //Now refresh the context menu - contextMenu->clear(); - if(!QFile::exists(QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1)) ){ - //Does not have a desktop link - contextMenu->addAction( LXDG::findIcon("preferences-desktop-icons",""), tr("Pin to Desktop"), this, SLOT(PinToDesktop()) ); - } - //Favorite Item - if( LDesktopUtils::isFavorite(icon->whatsThis()) ){ //Favorite Item - can always remove this - contextMenu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove from Favorites"), this, SLOT(RemoveFavorite()) ); - }else{ - //This file does not have a shortcut yet -- allow the user to add it - contextMenu->addAction( LXDG::findIcon("bookmark-toolbar",""), tr("Add to Favorites"), this, SLOT(AddFavorite()) ); - } - //QuickLaunch Item - if(LSession::handle()->sessionSettings()->value("QuicklaunchApps",QStringList()).toStringList().contains(icon->whatsThis()) ){ //Favorite Item - can always remove this - contextMenu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove from Quicklaunch"), this, SLOT(RemoveQL()) ); - }else{ - //This file does not have a shortcut yet -- allow the user to add it - contextMenu->addAction( LXDG::findIcon("quickopen",""), tr("Add to Quicklaunch"), this, SLOT(AddQL()) ); - } -} - -void ItemWidget::setupActions(XDGDesktop *app){ - if(app==0 || app->actions.isEmpty()){ actButton->setVisible(false); return; } - //Actions Available - go ahead and list them all - actButton->setMenu( new QMenu(this) ); - for(int i=0; i<app->actions.length(); i++){ - QAction *act = new QAction(LXDG::findIcon(app->actions[i].icon, app->icon), app->actions[i].name, this); - act->setToolTip(app->actions[i].ID); - act->setWhatsThis(app->actions[i].ID); - actButton->menu()->addAction(act); - } - connect(actButton->menu(), SIGNAL(triggered(QAction*)), this, SLOT(actionClicked(QAction*)) ); - connect(actButton->menu(), SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) ); - connect(actButton->menu(), SIGNAL(aboutToHide()), this, SLOT(actionMenuClosed()) ); - connect(menureset, SIGNAL(timeout()), this, SLOT(resetmenuflag()) ); -} - -void ItemWidget::updateItems(){ - //update the text/icon to match sizes - int H = 2.3*name->fontMetrics().height(); //make sure the height is large enough for two lines - icon->setFixedSize(QSize(H-4, H-4)); - actButton->setFixedSize( QSize( (H-4)/2, H-4) ); - QStringList newname = text.split("<br>"); - for(int i=0; i<newname.length(); i++){ newname[i] = name->fontMetrics().elidedText(newname[i], Qt::ElideRight, name->width()); } - name->setText( newname.join("<br>") ); - //Now reload the icon if necessary - if(icon->pixmap()!=0){ - if(icon->pixmap()->size().height() < (H-4) ){ - if(iconPath.isEmpty()){ - //Use item path (thumbnail or mimetype) - if(LUtils::imageExtensions().contains(icon->whatsThis().section("/",-1).section(".",-1).toLower()) ){ - icon->setPixmap( QIcon(icon->whatsThis()).pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); - }else{ - icon->setPixmap( LXDG::findMimeIcon(icon->whatsThis().section("/",-1)).pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); - } - }else{ - icon->setPixmap( LXDG::findIcon(iconPath,"preferences-system-windows-actions").pixmap(H-4,H-4).scaledToHeight(H-4,Qt::SmoothTransformation) ); - } - }else if(icon->pixmap()->size().height() > (H-4) ){ - icon->setPixmap( icon->pixmap()->scaled(H-4, H-4, Qt::IgnoreAspectRatio, Qt::SmoothTransformation) ); - } - } -} - -void ItemWidget::PinToDesktop(){ - qDebug() << "Create Link on Desktop:" << icon->whatsThis(); - bool ok = QFile::link(icon->whatsThis(), QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1)); - qDebug() << " - " << (ok ? "Success": "Failure"); -} - -void ItemWidget::RemoveFavorite(){ - LDesktopUtils::removeFavorite(icon->whatsThis()); - linkPath.clear(); - emit RemovedShortcut(); -} - -void ItemWidget::AddFavorite(){ - if( LDesktopUtils::addFavorite(icon->whatsThis()) ){ - linkPath = icon->whatsThis(); - emit NewShortcut(); - } - -} -void ItemWidget::RemoveQL(){ - qDebug() << "Remove QuickLaunch Button:" << icon->whatsThis(); - emit toggleQuickLaunch(icon->whatsThis(), false); -} - -void ItemWidget::AddQL(){ - qDebug() << "Add QuickLaunch Button:" << icon->whatsThis(); - emit toggleQuickLaunch(icon->whatsThis(), true); -} - - -void ItemWidget::ItemClicked(){ - if(!linkPath.isEmpty()){ emit RunItem(linkPath); } - else{ emit RunItem(icon->whatsThis()); } -} - -void ItemWidget::actionClicked(QAction *act){ - actButton->menu()->hide(); - QString cmd = "lumina-open -action \""+act->whatsThis()+"\" \"%1\""; - if(!linkPath.isEmpty()){ cmd = cmd.arg(linkPath); } - else{ cmd = cmd.arg(icon->whatsThis()); } - emit RunItem(cmd); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/ItemWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/ItemWidget.h deleted file mode 100644 index 11394dd6..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/ItemWidget.h +++ /dev/null @@ -1,98 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, 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_SYSTEM_START_ITEM_WIDGET_H -#define _LUMINA_PANEL_SYSTEM_START_ITEM_WIDGET_H - -#include <QFrame> -#include <QLabel> -#include <QToolButton> -#include <QString> -#include <QHBoxLayout> -#include <QSize> -#include <QDir> -#include <QFile> -#include <QMouseEvent> -#include <QAction> -#include <QMenu> -#include <QTimer> -#include <QResizeEvent> - -#include <LuminaXDG.h> - -class ItemWidget : public QFrame{ - Q_OBJECT -public: - //Overloaded Constructors for various uses - // - Favorites (path/type) - ItemWidget(QWidget *parent=0, QString itemPath="", QString type="unknown", bool goback=false); - // - Generic Apps - ItemWidget(QWidget *parent=0, XDGDesktop *item= 0); - - ~ItemWidget(); - - bool gooditem; - - void triggerItem(); //trigger this item - just as if it was clicked on - -private: - QToolButton *actButton; - QMenu *contextMenu; - QLabel *icon, *name; - bool isDirectory, isShortcut, menuopen; - QString linkPath, iconPath, text; - QTimer *menureset; - - void createWidget(); - - void setupContextMenu(); - void setupActions(XDGDesktop*); - - void updateItems(); //update the text/icon to match sizes - -private slots: - void PinToDesktop(); - void RemoveFavorite(); - void AddFavorite(); - void RemoveQL(); - void AddQL(); - void ItemClicked(); - void actionClicked(QAction*); - //Functions to fix the submenu open/close issues - void actionMenuOpen(){ - if(menureset->isActive()){ menureset->stop(); } - menuopen = true; - } - void resetmenuflag(){ menuopen = false; } //tied to the "menureset" timer - void actionMenuClosed(){ menureset->start(); } - - -protected: - void mouseReleaseEvent(QMouseEvent *event){ - if(menuopen){ resetmenuflag(); } //skip this event if a submenu was open - else if(event->button() == Qt::RightButton && !icon->whatsThis().startsWith("chcat::::") ){ - menuopen = true; - setupContextMenu(); - contextMenu->popup(event->globalPos()); - }else if(event->button() != Qt::NoButton){ ItemClicked(); } - } - - void resizeEvent(QResizeEvent *ev){ - updateItems(); //update the sizing of everything - QFrame::resizeEvent(ev); // do the normal procedures - } - -signals: - void NewShortcut(); - void RemovedShortcut(); - void RunItem(QString cmd); - void toggleQuickLaunch(QString path, bool ok); - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/LStartButton.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/LStartButton.cpp deleted file mode 100644 index f44add77..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/LStartButton.cpp +++ /dev/null @@ -1,137 +0,0 @@ -//=========================================== -// 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" - -#include <LuminaXDG.h> -#include <LUtils.h> //This contains the "ResizeMenu" class - -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 ResizeMenu(this); - menu->setContentsMargins(1,1,1,1); - connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - connect(menu, SIGNAL(MenuResized(QSize)), this, SLOT(SaveMenuSize(QSize)) ); - startmenu = new StartMenu(this); - connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) ); - connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList))); - menu->setContents(startmenu); - QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize", QSize(0,0)).toSize(); - if(!saved.isNull()){ startmenu->setFixedSize(saved); } //re-load the previously saved value - - button->setMenu(menu); - connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) ); - QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes - QTimer::singleShot(0, startmenu, SLOT(ReLoadQuickLaunch()) ); - //Setup the global shortcut handling for opening the start menu - connect(QApplication::instance(), SIGNAL(StartButtonActivated()), this, SLOT(shortcutActivated()) ); - LSession::handle()->registerStartButton(this->type()); -} - -LStartButtonPlugin::~LStartButtonPlugin(){ - LSession::handle()->unregisterStartButton(this->type()); -} - -void LStartButtonPlugin::updateButtonVisuals(){ - button->setToolTip(tr("")); - button->setText( SYSTEM::user() ); - button->setIcon( LXDG::findIcon("start-here-lumina","Lumina-DE") ); //force icon refresh -} - -void LStartButtonPlugin::updateQuickLaunch(QStringList apps){ - //First clear any obsolete apps - QStringList old; - //qDebug() << "Update QuickLaunch Buttons"; - for(int i=0; i<QUICKL.length(); i++){ - if( !apps.contains(QUICKL[i]->whatsThis()) ){ - //App was removed - QUICKL.takeAt(i)->deleteLater(); - i--; - }else{ - //App still listed - update the button - old << QUICKL[i]->whatsThis(); //add the list of current buttons - LFileInfo info(QUICKL[i]->whatsThis()); - QUICKL[i]->setIcon( LXDG::findIcon(info.iconfile(),"unknown") ); - if(info.isDesktopFile()){ QUICKL[i]->setToolTip( info.XDG()->name ); } - else{ QUICKL[i]->setToolTip( info.fileName() ); } - } - } - //Now go through and create any new buttons - for(int i=0; i<apps.length(); i++){ - if( !old.contains(apps[i]) ){ - //New App - LQuickLaunchButton *tmp = new LQuickLaunchButton(apps[i], this); - QUICKL << tmp; - LFileInfo info(apps[i]); - tmp->setIcon( LXDG::findIcon( info.iconfile() ) ); - if(info.isDesktopFile()){ tmp->setToolTip( info.XDG()->name ); } - else{ tmp->setToolTip( info.fileName() ); } - //Now add the button to the layout and connect the signal/slots - this->layout()->insertWidget(i+1,tmp); //"button" is always in slot 0 - connect(tmp, SIGNAL(Launch(QString)), this, SLOT(LaunchQuick(QString)) ); - connect(tmp, SIGNAL(Remove(QString)), this, SLOT(RemoveQuick(QString)) ); - } - } - //qDebug() << " - Done updateing QuickLaunch Buttons"; - QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes -} - -void LStartButtonPlugin::LaunchQuick(QString file){ - //Need to get which button was clicked - //qDebug() << "Quick Launch triggered:" << file; - if(!file.isEmpty()){ - LSession::LaunchApplication("lumina-open \""+file+"\""); - emit MenuClosed(); - } -} - -void LStartButtonPlugin::RemoveQuick(QString file){ - //qDebug() << "Remove Quicklaunch Button:" << file; - if(!file.isEmpty()){ - startmenu->UpdateQuickLaunch(file, false); //always a removal - emit MenuClosed(); - } -} - -void LStartButtonPlugin::SaveMenuSize(QSize sz){ - //Save this size for the menu - LSession::handle()->DesktopPluginSettings()->setValue("panelPlugs/"+this->type()+"/MenuSize", sz); -} - -// ======================== -// PRIVATE FUNCTIONS -// ======================== -void LStartButtonPlugin::openMenu(){ - if(menu->isVisible()){ return; } //don't re-show it - already open - //TESTING CODE TO SEE IF THIS MAKES IT RECOVER MEMORY - /*StartMenu *old = startmenu; - startmenu = new StartMenu(this); - connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) ); - connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList))); - menu->setContents(startmenu); - if(old!=0){ old->deleteLater(); }*/ -//-------- - startmenu->UpdateMenu(); - button->showMenu(); -} - -void LStartButtonPlugin::closeMenu(){ - menu->hide(); -} - -void LStartButtonPlugin::shortcutActivated(){ - if(LSession::handle()->registerStartButton(this->type())){ - if(menu->isVisible()){ closeMenu(); } - else{ this->activateWindow(); openMenu(); } - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/LStartButton.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/LStartButton.h deleted file mode 100644 index d46bb1be..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/LStartButton.h +++ /dev/null @@ -1,113 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, 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_START_MENU_PLUGIN_H -#define _LUMINA_DESKTOP_START_MENU_PLUGIN_H - -// Qt includes -#include <QMenu> -#include <QWidgetAction> -#include <QToolButton> -#include <QString> -#include <QWidget> -#include <QMenu> - -// Lumina-desktop includes -//#include "../../Globals.h" -#include "../LPPlugin.h" //main plugin widget - -// libLumina includes -#include <LuminaXDG.h> -#include <LUtils.h> -#include <ResizeMenu.h> - -#include "StartMenu.h" - -//Simple Tool Button For QuickLaunch Items -class LQuickLaunchButton : public QToolButton{ - Q_OBJECT -signals: - void Launch(QString); - void Remove(QString); - -private slots: - void rmentry(){ - emit Remove(this->whatsThis()); - } - void launchentry(){ - emit Launch(this->whatsThis()); - } - -public: - LQuickLaunchButton(QString path, QWidget* parent = 0) : QToolButton(parent){ - this->setWhatsThis(path); - this->setMenu(new QMenu(this)); - this->setContextMenuPolicy(Qt::CustomContextMenu); - this->menu()->addAction( LXDG::findIcon("edit-delete",""), tr("Remove from Quicklaunch"), this, SLOT(rmentry()) ); - connect(this, SIGNAL(clicked()), this, SLOT(launchentry()) ); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showMenu()) ); - } - ~LQuickLaunchButton(){} - -}; - -// PANEL PLUGIN BUTTON -class LStartButtonPlugin : public LPPlugin{ - Q_OBJECT - -public: - LStartButtonPlugin(QWidget *parent = 0, QString id = "systemstart", bool horizontal=true); - ~LStartButtonPlugin(); - -private: - ResizeMenu *menu; - //QWidgetAction *mact; - StartMenu *startmenu; - QToolButton *button; - QList<LQuickLaunchButton*> QUICKL; - -private slots: - void openMenu(); - void closeMenu(); - void shortcutActivated(); - - void updateButtonVisuals(); - - void updateQuickLaunch(QStringList); - void LaunchQuick(QString); - void RemoveQuick(QString); - void SaveMenuSize(QSize); - -public slots: - void OrientationChange(){ - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); - button->setIconSize( QSize(this->height(), this->height()) ); - for(int i=0; i<QUICKL.length(); i++){ QUICKL[i]->setIconSize(QSize(this->height(), this->height())); } - }else{ - this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - button->setIconSize( QSize(this->width(), this->width()) ); - for(int i=0; i<QUICKL.length(); i++){ QUICKL[i]->setIconSize(QSize(this->width(), this->width())); } - } - this->layout()->update(); - updateButtonVisuals(); - } - - void LocaleChange(){ - updateButtonVisuals(); - if(startmenu!=0){ startmenu->UpdateAll(); } - } - - void ThemeChange(){ - updateButtonVisuals(); - if(startmenu!=0){ startmenu->UpdateAll(); } - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.cpp deleted file mode 100644 index d05ba22f..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.cpp +++ /dev/null @@ -1,720 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "StartMenu.h" -#include "ui_StartMenu.h" -//#include <QtConcurrent> - -#include <LuminaOS.h> -#include "../../LSession.h" -#include <QtConcurrent> -#include <QMessageBox> - -#include "ItemWidget.h" -//#define SSAVER QString("xscreensaver-demo") - -StartMenu::StartMenu(QWidget *parent) : QWidget(parent), ui(new Ui::StartMenu){ - ui->setupUi(this); //load the designer file - this->setMouseTracking(true); - searchTimer = new QTimer(this); - searchTimer->setInterval(300); //~1/3 second - searchTimer->setSingleShot(true); - connect(searchTimer, SIGNAL(timeout()), this, SLOT(startSearch()) ); - connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateApps()) ); - connect(LSession::handle(), SIGNAL(FavoritesChanged()), this, SLOT(UpdateFavs()) ); - //Need to load the last used setting of the application list - QString state = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/systemstart/showcategories", "partial").toString(); - if(state=="partial"){ui->check_apps_showcats->setCheckState(Qt::PartiallyChecked); } - else if(state=="true"){ ui->check_apps_showcats->setCheckState(Qt::Checked); } - else{ ui->check_apps_showcats->setCheckState(Qt::Unchecked); } - connect(ui->check_apps_showcats, SIGNAL(stateChanged(int)), this, SLOT(catViewChanged()) ); - UpdateAll(); - QTimer::singleShot(10, this,SLOT(UpdateApps())); - QTimer::singleShot(10, this, SLOT(UpdateFavs())); -} - -StartMenu::~StartMenu(){ - -} - -void StartMenu::UpdateAll(){ - //Update all the icons/text on all the pages - - // Update Text - ui->retranslateUi(this); - - //Update Icons - ui->tool_goto_apps->setIcon(LXDG::findIcon("system-run","")); - ui->tool_goto_settings->setIcon(LXDG::findIcon("preferences-system","")); - ui->tool_launch_fm->setIcon(LXDG::findIcon("user-home","")); - ui->tool_launch_desksettings->setIcon(LXDG::findIcon("preferences-desktop","")); - ui->tool_lock->setIcon(LXDG::findIcon("system-lock-screen","")); - ui->tool_goto_logout->setIcon(LXDG::findIcon("system-log-out","")); - ui->tool_back->setIcon(LXDG::findIcon("go-previous","")); - ui->tool_launch_deskinfo->setIcon(LXDG::findIcon("system-help","")); - - ui->tool_launch_mixer->setIcon( LXDG::findIcon("preferences-desktop-sound","") ); - ui->label_bright_icon->setPixmap( LXDG::findIcon("preferences-system-power-management","").pixmap(ui->tool_goto_apps->iconSize()) ); - ui->label_locale_icon->setPixmap( LXDG::findIcon("preferences-desktop-locale","").pixmap(ui->tool_goto_apps->iconSize()) ); - ui->tool_set_nextwkspace->setIcon(LXDG::findIcon("go-next-view","")); - ui->tool_set_prevwkspace->setIcon(LXDG::findIcon("go-previous-view","")); - ui->tool_logout->setIcon(LXDG::findIcon("system-log-out","")); - ui->tool_restart->setIcon(LXDG::findIcon("system-reboot","")); - ui->tool_shutdown->setIcon(LXDG::findIcon("system-shutdown","")); - ui->tool_suspend->setIcon(LXDG::findIcon("system-suspend","")); - - //Update Visibility of system/session/OS options - // -- Control Panel - QString tmp = LOS::ControlPanelShortcut(); - if(QFile::exists(tmp)){ - ui->tool_launch_controlpanel->setWhatsThis(tmp); - //Now read the file to see which icon to use - XDGDesktop desk(tmp); - if(desk.isValid()){ - ui->tool_launch_controlpanel->setIcon(LXDG::findIcon(desk.icon,"preferences-other")); - }else{ ui->tool_launch_controlpanel->setVisible(false); } - }else{ ui->tool_launch_controlpanel->setVisible(false); } - // -- App Store - tmp = LOS::AppStoreShortcut(); - if(QFile::exists(tmp)){ - ui->tool_launch_store->setWhatsThis(tmp); - //Now read the file to see which icon to use - XDGDesktop desk(tmp); - if(desk.isValid()){ - ui->tool_launch_store->setIcon(LXDG::findIcon(desk.icon,"utilities-file-archiver")); - }else{ ui->tool_launch_store->setVisible(false); } - }else{ ui->tool_launch_store->setVisible(false); } - //Audio Controls - ui->frame_audio->setVisible( LOS::audioVolume() >=0 ); - //Brightness controls - ui->frame_bright->setVisible( LOS::ScreenBrightness() >=0 ); - //Shutdown/restart - bool ok = LOS::userHasShutdownAccess(); - ui->frame_leave_system->setWhatsThis(ok ? "allowed": ""); - ui->frame_leave_system->setVisible(ok); - //Battery Availability - ok = LOS::hasBattery(); - ui->label_status_battery->setWhatsThis(ok ? "allowed": ""); - ui->label_status_battery->setVisible(ok); - //Locale availability - QStringList locales = LUtils::knownLocales(); - ui->stackedWidget->setCurrentWidget(ui->page_main); //need to ensure the settings page is not active - ui->combo_locale->clear(); - QString curr = LUtils::currentLocale(); - //qDebug() << "Update Locales:" << locales; - //qDebug() << "Current Locale:" << curr; - for(int i=0; i<locales.length(); i++){ - QLocale loc( (locales[i]=="pt") ? "pt_PT" : locales[i] ); - ui->combo_locale->addItem(loc.nativeLanguageName() +" ("+locales[i]+")", locales[i]); //Make the display text prettier later - if(locales[i] == curr || locales[i] == curr.section("_",0,0) ){ - //Current Locale - ui->combo_locale->setCurrentIndex(ui->combo_locale->count()-1); //the last item in the list right now - } - } - ui->frame_locale->setVisible(locales.length() > 1); - //User Name in status bar - ui->label_status->setText( QString::fromLocal8Bit(getlogin()) ); - //Lumina Utilities - ui->tool_launch_desksettings->setVisible(LUtils::isValidBinary("lumina-config")); - ui->tool_launch_deskinfo->setVisible(LUtils::isValidBinary("lumina-info")); - -} - -void StartMenu::UpdateMenu(bool forceall){ - //qDebug() << "Update Menu" << forceall; - ui->line_search->clear(); - if(forceall){ UpdateAll(); } - //Quick update routine before the menu is made visible - //qDebug() << "update favs"; - //UpdateFavs(); - //qDebug() << "check page"; - if(ui->stackedWidget->currentWidget() != ui->page_main){ - ui->stackedWidget->setCurrentWidget(ui->page_main); //just show the main page - }else{ - on_stackedWidget_currentChanged(0); //refresh/update the main page every time - } - //qDebug() << "done"; -} - -void StartMenu::ReLoadQuickLaunch(){ - emit UpdateQuickLaunch( LSession::handle()->sessionSettings()->value("QuicklaunchApps",QStringList()).toStringList() ); -} - -void StartMenu::UpdateQuickLaunch(QString path, bool keep){ - QStringList QL = LSession::handle()->sessionSettings()->value("QuicklaunchApps",QStringList()).toStringList(); - if(keep){QL << path; } - else{ QL.removeAll(path); } - QL.removeDuplicates(); - LSession::handle()->sessionSettings()->setValue("QuicklaunchApps",QL); - //LSession::handle()->sessionSettings()->sync(); - emit UpdateQuickLaunch(QL); -} - -// ========================== -// PRIVATE FUNCTIONS -// ========================== -/*void StartMenu::deleteChildren(QWidget *obj){ - if(obj->layout()==0){ - for(int i=0; i<obj->children().count(); i++){ - obj->children().at(i)->deleteLater(); - } - }else{ - - } -}*/ - -void StartMenu::ClearScrollArea(QScrollArea *area){ - //QWidget *old = area->takeWidget(); - //qDebug() << "Clear Scroll Area:"; - //if(old->layout()!=0){ qDebug() << " - Number of items in layout:" << old->layout()->count(); } - //qDebug() << " - Number of Children:" << old->children().count(); - //deleteChildren(old); //make sure we *fully* delete these items to save memory - //old->deleteLater(); - if(area == ui->scroll_favs){ - area->takeWidget()->deleteLater(); - } - if(area->widget()==0){ - area->setWidget( new QWidget(area) ); //create a new widget in the scroll area - } - if(area->widget()->layout()==0){ - QVBoxLayout *layout = new QVBoxLayout(area->widget()); - layout->setSpacing(2); - layout->setContentsMargins(3,1,3,1); - layout->setDirection(QBoxLayout::TopToBottom); - layout->setAlignment(Qt::AlignTop); - area->widget()->setContentsMargins(0,0,0,0); - area->widget()->setLayout(layout); - } - //Now clear the items in the layout - while( area->widget()->layout()->count() >0 ){ - QLayoutItem *it = area->widget()->layout()->takeAt(0); - //Need to delete both the widget and the layout item - if(it->widget()!=0){ it->widget()->deleteLater(); } - delete it; - } -} - -void StartMenu::SortScrollArea(QScrollArea *area){ - //qDebug() << "Sorting Scroll Area:"; - //Sort all the items in the scroll area alphabetically - QLayout *lay = area->widget()->layout(); - QStringList items; - for(int i=0; i<lay->count(); i++){ - items << lay->itemAt(i)->widget()->whatsThis(); - } - - items.sort(); - //qDebug() << " - Sorted Items:" << items; - for(int i=0; i<items.length(); i++){ - if(items[i].isEmpty()){ continue; } - //QLayouts are weird in that they can only add items to the end - need to re-insert almost every item - for(int j=0; j<lay->count(); j++){ - //Find this item - if(lay->itemAt(j)->widget()->whatsThis()==items[i]){ - //Found it - now move it if necessary - //qDebug() << "Found Item:" << items[i] << i << j; - lay->addItem( lay->takeAt(j) ); - break; - } - } - } -} - -void StartMenu::do_search(QString search, bool force){ - search = search.simplified(); //remove unneccesary whitespace - if(search == CSearch && !force){ - //nothing new - just ensure the page is visible - if(ui->stackedWidget->currentWidget()!=ui->page_search ){ ui->stackedWidget->setCurrentWidget(ui->page_search); } - return; - }else if(search.isEmpty()){ - CSearch.clear(); - if(ui->stackedWidget->currentWidget()==ui->page_search ){ on_tool_back_clicked(); } - return; - } - //Got a search term - check it - CSearch = search; //save this for comparison later - qDebug() << "Search for term:" << search; - ClearScrollArea(ui->scroll_search); - topsearch.clear(); - //Now find any items which match the search - QStringList found; //syntax: [<sorter>::::<mimetype>::::<filepath>] - QString tmp = search; - if(LUtils::isValidBinary(tmp)){ found << "0::::application/x-executable::::"+tmp; } - QList<XDGDesktop*> apps = LSession::handle()->applicationMenu()->currentAppHash()->value("All"); - for(int i=0; i<apps.length(); i++){ - int priority = -1; - if(apps[i]->name.toLower()==search.toLower()){ priority = 10; } - else if(apps[i]->name.startsWith(search, Qt::CaseInsensitive)){ priority = 15; } - else if(apps[i]->name.contains(search, Qt::CaseInsensitive)){ priority = 19; } - else if(apps[i]->genericName.contains(search, Qt::CaseInsensitive)){ priority = 20; } - else if(apps[i]->comment.contains(search, Qt::CaseInsensitive)){ priority = 30; } - //Can add other filters here later - - if(priority>0){ - found << QString::number(priority)+"::::app::::"+apps[i]->filePath; - } - } - found.sort(Qt::CaseInsensitive); //sort by priority/type (lower numbers are higher on list) - //qDebug() << "Sorted Items:" << found; - //Now add the items to the menu in order - for(int i=0; i<found.length(); i++){ - if( !QFile::exists(found[i].section("::::",2,-1)) ){ continue; } //invalid favorite - skip it - if(topsearch.isEmpty()){ topsearch = found[i].section("::::",2,-1); } - ItemWidget *it = 0; - if( found[i].section("::::",2,-1).endsWith(".desktop")){ - XDGDesktop item(found[i].section("::::",2,-1)); - if(item.isValid()){ it = new ItemWidget(ui->scroll_favs->widget(), &item); } - }else{ - it = new ItemWidget(ui->scroll_favs->widget(), found[i].section("::::",2,-1), found[i].section("::::",1,1) ); - } - if(it==0){ continue; } - if(!it->gooditem){ it->deleteLater(); continue; } //invalid for some reason - ui->scroll_search->widget()->layout()->addWidget(it); - connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); - connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); - if(i%3==0){ - QApplication::processEvents(); - if(searchTimer->isActive()){ return; } //search changed - go ahead and stop here - } - } - ui->stackedWidget->setCurrentWidget(ui->page_search); -} - -bool StartMenu::promptAboutUpdates(bool &skip){ - QString pending = LOS::systemPendingUpdates(); - if(pending.isEmpty()){ skip = false; } //continue without skip - else{ - QMessageBox dlg(QMessageBox::Question, tr("Apply Updates?"), tr("You have system updates waiting to be applied! Do you wish to install them now?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, this); - dlg.setDetailedText(pending); - dlg.setDefaultButton(QMessageBox::Yes); - dlg.show(); - int ret = dlg.exec(); - if(ret == QMessageBox::Cancel){ return false; } //do not continue - else{ skip = (ret==QMessageBox::No); } - } - return true; -} - -// ======================== -// PRIVATE SLOTS -// ======================== -void StartMenu::LaunchItem(QString path, bool fix){ - if(path.startsWith("chcat::::")){ - ChangeCategory(path.section("::::",1,50)); - return; - } - qDebug() << "Launching Item:" << path << fix; - if(!path.isEmpty()){ - qDebug() << "Launch Application:" << path; - if( fix && !path.startsWith("lumina-open") ){ LSession::LaunchApplication("lumina-open \""+path+"\""); } - else{ LSession::LaunchApplication(path); } - emit CloseMenu(); //so the menu container will close - } -} - -void StartMenu::ChangeCategory(QString cat){ - //This only happens on user interaction - make sure to run the update routine in a separate thread - CCat = cat; - UpdateApps(); - //QtConcurrent::run(this, &StartMenu::UpdateApps); -} - -//Listing Update routines -void StartMenu::UpdateApps(){ - ClearScrollArea(ui->scroll_apps); - //Now assemble the apps list - //qDebug() << "Update Apps:";// << CCat << ui->check_apps_showcats->checkState(); - if(ui->check_apps_showcats->checkState() == Qt::PartiallyChecked){ - //qDebug() << " - Partially Checked"; - //Show a single page of apps, but still divided up by categories - CCat.clear(); - QStringList cats = LSession::handle()->applicationMenu()->currentAppHash()->keys(); - cats.sort(); - cats.removeAll("All"); - for(int c=0; c<cats.length(); c++){ - QList<XDGDesktop*> apps = LSession::handle()->applicationMenu()->currentAppHash()->value(cats[c]); - if(apps.isEmpty()){ continue; } - //Add the category label to the scroll - QLabel *catlabel = new QLabel("<b>"+cats[c]+"</b>",ui->scroll_apps->widget()); - catlabel->setAlignment(Qt::AlignCenter); - ui->scroll_apps->widget()->layout()->addWidget(catlabel); - //Now add all the apps for this category - for(int i=0; i<apps.length(); i++){ - ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), apps[i] ); - if(!it->gooditem){ qDebug() << "Invalid Item:"; it->deleteLater(); continue; } //invalid for some reason - ui->scroll_apps->widget()->layout()->addWidget(it); - connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); - connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); - } - } - - }else if(ui->check_apps_showcats->checkState() == Qt::Checked){ - //qDebug() << " - Checked"; - //Only show categories to start with - and have the user click-into a cat to see apps - if(CCat.isEmpty()){ - //No cat selected yet - show cats only - QStringList cats = LSession::handle()->applicationMenu()->currentAppHash()->keys(); - cats.sort(); - cats.removeAll("All"); //This is not a "real" category - for(int c=0; c<cats.length(); c++){ - ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), cats[c], "chcat::::"+cats[c] ); - if(!it->gooditem){ qDebug() << "Invalid Item:";it->deleteLater(); continue; } //invalid for some reason - ui->scroll_apps->widget()->layout()->addWidget(it); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); - } - }else{ - //qDebug() << "Show Apps For category:" << CCat; - //Show the "go back" button - ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), CCat, "chcat::::"+CCat, true); - //if(!it->gooditem){ continue; } //invalid for some reason - ui->scroll_apps->widget()->layout()->addWidget(it); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); - //Show apps for this cat - QList<XDGDesktop*> apps = LSession::handle()->applicationMenu()->currentAppHash()->value(CCat); - for(int i=0; i<apps.length(); i++){ - //qDebug() << " - App:" << apps[i].name; - ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), apps[i] ); - if(!it->gooditem){ qDebug() << "Invalid Item:"; it->deleteLater(); continue; } //invalid for some reason - ui->scroll_apps->widget()->layout()->addWidget(it); - connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); - connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); - } - } - - }else{ - //qDebug() << " - Not Checked"; - //No categories at all - just alphabetize all the apps - QList<XDGDesktop*> apps = LSession::handle()->applicationMenu()->currentAppHash()->value("All"); - CCat.clear(); - //Now add all the apps for this category - for(int i=0; i<apps.length(); i++){ - ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), apps[i] ); - if(!it->gooditem){ it->deleteLater(); continue; } //invalid for some reason - ui->scroll_apps->widget()->layout()->addWidget(it); - connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); - connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); - } - } - - -} - -void StartMenu::UpdateFavs(){ - //SYNTAX NOTE: (per-line) "<name>::::[dir/app/<mimetype>]::::<path>" - QStringList newfavs = LDesktopUtils::listFavorites(); - if(favs == newfavs){ return; } //nothing to do - same as before - favs = newfavs; - ClearScrollArea(ui->scroll_favs); - favs.sort(); - //Iterate over types of favorites - QStringList rest = favs; - QStringList tmp; - for(int type = 0; type<3; type++){ - if(type==0){ tmp = favs.filter("::::app::::"); } //apps first - else if(type==1){ tmp = favs.filter("::::dir::::"); } //dirs next - else{ tmp = rest; } //everything left over - if(type==1){ - SortScrollArea(ui->scroll_favs); - //Need to run a special routine for sorting the apps (already in the widget) - //qDebug() << "Sort App Widgets..."; - // Since each app actually might have a different name listed within the file - /*QLayout *lay = ui->scroll_favs->widget()->layout(); - QStringList items; - for(int i=0; i<lay->count(); i++){ - items << lay->itemAt(i)->widget()->whatsThis().toLower(); - } - - items.sort(); - // qDebug() << " - Sorted Items:" << items; - for(int i=0; i<items.length(); i++){ - if(items[i].isEmpty()){ continue; } - //QLayouts are weird in that they can only add items to the end - need to re-insert almost every item - for(int j=0; j<lay->count(); j++){ - //Find this item - if(lay->itemAt(j)->widget()->whatsThis().toLower()==items[i]){ - //Found it - now move it if necessary - //qDebug() << "Found Item:" << items[i] << i << j; - lay->addItem( lay->takeAt(j) ); - break; - } - } - }*/ - - }//end of special app sorting routine - tmp.sort(); //Sort alphabetically by name (dirs/files) - for(int i=0; i<tmp.length(); i++){ - if(type<2){ rest.removeAll(tmp[i]); } - if( !QFile::exists(tmp[i].section("::::",2,-1)) ){ continue; } //invalid favorite - skip it - ItemWidget *it = 0; - if( tmp[i].section("::::",2,-1).endsWith(".desktop")){ - XDGDesktop item(tmp[i].section("::::",2,-1)); - if(item.isValid()){ it = new ItemWidget(ui->scroll_favs->widget(), &item); } - }else{ - it = new ItemWidget(ui->scroll_favs->widget(), tmp[i].section("::::",2,-1), tmp[i].section("::::",1,1) ); - } - if(it==0){ continue; } - if(!it->gooditem){ it->deleteLater(); continue; } //invalid for some reason - ui->scroll_favs->widget()->layout()->addWidget(it); - connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); - connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); - } - //QApplication::processEvents(); - } //end loop over types - ui->scroll_favs->update(); - //qDebug() << "End updateFavs"; -} - -// Page update routines -void StartMenu::on_stackedWidget_currentChanged(int val){ - QWidget *page = ui->stackedWidget->widget(val); - ui->tool_back->setVisible(page != ui->page_main); - ui->line_search->setFocus(); - - //Now the page specific updates - if(page == ui->page_main){ - if(!ui->label_status_battery->whatsThis().isEmpty()){ - //Battery available - update the status button - int charge = LOS::batteryCharge(); - QString TT, ICON; - if(charge<=5){ ICON="-caution"; } - else if(charge<=20){ ICON="-040"; } - else if(charge<=70){ ICON="-060"; } - else if(charge<=90){ ICON="-080"; } - else{ ICON="-100"; } - if(LOS::batteryIsCharging()){ - if(charge>=80){ ICON.clear(); } //for charging, there is no suffix to the icon name over 80% - ICON.prepend("battery-charging"); - TT = QString(tr("%1% (Plugged In)")).arg(QString::number(charge)); - }else{ - ICON.prepend("battery"); - int secs = LOS::batterySecondsLeft(); - if(secs>1){ TT = QString(tr("%1% (%2 Estimated)")).arg(QString::number(charge), LUtils::SecondsToDisplay(secs)); } - else{ TT = QString(tr("%1% Remaining")).arg(QString::number(charge)); } - } - //qDebug() << " Battery Icon:" << ICON << val << TT - ui->label_status_battery->setPixmap( LXDG::findIcon(ICON,"").pixmap(ui->tool_goto_apps->iconSize()/2) ); - ui->label_status_battery->setToolTip(TT); - } - //Network Status - ui->label_status_network->clear(); //not implemented yet - }else if(page == ui->page_apps){ - //Nothing needed for this page explicitly - }else if( page == ui->page_settings){ - // -- Workspaces - int tot = LSession::handle()->XCB->NumberOfWorkspaces(); - if(tot>1){ - ui->frame_wkspace->setVisible(true); - int cur = LSession::handle()->XCB->CurrentWorkspace(); - ui->label_wkspace->setText( QString(tr("Workspace %1/%2")).arg(QString::number(cur+1), QString::number(tot)) ); - }else{ - ui->frame_wkspace->setVisible(false); - } - // -- Brightness Controls - int tmp = LOS::ScreenBrightness(); - ui->frame_bright->setVisible(tmp >= 0); - if(tmp >= 0){ ui->slider_bright->setValue(tmp); } - // -- Audio Controls - tmp = LOS::audioVolume(); - ui->frame_audio->setVisible(tmp >= 0); - if(tmp >= 0){ ui->slider_volume->setValue(tmp); } - }else if(page == ui->page_leave){ - if( !ui->frame_leave_system->whatsThis().isEmpty() ){ - //This frame is allowed/visible - need to adjust the shutdown detection - bool updating = LOS::systemPerformingUpdates(); - ui->tool_restart->setEnabled(!updating); - ui->tool_shutdown->setEnabled(!updating); - ui->label_updating->setVisible(updating); //to let the user know *why* they can't shutdown/restart right now - } - ui->frame_leave_suspend->setVisible( LOS::systemCanSuspend() ); - } - -} - -void StartMenu::catViewChanged(){ - QString state; - switch(ui->check_apps_showcats->checkState()){ - case Qt::Checked: - state = "true"; - break; - case Qt::PartiallyChecked: - state = "partial"; - break; - default: - state = "false"; - } - LSession::handle()->DesktopPluginSettings()->setValue("panelPlugs/systemstart/showcategories", state); - //Now kick off the reload of the apps list - UpdateApps(); - //QtConcurrent::run(this, &StartMenu::UpdateApps); //this was a direct user change - keep it thread safe -} -//Page Change Buttons -void StartMenu::on_tool_goto_apps_clicked(){ - ui->stackedWidget->setCurrentWidget(ui->page_apps); -} - -void StartMenu::on_tool_goto_settings_clicked(){ - ui->stackedWidget->setCurrentWidget(ui->page_settings); -} - -void StartMenu::on_tool_goto_logout_clicked(){ - ui->stackedWidget->setCurrentWidget(ui->page_leave); -} - -void StartMenu::on_tool_back_clicked(){ - ui->stackedWidget->setCurrentWidget(ui->page_main); -} - - -//Launch Buttons -void StartMenu::on_tool_launch_controlpanel_clicked(){ - LaunchItem(ui->tool_launch_controlpanel->whatsThis()); -} - -void StartMenu::on_tool_launch_fm_clicked(){ - LaunchItem(QDir::homePath()); -} - -void StartMenu::on_tool_launch_store_clicked(){ - LaunchItem(ui->tool_launch_store->whatsThis()); -} - -void StartMenu::on_tool_launch_desksettings_clicked(){ - LaunchItem("lumina-config", false); -} - -void StartMenu::on_tool_launch_deskinfo_clicked(){ - LaunchItem("lumina-info",false); -} - -//Logout Buttons -void StartMenu::on_tool_lock_clicked(){ - //QProcess::startDetached("xscreensaver-command -lock"); - LaunchItem("xscreensaver-command -lock",false); -} - -void StartMenu::on_tool_logout_clicked(){ - emit CloseMenu(); - LSession::handle()->StartLogout(); -} - -void StartMenu::on_tool_restart_clicked(){ - emit CloseMenu(); - QCoreApplication::processEvents(); - bool skipupdates = false; - if( !promptAboutUpdates(skipupdates) ){ return; } - LSession::handle()->StartReboot(skipupdates); -} - -void StartMenu::on_tool_shutdown_clicked(){ - emit CloseMenu(); - QCoreApplication::processEvents(); - bool skipupdates = false; - if( !promptAboutUpdates(skipupdates) ){ return; } - LSession::handle()->StartShutdown(skipupdates); -} - -void StartMenu::on_tool_suspend_clicked(){ - //Make sure to lock the system first (otherwise anybody can access it again) - emit CloseMenu(); - LUtils::runCmd("xscreensaver-command -lock"); - LOS::systemSuspend(); -} - - -//Audio Volume -void StartMenu::on_slider_volume_valueChanged(int val){ - ui->label_vol->setText(QString::number(val)+"%"); - LOS::setAudioVolume(val); - //Also adjust the icon for the volume - if(val<1){ ui->tool_mute_audio->setIcon(LXDG::findIcon("audio-volume-muted","")); } - else if(val<33){ ui->tool_mute_audio->setIcon(LXDG::findIcon("audio-volume-low","")); } - else if(val<66){ ui->tool_mute_audio->setIcon(LXDG::findIcon("audio-volume-medium","")); } - else{ ui->tool_mute_audio->setIcon(LXDG::findIcon("audio-volume-high","")); } -} - -void StartMenu::on_tool_launch_mixer_clicked(){ - if(LOS::hasMixerUtility()){ - emit CloseMenu(); - LOS::startMixerUtility(); - } -} - -void StartMenu::on_tool_mute_audio_clicked(){ - static int lastvol = 50; - if(ui->slider_volume->value()==0){ ui->slider_volume->setValue(lastvol); } - else{ - lastvol = ui->slider_volume->value(); - ui->slider_volume->setValue(0); - } -} - -//Screen Brightness -void StartMenu::on_slider_bright_valueChanged(int val){ - ui->label_bright->setText(QString::number(val)+"%"); - LOS::setScreenBrightness(val); -} - - -//Workspace -void StartMenu::on_tool_set_nextwkspace_clicked(){ - int cur = LSession::handle()->XCB->CurrentWorkspace(); - int tot = LSession::handle()->XCB->NumberOfWorkspaces(); - //qDebug()<< "Next Workspace:" << cur << tot; - cur++; - if(cur>=tot){ cur = 0; } //back to beginning - //qDebug() << " - New Current:" << cur; - LSession::handle()->XCB->SetCurrentWorkspace(cur); - ui->label_wkspace->setText( QString(tr("Workspace %1/%2")).arg(QString::number(cur+1), QString::number(tot)) ); -} - -void StartMenu::on_tool_set_prevwkspace_clicked(){ - int cur = LSession::handle()->XCB->CurrentWorkspace(); - int tot = LSession::handle()->XCB->NumberOfWorkspaces(); - //qDebug()<< "Next Workspace:" << cur << tot; - cur--; - if(cur<0){ cur = tot-1; } //back to end - //qDebug() << " - New Current:" << cur; - LSession::handle()->XCB->SetCurrentWorkspace(cur); - ui->label_wkspace->setText( QString(tr("Workspace %1/%2")).arg(QString::number(cur+1), QString::number(tot)) ); -} - - -//Locale -void StartMenu::on_combo_locale_currentIndexChanged(int){ - //Get the currently selected Locale - if(ui->stackedWidget->currentWidget()!=ui->page_settings){ return; } - QString locale = ui->combo_locale->currentData().toString(); - emit CloseMenu(); - LSession::processEvents(); - LSession::handle()->switchLocale(locale); -} - - -//Search -void StartMenu::on_line_search_textEdited(QString){ - if(searchTimer->isActive()){ searchTimer->stop(); } - searchTimer->start(); -} - -void StartMenu::startSearch(){ - if(!this->isVisible()){ return; } //menu closed while timer was active - do_search(ui->line_search->text(),false); //auto-launched -} - -void StartMenu::on_line_search_returnPressed(){ - if(topsearch.isEmpty()){ return; } - LaunchItem(topsearch); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.h deleted file mode 100644 index 8ab04d94..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.h +++ /dev/null @@ -1,105 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_SYSTEM_START_PANEL_PLUGIN_H -#define _LUMINA_DESKTOP_SYSTEM_START_PANEL_PLUGIN_H - -#include <QWidget> -#include <QScrollArea> -#include <QMouseEvent> - -#include <LuminaXDG.h> - -namespace Ui{ - class StartMenu; -}; - -class StartMenu : public QWidget{ - Q_OBJECT -public: - StartMenu(QWidget *parent = 0); - ~StartMenu(); - -public slots: - void UpdateAll(); //for re-translation/icon changes - void UpdateMenu(bool forceall = false); //for item changes - - void ReLoadQuickLaunch(); - void UpdateQuickLaunch(QString, bool); - -private: - Ui::StartMenu *ui; - QStringList favs; - QString CCat, CSearch, topsearch; //current category/search - QTimer *searchTimer; - - //Simple utility functions - //void deleteChildren(QWidget *obj); //recursive function - void ClearScrollArea(QScrollArea *area); - void SortScrollArea(QScrollArea *area); - void do_search(QString search, bool force); - - bool promptAboutUpdates(bool &skip); - -private slots: - void LaunchItem(QString path, bool fix = true); - - //Application/Favorite Listings - void ChangeCategory(QString cat); - void UpdateApps(); - void UpdateFavs(); - - // Page update routines - void on_stackedWidget_currentChanged(int); //page changed - void catViewChanged(); //application categorization view mode changed - - //Page Change Buttons - void on_tool_goto_apps_clicked(); - void on_tool_goto_settings_clicked(); - void on_tool_goto_logout_clicked(); - void on_tool_back_clicked(); - - //Launch Buttons - void on_tool_launch_controlpanel_clicked(); - void on_tool_launch_fm_clicked(); - void on_tool_launch_store_clicked(); - void on_tool_launch_desksettings_clicked(); - void on_tool_launch_deskinfo_clicked(); - - //Logout Buttons - void on_tool_lock_clicked(); - void on_tool_logout_clicked(); - void on_tool_restart_clicked(); - void on_tool_shutdown_clicked(); - void on_tool_suspend_clicked(); - - //Audio Volume - void on_slider_volume_valueChanged(int); - void on_tool_launch_mixer_clicked(); - void on_tool_mute_audio_clicked(); - - //Screen Brightness - void on_slider_bright_valueChanged(int); - - //Workspace - void on_tool_set_nextwkspace_clicked(); - void on_tool_set_prevwkspace_clicked(); - - //Locale - void on_combo_locale_currentIndexChanged(int); - - //Search - void on_line_search_textEdited(QString); - void startSearch(); - void on_line_search_returnPressed(); - -signals: - void CloseMenu(); - void UpdateQuickLaunch(QStringList); - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.ui b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.ui deleted file mode 100644 index 74f61d7f..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemstart/StartMenu.ui +++ /dev/null @@ -1,1148 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>StartMenu</class> - <widget class="QWidget" name="StartMenu"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>181</width> - <height>405</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <property name="styleSheet"> - <string notr="true">QScrollArea{background: transparent; border: none; }</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>1</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>1</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <item> - <widget class="QLineEdit" name="line_search"> - <property name="placeholderText"> - <string>Type to search</string> - </property> - </widget> - </item> - <item> - <widget class="QStackedWidget" name="stackedWidget"> - <property name="currentIndex"> - <number>4</number> - </property> - <widget class="QWidget" name="page_main"> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label_status_battery"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string notr="true">bat%</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_status_network"> - <property name="text"> - <string notr="true">netstat</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_status"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QScrollArea" name="scroll_favs"> - <property name="contextMenuPolicy"> - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="verticalScrollBarPolicy"> - <enum>Qt::ScrollBarAsNeeded</enum> - </property> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="sizeAdjustPolicy"> - <enum>QAbstractScrollArea::AdjustToContents</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>179</width> - <height>177</height> - </rect> - </property> - </widget> - </widget> - </item> - <item> - <widget class="Line" name="line_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_launch_fm"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Browse Files</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_goto_apps"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Browse Applications</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_launch_controlpanel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Control Panel</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_goto_settings"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Preferences</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QToolButton" name="tool_goto_logout"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="styleSheet"> - <string notr="true">QToolButton::menu-arrow{ image: rightarrow-icon; }</string> - </property> - <property name="text"> - <string>Leave</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="popupMode"> - <enum>QToolButton::DelayedPopup</enum> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - <property name="arrowType"> - <enum>Qt::NoArrow</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_lock"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string notr="true">lock</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_apps"> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="tool_launch_store"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Manage Applications</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_15"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="check_apps_showcats"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Show Categories</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="tristate"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QScrollArea" name="scroll_apps"> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="sizeAdjustPolicy"> - <enum>QAbstractScrollArea::AdjustToContents</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>179</width> - <height>284</height> - </rect> - </property> - </widget> - </widget> - </item> - <item> - <widget class="Line" name="line_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_settings"> - <layout class="QVBoxLayout" name="verticalLayout_9"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <item> - <widget class="QToolButton" name="tool_launch_desksettings"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Configure Desktop</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_launch_deskinfo"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string notr="true">info</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_8"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QFrame" name="frame_audio"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <widget class="QToolButton" name="tool_mute_audio"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_11"> - <item> - <widget class="QSlider" name="slider_volume"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_vol"> - <property name="text"> - <string notr="true">vol%</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QToolButton" name="tool_launch_mixer"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="autoRaise"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_7"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QFrame" name="frame_bright"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_bright_icon"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="slider_bright"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="minimum"> - <number>10</number> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_bright"> - <property name="text"> - <string notr="true">br%</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_9"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QFrame" name="frame_wkspace"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QToolButton" name="tool_set_prevwkspace"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string notr="true">prev</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_wkspace"> - <property name="text"> - <string notr="true">workspace #</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_set_nextwkspace"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string notr="true">next</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_10"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QFrame" name="frame_locale"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="label_locale_icon"> - <property name="text"> - <string notr="true">Locale:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="combo_locale"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>161</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="Line" name="line_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_leave"> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>185</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QFrame" name="frame_leave_suspend"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_10"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="tool_suspend"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Suspend System</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_11"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QFrame" name="frame_leave_system"> - <property name="styleSheet"> - <string notr="true">QFrame#frame_leave_system{border: none; background: transparent; }</string> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="tool_restart"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Restart System</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_shutdown"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Power Off System</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_updating"> - <property name="text"> - <string>(System Performing Updates)</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line_13"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_logout"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Sign Out User</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_12"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_search"> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <item> - <widget class="QScrollArea" name="scroll_search"> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_3"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>161</width> - <height>332</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_back"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="text"> - <string>Back</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - <property name="arrowType"> - <enum>Qt::NoArrow</enum> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/LSysTray.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/LSysTray.cpp deleted file mode 100644 index a71fd57e..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/LSysTray.cpp +++ /dev/null @@ -1,167 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2012-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LSysTray.h" -#include "../../LSession.h" - -LSysTray::LSysTray(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - frame = new QFrame(this); - frame->setContentsMargins(0,0,0,0); - //frame->setStyleSheet("QFrame{ background: transparent; border: 1px solid transparent; border-radius: 3px; }"); - LI = new QBoxLayout( this->layout()->direction()); - frame->setLayout(LI); - LI->setAlignment(Qt::AlignCenter); - LI->setSpacing(0); - LI->setContentsMargins(0,0,0,0); - this->layout()->addWidget(frame); - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - //TrayID=0; - upTimer = new QTimer(this); - upTimer->setInterval(300000); //maximum time between refreshes is 5 minutes - connect(upTimer, SIGNAL(timeout()), this, SLOT(checkAll()) ); - isRunning = false; stopping = false; checking = false; pending = false; - QTimer::singleShot(100, this, SLOT(start()) ); - //Also do one extra check a minute or so after startup (just in case something got missed in the initial flood of registrations) - QTimer::singleShot(90000,this, SLOT(checkAll()) ); - connect(LSession::handle(), SIGNAL(TrayListChanged()), this, SLOT(checkAll()) ); - connect(LSession::handle(), SIGNAL(TrayIconChanged(WId)), this, SLOT(UpdateTrayWindow(WId)) ); - connect(LSession::handle(), SIGNAL(VisualTrayAvailable()), this, SLOT(start()) ); -} - -LSysTray::~LSysTray(){ - if(isRunning){ - this->stop(); - } -} - -void LSysTray::start(){ - if(isRunning || stopping){ return; } //already running - isRunning = LSession::handle()->registerVisualTray(this->winId()); - qDebug() << "Visual Tray Started:" << this->type() << isRunning; - if(isRunning){ - //upTimer->start(); - QTimer::singleShot(0,this, SLOT(checkAll()) ); - } -} - -void LSysTray::stop(){ - if(!isRunning){ return; } - stopping = true; - upTimer->stop(); - //Now close down the system tray registry - qDebug() << "Stop visual system tray:" << this->type(); - //LX11::closeSystemTray(TrayID); - //TrayID = 0; - disconnect(this); //remove any signals/slots - isRunning = false; - //Release all the tray applications and delete the containers - if( !LSession::handle()->currentTrayApps(this->winId()).isEmpty() ){ - qDebug() << " - Remove tray applications"; - //This overall system tray is not closed down - go ahead and release them here - for(int i=(trayIcons.length()-1); i>=0; i--){ - trayIcons[i]->detachApp(); - TrayIcon *cont = trayIcons.takeAt(i); - LI->removeWidget(cont); - cont->deleteLater(); - } - } - //Now let some other visual tray take over - LSession::handle()->unregisterVisualTray(this->winId()); - qDebug() << "Done stopping visual tray"; -} - -// ======================== -// PRIVATE FUNCTIONS -// ======================== -void LSysTray::checkAll(){ - if(!isRunning || stopping || checking){ pending = true; return; } //Don't check if not running at the moment - checking = true; - pending = false; - //Make sure this tray should handle the windows (was not disabled in the backend) - bool TrayRunning = LSession::handle()->registerVisualTray(this->winId()); - //qDebug() << "System Tray: Check tray apps"; - QList<WId> wins = LSession::handle()->currentTrayApps(this->winId()); - for(int i=0; i<trayIcons.length(); i++){ - int index = wins.indexOf(trayIcons[i]->appID()); - if(index < 0){ - //Tray Icon no longer exists: remove it - qDebug() << " - Visual System Tray: Remove Icon:" << trayIcons[i]->appID(); - TrayIcon *cont = trayIcons.takeAt(i); - cont->cleanup(); - LI->removeWidget(cont); - cont->deleteLater(); - i--; //List size changed - //Re-adjust the maximum widget size to account for what is left - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - this->setMaximumSize( trayIcons.length()*this->height(), 10000); - }else{ - this->setMaximumSize(10000, trayIcons.length()*this->width()); - } - }else{ - //Tray Icon already exists - //qDebug() << " - SysTray: Update Icon"; - trayIcons[i]->update(); - wins.removeAt(index); //Already found - remove from the list - } - } - //Now go through any remaining windows and add them - for(int i=0; i<wins.length() && TrayRunning; i++){ - qDebug() << " - Visual System Tray: Add Icon:" << wins[i]; - TrayIcon *cont = new TrayIcon(this); - connect(cont, SIGNAL(BadIcon()), this, SLOT(checkAll()) ); - //LSession::processEvents(); - trayIcons << cont; - LI->addWidget(cont); - //qDebug() << " - Update tray layout"; - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - int sz = this->height()-2-2*frame->frameWidth(); - if(sz>64){ sz = 64; } - cont->setSizeSquare(sz); //horizontal tray - this->setMaximumSize( trayIcons.length()*this->height(), 10000); - }else{ - int sz = this->width()-2-2*frame->frameWidth(); - if(sz>64){ sz = 64; } - cont->setSizeSquare(sz); //vertical tray - this->setMaximumSize(10000, trayIcons.length()*this->width()); - } - //LSession::processEvents(); - //qDebug() << " - Attach tray app"; - cont->attachApp(wins[i]); - if(cont->appID()==0){ - //could not attach window - remove the widget - qDebug() << " - Invalid Tray App: Could Not Embed:"; - trayIcons.takeAt(trayIcons.length()-1); //Always at the end - LI->removeWidget(cont); - cont->deleteLater(); - continue; - } - LI->update(); //make sure there is no blank space in the layout - } - /*if(listChanged){ - //Icons got moved around: be sure to re-draw all of them to fix visuals - for(int i=0; i<trayIcons.length(); i++){ - trayIcons[i]->update(); - } - }*/ - //qDebug() << " - System Tray: check done"; - checking = false; - if(pending){ QTimer::singleShot(0,this, SLOT(checkAll()) ); } -} - -void LSysTray::UpdateTrayWindow(WId win){ - if(!isRunning || stopping || checking){ return; } - for(int i=0; i<trayIcons.length(); i++){ - if(trayIcons[i]->appID()==win){ - //qDebug() << "System Tray: Update Window " << win; - trayIcons[i]->repaint(); //don't use update() because we need an instant repaint (not a cached version) - return; //finished now - } - } - //Could not find tray in the list, run the checkall routine to make sure we are not missing any - //qDebug() << "System Tray: Missing Window - check all"; - QTimer::singleShot(0,this, SLOT(checkAll()) ); -} - diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/LSysTray.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/LSysTray.h deleted file mode 100644 index 7db307c6..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/LSysTray.h +++ /dev/null @@ -1,74 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2012-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_SYSTRAY_H -#define _LUMINA_DESKTOP_SYSTRAY_H - -//Qt includes -#include <QFrame> -#include <QHBoxLayout> -#include <QDebug> -#include <QX11Info> -#include <QCoreApplication> - -//Local includes -#include "../LPPlugin.h" -#include "TrayIcon.h" - -//SYSTEM TRAY STANDARD DEFINITIONS -#define SYSTEM_TRAY_REQUEST_DOCK 0 -#define SYSTEM_TRAY_BEGIN_MESSAGE 1 -#define SYSTEM_TRAY_CANCEL_MESSAGE 2 - -class LSysTray : public LPPlugin{ - Q_OBJECT -public: - LSysTray(QWidget *parent = 0, QString id="systemtray", bool horizontal=true); - ~LSysTray(); - - virtual void AboutToClose(){ - this->stop(); - } - -private: - bool isRunning, stopping, checking, pending; - QList<TrayIcon*> trayIcons; - QFrame *frame; - QBoxLayout *LI; //layout items - QTimer *upTimer; //manual timer to force refresh of all items - -private slots: - void checkAll(); - void UpdateTrayWindow(WId win); - - //void removeTrayIcon(WId win); - -public slots: - void start(); - void stop(); - - virtual void OrientationChange(){ - //make sure the internal layout has the same orientation as the main widget - LI->setDirection( this->layout()->direction() ); - //Re-adjust the maximum widget size - int sz; - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - this->setMaximumSize( trayIcons.length()*this->height(), 10000); - sz = this->height()-2*frame->frameWidth(); - }else{ - this->setMaximumSize(10000, trayIcons.length()*this->width()); - sz = this->width()-2*frame->frameWidth(); - } - if(sz>64){ sz = 64; } //many tray icons can't go larger than this anyway - for(int i=0; i<trayIcons.length(); i++){ - trayIcons[i]->setSizeSquare(sz); - trayIcons[i]->repaint(); - } - } - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/TrayIcon.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/TrayIcon.cpp deleted file mode 100644 index 9fdbce50..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/TrayIcon.cpp +++ /dev/null @@ -1,128 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "TrayIcon.h" - -#include <LSession.h> -#include <QScreen> -#include <LuminaX11.h> - -TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){ - AID = 0; //nothing yet - IID = 0; - dmgID = 0; - badpaints = 0; - //this->setLayout(new QHBoxLayout); - //this->layout()->setContentsMargins(0,0,0,0); -} - -TrayIcon::~TrayIcon(){ -} - -void TrayIcon::cleanup(){ - AID = IID = 0; -} - -WId TrayIcon::appID(){ - return AID; -} - -void TrayIcon::attachApp(WId id){ - if(id==0){ return; } //nothing to attach - else if(AID!=0){ qWarning() << "Tray Icon is already attached to a window!"; return; } - AID = id; - //WIN = QWindow::fromWinId(AID); - //connect(WIN, SIGNAL( - //this->layout()->addWidget( QWidget::createWindowContainer(WIN, this) ); - IID = this->winId(); //embed directly into this widget - dmgID = LSession::handle()->XCB->EmbedWindow(AID, IID); - if( dmgID != 0 ){ - LSession::handle()->XCB->RestoreWindow(AID); //make it visible - //qDebug() << "New System Tray App:" << AID; - QTimer::singleShot(1000, this, SLOT(updateIcon()) ); - }else{ - //qWarning() << "Could not Embed Tray Application:" << AID; - IID = 0; - AID = 0; - } -} - -void TrayIcon::setSizeSquare(int side){ - //qDebug() << " Set Fixed Systray size:" << side; - this->setFixedSize( QSize(side, side) ); -} - -// ============== -// PUBLIC SLOTS -// ============== -void TrayIcon::detachApp(){ - if(AID==0){ return; } //already detached - //qDebug() << "Detach App:" << AID; - //Temporarily move the AID, so that internal slots do not auto-run - WId tmp = AID; - AID = 0; - //Now detach the application window and clean up - //qDebug() << " - Unembed"; - //WIN->setParent(0); //Reset parentage back to the main stack - LSession::handle()->XCB->UnembedWindow(tmp); - //qDebug() << " - finished app:" << tmp; - IID = 0; -} - -// ============== -// PRIVATE SLOTS -// ============== -void TrayIcon::updateIcon(){ - if(AID==0){ return; } - //Make sure the icon is square - QSize icosize = this->size(); - LSession::handle()->XCB->ResizeWindow(AID, icosize.width(), icosize.height()); - QTimer::singleShot(500, this, SLOT(update()) ); //make sure to re-draw the window in a moment -} - -// ============= -// PROTECTED -// ============= -void TrayIcon::paintEvent(QPaintEvent *event){ - QWidget::paintEvent(event); //make sure the background is already painted - if(AID!=0){ - //Update the background on the tray app - //qDebug() << "Paint Tray Background"; - //LSession::handle()->XCB->SetWindowBackground(this, this->geometry(), AID); - //qDebug() << "Paint Tray:" << AID; - QPainter painter(this); - //Now paint the tray app on top of the background - //qDebug() << " - Draw tray:" << AID << IID << this->winId(); - //qDebug() << " - - " << event->rect().x() << event->rect().y() << event->rect().width() << event->rect().height(); - //qDebug() << " - Get image:" << AID; - QPixmap pix = LSession::handle()->XCB->TrayImage(AID); //= WIN->icon().pixmap(this->size()); - - //qDebug() << " - Pix size:" << pix.size().width() << pix.size().height(); - //qDebug() << " - Geom:" << this->geometry().x() << this->geometry().y() << this->geometry().width() << this->geometry().height(); - if(!pix.isNull()){ - if(this->size() != pix.size()){ QTimer::singleShot(10, this, SLOT(updateIcon())); } - painter.drawPixmap(0,0,this->width(), this->height(), pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) ); - badpaints = 0; //good paint - }else{ - badpaints++; - if(badpaints>5){ - qWarning() << " - - No Tray Icon/Image found!" << "ID:" << AID; - AID = 0; //reset back to nothing - IID = 0; - emit BadIcon(); //removed/destroyed in some non-valid way? - } - } - //qDebug() << " - Done"; - } -} - -void TrayIcon::resizeEvent(QResizeEvent *event){ - //qDebug() << "Resize Event:" << event->size().width() << event->size().height(); - if(AID!=0){ - LSession::handle()->XCB->ResizeWindow(AID, event->size()); - QTimer::singleShot(500, this, SLOT(update()) ); //make sure to re-draw the window in a moment - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/TrayIcon.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/TrayIcon.h deleted file mode 100644 index 5d072cc1..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/systemtray/TrayIcon.h +++ /dev/null @@ -1,55 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// Note: The basic idea behind this class that that it puts the app window -// in the same spot as the tray icon (to directly pass mouse events and such), -// while keeping the tray icon visual in sync with the app window -//=========================================== -#ifndef _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H -#define _LUMINA_PANEL_PLUGIN_SYSTEM_TRAY_ICON_H - -//Qt includes -#include <QWidget> -#include <QTimer> -#include <QPaintEvent> -#include <QMoveEvent> -#include <QResizeEvent> -#include <QPainter> -#include <QPixmap> -#include <QImage> -//#include <QWindow> -// libLumina includes -//#include <LuminaX11.h> - -class TrayIcon : public QWidget{ - Q_OBJECT -public: - TrayIcon(QWidget* parent = 0); - ~TrayIcon(); - - void cleanup(); //about to be removed after window was detroyed - - WId appID(); //the ID for the attached application - void attachApp(WId id); - void setSizeSquare(int side); - -public slots: - void detachApp(); - void updateIcon(); - -private: - WId IID, AID; //icon ID and app ID - int badpaints; - uint dmgID; - -protected: - void paintEvent(QPaintEvent *event); - void resizeEvent(QResizeEvent *event); - -signals: - void BadIcon(); -}; -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskButton.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskButton.cpp deleted file mode 100644 index 0dd68bb0..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskButton.cpp +++ /dev/null @@ -1,271 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LTaskButton.h" -#include "LSession.h" - -#ifndef DEBUG -#define DEBUG 0 -#endif - -LTaskButton::LTaskButton(QWidget *parent, bool smallDisplay) : LTBWidget(parent){ - actMenu = new QMenu(this); - winMenu = new QMenu(this); - UpdateMenus(); - showText = !smallDisplay; - this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - this->setAutoRaise(false); //make sure these always look like buttons - this->setContextMenuPolicy(Qt::CustomContextMenu); - this->setFocusPolicy(Qt::NoFocus); - this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); - winMenu->setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(openActionMenu()) ); - connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()) ); - connect(winMenu, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(openActionMenu()) ); - connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) ); - connect(winMenu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - connect(actMenu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); -} - -LTaskButton::~LTaskButton(){ - -} - -//=========== -// PUBLIC -//=========== -QList<WId> LTaskButton::windows(){ - QList<WId> list; - for(int i=0; i<WINLIST.length(); i++){ - list << WINLIST[i].windowID(); - } - return list; -} - -QString LTaskButton::classname(){ - return cname; -} - -bool LTaskButton::isActive(){ - return cstate == LXCB::ACTIVE; -} - -void LTaskButton::addWindow(WId win){ - WINLIST << LWinInfo(win); - UpdateButton(); -} - -void LTaskButton::rmWindow(WId win){ - for(int i=0; i<WINLIST.length(); i++){ - if(WINLIST[i].windowID() == win){ - WINLIST.removeAt(i); - break; - } - } - UpdateButton(); -} - -//========== -// PRIVATE -//========== -LWinInfo LTaskButton::currentWindow(){ - if(WINLIST.length() == 1 || cWin.windowID()==0){ - return WINLIST[0]; //only 1 window - this must be it - }else{ - return cWin; - } -} - -//============= -// PUBLIC SLOTS -//============= -void LTaskButton::UpdateButton(){ - if(winMenu->isVisible()){ return; } //skip this if the window menu is currently visible for now - bool statusOnly = (WINLIST.length() == LWINLIST.length()); - LWINLIST = WINLIST; - - winMenu->clear(); - LXCB::WINDOWVISIBILITY showstate = LXCB::IGNORE; - for(int i=0; i<WINLIST.length(); i++){ - if(WINLIST[i].windowID() == 0){ - WINLIST.removeAt(i); - i--; - continue; - } - if(i==0 && !statusOnly){ - //Update the button visuals from the first window - this->setIcon(WINLIST[i].icon(noicon)); - cname = WINLIST[i].Class(); - if(cname.isEmpty()){ - //Special case (chrome/chromium does not register *any* information with X except window title) - cname = WINLIST[i].text(); - if(cname.contains(" - ")){ cname = cname.section(" - ",-1); } - } - this->setToolTip(cname); - } - bool junk; - QAction *tmp = winMenu->addAction( WINLIST[i].icon(junk), WINLIST[i].text() ); - tmp->setData(i); //save which number in the WINLIST this entry is for - LXCB::WINDOWVISIBILITY stat = WINLIST[i].status(true); //update the saved state for the window - if(stat<LXCB::ACTIVE && WINLIST[i].windowID() == LSession::handle()->activeWindow()){ stat = LXCB::ACTIVE; } - if(stat > showstate){ showstate = stat; } //higher priority - } - //Now setup the button appropriately - // - visibility - if(showstate == LXCB::IGNORE || WINLIST.length() < 1){ this->setVisible(false); } - else{ this->setVisible(true); } - // - functionality - if(WINLIST.length() == 1){ - //single window - this->setPopupMode(QToolButton::DelayedPopup); - this->setMenu(actMenu); - if(showText){ - QString txt = WINLIST[0].text(); - if(txt.length()>30){ txt.truncate(27); txt.append("..."); } - else if(txt.length()<30){ txt = txt.leftJustified(30, ' '); } - this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); this->setText(txt); - }else if(noicon){ this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); this->setText( cname ); } - else{ this->setToolButtonStyle(Qt::ToolButtonIconOnly); this->setText(""); } - this->setToolTip(WINLIST[0].text()); - }else if(WINLIST.length() > 1){ - //multiple windows - this->setPopupMode(QToolButton::InstantPopup); - this->setMenu(winMenu); - this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - if(noicon || showText){ "("+QString::number(WINLIST.length())+") "+cname; } - else{ this->setText("("+QString::number(WINLIST.length())+")"); } - } - this->setState(showstate); //Make sure this is after the button setup so that it properly sets the margins/etc - cstate = showstate; //save this for later -} - -void LTaskButton::UpdateMenus(){ - //Action menu should be auto-created for the state of the current window (cWin/cstate) - actMenu->clear(); - if(cstate!=LXCB::ACTIVE){ - actMenu->addAction( LXDG::findIcon("edit-select",""), tr("Activate Window"), this, SLOT(triggerWindow()) ); - } - if(cstate!=LXCB::INVISIBLE){ - actMenu->addAction( LXDG::findIcon("view-close",""), tr("Minimize Window"), this, SLOT(minimizeWindow()) ); - if(LSession::handle()->XCB->WindowIsMaximized(cWin.windowID()) ){ - actMenu->addAction( LXDG::findIcon("view-restore",""), tr("Restore Window"), this, SLOT(maximizeWindow()) ); - }else{ - actMenu->addAction( LXDG::findIcon("view-fullscreen",""), tr("Maximize Window"), this, SLOT(maximizeWindow()) ); - } - } - actMenu->addAction( LXDG::findIcon("window-close",""), tr("Close Window"), this, SLOT(closeWindow()) ); - if(WINLIST.length()>1 && !winMenu->isVisible()){ - actMenu->addSeparator(); - actMenu->addAction( LXDG::findIcon("layer-visible-on",""), tr("Show All Windows"), this, SLOT(showAllWindows()) ); - actMenu->addAction( LXDG::findIcon("layer-visible-off",""), tr("Minimize All Windows"), this, SLOT(hideAllWindows()) ); - actMenu->addAction( LXDG::findIcon("window-close",""), tr("Close All Windows"), this, SLOT(closeAllWindows()) ); - } -} - -//============= -// PRIVATE SLOTS -//============= -void LTaskButton::buttonClicked(){ - if(WINLIST.length() > 1){ - winMenu->popup(QCursor::pos()); - }else{ - triggerWindow(); - } -} - -void LTaskButton::closeWindow(){ - if(DEBUG){ qDebug() << "Close Window:" << this->text(); } - if(winMenu->isVisible()){ winMenu->hide(); } - LWinInfo win = currentWindow(); - LSession::handle()->XCB->CloseWindow(win.windowID()); - cWin = LWinInfo(); //clear the current -} - -void LTaskButton::maximizeWindow(){ - if(DEBUG){ qDebug() << "Maximize Window:" << this->text(); } - if(winMenu->isVisible()){ winMenu->hide(); } - LWinInfo win = currentWindow(); - LSession::handle()->XCB->MaximizeWindow(win.windowID()); - //LSession::handle()->adjustWindowGeom(win.windowID(), true); //run this for now until the WM works properly - cWin = LWinInfo(); //clear the current -} - -void LTaskButton::minimizeWindow(){ - if(DEBUG){ qDebug() << "Minimize Window:" << this->text(); } - if(winMenu->isVisible()){ winMenu->hide(); } - LWinInfo win = currentWindow(); - LSession::handle()->XCB->MinimizeWindow(win.windowID()); - cWin = LWinInfo(); //clear the current - QTimer::singleShot(100, this, SLOT(UpdateButton()) ); //make sure to update this button if losing active status -} - -void LTaskButton::showAllWindows(){ - for(int i=WINLIST.length()-1; i>=0; i--){ - if(WINLIST[i].status()==LXCB::INVISIBLE){ - LSession::handle()->XCB->RestoreWindow(WINLIST[i].windowID()); - } - } -} - -void LTaskButton::hideAllWindows(){ - for(int i=WINLIST.length()-1; i>=0; i--){ - LXCB::WINDOWVISIBILITY state = WINLIST[i].status(); - if(state==LXCB::VISIBLE || state==LXCB::ACTIVE){ - LSession::handle()->XCB->MinimizeWindow(WINLIST[i].windowID()); - } - } -} - -void LTaskButton::closeAllWindows(){ - for(int i=WINLIST.length()-1; i>=0; i--){ - LSession::handle()->XCB->CloseWindow(WINLIST[i].windowID()); - } -} - -void LTaskButton::triggerWindow(){ - LWinInfo win = currentWindow(); - //Check which state the window is currently in and flip it to the other - //LXCB::WINDOWSTATE state = cstate; - //if(DEBUG){ qDebug() << "Window State: " << state; } - if(cstate == LXCB::ACTIVE){ - if(DEBUG){ qDebug() << "Minimize Window:" << this->text(); } - LSession::handle()->XCB->MinimizeWindow(win.windowID()); - QTimer::singleShot(100, this, SLOT(UpdateButton()) ); //make sure to update this button if losing active status - }else{ - if(DEBUG){ qDebug() << "Activate Window:" << this->text(); } - LSession::handle()->XCB->ActivateWindow(win.windowID()); - } - cWin = LWinInfo(); //clear the current -} - -void LTaskButton::winClicked(QAction* act){ - //Get the window from the action - if(act->data().toInt() < WINLIST.length()){ - cWin = WINLIST[act->data().toInt()]; - cstate = cWin.status(); - }else{ cWin = LWinInfo(); } //clear it - //Now trigger the window - triggerWindow(); -} - -void LTaskButton::openActionMenu(){ - //Get the Window the mouse is currently over - QPoint curpos = QCursor::pos(); - QAction *act = winMenu->actionAt(winMenu->mapFromGlobal(curpos)); - //qDebug() << "Button Context Menu:" << curpos.x() << curpos.y() << winMenu->geometry().x() << winMenu->geometry().y() << winMenu->geometry().width() << winMenu->geometry().height(); - cWin = WINLIST[0]; //default to the first window - if( act != 0 && winMenu->isVisible() ){ - //Get the window from the action - //qDebug() << "Found Action:" << act->data().toInt(); - if(act->data().toInt() < WINLIST.length()){ - cWin = WINLIST[act->data().toInt()]; - } - } - cstate = cWin.status(); - //Now show the action menu - UpdateMenus(); - actMenu->popup(QCursor::pos()); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskButton.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskButton.h deleted file mode 100644 index 6b171c6a..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskButton.h +++ /dev/null @@ -1,73 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_TASK_BUTTON_H -#define _LUMINA_DESKTOP_TASK_BUTTON_H - -// Qt includes -#include <QWidget> -#include <QList> -#include <QIcon> -#include <QCursor> -#include <QMenu> -#include <QEvent> -#include <QAction> - -// libLumina includes -#include <LuminaXDG.h> -#include <LuminaX11.h> - -// Local includes -#include "../../LWinInfo.h" -#include "../LTBWidget.h" - -class LTaskButton : public LTBWidget{ - Q_OBJECT -public: - LTaskButton(QWidget *parent=0, bool smallDisplay = true); - ~LTaskButton(); - - //Window Information - QList<WId> windows(); - QString classname(); - bool isActive(); - - //Window Management - void addWindow(WId win); //Add a window to this button - void rmWindow(WId win); //Remove a window from this button - -private: - QList<LWinInfo> WINLIST; - QList<LWinInfo> LWINLIST; - QMenu *actMenu; // action menu (custom context menu) - QMenu *winMenu; // window menu (if more than 1) - LWinInfo cWin; - QString cname; //class name for the entire button - bool noicon, showText; - - LWinInfo currentWindow(); //For getting the currently-active window - LXCB::WINDOWVISIBILITY cstate; //current state of the button - -public slots: - void UpdateButton(); //re-sync the current window infomation - void UpdateMenus(); //re-create the menus (text + icons) - -private slots: - void buttonClicked(); - void closeWindow(); //send the signal to close a window - void maximizeWindow(); //send the signal to maximize/restore a window - void minimizeWindow(); //send the signal to minimize a window (iconify) - void showAllWindows(); - void hideAllWindows(); - void closeAllWindows(); - void triggerWindow(); //change b/w visible and invisible - void winClicked(QAction*); - void openActionMenu(); - -signals: - void MenuClosed(); -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskManagerPlugin.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskManagerPlugin.cpp deleted file mode 100644 index 79c5dd36..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskManagerPlugin.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LTaskManagerPlugin.h" -#include "../../LSession.h" - -LTaskManagerPlugin::LTaskManagerPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ - timer = new QTimer(this); - timer->setSingleShot(true); - timer->setInterval(10); // 1/100 second - connect(timer, SIGNAL(timeout()), this, SLOT(UpdateButtons()) ); - usegroups = true; //backwards-compatible default value - if(id.contains("-nogroups")){ usegroups = false; } - connect(LSession::handle(), SIGNAL(WindowListEvent()), this, SLOT(checkWindows()) ); - connect(LSession::handle(), SIGNAL(WindowListEvent(WId)), this, SLOT(UpdateButton(WId)) ); - this->layout()->setContentsMargins(0,0,0,0); - QTimer::singleShot(0,this, SLOT(UpdateButtons()) ); //perform an initial sync - //QTimer::singleShot(100,this, SLOT(OrientationChange()) ); //perform an initial sync -} - -LTaskManagerPlugin::~LTaskManagerPlugin(){ - -} - -//============== -// PRIVATE SLOTS -//============== -void LTaskManagerPlugin::UpdateButtons(){ - updating = QDateTime::currentDateTime(); //global time stamp - QDateTime ctime = updating; //current thread time stamp - - //Get the current window list - QList<WId> winlist = LSession::handle()->XCB->WindowList(); - // Ignore the windows which don't want to be listed - for (int i = 0; i < winlist.length(); i++) { - QList<LXCB::WINDOWSTATE> states = LSession::handle()->XCB->WM_Get_Window_States(winlist[i]); - for (int j = 0; j < states.length(); j++) { - if (states[j] == LXCB::S_SKIP_TASKBAR) { - // Skip taskbar window - winlist.removeAt(i); - i--; - break; - } - } - } - //Do not change the status of the previously active window if it just changed to a non-visible window - //WId activeWin = LSession::handle()->XCB->ActiveWindow(); - //bool skipActive = !winlist.contains(activeWin); - //qDebug() << "Update Buttons:" << winlist; - if(updating > ctime){ return; } //another thread kicked off already - stop this one - //Now go through all the current buttons first - for(int i=0; i<BUTTONS.length(); i++){ - //Get the windows managed in this button - QList<WId> WI = BUTTONS[i]->windows(); - bool updated=false; - if(updating > ctime){ return; } //another thread kicked off already - stop this one - //Loop over all the windows for this button - for(int w=0; w<WI.length(); w++){ - if(updating > ctime){ return; } //another thread kicked off already - stop this one - if( winlist.contains( WI[w] ) ){ - //Still current window - update it later - winlist.removeAll(WI[w] ); //remove this window from the list since it is done - }else{ - //Window was closed - remove it - if(WI.length()==1){ - //Remove the entire button - //qDebug() << "Window Closed: Remove Button" ; - this->layout()->takeAt(i); //remove from the layout - BUTTONS.takeAt(i)->deleteLater(); - i--; - updated = true; //prevent updating a removed button - break; //break out of the button->window loop - }else{ - //qDebug() << "Window Closed: Remove from button:" << WI[w].windowID() << "Button:" << w; - BUTTONS[i]->rmWindow(WI[w]); // one of the multiple windows for the button - WI.removeAt(w); //remove this window from the list - w--; - } - updated=true; //button already changed - } - if(updating > ctime){ return; } //another thread kicked off already - stop this one - } - if(!updated){ - //qDebug() << "Update Button:" << i; - if(updating > ctime){ return; } //another thread kicked off already - stop this one - //if(!skipActive || !BUTTONS[i]->isActive()){ - QTimer::singleShot(1,BUTTONS[i], SLOT(UpdateButton()) ); //keep moving on - //} - } - } - //Now go through the remaining windows - for(int i=0; i<winlist.length(); i++){ - //New windows, create buttons for each (add grouping later) - if(updating > ctime){ return; } //another thread kicked off already - stop this one - //Check for a button that this can just be added to - QString ctxt = LSession::handle()->XCB->WindowClass(winlist[i]); - bool found = false; - for(int b=0; b<BUTTONS.length(); b++){ - if(updating > ctime){ return; } //another thread kicked off already - stop this one - if(BUTTONS[b]->classname()== ctxt && usegroups){ - //This adds a window to an existing group - found = true; - //qDebug() << "Add Window to Button:" << b; - BUTTONS[b]->addWindow(winlist[i]); - break; - } - } - if(!found){ - if(updating > ctime){ return; } //another thread kicked off already - stop this one - //No group, create a new button - //qDebug() << "New Button"; - LTaskButton *but = new LTaskButton(this, usegroups); - but->addWindow( winlist[i] ); - if(this->layout()->direction()==QBoxLayout::LeftToRight){ - but->setIconSize(QSize(this->height(), this->height())); - }else{ - but->setIconSize(QSize(this->width(), this->width())); - } - this->layout()->addWidget(but); - connect(but, SIGNAL(MenuClosed()), this, SIGNAL(MenuClosed())); - BUTTONS << but; - } - } -} - -void LTaskManagerPlugin::UpdateButton(WId win){ - for(int i=0; i<BUTTONS.length(); i++){ - if(BUTTONS[i]->windows().contains(win)){ - qDebug() << "Update Task Manager Button (single window ping)"; - QTimer::singleShot(0,BUTTONS[i], SLOT(UpdateButton()) ); - break; - } - } -} - -void LTaskManagerPlugin::checkWindows(){ - timer->start(); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskManagerPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskManagerPlugin.h deleted file mode 100644 index e6371f34..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/taskmanager/LTaskManagerPlugin.h +++ /dev/null @@ -1,71 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_TASK_MANAGER_PLUGIN_H -#define _LUMINA_DESKTOP_TASK_MANAGER_PLUGIN_H - -// Qt includes -#include <QWidget> -#include <QList> -#include <QString> -#include <QDebug> -#include <QTimer> -#include <QEvent> -#include <QDateTime> - -// libLumina includes -#include <LuminaX11.h> - -// Local includes -#include "LTaskButton.h" -#include "LWinInfo.h" -#include "../LPPlugin.h" - -class LTaskManagerPlugin : public LPPlugin{ - Q_OBJECT -public: - LTaskManagerPlugin(QWidget *parent=0, QString id="taskmanager", bool horizontal=true); - ~LTaskManagerPlugin(); - -private: - QList<LTaskButton*> BUTTONS; //to keep track of the current buttons - QTimer *timer; - QDateTime updating; //quick flag for if it is currently working - bool usegroups; - -private slots: - void UpdateButtons(); - void UpdateButton(WId win); - void checkWindows(); - -public slots: - void LocaleChange(){ - UpdateButtons(); - } - void ThemeChange(){ - UpdateButtons(); - } - void OrientationChange(){ - if(this->layout()->direction()==QBoxLayout::LeftToRight){ //horizontal - this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - this->layout()->setAlignment(Qt::AlignLeft); - QSize sz(this->height(), this->height()); - for(int i=0; i<BUTTONS.length(); i++){ - BUTTONS[i]->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - BUTTONS[i]->setIconSize(sz); - } - }else{ //vertical - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - this->layout()->setAlignment(Qt::AlignTop); - QSize sz(this->width(), this->width()); - for(int i=0; i<BUTTONS.length(); i++){ - BUTTONS[i]->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - BUTTONS[i]->setIconSize(sz); - } - } - } -}; -#endif
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/LUserButton.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/LUserButton.cpp deleted file mode 100644 index acb27135..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/LUserButton.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//=========================================== -// 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->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); - connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - usermenu = new UserWidget(this); - connect(usermenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) ); - mact = new QWidgetAction(this); - mact->setDefaultWidget(usermenu); - menu->addAction(mact); - - button->setMenu(menu); - connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) ); - //Setup the global shortcut handling for opening the start menu - connect(QApplication::instance(), SIGNAL(StartButtonActivated()), this, SLOT(shortcutActivated()) ); - LSession::handle()->registerStartButton(this->type()); - - QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes -} - -LUserButtonPlugin::~LUserButtonPlugin(){ - -} - -void LUserButtonPlugin::updateButtonVisuals(){ - button->setToolTip(tr("Quickly launch applications or open files")); - button->setText( SYSTEM::user() ); - if( QFile::exists(QDir::homePath()+"/.loginIcon.png") ){ - button->setIcon( QIcon(QDir::homePath()+"/.loginIcon.png") ); - }else{ - button->setIcon( LXDG::findIcon("user-identity", ":/images/default-user.png") ); //force icon refresh - } -} - -// ======================== -// PRIVATE FUNCTIONS -// ======================== -void LUserButtonPlugin::openMenu(){ - usermenu->UpdateMenu(); - button->showMenu(); -} - -void LUserButtonPlugin::closeMenu(){ - menu->hide(); -} - -void LUserButtonPlugin::shortcutActivated(){ - if(LSession::handle()->registerStartButton(this->type())){ - if(menu->isVisible()){ closeMenu(); } - else{ openMenu(); } - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/LUserButton.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/LUserButton.h deleted file mode 100644 index 8d5e5040..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/LUserButton.h +++ /dev/null @@ -1,75 +0,0 @@ -//=========================================== -// 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(); - void shortcutActivated(); - - void updateButtonVisuals(); - -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()) ); - } - this->layout()->update(); - updateButtonVisuals(); - } - - void LocaleChange(){ - updateButtonVisuals(); - usermenu->UpdateAll(); - } - - void ThemeChange(){ - updateButtonVisuals(); - usermenu->UpdateAll(); - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserItemWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserItemWidget.cpp deleted file mode 100644 index 8d7dab7a..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserItemWidget.cpp +++ /dev/null @@ -1,205 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "UserItemWidget.h" -#include <LUtils.h> -#include <LDesktopUtils.h> -#include <QMenu> - -#define TEXTCUTOFF 165 -UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, bool goback) : QFrame(parent){ - createWidget(); - //Now fill it appropriately - bool inHome = type.endsWith("-home"); //internal code - if(inHome){ type = type.remove("-home"); } - if(itemPath.endsWith(".desktop") || type=="app"){ - XDGDesktop item(itemPath); - if( item.isValid() ){ - icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(item.name, Qt::ElideRight, TEXTCUTOFF) ); - setupActions(&item); - }else{ - gooditem = false; - return; - } - }else if(type=="dir"){ - actButton->setVisible(false); - if(itemPath.endsWith("/")){ itemPath.chop(1); } - if(goback){ - icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(32,32) ); - name->setText( tr("Go Back") ); - }else{ - icon->setPixmap( LXDG::findIcon("folder","").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); - } - }else{ - actButton->setVisible(false); - if(itemPath.endsWith("/")){ itemPath.chop(1); } - if(QFileInfo(itemPath).isDir()){ - type = "dir"; - icon->setPixmap( LXDG::findIcon("folder","").pixmap(32,32) ); - }else if(LUtils::imageExtensions().contains(itemPath.section("/",-1).section(".",-1).toLower()) ){ - icon->setPixmap( QIcon(itemPath).pixmap(32,32) ); - }else{ - icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1)).pixmap(32,32) ); - } - name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); - } - icon->setWhatsThis(itemPath); - if(!goback){ this->setWhatsThis(name->text()); } - isDirectory = (type=="dir"); //save this for later - if(LDesktopUtils::isFavorite(itemPath)){ - linkPath = itemPath; - isShortcut=true; - }else if( inHome ){//|| itemPath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ - isShortcut = true; - }else{ - isShortcut = false; - } - //Now setup the button appropriately - setupButton(goback); -} - -UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(parent){ - if(item==0){ return; } - createWidget(); - isDirectory = false; - if(LDesktopUtils::isFavorite(item->filePath)){ - linkPath = item->filePath; - isShortcut=true; - }else if( item->filePath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ - isShortcut = true; - }else{ - isShortcut = false; - } - //Now fill it appropriately - icon->setPixmap( LXDG::findIcon(item->icon,"preferences-system-windows-actions").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(item->name, Qt::ElideRight, TEXTCUTOFF) ); - this->setWhatsThis(name->text()); - icon->setWhatsThis(item->filePath); - //Now setup the buttons appropriately - setupButton(); - setupActions(item); -} - -UserItemWidget::~UserItemWidget(){ - delete button; - delete icon; - delete name; -} - - -void UserItemWidget::createWidget(){ - //Initialize the widgets - gooditem = true; - menuopen = false; - menureset = new QTimer(this); - menureset->setSingleShot(true); - menureset->setInterval(1000); //1 second - this->setContentsMargins(0,0,0,0); - button = new QToolButton(this); - button->setIconSize( QSize(14,14) ); - button->setAutoRaise(true); - actButton = new QToolButton(this); - actButton->setPopupMode(QToolButton::InstantPopup); - actButton->setFixedSize( QSize(17,34) ); - actButton->setArrowType(Qt::DownArrow); - icon = new QLabel(this); - icon->setFixedSize( QSize(34,34) ); - 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(actButton); - this->layout()->addWidget(name); - this->layout()->addWidget(button); - //Set a custom object name so this can be tied into the Lumina Theme stylesheets - this->setObjectName("LuminaUserItemWidget"); - //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(bool disable){ - //if(isDirectory){ qDebug() << "Directory Entry:" << isShortcut << linkPath << icon->whatsThis(); } - - if(disable){ - button->setVisible(false); - }else if(isShortcut && !linkPath.isEmpty()){ //Favorite Item - can always remove this - button->setWhatsThis("remove"); - button->setIcon( LXDG::findIcon("list-remove","") ); - button->setToolTip(tr("Remove Shortcut")); - connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) ); - }else if(isShortcut){ //Physical File/Dir - can remove - button->setWhatsThis("remove"); - button->setIcon( LXDG::findIcon("user-trash","") ); - button->setToolTip(tr("Delete File")); - connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) ); - }else if(!isShortcut){// if( !QFile::exists( QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1) ) && !LUtils::isFavorite(icon->whatsThis() ) ){ - //This file does not have a shortcut yet -- allow the user to add it - button->setWhatsThis("add"); - button->setIcon( LXDG::findIcon("bookmark-toolbar","") ); - 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); - } - if(isShortcut){ - name->setToolTip(icon->whatsThis()); //also allow the user to see the full shortcut path - } -} - -void UserItemWidget::setupActions(XDGDesktop *app){ - if(app==0 || app->actions.isEmpty()){ actButton->setVisible(false); return; } - //Actions Available - go ahead and list them all - actButton->setMenu( new QMenu(this) ); - for(int i=0; i<app->actions.length(); i++){ - QAction *act = new QAction(LXDG::findIcon(app->actions[i].icon, app->icon), app->actions[i].name, this); - act->setToolTip(app->actions[i].ID); - act->setWhatsThis(app->actions[i].ID); - actButton->menu()->addAction(act); - } - connect(actButton->menu(), SIGNAL(triggered(QAction*)), this, SLOT(actionClicked(QAction*)) ); - connect(actButton->menu(), SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) ); - connect(actButton->menu(), SIGNAL(aboutToHide()), this, SLOT(actionMenuClosed()) ); - connect(menureset, SIGNAL(timeout()), this, SLOT(resetmenuflag()) ); -} - -void UserItemWidget::buttonClicked(){ - button->setVisible(false); - if(button->whatsThis()=="add"){ - LDesktopUtils::addFavorite(icon->whatsThis()); - //QFile::link(icon->whatsThis(), QDir::homePath()+"/.lumina/favorites/"+icon->whatsThis().section("/",-1) ); - emit NewShortcut(); - }else if(button->whatsThis()=="remove"){ - if(linkPath.isEmpty()){ - //This is a desktop file - if(isDirectory){ - QProcess::startDetached("rm -r \""+icon->whatsThis()+"\""); - }else{ - QFile::remove(icon->whatsThis()); - } - //Don't emit the RemovedShortcut signal here - the automatic ~/Desktop watcher will see the change when finished - }else{ - LDesktopUtils::removeFavorite(icon->whatsThis()); //This is a favorite - emit RemovedShortcut(); - } - } -} - -void UserItemWidget::ItemClicked(){ - if(!linkPath.isEmpty()){ emit RunItem(linkPath); } - else{ emit RunItem(icon->whatsThis()); } -} - -void UserItemWidget::actionClicked(QAction *act){ - actButton->menu()->hide(); - QString cmd = "lumina-open -action \""+act->whatsThis()+"\" \"%1\""; - if(!linkPath.isEmpty()){ cmd = cmd.arg(linkPath); } - else{ cmd = cmd.arg(icon->whatsThis()); } - emit RunItem(cmd); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserItemWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserItemWidget.h deleted file mode 100644 index 0b212f10..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserItemWidget.h +++ /dev/null @@ -1,72 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, 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 <QAction> -#include <QMenu> -#include <QTimer> - -#include <LuminaXDG.h> - -class UserItemWidget : public QFrame{ - Q_OBJECT -public: - UserItemWidget(QWidget *parent=0, QString itemPath="", QString type="unknown", bool goback=false); - UserItemWidget(QWidget *parent=0, XDGDesktop *item= 0); - ~UserItemWidget(); - - bool gooditem; -private: - QToolButton *button, *actButton; - QLabel *icon, *name; - bool isDirectory, isShortcut, menuopen; - QString linkPath; - QTimer *menureset; - - void createWidget(); - void setupButton(bool disable = false); - void setupActions(XDGDesktop*); - -private slots: - void buttonClicked(); - void ItemClicked(); - void actionClicked(QAction*); - //Functions to fix the submenu open/close issues - void actionMenuOpen(){ - if(menureset->isActive()){ menureset->stop(); } - menuopen = true; - } - void resetmenuflag(){ menuopen = false; } //tied to the "menureset" timer - void actionMenuClosed(){ menureset->start(); } - - -protected: - void mouseReleaseEvent(QMouseEvent *event){ - if(menuopen){ resetmenuflag(); } //skip this event if a submenu was open - else if(event->button() != Qt::NoButton){ ItemClicked(); } - } - -signals: - void NewShortcut(); - void RemovedShortcut(); - void RunItem(QString cmd); - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.cpp deleted file mode 100644 index a0ba8996..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, 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) : QTabWidget(parent), ui(new Ui::UserWidget){ - ui->setupUi(this); - updatingfavs = false; - if(parent!=0){ parent->setMouseTracking(true); } - this->setMouseTracking(true); - sysapps = LSession::handle()->applicationMenu()->currentAppHash(); //get the raw info - - //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_config_screensettings, SIGNAL(clicked()), this, SLOT(openScreenConfig()) ); - 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()) ); - connect(ui->tool_home_gohome, SIGNAL(clicked()), this, SLOT(slotGoHome()) ); - connect(ui->tool_home_browse, SIGNAL(clicked()), this, SLOT(slotOpenDir()) ); - connect(ui->tool_home_search, SIGNAL(clicked()), this, SLOT(slotOpenSearch()) ); - connect(ui->tool_config_about, SIGNAL(clicked()), this, SLOT(openLuminaInfo()) ); - - //Setup the special buttons - connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) ); - connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) ); - //connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) ); - - lastUpdate = QDateTime(); //make sure it refreshes - - connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateMenu()) ); - connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFavItems()) ); - QTimer::singleShot(10,this, SLOT(UpdateAll())); //make sure to load this once after initialization -} - -UserWidget::~UserWidget(){ -} - -//=========== -// PRIVATE -//=========== -void UserWidget::ClearScrollArea(QScrollArea *area){ - QWidget *wgt = area->takeWidget(); - wgt->deleteLater(); //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); - layout->setAlignment(Qt::AlignTop); - area->widget()->setLayout(layout); -} - -void UserWidget::SortScrollArea(QScrollArea *area){ - //qDebug() << "Sorting Scroll Area:"; - //Sort all the items in the scroll area alphabetically - QLayout *lay = area->widget()->layout(); - QStringList items; - for(int i=0; i<lay->count(); i++){ - items << lay->itemAt(i)->widget()->whatsThis().toLower(); - } - - items.sort(); - //qDebug() << " - Sorted Items:" << items; - for(int i=0; i<items.length(); i++){ - if(items[i].isEmpty()){ continue; } - //QLayouts are weird in that they can only add items to the end - need to re-insert almost every item - for(int j=0; j<lay->count(); j++){ - //Find this item - if(lay->itemAt(j)->widget()->whatsThis().toLower()==items[i]){ - //Found it - now move it if necessary - //qDebug() << "Found Item:" << items[i] << i << j; - lay->addItem( lay->takeAt(j) ); - break; - } - } - } - -} - -QIcon UserWidget::rotateIcon(QIcon ico){ - //Rotate the given icon to appear vertical in the tab widget - QPixmap pix = ico.pixmap(32,32); - QTransform tran; - tran.rotate(+90); //For tabs on the left/West - pix = pix.transformed(tran); - ico = QIcon(pix); - return ico; -} - -//============ -// PRIVATE SLOTS -//============ -void UserWidget::UpdateAll(){ - ui->retranslateUi(this); - //Setup the Icons - // - favorites tab - this->setTabIcon(0, rotateIcon(LXDG::findIcon("folder-favorites","")) ); - this->setTabText(0,""); - // - apps tab - this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) ); - this->setTabText(1,""); - // - home tab - this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) ); - this->setTabText(2,""); - // - config tab - this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) ); - this->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","") ); - ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") ); - ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") ); - ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") ); - ui->tool_home_search->setIcon( LXDG::findIcon("system-search","") ); - ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") ); - - //Setup the special buttons - QString APPSTORE = LOS::AppStoreShortcut(); - if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){ - //Now load the info - XDGDesktop store(APPSTORE); - bool ok = store.isValid(); - if(ok){ - ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") ); - ui->tool_app_store->setText( store.name ); - } - ui->tool_app_store->setVisible(ok); //availability - }else{ - ui->tool_app_store->setVisible(false); //not available - } - QString CONTROLPANEL = LOS::ControlPanelShortcut(); - if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){ - //Now load the info - XDGDesktop cpan(CONTROLPANEL); - bool ok = cpan.isValid(); - if(ok){ - ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") ); - } - ui->tool_controlpanel->setVisible(ok); //availability - }else{ - ui->tool_controlpanel->setVisible(false); //not available - } - /*QString QTCONFIG = LOS::QtConfigShortcut(); - if(QFile::exists(QTCONFIG) && !QTCONFIG.isEmpty()){ - ui->tool_qtconfig->setVisible(true); - ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); - }else{ - ui->tool_qtconfig->setVisible(false); - }*/ - //Now update the menus - UpdateMenu(); -} - -void UserWidget::UpdateMenu(bool forceall){ - this->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 - FavChanged(); - QString cdir = ui->label_home_dir->whatsThis(); - if(cdir.isEmpty() || !QFile::exists(cdir)){ - //Directory deleted or nothing loaded yet - ui->label_home_dir->setWhatsThis(QDir::homePath()); - QTimer::singleShot(0,this, SLOT(updateHome()) ); - }else if( lastUpdate < QFileInfo(cdir).lastModified() || forceall){ - //Directory contents changed - reload it - QTimer::singleShot(0,this, SLOT(updateHome()) ); - } - if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull() || forceall){ - updateAppCategories(); - QTimer::singleShot(0,this, SLOT(updateApps()) ); - } - lastUpdate = QDateTime::currentDateTime(); -} - -void UserWidget::LaunchItem(QString path, bool fix){ - if(!path.isEmpty()){ - qDebug() << "Launch Application:" << path; - if( fix && !path.startsWith("lumina-open") ){ LSession::LaunchApplication("lumina-open \""+path+"\""); } - else{ LSession::LaunchApplication(path); } - emit CloseMenu(); //so the menu container will close - } -} - -void UserWidget::FavChanged(){ - //uncheck the current item for a moment - int oldfav = cfav; - 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(oldfav!=cfav); -} - -void UserWidget::updateFavItems(bool newfilter){ - if(updatingfavs){ return; } - updatingfavs = true; - //qDebug() << "Updating User Favorite Items"; - QStringList newfavs = LDesktopUtils::listFavorites(); - //qDebug() << "Favorites:" << newfavs; - if(lastHomeUpdate.isNull() || (QFileInfo(QDir::homePath()+"/Desktop").lastModified() > lastHomeUpdate) || newfavs!=favs ){ - favs = newfavs; - - homefiles = LSession::handle()->DesktopFiles(); - lastHomeUpdate = QDateTime::currentDateTime(); - }else if(!newfilter){ updatingfavs = false; return; } //nothing new to change - stop now - //qDebug() << " - Passed Smoke Test..."; - QStringList favitems; - //Remember for format for favorites: <name>::::[app/dir/<mimetype>]::::<full path> - if(ui->tool_fav_apps->isChecked()){ - favitems = favs.filter("::::app::::"); - for(int i=0; i<homefiles.length(); i++){ - if(homefiles[i].fileName().endsWith(".desktop") && favitems.filter(homefiles[i].canonicalFilePath()).isEmpty() ){ - favitems << homefiles[i].fileName()+"::::app-home::::"+homefiles[i].absoluteFilePath(); - } - } - }else if(ui->tool_fav_dirs->isChecked()){ - favitems = favs.filter("::::dir::::"); - for(int i=0; i<homefiles.length(); i++){ - if(homefiles[i].isDir() && favitems.filter(homefiles[i].canonicalFilePath()).isEmpty() ){ - favitems << homefiles[i].fileName()+"::::dir-home::::"+homefiles[i].absoluteFilePath(); - } - } - }else{ - //Files - for(int i=0; i<favs.length(); i++){ - QString type = favs[i].section("::::",1,1); - if(type != "app" && type !="dir"){ - favitems << favs[i]; - } - } - for(int i=0; i<homefiles.length(); i++){ - if(!homefiles[i].isDir() && !homefiles[i].fileName().endsWith(".desktop") && favitems.filter(homefiles[i].canonicalFilePath()).isEmpty() ){ - favitems << homefiles[i].fileName()+"::::"+LXDG::findAppMimeForFile(homefiles[i].fileName())+"-home::::"+homefiles[i].absoluteFilePath(); - } - } - } - ClearScrollArea(ui->scroll_fav); - //qDebug() << " - Sorting Items"; - favitems.sort(); //sort them alphabetically - //qDebug() << " - Creating Items:" << favitems; - for(int i=0; i<favitems.length(); i++){ - if( !QFile::exists(favitems[i].section("::::",2,50)) ){ continue; } //file does not exist - just skip it - UserItemWidget *it = new UserItemWidget(ui->scroll_fav->widget(), favitems[i].section("::::",2,50), favitems[i].section("::::",1,1) ); - if(!it->gooditem){ it->deleteLater(); continue; } - 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()) ); - QApplication::processEvents(); //keep the UI snappy - might be a number of these - } - SortScrollArea(ui->scroll_fav); - updatingfavs = false; - //qDebug() << " - Done"; -} - -//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] == "All"){ name = tr("All"); icon = "application-x-executable"; } - else 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("Utilities"); icon = "applications-utilities"; } - else if(cats[i] == "Wine"){ name = tr("Wine"); icon = "wine"; } - 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()) ); - QApplication::processEvents(); //keep the UI snappy - might be a number of these - } -} - -//Home Tab -void UserWidget::updateHome(){ - qDebug() << "Update Home"; - ClearScrollArea(ui->scroll_home); - qDebug() << " - dir:" << ui->label_home_dir->whatsThis(); - QDir homedir(ui->label_home_dir->whatsThis()); - QStringList items; - if(QDir::homePath() == homedir.absolutePath()){ - ui->label_home_dir->setText(tr("Home")); - ui->tool_home_gohome->setVisible(false); - }else{ - qDebug() << " - Show the back button"; - ui->tool_home_gohome->setVisible(true); - ui->label_home_dir->setText( this->fontMetrics().elidedText(homedir.dirName(), Qt::ElideRight, ui->label_home_dir->width())); - //Now make sure to put a "go back" button at the top of the list - QString dir = ui->label_home_dir->whatsThis(); - if(dir.endsWith("/")){ dir.chop(1); } - dir.chop( dir.section("/",-1).length() ); - items << dir; - } - qDebug() << " - Load items"; - ui->label_home_dir->setToolTip(ui->label_home_dir->whatsThis()); - items << homedir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::DirsFirst); - QString type = ""; - if(homedir.absolutePath() == QDir::homePath()+"/Desktop"){ type.append("-home"); }//internal code - for(int i=0; i<items.length(); i++){ - qDebug() << " - New item:" << homedir.absoluteFilePath(items[i]); - UserItemWidget *it; - if(items[i].startsWith("/")){ it = new UserItemWidget(ui->scroll_home->widget(), items[i], "dir", true); } //go-back button - else{ it = new UserItemWidget(ui->scroll_home->widget(), homedir.absoluteFilePath(items[i]), type, false); } - qDebug() << " - Add to layout"; - ui->scroll_home->widget()->layout()->addWidget(it); - connect(it, SIGNAL(RunItem(QString)), this, SLOT(slotGoToDir(QString)) ); - connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) ); - connect(it, SIGNAL(RemovedShortcut()), this, SLOT(updateFavItems()) ); - qDebug() << " - process events"; - QApplication::processEvents(); //keep the UI snappy - may be a lot of these to load - } - qDebug() << " - Done"; -} - -void UserWidget::slotGoToDir(QString dir){ - if(!QFileInfo(dir).isDir()){ - LaunchItem(dir); - }else{ - ui->label_home_dir->setWhatsThis(dir); - updateHome(); - } -} - -void UserWidget::slotGoHome(){ - slotGoToDir(QDir::homePath()); -} - -void UserWidget::slotOpenDir(){ - LaunchItem(ui->label_home_dir->whatsThis()); -} - -void UserWidget::slotOpenSearch(){ - LaunchItem("lumina-search -dir \""+ui->label_home_dir->whatsThis()+"\"", false); //use command as-is -} - -void UserWidget::mouseMoveEvent( QMouseEvent *event){ - QTabBar *wid = tabBar(); - if(wid==0){ return; } //invalid widget found - QPoint relpos = wid->mapFromGlobal( this->mapToGlobal(event->pos()) ); - //qDebug() << "Mouse Move Event: " << event->pos().x() << event->pos().y() << relpos.x() << relpos.y() << wid->width() << wid->height(); - if(wid && wid->tabAt(relpos) != -1){ - qDebug() << " - Mouse over tab"; - this->setCurrentIndex( wid->tabAt(relpos) ); - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.h deleted file mode 100644 index 8b03c489..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.h +++ /dev/null @@ -1,101 +0,0 @@ -//=========================================== -// 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 <QDateTime> -#include <QTransform> -#include <QMouseEvent> -#include <QTabWidget> - -#include <LuminaXDG.h> -#include <LuminaOS.h> -#include "UserItemWidget.h" - -#define SSAVER QString("xscreensaver-demo") - -namespace Ui{ - class UserWidget; -}; - -class UserWidget : public QTabWidget{ - Q_OBJECT -public: - UserWidget(QWidget *parent=0); - ~UserWidget(); - -public slots: - void UpdateAll(); //for re-translation/icon changes - void UpdateMenu(bool forceall = false); //for item changes - -private: - Ui::UserWidget *ui; - QHash<QString, QList<XDGDesktop*> > *sysapps; - QDateTime lastUpdate, lastHomeUpdate; - QStringList favs; - QFileInfoList homefiles; - int cfav; //current favorite category - void ClearScrollArea(QScrollArea *area); - void SortScrollArea(QScrollArea *area); - QIcon rotateIcon(QIcon); - bool updatingfavs; - -private slots: - void LaunchItem(QString path, bool fix = true); - - //Favorites Tab - void FavChanged(); //for ensuring radio-button-like behaviour - void updateFavItems(bool newfilter = true); //if false, will only update if filesystem changes - - //Apps Tab - void updateAppCategories(); - void updateApps(); - - //Home Tab - void updateHome(); - void slotGoToDir(QString dir); - void slotGoHome(); - void slotOpenDir(); - void slotOpenSearch(); - - //Slots for the special buttons - void openStore(){ - LaunchItem(LOS::AppStoreShortcut()); - } - void openControlPanel(){ - LaunchItem(LOS::ControlPanelShortcut()); - } - void openDeskSettings(){ - LaunchItem("lumina-config", false); - } - void openScreenSaverConfig(){ - LaunchItem(SSAVER, false); - } - void openScreenConfig(){ - LaunchItem("lumina-xconfig",false); - } - void openLuminaInfo(){ - LaunchItem("lumina-info",false); - } - -protected: - void mouseMoveEvent( QMouseEvent *event); - -signals: - void CloseMenu(); - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.ui b/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.ui deleted file mode 100644 index 9ef5af7e..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/panel-plugins/userbutton/UserWidget.ui +++ /dev/null @@ -1,593 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UserWidget</class> - <widget class="QTabWidget" name="UserWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>294</width> - <height>289</height> - </rect> - </property> - <property name="windowTitle"> - <string>UserWidget</string> - </property> - <property name="tabPosition"> - <enum>QTabWidget::West</enum> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_fav"> - <attribute name="title"> - <string>Favorites</string> - </attribute> - <attribute name="toolTip"> - <string>Favorites</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>1</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>1</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <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="cursor"> - <cursorShape>ArrowCursor</cursorShape> - </property> - <property name="toolTip"> - <string>Favorite Applications</string> - </property> - <property name="text"> - <string>Applications</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <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>Places</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <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>Files</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <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>259</width> - <height>247</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_apps"> - <attribute name="title"> - <string>Apps</string> - </attribute> - <attribute name="toolTip"> - <string>Applications</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>1</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>1</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <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="maxVisibleItems"> - <number>12</number> - </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>98</width> - <height>28</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_home"> - <attribute name="title"> - <string>Home</string> - </attribute> - <attribute name="toolTip"> - <string>Home Directory</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>1</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>1</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout"> - <property name="horizontalSpacing"> - <number>4</number> - </property> - <property name="verticalSpacing"> - <number>1</number> - </property> - <item row="0" column="3"> - <widget class="QToolButton" name="tool_home_search"> - <property name="toolTip"> - <string>Search this Directory</string> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QToolButton" name="tool_home_browse"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Open Directory</string> - </property> - <property name="text"> - <string notr="true">Browse</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QToolButton" name="tool_home_gohome"> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Go back to home directory</string> - </property> - <property name="text"> - <string notr="true">home</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_home_dir"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>30</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>10</pointsize> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="text"> - <string notr="true"><current dir></string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="indent"> - <number>0</number> - </property> - <property name="textInteractionFlags"> - <set>Qt::NoTextInteraction</set> - </property> - </widget> - </item> - </layout> - </item> - <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>98</width> - <height>28</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_config"> - <attribute name="title"> - <string>Config</string> - </attribute> - <attribute name="toolTip"> - <string>Desktop Preferences</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <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_config_screensettings"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Screen Configuration</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>243</width> - <height>162</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_config_about"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>About the Lumina Desktop</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - <resources/> - <connections/> -</ui> |