Sort forge versions right. Do not spam the multimc log with mc server status stuff.
This commit is contained in:
parent
d85e820a07
commit
7b96d74d3b
@ -39,6 +39,15 @@ struct BaseVersion
|
|||||||
* the kind of version this is (Stable, Beta, Snapshot, whatever)
|
* the kind of version this is (Stable, Beta, Snapshot, whatever)
|
||||||
*/
|
*/
|
||||||
virtual QString typeString() const = 0;
|
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;
|
typedef std::shared_ptr<BaseVersion> BaseVersionPtr;
|
||||||
|
@ -404,12 +404,8 @@ void ForgeListLoadTask::listDownloaded()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::sort(list.begin(), list.end(), [](const BaseVersionPtr & l, const BaseVersionPtr & r)
|
||||||
qSort(list.begin(), list.end(), [](const BaseVersionPtr & p1, const BaseVersionPtr & p2)
|
{ return (*l > *r); });
|
||||||
{
|
|
||||||
// TODO better comparison (takes major/minor/build number into account)
|
|
||||||
return p1->name() > p2->name();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_list->updateListData(list);
|
m_list->updateListData(list);
|
||||||
|
|
||||||
|
@ -29,25 +29,38 @@ typedef std::shared_ptr<ForgeVersion> ForgeVersionPtr;
|
|||||||
|
|
||||||
struct ForgeVersion : public BaseVersion
|
struct ForgeVersion : public BaseVersion
|
||||||
{
|
{
|
||||||
virtual QString descriptor()
|
virtual QString descriptor() override
|
||||||
{
|
{
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
virtual QString name()
|
virtual QString name() override
|
||||||
{
|
{
|
||||||
return "Forge " + jobbuildver;
|
return "Forge " + jobbuildver;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
virtual QString typeString() const
|
virtual QString typeString() const override
|
||||||
{
|
{
|
||||||
if (installer_url.isEmpty())
|
if (installer_url.isEmpty())
|
||||||
return "Universal";
|
return "Universal";
|
||||||
else
|
else
|
||||||
return "Installer";
|
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;
|
int m_buildnr = 0;
|
||||||
QString universal_url;
|
QString universal_url;
|
||||||
QString changelog_url;
|
QString changelog_url;
|
||||||
|
@ -31,11 +31,11 @@ void StatusChecker::reloadStatus()
|
|||||||
{
|
{
|
||||||
if (isLoadingStatus())
|
if (isLoadingStatus())
|
||||||
{
|
{
|
||||||
QLOG_INFO() << "Ignored request to reload status. Currently reloading already.";
|
// QLOG_INFO() << "Ignored request to reload status. Currently reloading already.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QLOG_INFO() << "Reloading status.";
|
// QLOG_INFO() << "Reloading status.";
|
||||||
|
|
||||||
NetJob* job = new NetJob("Status JSON");
|
NetJob* job = new NetJob("Status JSON");
|
||||||
job->addNetAction(ByteArrayDownload::make(URLConstants::MOJANG_STATUS_URL));
|
job->addNetAction(ByteArrayDownload::make(URLConstants::MOJANG_STATUS_URL));
|
||||||
@ -85,7 +85,7 @@ void StatusChecker::statusDownloadFinished()
|
|||||||
if(value.type() == QVariant::Type::String)
|
if(value.type() == QVariant::Type::String)
|
||||||
{
|
{
|
||||||
m_statusEntries.insert(key, value.toString());
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user