aboutsummaryrefslogtreecommitdiff
path: root/launcher/settings/INISettingsObject.cpp
diff options
context:
space:
mode:
authorAlexandru Ionut Tripon <alexandru.tripon97@gmail.com>2023-08-12 12:42:30 +0300
committerGitHub <noreply@github.com>2023-08-12 12:42:30 +0300
commitb3b2e9df35222209b4920202d86091eeeb87f03f (patch)
treece44c3877ee36c21279d142b2af1c393e7b87780 /launcher/settings/INISettingsObject.cpp
parentca061080c13042642fb3bd49a29a863756f45866 (diff)
parent3aba7f8fec45c7c87be486d8f6b5c96f69facf93 (diff)
downloadPrismLauncher-b3b2e9df35222209b4920202d86091eeeb87f03f.tar.gz
PrismLauncher-b3b2e9df35222209b4920202d86091eeeb87f03f.tar.bz2
PrismLauncher-b3b2e9df35222209b4920202d86091eeeb87f03f.zip
Merge branch 'develop' into feat/acknowledge_release_type
Signed-off-by: Alexandru Ionut Tripon <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/settings/INISettingsObject.cpp')
-rw-r--r--launcher/settings/INISettingsObject.cpp50
1 files changed, 19 insertions, 31 deletions
diff --git a/launcher/settings/INISettingsObject.cpp b/launcher/settings/INISettingsObject.cpp
index da962ee9..519b8193 100644
--- a/launcher/settings/INISettingsObject.cpp
+++ b/launcher/settings/INISettingsObject.cpp
@@ -19,8 +19,7 @@
#include <QDebug>
#include <QFile>
-INISettingsObject::INISettingsObject(QStringList paths, QObject *parent)
- : SettingsObject(parent)
+INISettingsObject::INISettingsObject(QStringList paths, QObject* parent) : SettingsObject(parent)
{
auto first_path = paths.constFirst();
for (auto path : paths) {
@@ -39,14 +38,13 @@ INISettingsObject::INISettingsObject(QStringList paths, QObject *parent)
m_ini.loadFile(first_path);
}
-INISettingsObject::INISettingsObject(QString path, QObject* parent)
- : SettingsObject(parent)
+INISettingsObject::INISettingsObject(QString path, QObject* parent) : SettingsObject(parent)
{
m_filePath = path;
m_ini.loadFile(path);
}
-void INISettingsObject::setFilePath(const QString &filePath)
+void INISettingsObject::setFilePath(const QString& filePath)
{
m_filePath = filePath;
}
@@ -64,28 +62,24 @@ void INISettingsObject::suspendSave()
void INISettingsObject::resumeSave()
{
m_suspendSave = false;
- if(m_doSave)
- {
+ if (m_doSave) {
m_ini.saveFile(m_filePath);
}
}
-void INISettingsObject::changeSetting(const Setting &setting, QVariant value)
+void INISettingsObject::changeSetting(const Setting& setting, QVariant value)
{
- if (contains(setting.id()))
- {
+ if (contains(setting.id())) {
// valid value -> set the main config, remove all the sysnonyms
- if (value.isValid())
- {
+ if (value.isValid()) {
auto list = setting.configKeys();
m_ini.set(list.takeFirst(), value);
- for(auto iter: list)
+ for (auto iter : list)
m_ini.remove(iter);
}
// invalid -> remove all (just like resetSetting)
- else
- {
- for(auto iter: setting.configKeys())
+ else {
+ for (auto iter : setting.configKeys())
m_ini.remove(iter);
}
doSave();
@@ -94,35 +88,29 @@ void INISettingsObject::changeSetting(const Setting &setting, QVariant value)
void INISettingsObject::doSave()
{
- if(m_suspendSave)
- {
+ if (m_suspendSave) {
m_doSave = true;
- }
- else
- {
+ } else {
m_ini.saveFile(m_filePath);
}
}
-void INISettingsObject::resetSetting(const Setting &setting)
+void INISettingsObject::resetSetting(const Setting& setting)
{
// if we have the setting, remove all the synonyms. ALL OF THEM
- if (contains(setting.id()))
- {
- for(auto iter: setting.configKeys())
+ if (contains(setting.id())) {
+ for (auto iter : setting.configKeys())
m_ini.remove(iter);
doSave();
}
}
-QVariant INISettingsObject::retrieveValue(const Setting &setting)
+QVariant INISettingsObject::retrieveValue(const Setting& setting)
{
// if we have the setting, return value of the first matching synonym
- if (contains(setting.id()))
- {
- for(auto iter: setting.configKeys())
- {
- if(m_ini.contains(iter))
+ if (contains(setting.id())) {
+ for (auto iter : setting.configKeys()) {
+ if (m_ini.contains(iter))
return m_ini[iter];
}
}