summaryrefslogtreecommitdiff
path: root/src/instancemanager.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-07-25 22:47:34 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-03 11:39:05 -0500
commit0f0313874aa90c66acaac9082f5ba6fbd29300ef (patch)
treed9dbb5b7e479f88656379b9b4617632b20dce601 /src/instancemanager.cpp
parentdfbcf8ec4c6da4d2d098403a01e7ec19b587e836 (diff)
new GlobalSettings class to manage the registry
close the create instance dialog when launch is unchecked
Diffstat (limited to 'src/instancemanager.cpp')
-rw-r--r--src/instancemanager.cpp30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/instancemanager.cpp b/src/instancemanager.cpp
index 849cdb5e..bd35cb47 100644
--- a/src/instancemanager.cpp
+++ b/src/instancemanager.cpp
@@ -23,7 +23,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "settings.h"
#include "shared/appconfig.h"
#include "plugincontainer.h"
-#include "env.h"
#include <report.h>
#include <iplugingame.h>
#include <utility.h>
@@ -38,15 +37,9 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
using namespace MOBase;
-const QString Organization = "Mod Organizer Team";
-const QString Application = "Mod Organizer";
-const QString InstanceValue = "CurrentInstance";
-
-
InstanceManager::InstanceManager()
- : m_AppSettings(Organization, Application)
{
- updateRegistryKey();
+ GlobalSettings::updateRegistryKey();
}
InstanceManager &InstanceManager::instance()
@@ -55,23 +48,6 @@ InstanceManager &InstanceManager::instance()
return s_Instance;
}
-void InstanceManager::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);
-}
-
void InstanceManager::overrideInstance(const QString& instanceName)
{
m_overrideInstanceName = instanceName;
@@ -89,7 +65,7 @@ QString InstanceManager::currentInstance() const
if (m_overrideInstance)
return m_overrideInstanceName;
else
- return m_AppSettings.value(InstanceValue, "").toString();
+ return GlobalSettings::currentInstance();
}
void InstanceManager::clearCurrentInstance()
@@ -101,7 +77,7 @@ void InstanceManager::clearCurrentInstance()
void InstanceManager::setCurrentInstance(const QString &name)
{
- m_AppSettings.setValue(InstanceValue, name);
+ GlobalSettings::setCurrentInstance(name);
}
bool InstanceManager::deleteLocalInstance(const QString& instanceId) const