1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-12 21:07:44 +00:00

Show the game version when importing existing installations

This is more useful than a path - which is still shown when importing
from other launchers.
This commit is contained in:
Joshua Goins 2025-05-05 17:43:02 -04:00
parent f13d32db0b
commit fb28dd3480
5 changed files with 15 additions and 7 deletions

2
external/libphysis vendored

@ -1 +1 @@
Subproject commit c6423503dc7d3a07632579750c100cbb295519b4 Subproject commit 41bd594d2ab2d0f9a9325ab5eedec9810e225de3

View file

@ -16,6 +16,7 @@ public:
enum CustomRoles { enum CustomRoles {
TypeRole = Qt::UserRole, TypeRole = Qt::UserRole,
PathRole, PathRole,
VersionRole,
}; };
explicit ExistingInstallModel(QObject *parent = nullptr); explicit ExistingInstallModel(QObject *parent = nullptr);
@ -30,6 +31,7 @@ private:
struct ExistingInstall { struct ExistingInstall {
ExistingInstallType type; ExistingInstallType type;
QString path; QString path;
QString version;
}; };
QList<ExistingInstall> m_existingInstalls; QList<ExistingInstall> m_existingInstalls;

View file

@ -34,6 +34,8 @@ QVariant ExistingInstallModel::data(const QModelIndex &index, const int role) co
} }
case PathRole: case PathRole:
return install.path; return install.path;
case VersionRole:
return install.version;
default: default:
return {}; return {};
} }
@ -49,6 +51,7 @@ QHash<int, QByteArray> ExistingInstallModel::roleNames() const
return { return {
{TypeRole, "type"}, {TypeRole, "type"},
{PathRole, "path"}, {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 // 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) { if (dirs.entries[i].install_type != ExistingInstallType::Astra) {
beginInsertRows({}, m_existingInstalls.size(), m_existingInstalls.size()); 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(); endInsertRows();
} }
} }

View file

@ -82,7 +82,7 @@ FormCard.FormCardPage {
required property var profile required property var profile
text: profile.config.name text: profile.config.name
description: profile.isGamePathDefault ? i18n("Default Location") : profile.config.gamePath description: profile.subtitle
visible: profile.isGameInstalled visible: profile.isGameInstalled
onClicked: { onClicked: {

View file

@ -49,11 +49,12 @@ FormCard.FormCardPage {
model: ExistingInstallModel {} model: ExistingInstallModel {}
delegate: FormCard.FormButtonDelegate { delegate: FormCard.FormButtonDelegate {
required property var path required property string path
required property var type required property string type
required property string version
text: path text: type
description: type description: i18nc("version (path)", "%1 (%2)", version, path)
onClicked: { onClicked: {
page.profile.config.gamePath = path; page.profile.config.gamePath = path;