feat: show instance version
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
ee1d4acb51
commit
d9b265d7ac
@ -213,6 +213,8 @@ public:
|
||||
|
||||
virtual QString getStatusbarDescription() = 0;
|
||||
|
||||
virtual QString getMainVersion() = 0;
|
||||
|
||||
/// FIXME: this really should be elsewhere...
|
||||
virtual QString instanceConfigFolder() const = 0;
|
||||
|
||||
|
@ -152,6 +152,7 @@ QVariant InstanceList::data(const QModelIndex& index, int role) const {
|
||||
return QVariant();
|
||||
}
|
||||
const InstancePtr inst = m_instances[index.row()];
|
||||
|
||||
switch (static_cast<Column>(index.column())) {
|
||||
case Icon:
|
||||
if (role == Qt::DecorationRole) {
|
||||
@ -168,7 +169,8 @@ QVariant InstanceList::data(const QModelIndex& index, int role) const {
|
||||
break;
|
||||
case GameVersion: {
|
||||
if (role == Qt::DisplayRole)
|
||||
return "Minecraft <something>";
|
||||
return inst->getMainVersion();
|
||||
break;
|
||||
}
|
||||
case LastPlayed: {
|
||||
QString foo = Time::prettifyDuration(inst->lastTimePlayed());
|
||||
|
@ -58,6 +58,10 @@ public:
|
||||
{
|
||||
return tr("Unknown instance type");
|
||||
};
|
||||
QString getMainVersion() override
|
||||
{
|
||||
return tr("Unknown");
|
||||
};
|
||||
QSet< QString > traits() const override
|
||||
{
|
||||
return {};
|
||||
|
@ -88,6 +88,8 @@
|
||||
#include "minecraft/gameoptions/GameOptions.h"
|
||||
#include "minecraft/update/FoldersTask.h"
|
||||
|
||||
#include "modplatform/ModAPI.h"
|
||||
|
||||
#define IBUS "@im=ibus"
|
||||
|
||||
// all of this because keeping things compatible with deprecated old settings
|
||||
@ -880,22 +882,7 @@ QString MinecraftInstance::getLogFileRoot()
|
||||
|
||||
QString MinecraftInstance::getStatusbarDescription()
|
||||
{
|
||||
QStringList traits;
|
||||
if (hasVersionBroken())
|
||||
{
|
||||
traits.append(tr("broken"));
|
||||
}
|
||||
|
||||
QString mcVersion = m_components->getComponentVersion("net.minecraft");
|
||||
if (mcVersion.isEmpty())
|
||||
{
|
||||
// Load component info if needed
|
||||
m_components->reload(Net::Mode::Offline);
|
||||
mcVersion = m_components->getComponentVersion("net.minecraft");
|
||||
}
|
||||
|
||||
QString description;
|
||||
description.append(tr("Minecraft %1").arg(mcVersion));
|
||||
QString description = getMainVersion();
|
||||
if(m_settings->get("ShowGameTime").toBool())
|
||||
{
|
||||
if (lastTimePlayed() > 0) {
|
||||
@ -913,6 +900,25 @@ QString MinecraftInstance::getStatusbarDescription()
|
||||
return description;
|
||||
}
|
||||
|
||||
QString MinecraftInstance::getMainVersion() {
|
||||
QString mcVersion = m_components->getComponentVersion("net.minecraft");
|
||||
if (mcVersion.isEmpty())
|
||||
{
|
||||
// Load component info if needed
|
||||
m_components->reload(Net::Mode::Offline);
|
||||
mcVersion = m_components->getComponentVersion("net.minecraft");
|
||||
}
|
||||
if (mcVersion.isEmpty())
|
||||
{
|
||||
return tr("Unknown");
|
||||
}
|
||||
if (getPackProfile()->getModLoaders() != ModAPI::Unspecified) {
|
||||
return tr("%1 (Modded)").arg(mcVersion);
|
||||
}
|
||||
|
||||
return mcVersion;
|
||||
}
|
||||
|
||||
Task::Ptr MinecraftInstance::createUpdateTask(Net::Mode mode)
|
||||
{
|
||||
updateRuntimeContext();
|
||||
|
@ -146,6 +146,7 @@ public:
|
||||
QString getLogFileRoot() override;
|
||||
|
||||
QString getStatusbarDescription() override;
|
||||
QString getMainVersion() override;
|
||||
|
||||
// FIXME: remove
|
||||
virtual QStringList getClassPath();
|
||||
|
Loading…
x
Reference in New Issue
Block a user