RhythmGame 1.4.3
Loading...
Searching...
No Matches
ProfileList.h
Go to the documentation of this file.
1//
2// Created by bobini on 30.09.23.
3//
4
5#ifndef RHYTHMGAME_PROFILELIST_H
6#define RHYTHMGAME_PROFILELIST_H
7
9
10#include <qproperty.h>
11namespace resource_managers {
12class inputTranslator;
13} // namespace resource_managers
14namespace qml_components {
15class ThemeFamily;
16
22class BattleProfiles : public QObject
23{
24 Q_OBJECT
25
30
33
34 friend class ProfileList;
35
36 public:
38 auto getPlayer1Profile() const -> resource_managers::Profile*;
39
40 void setPlayer2Profile(resource_managers::Profile* profile);
41 auto getPlayer2Profile() const -> resource_managers::Profile*;
42
43 signals:
46};
47
54class ProfileList final : public QObject
55{
56 Q_OBJECT
63 Q_PROPERTY(resource_managers::Profile* mainProfile READ getMainProfile WRITE
64 setMainProfile NOTIFY mainProfileChanged FINAL)
69 Q_PROPERTY(qml_components::BattleProfiles* battleProfiles READ
70 getBattleProfiles CONSTANT FINAL)
74 Q_PROPERTY(QList<resource_managers::Profile*> profiles READ getProfiles
75 NOTIFY profilesChanged FINAL)
81 Q_PROPERTY(bool battleActive READ getBattleActive WRITE setBattleActive
82 NOTIFY battleActiveChanged FINAL)
83 Q_PROPERTY(bool battleAllowed READ getBattleAllowed NOTIFY
84 battleAllowedChanged FINAL)
85
86 std::filesystem::path profilesFolder;
87 std::filesystem::path mainDbPath;
88 QList<resource_managers::Profile*> profiles;
89 db::SqliteCppDb* songDb;
90 QMap<QString, ThemeFamily> themeFamilies;
91 resource_managers::Profile* mainProfile{};
92 BattleProfiles battleProfiles;
93 bool battleActive{};
94 bool battleAllowed{ true };
95 QList<QString> assetsPaths;
96 QNetworkAccessManager* networkAccessManager;
98
99 void saveMainProfile();
100 void saveActiveProfiles();
101
102 public:
103 explicit ProfileList(std::filesystem::path mainDbPath,
104 db::SqliteCppDb* songDb,
105 const QMap<QString, ThemeFamily>& themeFamilies,
106 std::filesystem::path profilesFolder,
107 QList<QString> assetsPaths,
108 QNetworkAccessManager* networkAccessManager,
109 resource_managers::SongAssetStore* songAssetStore,
110 QObject* parent = nullptr);
111 auto getProfiles() -> const QList<resource_managers::Profile*>&;
112
113 Q_INVOKABLE resource_managers::Profile* at(int index) const;
114 Q_INVOKABLE resource_managers::Profile* createProfile();
119 Q_INVOKABLE void removeProfile(resource_managers::Profile* profile);
120 void setMainProfile(resource_managers::Profile* profile);
121 auto getMainProfile() const -> resource_managers::Profile*;
122
123 auto getBattleProfiles() -> BattleProfiles*;
124
125 auto getBattleActive() const -> bool;
126 void setBattleActive(bool active);
127 [[nodiscard]] auto getBattleAllowed() const -> bool;
128 void setBattleAllowed(bool allowed);
129
130 signals:
131 void mainProfileChanged();
132 void profilesChanged();
133 void battleActiveChanged();
134 void battleAllowedChanged();
135};
136} // namespace qml_components
137
138#endif // RHYTHMGAME_PROFILELIST_H
QString path
Definition Lr2SkinParser.cpp:87
zip_uint64_t index
Definition SongAssetStore.cpp:436
Database wrapper for SQLiteCpp.
Definition SqliteCppDb.h:30
The profiles used in battle mode.
Definition ProfileList.h:23
void setPlayer2Profile(resource_managers::Profile *profile)
Definition ProfileList.cpp:317
void setPlayer1Profile(resource_managers::Profile *profile)
Definition ProfileList.cpp:301
auto getPlayer1Profile() const -> resource_managers::Profile *
Definition ProfileList.cpp:311
friend class ProfileList
Definition ProfileList.h:34
auto getPlayer2Profile() const -> resource_managers::Profile *
Definition ProfileList.cpp:328
resource_managers::Profile * player1Profile
Definition ProfileList.h:27
resource_managers::Profile * player2Profile
Definition ProfileList.h:29
The list of local profiles.
Definition ProfileList.h:55
Definition ThemeFamily.h:43
Definition Profile.h:91
Definition SongAssetStore.h:28
Namespace for database related classes and functions.
Definition QtArenaRoundLoader.h:15
Contains classes that wrap some functionality for use in QML.
Definition ProfileArenaIdentityProvider.h:9
Classes and functions related to loading and managing resources such as charts, sounds,...
Definition ProfileArenaIdentityProvider.h:12