summaryrefslogtreecommitdiffstats
path: root/logic/lists
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-01-16 23:06:07 +0100
committerPetr Mrázek <peterix@gmail.com>2014-01-16 23:06:07 +0100
commit7b96d74d3b197c23324c5a364809a91ea6800e4e (patch)
treedda120a762a8cd3b60ec89467bcd36aef61bf43d /logic/lists
parentd85e820a070ea81ee9b76553c3e35948ef785426 (diff)
downloadMultiMC-7b96d74d3b197c23324c5a364809a91ea6800e4e.tar
MultiMC-7b96d74d3b197c23324c5a364809a91ea6800e4e.tar.gz
MultiMC-7b96d74d3b197c23324c5a364809a91ea6800e4e.tar.lz
MultiMC-7b96d74d3b197c23324c5a364809a91ea6800e4e.tar.xz
MultiMC-7b96d74d3b197c23324c5a364809a91ea6800e4e.zip
Sort forge versions right. Do not spam the multimc log with mc server status stuff.
Diffstat (limited to 'logic/lists')
-rw-r--r--logic/lists/ForgeVersionList.cpp8
-rw-r--r--logic/lists/ForgeVersionList.h21
2 files changed, 19 insertions, 10 deletions
diff --git a/logic/lists/ForgeVersionList.cpp b/logic/lists/ForgeVersionList.cpp
index 56eca744..38e033fa 100644
--- a/logic/lists/ForgeVersionList.cpp
+++ b/logic/lists/ForgeVersionList.cpp
@@ -404,12 +404,8 @@ void ForgeListLoadTask::listDownloaded()
{
return;
}
-
- qSort(list.begin(), list.end(), [](const BaseVersionPtr & p1, const BaseVersionPtr & p2)
- {
- // TODO better comparison (takes major/minor/build number into account)
- return p1->name() > p2->name();
- });
+ std::sort(list.begin(), list.end(), [](const BaseVersionPtr & l, const BaseVersionPtr & r)
+ { return (*l > *r); });
m_list->updateListData(list);
diff --git a/logic/lists/ForgeVersionList.h b/logic/lists/ForgeVersionList.h
index 924084ae..b19d3f56 100644
--- a/logic/lists/ForgeVersionList.h
+++ b/logic/lists/ForgeVersionList.h
@@ -29,25 +29,38 @@ typedef std::shared_ptr<ForgeVersion> ForgeVersionPtr;
struct ForgeVersion : public BaseVersion
{
- virtual QString descriptor()
+ virtual QString descriptor() override
{
return filename;
}
;
- virtual QString name()
+ virtual QString name() override
{
return "Forge " + jobbuildver;
}
;
- virtual QString typeString() const
+ virtual QString typeString() const override
{
if (installer_url.isEmpty())
return "Universal";
else
return "Installer";
}
- ;
+ virtual bool operator<(BaseVersion &a) override
+ {
+ ForgeVersion *pa = dynamic_cast<ForgeVersion *>(&a);
+ if(!pa)
+ return true;
+ return m_buildnr < pa->m_buildnr;
+ }
+ virtual bool operator>(BaseVersion &a) override
+ {
+ ForgeVersion *pa = dynamic_cast<ForgeVersion *>(&a);
+ if(!pa)
+ return false;
+ return m_buildnr > pa->m_buildnr;
+ }
int m_buildnr = 0;
QString universal_url;
QString changelog_url;