myproject 0.0.0
%%description%%
Loading...
Searching...
No Matches
settings.h
Go to the documentation of this file.
1#pragma once
2
3#include <QSettings>
4#include <QString>
5
6class QObject;
7
8namespace myproject {
9
12class Settings : public QSettings {
13 Q_OBJECT
14
15 Q_PROPERTY(
16 QString language READ language WRITE setLanguage NOTIFY languageChanged)
17 Q_PROPERTY(qreal windowOpacity READ windowOpacity WRITE setWindowOpacity
19 Q_PROPERTY(bool fpsVisible READ isFpsVisible WRITE setFpsVisible NOTIFY
21 Q_PROPERTY(
22 QString appTheme READ appTheme WRITE setAppTheme NOTIFY appThemeChanged)
23
24 Q_PROPERTY(QString newShortcut READ newShortcut WRITE setNewShortcut NOTIFY
26 Q_PROPERTY(QString openShortcut READ openShortcut WRITE setOpenShortcut NOTIFY
28 Q_PROPERTY(QString saveShortcut READ saveShortcut WRITE setSaveShortcut NOTIFY
30 Q_PROPERTY(QString saveAsShortcut READ saveAsShortcut WRITE setSaveAsShortcut
32 Q_PROPERTY(QString quitShortcut READ quitShortcut WRITE setQuitShortcut NOTIFY
34 Q_PROPERTY(QString undoShortcut READ undoShortcut WRITE setUndoShortcut NOTIFY
36 Q_PROPERTY(QString redoShortcut READ redoShortcut WRITE setRedoShortcut NOTIFY
38 Q_PROPERTY(QString copyShortcut READ copyShortcut WRITE setCopyShortcut NOTIFY
40 Q_PROPERTY(QString cutShortcut READ cutShortcut WRITE setCutShortcut NOTIFY
42 Q_PROPERTY(QString pasteShortcut READ pasteShortcut WRITE setPasteShortcut
44 Q_PROPERTY(QString optionsShortcut READ optionsShortcut WRITE
46 Q_PROPERTY(QString fullScreenShortcut READ fullScreenShortcut WRITE
48
49 public:
50 explicit Settings(QObject *parent = nullptr);
51 Settings(const QString &organization, const QString &application,
52 QObject *parent = nullptr);
53
56 [[nodiscard]] QString defaultLanguage() const;
59 [[nodiscard]] QString language() const;
62 void setLanguage(const QString &language);
63
66 [[nodiscard]] qreal defaultWindowOpacity() const;
69 [[nodiscard]] qreal windowOpacity() const;
72 void setWindowOpacity(const qreal opacity);
73
76 [[nodiscard]] bool defaultFpsVisible() const;
79 [[nodiscard]] bool isFpsVisible() const;
82 void setFpsVisible(const bool fps_visible);
83
86 [[nodiscard]] QString defaultAppTheme() const;
89 [[nodiscard]] QString appTheme() const;
92 void setAppTheme(const QString &theme);
93
95 Q_INVOKABLE void resetShortcutsToDefaults();
96
99 [[nodiscard]] QString defaultNewShortcut() const;
102 [[nodiscard]] QString newShortcut() const;
105 void setNewShortcut(const QString &shortcut);
106
109 [[nodiscard]] QString defaultOpenShortcut() const;
112 [[nodiscard]] QString openShortcut() const;
115 void setOpenShortcut(const QString &shortcut);
116
119 [[nodiscard]] QString defaultSaveShortcut() const;
122 [[nodiscard]] QString saveShortcut() const;
125 void setSaveShortcut(const QString &shortcut);
126
129 [[nodiscard]] QString defaultSaveAsShortcut() const;
132 [[nodiscard]] QString saveAsShortcut() const;
135 void setSaveAsShortcut(const QString &shortcut);
136
139 [[nodiscard]] QString defaultQuitShortcut() const;
142 [[nodiscard]] QString quitShortcut() const;
145 void setQuitShortcut(const QString &shortcut);
146
149 [[nodiscard]] QString defaultUndoShortcut() const;
152 [[nodiscard]] QString undoShortcut() const;
155 void setUndoShortcut(const QString &shortcut);
156
159 [[nodiscard]] QString defaultRedoShortcut() const;
162 [[nodiscard]] QString redoShortcut() const;
165 void setRedoShortcut(const QString &shortcut);
166
169 [[nodiscard]] QString defaultCopyShortcut() const;
172 [[nodiscard]] QString copyShortcut() const;
175 void setCopyShortcut(const QString &shortcut);
176
179 [[nodiscard]] QString defaultCutShortcut() const;
182 [[nodiscard]] QString cutShortcut() const;
185 void setCutShortcut(const QString &shortcut);
186
189 [[nodiscard]] QString defaultPasteShortcut() const;
192 [[nodiscard]] QString pasteShortcut() const;
195 void setPasteShortcut(const QString &shortcut);
196
199 [[nodiscard]] QString defaultOptionsShortcut() const;
202 [[nodiscard]] QString optionsShortcut() const;
205 void setOptionsShortcut(const QString &shortcut);
206
209 [[nodiscard]] QString defaultFullScreenShortcut() const;
212 [[nodiscard]] QString fullScreenShortcut() const;
215 void setFullScreenShortcut(const QString &shortcut);
216
217 signals:
226
237
248
253};
254
255} // namespace myproject
The Settings class is a singleton that manages the application settings.
Definition settings.h:12
QString language
Definition settings.h:16
bool fpsVisible
Definition settings.h:20
QString defaultFullScreenShortcut() const
Returns the default full screen shortcut for the application.
Definition settings.cpp:258
bool defaultFpsVisible() const
Returns the default FPS visibility for the application.
Definition settings.cpp:43
QString copyShortcut
Definition settings.h:39
void saveAsShortcutChanged()
Emitted when the save as shortcut is changed.
bool isFpsVisible() const
Returns the current FPS visibility for the application.
Definition settings.cpp:45
void setPasteShortcut(const QString &shortcut)
Sets the current paste shortcut for the application.
Definition settings.cpp:233
qreal defaultWindowOpacity() const
Returns the default window opacity for the application.
Definition settings.cpp:30
void fpsVisibleChanged()
Emitted when the FPS visibility is changed.
void setOptionsShortcut(const QString &shortcut)
Sets the current options shortcut for the application.
Definition settings.cpp:249
QString fullScreenShortcut
Definition settings.h:47
void setWindowOpacity(const qreal opacity)
Sets the current window opacity for the application.
Definition settings.cpp:36
void setNewShortcut(const QString &shortcut)
Sets the current new shortcut for the application.
Definition settings.cpp:89
QString openShortcut
Definition settings.h:27
QString defaultCopyShortcut() const
Returns the default copy shortcut for the application.
Definition settings.cpp:193
QString defaultSaveShortcut() const
Returns the default save shortcut for the application.
Definition settings.cpp:113
void openShortcutChanged()
Emitted when the open shortcut is changed.
void setUndoShortcut(const QString &shortcut)
Sets the current undo shortcut for the application.
Definition settings.cpp:169
QString newShortcut
Definition settings.h:25
QString defaultOpenShortcut() const
Returns the default open shortcut for the application.
Definition settings.cpp:97
QString defaultLanguage() const
Returns the default language for the application.
Definition settings.cpp:17
void setAppTheme(const QString &theme)
Sets the current app theme for the application.
Definition settings.cpp:62
void setLanguage(const QString &language)
Sets the current language for the application.
Definition settings.cpp:23
Q_INVOKABLE void resetShortcutsToDefaults()
Resets all shortcuts to their default values.
Definition settings.cpp:69
QString saveShortcut
Definition settings.h:29
QString redoShortcut
Definition settings.h:37
void newShortcutChanged()
Emitted when the new shortcut is changed.
QString cutShortcut
Definition settings.h:41
void setRedoShortcut(const QString &shortcut)
Sets the current redo shortcut for the application.
Definition settings.cpp:185
void redoShortcutChanged()
Emitted when the redo shortcut is changed.
qreal windowOpacity
Definition settings.h:18
void setQuitShortcut(const QString &shortcut)
Sets the current quit shortcut for the application.
Definition settings.cpp:153
void optionsShortcutChanged()
Emitted when the options shortcut is changed.
QString defaultSaveAsShortcut() const
Returns the default save as shortcut for the application.
Definition settings.cpp:129
void setSaveShortcut(const QString &shortcut)
Sets the current save shortcut for the application.
Definition settings.cpp:121
void fullScreenShortcutChanged()
Emitted when the full screen shortcut is changed.
void pasteShortcutChanged()
Emitted when the paste shortcut is changed.
void undoShortcutChanged()
Emitted when the undo shortcut is changed.
void cutShortcutChanged()
Emitted when the cut shortcut is changed.
void quitShortcutChanged()
Emitted when the quit shortcut is changed.
void saveShortcutChanged()
Emitted when the save shortcut is changed.
QString defaultCutShortcut() const
Returns the default cut shortcut for the application.
Definition settings.cpp:209
QString undoShortcut
Definition settings.h:35
QString defaultAppTheme() const
Returns the default app theme for the application.
Definition settings.cpp:56
QString defaultUndoShortcut() const
Returns the default undo shortcut for the application.
Definition settings.cpp:161
QString defaultOptionsShortcut() const
Returns the default options shortcut for the application.
Definition settings.cpp:241
QString defaultQuitShortcut() const
Returns the default quit shortcut for the application.
Definition settings.cpp:145
void copyShortcutChanged()
Emitted when the copy shortcut is changed.
QString saveAsShortcut
Definition settings.h:31
void setSaveAsShortcut(const QString &shortcut)
Sets the current save as shortcut for the application.
Definition settings.cpp:137
QString pasteShortcut
Definition settings.h:43
QString quitShortcut
Definition settings.h:33
void languageChanged()
Emitted when the language is changed.
void setCopyShortcut(const QString &shortcut)
Sets the current copy shortcut for the application.
Definition settings.cpp:201
void windowOpacityChanged()
Emitted when the window opacity is changed.
QString appTheme
Definition settings.h:22
void setFpsVisible(const bool fps_visible)
Sets the current FPS visibility for the application.
Definition settings.cpp:49
QString defaultPasteShortcut() const
Returns the default paste shortcut for the application.
Definition settings.cpp:225
QString defaultNewShortcut() const
Returns the default new shortcut for the application.
Definition settings.cpp:81
QString defaultRedoShortcut() const
Returns the default redo shortcut for the application.
Definition settings.cpp:177
void setOpenShortcut(const QString &shortcut)
Sets the current open shortcut for the application.
Definition settings.cpp:105
QString optionsShortcut
Definition settings.h:45
void setCutShortcut(const QString &shortcut)
Sets the current cut shortcut for the application.
Definition settings.cpp:217
void setFullScreenShortcut(const QString &shortcut)
Sets the current full screen shortcut for the application.
Definition settings.cpp:266
void appThemeChanged()
Emitted when the app theme is changed.
Definition application.cpp:63