feat: show instance version
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user