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

Commit 4eb589f

Browse files
committed
updated datasync core doc
1 parent 872a44a commit 4eb589f

10 files changed

+189
-5
lines changed

doc/datasyncsettingsentry.dox

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*!
2+
@class QtMvvm::DataSyncSettingsAccessor
3+
4+
The data is stored by using the DataSyncSettingsEntry class to wrap the key value pairs into a
5+
serializable datatype.
6+
7+
@sa DataSyncSettingsEntry
8+
*/
9+
10+
11+
12+
/*!
13+
@class QtMvvm::DataSyncSettingsEntry
14+
15+
In order to be consistend with other settings implementations and the requirements of
16+
ISettingsAccessor, the actual value stored in this class is serialized not via the json
17+
serializer, but using QDataStream. The resulting binary data is stored as the
18+
valueData property in base64 format. When loaded, you can access the data
19+
in the QVariant format using the DataSyncSettingsEntry::value property.
20+
21+
@sa DataSyncSettingsAccessor
22+
*/
23+
24+
/*!
25+
@property QtMvvm::DataSyncSettingsEntry::key
26+
27+
@default{<i>empty</i>}
28+
29+
The key is simply the settings key used to identify the entry. Thus, it is set as the user
30+
property.
31+
32+
@accessors{
33+
@readAc{key()}
34+
@writeAc{setKey()}
35+
@userAc{`true`}
36+
}
37+
38+
@sa DataSyncSettingsEntry::variantValue
39+
*/
40+
41+
/*!
42+
@property QtMvvm::DataSyncSettingsEntry::dataVersion
43+
44+
@default{`QDataStream::Qt_DefaultCompiledVersion`}
45+
46+
The version is needed to identify the format used for the serialization to be able to
47+
properly deserialize the data again. It is used internally to set up the internal QDataStream
48+
49+
@accessors{
50+
@readAc{dataVersion()}
51+
@writeAc{setDataVersion()}
52+
}
53+
54+
@sa DataSyncSettingsEntry::value
55+
*/
56+
57+
/*!
58+
@property QtMvvm::DataSyncSettingsEntry::value
59+
60+
@default{<i>invalid</i>}
61+
62+
The data of the entry. This property does not get stored directly, but instead gets serialized
63+
to a QByteArray and then stored via the internal valueData property.
64+
65+
@accessors{
66+
@readAc{value()}
67+
@writeAc{setValue()}
68+
@storedAc{`false`}
69+
}
70+
71+
@sa DataSyncSettingsEntry::valueData
72+
*/

doc/datasyncsettingsviewmodel.dox

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*!
2+
@var QtMvvm::DataSyncSettingsViewModel::paramSetup
3+
4+
<b>Value:</b> `"setup"`
5+
6+
@sa DataSyncSettingsViewModel::showParams
7+
*/
8+
9+
/*!
10+
@var QtMvvm::DataSyncSettingsViewModel::paramDataStore
11+
12+
<b>Value:</b> `"dataStore"`
13+
14+
@sa DataSyncSettingsViewModel::showParams
15+
*/
16+
17+
/*!
18+
@var QtMvvm::DataSyncSettingsViewModel::paramDataTypeStore
19+
20+
<b>Value:</b> `"dataTypeStore"`
21+
22+
@sa DataSyncSettingsViewModel::showParams
23+
*/
24+
25+
/*!
26+
@fn QtMvvm::DataSyncSettingsViewModel::showParams(const QString &, const QString &)
27+
28+
@param setup The name of the QtDataSync::Setup to be passed to the internally used
29+
DataSyncSettingsAccessor
30+
@param setupFile The path to a file to be used to create the settings. Can be empty to use the
31+
default path
32+
@return A paramater hash to be passed to ViewModel::show
33+
34+
It's a shortcut to generate parameters for the show methods to show a settings viewmodel.
35+
36+
@note Unless you need to explicitly set the settings or setup file a normal show without any
37+
parameters will just do fine.
38+
39+
@sa ViewModel::show, DataSyncSettingsViewModel::paramSetup, SettingsViewModel::paramSetupFile,
40+
DataSyncSettingsAccessor
41+
*/
42+
43+
/*!
44+
@fn QtMvvm::DataSyncSettingsViewModel::showParams(QtDataSync::DataStore*, const QString &)
45+
46+
@param dataStore The store to be passed to the internally used DataSyncSettingsAccessor
47+
@param setupFile The path to a file to be used to create the settings. Can be empty to use the
48+
default path
49+
@return A paramater hash to be passed to ViewModel::show
50+
51+
It's a shortcut to generate parameters for the show methods to show a settings viewmodel.
52+
53+
@note Unless you need to explicitly set the settings or setup file a normal show without any
54+
parameters will just do fine.
55+
56+
@sa ViewModel::show, DataSyncSettingsViewModel::paramDataStore,
57+
SettingsViewModel::paramSetupFile, DataSyncSettingsAccessor
58+
*/
59+
60+
/*!
61+
@fn QtMvvm::DataSyncSettingsViewModel::showParams(QtDataSync::DataTypeStore<DataSyncSettingsEntry>*, const QString &)
62+
63+
@param dataStore The store to be passed to the internally used DataSyncSettingsAccessor
64+
@param setupFile The path to a file to be used to create the settings. Can be empty to use the
65+
default path
66+
@return A paramater hash to be passed to ViewModel::show
67+
68+
It's a shortcut to generate parameters for the show methods to show a settings viewmodel.
69+
70+
@note Unless you need to explicitly set the settings or setup file a normal show without any
71+
parameters will just do fine.
72+
73+
@sa ViewModel::show, DataSyncSettingsViewModel::paramDataTypeStore,
74+
SettingsViewModel::paramSetupFile, DataSyncSettingsAccessor
75+
*/
76+

doc/makedoc.sh

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ for tagFile in $(find "$qtDocs" -name *.tags); do
4848
qtdatasync.tags)
4949
echo "TAGFILES += \"$tagFile=https://skycoder42.github.io/QtDataSync\"" >> $doxyRes
5050
;;
51+
qtservice.tags)
52+
echo "TAGFILES += \"$tagFile=https://skycoder42.github.io/QtService\"" >> $doxyRes
53+
;;
5154
qtmvvm.tags|qtquickcontrols.tags)
5255
# skipped
5356
;;

doc/networkexchangeviewmodel.dox

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Changing this property will trigger start and stop actions on the underlying man
6363
the other information provided from this viewmodel.
6464

6565
@accessors{
66-
@readAc{active()}
66+
@readAc{isActive()}
6767
@writeAc{setActive()}
6868
@notifyAc{activeChanged()}
6969
}

src/mvvmcore/qsettingsaccessor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Q_MVVMCORE_EXPORT QSettingsAccessor : public ISettingsAccessor
1717
Q_INTERFACES(QtMvvm::ISettingsAccessor)
1818

1919
public:
20-
//! Constructor
20+
//! Default Constructor
2121
Q_INVOKABLE explicit QSettingsAccessor(QObject *parent = nullptr);
2222
//! Constructor, with settings to be used (takes ownership of the settings)
2323
explicit QSettingsAccessor(QSettings *settings, QObject *parent = nullptr);

src/mvvmcore/settingsviewmodel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Q_MVVMCORE_EXPORT SettingsViewModel : public ViewModel
4141

4242
//! Generates show parameter to show a settings viewmodel via ViewModel::show
4343
static QVariantHash showParams(ISettingsAccessor *accessor, const QString &setupFile = {});
44-
//! @copydetails SettingsViewModel::showParams(ISettingsAccessor*, const QString &)
44+
//! @copybrief SettingsViewModel::showParams(ISettingsAccessor*, const QString &)
4545
static QVariantHash showParams(QSettings *settings, const QString &setupFile = {});
4646

4747
//! Invokable constructor

src/mvvmdatasynccore/datasyncsettingsaccessor.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void DataSyncSettingsAccessor::remove(const QString &key)
9090
void DataSyncSettingsAccessor::sync()
9191
{
9292
// nothing needs to be done
93+
//TODO implement via manager sync with blocking eventloop?
9394
}
9495

9596
void DataSyncSettingsAccessor::dataChanged(const QString &key, const QVariant &value)

src/mvvmdatasynccore/datasyncsettingsaccessor.h

+6
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,20 @@
1111
namespace QtMvvm {
1212

1313
class DataSyncSettingsAccessorPrivate;
14+
//! A settings accessor implementation that allows to store and sync settings via datasync
1415
class Q_MVVMDATASYNCCORE_EXPORT DataSyncSettingsAccessor : public ISettingsAccessor
1516
{
1617
Q_OBJECT
1718
Q_INTERFACES(QtMvvm::ISettingsAccessor)
1819

1920
public:
21+
//! Default Constructor
2022
Q_INVOKABLE explicit DataSyncSettingsAccessor(QObject *parent = nullptr);
23+
//! Constructor, with the name of the datasync setup to use
2124
explicit DataSyncSettingsAccessor(const QString &setupName, QObject *parent = nullptr);
25+
//! Constructor, with the store to use for access. Does not take ownership
2226
explicit DataSyncSettingsAccessor(QtDataSync::DataStore *store, QObject *parent = nullptr);
27+
//! Constructor, with the store to use for access. Does not take ownership
2328
explicit DataSyncSettingsAccessor(QtDataSync::DataTypeStore<DataSyncSettingsEntry> *store, QObject *parent = nullptr);
2429
~DataSyncSettingsAccessor() override;
2530

@@ -29,6 +34,7 @@ class Q_MVVMDATASYNCCORE_EXPORT DataSyncSettingsAccessor : public ISettingsAcces
2934
void remove(const QString &key) override;
3035

3136
public Q_SLOTS:
37+
//! @copydoc ISettingsAccessor::sync
3238
void sync() override;
3339

3440
private Q_SLOTS:

src/mvvmdatasynccore/datasyncsettingsentry.h

+20-2
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,55 @@
1010
namespace QtMvvm {
1111

1212
class DataSyncSettingsEntryData;
13+
//! A class used with the DataSyncSettingsAccessor to store and sync generic settings
1314
struct Q_MVVMDATASYNCCORE_EXPORT DataSyncSettingsEntry
1415
{
1516
Q_GADGET
1617

18+
//! They key of the entry stored
1719
Q_PROPERTY(QString key READ key WRITE setKey USER true)
20+
//! The QDataStream::Version that was used to serialize the entry
1821
Q_PROPERTY(int dataVersion READ dataVersion WRITE setDataVersion)
19-
Q_PROPERTY(QByteArray value READ valueData WRITE setValueData)
22+
//! The raw (deserialized) value stored
23+
Q_PROPERTY(QVariant value READ value WRITE setValue STORED false)
2024

21-
Q_PROPERTY(QVariant variantValue READ value WRITE setValue STORED false)
25+
//! @private Internal property
26+
Q_PROPERTY(QByteArray valueData READ valueData WRITE setValueData)
2227

2328
public:
2429
DataSyncSettingsEntry();
2530
~DataSyncSettingsEntry();
31+
//! Copy constructor
2632
DataSyncSettingsEntry(const DataSyncSettingsEntry &other);
33+
//! Move constructor
2734
DataSyncSettingsEntry(DataSyncSettingsEntry &&other) noexcept;
35+
//! Copy assignment operator
2836
DataSyncSettingsEntry &operator=(const DataSyncSettingsEntry &other);
37+
//! Move assignment operator
2938
DataSyncSettingsEntry &operator=(DataSyncSettingsEntry &&other) noexcept;
3039

40+
//! Constructor, takes a key and value
3141
DataSyncSettingsEntry(QString key, QVariant value);
42+
//! @copybrief DataSyncSettingsEntry::DataSyncSettingsEntry(QString, QVariant)
3243
template <typename T>
3344
DataSyncSettingsEntry(QString key, const T &value);
3445

46+
//! @readAcFn{key}
3547
QString key() const;
48+
//! @readAcFn{dataVersion}
3649
int dataVersion() const;
3750

51+
//! @readAcFn{variantValue}
3852
QVariant value() const;
53+
//! @readAcFn{variantValue}
3954
template <typename T>
4055
T value() const;
4156

57+
//! @writeAcFn{key}
4258
void setKey(QString key);
59+
//! @writeAcFn{dataVersion}
4360
void setDataVersion(int dataVersion);
61+
//! @writeAcFn{variantValue}
4462
void setValue(QVariant value);
4563

4664
private:

src/mvvmdatasynccore/datasyncsettingsviewmodel.h

+8
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,27 @@
1313

1414
namespace QtMvvm {
1515

16+
//! An extension of the normal settings viewmodel with the DataSyncSettingsAccessor as accessor
1617
class Q_MVVMDATASYNCCORE_EXPORT DataSyncSettingsViewModel : public QtMvvm::SettingsViewModel
1718
{
1819
Q_OBJECT
1920

2021
public:
22+
//! The parameter for a setup name for the onInit() method
2123
static const QString paramSetup;
24+
//! The parameter for a QtDataSync::DataStore object for the onInit() method
2225
static const QString paramDataStore;
26+
//! The parameter for a QtDataSync::DataTypeStore object for the onInit() method
2327
static const QString paramDataTypeStore;
2428

29+
//! @copybrief SettingsViewModel::showParams(ISettingsAccessor*, const QString &)
2530
static QVariantHash showParams(const QString &setup, const QString &setupFile = {});
31+
//! @copybrief SettingsViewModel::showParams(ISettingsAccessor*, const QString &)
2632
static QVariantHash showParams(QtDataSync::DataStore *dataStore, const QString &setupFile = {});
33+
//! @copybrief SettingsViewModel::showParams(ISettingsAccessor*, const QString &)
2734
static QVariantHash showParams(QtDataSync::DataTypeStore<DataSyncSettingsEntry> *dataStore, const QString &setupFile = {});
2835

36+
//! Invokable constructor
2937
Q_INVOKABLE explicit DataSyncSettingsViewModel(QObject *parent = nullptr);
3038

3139
protected:

0 commit comments

Comments
 (0)