diff options
author | Simon Rettberg | 2018-08-30 16:01:56 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-08-30 16:01:56 +0200 |
commit | e36f2f9dcb864cbaa31787df9f19dda8cc86941d (patch) | |
tree | 66c98da0fce15be36944d6dec4ef35ce7b0fce67 | |
parent | Fix compile error (diff) | |
download | slxgreeter-e36f2f9dcb864cbaa31787df9f19dda8cc86941d.tar.gz slxgreeter-e36f2f9dcb864cbaa31787df9f19dda8cc86941d.tar.xz slxgreeter-e36f2f9dcb864cbaa31787df9f19dda8cc86941d.zip |
Simplify Settings
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/settings.h | 27 |
2 files changed, 13 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp index 3b61d30..d248718 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,7 +53,6 @@ int main(int argc, char *argv[]) } QApplication a(argc, argv); - Settings::loadConfigs(); // I have no idea why, but Qt's stock qWarning() output never makes it // to /var/log/lightdm/x-0-greeter.log, so we use std::cerr instead.. diff --git a/src/settings.h b/src/settings.h index b6c9db0..7a587ea 100644 --- a/src/settings.h +++ b/src/settings.h @@ -14,7 +14,19 @@ class Settings : public QSettings { public: - Settings() : QSettings(QString(CONFIG_FILE), NativeFormat) {} + Settings() : QSettings(QString(CONFIG_FILE), IniFormat) + { + QDir configDir(CONFIG_FOLDER); + QFileInfoList fileInfoList = configDir.entryInfoList(QStringList() << "*.conf", QDir::Files, QDir::Name); + + for (QFileInfo fileInfo : fileInfoList) { + QString filePath = fileInfo.absoluteFilePath(); + QSettings setting(filePath, IniFormat); + for(QString key : setting.allKeys()) { + this->setValue(key, setting.value(key)); + } + } + } static QString iconThemeName() { return s_settings->value("greeter-icon-theme").toString(); } static QString backgrundImagePath() { return s_settings->value("greeter-background-image").toString(); } static QString offsetX() { return s_settings->value("loginform-offset-x").toString(); } @@ -29,19 +41,6 @@ public: static QString clockBackgroundStyle() { return s_settings->value("clock-background-style").toString(); } static QStringList clockShadow() { return s_settings->value("clock-shadow").toString().split(QRegExp("\\s"), QString::SkipEmptyParts); } static QString usernamePlaceholder() { return s_settings->value("username-placeholder").toString(); } - - static void loadConfigs() { - QDir configDir(CONFIG_FOLDER); - QFileInfoList fileInfoList = configDir.entryInfoList(QStringList() << "*.conf", QDir::Files, QDir::Name); - - for (QFileInfo fileInfo : fileInfoList) { - QString filePath = fileInfo.absoluteFilePath(); - QSettings setting(filePath, QSettings::NativeFormat); - for(QString key : setting.allKeys()) { - s_settings->setValue(key, setting.value(key)); - } - } - } }; #endif // SETTINGS_H |