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:
parent
f3c46d3a3b
commit
f6ddc0193e
3 changed files with 8 additions and 0 deletions
|
@ -14,6 +14,8 @@ class ProfileManager : public QAbstractListModel
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
QML_UNCREATABLE("Use LauncherCore.profileManager")
|
QML_UNCREATABLE("Use LauncherCore.profileManager")
|
||||||
|
|
||||||
|
Q_PROPERTY(int numProfiles READ numProfiles NOTIFY profilesChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ProfileManager(LauncherCore &launcher, QObject *parent = nullptr);
|
explicit ProfileManager(LauncherCore &launcher, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
@ -46,6 +48,9 @@ public:
|
||||||
static QString getDefaultGamePath(const QString &uuid);
|
static QString getDefaultGamePath(const QString &uuid);
|
||||||
static QString getDefaultWinePrefixPath(const QString &uuid);
|
static QString getDefaultWinePrefixPath(const QString &uuid);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void profilesChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void insertProfile(Profile *profile);
|
void insertProfile(Profile *profile);
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ void ProfileManager::deleteProfile(Profile *profile)
|
||||||
beginRemoveRows(QModelIndex(), row, row);
|
beginRemoveRows(QModelIndex(), row, row);
|
||||||
m_profiles.removeAll(profile);
|
m_profiles.removeAll(profile);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
Q_EMIT profilesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProfileManager::getDefaultGamePath(const QString &uuid)
|
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()));
|
beginInsertRows(QModelIndex(), static_cast<int>(m_profiles.size()), static_cast<int>(m_profiles.size()));
|
||||||
m_profiles.append(profile);
|
m_profiles.append(profile);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
Q_EMIT profilesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Profile *> ProfileManager::profiles() const
|
QList<Profile *> ProfileManager::profiles() const
|
||||||
|
|
|
@ -105,6 +105,7 @@ QQC2.Control {
|
||||||
|
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
maximumWidth: Kirigami.Units.gridUnit * 25
|
maximumWidth: Kirigami.Units.gridUnit * 25
|
||||||
|
visible: LauncherCore.profileManager.numProfiles > 1
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue