aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.cpp9
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow-Widgets.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp10
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp5
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp13
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h13
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h20
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h24
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri3
10 files changed, 88 insertions, 15 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp
index 5e931e5f..5f2dc5ab 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.cpp
+++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp
@@ -10,7 +10,7 @@
#include "BootSplash.h"
#ifndef DEBUG
-#define DEBUG 1
+#define DEBUG 0
#endif
//Initialize all the global objects to null pointers
@@ -33,12 +33,14 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu
mediaObj = 0; //private object used for playing login/logout chimes
if(this->isPrimaryProcess()){
//Setup the global registrations
+ if(DEBUG){ qDebug() << "Starting session init..."; }
qsrand(QDateTime::currentMSecsSinceEpoch());
this->setApplicationName("Lumina Desktop Environment");
this->setApplicationVersion( LDesktopUtils::LuminaDesktopVersion() );
this->setOrganizationName("LuminaDesktopEnvironment");
this->setQuitOnLastWindowClosed(false); //since the LDesktop's are not necessarily "window"s
//Enable a few of the simple effects by default
+ if(DEBUG){ qDebug() << " - Setting attributes and effects"; }
this->setEffectEnabled( Qt::UI_AnimateMenu, true);
this->setEffectEnabled( Qt::UI_AnimateCombo, true);
this->setEffectEnabled( Qt::UI_AnimateTooltip, true);
@@ -46,19 +48,24 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu
this->setAttribute(Qt::AA_UseHighDpiPixmaps); //allow pixmaps to be scaled up as well as down
//Now initialize the global objects (but do not start them yet)
+ if(DEBUG){ qDebug() << " - Create native event objects"; }
Lumina::NEF = new NativeEventFilter();
Lumina::NWS = new NativeWindowSystem();
Lumina::SS = new LScreenSaver();
Lumina::DESKMAN = new DesktopManager();
//Now put the Native Window System into it's own thread to keep things snappy
+ if(DEBUG){ qDebug() << " - Create extra threads"; }
Lumina::EVThread = new QThread();
Lumina::DESKMAN->moveToThread(Lumina::EVThread);
Lumina::EVThread->start();
Lumina::APPLIST = XDGDesktopList::instance();
+ if(DEBUG){ qDebug() << " - Create root window"; }
Lumina::ROOTWIN = new RootWindow();
Lumina::SHORTCUTS = new LShortcutEvents(); //this can be moved to it's own thread eventually as well
+ if(DEBUG){ qDebug() << " - Setup Connections"; }
setupGlobalConnections();
} //end check for primary process
+ if(DEBUG){ qDebug() << " [finished] Session init"; }
}
LSession::~LSession(){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow-Widgets.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow-Widgets.cpp
index 6a4c4cb0..44007b08 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow-Widgets.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow-Widgets.cpp
@@ -13,8 +13,10 @@ RootDesktop *root_view;
RootWindow::RootWindow() : QObject(){
root_win = QWindow::fromWinId( QX11Info::appRootWindow() );
- root_view = new RootDesktop(root_win); //make it a child of the root window
+ //qDebug() << "Creating RootDesktop Object";
root_obj = RootDesktopObject::instance();
+ //qDebug() << "Creating RootDesktop View";
+ root_view = new RootDesktop(root_win); //make it a child of the root window
syncRootSize();
connect(root_win, SIGNAL(widthChanged(int)), this, SLOT(syncRootSize()) );
connect(root_win, SIGNAL(heightChanged(int)),this, SLOT(syncRootSize()) );
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp
index 94079bf7..035dd29c 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/PanelObject.cpp
@@ -10,6 +10,10 @@
#include <QQmlEngine>
#include <QDebug>
+#ifdef USE_WIDGETS
+#include <Plugin.h>
+#endif
+
PanelObject::PanelObject(QString id, QObject *parent) : QObject(parent){
panel_id = id;
}
@@ -56,8 +60,12 @@ void PanelObject::setGeometry( QRect newgeom ){
void PanelObject::setPlugins( QStringList plist){
//Iterate through the list and find the URL's for the files
QStringList dirs; dirs << ":/qml/plugins/"; //add local directories here
+ static QStringList built_in;
+#ifdef USE_WIDGETS
+ if(built_in.isEmpty()){ built_in = Plugin::built_in_plugins(); }
+#endif
for(int i=0; i<plist.length(); i++){
- bool found = false;
+ bool found = built_in.contains(plist[i].toLower());
for(int j=0; j<dirs.length() && !found; j++){
if(QFile::exists(dirs[j]+plist[i]+".qml")){
plist[i] = QUrl::fromLocalFile(dirs[j]+plist[i]+".qml").url();
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
index 9d48c28d..8e559819 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
@@ -14,7 +14,7 @@
// === PUBLIC ===
RootDesktopObject::RootDesktopObject(QObject *parent) : QObject(parent){
last_window_up = 0;
- updateScreens(); //make sure the internal list is updated right away
+ //updateScreens(); //make sure the internal list is updated right away
connect(this, SIGNAL(changePanels(QStringList)), this, SLOT(setPanels(QStringList)) );
currentTimeTimer = new QTimer(this);
connect(currentTimeTimer, SIGNAL(timeout()), this, SLOT(updateCurrentTime()) );
@@ -46,6 +46,7 @@ RootDesktopObject* RootDesktopObject::instance(){
//QML Read Functions
QStringList RootDesktopObject::screens(){
+ if(s_objects.length()<1){ updateScreens(); }
//qDebug() << "Request Screens:" << s_objects.length();
QStringList names;
for(int i=0; i<s_objects.length(); i++){ names << s_objects[i]->name(); }
@@ -53,6 +54,7 @@ QStringList RootDesktopObject::screens(){
}
ScreenObject* RootDesktopObject::screen(QString id){
+ if(s_objects.length()<1){ updateScreens(); }
//qDebug() << "Got Screen Request:" << id;
for(int i=0; i<s_objects.length(); i++){
if(s_objects[i]->name()==id){ return s_objects[i]; }
@@ -315,6 +317,7 @@ void RootDesktopObject::updateCurrentTime(){
currentDateTimeStruct = DT;
currentTimeString = tmp;
emit currentTimeChanged();
+ //qDebug() << "Current Time Changed:" << currentTimeString;
}
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
index 5b2a8a08..52642235 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Panel.cpp
@@ -11,6 +11,7 @@ Panel::Panel(PanelObject *pobj) : QWidget(0, Qt::Window | Qt::FramelessWindowHin
this->setObjectName("LuminaPanelBackgroundWidget");
obj = pobj;
layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
+ layout->setContentsMargins(0,0,0,0);
this->setBackgroundRole(QPalette::AlternateBase);
connect(obj, SIGNAL(backgroundChanged()), this, SLOT(updateBackground()) );
connect(obj, SIGNAL(geomChanged()), this, SLOT(updateGeom()) );
@@ -75,6 +76,7 @@ void Panel::updatePlugins(){
layout->removeWidget(plug); //remove from the layout for a moment
}
layout->insertWidget(i, plug);
+ plug->setupSizing();
}
//Now remove any plugins which were deleted from config
for(int i=0; i<lastplugins.length(); i++){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp
index 7c60b407..9ddceccc 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.cpp
@@ -8,19 +8,24 @@
//Add includes for individual plugin files here
#include <ClockPlugin.h>
+#include <SpacerPlugin.h>
QStringList Plugin::built_in_plugins(){
QStringList list;
- list << "clock";
+ list << "clock" << "spacer";
return list;
}
Plugin* Plugin::createPlugin(QWidget *parent, QString id, bool panelplug){
Plugin *plug = 0;
- //QString id_extra;
- //if(id.contains("--")){ id_extra = id.section("--",1,-1); id = id.section("--",0,0); }
- if(id=="clock"){
+ QString id_extra, id_primary;
+ if(id.contains("--")){ id_extra = id.section("--",1,-1); id_primary = id.section("--",0,0); }
+ else{ id_primary = id; } //no extra info on this one
+ id_primary = id_primary.toLower();
+ if(id_primary=="clock"){
plug = new ClockPlugin(parent, id, panelplug);
+ }else if(id_primary=="spacer"){
+ plug = new SpacerPlugin(parent, id, panelplug);
}
return plug;
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
index 1bc0476f..db8c4e54 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h
@@ -36,16 +36,27 @@ public:
boxLayout = new QBoxLayout(QBoxLayout::LeftToRight);
this->setLayout( boxLayout );
boxLayout->setContentsMargins(0,0,0,0);
+ this->setContentsMargins(0,0,0,0);
updateLayoutOrientation();
connect(this, SIGNAL(orientationChanged()), this, SLOT(updateLayoutOrientation()) );
}
void setVertical(bool set){
if(set!=isVertical){ isVertical = set; emit orientationChanged(); }
+ setupSizing();
}
QString id(){ return _id; }
+ virtual void setupSizing(){
+ if(isPanelPlugin){
+ if(!isVertical){ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); }
+ else{ this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); }
+ }else{
+ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ }
+ }
+
private slots:
void updateLayoutOrientation(){
boxLayout->setDirection( this->isVertical ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight );
@@ -60,6 +71,8 @@ public:
QToolButton *button;
PluginButton(QWidget *parent, QString id, bool panelplug=false) : Plugin(parent, id, panelplug) {
button = new QToolButton(this);
+ button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ button->setAutoRaise(true);
this->layout()->addWidget(button);
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
index b5510ad7..be5d017b 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
@@ -4,22 +4,30 @@
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_CLOCK_H
+#define _LUMINA_DESKTOP_PLUGIN_CLOCK_H
+
#include <Plugin.h>
#include <RootDesktopObject.h>
class ClockPlugin : public PluginButton{
Q_OBJECT
-private:
+private slots:
+ void updateTime(){
+ //qDebug() << "Clock: Update Time";
+ this->button->setText(RootDesktopObject::instance()->currentTime() );
+ }
public:
ClockPlugin(QWidget *parent, QString id, bool panelplug) : PluginButton(parent, id, panelplug){
connect(RootDesktopObject::instance(), SIGNAL(currentTimeChanged()), this, SLOT(updateTime()) );
+ QFont tmp = button->font();
+ tmp.setBold(true);
+ button->setFont( tmp );
+ QTimer::singleShot(0, this, SLOT(updateTime()) );
}
~ClockPlugin(){ }
-private slots:
- void updateTime(){
- this->button->setText(RootDesktopObject::instance()->currentTime() );
- }
-
};
+
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h
new file mode 100644
index 00000000..0f8d8809
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/SpacerPlugin.h
@@ -0,0 +1,24 @@
+//===========================================
+// Lumina-desktop source code
+// Copyright (c) 2018, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_SPACER_H
+#define _LUMINA_DESKTOP_PLUGIN_SPACER_H
+#include <Plugin.h>
+
+class SpacerPlugin : public Plugin{
+ Q_OBJECT
+
+public:
+ SpacerPlugin(QWidget *parent, QString id, bool panelplug) : Plugin(parent, id, panelplug){}
+ ~SpacerPlugin(){ }
+
+ //Replace the virtual sizing function
+ void setupSizing(){
+ this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ }
+};
+
+#endif
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri
index 6031a0d4..d7082141 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/plugins.pri
@@ -3,4 +3,5 @@ INCLUDEPATH *= $${PWD}
#SOURCES *=
-HEADERS *= $${PWD}/ClockPlugin.h
+HEADERS *= $${PWD}/ClockPlugin.h \
+ $${PWD}/SpacerPlugin.h
bgstack15