diff options
author | Ken Moore <moorekou@gmail.com> | 2015-07-09 16:42:49 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-07-09 16:42:49 -0400 |
commit | b6e2f46f79324b019caf1e4b504454591b591acf (patch) | |
tree | 3a40852c3d956f71e6f4e52118bbce1c429157e7 /lumina-desktop | |
parent | Remove the old "forcing" of a panel with particular settings on the default/f... (diff) | |
download | lumina-b6e2f46f79324b019caf1e4b504454591b591acf.tar.gz lumina-b6e2f46f79324b019caf1e4b504454591b591acf.tar.bz2 lumina-b6e2f46f79324b019caf1e4b504454591b591acf.zip |
Finish cleaning up the arrangement/placement of desktop plugins with the new system. Also add a default size for the calendar plugin.
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 38 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/LDPlugin.cpp | 3 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h | 1 |
3 files changed, 25 insertions, 17 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 80e28e59..c9168651 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -11,7 +11,7 @@ #include <LuminaX11.h> #include "LWinInfo.h" -#define DEBUG 0 +#define DEBUG 1 LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){ @@ -188,7 +188,7 @@ LDPluginContainer* LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){ LDPluginContainer *win = new LDPluginContainer(plug, desktoplocked); if(desktoplocked){ bgDesktop->addSubWindow(win, Qt::Tool | Qt::FramelessWindowHint); - }else{ bgDesktop->addSubWindow(win, Qt::Tool | Qt::FramelessWindowHint | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); } + }else{ bgDesktop->addSubWindow(win, Qt::Tool | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); } win->loadInitialPosition(); if(DEBUG){ qDebug() << "Initial DP Geom:" << plug->geometry(); @@ -197,9 +197,9 @@ LDPluginContainer* LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){ win->show(); plug->update(); win->update(); - QApplication::processEvents(); bgDesktop->update(); QApplication::processEvents(); + QApplication::processEvents(); connect(win, SIGNAL(PluginRemoved(QString)), this, SLOT(DesktopPluginRemoved(QString)) ); return win; @@ -208,20 +208,20 @@ LDPluginContainer* LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){ QPoint LDesktop::findNewPluginLocation(QRegion avail, QSize winsize){ //This just searches through the region of available space until it find the first location where it // will fit without overlapping anything else (scanning left->right, top->bottom) + //return QPoint(-1,-1); //just for testing QRect bounds = avail.boundingRect(); + qDebug() << "Bounds:" << bounds; if(bounds.width()<winsize.width() || bounds.height()<winsize.height()){ return QPoint(-1,-1); } - //qDebug() << "Bounds:" << bounds; QPoint pt = bounds.topLeft(); //start in upper-left corner bool found = false; - //qDebug() << "Check Availability:" << bounds << winsize; + if(DEBUG){ qDebug() << "Check Availability:" << bounds << winsize; } while(pt.y()+winsize.height() < bounds.bottom() && !found){ int dy = winsize.height()/2; while(pt.x()+winsize.width() < bounds.right() && !found){ - //qDebug() << "Check X:" << pt << winsize; //Check the horizontal position (incrementing as necessary) QRect inter = avail.intersected(QRect(pt, winsize)).boundingRect(); - //qDebug() << " - Inter:" << inter; + if(DEBUG){ qDebug() << "Check X:" << pt << " - Inter:" << inter; } if(inter.size() == winsize && avail.contains(inter) ){ found = true; } //use this point else{ int dx = winsize.width() - inter.width(); @@ -238,7 +238,7 @@ QPoint LDesktop::findNewPluginLocation(QRegion avail, QSize winsize){ //Nothing in the horizontal direction - increment the vertical dimension pt.setX( bounds.left() ); //reset back to the left-most edge pt.setY( pt.y()+dy ); - //qDebug() << "Check Y:" << pt << dy; + if(DEBUG){ qDebug() << "Check Y:" << pt << dy; } } } //qDebug() << "Found Point:" << found << pt; @@ -413,13 +413,16 @@ void LDesktop::UpdateDesktop(){ } } //Now get an accounting of all the available/used space - QRegion avail(this->availableScreenGeom()); - if(avail.isEmpty()){ avail = QRegion( QRect(QPoint(0,0),desktop->screenGeometry(desktopnumber).size()) ); } + QRegion avail;//Note that this is child-geometry space + if(!bgDesktop->isVisible()){ avail = QRegion( QRect(QPoint(0,0),desktop->screenGeometry(desktopnumber).size()) ); } + else{ avail = QRegion(QRect(QPoint(0,0),bgDesktop->size()) ); qDebug() << "Desktop size:" << bgDesktop->size(); } //qDebug() << "Available Screen Geom:" << avail.boundingRect(); - QList<QMdiSubWindow*> wins = bgDesktop->subWindowList(); + //avail = avail.subtracted( bgDesktop->childrenRegion() ); // + /*QList<QMdiSubWindow*> wins = bgDesktop->subWindowList(); for(int i=0; i<wins.length(); i++){ - if(avail.contains(wins[i]->geometry())){ avail = avail.subtracted( QRegion(wins[i]->geometry()) ); } - } + QRect geom = wins[i]->geometry() + if(avail.contains(wins[i]->geometry())){ avail = avail.subtracted( QRegion(wins[i]->geometry()) ); } + }*/ //qDebug() << " - after removals:" << avail.boundingRect(); //Now add/update plugins for(int i=0; i<plugins.length(); i++){ @@ -442,22 +445,23 @@ void LDesktop::UpdateDesktop(){ if(DEBUG){ qDebug() << " --- Show Plugin"; } PLUGINS << plug; QApplication::processEvents(); //need a moment between plugin/container creation + QRegion tmpavail = avail - bgDesktop->childrenRegion(); //currently available space right now LDPluginContainer *cont = CreateDesktopPluginContainer(plug); cont->show(); QApplication::processEvents(); if(!cont->hasFixedPosition()){ //Need to arrange the location of the plugin (leave size alone) if(DEBUG){ qDebug() << " --- Floating Plugin - find a spot for it"; } - QPoint pt = findNewPluginLocation(avail, cont->size()); - if(pt.x()>=0 && pt.y()>=0){ + QPoint pt = findNewPluginLocation(tmpavail, cont->size()); + if(pt.x()>=0 && pt.y()>=0){ cont->saveNewPosition(pt); - QTimer::singleShot(1000, cont, SLOT(loadInitialPosition()) ); //re-load geometry in a moment + QTimer::singleShot(500, cont, SLOT(loadInitialPosition()) ); //re-load geometry in a moment if(DEBUG){ qDebug() << " --- Moving to point:" << pt; } } } //Done with this plugin - removed it's area from the available space if(DEBUG){ qDebug() << " --- Done Creating Plugin Container" << cont->geometry(); } - avail = avail.subtracted( QRegion(cont->geometry()) ); + //avail = avail.subtracted( QRegion(cont->geometry()) ); } } diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp index cc07b747..ebed6d90 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.cpp +++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp @@ -27,11 +27,14 @@ void LDPlugin::setInitialSize(int width, int height){ settings->setValue(prefix+"location/height",height); settings->sync(); } + //Now make sure the plugin is the saved size right away + this->resize( settings->value(prefix+"location/width").toInt(), settings->value(prefix+"location/height").toInt()); } void LDPlugin::adjustSize(int width, int height){ settings->setValue(prefix+"location/width",width); settings->setValue(prefix+"location/height",height); settings->sync(); + this->resize(width,height); emit PluginResized(); }
\ No newline at end of file diff --git a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h index e861052e..796bc42d 100644 --- a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h +++ b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h @@ -21,6 +21,7 @@ public: this->layout()->setContentsMargins(0,0,0,0); cal = new QCalendarWidget(this); this->layout()->addWidget(cal); + this->setInitialSize( cal->sizeHint().width(), cal->sizeHint().height() ); } ~CalendarPlugin(){} |