summaryrefslogtreecommitdiffstats
path: root/api/logic/BaseInstance.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-10-03 00:55:54 +0200
committerPetr Mrázek <peterix@gmail.com>2016-10-26 18:21:24 +0200
commitd66fdcd4cc6913508d2987c14cd9fc4d6760b8a5 (patch)
tree4f385106ce732d4f7338feab5391f2a06c68a0e6 /api/logic/BaseInstance.cpp
parentbbe139dce51a7965394c800cac974946820d3869 (diff)
downloadMultiMC-d66fdcd4cc6913508d2987c14cd9fc4d6760b8a5.tar
MultiMC-d66fdcd4cc6913508d2987c14cd9fc4d6760b8a5.tar.gz
MultiMC-d66fdcd4cc6913508d2987c14cd9fc4d6760b8a5.tar.lz
MultiMC-d66fdcd4cc6913508d2987c14cd9fc4d6760b8a5.tar.xz
MultiMC-d66fdcd4cc6913508d2987c14cd9fc4d6760b8a5.zip
NOISSUE Granular instance reload
Diffstat (limited to 'api/logic/BaseInstance.cpp')
-rw-r--r--api/logic/BaseInstance.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/api/logic/BaseInstance.cpp b/api/logic/BaseInstance.cpp
index 9dee2c38..452e657a 100644
--- a/api/logic/BaseInstance.cpp
+++ b/api/logic/BaseInstance.cpp
@@ -17,6 +17,7 @@
#include <QFileInfo>
#include <QDir>
+#include <QDebug>
#include "settings/INISettingsObject.h"
#include "settings/Setting.h"
@@ -74,10 +75,32 @@ void BaseInstance::iconUpdated(QString key)
}
}
+void BaseInstance::invalidate()
+{
+ changeStatus(Status::Gone);
+ qDebug() << "Instance" << id() << "has been invalidated.";
+}
+
void BaseInstance::nuke()
{
+ changeStatus(Status::Gone);
+ qDebug() << "Instance" << id() << "has been deleted by MultiMC.";
FS::deletePath(instanceRoot());
- emit nuked(this);
+}
+
+void BaseInstance::changeStatus(BaseInstance::Status newStatus)
+{
+ Status status = currentStatus();
+ if(status != newStatus)
+ {
+ m_status = newStatus;
+ emit statusChanged(status, newStatus);
+ }
+}
+
+BaseInstance::Status BaseInstance::currentStatus() const
+{
+ return m_status;
}
QString BaseInstance::id() const
@@ -278,3 +301,19 @@ std::shared_ptr<LaunchTask> BaseInstance::getLaunchTask()
{
return m_launchProcess;
}
+
+void BaseInstance::setProvider(BaseInstanceProvider* provider)
+{
+ // only once.
+ assert(!m_provider);
+ if(m_provider)
+ {
+ qWarning() << "Provider set more than once for instance" << id();
+ }
+ m_provider = provider;
+}
+
+BaseInstanceProvider* BaseInstance::provider() const
+{
+ return m_provider;
+}