diff options
-rw-r--r-- | libLumina/LuminaUtils.cpp | 15 | ||||
-rw-r--r-- | libLumina/LuminaUtils.h | 6 | ||||
-rw-r--r-- | libLumina/libLumina.pro | 5 | ||||
-rw-r--r-- | lumina-desktop/LSession.cpp | 8 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/NewDP.h | 3 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h | 42 | ||||
-rw-r--r-- | lumina-desktop/lumina-desktop.pro | 6 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/NewPP.h | 3 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h | 44 |
9 files changed, 124 insertions, 8 deletions
diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp index 7d53af3e..b569782e 100644 --- a/libLumina/LuminaUtils.cpp +++ b/libLumina/LuminaUtils.cpp @@ -181,6 +181,21 @@ double LUtils::DisplaySizeToBytes(QString num){ return N; } +//Various function for finding valid QtQuick plugins on the system +bool LUtils::validQuickPlugin(QString ID){ + return ( !LUtils::findQuickPluginFile(ID).isEmpty() ); +} + +QString LUtils::findQuickPluginFile(QString ID){ + if(ID.startsWith("quick-")){ ID = ID.section("-",1,50); } + //Give preference to any user-supplied plugins (overwrites for system plugins) + QString path = QDir::homePath()+"/.lumina/quickplugins/"+ID+".qml"; + if( QFile::exists(path) ){return path; } + path = LOS::LuminaShare()+"quickplugins/"+ID+".qml"; + if( QFile::exists(path) ){return path; } + return ""; //could not be found +} + QStringList LUtils::listFavorites(){ static QStringList fav; static QDateTime lastRead; diff --git a/libLumina/LuminaUtils.h b/libLumina/LuminaUtils.h index 434970ef..605f2653 100644 --- a/libLumina/LuminaUtils.h +++ b/libLumina/LuminaUtils.h @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2012, Ken Moore +// Copyright (c) 2012-2015, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -53,6 +53,10 @@ public: static double DisplaySizeToBytes(QString num); //Turn a display size (like 50M or 50KB) into a double for calculations (bytes) + //Various function for finding valid QtQuick plugins on the system + static bool validQuickPlugin(QString ID); + static QString findQuickPluginFile(QString ID); + //Various functions for the favorites sub-system // Formatting Note: "<name>::::[dir/app/<mimetype>]::::<path>" // the <name> field might not be used for "app" flagged entries diff --git a/libLumina/libLumina.pro b/libLumina/libLumina.pro index 4aa25154..2cfd20db 100644 --- a/libLumina/libLumina.pro +++ b/libLumina/libLumina.pro @@ -81,6 +81,9 @@ themes.path=$$PREFIX/share/Lumina-DE/themes/ themes.files=themes/Lumina-default.qss.template \ themes/None.qss.template -INSTALLS += target include colors themes +quickplugins.path=$$PREFIX/share/Lumina-DE/quickplugins/ +quickplugins.files=quickplugins/*.qml + +INSTALLS += target include colors themes quickplugins QMAKE_LIBDIR = $$LIBPREFIX/qt5 $$LIBPREFIX diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index 9a292438..aeb3e624 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -235,6 +235,9 @@ void LSession::launchStartupApps(){ QProcess::startDetached("numlockx off"); } } + int tmp = LOS::ScreenBrightness(); + LOS::setScreenBrightness( tmp ); + qDebug() << " - - Screen Brightness:" << QString::number(tmp)+"%"; //First create the list of all possible locations in order of precedence // NOTE: Lumina/system defaults should be launched earlier due to possible system admin utilities @@ -287,12 +290,9 @@ void LSession::launchStartupApps(){ //Re-load the screen brightness and volume settings from the previous session // Wait until after the XDG-autostart functions, since the audio system might be started that way qDebug() << " - Loading previous settings"; - int tmp = LOS::audioVolume(); + tmp = LOS::audioVolume(); LOS::setAudioVolume(tmp); qDebug() << " - - Audio Volume:" << QString::number(tmp)+"%"; - tmp = LOS::ScreenBrightness(); - LOS::setScreenBrightness( tmp ); - qDebug() << " - - Screen Brightness:" << QString::number(tmp)+"%"; //Now play the login music since we are finished if(sessionsettings->value("PlayStartupAudio",true).toBool()){ diff --git a/lumina-desktop/desktop-plugins/NewDP.h b/lumina-desktop/desktop-plugins/NewDP.h index 3e7c5eec..78f10981 100644 --- a/lumina-desktop/desktop-plugins/NewDP.h +++ b/lumina-desktop/desktop-plugins/NewDP.h @@ -20,6 +20,7 @@ #include "notepad/NotepadPlugin.h" #include "audioplayer/PlayerWidget.h" #include "systemmonitor/MonitorWidget.h" +#include "quickcontainer/QuickDPlugin.h" //#include "messagecenter/MessageCenter.h" class NewDP{ @@ -43,6 +44,8 @@ public: plug = new SysMonitorPlugin(parent, plugin); //}else if(plugin.section("---",0,0)=="messagecenter"){ //plug = new MessageCenterPlugin(parent, plugin); + }else if(plugin.section("---",0,0).startsWith("quick-") && LUtils::validQuickPlugin(plugin.section("---",0,0)) ){ + plug = new QuickDPlugin(parent, plugin); }else{ qWarning() << "Invalid Desktop Plugin:"<<plugin << " -- Ignored"; } diff --git a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h new file mode 100644 index 00000000..a59ed87f --- /dev/null +++ b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h @@ -0,0 +1,42 @@ +//=========================================== +// 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_DESKTOP_PLUGIN_QUICK_H +#define _LUMINA_DESKTOP_DESKTOP_PLUGIN_QUICK_H + +#include <QQuickWidget> +#include <QVBoxLayout> +#include "../LDPlugin.h" + +#include <LuminaUtils.h> + +class QuickDPlugin : public LDPlugin{ + Q_OBJECT +public: + QuickDPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ + this->setLayout( new QVBoxLayout()); + this->layout()->setContentsMargins(0,0,0,0); + container = new QQuickWidget(this); + this->layout()->addWidget(container); + container->setSource(QUrl::fromLocalFile( LUtils::findQuickPluginFile(ID.section("---",0,0)) )); + } + + ~QuickDPlugin(){} + +private: + QQuickWidget *container; + +private slots: + void statusChange(QQuickWidget::Status status){ + if(status == QQuickWidget::Error){ + qDebug() << "Quick Widget Error:" << this->ID(); + } + } + +}; +#endif diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro index 1964cafd..c8203533 100644 --- a/lumina-desktop/lumina-desktop.pro +++ b/lumina-desktop/lumina-desktop.pro @@ -1,6 +1,6 @@ QT += core gui network -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia quickwidgets TARGET = Lumina-DE isEmpty(PREFIX) { @@ -94,13 +94,15 @@ HEADERS += Globals.h \ panel-plugins/showdesktop/LHomeButton.h \ panel-plugins/appmenu/LAppMenuPlugin.h \ panel-plugins/applauncher/AppLaunchButton.h \ + panel-plugins/quickcontainer/QuickPPlugin.h \ desktop-plugins/SamplePlugin.h \ desktop-plugins/calendar/CalendarPlugin.h \ desktop-plugins/applauncher/AppLauncherPlugin.h \ desktop-plugins/desktopview/DesktopViewPlugin.h \ desktop-plugins/notepad/NotepadPlugin.h \ desktop-plugins/audioplayer/PlayerWidget.h \ - desktop-plugins/systemmonitor/MonitorWidget.h + desktop-plugins/systemmonitor/MonitorWidget.h \ + desktop-plugins/quickcontainer/QuickDPlugin.h # desktop-plugins/messagecenter/MessageCenter.h FORMS += SystemWindow.ui \ diff --git a/lumina-desktop/panel-plugins/NewPP.h b/lumina-desktop/panel-plugins/NewPP.h index 3a593629..78b942d0 100644 --- a/lumina-desktop/panel-plugins/NewPP.h +++ b/lumina-desktop/panel-plugins/NewPP.h @@ -24,6 +24,7 @@ #include "showdesktop/LHomeButton.h" #include "appmenu/LAppMenuPlugin.h" #include "applauncher/AppLaunchButton.h" +#include "quickcontainer/QuickPPlugin.h" #include "systemtray/LSysTray.h" //must be last due to X11 compile issues class NewPP{ @@ -55,6 +56,8 @@ public: plug = new LAppMenuPlugin(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"; } diff --git a/lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h b/lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h new file mode 100644 index 00000000..7c887803 --- /dev/null +++ b/lumina-desktop/panel-plugins/quickcontainer/QuickPPlugin.h @@ -0,0 +1,44 @@ +//=========================================== +// 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 <LuminaUtils.h> +#include <QDebug> + +class QuickPPlugin : public LPPlugin{ + Q_OBJECT +public: + QuickPPlugin(QWidget* parent, QString ID, bool horizontal) : LPPlugin(parent, ID){ + this->setLayout( new QVBoxLayout()); + this->layout()->setContentsMargins(0,0,0,0); + container = new QQuickWidget(this); + 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 |