From d87c227347bba9c005c6c25cf327d77dd0ec527f Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Mon, 9 Feb 2026 13:58:19 +0100 Subject: [PATCH] Core: persist per-game runner launch config --- src/game.cpp | 27 ++++++++++++++++++++++++++- src/game.h | 6 ++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 32993c3..cb3fa6e 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -159,6 +159,19 @@ void Game::setLaunchRunner(const QString &runner) } } +QString Game::launchRunnerId() const +{ + return m_launchRunnerId; +} + +void Game::setLaunchRunnerId(const QString &runnerId) +{ + if (m_launchRunnerId != runnerId) { + m_launchRunnerId = runnerId; + Q_EMIT launchRunnerIdChanged(); + } +} + QString Game::launchRunnerPath() const { return m_launchRunnerPath; @@ -323,7 +336,8 @@ QJsonObject Game::toJson() const obj[QStringLiteral("hidden")] = m_hidden; obj[QStringLiteral("installed")] = m_installed; - const bool hasLaunchConfig = !m_launchEnv.isEmpty() || !m_launchRunner.isEmpty() || !m_launchRunnerPath.isEmpty() || !m_launchPrefixPath.isEmpty(); + const bool hasLaunchConfig = + !m_launchEnv.isEmpty() || !m_launchRunner.isEmpty() || !m_launchRunnerId.isEmpty() || !m_launchRunnerPath.isEmpty() || !m_launchPrefixPath.isEmpty(); if (hasLaunchConfig) { QJsonObject launchObj; @@ -338,6 +352,9 @@ QJsonObject Game::toJson() const if (!m_launchRunner.isEmpty()) { launchObj.insert(QStringLiteral("runner"), m_launchRunner); } + if (!m_launchRunnerId.isEmpty()) { + launchObj.insert(QStringLiteral("runnerId"), m_launchRunnerId); + } if (!m_launchRunnerPath.isEmpty()) { launchObj.insert(QStringLiteral("runnerPath"), m_launchRunnerPath); } @@ -391,6 +408,7 @@ Game *Game::fromJson(const QJsonObject &json, QObject *parent) QVariantMap env; QString runner; + QString runnerId; QString runnerPath; QString prefixPath; const QJsonValue launchValue = json.value(QStringLiteral("launch")); @@ -402,6 +420,7 @@ Game *Game::fromJson(const QJsonObject &json, QObject *parent) } runner = launchObj.value(QStringLiteral("runner")).toString(); + runnerId = launchObj.value(QStringLiteral("runnerId")).toString(); runnerPath = launchObj.value(QStringLiteral("runnerPath")).toString(); prefixPath = launchObj.value(QStringLiteral("prefixPath")).toString(); } @@ -414,6 +433,9 @@ Game *Game::fromJson(const QJsonObject &json, QObject *parent) if (runner.isEmpty()) { runner = json.value(QStringLiteral("launchRunner")).toString(); } + if (runnerId.isEmpty()) { + runnerId = json.value(QStringLiteral("launchRunnerId")).toString(); + } if (runnerPath.isEmpty()) { runnerPath = json.value(QStringLiteral("launchRunnerPath")).toString(); } @@ -428,6 +450,9 @@ Game *Game::fromJson(const QJsonObject &json, QObject *parent) if (!runner.isEmpty()) { game->setLaunchRunner(runner); } + if (!runnerId.isEmpty()) { + game->setLaunchRunnerId(runnerId); + } if (!runnerPath.isEmpty()) { game->setLaunchRunnerPath(runnerPath); } diff --git a/src/game.h b/src/game.h index 05304b8..ada53d5 100644 --- a/src/game.h +++ b/src/game.h @@ -28,6 +28,7 @@ class Game : public QObject Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory NOTIFY workingDirectoryChanged) Q_PROPERTY(QVariantMap launchEnv READ launchEnv WRITE setLaunchEnv NOTIFY launchEnvChanged) Q_PROPERTY(QString launchRunner READ launchRunner WRITE setLaunchRunner NOTIFY launchRunnerChanged) + Q_PROPERTY(QString launchRunnerId READ launchRunnerId WRITE setLaunchRunnerId NOTIFY launchRunnerIdChanged) Q_PROPERTY(QString launchRunnerPath READ launchRunnerPath WRITE setLaunchRunnerPath NOTIFY launchRunnerPathChanged) Q_PROPERTY(QString launchPrefixPath READ launchPrefixPath WRITE setLaunchPrefixPath NOTIFY launchPrefixPathChanged) Q_PROPERTY(QString platform READ platform WRITE setPlatform NOTIFY platformChanged) @@ -76,6 +77,9 @@ public: QString launchRunner() const; void setLaunchRunner(const QString &runner); + QString launchRunnerId() const; + void setLaunchRunnerId(const QString &runnerId); + QString launchRunnerPath() const; void setLaunchRunnerPath(const QString &path); @@ -127,6 +131,7 @@ Q_SIGNALS: void workingDirectoryChanged(); void launchEnvChanged(); void launchRunnerChanged(); + void launchRunnerIdChanged(); void launchRunnerPathChanged(); void launchPrefixPathChanged(); void platformChanged(); @@ -151,6 +156,7 @@ private: QString m_workingDirectory; QVariantMap m_launchEnv; QString m_launchRunner; + QString m_launchRunnerId; QString m_launchRunnerPath; QString m_launchPrefixPath; QString m_platform;