aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-05-13 05:35:48 -0400
committerKen Moore <ken@ixsystems.com>2018-05-13 05:40:00 -0400
commit0cabdf5e3a44a21e6561d345bc5149de1a68457b (patch)
treea886759e71e4d7f21f08be78745b465ec4fe0d8d /src-qt5/core/lumina-desktop-unified
parentUpdate the fallback icon used for Pandora radio in lumina-mediaplayer (diff)
downloadlumina-0cabdf5e3a44a21e6561d345bc5149de1a68457b.tar.gz
lumina-0cabdf5e3a44a21e6561d345bc5149de1a68457b.tar.bz2
lumina-0cabdf5e3a44a21e6561d345bc5149de1a68457b.zip
Get the screen reservation work finished up and committed.
Also finish up the Plugin base-classes for use when writing the various panel/desktop plugins.
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp10
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp5
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/Plugin.h18
4 files changed, 25 insertions, 10 deletions
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 79737ddc..9d48c28d 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
@@ -175,13 +175,13 @@ void RootDesktopObject::setPanels(QStringList ids){
}
} //end loop over screens+session
//Now calculate the available session geometry
- QRegion sess(geom);
+ QRegion sess(total);
for(int i=0; i<panel_objects.length(); i++){
- sess = sess.subtracted( QRegion(panel_objects[i].geometry()) );
+ sess = sess.subtracted( QRegion(panel_objects[i]->geometry()) );
}
if(sess != session_avail_geom){
session_avail_geom = sess;
- emit sessionGeomAvailableChanged(); }
+ emit sessionGeomAvailableChanged();
}
if(change){ emit panelsChanged(); }
@@ -260,6 +260,10 @@ QList<ScreenObject*> RootDesktopObject::screenObjects(){
return s_objects;
}
+QRegion* RootDesktopObject::availableGeometry(){
+ return &session_avail_geom;
+}
+
// === PUBLIC SLOTS ===
void RootDesktopObject::updateScreens(){
QList<QScreen*> scrns = QApplication::screens();
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
index 4a722ec0..f88a547c 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
@@ -46,6 +46,7 @@ public:
Q_INVOKABLE QString currentTime();
Q_INVOKABLE QDateTime currentDateTime();
+
//QML Globals Access
Q_INVOKABLE OSInterface* os_interface();
@@ -58,6 +59,7 @@ public:
//C++ Access Functions (simplifications for the QML ones)
QList<NativeWindowObject*> windowObjects();
QList<ScreenObject*> screenObjects();
+ QRegion* availableGeometry();
private:
QList<ScreenObject*> s_objects;
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp
index d6e0abb6..f36db2be 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp
@@ -7,11 +7,12 @@
#include "ScreenObject.h"
#include <QQmlEngine>
#include <QDebug>
+#include "RootDesktopObject.h"
ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){
bg_screen = scrn;
connect(this, SIGNAL(changePanels(QStringList)), this, SLOT(setPanels(QStringList)) );
- connect(RootWindowObject::instance(), SIGNAL(sessionGeomAvailableChanged()), this, SLOT(updateAvailableGeometry()) );
+ connect(RootDesktopObject::instance(), SIGNAL(sessionGeomAvailableChanged()), this, SLOT(updateAvailableGeometry()) );
}
void ScreenObject::RegisterType(){
@@ -52,7 +53,7 @@ void ScreenObject::setPanels(QStringList ids){
QRegion *sess = RootDesktopObject::instance()->availableGeometry();
QRect avail = sess->intersected(bg_screen->geometry()).boundingRect();
- if(session_available_geometry.isNull()){ avail = bg_screen->geometry(); }
+ if(avail.isNull()){ avail = bg_screen->geometry(); }
//First update/remove any current panel objects
bool change = false;
for(int i=0; i<panel_objects.length(); i++){
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 0934374f..4a81d79b 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
@@ -15,18 +15,25 @@
class Plugin : public QWidget{
Q_OBJECT
private:
- bool isPanelPlugin;
- bool isVertical; //only used for panel plugins
QString _id;
signals:
void orientationChanged();
public:
+ QBoxLayout *boxLayout;
+ bool isPanelPlugin;
+ bool isVertical; //only used for panel plugins
+
Plugin(QWidget *parent, QString id, bool panelplug = false) : QWidget(parent){
isPanelPlugin = panelplug;
isVertical = false;
_id = id;
+ boxLayout = new QBoxLayout(QBoxLayout::LeftToRight);
+ this->setLayout( boxLayout );
+ boxLayout->setContentsMargins(0,0,0,0);
+ updateLayoutOrientation();
+ connect(this, SIGNAL(orientationChanged()), this, SLOT(updateLayoutOrientation()) );
}
void setVertical(bool set){
@@ -36,7 +43,9 @@ public:
QString id(){ return _id; }
private slots:
-
+ void updateLayoutOrientation(){
+ boxLayout->setDirection( this->isVertical ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight );
+ }
};
//Special subclass for a button-based plugin
@@ -48,11 +57,10 @@ private:
public:
PluginButton(QWidget *parent, QString id, bool panelplug=false) : Plugin(parent, id, panelplug) {
button = new QToolButton(this);
- this->setLayout( new QBoxLayout(QBoxLayout::LeftToRight) );
- this->layout()->setContentsMargins(0,0,0,0);
this->layout()->addWidget(button);
}
~PluginButton(){}
};
+
#endif
bgstack15