ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
QSimpleUpdater Class Reference

Manages the updater instances. More...

#include <QSimpleUpdater.h>

Inheritance diagram for QSimpleUpdater:
Collaboration 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 setUserAgentString (const QString &url, const QString &agent)
 
void setUseCustomAppcast (const QString &url, const bool customAppcast)
 
void setUseCustomInstallProcedures (const QString &url, const bool custom)
 
void setMandatoryUpdate (const QString &url, const bool mandatory_update)
 

Signals

void checkingFinished (const QString &url)
 
void appcastDownloaded (const QString &url, const QByteArray &data)
 
void downloadFinished (const QString &url, const QString &filepath)
 

Public Member Functions

bool usesCustomAppcast (const QString &url) const
 
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 getOpenUrl (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
 
QString getUserAgentString (const QString &url) const
 

Static Public Member Functions

static QSimpleUpdatergetInstance ()
 

Protected Member Functions

 ~QSimpleUpdater ()
 

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

Definition at line 43 of file QSimpleUpdater.h.

Constructor & Destructor Documentation

◆ ~QSimpleUpdater()

QSimpleUpdater::~QSimpleUpdater ( )
protected

Definition at line 14 of file QSimpleUpdater.cpp.

References UPDATERS, and URLS.

Member Function Documentation

◆ appcastDownloaded

void QSimpleUpdater::appcastDownloaded ( const QString &  url,
const QByteArray &  data 
)
signal

◆ checkForUpdates

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

Definition at line 229 of file QSimpleUpdater.cpp.

References Updater::checkForUpdates().

Referenced by ecvUpdateDlg::checkForUpdates(), and Window::checkForUpdates().

◆ checkingFinished

void QSimpleUpdater::checkingFinished ( const QString &  url)
signal

◆ downloadFinished

void QSimpleUpdater::downloadFinished ( const QString &  url,
const QString &  filepath 
)
signal

◆ getChangelog()

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

Definition at line 133 of file QSimpleUpdater.cpp.

References Updater::changelog().

Referenced by ecvUpdateDlg::updateChangelog(), and Window::updateChangelog().

◆ getDownloaderEnabled()

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

Definition at line 90 of file QSimpleUpdater.cpp.

References Updater::downloaderEnabled().

◆ getDownloadUrl()

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

Definition at line 160 of file QSimpleUpdater.cpp.

References Updater::downloadUrl().

◆ getInstance()

QSimpleUpdater * QSimpleUpdater::getInstance ( )
static

Returns the only instance of the class

Definition at line 27 of file QSimpleUpdater.cpp.

Referenced by ecvUpdateDlg::ecvUpdateDlg(), and Window::Window().

◆ getLatestVersion()

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

Definition at line 191 of file QSimpleUpdater.cpp.

References Updater::latestVersion().

◆ getModuleName()

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

Definition at line 147 of file QSimpleUpdater.cpp.

References Updater::moduleName().

◆ getModuleVersion()

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

Definition at line 205 of file QSimpleUpdater.cpp.

References Updater::moduleVersion().

◆ getNotifyOnFinish()

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

Definition at line 65 of file QSimpleUpdater.cpp.

References Updater::notifyOnFinish().

◆ getNotifyOnUpdate()

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

Definition at line 53 of file QSimpleUpdater.cpp.

References Updater::notifyOnUpdate().

◆ getOpenUrl()

QString QSimpleUpdater::getOpenUrl ( const QString &  url) const

Returns the URL to open in a web browser 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

Definition at line 120 of file QSimpleUpdater.cpp.

References Updater::openUrl().

◆ getPlatformKey()

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

Definition at line 178 of file QSimpleUpdater.cpp.

References Updater::platformKey().

◆ getUpdateAvailable()

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

Definition at line 78 of file QSimpleUpdater.cpp.

References Updater::updateAvailable().

◆ getUserAgentString()

QString QSimpleUpdater::getUserAgentString ( const QString &  url) const

Returns the user-agent string used by the updater to communicate with the remote HTTP(S) server.

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

Definition at line 217 of file QSimpleUpdater.cpp.

References Updater::userAgentString().

◆ setDownloaderEnabled

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

Definition at line 313 of file QSimpleUpdater.cpp.

References Updater::setDownloaderEnabled().

Referenced by ecvUpdateDlg::checkForUpdates(), and Window::checkForUpdates().

◆ setMandatoryUpdate

void QSimpleUpdater::setMandatoryUpdate ( const QString &  url,
const bool  mandatory_update 
)
slot

◆ setModuleName

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.

Definition at line 243 of file QSimpleUpdater.cpp.

References name, and Updater::setModuleName().

◆ setModuleVersion

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.

Definition at line 300 of file QSimpleUpdater.cpp.

References Updater::setModuleVersion(), and version.

Referenced by ecvUpdateDlg::checkForUpdates(), and Window::checkForUpdates().

◆ setNotifyOnFinish

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

Definition at line 268 of file QSimpleUpdater.cpp.

References Updater::setNotifyOnFinish().

Referenced by ecvUpdateDlg::checkForUpdates(), and Window::checkForUpdates().

◆ setNotifyOnUpdate

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

Definition at line 255 of file QSimpleUpdater.cpp.

References Updater::setNotifyOnUpdate().

Referenced by ecvUpdateDlg::checkForUpdates(), and Window::checkForUpdates().

◆ setPlatformKey

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

Definition at line 287 of file QSimpleUpdater.cpp.

References Updater::setPlatformKey().

◆ setUseCustomAppcast

void QSimpleUpdater::setUseCustomAppcast ( const QString &  url,
const bool  customAppcast 
)
slot

If the customAppcast parameter is set to true, then the Updater will not try to read the network reply from the server, instead, it will emit the appcastDownloaded() signal, which allows the application to read and interpret the appcast file by itself.

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

Definition at line 339 of file QSimpleUpdater.cpp.

References Updater::setUseCustomAppcast().

Referenced by ecvUpdateDlg::checkForUpdates(), and Window::checkForUpdates().

◆ setUseCustomInstallProcedures

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

Definition at line 355 of file QSimpleUpdater.cpp.

References Updater::setUseCustomInstallProcedures().

◆ setUserAgentString

void QSimpleUpdater::setUserAgentString ( const QString &  url,
const QString &  agent 
)
slot

Changes the user-agent string used by the updater to communicate with the remote server

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

Definition at line 325 of file QSimpleUpdater.cpp.

References Updater::setUserAgentString().

◆ usesCustomAppcast()

bool QSimpleUpdater::usesCustomAppcast ( const QString &  url) const

Returns true if the Updater instance registered with the given url uses a custom appcast format and/or allows the application to read and interpret the downloaded appcast file

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

Definition at line 41 of file QSimpleUpdater.cpp.

References Updater::customAppcast().

◆ usesCustomInstallProcedures()

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

Definition at line 106 of file QSimpleUpdater.cpp.

References Updater::useCustomInstallProcedures().


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