summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-02-09 11:00:34 +0100
committerPetr Mrázek <peterix@gmail.com>2014-02-09 11:00:34 +0100
commit902204236031dedffc6047802524c93dcc14fa45 (patch)
tree8d32b9b7f8b1c8a7f3d66202f3c83d49d6b3b7d4 /logic
parent583786757a112827ac12efdf6736d1b602e6eb1e (diff)
downloadMultiMC-902204236031dedffc6047802524c93dcc14fa45.tar
MultiMC-902204236031dedffc6047802524c93dcc14fa45.tar.gz
MultiMC-902204236031dedffc6047802524c93dcc14fa45.tar.lz
MultiMC-902204236031dedffc6047802524c93dcc14fa45.tar.xz
MultiMC-902204236031dedffc6047802524c93dcc14fa45.zip
Only load instance list twice.
Diffstat (limited to 'logic')
-rw-r--r--logic/lists/MinecraftVersionList.cpp10
-rw-r--r--logic/lists/MinecraftVersionList.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/logic/lists/MinecraftVersionList.cpp b/logic/lists/MinecraftVersionList.cpp
index 91f86df0..ece31e3d 100644
--- a/logic/lists/MinecraftVersionList.cpp
+++ b/logic/lists/MinecraftVersionList.cpp
@@ -60,10 +60,15 @@ bool cmpVersions(BaseVersionPtr first, BaseVersionPtr second)
return left->timestamp > right->timestamp;
}
+void MinecraftVersionList::sortInternal()
+{
+ qSort(m_vlist.begin(), m_vlist.end(), cmpVersions);
+}
+
void MinecraftVersionList::sort()
{
beginResetModel();
- qSort(m_vlist.begin(), m_vlist.end(), cmpVersions);
+ sortInternal();
endResetModel();
}
@@ -85,9 +90,8 @@ void MinecraftVersionList::updateListData(QList<BaseVersionPtr> versions)
beginResetModel();
m_vlist = versions;
m_loaded = true;
+ sortInternal();
endResetModel();
- // NOW SORT!!
- sort();
}
inline QDomElement getDomElementByTagName(QDomElement parent, QString tagname)
diff --git a/logic/lists/MinecraftVersionList.h b/logic/lists/MinecraftVersionList.h
index 82af1009..167f4d11 100644
--- a/logic/lists/MinecraftVersionList.h
+++ b/logic/lists/MinecraftVersionList.h
@@ -29,6 +29,8 @@ class QNetworkReply;
class MinecraftVersionList : public BaseVersionList
{
Q_OBJECT
+private:
+ void sortInternal();
public:
friend class MCVListLoadTask;