|
| 1 | +/*! |
| 2 | +@class QtAutoUpdater::UpdaterBackend |
| 3 | + |
| 4 | +This is the primary interface you need to implement when providing a custom updater backend. If you |
| 5 | +are only using the library with existing backends, you won't come in contact with this class. |
| 6 | + |
| 7 | +Implement it following this documentation, and make sure to return the correct features(). Depending |
| 8 | +on the application, there might be multiple instances of one backend with different configurations. |
| 9 | +Be aware of this when implementing your own. |
| 10 | + |
| 11 | +@note If your custom backend is mostly focussed around running other executables for get update |
| 12 | +details etc., it is recommended to use ProcessBackend instead, as it simplifies this by a great |
| 13 | +amount. |
| 14 | + |
| 15 | +@sa UpdaterPlugin, ProcessBackend, ProcessBackend::features |
| 16 | +*/ |
| 17 | + |
| 18 | +/*! |
| 19 | +@fn QtAutoUpdater::UpdaterBackend::secondaryInfo |
| 20 | + |
| 21 | +@returns The secondary update information meta data |
| 22 | + |
| 23 | +A UpdateInfo has the UpdateInfo::name and UpdateInfo::version property to show details to a user. |
| 24 | +However, the GUIs support a third column, with additional information stored in the UpdateInfo::data |
| 25 | +property, custom to each backend. |
| 26 | + |
| 27 | +This method allows you to specify that additional data. The `first` of the pair should be the key to |
| 28 | +access the value within data, i.e. `info.data()[info->first]` should return the data to be displayed |
| 29 | +for each update info. `second` must hold a localized string to serve as header to that data. |
| 30 | + |
| 31 | +If your backend does not have such information, simply return `std::nullopt` (or don't override this |
| 32 | +method) |
| 33 | + |
| 34 | +@sa UpdateInfo |
| 35 | +*/ |
| 36 | + |
| 37 | +/*! |
| 38 | +@fn QtAutoUpdater::UpdaterBackend::checkForUpdates |
| 39 | + |
| 40 | +This method is called by the library to start an update check. In here, you should do whatever is |
| 41 | +neccessary to perform the update check. |
| 42 | + |
| 43 | +While the check is running, use checkProgress() to report the status and progress, and use |
| 44 | +checkDone() do report a result once done. |
| 45 | + |
| 46 | +@attention This method must be non blocking. It should only start the check for updates, not wait for |
| 47 | +it's completion. Exceptions are extremly shortrunning tasks, as e.g. checking a locally available |
| 48 | +file etc. |
| 49 | + |
| 50 | +@sa UpdaterBackend::checkProgress, UpdaterBackend::checkDone, UpdaterBackend::abort |
| 51 | +*/ |
| 52 | + |
| 53 | +/*! |
| 54 | +@fn QtAutoUpdater::UpdaterBackend::abort |
| 55 | + |
| 56 | +@param force Specify, if the abortion should be forced or gentle |
| 57 | + |
| 58 | +This method is called by the library to abort an ongoing update check. The force parameter specifies |
| 59 | +if the abort should be done gently or forced. |
| 60 | + |
| 61 | +A gentle abort should stop the check if possible, but may take some time to gracefully do so. It is |
| 62 | +also possible for a soft abort to fail under certain conditions and simply continue with the check. |
| 63 | +A forced abort must be as fast as possible and should stop the check no matter what, even if that |
| 64 | +means that an invalid state might be reached. |
| 65 | + |
| 66 | +Once canceled, the checkDone() must be emitted to notify the library. The success state of that |
| 67 | +signal should mirror how "clean" the abort was. |
| 68 | + |
| 69 | +@sa UpdaterBackend::checkForUpdates, UpdaterBackend::checkDone |
| 70 | +*/ |
| 71 | + |
| 72 | +/*! |
| 73 | +@fn QtAutoUpdater::UpdaterBackend::triggerUpdates |
| 74 | + |
| 75 | +@param infos A list of update infos to be updated |
| 76 | +@param track Specifies if the installers execution should be tracked |
| 77 | +@returns `true` if an installer was launched, `false` if not |
| 78 | + |
| 79 | +This method should launch some kind of external installer application and report whether it could be |
| 80 | +launched successfully. The infos parameter can be seen as hint for what updates should be installed, |
| 81 | +but can be ignored if the external installer cannot be given that information. |
| 82 | + |
| 83 | +@note For this method to ever be called from the library, features() must have the |
| 84 | +UpdaterBackend::Feature::TriggerInstall flag set. |
| 85 | + |
| 86 | +The track parameter specifies whether the execution of the external installer should be tracked. If |
| 87 | +true, than the backend should track the launched installer and emit triggerInstallDone() once the |
| 88 | +installer has completed the installation. If set to false, it should only be launched and then |
| 89 | +forgotten. |
| 90 | + |
| 91 | +@note track can only be true if features() has the UpdaterBackend::Feature::ParallelTrigger flag set. |
| 92 | +In that case, an installer might be run in parallel to the calling application. If that flag is not |
| 93 | +set, this method will only ever be called with track set to false and the calling application will |
| 94 | +exit immediatly after the installer was launched successfully. However, even if the feature is |
| 95 | +supported, it is still possible for track to be false and the application to exit. |
| 96 | + |
| 97 | +@sa UpdaterBackend::features(), UpdaterBackend::Feature, UpdaterBackend::triggerInstallDone |
| 98 | +UpdaterBackend::createInstaller |
| 99 | +*/ |
| 100 | + |
| 101 | +/*! |
| 102 | +@fn QtAutoUpdater::UpdaterBackend::createInstaller |
| 103 | + |
| 104 | +@returns An UpdateInstaller instance, if the backend supports it |
| 105 | + |
| 106 | +Implement this method to return your implementation of a UpdateInstaller, if your backend supports |
| 107 | +a performed installation (See UpdateInstaller for more details on that). If your backend does not |
| 108 | +support this, simply return `nullptr` |
| 109 | + |
| 110 | +@note For this method to ever be called from the library, features() must have the |
| 111 | +UpdaterBackend::Feature::PerformInstall flag set. |
| 112 | + |
| 113 | +@sa UpdateInstaller, UpdaterBackend::features(), UpdaterBackend::Feature, |
| 114 | +UpdaterBackend::triggerUpdates |
| 115 | +*/ |
| 116 | + |
| 117 | +/*! |
| 118 | +@fn QtAutoUpdater::UpdaterBackend::readStringList |
| 119 | + |
| 120 | +@param value The variant value to be parsed |
| 121 | +@param listSeperator The seperator to split a string by |
| 122 | +@returns A string list extracted from the value |
| 123 | + |
| 124 | +This method first checks the value. If it already is a QStringList, it is simply returned as one. |
| 125 | +If not, the value is converted to a QString and the split using QString::split with the given |
| 126 | +seperator to create a string list from it. |
| 127 | + |
| 128 | +@sa ProcessBackend::readPathList, ProcessBackend::readArgumentList |
| 129 | +*/ |
| 130 | + |
| 131 | +/*! |
| 132 | +@fn QtAutoUpdater::UpdaterBackend::checkProgress |
| 133 | + |
| 134 | +@param percent A percentage value representing the check progress |
| 135 | +@param status A localized status string to explaing the current state of the check process |
| 136 | + |
| 137 | +Emit this signal to give the user some feedback on the current state of the update check. percent can |
| 138 | +either range from 0.0 to 1.0 to present an actual percentage, or be -1.0 to represent an |
| 139 | +indeterminate progress. Status can be left empty to be unchanged/unset. Emitting this signal is |
| 140 | +optional, but recommended for long running checks. |
| 141 | + |
| 142 | +@note For this signal to be catched by the library, features() must have the |
| 143 | +UpdaterBackend::Feature::CheckProgress flag set. |
| 144 | + |
| 145 | +@sa UpdaterBackend::checkForUpdates, UpdaterBackend::features(), UpdaterBackend::Feature |
| 146 | +*/ |
| 147 | + |
| 148 | +/*! |
| 149 | +@fn QtAutoUpdater::UpdaterBackend::checkDone |
| 150 | + |
| 151 | +@param success Reports whether the check was successfull or not |
| 152 | +@param updates Returns a list of updates, if some are available |
| 153 | + |
| 154 | +Emit this signal to tell the library that checking for updates is done. Emit it with `true` if no |
| 155 | +error occured, even if no updates are available, as that is not considered an error. Simply leave |
| 156 | +updates empty in that case. If some are available, create UpdateInfos for them and pass them to |
| 157 | +updates. |
| 158 | + |
| 159 | +Only set success to `false`, if an actual error occured (or when canceling unclean), as this will |
| 160 | +show a message to the user, that something went wrong. |
| 161 | + |
| 162 | +@sa UpdaterBackend::checkForUpdates, UpdaterBackend::abort |
| 163 | +*/ |
| 164 | + |
| 165 | +/*! |
| 166 | +@fn QtAutoUpdater::UpdaterBackend::triggerInstallDone |
| 167 | + |
| 168 | +@param success Reports whether the installation was successfull or not |
| 169 | + |
| 170 | +Emit this signal once an external installer, that was started with track set to true, finsihed it's |
| 171 | +execution. Use the parameter to report, whether the installer was successful or not. It is up to the |
| 172 | +developer of each backend to decide, whether updates not installed due to the user are considered an |
| 173 | +error or not. |
| 174 | + |
| 175 | +@note For this signal to be catched by the library, features() must have the |
| 176 | +UpdaterBackend::Feature::ParallelTrigger flag set, as only then triggerUpdates() can be called with |
| 177 | +track set to true. |
| 178 | + |
| 179 | +@sa UpdaterBackend::triggerUpdates, UpdaterBackend::features(), UpdaterBackend::Feature |
| 180 | +*/ |
| 181 | + |
| 182 | +/*! |
| 183 | +@fn QtAutoUpdater::UpdaterBackend::initialize() |
| 184 | + |
| 185 | +@returns `true` if initialization was successful, `false` if not |
| 186 | + |
| 187 | +This method is internally called by initialize(QScopedPointer<IConfigReader> &&) to perform the |
| 188 | +actual initialization. This is done immediatly after the creation of the backend by the library. At |
| 189 | +this point, config() will return a valid object and can be used to configure the backend. |
| 190 | + |
| 191 | +Return true if the init was successful and the backend can now be used normally. On a failure, return |
| 192 | +false and the backend will be deleted. |
| 193 | + |
| 194 | +@sa UpdaterBackend::initialize(QScopedPointer<IConfigReader> &&), UpdaterBackend::config |
| 195 | +*/ |
0 commit comments