Implemented version lists.

Further work on this is still needed. Currently there is no sorting or filtering of any kind. In addition,
changes need to be made to fix issues with bad ETags since the current system here is based on MultiMC 4's
version list system before it was fixed.
This commit is contained in:
Andrew
2013-03-28 11:33:31 -05:00
parent ad70e3fd4c
commit 168ed3e8e5
12 changed files with 352 additions and 12 deletions

View File

@ -63,10 +63,10 @@ QString StdInstVersion::name() const
return m_name;
}
QString StdInstVersion::type() const
QString StdInstVersion::typeName() const
{
if (m_linkedVersion)
return m_linkedVersion->type();
return m_linkedVersion->typeName();
switch (versionType())
{

View File

@ -55,14 +55,14 @@ public:
virtual QString descriptor() const;
virtual QString name() const;
virtual QString type() const;
virtual QString typeName() const;
virtual qint64 timestamp() const;
virtual QString downloadURL() const;
virtual bool hasLWJGL() const;
virtual QString etag() const;
virtual VersionType versionType() const;
virtual void setVersionType(VersionType type);
virtual void setVersionType(VersionType typeName);
virtual bool isMeta() const;

View File

@ -45,7 +45,7 @@
#define MCN_URLBASE "http://sonicrules.org/mcnweb.py"
// When this is defined, prints the entire version list to qDebug() after loading.
#define PRINT_VERSIONS
//#define PRINT_VERSIONS
StdInstVersionList vList;
@ -90,7 +90,7 @@ void StdInstVersionList::printToStdOut()
qDebug() << "Version " << version->name();
qDebug() << "\tDownload: " << version->downloadURL();
qDebug() << "\tTimestamp: " << version->timestamp();
qDebug() << "\tType: " << version->type();
qDebug() << "\tType: " << version->typeName();
qDebug() << "----------------------------------------------";
}
}
@ -157,8 +157,10 @@ void StdInstVListLoadTask::finalize()
// Now we swap the list we loaded into the actual version list.
// This applies our changes to the version list immediately and still gives us
// access to the old list so that we can delete the objects in it and free their memory.
// By doing this, we cause the version list to update immediately.
// By doing this, we cause the version list to update as quickly as possible.
m_list->beginResetModel();
m_list->m_vlist.swap(tempList);
m_list->endResetModel();
// We called swap, so all the data that was in the version list previously is now in
// tempList (and vice-versa). Now we just free the memory.