Small fixes, including release dates of some legacy versions

This commit is contained in:
Petr Mrázek 2014-05-11 19:13:21 +02:00
parent e993adaf44
commit 68ef451be5
7 changed files with 64 additions and 22 deletions

View File

@ -30,15 +30,6 @@ class URNResolver;
#endif #endif
#define MMC (static_cast<MultiMC *>(QCoreApplication::instance())) #define MMC (static_cast<MultiMC *>(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 enum UpdateFlag
{ {
None = 0x0, None = 0x0,

View File

@ -116,6 +116,7 @@
<addaction name="actionScreenshots"/> <addaction name="actionScreenshots"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionEditInstance"/> <addaction name="actionEditInstance"/>
<addaction name="actionInstance_Settings"/>
<addaction name="actionViewSelectedInstFolder"/> <addaction name="actionViewSelectedInstFolder"/>
<addaction name="actionConfig_Folder"/> <addaction name="actionConfig_Folder"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -488,6 +489,14 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;View and upload screenshots for this instance&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;View and upload screenshots for this instance&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</action> </action>
<action name="actionInstance_Settings">
<property name="text">
<string>Instance Settings</string>
</property>
<property name="toolTip">
<string>Change the settings specific to the instance</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>

View File

@ -38,6 +38,15 @@
#include <QMessageBox> #include <QMessageBox>
#include <QDir> #include <QDir>
// 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) SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this); MultiMCPlatform::fixWM_CLASS(this);

View File

@ -20,14 +20,26 @@ QString MinecraftVersion::name()
QString MinecraftVersion::typeString() const QString MinecraftVersion::typeString() const
{ {
if (is_snapshot) if(m_type == "snapshot")
{ {
return QObject::tr("Snapshot"); return QObject::tr("Snapshot");
} }
else else if (m_type == "release")
{ {
return QObject::tr("Regular 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() bool MinecraftVersion::hasJarMods()

View File

@ -61,9 +61,6 @@ public: /* data */
/// The URL that this version will be downloaded from. maybe. /// The URL that this version will be downloaded from. maybe.
QString download_url; QString download_url;
/// is this a snapshot?
bool is_snapshot = false;
VersionSource m_versionSource = Builtin; VersionSource m_versionSource = Builtin;
/// the human readable version name /// the human readable version name

View File

@ -154,6 +154,7 @@ void MinecraftVersionList::loadBuiltinList()
"http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + versionID + "/"; "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + versionID + "/";
mcVersion->m_versionSource = Builtin; mcVersion->m_versionSource = Builtin;
mcVersion->m_type = versionTypeStr;
mcVersion->m_appletClass = versionObj.value("appletClass").toString(""); mcVersion->m_appletClass = versionObj.value("appletClass").toString("");
mcVersion->m_mainClass = versionObj.value("mainClass").toString(""); mcVersion->m_mainClass = versionObj.value("mainClass").toString("");
mcVersion->m_processArguments = versionObj.value("processArguments").toString("legacy"); mcVersion->m_processArguments = versionObj.value("processArguments").toString("legacy");
@ -293,10 +294,13 @@ void MinecraftVersionList::loadMojangList(QByteArray data, VersionSource source)
continue; continue;
} }
mcVersion->m_type = versionTypeStr; mcVersion->m_type = versionTypeStr;
mcVersion->is_snapshot = is_snapshot;
tempList.append(mcVersion); tempList.append(mcVersion);
} }
updateListData(tempList); updateListData(tempList);
if(source == Remote)
{
m_loaded = true;
}
} }
void MinecraftVersionList::sort() void MinecraftVersionList::sort()
@ -322,6 +326,7 @@ void MinecraftVersionList::updateListData(QList<BaseVersionPtr> versions)
if (!m_lookup.contains(descr)) if (!m_lookup.contains(descr))
{ {
m_lookup[version->descriptor()] = version;
m_vlist.append(version); m_vlist.append(version);
continue; continue;
} }
@ -343,7 +348,6 @@ void MinecraftVersionList::updateListData(QList<BaseVersionPtr> versions)
// alright, it's an update. put it inside the original, for further processing. // alright, it's an update. put it inside the original, for further processing.
orig->upstreamUpdate = added; orig->upstreamUpdate = added;
} }
m_loaded = true;
sortInternal(); sortInternal();
endResetModel(); endResetModel();
} }
@ -528,6 +532,26 @@ void MinecraftVersionList::saveCachedList()
entriesArr.append(entryObj); entriesArr.append(entryObj);
} }
toplevel.insert("versions", entriesArr); 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); QJsonDocument doc(toplevel);
QByteArray jsonData = doc.toJson(); QByteArray jsonData = doc.toJson();
qint64 result = tfile.write(jsonData); qint64 result = tfile.write(jsonData);

View File

@ -37,42 +37,42 @@
}, },
{ {
"id": "1.4.5", "id": "1.4.5",
"releaseTime": "2012-12-20T00:00:00+02:00", "releaseTime": "2012-11-20T00:00:00+02:00",
"type": "release", "type": "release",
"processArguments": "legacy", "processArguments": "legacy",
"+traits": ["legacyLaunch"] "+traits": ["legacyLaunch"]
}, },
{ {
"id": "1.4.4", "id": "1.4.4",
"releaseTime": "2012-12-14T00:00:00+02:00", "releaseTime": "2012-11-14T00:00:00+02:00",
"type": "release", "type": "release",
"processArguments": "legacy", "processArguments": "legacy",
"+traits": ["legacyLaunch"] "+traits": ["legacyLaunch"]
}, },
{ {
"id": "1.4.3", "id": "1.4.3",
"releaseTime": "2012-12-01T00:00:00+02:00", "releaseTime": "2012-11-01T00:00:00+02:00",
"type": "snapshot", "type": "snapshot",
"processArguments": "legacy", "processArguments": "legacy",
"+traits": ["legacyLaunch"] "+traits": ["legacyLaunch"]
}, },
{ {
"id": "1.4.2", "id": "1.4.2",
"releaseTime": "2012-11-25T00:00:00+02:00", "releaseTime": "2012-10-25T00:00:00+02:00",
"type": "release", "type": "release",
"processArguments": "legacy", "processArguments": "legacy",
"+traits": ["legacyLaunch"] "+traits": ["legacyLaunch"]
}, },
{ {
"id": "1.4.1", "id": "1.4.1",
"releaseTime": "2012-11-23T00:00:00+02:00", "releaseTime": "2012-10-23T00:00:00+02:00",
"type": "snapshot", "type": "snapshot",
"processArguments": "legacy", "processArguments": "legacy",
"+traits": ["legacyLaunch"] "+traits": ["legacyLaunch"]
}, },
{ {
"id": "1.4", "id": "1.4",
"releaseTime": "2012-11-19T00:00:00+02:00", "releaseTime": "2012-10-19T00:00:00+02:00",
"type": "snapshot", "type": "snapshot",
"processArguments": "legacy", "processArguments": "legacy",
"+traits": ["legacyLaunch"] "+traits": ["legacyLaunch"]