1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-11 12:37:46 +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 {
TypeRole = Qt::UserRole,
PathRole,
VersionRole,
};
explicit ExistingInstallModel(QObject *parent = nullptr);
@ -30,6 +31,7 @@ private:
struct ExistingInstall {
ExistingInstallType type;
QString path;
QString version;
};
QList<ExistingInstall> m_existingInstalls;

View file

@ -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<int, QByteArray> 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();
}
}

View file

@ -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: {

View file

@ -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;