QSimpleUpdater: QSimpleUpdater Class Reference

| QSimpleUpdater A simple auto-updater system for Qt applications

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Slots | Signals | Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
QSimpleUpdater Class Reference

Manages the updater instances. More...

`#include <QSimpleUpdater.h>`

Inheritance diagram for QSimpleUpdater:

## Public Slots
void | checkForUpdates (const QString &url)
void | setModuleName (const QString &url, const QString &name)
void | setNotifyOnUpdate (const QString &url, const bool &notify)
void | setNotifyOnFinish (const QString &url, const bool &notify)
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

## Detailed Description

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).

## Member Function Documentation

void QSimpleUpdater::checkForUpdates | ( | const QString & | url | ) |
| slot

Instructs the `Updater` instance with the registered `url` to download and interpret the update definitions file.

Note
  If an `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.

Warning
  You should call `checkForUpdates()` before using this function

Note
  If an `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.

Note
  If an `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.

Warning
  You should call `checkForUpdates()` before using this function

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically

References Updater::downloadUrl(), and getUpdater().

QSimpleUpdater * QSimpleUpdater::getInstance | ( |  | ) |
| 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.

Warning
  You should call `checkForUpdates()` before using this function

Note
  If an `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.

Note
  If the module name is empty, then the `Updater` will use the application name as its module name.
  If an `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.

Note
  If the module version is empty, then the `Updater` will use the application version as its module version.
  If an `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.

Note
  If an `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.

Note
  If an `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:

- On iOS: `ios`
- On Mac OSX: `osx`
- On Android: `android`
- On GNU/Linux: `linux`
- On Microsoft Windows: `windows`

Note
  If an `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.

Warning
  You should call `checkForUpdates()` before using this function

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically

References getUpdater(), and Updater::updateAvailable().

Updater * QSimpleUpdater::getUpdater | ( | const QString & | url | ) | const
| 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().

void QSimpleUpdater::setDownloaderEnabled | ( | const QString & | url,
|  | const bool & | enabled
| ) |  |
| 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).

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically

References getUpdater(), and Updater::setDownloaderEnabled().

void QSimpleUpdater::setModuleName | ( | const QString & | url,
|  | const QString & | name
| ) |  |
| slot

Changes the module name of the `Updater` instance registered at the given url.

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically
  The module name is used on the user prompts. If the module name is empty, then the prompts will show the name of the application.

References getUpdater(), and Updater::setModuleName().

void QSimpleUpdater::setModuleVersion | ( | const QString & | url,
|  | const QString & | version
| ) |  |
| slot

Changes the module

Version
  of the `Updater` instance registered at the given url.

Note
  The module version is used to compare it with the remove version. If the module name is empty, then the `Updater` instance will use the application version.

References getUpdater(), and Updater::setModuleVersion().

void QSimpleUpdater::setNotifyOnFinish | ( | const QString & | url,
|  | const bool & | notify
| ) |  |
| 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.

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically

References getUpdater(), and Updater::setNotifyOnFinish().

void QSimpleUpdater::setNotifyOnUpdate | ( | const QString & | url,
|  | const bool & | notify
| ) |  |
| 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.

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically

References getUpdater(), and Updater::setNotifyOnUpdate().

void QSimpleUpdater::setPlatformKey | ( | const QString & | url,
|  | const QString & | platform
| ) |  |
| 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:

- On iOS: `ios`
- On Mac OSX: `osx`
- On Android: `android`
- On GNU/Linux: `linux`
- On Microsoft Windows: `windows`

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically

References getUpdater(), and Updater::setPlatformKey().

void QSimpleUpdater::setUseCustomInstallProcedures | ( | const QString & | url,
|  | const bool & | custom
| ) |  |
| 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.

Note
  If an `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.

Note
  If an `Updater` instance registered with the given url is not found, that `Updater` instance will be initialized automatically

References getUpdater(), and Updater::useCustomInstallProcedures().

The documentation for this class was generated from the following files:

- QSimpleUpdater.h
- QSimpleUpdater.cpp