diff options
author | Ken Moore <ken@ixsystems.com> | 2017-07-05 13:23:25 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-07-05 13:23:25 -0400 |
commit | c350293e4a3bccfbc255dec8e1eea35fe36c2b2d (patch) | |
tree | 6d0c247c5a265cdcf77e350baaeefdb8178e57c8 /src-qt5/core | |
parent | Remove the "DEPENDENCIES" file from the overall project directory. Each indiv... (diff) | |
download | lumina-c350293e4a3bccfbc255dec8e1eea35fe36c2b2d.tar.gz lumina-c350293e4a3bccfbc255dec8e1eea35fe36c2b2d.tar.bz2 lumina-c350293e4a3bccfbc255dec8e1eea35fe36c2b2d.zip |
Add the ability to use a static "instance()" of the DesktopSettings class within a project
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/DesktopSettings.cpp | 14 | ||||
-rw-r--r-- | src-qt5/core/libLumina/DesktopSettings.h | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src-qt5/core/libLumina/DesktopSettings.cpp b/src-qt5/core/libLumina/DesktopSettings.cpp index 30bd5bc2..bd0325ec 100644 --- a/src-qt5/core/libLumina/DesktopSettings.cpp +++ b/src-qt5/core/libLumina/DesktopSettings.cpp @@ -9,7 +9,7 @@ #include <QDir> #include <QDebug> -#include <unistd.h> +#include <unistd.h> #include <pwd.h> #include <grp.h> @@ -25,6 +25,16 @@ DesktopSettings::~DesktopSettings(){ if(!files.isEmpty()){ stop(); } } +DesktopSettings* DesktopSettings::instance(){ + static DesktopSettings *set = 0; + if(set==0){ + //First-time init + set = new DesktopSettings(); + set->start(); + } + return set; +} + //Start/stop routines void DesktopSettings::start(){ files.clear(); settings.clear(); //clear the internal hashes (just in case) @@ -35,7 +45,7 @@ void DesktopSettings::start(){ } parseSystemSettings(); //set the runmode appropriately locateFiles(); // - + } void DesktopSettings::stop(){ diff --git a/src-qt5/core/libLumina/DesktopSettings.h b/src-qt5/core/libLumina/DesktopSettings.h index 57eede9d..57a85791 100644 --- a/src-qt5/core/libLumina/DesktopSettings.h +++ b/src-qt5/core/libLumina/DesktopSettings.h @@ -30,6 +30,8 @@ public: DesktopSettings(QObject *parent = 0); ~DesktopSettings(); + static DesktopSettings* instance(); + //Start/stop routines void start(); void stop(); |