@@ -15,73 +15,111 @@ namespace QtMvvm {
1515// ! A sub namespace for the different elements in a settings setup
1616namespace SettingsElements {
1717
18+ // ! An entry in the settings to display and edit a value
1819struct Entry
1920{
21+ // ! The QSettings key this entry should handle
2022 QString key;
23+ // ! The input view type (typically the actual data type) to show
2124 QByteArray type;
25+ // ! A short title/label of the entry to give it a name
2226 QString title;
27+ // ! A tooltip with more detailed information about the entry
2328 QString tooltip;
29+ // ! A default value to display in case no value is in the settings yet
2430 QVariant defaultValue;
31+ // ! A list of keys to find this entry by when searching
2532 QStringList searchKeys;
33+ // ! Additional properties to be passed on to the edit view
2634 QVariantMap properties;
2735
36+ // ! *[Internal]* A logical string describing the allowed frontends
2837 QString frontends;
38+ // ! *[Internal]* A logical string describing the allowed selectors
2939 QString selectors;
3040};
3141
42+ // ! A logical group of settings entries
3243struct Group
3344{
45+ // ! The groups title
3446 QString title;
47+ // ! A tooltip to describe what the group is about
3548 QString tooltip;
3649
50+ // ! A list of entries the group contains
3751 QList<Entry> entries;
3852
53+ // ! *[Internal]* A logical string describing the allowed frontends
3954 QString frontends;
55+ // ! *[Internal]* A logical string describing the allowed selectors
4056 QString selectors;
4157};
4258
59+ // ! A bigger section for different entries and groups
4360struct Section
4461{
62+ // ! The sections title
4563 QString title;
64+ // ! An icon for the section
4665 QUrl icon;
66+ // ! A tooltip to describe what the section is about
4767 QString tooltip;
4868
69+ // ! A list of groups the section contains
4970 QList<Group> groups;
5071
72+ // ! *[Internal]* A logical string describing the allowed frontends
5173 QString frontends;
74+ // ! *[Internal]* A logical string describing the allowed selectors
5275 QString selectors;
5376};
5477
78+ // ! A top level category to organize sections in
5579struct Category
5680{
81+ // ! The categories title
5782 QString title;
83+ // ! An icon for the category
5884 QUrl icon;
85+ // ! A tooltip to describe what the category is about
5986 QString tooltip;
6087
88+ // ! A list of sections the category contains
6189 QList<Section> sections;
6290
91+ // ! *[Internal]* A logical string describing the allowed frontends
6392 QString frontends;
93+ // ! *[Internal]* A logical string describing the allowed selectors
6494 QString selectors;
6595};
6696
97+ // ! The whole settings setup
6798struct Setup
6899{
100+ // ! Specifies if the user is allowed to search in the settings
69101 bool allowSearch = true ;
102+ // ! Specifies if the user is allowed to restore the factory defaults
70103 bool allowRestore = true ;
71104
105+ // ! A list of categories the setup is build of
72106 QList<Category> categories;
73107};
74108
75109}
76110
111+ // ! An exception throw in case loading a settings setup went wrong
77112class SettingsLoaderException : public QException {};
78113
114+ // ! An interface for a generic settings setup loader
79115class ISettingsSetupLoader
80116{
81117public:
82118 virtual inline ~ISettingsSetupLoader () = default ;
83119
120+ // ! Can be used to overwrite the default icon for categories
84121 virtual void changeDefaultIcon (const QUrl &defaultIcon) = 0;
122+ // ! Loads the settings setup from the given file
85123 virtual SettingsElements::Setup loadSetup (const QString &filePath, const QString &frontend, const QFileSelector *selector) const = 0;
86124};
87125
@@ -93,8 +131,10 @@ Q_DECLARE_METATYPE(QtMvvm::SettingsElements::Section)
93131Q_DECLARE_METATYPE(QtMvvm::SettingsElements::Category)
94132Q_DECLARE_METATYPE(QtMvvm::SettingsElements::Setup)
95133
134+ // ! The Iid of the QtMvvm::ISettingsSetupLoader class
96135#define QtMvvm_ISettingsSetupLoaderIid " de.skycoder42.qtmvvm.settings.core.ISettingsSetupLoader"
97136Q_DECLARE_INTERFACE (QtMvvm::ISettingsSetupLoader, QtMvvm_ISettingsSetupLoaderIid)
98137Q_DECLARE_METATYPE(QtMvvm::ISettingsSetupLoader*)
99138
139+ // ! @file settingssetup.h The settings setup header
100140#endif // QTMVVM_SETTINGSSETUP_H
0 commit comments