From d66fdcd4cc6913508d2987c14cd9fc4d6760b8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 3 Oct 2016 00:55:54 +0200 Subject: NOISSUE Granular instance reload --- api/logic/BaseInstance.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'api/logic/BaseInstance.cpp') 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 #include +#include #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 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; +} -- cgit v1.2.3