From 68ef451be5a0b8724381187f5aa123d87b82e222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 11 May 2014 19:13:21 +0200 Subject: Small fixes, including release dates of some legacy versions --- MultiMC.h | 9 --------- gui/MainWindow.ui | 9 +++++++++ gui/dialogs/SettingsDialog.cpp | 9 +++++++++ logic/minecraft/MinecraftVersion.cpp | 16 ++++++++++++++-- logic/minecraft/MinecraftVersion.h | 3 --- logic/minecraft/MinecraftVersionList.cpp | 28 ++++++++++++++++++++++++++-- resources/versions/minecraft.json | 12 ++++++------ 7 files changed, 64 insertions(+), 22 deletions(-) diff --git a/MultiMC.h b/MultiMC.h index a80a54c6..ce3f9238 100644 --- a/MultiMC.h +++ b/MultiMC.h @@ -30,15 +30,6 @@ class URNResolver; #endif #define MMC (static_cast(QCoreApplication::instance())) -// FIXME: possibly move elsewhere -enum InstSortMode -{ - // Sort alphabetically by name. - Sort_Name, - // Sort by which instance was launched most recently. - Sort_LastLaunch -}; - enum UpdateFlag { None = 0x0, diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui index 8ee196fd..188433e9 100644 --- a/gui/MainWindow.ui +++ b/gui/MainWindow.ui @@ -116,6 +116,7 @@ + @@ -488,6 +489,14 @@ <html><head/><body><p>View and upload screenshots for this instance</p></body></html> + + + Instance Settings + + + Change the settings specific to the instance + + diff --git a/gui/dialogs/SettingsDialog.cpp b/gui/dialogs/SettingsDialog.cpp index 4c69c785..f7333055 100644 --- a/gui/dialogs/SettingsDialog.cpp +++ b/gui/dialogs/SettingsDialog.cpp @@ -38,6 +38,15 @@ #include #include +// FIXME: possibly move elsewhere +enum InstSortMode +{ + // Sort alphabetically by name. + Sort_Name, + // Sort by which instance was launched most recently. + Sort_LastLaunch +}; + SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { MultiMCPlatform::fixWM_CLASS(this); diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp index e0cbce8d..b66b9768 100644 --- a/logic/minecraft/MinecraftVersion.cpp +++ b/logic/minecraft/MinecraftVersion.cpp @@ -20,14 +20,26 @@ QString MinecraftVersion::name() QString MinecraftVersion::typeString() const { - if (is_snapshot) + if(m_type == "snapshot") { return QObject::tr("Snapshot"); } - else + else if (m_type == "release") { return QObject::tr("Regular release"); } + else if (m_type == "old_alpha") + { + return QObject::tr("Alpha"); + } + else if (m_type == "old_beta") + { + return QObject::tr("Beta"); + } + else + { + return QString(); + } } bool MinecraftVersion::hasJarMods() diff --git a/logic/minecraft/MinecraftVersion.h b/logic/minecraft/MinecraftVersion.h index 02afd709..422b4cea 100644 --- a/logic/minecraft/MinecraftVersion.h +++ b/logic/minecraft/MinecraftVersion.h @@ -61,9 +61,6 @@ public: /* data */ /// The URL that this version will be downloaded from. maybe. QString download_url; - /// is this a snapshot? - bool is_snapshot = false; - VersionSource m_versionSource = Builtin; /// the human readable version name diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp index 26a17c73..e012330e 100644 --- a/logic/minecraft/MinecraftVersionList.cpp +++ b/logic/minecraft/MinecraftVersionList.cpp @@ -154,6 +154,7 @@ void MinecraftVersionList::loadBuiltinList() "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + versionID + "/"; mcVersion->m_versionSource = Builtin; + mcVersion->m_type = versionTypeStr; mcVersion->m_appletClass = versionObj.value("appletClass").toString(""); mcVersion->m_mainClass = versionObj.value("mainClass").toString(""); mcVersion->m_processArguments = versionObj.value("processArguments").toString("legacy"); @@ -293,10 +294,13 @@ void MinecraftVersionList::loadMojangList(QByteArray data, VersionSource source) continue; } mcVersion->m_type = versionTypeStr; - mcVersion->is_snapshot = is_snapshot; tempList.append(mcVersion); } updateListData(tempList); + if(source == Remote) + { + m_loaded = true; + } } void MinecraftVersionList::sort() @@ -322,6 +326,7 @@ void MinecraftVersionList::updateListData(QList versions) if (!m_lookup.contains(descr)) { + m_lookup[version->descriptor()] = version; m_vlist.append(version); continue; } @@ -343,7 +348,6 @@ void MinecraftVersionList::updateListData(QList versions) // alright, it's an update. put it inside the original, for further processing. orig->upstreamUpdate = added; } - m_loaded = true; sortInternal(); endResetModel(); } @@ -528,6 +532,26 @@ void MinecraftVersionList::saveCachedList() entriesArr.append(entryObj); } toplevel.insert("versions", entriesArr); + + { + bool someLatest = false; + QJsonObject latestObj; + if(!m_latestReleaseID.isNull()) + { + latestObj.insert("release", m_latestReleaseID); + someLatest = true; + } + if(!m_latestSnapshotID.isNull()) + { + latestObj.insert("snapshot", m_latestSnapshotID); + someLatest = true; + } + if(someLatest) + { + toplevel.insert("latest", latestObj); + } + } + QJsonDocument doc(toplevel); QByteArray jsonData = doc.toJson(); qint64 result = tfile.write(jsonData); diff --git a/resources/versions/minecraft.json b/resources/versions/minecraft.json index d5739cb5..1c6928c6 100644 --- a/resources/versions/minecraft.json +++ b/resources/versions/minecraft.json @@ -37,42 +37,42 @@ }, { "id": "1.4.5", - "releaseTime": "2012-12-20T00:00:00+02:00", + "releaseTime": "2012-11-20T00:00:00+02:00", "type": "release", "processArguments": "legacy", "+traits": ["legacyLaunch"] }, { "id": "1.4.4", - "releaseTime": "2012-12-14T00:00:00+02:00", + "releaseTime": "2012-11-14T00:00:00+02:00", "type": "release", "processArguments": "legacy", "+traits": ["legacyLaunch"] }, { "id": "1.4.3", - "releaseTime": "2012-12-01T00:00:00+02:00", + "releaseTime": "2012-11-01T00:00:00+02:00", "type": "snapshot", "processArguments": "legacy", "+traits": ["legacyLaunch"] }, { "id": "1.4.2", - "releaseTime": "2012-11-25T00:00:00+02:00", + "releaseTime": "2012-10-25T00:00:00+02:00", "type": "release", "processArguments": "legacy", "+traits": ["legacyLaunch"] }, { "id": "1.4.1", - "releaseTime": "2012-11-23T00:00:00+02:00", + "releaseTime": "2012-10-23T00:00:00+02:00", "type": "snapshot", "processArguments": "legacy", "+traits": ["legacyLaunch"] }, { "id": "1.4", - "releaseTime": "2012-11-19T00:00:00+02:00", + "releaseTime": "2012-10-19T00:00:00+02:00", "type": "snapshot", "processArguments": "legacy", "+traits": ["legacyLaunch"] -- cgit v1.2.3