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

Commit 4f627c7

Browse files
committed
completed datasync core doc
1 parent e02b588 commit 4f627c7

File tree

9 files changed

+520
-13
lines changed

9 files changed

+520
-13
lines changed

doc/datasyncviewmodel.dox

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
/*!
2+
@class QtMvvm::DataSyncViewModel
3+
4+
The viewmodel provides data to show a ui that gives access to all of the important datasync
5+
account features and the synchronization status. The uis should show:
6+
7+
- The sync status as string (DataSyncViewModel::statusString)
8+
- A sync progress when actively syncing (QtDataSync::SyncManager::syncProgress)
9+
- A possible error string, if an error occurs (QtDataSync::SyncManager::lastError)
10+
- A list of all devices of the account (DataSyncViewModel::sortedModel)
11+
- Actions to:
12+
- Synchronize (syncOrConnect())
13+
- Toggle synchronization (QtDataSync::SyncManager::syncEnabled)
14+
- Edit the identity (showDeviceInfo())
15+
- Reload the list of devices (QtDataSync::AccountManager::listDevices)
16+
- Remove devices (removeDevice())
17+
- Update the exchange key (QtDataSync::AccountManager::updateExchangeKey)
18+
- Change the remote server (changeRemote())
19+
- Reset the account (performReset())
20+
- Export the account data (startExport())
21+
- Import the account data (startImport())
22+
- Show the exchange viewmodel (startNetworkExchange())
23+
24+
@sa QtDataSync, NetworkExchangeViewModel
25+
*/
26+
27+
/*!
28+
@property QtMvvm::DataSyncViewModel::syncManager
29+
30+
@default{`nullptr` (Is initialized by onInit())}
31+
32+
A reference to the sync manager the view model internally uses. Is owned by the viewmodel, but
33+
can be used to get properties for the ui.
34+
35+
@accessors{
36+
@readAc{syncManager()}
37+
@notifyAc{syncManagerChanged()}
38+
}
39+
40+
@sa DataSyncViewModel::accountManager
41+
*/
42+
43+
/*!
44+
@property QtMvvm::DataSyncViewModel::accountManager
45+
46+
@default{`nullptr` (Is initialized by onInit())}
47+
48+
A reference to the account manager the view model internally uses. Is owned by the viewmodel,
49+
but can be used to get properties for the ui.
50+
51+
@accessors{
52+
@readAc{accountManager()}
53+
@notifyAc{accountManagerChanged()}
54+
}
55+
56+
@sa DataSyncViewModel::syncManager
57+
*/
58+
59+
/*!
60+
@property QtMvvm::DataSyncViewModel::colorMap
61+
62+
@default{A map inizialized as:}
63+
Key | Value
64+
----------------------------------------|-------
65+
QtDataSync::SyncManager::Initializing | Qt::darkCyan
66+
QtDataSync::SyncManager::Downloading | Qt::darkCyan
67+
QtDataSync::SyncManager::Uploading | Qt::darkCyan
68+
QtDataSync::SyncManager::Synchronized | Qt::darkGreen
69+
QtDataSync::SyncManager::Error | Qt::darkRed
70+
QtDataSync::SyncManager::Disconnected | Qt::darkYellow
71+
72+
This map is used by the DataSyncViewModel::statusString property to determine the color of the
73+
status string, based of the state itself. You can change this property if you need different
74+
colors for your theme.
75+
76+
@accessors{
77+
@readAc{colorMap()}
78+
@writeAc{setColorMap()}
79+
@resetAc{resetColorMap()}
80+
@notifyAc{colorMapChanged()}
81+
}
82+
83+
@sa DataSyncViewModel::statusString, DataSyncViewModel::ColorMap
84+
*/
85+
86+
/*!
87+
@property QtMvvm::DataSyncViewModel::statusString
88+
89+
@default{`Disconnected`}
90+
91+
A localized string to display the sync state as a single, simple string. The string is styled
92+
with different colors based of the DataSyncViewModel::colorMap property.
93+
94+
@accessors{
95+
@readAc{statusString()}
96+
@notifyAc{statusStringChanged()}
97+
}
98+
99+
@sa DataSyncViewModel::colorMap, QtDataSync::SyncManager::syncState
100+
*/
101+
102+
/*!
103+
@property QtMvvm::DataSyncViewModel::accountModel
104+
105+
@default{<i>An account model</i>}
106+
107+
An unsorted model with all the devices of the current account. Automatically initialized and
108+
managed by the viewmodel.
109+
110+
@note You should use the DataSyncViewModel::sortedModel property when creating views. It is
111+
a sorted version of this model, which is better for users.
112+
113+
@accessors{
114+
@readAc{accountModel()}
115+
@constantAc
116+
}
117+
118+
@sa DataSyncViewModel::sortedModel
119+
*/
120+
121+
/*!
122+
@property QtMvvm::DataSyncViewModel::sortedModel
123+
124+
@default{<i>The accountModel, sorted</i>}
125+
126+
A sorted proxy to the DataSyncViewModel::accountModel. You should prefer this sorted version
127+
when binding views to the viewmodel.
128+
129+
@accessors{
130+
@readAc{sortedModel()}
131+
@constantAc
132+
}
133+
134+
@sa DataSyncViewModel::accountModel
135+
*/
136+
137+
/*!
138+
@var QtMvvm::DataSyncViewModel::paramSetup
139+
140+
<b>Value:</b> `"setup"`
141+
142+
@sa DataSyncViewModel::showParams
143+
*/
144+
145+
/*!
146+
@var QtMvvm::DataSyncViewModel::paramReplicaNode
147+
148+
<b>Value:</b> `"node"`
149+
150+
@sa DataSyncViewModel::showParams
151+
*/
152+
153+
/*!
154+
@fn QtMvvm::DataSyncViewModel::showParams(const QString &)
155+
156+
@param setup The name of the QtDataSync::Setup to create the viewmodel for
157+
@return A paramater hash to be passed to ViewModel::show
158+
159+
It's a shortcut to generate parameters for the show methods to show a datasync viewmodel. Use
160+
them as:
161+
162+
@code{.cpp}
163+
show<QtMvvm::DataSyncViewModel>(QtMvvm::DataSyncViewModel::showParams(...));
164+
@endcode
165+
166+
@note Unless you need to explicitly set the setup or node a normal show without any parameters
167+
will just do fine.
168+
169+
@sa ViewModel::show, DataSyncViewModel::paramSetup
170+
*/
171+
172+
/*!
173+
@fn QtMvvm::DataSyncViewModel::showParams(QRemoteObjectNode*)
174+
175+
@param node The node to use to get the replicas for the managers
176+
@return A paramater hash to be passed to ViewModel::show
177+
178+
It's a shortcut to generate parameters for the show methods to show a datasync viewmodel. Use
179+
them as:
180+
181+
@code{.cpp}
182+
show<QtMvvm::DataSyncViewModel>(QtMvvm::DataSyncViewModel::showParams(...));
183+
@endcode
184+
185+
@note Unless you need to explicitly set the setup or node a normal show without any parameters
186+
will just do fine.
187+
188+
@sa ViewModel::show, DataSyncViewModel::paramReplicaNode
189+
*/
190+
191+
/*!
192+
@fn QtMvvm::DataSyncViewModel::formatFingerPrint
193+
194+
@param fingerPrint The fingerprint as a binary string
195+
@return A human readable string in hex format
196+
197+
The returned string will be of the format:
198+
@code
199+
AB:CD:EF:01:02:03:...
200+
@endcode
201+
202+
@sa QtDataSync::AccountManager::deviceFingerprint, QtDataSync::DeviceInfo::fingerprint
203+
*/
204+
205+
/*!
206+
@fn QtMvvm::DataSyncViewModel::removeDevice
207+
208+
@param sortedIndex The index in the sorted model to be removed
209+
210+
@warning The passed index **must** be an index from the DataSyncViewModel::sortedModel! It is
211+
translated to an account model index and the passed to AccountModel::removeDevice. If you do
212+
not use the sorted model, use the account model remove directly. If you use the sorted model
213+
(as recommended) use this method.
214+
215+
@sa AccountModel::removeDevice, DataSyncViewModel::sortedModel
216+
*/

doc/networkexchangeviewmodel.dox

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/*!
2+
@class QtMvvm::NetworkExchangeViewModel
3+
4+
The viewmodel provides data to show a ui that allows you to exchange your user data with
5+
another device in the same local network.
6+
7+
@sa QtDataSync::UserExchangeManager, DataSyncViewModel
8+
*/
9+
10+
/*!
11+
@property QtMvvm::NetworkExchangeViewModel::userExchangeManager
12+
13+
@default{`nullptr` (Is initialized by onInit())}
14+
15+
A reference to the user exchange manager the view model internally uses. Is owned by the
16+
viewmodel, but can be used to get properties for the ui.
17+
18+
@accessors{
19+
@readAc{userExchangeManager()}
20+
@notifyAc{userExchangeManagerChanged()}
21+
}
22+
*/
23+
24+
/*!
25+
@property QtMvvm::NetworkExchangeViewModel::port
26+
27+
@default{`QtDataSync::UserExchangeManager::DataExchangePort`}
28+
29+
This port is passed to the exchange manager when activated to set the port.
30+
31+
@accessors{
32+
@readAc{port()}
33+
@writeAc{setPort()}
34+
@notifyAc{portChanged()}
35+
}
36+
37+
@sa NetworkExchangeViewModel::active, QtDataSync::UserExchangeManager::startExchange,
38+
QtDataSync::UserExchangeManager::port
39+
*/
40+
41+
/*!
42+
@property QtMvvm::NetworkExchangeViewModel::deviceName
43+
44+
@default{`QtDataSync::AccountManager::deviceName`}
45+
46+
This property is simply a forwarding of the QtDataSync::AccountManager::deviceName property.
47+
48+
@accessors{
49+
@readAc{deviceName()}
50+
@writeAc{setDeviceName()}
51+
@notifyAc{deviceNameChanged()}
52+
}
53+
54+
@sa QtDataSync::AccountManager::deviceName
55+
*/
56+
57+
/*!
58+
@property QtMvvm::NetworkExchangeViewModel::active
59+
60+
@default{`false`}
61+
62+
Changing this property will trigger start and stop actions on the underlying manager, using
63+
the other information provided from this viewmodel.
64+
65+
@accessors{
66+
@readAc{active()}
67+
@writeAc{setActive()}
68+
@notifyAc{activeChanged()}
69+
}
70+
71+
@sa QtDataSync::AccountManager::startExchange, QtDataSync::AccountManager::stopExchange,
72+
NetworkExchangeViewModel::port
73+
*/
74+
75+
/*!
76+
@property QtMvvm::NetworkExchangeViewModel::deviceModel
77+
78+
@default{<i>An exchange device model</i>}
79+
80+
An unsorted model with all the devices available for exchange. Automatically initialized and
81+
managed by the viewmodel.
82+
83+
@note You should use the NetworkExchangeViewModel::sortedModel property when creating views.
84+
It is a sorted version of this model, which is better for users.
85+
86+
@accessors{
87+
@readAc{deviceModel()}
88+
@constantAc
89+
}
90+
91+
@sa NetworkExchangeViewModel::sortedModel
92+
*/
93+
94+
/*!
95+
@property QtMvvm::NetworkExchangeViewModel::sortedModel
96+
97+
@default{<i>The deviceModel, sorted</i>}
98+
99+
A sorted proxy to the NetworkExchangeViewModel::deviceModel. You should prefer this sorted
100+
version when binding views to the viewmodel.
101+
102+
@accessors{
103+
@readAc{sortedModel()}
104+
@constantAc
105+
}
106+
107+
@sa NetworkExchangeViewModel::deviceModel
108+
*/
109+
110+
/*!
111+
@var QtMvvm::NetworkExchangeViewModel::paramSetup
112+
113+
<b>Value:</b> `"setup"`
114+
115+
@sa NetworkExchangeViewModel::showParams
116+
*/
117+
118+
/*!
119+
@var QtMvvm::NetworkExchangeViewModel::paramAccountManager
120+
121+
<b>Value:</b> `"accountManager"`
122+
123+
@sa NetworkExchangeViewModel::showParams
124+
*/
125+
126+
/*!
127+
@fn QtMvvm::NetworkExchangeViewModel::showParams(const QString &)
128+
129+
@param setup The name of the QtDataSync::Setup to create the viewmodel for
130+
@return A paramater hash to be passed to ViewModel::show
131+
132+
It's a shortcut to generate parameters for the show methods to show an exchange viewmodel. Use
133+
them as:
134+
135+
@code{.cpp}
136+
show<QtMvvm::NetworkExchangeViewModel>(QtMvvm::NetworkExchangeViewModel::showParams(...));
137+
@endcode
138+
139+
@note Unless you need to explicitly set the setup or node a normal show without any parameters
140+
will just do fine.
141+
142+
@sa ViewModel::show, NetworkExchangeViewModel::paramSetup
143+
*/
144+
145+
/*!
146+
@fn QtMvvm::NetworkExchangeViewModel::showParams(QtDataSync::AccountManager*)
147+
148+
@param accountManager The account manager to create the exchange manager of
149+
@return A paramater hash to be passed to ViewModel::show
150+
151+
It's a shortcut to generate parameters for the show methods to show an exchange viewmodel. Use
152+
them as:
153+
154+
@code{.cpp}
155+
show<QtMvvm::NetworkExchangeViewModel>(QtMvvm::NetworkExchangeViewModel::showParams(...));
156+
@endcode
157+
158+
@note Unless you need to explicitly set the setup or node a normal show without any parameters
159+
will just do fine.
160+
161+
@sa ViewModel::show, NetworkExchangeViewModel::paramAccountManager
162+
*/
163+
164+
/*!
165+
@fn QtMvvm::NetworkExchangeViewModel::exportTo
166+
167+
@param sortedIndex The index in the sorted model of the device to export to
168+
169+
@warning The passed index **must** be an index from the NetworkExchangeViewModel::sortedModel!
170+
It is translated to an exchange model index and the passed to ExchangeDevicesModel::infoAt to
171+
get the user info of the device to export the data to.
172+
173+
@sa ExchangeDevicesModel::infoAt, NetworkExchangeViewModel::sortedModel
174+
*/

0 commit comments

Comments
 (0)