NOISSUE add an interface to pass information to CraftPresence

Specifically, the icon key and instance title.
This commit is contained in:
Petr Mrázek
2023-03-10 19:56:17 +01:00
parent d98022d3ae
commit c1ed09e747
5 changed files with 19 additions and 2 deletions

View File

@@ -313,6 +313,11 @@ QString BaseInstance::windowTitle() const
return BuildConfig.LAUNCHER_NAME + ": " + name().replace(QRegExp("[ \n\r\t]+"), " ");
}
QString BaseInstance::instanceTitle() const
{
return name().replace(QRegExp("[ \n\r\t]+"), " ");
}
// FIXME: why is this here? move it to MinecraftInstance!!!
QStringList BaseInstance::extraArguments() const
{

View File

@@ -110,6 +110,8 @@ public:
/// Value used for instance window titles
QString windowTitle() const;
QString instanceTitle() const;
QString iconKey() const;
void setIconKey(QString val);

View File

@@ -513,6 +513,8 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
.arg(settings()->get("MinecraftWinHeight").toInt());
launchScript += "windowTitle " + windowTitle() + "\n";
launchScript += "windowParams " + windowParams + "\n";
launchScript += "instanceTitle " + instanceTitle() + "\n";
launchScript += "instanceIconId " + iconKey() + "\n";
}
// legacy auth

View File

@@ -192,7 +192,6 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
return;
}
int index = 1;
try
{
auto toplevel_doc = Json::requireDocument(data);
@@ -225,7 +224,6 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
lang.file_size = Json::requireInteger(langObj, "size");
languages.insert(lang.key, lang);
index++;
}
}
catch (Json::JsonException & e)