summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/logic/BaseInstance.cpp37
-rw-r--r--api/logic/BaseInstance.h57
-rw-r--r--api/logic/NullInstance.h2
-rw-r--r--api/logic/launch/LaunchTask.cpp2
-rw-r--r--api/logic/minecraft/MinecraftInstance.cpp8
-rw-r--r--api/logic/minecraft/onesix/OneSixInstance.cpp10
-rw-r--r--api/logic/minecraft/onesix/update/LibrariesTask.cpp2
-rw-r--r--application/groupview/InstanceDelegate.cpp17
-rw-r--r--application/resources/instances/instances.qrc1
-rw-r--r--application/resources/instances/status-bad.pngbin0 -> 1102 bytes
10 files changed, 63 insertions, 73 deletions
diff --git a/api/logic/BaseInstance.cpp b/api/logic/BaseInstance.cpp
index b499c106..b7a7f9fd 100644
--- a/api/logic/BaseInstance.cpp
+++ b/api/logic/BaseInstance.cpp
@@ -172,44 +172,9 @@ SettingsObjectPtr BaseInstance::settings() const
return m_settings;
}
-BaseInstance::InstanceFlags BaseInstance::flags() const
-{
- return m_flags;
-}
-
-void BaseInstance::setFlags(const InstanceFlags &flags)
-{
- if (flags != m_flags)
- {
- m_flags = flags;
- emit flagsChanged();
- emit propertiesChanged(this);
- }
-}
-
-void BaseInstance::setFlag(const BaseInstance::InstanceFlag flag)
-{
- // nothing to set?
- if(flag & m_flags)
- return;
- m_flags |= flag;
- emit flagsChanged();
- emit propertiesChanged(this);
-}
-
-void BaseInstance::unsetFlag(const BaseInstance::InstanceFlag flag)
-{
- // nothing to unset?
- if(!(flag & m_flags))
- return;
- m_flags &= ~flag;
- emit flagsChanged();
- emit propertiesChanged(this);
-}
-
bool BaseInstance::canLaunch() const
{
- return (!(flags() & VersionBrokenFlag)) && (!isRunning());
+ return (!hasVersionBroken() && !isRunning());
}
bool BaseInstance::reload()
diff --git a/api/logic/BaseInstance.h b/api/logic/BaseInstance.h
index 669bad79..147dd703 100644
--- a/api/logic/BaseInstance.h
+++ b/api/logic/BaseInstance.h
@@ -218,16 +218,44 @@ public:
virtual QString typeName() const = 0;
- enum InstanceFlag
+ bool hasVersionBroken() const
{
- VersionBrokenFlag = 0x01,
- UpdateAvailable = 0x02
- };
- Q_DECLARE_FLAGS(InstanceFlags, InstanceFlag)
- InstanceFlags flags() const;
- void setFlags(const InstanceFlags &flags);
- void setFlag(const InstanceFlag flag);
- void unsetFlag(const InstanceFlag flag);
+ return m_hasBrokenVersion;
+ }
+ void setVersionBroken(bool value)
+ {
+ if(m_hasBrokenVersion != value)
+ {
+ m_hasBrokenVersion = value;
+ emit propertiesChanged(this);
+ }
+ }
+
+ bool hasUpdateAvailable() const
+ {
+ return m_hasUpdate;
+ }
+ void setUpdateAvailable(bool value)
+ {
+ if(m_hasUpdate != value)
+ {
+ m_hasUpdate = value;
+ emit propertiesChanged(this);
+ }
+ }
+
+ bool hasCrashed() const
+ {
+ return m_crashed;
+ }
+ void setCrashed(bool value)
+ {
+ if(m_crashed != value)
+ {
+ m_crashed = value;
+ emit propertiesChanged(this);
+ }
+ }
bool canLaunch() const;
virtual bool canExport() const = 0;
@@ -254,8 +282,6 @@ signals:
*/
void groupChanged();
- void flagsChanged();
-
void launchTaskChanged(std::shared_ptr<LaunchTask>);
void runningStatusChanged(bool running);
@@ -269,7 +295,7 @@ protected: /* data */
QString m_rootDir;
QString m_group;
SettingsObjectPtr m_settings;
- InstanceFlags m_flags;
+ // InstanceFlags m_flags;
bool m_isRunning = false;
std::shared_ptr<LaunchTask> m_launchProcess;
QDateTime m_timeStarted;
@@ -277,8 +303,11 @@ protected: /* data */
private: /* data */
Status m_status = Status::Present;
+ bool m_crashed = false;
+ bool m_hasUpdate = false;
+ bool m_hasBrokenVersion = false;
};
Q_DECLARE_METATYPE(std::shared_ptr<BaseInstance>)
-Q_DECLARE_METATYPE(BaseInstance::InstanceFlag)
-Q_DECLARE_OPERATORS_FOR_FLAGS(BaseInstance::InstanceFlags)
+//Q_DECLARE_METATYPE(BaseInstance::InstanceFlag)
+//Q_DECLARE_OPERATORS_FOR_FLAGS(BaseInstance::InstanceFlags)
diff --git a/api/logic/NullInstance.h b/api/logic/NullInstance.h
index 4fb31854..5323d135 100644
--- a/api/logic/NullInstance.h
+++ b/api/logic/NullInstance.h
@@ -7,7 +7,7 @@ public:
NullInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString& rootDir)
:BaseInstance(globalSettings, settings, rootDir)
{
- setFlag(BaseInstance::VersionBrokenFlag);
+ setVersionBroken(true);
}
virtual ~NullInstance() {};
virtual bool setIntendedVersionId(QString) override
diff --git a/api/logic/launch/LaunchTask.cpp b/api/logic/launch/LaunchTask.cpp
index 9c09caf4..a006e519 100644
--- a/api/logic/launch/LaunchTask.cpp
+++ b/api/logic/launch/LaunchTask.cpp
@@ -56,6 +56,7 @@ void LaunchTask::prependStep(std::shared_ptr<LaunchStep> step)
void LaunchTask::executeTask()
{
+ m_instance->setCrashed(false);
if(!m_steps.size())
{
state = LaunchTask::Finished;
@@ -217,6 +218,7 @@ void LaunchTask::emitFailed(QString reason)
{
m_instance->cleanupAfterRun();
m_instance->setRunning(false);
+ m_instance->setCrashed(true);
Task::emitFailed(reason);
}
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp
index d3af5011..f0d47733 100644
--- a/api/logic/minecraft/MinecraftInstance.cpp
+++ b/api/logic/minecraft/MinecraftInstance.cpp
@@ -369,7 +369,7 @@ QString MinecraftInstance::prettifyTimeDuration(int64_t duration)
QString MinecraftInstance::getStatusbarDescription()
{
QStringList traits;
- if (flags() & VersionBrokenFlag)
+ if (hasVersionBroken())
{
traits.append(tr("broken"));
}
@@ -380,12 +380,10 @@ QString MinecraftInstance::getStatusbarDescription()
{
description.append(tr(", played for %1").arg(prettifyTimeDuration(totalTimePlayed())));
}
- /*
- if(traits.size())
+ if(hasCrashed())
{
- description.append(QString(" (%1)").arg(traits.join(", ")));
+ description.append(tr(", has crashed."));
}
- */
return description;
}
diff --git a/api/logic/minecraft/onesix/OneSixInstance.cpp b/api/logic/minecraft/onesix/OneSixInstance.cpp
index d89a7612..859e2e69 100644
--- a/api/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/api/logic/minecraft/onesix/OneSixInstance.cpp
@@ -526,15 +526,7 @@ QString OneSixInstance::currentVersionId() const
void OneSixInstance::reloadProfile()
{
m_profile->reload();
- auto severity = m_profile->getProblemSeverity();
- if(severity == ProblemSeverity::PROBLEM_ERROR)
- {
- setFlag(VersionBrokenFlag);
- }
- else
- {
- unsetFlag(VersionBrokenFlag);
- }
+ setVersionBroken(m_profile->getProblemSeverity() == ProblemSeverity::PROBLEM_ERROR);
emit versionReloaded();
}
diff --git a/api/logic/minecraft/onesix/update/LibrariesTask.cpp b/api/logic/minecraft/onesix/update/LibrariesTask.cpp
index 1efbc64c..f60c2b5e 100644
--- a/api/logic/minecraft/onesix/update/LibrariesTask.cpp
+++ b/api/logic/minecraft/onesix/update/LibrariesTask.cpp
@@ -13,7 +13,7 @@ void LibrariesTask::executeTask()
qDebug() << m_inst->name() << ": downloading libraries";
OneSixInstance *inst = (OneSixInstance *)m_inst;
inst->reloadProfile();
- if(inst->flags() & BaseInstance::VersionBrokenFlag)
+ if(inst->hasVersionBroken())
{
emitFailed(tr("Failed to load the version description files - check the instance for errors."));
return;
diff --git a/application/groupview/InstanceDelegate.cpp b/application/groupview/InstanceDelegate.cpp
index 359dd3cf..b88f9a8a 100644
--- a/application/groupview/InstanceDelegate.cpp
+++ b/application/groupview/InstanceDelegate.cpp
@@ -113,18 +113,21 @@ void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItemV4 &option
void drawBadges(QPainter *painter, const QStyleOptionViewItemV4 &option, BaseInstance *instance)
{
QList<QString> pixmaps;
- const BaseInstance::InstanceFlags flags = instance->flags();
- if (flags & BaseInstance::VersionBrokenFlag)
+ if (instance->isRunning())
{
- pixmaps.append("broken");
+ pixmaps.append("status-running");
}
- if (flags & BaseInstance::UpdateAvailable)
+ else if (instance->hasCrashed())
{
- pixmaps.append("updateavailable");
+ pixmaps.append("status-bad");
}
- if (instance->isRunning())
+ if (instance->hasVersionBroken())
{
- pixmaps.append("status-running");
+ pixmaps.append("broken");
+ }
+ if (instance->hasUpdateAvailable())
+ {
+ pixmaps.append("updateavailable");
}
// begin easter eggs
diff --git a/application/resources/instances/instances.qrc b/application/resources/instances/instances.qrc
index b1f1bb4d..1f90762a 100644
--- a/application/resources/instances/instances.qrc
+++ b/application/resources/instances/instances.qrc
@@ -38,6 +38,7 @@
<file>herobrine.png</file>
<file>derp.png</file>
<file>status-running.png</file>
+ <file>status-bad.png</file>
<!-- Update. GPLv2, https://code.google.com/p/gnome-colors/ -->
<file>updateavailable.png</file>
diff --git a/application/resources/instances/status-bad.png b/application/resources/instances/status-bad.png
new file mode 100644
index 00000000..d1547a47
--- /dev/null
+++ b/application/resources/instances/status-bad.png
Binary files differ