diff options
author | Ken Moore <ken@pcbsd.org> | 2015-06-14 17:53:11 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-06-14 17:53:11 -0400 |
commit | 33494b8f9177a9c1b3d936e974ad553fc07ae859 (patch) | |
tree | 93b404510a04f5dcb76dc0e35ccac144c6d5cb68 /lumina-desktop/desktop-plugins/LDPluginContainer.h | |
parent | Add a QtQuick sample plugin and disable the new panel container for QtQuick p... (diff) | |
download | lumina-33494b8f9177a9c1b3d936e974ad553fc07ae859.tar.gz lumina-33494b8f9177a9c1b3d936e974ad553fc07ae859.tar.bz2 lumina-33494b8f9177a9c1b3d936e974ad553fc07ae859.zip |
Re-work quite a bit of the background procedures for desktop plugins and watchers:
1) Move the ~/Desktop directory watcher into the Session (no extra overhead, already have a watcher there), and have te session send out signals when the contents of the ~/Desktop dir change.
2) Setup the plugins that poll the desktop to use the new session implementation (reducing overhead overall)
3) Add the ability to use files/dirs in the "applauncher" plugin as well (not exposed to user yet)
4) Add a new desktop flag for auto-creating applauncher plugins for any files/dirs on the desktop (not added to lumina-config yet)
5) Get rid of all the config files for the desktop plugins and merge them all together into a single conf file that the session maintains the pointer to (so plugins can grab that pointer as necessary)
6) Make sure that desktop plugins go through a special [read/save]Setting() functions in the plugin implementation itself so that they don't accidentally trample other plugin settings (keeps it restricted to the particular group for that plugin)
Diffstat (limited to 'lumina-desktop/desktop-plugins/LDPluginContainer.h')
-rw-r--r-- | lumina-desktop/desktop-plugins/LDPluginContainer.h | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPluginContainer.h b/lumina-desktop/desktop-plugins/LDPluginContainer.h index 04ae8262..0e570e26 100644 --- a/lumina-desktop/desktop-plugins/LDPluginContainer.h +++ b/lumina-desktop/desktop-plugins/LDPluginContainer.h @@ -27,43 +27,31 @@ class LDPluginContainer : public QMdiSubWindow{ Q_OBJECT private: - QSettings *settings; QTimer *syncTimer; bool locked, setup; - + LDPlugin *PLUG; + private slots: void saveGeometry(){ - if(settings==0){ return; } - settings->setValue("location/x", this->pos().x()); - settings->setValue("location/y", this->pos().y()); - settings->setValue("location/width", this->size().width()); - settings->setValue("location/height", this->size().height()); - settings->sync(); + if(PLUG==0){ return; } + PLUG->saveSetting("location/x", this->pos().x()); + PLUG->saveSetting("location/y", this->pos().y()); + PLUG->saveSetting("location/width", this->size().width()); + PLUG->saveSetting("location/height", this->size().height()); } public: LDPluginContainer(LDPlugin *plugin = 0, bool islocked = true) : QMdiSubWindow(){ locked = islocked; setup=true; + PLUG = plugin; syncTimer = new QTimer(this); syncTimer->setInterval(500); //save settings 1 second after it is moved syncTimer->setSingleShot(true); //no repeats connect(syncTimer, SIGNAL(timeout()), this, SLOT(saveGeometry()) ); this->setWhatsThis(plugin->ID()); if(locked){ this->setWindowFlags(Qt::FramelessWindowHint); } - else{ this->setWindowFlags(Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); } - settings = plugin->settings; //save this pointer for access later - if(settings!=0){ - if(settings->allKeys().isEmpty()){ - //Brand new plugin - no location/size info saved yet - //save the initial size of the plugin - the initial location will be set automatically - QSize sz = plugin->sizeHint(); - if(!sz.isValid()){ sz = QSize(64,64); } - settings->setValue("location/width", sz.width()); - settings->setValue("location/height", sz.height()); - settings->sync(); - } - } + else{ this->setWindowFlags(Qt::CustomizeWindowHint); }//Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); } this->setContentsMargins(0,0,0,0); if(!locked){ this->setWindowTitle( plugin->ID().replace("---"," - ") ); @@ -80,7 +68,7 @@ public: } void loadInitialPosition(){ - QRect set(settings->value("location/x",-12345).toInt(), settings->value("location/y",-12345).toInt(), settings->value("location/width",this->widget()->sizeHint().width()).toInt(), settings->value("location/height",this->widget()->sizeHint().height()).toInt()); + QRect set(PLUG->readSetting("location/x",-12345).toInt(), PLUG->readSetting("location/y",-12345).toInt(), PLUG->readSetting("location/width",this->widget()->sizeHint().width()).toInt(), PLUG->readSetting("location/height",this->widget()->sizeHint().height()).toInt()); //qDebug() << "Initial Plugin Location:" << set.x() << set.y() << set.width() << set.height(); if(set.height() < 10){ set.setHeight(10); } //to prevent foot-shooting if(set.width() < 10){ set.setWidth(10); } //to prevent foot-shooting @@ -122,11 +110,10 @@ protected: if( !this->whatsThis().isEmpty() && !locked){ //Plugin removed by the user - delete the settings file locked = true; //ensure that the save settings routines don't do anything during the close - //QFile::remove( settings->fileName() ); emit PluginRemoved( this->whatsThis() ); } if(syncTimer->isActive()){ syncTimer->stop(); } //prevent save routine from running in a moment - settings = 0; //ensure we don't touch the settings file after a close event + //settings = 0; //ensure we don't touch the settings file after a close event QMdiSubWindow::closeEvent(event); //continue closing this window } |