aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2016-09-21 12:07:45 -0400
committerKen Moore <ken@pcbsd.org>2016-09-21 12:07:45 -0400
commitd4e90780226e6e910561654cc3a574623ddfa5cc (patch)
tree07b8a7b5e601a1eab89a8a92ad5ed879c66060cb
parentRestore all the translations for lumina-textedit (aside from "hi"). (diff)
downloadlumina-d4e90780226e6e910561654cc3a574623ddfa5cc.tar.gz
lumina-d4e90780226e6e910561654cc3a574623ddfa5cc.tar.bz2
lumina-d4e90780226e6e910561654cc3a574623ddfa5cc.zip
Commit a small cleanup for the auto-loading of the apps list on the system.
Going to check if this fixes the memory leak issue on some systems (have one I can test on now).
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp12
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.h1
2 files changed, 8 insertions, 5 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index 48185a38..64f21743 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -20,6 +20,7 @@ XDGDesktopList::XDGDesktopList(QObject *parent, bool watchdirs) : QObject(parent
synctimer = new QTimer(this);
synctimer->setInterval(60000); //1 minute intervals. since the polling/update only takes a few ms, this is completely reasonable
connect(synctimer, SIGNAL(timeout()), this, SLOT(updateList()) );
+ keepsynced = watchdirs;
if(watchdirs){
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(watcherChanged()) );
@@ -79,12 +80,13 @@ void XDGDesktopList::updateList(){
}
//If this class is automatically managing the lists, update the watched files/dirs and send out notifications
if(watcher!=0){
- //qDebug() << "App List Updated:" << lastCheck << appschanged << newfiles << oldkeys;
+ qDebug() << "Auto App List Update:" << lastCheck << "Changes:" << appschanged;// << newfiles << oldkeys;
watcher->removePaths(QStringList() << watcher->files() << watcher->directories());
watcher->addPaths(appDirs);
if(appschanged){ emit appsUpdated(); }
+ synctimer->start();
}
- synctimer->start();
+
}
QList<XDGDesktop> XDGDesktopList::apps(bool showAll, bool showHidden){
@@ -511,15 +513,15 @@ QStringList LXDG::systemApplicationDirs(){
}
XDGDesktopList* LXDG::systemAppsList(){
- static XDGDesktopList *sysapps = new XDGDesktopList(0,true); //set this to automatically update as needed
+ static XDGDesktopList *sysapps = 0;
+ if(sysapps == 0){ qDebug() << "Generating new apps list"; sysapps = new XDGDesktopList(0,true); }//set this to automatically update as needed
if(sysapps->lastCheck.isNull()){ sysapps->updateList(); } //catch the first time the class was used, and prompt for an update right now
return sysapps;
}
QList<XDGDesktop> LXDG::systemDesktopFiles(bool showAll, bool showHidden){
//Quick overload for backwards compatibility which uses the static/global class for managing app entries
- XDGDesktopList list(0, false);
- return list.apps(showAll, showHidden);
+ return systemAppsList()->apps(showAll, showHidden);
}
QHash<QString,QList<XDGDesktop> > LXDG::sortDesktopCats(QList<XDGDesktop> apps){
diff --git a/src-qt5/core/libLumina/LuminaXDG.h b/src-qt5/core/libLumina/LuminaXDG.h
index 996e5a20..0397ce71 100644
--- a/src-qt5/core/libLumina/LuminaXDG.h
+++ b/src-qt5/core/libLumina/LuminaXDG.h
@@ -93,6 +93,7 @@ public slots:
private:
QFileSystemWatcher *watcher;
QTimer *synctimer;
+ bool keepsynced;
private slots:
void watcherChanged();
bgstack15