|
| 1 | +/*! |
| 2 | +@class QtAutoUpdater::UpdateInstaller |
| 3 | + |
| 4 | +This class can be used to perform an update of the application from within the running process, |
| 5 | +without the need of an external installer. It can also be used if an external installer provides |
| 6 | +enough details about an installation for them to be presented via this class. |
| 7 | + |
| 8 | +Instances of the installer are provided via Updater::showInstaller if such an installer was selected |
| 9 | +by Updater::runUpdater. You can then use the public API of the installer to select components to be |
| 10 | +installed and perform their installation. |
| 11 | + |
| 12 | +When implementing a custom updater backend, you can use this as abstract base class for a custom |
| 13 | +installer. |
| 14 | + |
| 15 | +@note Using such an installer requires the UpdaterBackend to have the |
| 16 | +UpdaterBackend::Feature::PerformInstall flag set. |
| 17 | + |
| 18 | +@sa Updater, Updater::showInstaller, UpdaterBackend |
| 19 | +*/ |
| 20 | + |
| 21 | +/*! |
| 22 | +@property QtAutoUpdater::UpdateInstaller::features |
| 23 | + |
| 24 | +@default{`UpdateInstaller::Feature::None`} |
| 25 | + |
| 26 | +The flags indicate which features are supported and which are not. |
| 27 | + |
| 28 | +@accessors{ |
| 29 | + @readAc{features()} |
| 30 | + @constantAc |
| 31 | +} |
| 32 | + |
| 33 | +@sa UpdateInstaller::Feature, UpdaterBackend::features() |
| 34 | +*/ |
| 35 | + |
| 36 | +/*! |
| 37 | +@property QtAutoUpdater::UpdateInstaller::components |
| 38 | + |
| 39 | +@default{`<empty>`} |
| 40 | + |
| 41 | +This property only returns enabled components. If a component was disabled by the user, it is not |
| 42 | +visible via this property. You can thuse use this to figure out which components are actually |
| 43 | +installed. When setting this property, all components set are marked as enabled and thus are visible |
| 44 | +through this property. |
| 45 | + |
| 46 | +@accessors{ |
| 47 | + @readAc{components()} |
| 48 | + @writeAc{setComponents()} |
| 49 | + @notifyAc{componentsChanged()} |
| 50 | +} |
| 51 | + |
| 52 | +@sa UpdateInstaller::componentModel, UpdateInstaller::setComponentEnabled |
| 53 | +*/ |
| 54 | + |
| 55 | +/*! |
| 56 | +@property QtAutoUpdater::UpdateInstaller::componentModel |
| 57 | + |
| 58 | +@default{`<instance>`} |
| 59 | + |
| 60 | +By default, the model provides the following roles and columns. Strings represent those accessible |
| 61 | +from QML via role names, others are enum values for access via C++. |
| 62 | + |
| 63 | + Column | role | UpdateInfo property: type | writable |
| 64 | +--------|-----------------------|-----------------------------------|---------- |
| 65 | + 0 | Qt::DisplayRole | name: QString | false |
| 66 | + 0 | Qt::ToolTipRole | name: QString | false |
| 67 | + 0 | Qt::CheckStateRole | _<enabled>_: Qt::CheckState | true |
| 68 | + 0 | "name" | name: QString | false |
| 69 | + 0 | "version" | version: QString | false |
| 70 | + 0 | "selected" | _<enabled>_: bool | true |
| 71 | + 0 | "updateInfo" | _<gadget>_: UpdateInfo | false |
| 72 | + 1 | Qt::DisplayRole | version: QString | false |
| 73 | + 1 | Qt::ToolTipRole | version: QString | false |
| 74 | + |
| 75 | +However, backends can decide to provide additional/different columns and roles as well. The model |
| 76 | +should always provide a way for the user to enable or disable components. |
| 77 | + |
| 78 | +@note This model is useless unless the Feature::SelectComponents was set in |
| 79 | +UpdateInstaller::features |
| 80 | + |
| 81 | +@accessors{ |
| 82 | + @readAc{componentModel()} |
| 83 | + @constantAc |
| 84 | +} |
| 85 | + |
| 86 | +@sa UpdateInstaller::components, UpdateInstaller::setComponentEnabled, UpdateInstaller::Feature, |
| 87 | +UpdateInstaller::features |
| 88 | +*/ |
| 89 | + |
| 90 | +/*! |
| 91 | +@property QtAutoUpdater::UpdateInstaller::progressModel |
| 92 | + |
| 93 | +@default{`<instance>`} |
| 94 | + |
| 95 | +By default, the model provides the following roles and columns. Strings represent those accessible |
| 96 | +from QML via role names, others are enum values for access via C++. None are writable. "progress" |
| 97 | +and "status" are special properties that can be set via updateComponentProgress() |
| 98 | + |
| 99 | + Column | role | UpdateInfo property: type |
| 100 | +--------|-----------------------|--------------------------- |
| 101 | + 0 | Qt::DisplayRole | name: QString |
| 102 | + 0 | Qt::ToolTipRole | name: QString |
| 103 | + 0 | "name" | name: QString |
| 104 | + 0 | "progress" | progress: double |
| 105 | + 0 | "status" | status: QString |
| 106 | + 0 | "updateInfo" | _<gadget>_: UpdateInfo |
| 107 | + 1 | Qt::DisplayRole | status: QString |
| 108 | + 1 | Qt::ToolTipRole | status: QString |
| 109 | + 2 | Qt::DisplayRole | progress: double |
| 110 | + 2 | Qt::ToolTipRole | progress: double |
| 111 | + |
| 112 | +However, backends can decide to provide additional/different columns and roles as well. The model |
| 113 | +should connect to the updateComponentProgress() signal to be able to catch the progress of |
| 114 | +components and should always display those in some way via the model. |
| 115 | + |
| 116 | +@note This model is useless unless the Feature::DetailedProgress was set in |
| 117 | +UpdateInstaller::features |
| 118 | + |
| 119 | +@accessors{ |
| 120 | + @readAc{progressModel()} |
| 121 | + @constantAc |
| 122 | +} |
| 123 | + |
| 124 | +@sa UpdateInstaller::updateComponentProgress, UpdateInstaller::Feature, UpdateInstaller::features |
| 125 | +*/ |
| 126 | + |
| 127 | +/*! |
| 128 | +@fn QtAutoUpdater::UpdateInstaller::startInstall |
| 129 | + |
| 130 | +Call this to start an installation. |
| 131 | + |
| 132 | +@attention Do **not** reimplement this method yourself unless you have a custom progressModel!!! |
| 133 | +Instead, implement startInstallImpl(), as that method is called directly from this one. |
| 134 | + |
| 135 | +@sa UpdateInstaller::startInstallImpl, UpdateInstaller::progressModel |
| 136 | +*/ |
| 137 | + |
| 138 | +/*! |
| 139 | +@fn QtAutoUpdater::UpdateInstaller::cancelInstall |
| 140 | + |
| 141 | +Call this to abort an ongoing installation. |
| 142 | + |
| 143 | +@note For this method to ever be called, the Feature::DetailedProgress must be set in |
| 144 | +UpdateInstaller::features |
| 145 | + |
| 146 | +@warning Even if this is supported by a backend, cancelling can **always** have fatal repercussions |
| 147 | +on an installation and possibly corrupt it into an unrepairable state! When allowing users to |
| 148 | +cancel, always make them aware of this fact. |
| 149 | + |
| 150 | +@sa UpdateInstaller::startInstall, UpdateInstaller::Feature, UpdateInstaller::features |
| 151 | +*/ |
| 152 | + |
| 153 | +/*! |
| 154 | +@fn QtAutoUpdater::UpdateInstaller::eulaHandled |
| 155 | + |
| 156 | +@param id The id of the EULA that was passed to it's show request |
| 157 | +@param accepted true, if the user accepted the EULA, false if not |
| 158 | + |
| 159 | +Call this method from a GUI to notify the installer that a required EULA was accepted or rejected. |
| 160 | + |
| 161 | +For the implementation of this method, a rejected EULA should always lead to a failed installation. |
| 162 | + |
| 163 | +@sa UpdateInstaller::showEula |
| 164 | +*/ |
| 165 | + |
| 166 | +/*! |
| 167 | +@fn QtAutoUpdater::UpdateInstaller::restartApplication |
| 168 | + |
| 169 | +Implement this method if you are going to emit installSucceeded(true). The method should quit the |
| 170 | +current application and restart it, using the updated version of your application. |
| 171 | + |
| 172 | +@sa UpdateInstaller::installSucceeded |
| 173 | +*/ |
| 174 | + |
| 175 | +/*! |
| 176 | +@fn QtAutoUpdater::UpdateInstaller::updateGlobalProgress |
| 177 | + |
| 178 | +@param progress The progress of the full installation |
| 179 | +@param status The current status of the installation |
| 180 | + |
| 181 | +Emit this signal to give the user some feedback on the current state of the installation. percent |
| 182 | +can either range from 0.0 to 1.0 to present an actual percentage, or be -1.0 to represent an |
| 183 | +indeterminate progress. Status can be left empty to be unchanged/unset. Emitting this signal is |
| 184 | +optional, but recommended. |
| 185 | + |
| 186 | +@sa UpdateInstaller::updateComponentProgress |
| 187 | +*/ |
| 188 | + |
| 189 | +/*! |
| 190 | +@fn QtAutoUpdater::UpdateInstaller::updateComponentProgress |
| 191 | + |
| 192 | +@param id The id of the component |
| 193 | +@param progress The progress of the full installation |
| 194 | +@param status The current status of the installation |
| 195 | + |
| 196 | +Emit this signal to give the user some feedback on the current state of a certain component that is |
| 197 | +part of the installation. The semantics are the same as for updateGlobalProgress(). The id is the |
| 198 | +same as the UpdateInfo::identifier property of the UpdateInfo that represents that component. |
| 199 | + |
| 200 | +This signal is typically consumed by the progressModel, which displays it. |
| 201 | + |
| 202 | +@note This signal is ignored unless the Feature::DetailedProgress was set in |
| 203 | +UpdateInstaller::features |
| 204 | + |
| 205 | +@sa UpdateInstaller::updateGlobalProgress, UpdateInstaller::progressModel |
| 206 | +*/ |
| 207 | + |
| 208 | +/*! |
| 209 | +@fn QtAutoUpdater::UpdateInstaller::showEula |
| 210 | + |
| 211 | +@param id An internally used id to identify the EULA |
| 212 | +@param htmlText The EULAs text, formatted as HTML-text |
| 213 | +@param required Specifies whether the EULA must be accepted or not |
| 214 | + |
| 215 | +Emit this signal to make the user accept an EULA. The id is used internally and only actually needed |
| 216 | +for required EULAs, as it is passed to eulaHandled() to report the result. The text is interpreted |
| 217 | +as HTML, but should only consist of the HTML-subset supported by styled QML Labels. |
| 218 | + |
| 219 | +If required is false, the EULA should only be shown to the user, but he doesn't have to accept it. |
| 220 | +If set true however, the user must accept the EULA and the result must be reported via |
| 221 | +eulaHandled(). |
| 222 | + |
| 223 | +Required EULAs should block the installation until accepted and their rejection should fail an |
| 224 | +installation. |
| 225 | + |
| 226 | +@sa UpdateInstaller::eulaHandled |
| 227 | +*/ |
| 228 | + |
| 229 | +/*! |
| 230 | +@fn QtAutoUpdater::UpdateInstaller::installSucceeded |
| 231 | + |
| 232 | +@param shouldRestart Specify whether the application should be restarted |
| 233 | + |
| 234 | +Emit this from your custom installer on a successfully completed installation. If you set the |
| 235 | +shouldRestart to true, the user will be asked if he wants to restart the application. If he accepts, |
| 236 | +restartApplication() will be called to do so. Otherwise, the user is not presented the option and |
| 237 | +nothing happens. |
| 238 | + |
| 239 | +@sa UpdateInstaller::installFailed, UpdateInstaller::restartApplication |
| 240 | +*/ |
| 241 | + |
| 242 | +/*! |
| 243 | +@fn QtAutoUpdater::UpdateInstaller::installFailed |
| 244 | + |
| 245 | +@param errorMessage Specify whether the application should be restarted |
| 246 | + |
| 247 | +Emit this from your custom installer on a failed installation. The errorMessage should be a |
| 248 | +localized string to describe what went wrong to the user. Do not include technical details there, |
| 249 | +only general information. Such details should be logged instead. |
| 250 | + |
| 251 | +@sa UpdateInstaller::installSucceeded |
| 252 | +*/ |
| 253 | + |
| 254 | +/*! |
| 255 | +@fn QtAutoUpdater::UpdateInstaller::startInstallImpl |
| 256 | + |
| 257 | +The actual method to start the installation. This should start whatever has to be done to perform |
| 258 | +the installation in a non-blocking manner. |
| 259 | + |
| 260 | +@sa UpdateInstaller::startInstall, UpdateInstaller::installSucceeded, |
| 261 | +UpdateInstaller::installFailed, UpdateInstaller::updateGlobalProgress, |
| 262 | +UpdateInstaller::updateComponentProgress, UpdateInstaller::showEula |
| 263 | +*/ |
| 264 | + |
| 265 | +/*! |
| 266 | +@fn QtAutoUpdater::UpdateInstaller::setComponentEnabled |
| 267 | + |
| 268 | +@param id The id of the component to be enabled or disabled |
| 269 | +@param enabled The new state of the component |
| 270 | + |
| 271 | +Call this method from your custom componentModel to enable or disable components as done by the |
| 272 | +user. The id is the same as the UpdateInfo::identifier property of the UpdateInfo that represents |
| 273 | +that component. You can only enable/disable components that have been added to the installer via |
| 274 | +the components property. |
| 275 | + |
| 276 | +@note Disabled components will disappear from the components property, but still be settable via |
| 277 | +this method. To completely remove the, write the property instead. |
| 278 | + |
| 279 | +@sa UpdateInstaller::components, UpdateInstaller::componentModel |
| 280 | +*/ |
0 commit comments