![]() |
NDEVR
API Documentation
|
Provides logic for checking a source, typically online, for an update to the software. More...
Public Types | |
| enum | UpdateStatus { e_need_to_check , e_no_new_updates , e_update_available_to_download , e_update_available_to_install , e_could_not_connect , e_unsupported } |
| The possible states of the update check/download lifecycle. More... | |
Public Member Functions | |
| UpdateChecker () | |
| Constructs an UpdateChecker with default settings. | |
| UpdateChecker (StringView update_version) | |
| Constructs an UpdateChecker with a known current version. | |
| void | appStartupCheck () |
| Performs an update check at application startup if enough time has elapsed. | |
| const Buffer< ApplicationResource::ReleaseType > & | availableReleaseTypes () const |
| Returns the list of available release types for this application. | |
| void | checkForUpdateCompletedSignal (UpdateStatus update) |
| Signal emitted when an update check completes. | |
| virtual void | createUpdateFile (const String &installer_url, File output_location) |
| Creates an update file from the given installer URL. | |
| uint08 | currentDownloadSize () const |
| Returns the number of bytes downloaded so far. | |
| virtual String | defaultURLPathName () const |
| Returns the default URL path segment used for update requests. | |
| fltp08 | downloadPercent () const |
| Returns the download progress as a percentage. | |
| virtual INIFactory | getINI () |
| Returns an INI factory configured for update settings. | |
| Time | lastUpdateCheckTime () const |
| Returns the time of the last update check. | |
| void | percentChangedSignal () |
| Signal emitted when download progress changes. | |
| virtual void | processUpdateString (const String &s) |
| Parses an update response string to extract version and URL information. | |
| ApplicationResource::ReleaseType | recommendedReleaseType () const |
| Returns the recommended release type based on user preference and availability. | |
| void | releaseTypesChangedSignal () |
| Signal emitted when the available release types change. | |
| virtual void | requestCheckForUpdate (const StringView ¤t_version=StringView())=0 |
| Initiates an asynchronous check for available updates. | |
| virtual bool | requestInstallUpdate (bool wait_for_completion=false) |
| Requests installation of the downloaded update. | |
| virtual bool | requstDownloadUpdate () |
| Requests download of the available update. | |
| void | setMaxNoUpdateTime (const TimeSpan &max_no_update_check_time) |
| Sets the maximum time between automatic update checks. | |
| void | setReleaseTypes (const Buffer< ApplicationResource::ReleaseType > &types) |
| Sets the available release types for the update checker. | |
| void | setUpdateStatus (UpdateStatus status) |
| Sets the current update status and emits statusChangedSignal. | |
| void | showUpdateDialogIfNeeded () |
| Shows a dialog prompting the user to update if one is available. | |
| void | statusChangedSignal () |
| Signal emitted when the update status changes. | |
| uint08 | totalDownloadSize () const |
| Returns the total size of the update download. | |
| void | updateDownloadCompletedSignal (const File &location) |
| Signal emitted when an update download completes. | |
| File | updateFile () const |
| Returns the local file path of the downloaded update. | |
| virtual String | updateName () const |
| Returns the file name of the available update. | |
| virtual bool | updateRequiresApplicationClose () const |
| Returns whether the update requires closing the application first. | |
| UpdateStatus | updateStatus () const |
| Returns the current update status. | |
| virtual bool | updateSupported () const |
| Returns whether software updates are supported on this platform. | |
| virtual String | updateURLDownload () const |
| Returns the direct download URL for the update. | |
| virtual String | updateURLPage () const =0 |
| Returns the URL of the update information page. | |
| virtual String | updateVersion () const |
| Returns the version string of the available update. | |
Static Public Attributes | |
| static ApplicationOption< ApplicationResource::ReleaseType > | release_check_type |
| The user's preferred release type for update checks. | |
Protected Member Functions | |
| void | checkForUpdateCompleteSlot () |
| Slot invoked when the update check network request completes. | |
| virtual void | onCheckForUpdateComplete () |
| Virtual callback invoked when an update check completes. | |
| void | onUpdateDownloadCompleteSlot () |
| Slot invoked when the update file download completes. | |
Protected Attributes | |
| String | m_current_version |
| The current application version string. | |
| File | m_download_location |
| The local file path for downloaded updates. | |
| QPointer< ItemDownloader > | m_downloader |
| The downloader managing the update file transfer. | |
| Time | m_last_application_update_check |
| The time of the last update check. | |
| TimeSpan | m_max_no_update_time |
| The maximum allowed time between automatic update checks. | |
| Buffer< ApplicationResource::ReleaseType > | m_release_types |
| The available release types. | |
| String | m_update_file_name |
| The file name of the available update. | |
| String | m_update_url |
| The download URL for the available update. | |
| String | m_update_version |
| The version string of the available update. | |
Provides logic for checking a source, typically online, for an update to the software.
Definition at line 49 of file UpdateChecker.h.
The possible states of the update check/download lifecycle.
Definition at line 54 of file UpdateChecker.h.
| UpdateChecker::UpdateChecker | ( | StringView | update_version | ) |
Constructs an UpdateChecker with a known current version.
| [in] | update_version | The current application version string. |
| const Buffer< ApplicationResource::ReleaseType > & UpdateChecker::availableReleaseTypes | ( | ) | const |
Returns the list of available release types for this application.
| void UpdateChecker::checkForUpdateCompletedSignal | ( | UpdateStatus | update | ) |
Signal emitted when an update check completes.
| [in] | update | The resulting UpdateStatus. |
|
virtual |
Creates an update file from the given installer URL.
| [in] | installer_url | The URL of the installer to download. |
| [in] | output_location | The file path to write the downloaded installer to. |
| uint08 UpdateChecker::currentDownloadSize | ( | ) | const |
Returns the number of bytes downloaded so far.
|
virtual |
Returns the default URL path segment used for update requests.
| fltp08 UpdateChecker::downloadPercent | ( | ) | const |
Returns the download progress as a percentage.
|
virtual |
Returns an INI factory configured for update settings.
| Time UpdateChecker::lastUpdateCheckTime | ( | ) | const |
Returns the time of the last update check.
|
inlineprotectedvirtual |
Virtual callback invoked when an update check completes.
Override for custom handling.
Reimplemented in NDEVRUpdateChecker.
Definition at line 169 of file UpdateChecker.h.
|
virtual |
Parses an update response string to extract version and URL information.
| [in] | s | The raw update response string to parse. |
| ApplicationResource::ReleaseType UpdateChecker::recommendedReleaseType | ( | ) | const |
Returns the recommended release type based on user preference and availability.
|
pure virtual |
Initiates an asynchronous check for available updates.
| [in] | current_version | The current version to compare against. Uses stored version if empty. |
Implemented in NDEVRUpdateChecker.
|
virtual |
Requests installation of the downloaded update.
| [in] | wait_for_completion | Whether to block until installation finishes. |
|
virtual |
Requests download of the available update.
| void UpdateChecker::setMaxNoUpdateTime | ( | const TimeSpan & | max_no_update_check_time | ) |
Sets the maximum time between automatic update checks.
| [in] | max_no_update_check_time | The maximum TimeSpan between checks. |
| void UpdateChecker::setReleaseTypes | ( | const Buffer< ApplicationResource::ReleaseType > & | types | ) |
Sets the available release types for the update checker.
| [in] | types | The buffer of ReleaseType values to make available. |
| void UpdateChecker::setUpdateStatus | ( | UpdateStatus | status | ) |
Sets the current update status and emits statusChangedSignal.
| [in] | status | The new UpdateStatus to set. |
| uint08 UpdateChecker::totalDownloadSize | ( | ) | const |
Returns the total size of the update download.
| void UpdateChecker::updateDownloadCompletedSignal | ( | const File & | location | ) |
Signal emitted when an update download completes.
| [in] | location | The file path of the downloaded update. |
| File UpdateChecker::updateFile | ( | ) | const |
Returns the local file path of the downloaded update.
|
inlinevirtual |
Returns the file name of the available update.
Definition at line 84 of file UpdateChecker.h.
References m_update_file_name.
|
virtual |
Returns whether the update requires closing the application first.
| UpdateStatus UpdateChecker::updateStatus | ( | ) | const |
Returns the current update status.
|
virtual |
Returns whether software updates are supported on this platform.
|
inlinevirtual |
Returns the direct download URL for the update.
Definition at line 93 of file UpdateChecker.h.
References m_update_url.
|
pure virtual |
Returns the URL of the update information page.
Implemented in NDEVRUpdateChecker.
|
inlinevirtual |
Returns the version string of the available update.
Definition at line 87 of file UpdateChecker.h.
References m_update_version.