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 getStatusbarDescription() = 0;
|
||||||
|
|
||||||
|
virtual QString getMainVersion() = 0;
|
||||||
|
|
||||||
/// FIXME: this really should be elsewhere...
|
/// FIXME: this really should be elsewhere...
|
||||||
virtual QString instanceConfigFolder() const = 0;
|
virtual QString instanceConfigFolder() const = 0;
|
||||||
|
|
||||||
|
@ -152,6 +152,7 @@ QVariant InstanceList::data(const QModelIndex& index, int role) const {
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
const InstancePtr inst = m_instances[index.row()];
|
const InstancePtr inst = m_instances[index.row()];
|
||||||
|
|
||||||
switch (static_cast<Column>(index.column())) {
|
switch (static_cast<Column>(index.column())) {
|
||||||
case Icon:
|
case Icon:
|
||||||
if (role == Qt::DecorationRole) {
|
if (role == Qt::DecorationRole) {
|
||||||
@ -168,7 +169,8 @@ QVariant InstanceList::data(const QModelIndex& index, int role) const {
|
|||||||
break;
|
break;
|
||||||
case GameVersion: {
|
case GameVersion: {
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
return "Minecraft <something>";
|
return inst->getMainVersion();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case LastPlayed: {
|
case LastPlayed: {
|
||||||
QString foo = Time::prettifyDuration(inst->lastTimePlayed());
|
QString foo = Time::prettifyDuration(inst->lastTimePlayed());
|
||||||
|
@ -58,6 +58,10 @@ public:
|
|||||||
{
|
{
|
||||||
return tr("Unknown instance type");
|
return tr("Unknown instance type");
|
||||||
};
|
};
|
||||||
|
QString getMainVersion() override
|
||||||
|
{
|
||||||
|
return tr("Unknown");
|
||||||
|
};
|
||||||
QSet< QString > traits() const override
|
QSet< QString > traits() const override
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
|
@ -88,6 +88,8 @@
|
|||||||
#include "minecraft/gameoptions/GameOptions.h"
|
#include "minecraft/gameoptions/GameOptions.h"
|
||||||
#include "minecraft/update/FoldersTask.h"
|
#include "minecraft/update/FoldersTask.h"
|
||||||
|
|
||||||
|
#include "modplatform/ModAPI.h"
|
||||||
|
|
||||||
#define IBUS "@im=ibus"
|
#define IBUS "@im=ibus"
|
||||||
|
|
||||||
// all of this because keeping things compatible with deprecated old settings
|
// all of this because keeping things compatible with deprecated old settings
|
||||||
@ -880,22 +882,7 @@ QString MinecraftInstance::getLogFileRoot()
|
|||||||
|
|
||||||
QString MinecraftInstance::getStatusbarDescription()
|
QString MinecraftInstance::getStatusbarDescription()
|
||||||
{
|
{
|
||||||
QStringList traits;
|
QString description = getMainVersion();
|
||||||
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));
|
|
||||||
if(m_settings->get("ShowGameTime").toBool())
|
if(m_settings->get("ShowGameTime").toBool())
|
||||||
{
|
{
|
||||||
if (lastTimePlayed() > 0) {
|
if (lastTimePlayed() > 0) {
|
||||||
@ -913,6 +900,25 @@ QString MinecraftInstance::getStatusbarDescription()
|
|||||||
return description;
|
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)
|
Task::Ptr MinecraftInstance::createUpdateTask(Net::Mode mode)
|
||||||
{
|
{
|
||||||
updateRuntimeContext();
|
updateRuntimeContext();
|
||||||
|
@ -146,6 +146,7 @@ public:
|
|||||||
QString getLogFileRoot() override;
|
QString getLogFileRoot() override;
|
||||||
|
|
||||||
QString getStatusbarDescription() override;
|
QString getStatusbarDescription() override;
|
||||||
|
QString getMainVersion() override;
|
||||||
|
|
||||||
// FIXME: remove
|
// FIXME: remove
|
||||||
virtual QStringList getClassPath();
|
virtual QStringList getClassPath();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user