aboutsummaryrefslogtreecommitdiff
path: root/launcher/BaseInstance.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-05-04 20:29:33 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-05-04 20:29:33 +0300
commit9fbec3793f02f6bb3e692f98f2d86cad12c52190 (patch)
tree9f375cbb5e46020f172fd01acd92988fe17655bc /launcher/BaseInstance.cpp
parentb2ecb9ac09573d13c6edf8f6ea0924c1f7006b4b (diff)
parent64ba5e4ed1456bed159cfe7b41ed9175b8baf5c4 (diff)
downloadPrismLauncher-9fbec3793f02f6bb3e692f98f2d86cad12c52190.tar.gz
PrismLauncher-9fbec3793f02f6bb3e692f98f2d86cad12c52190.tar.bz2
PrismLauncher-9fbec3793f02f6bb3e692f98f2d86cad12c52190.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into develop
Diffstat (limited to 'launcher/BaseInstance.cpp')
-rw-r--r--launcher/BaseInstance.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp
index 8680361c..a8fce879 100644
--- a/launcher/BaseInstance.cpp
+++ b/launcher/BaseInstance.cpp
@@ -40,6 +40,8 @@
#include <QDir>
#include <QDebug>
#include <QRegularExpression>
+#include <QJsonDocument>
+#include <QJsonObject>
#include "settings/INISettingsObject.h"
#include "settings/Setting.h"
@@ -64,6 +66,8 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
m_settings->registerSetting("totalTimePlayed", 0);
m_settings->registerSetting("lastTimePlayed", 0);
+ m_settings->registerSetting("linkedInstances", "[]");
+
// Game time override
auto gameTimeOverride = m_settings->registerSetting("OverrideGameTime", false);
m_settings->registerOverride(globalSettings->getSetting("ShowGameTime"), gameTimeOverride);
@@ -182,6 +186,38 @@ bool BaseInstance::shouldStopOnConsoleOverflow() const
return m_settings->get("ConsoleOverflowStop").toBool();
}
+QStringList BaseInstance::getLinkedInstances() const
+{
+ return m_settings->get("linkedInstances").toStringList();
+}
+
+void BaseInstance::setLinkedInstances(const QStringList& list)
+{
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
+ m_settings->set("linkedInstances", list);
+}
+
+void BaseInstance::addLinkedInstanceId(const QString& id)
+{
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
+ linkedInstances.append(id);
+ setLinkedInstances(linkedInstances);
+}
+
+bool BaseInstance::removeLinkedInstanceId(const QString& id)
+{
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
+ int numRemoved = linkedInstances.removeAll(id);
+ setLinkedInstances(linkedInstances);
+ return numRemoved > 0;
+}
+
+bool BaseInstance::isLinkedToInstanceId(const QString& id) const
+{
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
+ return linkedInstances.contains(id);
+}
+
void BaseInstance::iconUpdated(QString key)
{
if(iconKey() == key)