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/desktopview | |
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/desktopview')
-rw-r--r-- | lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp | 20 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h | 2 |
2 files changed, 9 insertions, 13 deletions
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp index 991abf2e..81f1281b 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp @@ -21,7 +21,7 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par list->setSpacing(2); list->setSelectionBehavior(QAbstractItemView::SelectItems); list->setSelectionMode(QAbstractItemView::ExtendedSelection); - //int icosize = settings->value("IconSize",64).toInt(); + //int icosize = this->readSetting("IconSize",64).toInt(); //list->setIconSize(QSize(icosize,icosize)); //list->setUniformItemSizes(true); list->setContextMenuPolicy(Qt::CustomContextMenu); @@ -42,10 +42,8 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par } this->layout()->addWidget(list); this->setInitialSize(600,600); - watcher = new QFileSystemWatcher(this); - watcher->addPath(QDir::homePath()+"/Desktop"); - connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateContents()) ); - + + connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateContents()) ); connect(list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(runItems()) ); connect(list, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showMenu(const QPoint&)) ); QTimer::singleShot(0,this, SLOT(updateContents()) ); @@ -116,21 +114,19 @@ void DesktopViewPlugin::showMenu(const QPoint &pos){ } void DesktopViewPlugin::increaseIconSize(){ - int icosize = settings->value("IconSize",64).toInt(); + int icosize = this->readSetting("IconSize",64).toInt(); icosize+=16; //go in orders of 16 pixels //list->setIconSize(QSize(icosize,icosize)); - settings->setValue("IconSize",icosize); - settings->sync(); + this->saveSetting("IconSize",icosize); updateContents(); } void DesktopViewPlugin::decreaseIconSize(){ - int icosize = settings->value("IconSize",64).toInt(); + int icosize = this->readSetting("IconSize",64).toInt(); if(icosize < 20){ return; } //too small to decrease more icosize-=16; //go in orders of 16 pixels //list->setIconSize(QSize(icosize,icosize)); - settings->setValue("IconSize",icosize); - settings->sync(); + this->saveSetting("IconSize",icosize); updateContents(); } @@ -140,7 +136,7 @@ void DesktopViewPlugin::updateContents(){ QList<QByteArray> fmt = QImageReader::supportedImageFormats(); for(int i=0; i<fmt.length(); i++){ imgExtensions << QString::fromLocal8Bit(fmt[i]); } }*/ - int icosize = settings->value("IconSize",64).toInt(); + int icosize = this->readSetting("IconSize",64).toInt(); QSize gridSZ = QSize(icosize+8,icosize+4+(2*this->fontMetrics().height()) ); //qDebug() << "Icon Size:" << icosize <<"Grid Size:" << gridSZ.width() << gridSZ.height(); list->setGridSize(gridSZ); diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h index d8f217f0..7a2d327b 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h @@ -25,7 +25,7 @@ public: private: QListWidget *list; - QFileSystemWatcher *watcher; + //QFileSystemWatcher *watcher; QMenu *menu; //QStringList imgExtensions; |