1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Hide change profile button if only one profile is used

This commit is contained in:
Joshua Goins 2023-12-31 17:28:31 -05:00
parent f3c46d3a3b
commit f6ddc0193e
3 changed files with 8 additions and 0 deletions

View file

@ -14,6 +14,8 @@ class ProfileManager : public QAbstractListModel
QML_ELEMENT
QML_UNCREATABLE("Use LauncherCore.profileManager")
Q_PROPERTY(int numProfiles READ numProfiles NOTIFY profilesChanged)
public:
explicit ProfileManager(LauncherCore &launcher, QObject *parent = nullptr);
@ -46,6 +48,9 @@ public:
static QString getDefaultGamePath(const QString &uuid);
static QString getDefaultWinePrefixPath(const QString &uuid);
Q_SIGNALS:
void profilesChanged();
private:
void insertProfile(Profile *profile);

View file

@ -61,6 +61,7 @@ void ProfileManager::deleteProfile(Profile *profile)
beginRemoveRows(QModelIndex(), row, row);
m_profiles.removeAll(profile);
endRemoveRows();
Q_EMIT profilesChanged();
}
QString ProfileManager::getDefaultGamePath(const QString &uuid)
@ -137,6 +138,7 @@ void ProfileManager::insertProfile(Profile *profile)
beginInsertRows(QModelIndex(), static_cast<int>(m_profiles.size()), static_cast<int>(m_profiles.size()));
m_profiles.append(profile);
endInsertRows();
Q_EMIT profilesChanged();
}
QList<Profile *> ProfileManager::profiles() const

View file

@ -105,6 +105,7 @@ QQC2.Control {
FormCard.FormCard {
maximumWidth: Kirigami.Units.gridUnit * 25
visible: LauncherCore.profileManager.numProfiles > 1
Layout.fillWidth: true