summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/BaseVersion.h9
-rw-r--r--logic/lists/ForgeVersionList.cpp8
-rw-r--r--logic/lists/ForgeVersionList.h21
-rw-r--r--logic/status/StatusChecker.cpp6
4 files changed, 31 insertions, 13 deletions
diff --git a/logic/BaseVersion.h b/logic/BaseVersion.h
index 1864c94c..43f5942a 100644
--- a/logic/BaseVersion.h
+++ b/logic/BaseVersion.h
@@ -39,6 +39,15 @@ struct BaseVersion
* the kind of version this is (Stable, Beta, Snapshot, whatever)
*/
virtual QString typeString() const = 0;
+
+ virtual bool operator<(BaseVersion &a)
+ {
+ return name() < a.name();
+ };
+ virtual bool operator>(BaseVersion &a)
+ {
+ return name() > a.name();
+ };
};
typedef std::shared_ptr<BaseVersion> BaseVersionPtr;
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;
diff --git a/logic/status/StatusChecker.cpp b/logic/status/StatusChecker.cpp
index 7c856d3f..66f800ae 100644
--- a/logic/status/StatusChecker.cpp
+++ b/logic/status/StatusChecker.cpp
@@ -31,11 +31,11 @@ void StatusChecker::reloadStatus()
{
if (isLoadingStatus())
{
- QLOG_INFO() << "Ignored request to reload status. Currently reloading already.";
+ // QLOG_INFO() << "Ignored request to reload status. Currently reloading already.";
return;
}
- QLOG_INFO() << "Reloading status.";
+ // QLOG_INFO() << "Reloading status.";
NetJob* job = new NetJob("Status JSON");
job->addNetAction(ByteArrayDownload::make(URLConstants::MOJANG_STATUS_URL));
@@ -85,7 +85,7 @@ void StatusChecker::statusDownloadFinished()
if(value.type() == QVariant::Type::String)
{
m_statusEntries.insert(key, value.toString());
- QLOG_DEBUG() << "Status JSON object: " << key << m_statusEntries[key];
+ //QLOG_DEBUG() << "Status JSON object: " << key << m_statusEntries[key];
}
else
{