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

Downloads and interprests the update definition file. More...

#include <Updater.h>

Inheritance diagram for Updater:
Collaboration diagram for Updater:

Public Slots

void checkForUpdates ()
 
void setUrl (const QString &url)
 
void setModuleName (const QString &name)
 
void setNotifyOnUpdate (const bool notify)
 
void setNotifyOnFinish (const bool notify)
 
void setUserAgentString (const QString &agent)
 
void setModuleVersion (const QString &version)
 
void setDownloaderEnabled (const bool enabled)
 
void setPlatformKey (const QString &platformKey)
 
void setUseCustomAppcast (const bool customAppcast)
 
void setUseCustomInstallProcedures (const bool custom)
 
void setMandatoryUpdate (const bool mandatory_update)
 

Signals

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

Public Member Functions

 Updater ()
 
 ~Updater ()
 
QString url () const
 
QString openUrl () const
 
QString changelog () const
 
QString moduleName () const
 
QString downloadUrl () const
 
QString platformKey () const
 
QString moduleVersion () const
 
QString latestVersion () const
 
QString userAgentString () const
 
bool mandatoryUpdate () const
 
bool customAppcast () const
 
bool notifyOnUpdate () const
 
bool notifyOnFinish () const
 
bool updateAvailable () const
 
bool downloaderEnabled () const
 
bool useCustomInstallProcedures () const
 

Detailed Description

Downloads and interprests the update definition file.

Definition at line 22 of file Updater.h.

Constructor & Destructor Documentation

◆ Updater()

Updater::Updater ( )

Definition at line 20 of file Updater.cpp.

References downloadFinished(), and setUserAgentString().

◆ ~Updater()

Updater::~Updater ( )

Definition at line 57 of file Updater.cpp.

Member Function Documentation

◆ appcastDownloaded

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

◆ changelog()

QString Updater::changelog ( ) const

Returns the changelog defined by the update definitions file.

Warning
You should call checkForUpdates() before using this function

Definition at line 85 of file Updater.cpp.

Referenced by QSimpleUpdater::getChangelog().

◆ checkForUpdates

void Updater::checkForUpdates ( )
slot

Downloads and interpets the update definitions file referenced by the url() function.

Definition at line 221 of file Updater.cpp.

References url(), and userAgentString().

Referenced by QSimpleUpdater::checkForUpdates().

◆ checkingFinished

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

◆ customAppcast()

bool Updater::customAppcast ( ) const

Returns true if the updater should NOT interpret the downloaded appcast. This is useful if you need to store more variables (or information) in the JSON file or use another appcast format (e.g. XML)

Definition at line 153 of file Updater.cpp.

Referenced by setUseCustomAppcast(), and QSimpleUpdater::usesCustomAppcast().

◆ downloaderEnabled()

bool Updater::downloaderEnabled ( ) const

Returns true if the integrated downloader is enabled.

Note
If set to true, the Updater will open the downloader dialog if the user agrees to download the update.

Definition at line 202 of file Updater.cpp.

Referenced by QSimpleUpdater::getDownloaderEnabled().

◆ downloadFinished

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

Referenced by Updater().

◆ downloadUrl()

QString Updater::downloadUrl ( ) const

Returns the download URL defined by the update definitions file.

Warning
You should call checkForUpdates() before using this function

Definition at line 117 of file Updater.cpp.

Referenced by QSimpleUpdater::getDownloadUrl().

◆ latestVersion()

QString Updater::latestVersion ( ) const

Returns the latest version defined by the update definitions file.

Warning
You should call checkForUpdates() before using this function

Definition at line 126 of file Updater.cpp.

Referenced by QSimpleUpdater::getLatestVersion().

◆ mandatoryUpdate()

bool Updater::mandatoryUpdate ( ) const

Returns true if there the current update is mandatory.

Warning
You should call checkForUpdates() before using this function

Definition at line 183 of file Updater.cpp.

◆ moduleName()

QString Updater::moduleName ( ) const

Returns the name of the module (if defined)

Definition at line 93 of file Updater.cpp.

Referenced by QSimpleUpdater::getModuleName().

◆ moduleVersion()

QString Updater::moduleVersion ( ) const

Returns the "local" version of the installed module

Definition at line 143 of file Updater.cpp.

Referenced by QSimpleUpdater::getModuleVersion().

◆ notifyOnFinish()

bool Updater::notifyOnFinish ( ) const

Returns true if the updater should notify the user when it finishes checking for updates.

Note
If set to true, the Updater will notify the user even when there are no updates available (by congratulating him/her about being smart)

Definition at line 174 of file Updater.cpp.

Referenced by QSimpleUpdater::getNotifyOnFinish().

◆ notifyOnUpdate()

bool Updater::notifyOnUpdate ( ) const

Returns true if the updater should notify the user when an update is available.

Definition at line 162 of file Updater.cpp.

Referenced by QSimpleUpdater::getNotifyOnUpdate().

◆ openUrl()

QString Updater::openUrl ( ) const

Returns the URL that the update definitions file wants us to open in a web browser.

Warning
You should call checkForUpdates() before using this functio

Definition at line 76 of file Updater.cpp.

Referenced by QSimpleUpdater::getOpenUrl().

◆ platformKey()

QString Updater::platformKey ( ) const

Returns the platform key (be it system-set or user-set). 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

Definition at line 108 of file Updater.cpp.

Referenced by QSimpleUpdater::getPlatformKey(), and setPlatformKey().

◆ setDownloaderEnabled

void Updater::setDownloaderEnabled ( const bool  enabled)
slot

If the enabled parameter is set to true, the Updater will open the integrated downloader if the user agrees to install the update (if any)

Definition at line 294 of file Updater.cpp.

Referenced by QSimpleUpdater::setDownloaderEnabled().

◆ setMandatoryUpdate

void Updater::setMandatoryUpdate ( const bool  mandatory_update)
slot

If the mandatory_update is set to true, the Updater has to download and install the update. If the user cancels or exits, the application will close

Definition at line 338 of file Updater.cpp.

Referenced by QSimpleUpdater::setMandatoryUpdate().

◆ setModuleName

void Updater::setModuleName ( const QString &  name)
slot

Changes the module name.

Note
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 244 of file Updater.cpp.

References name.

Referenced by QSimpleUpdater::setModuleName().

◆ setModuleVersion

void Updater::setModuleVersion ( const QString &  version)
slot

Changes the module version

Note
The module version is used to compare the local and remote versions. If the version parameter is empty, then the Updater will use the application version (referenced by qApp)

Definition at line 285 of file Updater.cpp.

References version.

Referenced by QSimpleUpdater::setModuleVersion().

◆ setNotifyOnFinish

void Updater::setNotifyOnFinish ( const bool  notify)
slot

If notify is set to true, then the Updater will notify the user when it has finished interpreting the update definitions file.

Definition at line 262 of file Updater.cpp.

Referenced by QSimpleUpdater::setNotifyOnFinish().

◆ setNotifyOnUpdate

void Updater::setNotifyOnUpdate ( const bool  notify)
slot

If notify is set to true, then the Updater will notify the user when an update is available.

Definition at line 253 of file Updater.cpp.

Referenced by QSimpleUpdater::setNotifyOnUpdate().

◆ setPlatformKey

void Updater::setPlatformKey ( const QString &  platformKey)
slot

Changes the platform key. 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

Definition at line 308 of file Updater.cpp.

References platformKey().

Referenced by QSimpleUpdater::setPlatformKey().

◆ setUrl

void Updater::setUrl ( const QString &  url)
slot

Changes the url in which the Updater can find the update definitions file.

Definition at line 234 of file Updater.cpp.

References url().

◆ setUseCustomAppcast

void Updater::setUseCustomAppcast ( 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

Definition at line 319 of file Updater.cpp.

References customAppcast().

Referenced by QSimpleUpdater::setUseCustomAppcast().

◆ setUseCustomInstallProcedures

void Updater::setUseCustomInstallProcedures ( const bool  custom)
slot

If the custom parameter is set to true, the Updater will not try to open the downloaded file. Use the signals fired by the QSimpleUpdater to install the update from the downloaded file by yourself.

Definition at line 329 of file Updater.cpp.

References Downloader::setUseCustomInstallProcedures().

Referenced by QSimpleUpdater::setUseCustomInstallProcedures().

◆ setUserAgentString

void Updater::setUserAgentString ( const QString &  agent)
slot

Changes the user agent string used to identify the client application from the server in a HTTP session.

By default, the user agent will co

Definition at line 273 of file Updater.cpp.

References Downloader::setUserAgentString().

Referenced by QSimpleUpdater::setUserAgentString(), and Updater().

◆ updateAvailable()

bool Updater::updateAvailable ( ) const

Returns true if there is an update available.

Warning
You should call checkForUpdates() before using this function

Definition at line 192 of file Updater.cpp.

Referenced by QSimpleUpdater::getUpdateAvailable().

◆ url()

QString Updater::url ( ) const

Returns the URL of the update definitions file

Definition at line 65 of file Updater.cpp.

Referenced by checkForUpdates(), and setUrl().

◆ useCustomInstallProcedures()

bool Updater::useCustomInstallProcedures ( ) const

Returns true if the updater shall not intervene when the download has finished (you can use the QSimpleUpdater signals to know when the download is completed).

Definition at line 212 of file Updater.cpp.

References Downloader::useCustomInstallProcedures().

Referenced by QSimpleUpdater::usesCustomInstallProcedures().

◆ userAgentString()

QString Updater::userAgentString ( ) const

Returns the user-agent header used by the client when communicating with the server through HTTP

Definition at line 135 of file Updater.cpp.

Referenced by checkForUpdates(), and QSimpleUpdater::getUserAgentString().


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