diff options
15 files changed, 116 insertions, 99 deletions
diff --git a/lumina-desktop/LDesktopPluginSpace.cpp b/lumina-desktop/LDesktopPluginSpace.cpp index 2732556e..47ed32fd 100644 --- a/lumina-desktop/LDesktopPluginSpace.cpp +++ b/lumina-desktop/LDesktopPluginSpace.cpp @@ -43,11 +43,12 @@ void LDesktopPluginSpace::LoadItems(QStringList plugs, QStringList files){ void LDesktopPluginSpace::SetIconSize(int size){ if(DEBUG){ qDebug() << "Set Desktop Icon Size:" << size; } //QSize newsize = calculateItemSize(size); + int oldsize = GRIDSIZE; GRIDSIZE = size; //turn the int into a float; - itemSize = QSize(1,1); //save this for all the later icons which are generated (grid size) - UpdateGeom(); + //itemSize = QSize(1,1); //save this for all the later icons which are generated (grid size) + UpdateGeom(oldsize); //Now re-set the item icon size - reloadPlugins(true); + //reloadPlugins(true); } void LDesktopPluginSpace::cleanup(){ @@ -62,41 +63,37 @@ void LDesktopPluginSpace::cleanup(){ // =================== // PUBLIC SLOTS // =================== -void LDesktopPluginSpace::UpdateGeom(){ +void LDesktopPluginSpace::UpdateGeom(int oldgrid){ if(DEBUG){ qDebug() << "Updated Desktop Geom:" << this->size() << GRIDSIZE << this->size()/GRIDSIZE; } //Go through and check the locations/sizes of all items (particularly the ones on the bottom/right edges) - bool reload = false; + //bool reload = false; for(int i=0; i<ITEMS.length(); i++){ - QRect grid = geomToGrid(ITEMS[i]->geometry()); - if(DEBUG){ qDebug() << " - Check Plugin:" << grid; } - if( (grid.x()+grid.width() > this->width()/GRIDSIZE) || (grid.y()+grid.height() > this->height()/GRIDSIZE) ){ - //This plugin is too far out of the screen - remove it and reload plugins (will find new location for it) - //qDebug() << " -- Out of bounds - recreate it..."; + QRect grid = geomToGrid(ITEMS[i]->geometry(), oldgrid); + if(DEBUG){ qDebug() << " - Check Plugin:" << ITEMS[i]->whatsThis() << grid; } + if( !ValidGrid(grid) ){ + //This plugin is too far out of the screen - find new location for it + if(DEBUG){ qDebug() << " -- Out of bounds - Find a new spot"; } + grid = findOpenSpot(grid.width(), grid.height(), grid.y()-1, grid.x()-1); //try to get a nearby spot first + } + if(!ValidGrid(grid)){ + qDebug() << "No Place for plugin:" << ITEMS[i]->whatsThis(); + qDebug() << " - Removing it for now..."; delete ITEMS.takeAt(i); i--; - reload = true; - }else if( (grid.x()+grid.width() == this->width()/GRIDSIZE) || (grid.y()+grid.height() == this->height()/GRIDSIZE) ){ - //This plugin is on the bottom/right screen edge - recalculate edge matching and re-apply geometry - //qDebug() << " -- On Screen Edge - adjust to fit..."; - ITEMS[i]->setGeometry( gridToGeom(grid) ); + }else{ + //NOTE: We are not doing the ValidGeometry() checks because we are only resizing existing plugin with pre-set & valid grid positions + grid = gridToGeom(grid); //convert to pixels before saving/sizing + ITEMS[i]->setGeometry( grid ); + ITEMS[i]->setFixedSize(grid.size()); + ITEMS[i]->savePluginGeometry(grid); } } - if(reload){ QTimer::singleShot(0,this, SLOT(reloadPlugins())); } + //if(reload){ QTimer::singleShot(0,this, SLOT(reloadPlugins())); } } // =================== // PRIVATE // =================== -QSize LDesktopPluginSpace::calculateItemSize(int icosize){ - //Note: This returns the size in numbers of cells (width = columnspan, height = rowspan) - QSize sz; - sz.setWidth(1.8*icosize); - sz.setWidth( RoundUp(sz.width()/GRIDSIZE)); //always round up to cell numbers - sz.setHeight(icosize+ 2.3*this->fontMetrics().height() ); - sz.setHeight( RoundUp(sz.height()/GRIDSIZE)); //always round up to cell number - return sz; -} - void LDesktopPluginSpace::addDesktopItem(QString filepath){ addDesktopPlugin("applauncher::"+filepath+"---dlink"+QString::number(LSession::handle()->desktop()->screenNumber(this)) ); } @@ -111,15 +108,12 @@ void LDesktopPluginSpace::addDesktopPlugin(QString plugID){ if(!geom.isNull()){ geom = geomToGrid(geom); } //convert to grid coordinates if(geom.isNull()){ //No previous location - need to calculate initial geom - QSize sz = plug->sizeHint(); - if(plugID.startsWith("applauncher") ){ sz = itemSize*GRIDSIZE; } - geom.setWidth( RoundUp(sz.width()/GRIDSIZE) ); - geom.setHeight( RoundUp(sz.height()/GRIDSIZE) ); - geom.moveTo( findOpenSpot(geom.width(), geom.height()) ); + QSize sz = plug->defaultPluginSize(); //in grid coordinates + geom.setSize(sz); + geom = findOpenSpot(geom.width(), geom.height() ); }else if(!ValidGeometry(plugID, gridToGeom(geom)) ){ //Find a new location for the plugin (saved location is invalid) - QPoint pt = findOpenSpot(geom.width(), geom.height(), geom.y()-1, geom.x()-1); //try to get it within the same general area - geom.moveTo(pt); + geom = findOpenSpot(geom.width(), geom.height(), geom.y()-1, geom.x()-1); //try to get it within the same general area } if(geom.x() < 0 || geom.y() < 0){ qDebug() << "No available space for desktop plugin:" << plugID << " - IGNORING"; @@ -139,7 +133,7 @@ void LDesktopPluginSpace::addDesktopPlugin(QString plugID){ } } -QPoint LDesktopPluginSpace::findOpenSpot(int gridwidth, int gridheight, int startRow, int startCol){ +QRect LDesktopPluginSpace::findOpenSpot(int gridwidth, int gridheight, int startRow, int startCol){ //Note about the return QPoint: x() is the column number, y() is the row number QPoint pt(0,0); int row = startRow; int col = startCol; @@ -192,15 +186,20 @@ QPoint LDesktopPluginSpace::findOpenSpot(int gridwidth, int gridheight, int star } } if(!found){ - //Decrease the size of the item by 1x1 grid points and try again - if(gridwidth>2 && gridheight>2){ - pt = findOpenSpot(gridwidth-1, gridheight-1, 0, 0); + + if(startRow!=0 || startCol!=0){ + //Did not check the entire screen yet - try that first + return findOpenSpot(gridwidth, gridheight, 0,0); + }else if(gridwidth>1 && gridheight>1){ + //Decrease the size of the item by 1x1 grid points and try again + return findOpenSpot(gridwidth-1, gridheight-1, 0, 0); }else{ - pt.setX(-1); pt.setY(-1); //invalid qDebug() << "Could not find an open spot for a desktop plugin:" << gridwidth << gridheight << startRow << startCol; + return QRect(-1,-1,-1,-1); } + }else{ + return QRect(pt,QSize(gridwidth,gridheight)); } - return pt; } // =================== @@ -214,12 +213,12 @@ void LDesktopPluginSpace::reloadPlugins(bool ForceIconUpdate ){ if( ITEMS[i]->whatsThis().startsWith("applauncher") && ForceIconUpdate){ //Change the size of the existing plugin - preserving the location if possible - QRect geom = ITEMS[i]->loadPluginGeometry(); //pixel coords + /*QRect geom = ITEMS[i]->loadPluginGeometry(); //pixel coords if(!geom.isNull()){ geom = geomToGrid(geom); //convert to grid coords geom.setSize(itemSize); //Reset back to default size (does not change location) ITEMS[i]->savePluginGeometry( gridToGeom(geom)); //save it back in pixel coords - } + }*/ //Now remove the plugin for the moment - run it through the re-creation routine below delete ITEMS.takeAt(i); i--; diff --git a/lumina-desktop/LDesktopPluginSpace.h b/lumina-desktop/LDesktopPluginSpace.h index 8e4c31c2..316ee2f9 100644 --- a/lumina-desktop/LDesktopPluginSpace.h +++ b/lumina-desktop/LDesktopPluginSpace.h @@ -40,11 +40,10 @@ public: void cleanup(); public slots: - void UpdateGeom(); + void UpdateGeom(int oldgrid = -1); private: QSettings *plugsettings; - QSize itemSize; QStringList plugins, deskitems; QList<LDPlugin*> ITEMS; bool TopToBottom; @@ -56,12 +55,11 @@ private: return out; } - QSize calculateItemSize(int icosize); - void addDesktopItem(QString filepath); //This will convert it into a valid Plugin ID + void addDesktopItem(QString filepath); //This will convert it into a valid Plugin ID automatically void addDesktopPlugin(QString plugID); - QPoint findOpenSpot(int gridwidth = 1, int gridheight = 1, int startRow = 0, int startCol = 0); + QRect findOpenSpot(int gridwidth = 1, int gridheight = 1, int startRow = 0, int startCol = 0); QPoint posToGrid(QPoint pos){ //This assumes a point in widget-relative coordinates @@ -70,11 +68,18 @@ private: return pos; } - QRect geomToGrid(QRect geom){ - return QRect( RoundUp(geom.x()/GRIDSIZE), RoundUp(geom.y()/GRIDSIZE), \ + QRect geomToGrid(QRect geom, int grid = -1){ + if(grid<0){ + //use the current grid size + return QRect( RoundUp(geom.x()/GRIDSIZE), RoundUp(geom.y()/GRIDSIZE), \ RoundUp(geom.width()/GRIDSIZE), RoundUp(geom.height()/GRIDSIZE) ); - + }else{ + //use the input grid size + return QRect( RoundUp(geom.x()/((double) grid)), RoundUp(geom.y()/((double) grid)), \ + RoundUp(geom.width()/((double) grid)), RoundUp(geom.height()/((double) grid)) ); + } } + QRect gridToGeom(QRect grid){ //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); @@ -107,6 +112,14 @@ private: drag->exec(Qt::CopyAction); } + bool ValidGrid(QRect grid){ + //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; } + 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 @@ -174,14 +187,17 @@ protected: //qDebug() << "Move Event:" << "Old geom (grid):" << geom; geom.moveTo( (geom.topLeft()+diff) ); //qDebug() << " - After Move:" << geom; - geom = gridToGeom(geom); //convert back to px coords with edge matching - //qDebug() << " - new Geometry:" << geom; - if(ValidGeometry(act.section("::::",1,50), geom)){ - //qDebug() << " - Is valid"; + bool valid = ValidGrid(geom); + if(valid){ + //Convert to pixel coordinates and check validity again + geom = gridToGeom(geom); //convert back to px coords with edge matching + valid = ValidGeometry(act.section("::::",1,50), geom); + } + if(valid){ item->setGeometry(geom); item->setFixedSize(geom.size()); //needed due to resizing limitations and such for some plugins ev->acceptProposedAction(); - item->savePluginGeometry(geom); //save in pixel coords + item->savePluginGeometry(geom); //save in pixel coords }else{ ev->ignore(); } //invalid location }else{ @@ -196,17 +212,18 @@ protected: if(diff.y()<0){ geom.setTop( ev->pos().y()/GRIDSIZE); } //expanding above (round down) else if(diff.y()>0){ geom.setBottom( ev->pos().y()/GRIDSIZE); } //expanding below (round down) //qDebug() << " - Adjusted:" << geom; - if(geom.width()<1 || geom.height()<1){ ev->ignore(); return; } //cannot have 0 size - //Now convert back to pixel coords (includes edge matching/adjustments) - geom = gridToGeom(geom); - //qDebug() << " - Pixels:" << geom; - //Check Validity of new geom - if(ValidGeometry(act.section("::::",1,50), geom)){ + bool valid = ValidGrid(geom); + if(valid){ + //Convert to pixel coordinates and check validity again + geom = gridToGeom(geom); //convert back to px coords with edge matching + valid = ValidGeometry(act.section("::::",1,50), geom); + } + if(valid){ item->setGeometry(geom); item->setFixedSize(geom.size()); //needed due to resizing limitations and such for some plugins - ev->acceptProposedAction(); - item->savePluginGeometry(geom); //save in pixel coords - }else{ ev->ignore(); } //invalid location + ev->acceptProposedAction(); + item->savePluginGeometry(geom); //save in pixel coords + }else{ ev->ignore(); } //invalid location } } }else if(ev->mimeData()->hasUrls()){ diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp index 0fec17c6..b238a207 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.cpp +++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp @@ -42,7 +42,7 @@ void LDPlugin::setupMenu(){ menu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove Item"), this, SLOT(slotRemovePlugin()) ); } -void LDPlugin::setInitialSize(int width, int height){ +/*void LDPlugin::setInitialSize(int width, int height){ //Note: Only run this in the plugin initization routine: // if the plugin is completely new (first time used), it will be this size if(settings->allKeys().filter(prefix+"location").isEmpty()){ @@ -54,12 +54,4 @@ void LDPlugin::setInitialSize(int width, int height){ } //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/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h index d1a9c743..6a3c82a1 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.h +++ b/lumina-desktop/desktop-plugins/LDPlugin.h @@ -47,8 +47,11 @@ public: return PLUGID; } - void setInitialSize(int width, int height); - //void adjustSize(int width, int height); + virtual QSize defaultPluginSize(){ + //This needs to be re-implemented in the subclassed plugin + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(1,1); //1x1 grid size + } void savePluginGeometry(QRect geom){ settings->setValue(prefix+"geometry/desktopGridPoints", geom); diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp index c0f868e2..4b3210a5 100644 --- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -15,25 +15,10 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); lay->addWidget(button, 0, Qt::AlignCenter); connect(button, SIGNAL(DoubleClicked()), this, SLOT(buttonClicked()) ); - //menu = new QMenu(this); - /*int icosize = this->readSetting("iconsize",-1).toInt(); - if(icosize <1){ - icosize = LSession::handle()->sessionSettings()->value("DefaultIconSize",64).toInt(); - this->saveSetting("iconsize",icosize); - }*/ - //int icosize - //button->setIconSize(QSize(icosize,icosize)); button->setContextMenuPolicy(Qt::NoContextMenu); - //connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(openContextMenu()) ); watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) ); - //Calculate the initial size of the button - //qDebug() << "Button Size:" << button->size(); - //qDebug() << "Calculated:" << icosize+4 << icosize+8+qRound(2.15*button->fontMetrics().height()); - //qDebug() << "Preferred Size:" << button->sizeHint(); - //QSize sz(qRound(1.1*icosize), icosize+qRound(2.7*button->fontMetrics().height()) ); - //button->setFixedSize(sz); //make sure to adjust the button on first show. - this->setInitialSize(120, 100); //give the container a bit of a buffer + QTimer::singleShot(200,this, SLOT(loadButton()) ); } @@ -49,7 +34,7 @@ void AppLauncherPlugin::loadButton(){ QString path = this->readSetting("applicationpath",def).toString(); //use the default if necessary //qDebug() << "Default Application Launcher:" << def << path; bool ok = QFile::exists(path); - int icosize = this->width()/1.8; //This is the same calculation as in the LDesktopPluginSpace + int icosize = this->height()-4 - 2.2*button->fontMetrics().height(); button->setFixedSize( this->width()-4, this->height()-4); button->setIconSize( QSize(icosize,icosize) ); QString txt; diff --git a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp index 459e4610..4d293b39 100644 --- a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp +++ b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp @@ -262,7 +262,6 @@ AudioPlayerPlugin::AudioPlayerPlugin(QWidget *parent, QString ID) : LDPlugin(par this->layout()->setContentsMargins(0,0,0,0); this->layout()->addWidget(player); - this->setInitialSize(this->sizeHint().width(), this->sizeHint().height()); } AudioPlayerPlugin::~AudioPlayerPlugin(){ diff --git a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h index eaa068ff..6aaeac4c 100644 --- a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h +++ b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h @@ -64,6 +64,11 @@ public: AudioPlayerPlugin(QWidget* parent, QString ID); ~AudioPlayerPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,1); + } + private: PlayerWidget *player; diff --git a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h index 133a3af6..b3a6a8d7 100644 --- a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h +++ b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h @@ -28,7 +28,6 @@ public: cal = new QCalendarWidget(this); cal->setSelectionMode(QCalendarWidget::NoSelection); this->layout()->addWidget(cal); - this->setInitialSize( cal->sizeHint().width(), cal->sizeHint().height() ); timer = new QTimer(this); timer->setInterval(1800000); //30 minute refresh timer timer->start(); @@ -38,6 +37,11 @@ public: ~CalendarPlugin(){ timer->stop(); } + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,2); + } + private slots: void updateDate(){ if(cal->selectedDate() != QDate::currentDate()){ diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp index 0b48a049..d81afd1e 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp @@ -39,7 +39,6 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par menu->addAction( LXDG::findIcon("system-search",""), tr("Properties"), this, SLOT(displayProperties()) ); } this->layout()->addWidget(list); - this->setInitialSize(300,300); connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateContents()) ); connect(list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(runItems()) ); diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h index a75372a1..046b6e5c 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h @@ -23,6 +23,10 @@ public: DesktopViewPlugin(QWidget* parent, QString ID); ~DesktopViewPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,3); + } private: QListWidget *list; QMenu *menu; diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp index f66cb53e..e229774d 100644 --- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp +++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp @@ -62,9 +62,6 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID) QTimer::singleShot(2000, this, SLOT(notesDirChanged())); //qDebug() << "Set Sizing"; - //Now setup the initial values for the plugin - qDebug() << "New Notepad:" << this->sizeHint() << this->size(); - this->setInitialSize(this->sizeHint().width(),this->sizeHint().height()); //qDebug() << "Connect Signals/slots"; //Setup the button connections connect(open, SIGNAL(clicked()), this, SLOT(openNote()) ); diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h index a1d9bf8f..5a9ea2be 100644 --- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h +++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h @@ -23,6 +23,10 @@ public: NotePadPlugin(QWidget* parent, QString ID); ~NotePadPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,3); + } private: QPlainTextEdit *edit; QToolButton *open, *add, *rem; diff --git a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h index 0e6cda2f..4ba74133 100644 --- a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h +++ b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h @@ -27,11 +27,15 @@ public: this->layout()->addWidget(container); container->setSource(QUrl::fromLocalFile( LUtils::findQuickPluginFile(ID.section("---",0,0)) )); QApplication::processEvents(); //to check for errors right away - this->setInitialSize(container->initialSize().width(), container->initialSize().height()); + //this->setInitialSize(container->initialSize().width(), container->initialSize().height()); } ~QuickDPlugin(){} + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(2,2); + } private: QQuickWidget *container; diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp index 6a300b6c..951bcc98 100644 --- a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp +++ b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp @@ -55,7 +55,7 @@ SysMonitorPlugin::SysMonitorPlugin(QWidget *parent, QString ID) : LDPlugin(paren this->layout()->setContentsMargins(0,0,0,0); this->layout()->addWidget(monitor); - this->setInitialSize(monitor->sizeHint().width(),monitor->sizeHint().height()); + //this->setInitialSize(monitor->sizeHint().width(),monitor->sizeHint().height()); } SysMonitorPlugin::~SysMonitorPlugin(){ diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h index 08e8c09c..015ba7fe 100644 --- a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h +++ b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h @@ -42,6 +42,11 @@ public: SysMonitorPlugin(QWidget* parent, QString ID); ~SysMonitorPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(2,3); + } + private: MonitorWidget *monitor; |