diff options
author | Ken Moore <moorekou@gmail.com> | 2015-10-16 23:07:32 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-10-16 23:07:32 -0400 |
commit | 9d2f7b1bd0d9c6a726099e77d53599a4e4d99346 (patch) | |
tree | d75ca3dae6982e0bff9925b9ff8375a0d3ef32d3 /lumina-desktop | |
parent | Convert the grid used for the desktop plugin system a little bit: (diff) | |
download | lumina-9d2f7b1bd0d9c6a726099e77d53599a4e4d99346.tar.gz lumina-9d2f7b1bd0d9c6a726099e77d53599a4e4d99346.tar.bz2 lumina-9d2f7b1bd0d9c6a726099e77d53599a4e4d99346.zip |
Fix up the automatic re-sizing of desktop plugins along the bottom/right screen edges when the viewport size changes. If a plugin is *completely* off the screen (a full grid point or more), remove the plugin temporarily and then re-run the plugin creation/placement routine to perform the full "find-a-spot" functionality.
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktopPluginSpace.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lumina-desktop/LDesktopPluginSpace.cpp b/lumina-desktop/LDesktopPluginSpace.cpp index 2c9bea12..2732556e 100644 --- a/lumina-desktop/LDesktopPluginSpace.cpp +++ b/lumina-desktop/LDesktopPluginSpace.cpp @@ -33,7 +33,7 @@ LDesktopPluginSpace::~LDesktopPluginSpace(){ } void LDesktopPluginSpace::LoadItems(QStringList plugs, QStringList files){ - if(DEBUG){ qDebug() << "Loading Desktop Items:" << plugs << files; } + if(DEBUG){ qDebug() << "Loading Desktop Items:" << plugs << files << "Area:" << this->size() << GRIDSIZE; } bool changes = false; if(plugs != plugins){ plugins = plugs; changes = true; } if(files != deskitems){ deskitems = files; changes = true; } @@ -63,8 +63,25 @@ void LDesktopPluginSpace::cleanup(){ // PUBLIC SLOTS // =================== void LDesktopPluginSpace::UpdateGeom(){ - if(DEBUG){ qDebug() << "Update Desktop Geom:"; } - //Currently no special checks - might need to add validation of all current plugin geometries in the future + 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; + 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..."; + 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) ); + } + } + if(reload){ QTimer::singleShot(0,this, SLOT(reloadPlugins())); } } // =================== |