-
Notifications
You must be signed in to change notification settings - Fork 181
/
Copy pathupdater.dox
479 lines (372 loc) · 16.8 KB
/
updater.dox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
/*!
@class QtAutoUpdater::Updater
The updater class acts as a user friendly frontend to the UpdaterBackend. It is the primary class
of this module and can be used to check for updates and install them, if supported. The actual
feature set of the updater depends on the backend used, but all backends support at least checking
for updates.
@sa @ref index REAMDE.md, QtAutoUpdater::UpdaterBackend, Updater::features,
@ref qtautoupdater_backends "Updater Backend Plugins"
*/
/*!
@property QtAutoUpdater::Updater::features
@default{`UpdaterBackend::CheckUpdates`}
These features depend on what the backend implementation supports and thus differ based on the update
mechanism used for your application. The features dictate what can be done with the backend. All
backends can check for updates, but installing is only supported on some in one way or another.
@accessors{
@readAc{features()}
@constantAc
}
@sa UpdaterBackend::Feature, UpdaterBackend::features()
*/
/*!
@property QtAutoUpdater::Updater::state
@default{`Updater::State::NoUpdates`}
The state represents what the updater is currently doing. Certain operations are only possible in
certain states. For example, you can only install updates if the updater is in the NewUpdates state.
@note If you are only interested in whether the updater is doing something or not, use the running
property instead
@accessors{
@readAc{state()}
@notifyAc{stateChanged()}
}
@sa Updater::checkForUpdates, Updater::running
*/
/*!
@property QtAutoUpdater::Updater::running
@default{`false`}
Convenience property that simplifies the state property into a boolean property that reports whether
the updater is doing something or not. States are mapped as follows:
State | Running
------------|---------
NoUpdates | false
Checking | true
Canceling | true
NewUpdates | false
Installing | true
Error | false
Checking for updates and installing is only possible when the updater is not running
@accessors{
@readAc{isRunning()}
@notifyAc{runningChanged()}
}
@sa Updater::checkForUpdates, Updater::state
*/
/*!
@property QtAutoUpdater::Updater::updateInfo
@default{_<empty list>_}
This property is always empty, unless the state is Updater::State::NewUpdates. In that case, it will
hold the update information of those available updates. Whenever the updater leaves this state, this
property will be cleared as well.
@accessors{
@readAc{updateInfo()}
@notifyAc{updateInfoChanged()}
}
@sa Updater::state, Updater::running, Updater::checkForUpdates
*/
/*!
@property QtAutoUpdater::Updater::runOnExit
@default{`false`}
Specifies if an installer will be launched automatically, as soon as the application exists. This
property is read only, but will be set when runUpdater() leads to an installer beeing queued to be
run on exit.
To reset this property use the cancelExitRun() method. If an exit run was scheduled, this will
disable it. To reenable it, call runUpdater() again
@accessors{
@readAc{willRunOnExit()}
@resetAc{cancelExitRun()}
@notifyAc{runOnExitChanged()}
}
@sa Updater::runUpdater
*/
/*!
@fn QtAutoUpdater::Updater::create(QObject *)
@param parent The object to be set as the parent for the created updater
@returns A newly created updater instance or `nullptr`, if unable to create one.
This method assumes the configuration for the updater to be create is located at a default location.
The location is searched as follows:
1. Windows only: Check for a group name "updater" in the applications default registry group
2. Search all application configuration paths (QStandardPaths::AppConfigLocation) for a file
named updater.conf
3. Search all application data paths (QStandardPaths::AppDataLocation) for a file named updater.conf
If none of these work and no config can be found, nullptr is returned. If it is found, it must
contain the "backend" entry, set to the updater backend to be used. The backend will get initialized
using the found configuration.
@attention For some update installations, an updater needs to be launched on exit of the running
application. This only works if the updater lives long enough to catch the
QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need
to be run on exit, you should use either `qApp` or `nullptr` as parent for the updater.
@sa Updater::supportedUpdaterBackends, @ref qtautoupdater_backends "Updater Backend Plugins"
*/
/*!
@fn QtAutoUpdater::Updater::create(const QString &, QObject *)
@param configPath The path to the configuration file
@param parent The object to be set as the parent for the created updater
@returns A newly created updater instance or `nullptr`, if unable to create one.
The backend is loaded based on the given configuration file, which must be in the
QSettings::IniFormat. It must contain the "backend" entry, set to the updater backend to be used. If
the file does not exists or backend is invalid, nullptr is returned. Otherwise the created instance,
initialized using the given configuration.
@attention For some update installations, an updater needs to be launched on exit of the running
application. This only works if the updater lives long enough to catch the
QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need
to be run on exit, you should use either `qApp` or `nullptr` as parent for the updater.
@sa Updater::supportedUpdaterBackends, @ref qtautoupdater_backends "Updater Backend Plugins"
*/
/*!
@fn QtAutoUpdater::Updater::create(QSettings*, QObject *)
@param config The configuration object
@param parent The object to be set as the parent for the created updater
@returns A newly created updater instance or `nullptr`, if unable to create one.
The backend is loaded based on the given configuration. It must contain the "backend" entry, set to
the updater backend to be used. If the backend is missing or invalid, nullptr is returned. Otherwise
the created instance, initialized using the given configuration.
@attention For some update installations, an updater needs to be launched on exit of the running
application. This only works if the updater lives long enough to catch the
QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need
to be run on exit, you should use either `qApp` or `nullptr` as parent for the updater.
@sa Updater::supportedUpdaterBackends, @ref qtautoupdater_backends "Updater Backend Plugins"
*/
/*!
@fn QtAutoUpdater::Updater::create(QString, QVariantMap, QObject *)
@param key The key of the backend to be loaded
@param configuration The configuration to be passed to the backend to configure it
@param parent The object to be set as the parent for the created updater
@returns A newly created updater instance or `nullptr`, if unable to create one.
The backend is loaded based on the given key. If no backend was found for the key, nullptr is
returned. Otherwise the created instance. The configuration is used to initialize the backend.
@attention For some update installations, an updater needs to be launched on exit of the running
application. This only works if the updater lives long enough to catch the
QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need
to be run on exit, you should use either `qApp` or `nullptr` as parent for the updater.
@sa Updater::supportedUpdaterBackends, @ref qtautoupdater_backends "Updater Backend Plugins"
*/
/*!
@fn QtAutoUpdater::Updater::create(UpdaterBackend::IConfigReader *, QObject *)
@param configReader The configuration reader object
@param parent The object to be set as the parent for the created updater
@returns A newly created updater instance or `nullptr`, if unable to create one.
The backend is loaded based on the given configuration. It must contain the "backend" entry, set to
the updater backend to be used. If the backend is missing or invalid, nullptr is returned. Otherwise
the created instance, initialized using the given configuration.
@note Only use this method if you have to provide your own implementation of the IConfigReader.
Prefer the other overloads.
@attention For some update installations, an updater needs to be launched on exit of the running
application. This only works if the updater lives long enough to catch the
QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need
to be run on exit, you should use either `qApp` or `nullptr` as parent for the updater.
@sa Updater::supportedUpdaterBackends, @ref qtautoupdater_backends "Updater Backend Plugins",
UpdaterBackend::IConfigReader
*/
/*!
@fn QtAutoUpdater::Updater::~Updater
@warning Destroying the updater while it is still running can crash your application! Always make
shure to abort update checks and wait for them to finish before doing so.
@sa Updater::running, Updater::abortUpdateCheck
*/
/*!
@fn QtAutoUpdater::Updater::scheduleUpdate(std::chrono::seconds , bool)
@param delaySeconds The time (in seconds) to wait until the update is started
@param repeated Specifies, whether the updater should be started every `delaySeconds`
or only once
@returns The internal ID of this update task. Can be used to cancel the task
Schedules an update to be run after `delaySeconds` seconds. If `repeated` is `true`, the
updater will not just be run once, but every `delaySeconds` seconds (indefinitly, until
this instance is destroyed or the task canceled).
@note After scheduling the update, you will have no way to track of the schedule.
If the updater is already running while the task is triggered, nothing will happend.
The scheduled update will only work if this instance of the updater is still alive
at that time.
@sa Updater::cancelScheduledUpdate, Updater::checkForUpdates
*/
/*!
@fn QtAutoUpdater::Updater::scheduleUpdate(const QDateTime &)
@param when The timepoint where the update should be started
@returns The internal ID of this update task. Can be used to cancel the task
Schedules an update to be run at `when`. If `when` is in the past, nothing will happen and
0 will be returned. The update will be started once that time is reached (assuming that
this updater instance is still alive at that timepoint).
@note After scheduling the update, you will have no way to track of the schedule.
If the updater is already running while the task is triggered, nothing will happend.
The scheduled update will only work if this instance of the updater is still alive
at that time.
@sa Updater::cancelScheduledUpdate, Updater::checkForUpdates
*/
/*!
@fn QtAutoUpdater::Updater::runUpdater
@param mode The preferred mode to start the updater in
@param scope The preferred scope to use for the updater
@returns `true`, if the update installer was started, false if not
This method launches the installer, based on the given mode, scope and the features that the
backend supports. It will either launch the internal installer ("perform"), by emitting
showInstaller(), launch a parallel external install process immediately ("trigger") and track it's
exection, or mark an external installer to be executed as soon as the application quits ("onExit").
The following table shows which parameters and flags trigger which mode. The flags are evaluated in
the order seen in the table, so if multiple flags are set, those who are displayed here first are
the onces that decide what happens
<table>
<tr>
<th>Mode</th>
<th>Scope</th>
<th>Flags</th>
<th>Result</th>
</tr>
<tr>
<td rowspan="6">`Parallel`</td>
<td rowspan="3">`PreferInternal`</td>
<td>`PerformInstall`</td>
<td>perform</td>
</tr>
<tr>
<td>`ParallelTrigger`</td>
<td>trigger</td>
</tr>
<tr>
<td>`TriggerInstall`</td>
<td>onExit</td>
</tr>
<tr>
<td rowspan="3">`PreferExternal`</td>
<td>`ParallelTrigger`</td>
<td>trigger</td>
</tr>
<tr>
<td>`PerformInstall`</td>
<td>perform</td>
</tr>
<tr>
<td>`TriggerInstall`</td>
<td>onExit</td>
</tr>
<tr>
<td rowspan="6">`Parallel | Force`</td>
<td rowspan="3">`PreferInternal`</td>
<td>`PerformInstall`</td>
<td>perform</td>
</tr>
<tr>
<td>`ParallelTrigger`</td>
<td>trigger</td>
</tr>
<tr>
<td>`TriggerInstall`</td>
<td>-</td>
</tr>
<tr>
<td rowspan="3">`PreferExternal`</td>
<td>`ParallelTrigger`</td>
<td>trigger</td>
</tr>
<tr>
<td>`PerformInstall`</td>
<td>perform</td>
</tr>
<tr>
<td>`TriggerInstall`</td>
<td>-</td>
</tr>
<tr>
<td rowspan="4">`OnExit`</td>
<td rowspan="3">`PreferInternal`</td>
<td>`TriggerInstall`</td>
<td>onExit</td>
</tr>
<tr>
<td>`ParallelTrigger`</td>
<td>onExit</td>
</tr>
<tr>
<td>`PerformInstall`</td>
<td>perform</td>
</tr>
<tr>
<td>`PreferExternal`</td>
<td colspan="2"><i>Same as </i>`PreferInternal`</td>
</tr>
<tr>
<td rowspan="4">`OnExit | Force`</td>
<td rowspan="3">`PreferInternal`</td>
<td>`TriggerInstall`</td>
<td>onExit</td>
</tr>
<tr>
<td>`ParallelTrigger`</td>
<td>onExit</td>
</tr>
<tr>
<td>`PerformInstall`</td>
<td>-</td>
</tr>
<tr>
<td>`PreferExternal`</td>
<td colspan="2"><i>Same as </i>`PreferInternal`</td>
</tr>
</table>
For some force configurations, - is specified. This means no updater can be run and false is returned
instead. If you want to find out whether an installation as been launched immediatly (Parallel) or
delayed (OnExit), query the runOnExit property.
@sa Updater::state, Updater::installDone, Updater::showInstaller, Updater::runOnExit
*/
/*!
@fn QtAutoUpdater::Updater::checkForUpdates
Checking for updates means that the backend will perform the check in the background. If already in
the running state, nothing happens instead. The updater now enters the Checking state and performs
the check. The result will be reported via the checkUpdatesDone() signal (and the state).
@sa Updater::abortUpdateCheck, Updater::checkUpdatesDone, Updater::state, Updater::running,
Updater::updateInfo
*/
/*!
@fn QtAutoUpdater::Updater::abortUpdateCheck
@param killDelay The maximum delay to wait for the process to gracefully finish
Tries to abort the update check. If no update is currently running (Updater::state != Checking),
nothing will happen.
If `killDelay` is greater than 0, the updater will try to gracefully terminate the check. After this
is done, the updater will wait at most `killDelay` milliseconds for the process to finish. If it
doesn't, it will be killed hard. It will be killed hard immediately, if the delay is set to 0. A
value below 0 indicates, that only the terminate should happen, without a hard kill timeout.
@warning In most cases there will be no side-effects of an abort. However, if the backend has to be
killed, because of no delay or a timeout, this may cause unwanted effects.
@sa Updater::checkForUpdates, Updater::state, Updater::running
*/
/*!
@fn QtAutoUpdater::Updater::cancelScheduledUpdate
@param taskId The id of the task to be canceled
Cancels the task with the id `taskId`. If there was a task with that ID, you can be shure
that it will be canceled. If the task was not until the point you call this function, it
will not be triggered anymore.
@sa Updater::scheduleUpdate, Updater::abortUpdateCheck
*/
/*!
@fn QtAutoUpdater::Updater::checkUpdatesDone
@param result The result state the updater reached after checking for updates
This signal is emitted if the updater was in the Checking state and has finished that task. It will
now be in one of the three non-running states NoUpdates, NewUpdates or Error. This is a signal for
convenience to only catch those specific state changes, instead of all by using the state property.
@sa Updater::checkForUpdates, Updater::state, Updater::updateInfo
*/
/*!
@fn QtAutoUpdater::Updater::progressChanged
@param progress A percentage value representing the check progress
@param status A localized status string to explaing the current state of the check process
This signal provides the current state of the update check process. percent can either range from
0.0 to 1.0 to present an actual percentage, or be -1.0 to represent an indeterminate progress.
Status can be empty to be unchanged/unset. Not all update backends support reporting detailes status.
Check the features property for the UpdaterBackend::Feature::CheckProgress flag to verify this.
@sa Updater::checkForUpdates, Updater::state, Updater::features, UpdaterBackend::Feature
*/
/*!
@fn QtAutoUpdater::Updater::showInstaller
@param installer The installer to be shown
This signal is emitted if runUpdater() decides to perform an internal update installation. It will
create an installer from the backend and pass it back via this signal. The installer should be used
by some kind of UI to guide the user through the installation process.
@sa Updater::runUpdater, Updater::features, UpdateInstaller
*/
/*!
@fn QtAutoUpdater::Updater::installDone
@param success Reports whether the update installer did succeed or not
This signal is emitted if runUpdater() launched a parallel installation (either a performed or a
triggered installation) and that installation finished. If the installation was successfully
completed, success will be true, otherwise false.
@sa Updater::runUpdater, Updater::features
*/