From ded6e4e13a6a98c3793f73cbb286fcc73caf5bf7 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Oct 2016 10:40:01 -0400 Subject: Large update/refactor of desktop widgets. This reduces the number of widgets in the stack by 1, and seems to help performance a bit. --- src-qt5/core/lumina-desktop/LDesktopPluginSpace.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src-qt5/core/lumina-desktop/LDesktopPluginSpace.h') diff --git a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h index 44765029..12382db8 100644 --- a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h +++ b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h @@ -33,7 +33,7 @@ signals: void HideDesktopMenu(); public: - LDesktopPluginSpace(QWidget *parent = 0); + LDesktopPluginSpace(); ~LDesktopPluginSpace(); void LoadItems(QStringList plugs, QStringList files); @@ -42,6 +42,9 @@ public: void ArrangeTopToBottom(bool ttb); //if false, will arrange left->right void cleanup(); + void setBackground(QPixmap pix); //should already be sized appropriately for this widget + void setDesktopArea(QRect area); + public slots: void UpdateGeom(int oldgrid = -1); @@ -49,6 +52,8 @@ private: QSettings *plugsettings; QStringList plugins, deskitems; QList ITEMS; + QPixmap wallpaper; + QRect desktopRect; bool TopToBottom; float GRIDSIZE; @@ -88,7 +93,7 @@ private: //This function incorporates the bottom/right edge matchins procedures (for incomplete last grid) QRect geom(grid.x()*GRIDSIZE, grid.y()*GRIDSIZE, grid.width()*GRIDSIZE, grid.height()*GRIDSIZE); //Now check the edge conditions (last right/bottom grid points might be smaller than GRIDSIZE) - QSize areaSize = this->size(); //use the size of the area instead of the geometry - because we need this in child coordinates like "geom" above + QSize areaSize = desktopRect.size(); //use the size of the area instead of the geometry - because we need this in child coordinates like "geom" above //qDebug() << "GridToGeom:" << grid << geom << "Area size:" << areaSize; if(geom.right() > areaSize.width() && (geom.right()-areaSize.width())width()/GRIDSIZE) << RoundUp(this->height()/GRIDSIZE); //This just checks that the grid coordinates are not out of bounds - should still run ValidGeometry() below with the actual pixel geom if(grid.x()<0 || grid.y()<0 || grid.width()<0 || grid.height()<0){ return false; } - else if( (grid.x()+grid.width()) > RoundUp(this->width()/GRIDSIZE) ){ return false; } - else if( (grid.y()+grid.height()) > RoundUp(this->height()/GRIDSIZE) ){ return false; } + else if( (grid.x()+grid.width()) > RoundUp(desktopRect.width()/GRIDSIZE) ){ return false; } + else if( (grid.y()+grid.height()) > RoundUp(desktopRect.height()/GRIDSIZE) ){ return false; } return true; } bool ValidGeometry(QString id, QRect geom){ //First check that it is within the desktop area completely // Note that "this->geometry()" is not in the same coordinate space as the geometry inputs - if(!QRect(0,0,this->width(), this->height()).contains(geom)){ return false; } + if(!QRect(0,0,desktopRect.width(), desktopRect.height()).contains(geom)){ return false; } //Now check that it does not collide with any other items for(int i=0; iwhatsThis()==id){ continue; } @@ -183,9 +188,8 @@ private slots: } protected: - void paintEvent(QPaintEvent*){ - //do nothing here - the main plugin area should *always* be invisible - } + void paintEvent(QPaintEvent*ev); + //Need Drag and Drop functionality (internal movement) void dragEnterEvent(QDragEnterEvent *ev){ if(ev->mimeData()->hasFormat(MIMETYPE) ){ -- cgit