diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-07-25 22:47:34 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-03 11:39:05 -0500 |
| commit | 0f0313874aa90c66acaac9082f5ba6fbd29300ef (patch) | |
| tree | d9dbb5b7e479f88656379b9b4617632b20dce601 /src/settings.cpp | |
| parent | dfbcf8ec4c6da4d2d098403a01e7ec19b587e836 (diff) | |
new GlobalSettings class to manage the registry
close the create instance dialog when launch is unchecked
Diffstat (limited to 'src/settings.cpp')
| -rw-r--r-- | src/settings.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 661cf429..76378af9 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2165,3 +2165,39 @@ void DiagnosticsSettings::setSpawnDelay(std::chrono::seconds t) { set(m_Settings, "Settings", "spawn_delay", t.count()); } + + +void GlobalSettings::updateRegistryKey() +{ + const QString OldOrganization = "Tannin"; + const QString OldApplication = "Mod Organizer"; + const QString OldInstanceValue = "CurrentInstance"; + + const QString OldRootKey = "Software\\" + OldOrganization; + + if (env::registryValueExists(OldRootKey + "\\" + OldApplication, OldInstanceValue)) { + QSettings old(OldOrganization, OldApplication); + setCurrentInstance(old.value(OldInstanceValue).toString()); + old.remove(OldInstanceValue); + } + + env::deleteRegistryKeyIfEmpty(OldRootKey); +} + +QString GlobalSettings::currentInstance() +{ + return settings().value("CurrentInstance", "").toString(); +} + +void GlobalSettings::setCurrentInstance(const QString& s) +{ + settings().setValue("CurrentInstance", s); +} + +QSettings GlobalSettings::settings() +{ + const QString Organization = "Mod Organizer Team"; + const QString Application = "Mod Organizer"; + + return QSettings(Organization, Application); +} |
