Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit 4729b29

Browse files
committed
updated settings doc, try prebuilt image
1 parent a60dfd4 commit 4729b29

File tree

5 files changed

+146
-56
lines changed

5 files changed

+146
-56
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ matrix:
2020
- PLATFORM=gcc_64
2121
- BUILD_DOC=true
2222
- BUILD_EXAMPLES=true
23+
- DOCKER_IMAGE=datasync
2324
- os: linux
2425
env:
2526
- PLATFORM=android_armv7

doc/settingssetup.dox

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*!
2+
@class QtMvvm::ISettingsSetupLoader
3+
4+
It is used by the SettingsViewModel to load a SettingsElements::Setup from a generic file. The
5+
default implementation that is used by default implements a loader for an XML format. You can
6+
implement your own format, but unless you need to open things other then normal files/resources
7+
(or hate XML), there is no advantage of doing so.
8+
9+
@sa #QtMvvm_ISettingsSetupLoaderIid, SettingsViewModel, SettingsLoaderException,
10+
SettingsElements::Setup, TODO link to xml doc
11+
*/
12+
13+
/*!
14+
@fn QtMvvm::ISettingsSetupLoader::changeDefaultIcon
15+
16+
@param defaultIcon The URL to the icon to use as overwrite
17+
18+
The default icon used by the XML loader is `qrc:/de/skycoder42/qtmvvm/icons/settings.svg`. If
19+
you want to overwrite that path (for example because you want to use a png instead of a svg
20+
icon) you can do so via this function
21+
22+
@sa SettingsDialog::iconOverwrite
23+
*/
24+
25+
/*!
26+
@fn QtMvvm::ISettingsSetupLoader::loadSetup
27+
28+
@param filePath The path to the file to be loaded
29+
@param frontend The name of the GUI frontend beeing used
30+
@param selector The currently active file selectors
31+
@returns The loaded and filtered settings setup
32+
@throws SettingsLoaderException In case the loaded file is invalid
33+
34+
The frontend is used to filter elements by their `frontends` variable. It is always the name of
35+
the view type that is loading the settings via the viewmodel. Current values are:
36+
37+
- `widgets` for the Widgets GUI
38+
- `quick` for the Quick Controls 2 GUI
39+
40+
The selector should be used to a.) select the files to open (event the one passed). Use the
41+
select method to apply the paths. This applies for the elements as well, via the `selectors`
42+
variable.
43+
44+
@note The syntax etc of these two variables depends on your loader and they are only used by you,
45+
not by anyone using this method. The default syntax used by the XML load implementation can be
46+
found in the TODO xml doc
47+
48+
@sa SettingsElements::Setup, QFileSelector, TODO xml doc
49+
*/

src/mvvmcore/settingssetup.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,73 +15,111 @@ namespace QtMvvm {
1515
//! A sub namespace for the different elements in a settings setup
1616
namespace SettingsElements {
1717

18+
//! An entry in the settings to display and edit a value
1819
struct 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
3243
struct 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
4360
struct 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
5579
struct 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
6798
struct 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
77112
class SettingsLoaderException : public QException {};
78113

114+
//! An interface for a generic settings setup loader
79115
class ISettingsSetupLoader
80116
{
81117
public:
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)
93131
Q_DECLARE_METATYPE(QtMvvm::SettingsElements::Category)
94132
Q_DECLARE_METATYPE(QtMvvm::SettingsElements::Setup)
95133

134+
//! The Iid of the QtMvvm::ISettingsSetupLoader class
96135
#define QtMvvm_ISettingsSetupLoaderIid "de.skycoder42.qtmvvm.settings.core.ISettingsSetupLoader"
97136
Q_DECLARE_INTERFACE(QtMvvm::ISettingsSetupLoader, QtMvvm_ISettingsSetupLoaderIid)
98137
Q_DECLARE_METATYPE(QtMvvm::ISettingsSetupLoader*)
99138

139+
//! @file settingssetup.h The settings setup header
100140
#endif // QTMVVM_SETTINGSSETUP_H

0 commit comments

Comments
 (0)