diff options
Diffstat (limited to 'src/choosersettings.cpp')
-rw-r--r-- | src/choosersettings.cpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/choosersettings.cpp b/src/choosersettings.cpp deleted file mode 100644 index 439c9ea..0000000 --- a/src/choosersettings.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * choosersettings.cpp - * - * Created on: Mar 24, 2014 - * Author: nils - */ - -#include "choosersettings.h" -#include "globals.h" - -bool ChooserSettings::settingsLoaded = false; -ChooserSettings* ChooserSettings::chooserSettings = nullptr; - -ChooserSettings::ChooserSettings() { - // test (and make) directory - QDir saveFileDir(QFileInfo(PREVIOUS_SESSION_USER).absoluteDir()); - if (!saveFileDir.exists()) { - if (!saveFileDir.mkpath(saveFileDir.path())) { - return; - } - } - - settings = new QSettings(PREVIOUS_SESSION_USER, QSettings::IniFormat); - settings->setIniCodec("UTF-8"); - - if (settings->status() != QSettings::NoError) { - if (g_debugMode) { - qDebug() << "Settings: " << PREVIOUS_SESSION_USER << " contains erros."; - } - return; - } - - settingsLoaded = true; -} - -ChooserSettings::~ChooserSettings() { - settings->deleteLater(); -} - -QString ChooserSettings::getSetting(QString key) { - if (!settingsLoaded) { - chooserSettings = new ChooserSettings(); - if (!settingsLoaded) return ""; - } - - return chooserSettings->settings->value(key).toString(); -} - -bool ChooserSettings::setSetting(QString key, QString value) { - if (!settingsLoaded) { - chooserSettings = new ChooserSettings(); - if (!settingsLoaded) return false; - } - chooserSettings->settings->setValue(key, value); -// chooserSettings->settings->sync(); - return true; -} |