QSimpleUpdater
A simple auto-updater system for Qt applications
|
Manages the updater instances. More...
#include <QSimpleUpdater.h>
Public Slots | |
void | checkForUpdates (const QString &url) |
void | setModuleName (const QString &url, const QString &name) |
void | setNotifyOnUpdate (const QString &url, const bool ¬ify) |
void | setNotifyOnFinish (const QString &url, const bool ¬ify) |
void | setPlatformKey (const QString &url, const QString &platform) |
void | setModuleVersion (const QString &url, const QString &version) |
void | setDownloaderEnabled (const QString &url, const bool &enabled) |
void | setUseCustomInstallProcedures (const QString &url, const bool &custom) |
Signals | |
void | checkingFinished (const QString &url) |
void | downloadFinished (const QString &url, const QString &filepath) |
Public Member Functions | |
bool | getNotifyOnUpdate (const QString &url) const |
bool | getNotifyOnFinish (const QString &url) const |
bool | getUpdateAvailable (const QString &url) const |
bool | getDownloaderEnabled (const QString &url) const |
bool | usesCustomInstallProcedures (const QString &url) const |
QString | getChangelog (const QString &url) const |
QString | getModuleName (const QString &url) const |
QString | getDownloadUrl (const QString &url) const |
QString | getPlatformKey (const QString &url) const |
QString | getLatestVersion (const QString &url) const |
QString | getModuleVersion (const QString &url) const |
Static Public Member Functions | |
static QSimpleUpdater * | getInstance () |
Private Member Functions | |
Updater * | getUpdater (const QString &url) const |
Manages the updater instances.
The QSimpleUpdater
class manages the updater system and allows for parallel application modules to check for updates and download them.
The behavior of each updater can be regulated by specifying the update definitions URL (from where we download the individual update definitions) and defining the desired options by calling the individual "setter" functions (e.g. setNotifyOnUpdate()
).
The QSimpleUpdater
also implements an integrated downloader. If you need to use a custom install procedure/code, just create a function that is called when the downloadFinished()
signal is emitted to implement your own install procedures.
By default, the downloader will try to open the file as if you opened it from a file manager or a web browser (with the "file:*" url).
|
slot |
Instructs the Updater
instance with the registered url
to download and interpret the update definitions file.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References Updater::checkForUpdates(), and getUpdater().
QString QSimpleUpdater::getChangelog | ( | const QString & | url | ) | const |
Returns the changelog of the Updater
instance registered with the given url.
checkForUpdates()
before using this function Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References Updater::changelog(), and getUpdater().
bool QSimpleUpdater::getDownloaderEnabled | ( | const QString & | url | ) | const |
Returns true
if the Updater
instance registered with the given url has the integrated downloader enabled.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References Updater::downloaderEnabled(), and getUpdater().
QString QSimpleUpdater::getDownloadUrl | ( | const QString & | url | ) | const |
Returns the download URL of the Updater
instance registered with the given url.
checkForUpdates()
before using this function Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References Updater::downloadUrl(), and getUpdater().
|
static |
Returns the only instance of the class
QString QSimpleUpdater::getLatestVersion | ( | const QString & | url | ) | const |
Returns the remote module version of the Updater
instance registered with the given url.
checkForUpdates()
before using this function Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::latestVersion().
QString QSimpleUpdater::getModuleName | ( | const QString & | url | ) | const |
Returns the module name of the Updater
instance registered with the given url.
Updater
will use the application name as its module name. Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::moduleName().
QString QSimpleUpdater::getModuleVersion | ( | const QString & | url | ) | const |
Returns the module version of the Updater
instance registered with the given url.
Updater
will use the application version as its module version. Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::moduleVersion().
bool QSimpleUpdater::getNotifyOnFinish | ( | const QString & | url | ) | const |
Returns true
if the Updater
instance registered with the given url shall notify the user when it finishes checking for updates.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::notifyOnFinish().
bool QSimpleUpdater::getNotifyOnUpdate | ( | const QString & | url | ) | const |
Returns true
if the Updater
instance registered with the given url shall notify the user when an update is available.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::notifyOnUpdate().
QString QSimpleUpdater::getPlatformKey | ( | const QString & | url | ) | const |
Returns the platform key of the Updater
registered with the given url. If you do not define a platform key, the system will assign the following platform key:
ios
osx
android
linux
windows
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::platformKey().
bool QSimpleUpdater::getUpdateAvailable | ( | const QString & | url | ) | const |
Returns true
if the Updater
instance registered with the given url has an update available.
checkForUpdates()
before using this function Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::updateAvailable().
|
private |
Returns the Updater
instance registered with the given url.
If an Updater
instance registered with teh given url does not exist, this function will create it and configure it automatically.
References Updater::setUrl().
Referenced by checkForUpdates(), getChangelog(), getDownloaderEnabled(), getDownloadUrl(), getLatestVersion(), getModuleName(), getModuleVersion(), getNotifyOnFinish(), getNotifyOnUpdate(), getPlatformKey(), getUpdateAvailable(), setDownloaderEnabled(), setModuleName(), setModuleVersion(), setNotifyOnFinish(), setNotifyOnUpdate(), setPlatformKey(), setUseCustomInstallProcedures(), and usesCustomInstallProcedures().
|
slot |
If the enabled parameter is set to true
, the Updater
instance registered with the given url will open the integrated downloader if the user agrees to install the update (if any).
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::setDownloaderEnabled().
|
slot |
Changes the module name of the Updater
instance registered at the given url.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::setModuleName().
|
slot |
Changes the module
Updater
instance registered at the given url.Updater
instance will use the application version. References getUpdater(), and Updater::setModuleVersion().
|
slot |
If notify is set to true
, then the Updater
instance registered with the given url will notify the user when it has finished interpreting the update definitions file.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::setNotifyOnFinish().
|
slot |
If notify is set to true
, then the Updater
instance registered with the given url will notify the user when an update is available.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::setNotifyOnUpdate().
|
slot |
Changes the platform key of the Updater
isntance registered at the given url.
If the platform key is empty, then the system will use the following keys:
ios
osx
android
linux
windows
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::setPlatformKey().
|
slot |
If the custom parameter is set to true
, the Updater
instance registered with the given url will not try to open the downloaded file.
If you want to implement your own way to handle the downloaded file, just bind to the downloadFinished()
signal and disable the integrated downloader with the setUseCustomInstallProcedures()
function.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::setUseCustomInstallProcedures().
bool QSimpleUpdater::usesCustomInstallProcedures | ( | const QString & | url | ) | const |
Returns true
if the Updater
instance registered with the given url shall try to open the downloaded file.
If you want to implement your own way to handle the downloaded file, just bind to the downloadFinished()
signal and disable the integrated downloader with the setUseCustomInstallProcedures()
function.
Updater
instance registered with the given url is not found, that Updater
instance will be initialized automatically References getUpdater(), and Updater::useCustomInstallProcedures().