summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/MainWindow.cpp3
-rw-r--r--logic/BaseInstance.cpp23
-rw-r--r--logic/BaseInstance.h15
-rw-r--r--logic/BaseInstance_p.h3
-rw-r--r--logic/LegacyFTBInstance.cpp4
-rw-r--r--logic/LegacyInstance.cpp10
-rw-r--r--logic/NostalgiaInstance.cpp4
-rw-r--r--logic/OneSixFTBInstance.cpp4
-rw-r--r--logic/OneSixInstance.cpp15
-rw-r--r--logic/OneSixVersionBuilder.cpp8
10 files changed, 81 insertions, 8 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index 29f7c8e8..a4c04d89 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -354,6 +354,7 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
QMenu myMenu;
myMenu.addActions(actions);
+ myMenu.setEnabled(m_selectedInstance->canLaunch());
myMenu.exec(view->mapToGlobal(pos));
}
@@ -1366,7 +1367,7 @@ void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &
(BaseInstance *)current.data(InstanceList::InstancePointerRole)
.value<void *>()))
{
- ui->instanceToolBar->setEnabled(true);
+ ui->instanceToolBar->setEnabled(m_selectedInstance->canLaunch());
renameButton->setText(m_selectedInstance->name());
ui->actionChangeInstLWJGLVersion->setEnabled(
m_selectedInstance->menuActionEnabled("actionChangeInstLWJGLVersion"));
diff --git a/logic/BaseInstance.cpp b/logic/BaseInstance.cpp
index 222004a3..d78f1ea0 100644
--- a/logic/BaseInstance.cpp
+++ b/logic/BaseInstance.cpp
@@ -37,6 +37,7 @@ BaseInstance::BaseInstance(BaseInstancePrivate *d_in, const QString &rootDir,
I_D(BaseInstance);
d->m_settings = settings_obj;
d->m_rootDir = rootDir;
+ d->m_flags = 0;
settings().registerSetting("name", "Unnamed Instance");
settings().registerSetting("iconKey", "default");
@@ -146,6 +147,28 @@ SettingsObject &BaseInstance::settings() const
return *d->m_settings;
}
+BaseInstance::InstanceFlags BaseInstance::flags() const
+{
+ I_D(const BaseInstance);
+ return InstanceFlags(d->m_flags);
+}
+
+void BaseInstance::setFlags(const BaseInstance::InstanceFlags flags)
+{
+ I_D(BaseInstance);
+ if (flags != d->m_flags)
+ {
+ d->m_flags = flags;
+ emit flagsChanged();
+ emit propertiesChanged(this);
+ }
+}
+
+bool BaseInstance::canLaunch() const
+{
+ return !(flags() & VersionBrokenFlag);
+}
+
QString BaseInstance::baseJar() const
{
I_D(BaseInstance);
diff --git a/logic/BaseInstance.h b/logic/BaseInstance.h
index cd49f99b..91b83bfc 100644
--- a/logic/BaseInstance.h
+++ b/logic/BaseInstance.h
@@ -175,6 +175,17 @@ public:
/// FIXME: this really should be elsewhere...
virtual QString instanceConfigFolder() const = 0;
+ enum InstanceFlag
+ {
+ NoFlags = 0x00,
+ VersionBrokenFlag = 0x01
+ };
+ Q_DECLARE_FLAGS(InstanceFlags, InstanceFlag)
+ InstanceFlags flags() const;
+ void setFlags(const BaseInstance::InstanceFlags flags);
+
+ bool canLaunch() const;
+
signals:
/*!
* \brief Signal emitted when properties relevant to the instance view change
@@ -189,6 +200,8 @@ signals:
*/
void nuked(BaseInstance *inst);
+ void flagsChanged();
+
protected slots:
void iconUpdated(QString key);
@@ -198,3 +211,5 @@ protected:
// pointer for lazy people
typedef std::shared_ptr<BaseInstance> InstancePtr;
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(BaseInstance::InstanceFlags)
diff --git a/logic/BaseInstance_p.h b/logic/BaseInstance_p.h
index 06581a34..73eebec7 100644
--- a/logic/BaseInstance_p.h
+++ b/logic/BaseInstance_p.h
@@ -26,4 +26,5 @@ struct BaseInstancePrivate
QString m_rootDir;
QString m_group;
SettingsObject *m_settings;
-}; \ No newline at end of file
+ int m_flags;
+};
diff --git a/logic/LegacyFTBInstance.cpp b/logic/LegacyFTBInstance.cpp
index 6c6bd10b..23cb259d 100644
--- a/logic/LegacyFTBInstance.cpp
+++ b/logic/LegacyFTBInstance.cpp
@@ -7,6 +7,10 @@ LegacyFTBInstance::LegacyFTBInstance(const QString &rootDir, SettingsObject *set
QString LegacyFTBInstance::getStatusbarDescription()
{
+ if (flags() & VersionBrokenFlag)
+ {
+ return "Legacy FTB: " + intendedVersionId() + " (broken)";
+ }
return "Legacy FTB: " + intendedVersionId();
}
diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp
index a9f0d112..f58f0e76 100644
--- a/logic/LegacyInstance.cpp
+++ b/logic/LegacyInstance.cpp
@@ -268,13 +268,23 @@ QString LegacyInstance::defaultCustomBaseJar() const
bool LegacyInstance::menuActionEnabled(QString action_name) const
{
+ if (flags() & VersionBrokenFlag)
+ {
+ return false;
+ }
if (action_name == "actionChangeInstMCVersion")
+ {
return false;
+ }
return true;
}
QString LegacyInstance::getStatusbarDescription()
{
+ if (flags() & VersionBrokenFlag)
+ {
+ return "Legacy : " + intendedVersionId() + " (broken)";
+ }
if (shouldUpdate())
return "Legacy : " + currentVersionId() + " -> " + intendedVersionId();
else
diff --git a/logic/NostalgiaInstance.cpp b/logic/NostalgiaInstance.cpp
index 2e23ee71..96ce4cc7 100644
--- a/logic/NostalgiaInstance.cpp
+++ b/logic/NostalgiaInstance.cpp
@@ -23,6 +23,10 @@ NostalgiaInstance::NostalgiaInstance(const QString &rootDir, SettingsObject *set
QString NostalgiaInstance::getStatusbarDescription()
{
+ if (flags() & VersionBrokenFlag)
+ {
+ return "Nostalgia : " + intendedVersionId() + " (broken)";
+ }
return "Nostalgia : " + intendedVersionId();
}
diff --git a/logic/OneSixFTBInstance.cpp b/logic/OneSixFTBInstance.cpp
index ca88142a..dfd57046 100644
--- a/logic/OneSixFTBInstance.cpp
+++ b/logic/OneSixFTBInstance.cpp
@@ -97,6 +97,10 @@ QString OneSixFTBInstance::id() const
QString OneSixFTBInstance::getStatusbarDescription()
{
+ if (flags() & VersionBrokenFlag)
+ {
+ return "OneSix FTB: " + intendedVersionId() + " (broken)";
+ }
return "OneSix FTB: " + intendedVersionId();
}
bool OneSixFTBInstance::menuActionEnabled(QString action_name) const
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp
index 048e635c..b85a593c 100644
--- a/logic/OneSixInstance.cpp
+++ b/logic/OneSixInstance.cpp
@@ -325,11 +325,12 @@ bool OneSixInstance::reloadVersion(QWidget *widgetParent)
}
if (ret)
{
+ setFlags(flags() & ~VersionBrokenFlag);
emit versionReloaded();
}
else
{
- nuke();
+ setFlags(flags() | VersionBrokenFlag);
}
return ret;
}
@@ -366,8 +367,14 @@ QString OneSixInstance::defaultCustomBaseJar() const
bool OneSixInstance::menuActionEnabled(QString action_name) const
{
+ if (flags() & VersionBrokenFlag)
+ {
+ return false;
+ }
if (action_name == "actionChangeInstLWJGLVersion")
+ {
return false;
+ }
return true;
}
@@ -376,7 +383,11 @@ QString OneSixInstance::getStatusbarDescription()
QString descr = "OneSix : " + intendedVersionId();
if (versionIsCustom())
{
- descr + " (custom)";
+ descr += " (custom)";
+ }
+ if (flags() & VersionBrokenFlag)
+ {
+ descr += " (broken)";
}
return descr;
}
diff --git a/logic/OneSixVersionBuilder.cpp b/logic/OneSixVersionBuilder.cpp
index 932374f9..a4bac80a 100644
--- a/logic/OneSixVersionBuilder.cpp
+++ b/logic/OneSixVersionBuilder.cpp
@@ -846,7 +846,7 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
{
QMessageBox::critical(
m_widgetParent, QObject::tr("Error"),
- QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
+ QObject::tr("The version descriptors of this instance are not compatible with the current version of MultiMC"));
return false;
}
}
@@ -880,7 +880,7 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
{
QMessageBox::critical(
m_widgetParent, QObject::tr("Error"),
- QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
+ QObject::tr("The version descriptors of this instance are not compatible with the current version of MultiMC"));
return false;
}
}
@@ -931,7 +931,7 @@ bool OneSixVersionBuilder::build(const bool onlyVanilla)
{
QMessageBox::critical(
m_widgetParent, QObject::tr("Error"),
- QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
+ QObject::tr("The version descriptors of this instance are not compatible with the current version of MultiMC"));
return false;
}
}
@@ -1024,7 +1024,7 @@ bool OneSixVersionBuilder::read(const QJsonObject &obj)
{
QMessageBox::critical(
m_widgetParent, QObject::tr("Error"),
- QObject::tr("The version descriptors of this instance are now compatible with the current version of MultiMC"));
+ QObject::tr("The version descriptors of this instance are not compatible with the current version of MultiMC"));
return false;
}