From fb28dd3480a13655b255541a53c10099d2ff4fdc Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 5 May 2025 17:43:02 -0400 Subject: [PATCH] Show the game version when importing existing installations This is more useful than a path - which is still shown when importing from other launchers. --- external/libphysis | 2 +- launcher/include/existinginstallmodel.h | 2 ++ launcher/src/existinginstallmodel.cpp | 7 ++++++- launcher/ui/Setup/SetupPage.qml | 2 +- launcher/ui/Setup/UseExistingInstall.qml | 9 +++++---- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/external/libphysis b/external/libphysis index c642350..41bd594 160000 --- a/external/libphysis +++ b/external/libphysis @@ -1 +1 @@ -Subproject commit c6423503dc7d3a07632579750c100cbb295519b4 +Subproject commit 41bd594d2ab2d0f9a9325ab5eedec9810e225de3 diff --git a/launcher/include/existinginstallmodel.h b/launcher/include/existinginstallmodel.h index 9b21f54..0097530 100644 --- a/launcher/include/existinginstallmodel.h +++ b/launcher/include/existinginstallmodel.h @@ -16,6 +16,7 @@ public: enum CustomRoles { TypeRole = Qt::UserRole, PathRole, + VersionRole, }; explicit ExistingInstallModel(QObject *parent = nullptr); @@ -30,6 +31,7 @@ private: struct ExistingInstall { ExistingInstallType type; QString path; + QString version; }; QList m_existingInstalls; diff --git a/launcher/src/existinginstallmodel.cpp b/launcher/src/existinginstallmodel.cpp index 53fe663..8e85b01 100644 --- a/launcher/src/existinginstallmodel.cpp +++ b/launcher/src/existinginstallmodel.cpp @@ -34,6 +34,8 @@ QVariant ExistingInstallModel::data(const QModelIndex &index, const int role) co } case PathRole: return install.path; + case VersionRole: + return install.version; default: return {}; } @@ -49,6 +51,7 @@ QHash ExistingInstallModel::roleNames() const return { {TypeRole, "type"}, {PathRole, "path"}, + {VersionRole, "version"}, }; } @@ -59,7 +62,9 @@ void ExistingInstallModel::fill() // We shouldn't be able to import our own game installs, that's handled elsewhere in the UI if (dirs.entries[i].install_type != ExistingInstallType::Astra) { beginInsertRows({}, m_existingInstalls.size(), m_existingInstalls.size()); - m_existingInstalls.push_back(ExistingInstall{.type = dirs.entries[i].install_type, .path = QString::fromUtf8(dirs.entries[i].path)}); + m_existingInstalls.push_back(ExistingInstall{.type = dirs.entries[i].install_type, + .path = QString::fromUtf8(dirs.entries[i].path), + .version = QString::fromUtf8(dirs.entries[i].version)}); endInsertRows(); } } diff --git a/launcher/ui/Setup/SetupPage.qml b/launcher/ui/Setup/SetupPage.qml index c61d8b0..7969730 100644 --- a/launcher/ui/Setup/SetupPage.qml +++ b/launcher/ui/Setup/SetupPage.qml @@ -82,7 +82,7 @@ FormCard.FormCardPage { required property var profile text: profile.config.name - description: profile.isGamePathDefault ? i18n("Default Location") : profile.config.gamePath + description: profile.subtitle visible: profile.isGameInstalled onClicked: { diff --git a/launcher/ui/Setup/UseExistingInstall.qml b/launcher/ui/Setup/UseExistingInstall.qml index 96ad518..0a26f81 100644 --- a/launcher/ui/Setup/UseExistingInstall.qml +++ b/launcher/ui/Setup/UseExistingInstall.qml @@ -49,11 +49,12 @@ FormCard.FormCardPage { model: ExistingInstallModel {} delegate: FormCard.FormButtonDelegate { - required property var path - required property var type + required property string path + required property string type + required property string version - text: path - description: type + text: type + description: i18nc("version (path)", "%1 (%2)", version, path) onClicked: { page.profile.config.gamePath = path;