QtAutoUpdater  3.0.0
A Qt library to automatically check for updates and install them
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Properties | List of all members
QtAutoUpdater::Updater Class Reference

The main updater. Can check for updates and trigger update installations. More...

#include <updater.h>

+ Inheritance diagram for QtAutoUpdater::Updater:

Public Types

enum  State {
  State::NoUpdates = 0, State::Checking, State::Canceling, State::NewUpdates,
  State::Installing, State::Error = -1
}
 The state of the updater. More...
 
enum  InstallModeFlag { InstallModeFlag::Parallel = 0x00, InstallModeFlag::OnExit = 0x01, InstallModeFlag::Force = 0x02, InstallModeFlag::ForceOnExit = (OnExit | Force) }
 Flags to indicate how to run the installer. More...
 
enum  InstallScope { InstallScope::PreferInternal, InstallScope::PreferExternal }
 Defines the different installation scopes. More...
 

Public Slots

void checkForUpdates ()
 Starts checking for updates. More...
 
void abortUpdateCheck (int killDelay=5000)
 Aborts checking for updates. More...
 
void cancelScheduledUpdate (int taskId)
 Cancels the scheduled update with taskId. More...
 
void cancelExitRun ()
 RESET accessor for runOnExit.
 

Signals

void checkUpdatesDone (QtAutoUpdater::Updater::State result, QPrivateSignal)
 Will be emitted as soon as the updater finished checking for updates. More...
 
void progressChanged (double progress, const QString &status, QPrivateSignal)
 Will be emitted to report a change in the update check progress. More...
 
void showInstaller (QtAutoUpdater::UpdateInstaller *installer, QPrivateSignal)
 Will be emitted when a started installation requires an installer to be shown. More...
 
void installDone (bool success, QPrivateSignal)
 Will be emitted when a started parallel installation has finished. More...
 
void stateChanged (QtAutoUpdater::Updater::State state, QPrivateSignal)
 NOTIFY accessor for Updater::state.
 
void runningChanged (bool running, QPrivateSignal)
 NOTIFY accessor for Updater::running.
 
void updateInfoChanged (QList< QtAutoUpdater::UpdateInfo > updateInfo, QPrivateSignal)
 NOTIFY accessor for Updater::updateInfo.
 
void runOnExitChanged (bool runOnExit, QPrivateSignal)
 NOTIFY accessor for Updater::runOnExit.
 

Public Member Functions

 ~Updater () override
 Destroyes the updater and kills the update check (if running) More...
 
Q_INVOKABLE QtAutoUpdater::UpdaterBackendbackend () const
 Returns the backend used by this updater instance.
 
UpdaterBackend::Features features () const
 READ accessor for Updater::features.
 
State state () const
 READ accessor for Updater::state.
 
bool isRunning () const
 READ accessor for Updater::running.
 
QList< UpdateInfoupdateInfo () const
 READ accessor for Updater::updateInfo.
 
bool willRunOnExit () const
 READ accessor for Updater::runOnExit.
 
int scheduleUpdate (std::chrono::seconds delaySeconds, bool repeated=false)
 Schedules an update after a specific delay, optionally repeated. More...
 
Q_INVOKABLE int scheduleUpdate (int delaySeconds, bool repeated=false)
 Schedules an update after a specific delay, optionally repeated. More...
 
template<typename TRep , typename TPeriod >
int scheduleUpdate (const std::chrono::duration< TRep, TPeriod > &delaySeconds, bool repeated=false)
 Schedules an update after a specific delay, optionally repeated. More...
 
Q_INVOKABLE int scheduleUpdate (const QDateTime &when)
 Schedules an update for a specific timepoint. More...
 
template<typename TClock , typename TDur >
int scheduleUpdate (const std::chrono::time_point< TClock, TDur > &when)
 Schedules an update for a specific timepoint. More...
 
Q_INVOKABLE bool runUpdater (InstallMode mode=InstallModeFlag::Parallel, InstallScope scope=InstallScope::PreferInternal)
 Launches an update installer based on the given mode and scope. More...
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Static Public Member Functions

static QStringList supportedUpdaterBackends ()
 Returns a list of all currently available backends.
 
static Updatercreate (QObject *parent=nullptr)
 Creates an updater instance using the default configuration. More...
 
static Updatercreate (const QString &configPath, QObject *parent=nullptr)
 Creates an updater instance using the given configuration file. More...
 
static Updatercreate (QSettings *config, QObject *parent=nullptr)
 Creates an updater instance using the given configuration object. More...
 
static Updatercreate (QString key, QVariantMap configuration, QObject *parent=nullptr)
 Creates an updater instance using the given backend and configuration. More...
 
static Updatercreate (UpdaterBackend::IConfigReader *configReader, QObject *parent=nullptr)
 Creates an updater instance using the given configuration reader. More...
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 

Properties

QtAutoUpdater::UpdaterBackend::Features features
 Holds the features of the backend used by the updater. More...
 
QtAutoUpdater::Updater::State state
 Reports the state the updater is currently in. More...
 
bool running
 Specifies whether the updater is currently running or not. More...
 
QList< QtAutoUpdater::UpdateInfoupdateInfo
 Holds extended information about the last update check. More...
 
bool runOnExit
 Specifies whether an installer will be launched when the application exits. More...
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Detailed Description

The main updater. Can check for updates and trigger update installations.

The updater class acts as a user friendly frontend to the UpdaterBackend. It is the primary class of this module and can be used to check for updates and install them, if supported. The actual feature set of the updater depends on the backend used, but all backends support at least checking for updates.

See also
index REAMDE.md, QtAutoUpdater::UpdaterBackend, Updater::features, Updater Backend Plugins

Definition at line 26 of file updater.h.

Member Enumeration Documentation

◆ InstallModeFlag

Flags to indicate how to run the installer.

Enumerator
Parallel 

Prefer the installation to be run in parallel to the running application.

OnExit 

Prefer the installation to be run when the application exits.

Force 

Force the Parallel or OnExit behaviour and fail otherwise.

ForceOnExit 

Short for OnExit | Force.

Definition at line 55 of file updater.h.

◆ InstallScope

Defines the different installation scopes.

Enumerator
PreferInternal 

Prefer the installer to be run as internal window of this application.

PreferExternal 

Prefer the installer to be run as external tool.

Definition at line 67 of file updater.h.

◆ State

The state of the updater.

Enumerator
NoUpdates 

The updater is not active and there are no updates to be installed.

Checking 

The updater is currently checking for new updates.

Canceling 

The updater is trying to cancel an update check.

NewUpdates 

The updater is not active, but new updates are available.

Installing 

The updater is blocked because there is currently an installation running.

Error 

The updater is not active because an error occured.

Definition at line 43 of file updater.h.

Constructor & Destructor Documentation

◆ ~Updater()

QtAutoUpdater::Updater::~Updater ( )
override

Destroyes the updater and kills the update check (if running)

Warning
Destroying the updater while it is still running can crash your application! Always make shure to abort update checks and wait for them to finish before doing so.
See also
Updater::running, Updater::abortUpdateCheck

Member Function Documentation

◆ abortUpdateCheck

QtAutoUpdater::Updater::abortUpdateCheck ( int  killDelay = 5000)
slot

Aborts checking for updates.

Parameters
killDelayThe maximum delay to wait for the process to gracefully finish

Tries to abort the update check. If no update is currently running (Updater::state != Checking), nothing will happen.

If killDelay is greater than 0, the updater will try to gracefully terminate the check. After this is done, the updater will wait at most killDelay milliseconds for the process to finish. If it doesn't, it will be killed hard. It will be killed hard immediately, if the delay is set to 0. A value below 0 indicates, that only the terminate should happen, without a hard kill timeout.

Warning
In most cases there will be no side-effects of an abort. However, if the backend has to be killed, because of no delay or a timeout, this may cause unwanted effects.
See also
Updater::checkForUpdates, Updater::state, Updater::running

◆ cancelScheduledUpdate

QtAutoUpdater::Updater::cancelScheduledUpdate ( int  taskId)
slot

Cancels the scheduled update with taskId.

Parameters
taskIdThe id of the task to be canceled

Cancels the task with the id taskId. If there was a task with that ID, you can be shure that it will be canceled. If the task was not until the point you call this function, it will not be triggered anymore.

See also
Updater::scheduleUpdate, Updater::abortUpdateCheck

◆ checkForUpdates

QtAutoUpdater::Updater::checkForUpdates ( )
slot

Starts checking for updates.

Checking for updates means that the backend will perform the check in the background. If already in the running state, nothing happens instead. The updater now enters the Checking state and performs the check. The result will be reported via the checkUpdatesDone() signal (and the state).

See also
Updater::abortUpdateCheck, Updater::checkUpdatesDone, Updater::state, Updater::running, Updater::updateInfo

◆ checkUpdatesDone

QtAutoUpdater::Updater::checkUpdatesDone ( QtAutoUpdater::Updater::State  result,
QPrivateSignal   
)
signal

Will be emitted as soon as the updater finished checking for updates.

Parameters
resultThe result state the updater reached after checking for updates

This signal is emitted if the updater was in the Checking state and has finished that task. It will now be in one of the three non-running states NoUpdates, NewUpdates or Error. This is a signal for convenience to only catch those specific state changes, instead of all by using the state property.

See also
Updater::checkForUpdates, Updater::state, Updater::updateInfo

◆ create() [1/5]

QtAutoUpdater::Updater::create ( const QString configPath,
QObject parent = nullptr 
)
static

Creates an updater instance using the given configuration file.

Parameters
configPathThe path to the configuration file
parentThe object to be set as the parent for the created updater
Returns
A newly created updater instance or nullptr, if unable to create one.

The backend is loaded based on the given configuration file, which must be in the QSettings::IniFormat. It must contain the "backend" entry, set to the updater backend to be used. If the file does not exists or backend is invalid, nullptr is returned. Otherwise the created instance, initialized using the given configuration.

Attention
For some update installations, an updater needs to be launched on exit of the running application. This only works if the updater lives long enough to catch the QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need to be run on exit, you should use either qApp or nullptr as parent for the updater.
See also
Updater::supportedUpdaterBackends, Updater Backend Plugins

◆ create() [2/5]

QtAutoUpdater::Updater::create ( QObject parent = nullptr)
static

Creates an updater instance using the default configuration.

Parameters
parentThe object to be set as the parent for the created updater
Returns
A newly created updater instance or nullptr, if unable to create one.

This method assumes the configuration for the updater to be create is located at a default location. The location is searched as follows:

  1. Windows only: Check for a group name "updater" in the applications default registry group
  2. Search all application configuration paths (QStandardPaths::AppConfigLocation) for a file named updater.conf
  3. Search all application data paths (QStandardPaths::AppDataLocation) for a file named updater.conf

If none of these work and no config can be found, nullptr is returned. If it is found, it must contain the "backend" entry, set to the updater backend to be used. The backend will get initialized using the found configuration.

Attention
For some update installations, an updater needs to be launched on exit of the running application. This only works if the updater lives long enough to catch the QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need to be run on exit, you should use either qApp or nullptr as parent for the updater.
See also
Updater::supportedUpdaterBackends, Updater Backend Plugins

◆ create() [3/5]

QtAutoUpdater::Updater::create ( QSettings config,
QObject parent = nullptr 
)
static

Creates an updater instance using the given configuration object.

Parameters
configThe configuration object
parentThe object to be set as the parent for the created updater
Returns
A newly created updater instance or nullptr, if unable to create one.

The backend is loaded based on the given configuration. It must contain the "backend" entry, set to the updater backend to be used. If the backend is missing or invalid, nullptr is returned. Otherwise the created instance, initialized using the given configuration.

Attention
For some update installations, an updater needs to be launched on exit of the running application. This only works if the updater lives long enough to catch the QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need to be run on exit, you should use either qApp or nullptr as parent for the updater.
See also
Updater::supportedUpdaterBackends, Updater Backend Plugins

◆ create() [4/5]

QtAutoUpdater::Updater::create ( QString  key,
QVariantMap  configuration,
QObject parent = nullptr 
)
static

Creates an updater instance using the given backend and configuration.

Parameters
keyThe key of the backend to be loaded
configurationThe configuration to be passed to the backend to configure it
parentThe object to be set as the parent for the created updater
Returns
A newly created updater instance or nullptr, if unable to create one.

The backend is loaded based on the given key. If no backend was found for the key, nullptr is returned. Otherwise the created instance. The configuration is used to initialize the backend.

Attention
For some update installations, an updater needs to be launched on exit of the running application. This only works if the updater lives long enough to catch the QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need to be run on exit, you should use either qApp or nullptr as parent for the updater.
See also
Updater::supportedUpdaterBackends, Updater Backend Plugins

◆ create() [5/5]

QtAutoUpdater::Updater::create ( UpdaterBackend::IConfigReader configReader,
QObject parent = nullptr 
)
static

Creates an updater instance using the given configuration reader.

Parameters
configReaderThe configuration reader object
parentThe object to be set as the parent for the created updater
Returns
A newly created updater instance or nullptr, if unable to create one.

The backend is loaded based on the given configuration. It must contain the "backend" entry, set to the updater backend to be used. If the backend is missing or invalid, nullptr is returned. Otherwise the created instance, initialized using the given configuration.

Note
Only use this method if you have to provide your own implementation of the IConfigReader. Prefer the other overloads.
Attention
For some update installations, an updater needs to be launched on exit of the running application. This only works if the updater lives long enough to catch the QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need to be run on exit, you should use either qApp or nullptr as parent for the updater.
See also
Updater::supportedUpdaterBackends, Updater Backend Plugins, UpdaterBackend::IConfigReader

◆ installDone

QtAutoUpdater::Updater::installDone ( bool  success,
QPrivateSignal   
)
signal

Will be emitted when a started parallel installation has finished.

Parameters
successReports whether the update installer did succeed or not

This signal is emitted if runUpdater() launched a parallel installation (either a performed or a triggered installation) and that installation finished. If the installation was successfully completed, success will be true, otherwise false.

See also
Updater::runUpdater, Updater::features

◆ progressChanged

QtAutoUpdater::Updater::progressChanged ( double  progress,
const QString status,
QPrivateSignal   
)
signal

Will be emitted to report a change in the update check progress.

Parameters
progressA percentage value representing the check progress
statusA localized status string to explaing the current state of the check process

This signal provides the current state of the update check process. percent can either range from 0.0 to 1.0 to present an actual percentage, or be -1.0 to represent an indeterminate progress. Status can be empty to be unchanged/unset. Not all update backends support reporting detailes status. Check the features property for the UpdaterBackend::Feature::CheckProgress flag to verify this.

See also
Updater::checkForUpdates, Updater::state, Updater::features, UpdaterBackend::Feature

◆ runUpdater()

QtAutoUpdater::Updater::runUpdater ( InstallMode  mode = InstallModeFlag::Parallel,
InstallScope  scope = InstallScope::PreferInternal 
)

Launches an update installer based on the given mode and scope.

Parameters
modeThe preferred mode to start the updater in
scopeThe preferred scope to use for the updater
Returns
true, if the update installer was started, false if not

This method launches the installer, based on the given mode, scope and the features that the backend supports. It will either launch the internal installer ("perform"), by emitting showInstaller(), launch a parallel external install process immediately ("trigger") and track it's exection, or mark an external installer to be executed as soon as the application quits ("onExit"). The following table shows which parameters and flags trigger which mode. The flags are evaluated in the order seen in the table, so if multiple flags are set, those who are displayed here first are the onces that decide what happens

Mode Scope Flags Result
Parallel PreferInternal PerformInstall perform
ParallelTrigger trigger
TriggerInstall onExit
PreferExternal ParallelTrigger trigger
PerformInstall perform
TriggerInstall onExit
Parallel | Force PreferInternal PerformInstall perform
ParallelTrigger trigger
TriggerInstall -
PreferExternal ParallelTrigger trigger
PerformInstall perform
TriggerInstall -
OnExit PreferInternal TriggerInstall onExit
ParallelTrigger onExit
PerformInstall perform
PreferExternal Same as PreferInternal
OnExit | Force PreferInternal TriggerInstall onExit
ParallelTrigger onExit
PerformInstall -
PreferExternal Same as PreferInternal

For some force configurations, - is specified. This means no updater can be run and false is returned instead. If you want to find out whether an installation as been launched immediatly (Parallel) or delayed (OnExit), query the runOnExit property.

See also
Updater::state, Updater::installDone, Updater::showInstaller, Updater::runOnExit

◆ scheduleUpdate() [1/5]

QtAutoUpdater::Updater::scheduleUpdate ( const QDateTime when)

Schedules an update for a specific timepoint.

Parameters
whenThe timepoint where the update should be started
Returns
The internal ID of this update task. Can be used to cancel the task

Schedules an update to be run at when. If when is in the past, nothing will happen and 0 will be returned. The update will be started once that time is reached (assuming that this updater instance is still alive at that timepoint).

Note
After scheduling the update, you will have no way to track of the schedule. If the updater is already running while the task is triggered, nothing will happend. The scheduled update will only work if this instance of the updater is still alive at that time.
See also
Updater::cancelScheduledUpdate, Updater::checkForUpdates

◆ scheduleUpdate() [2/5]

template<typename TRep , typename TPeriod >
int QtAutoUpdater::Updater::scheduleUpdate ( const std::chrono::duration< TRep, TPeriod > &  delaySeconds,
bool  repeated = false 
)

Schedules an update after a specific delay, optionally repeated.

Parameters
delaySecondsThe time (in seconds) to wait until the update is started
repeatedSpecifies, whether the updater should be started every delaySeconds or only once
Returns
The internal ID of this update task. Can be used to cancel the task

Schedules an update to be run after delaySeconds seconds. If repeated is true, the updater will not just be run once, but every delaySeconds seconds (indefinitly, until this instance is destroyed or the task canceled).

Note
After scheduling the update, you will have no way to track of the schedule. If the updater is already running while the task is triggered, nothing will happend. The scheduled update will only work if this instance of the updater is still alive at that time.
See also
Updater::cancelScheduledUpdate, Updater::checkForUpdates

Definition at line 173 of file updater.h.

◆ scheduleUpdate() [3/5]

template<typename TClock , typename TDur >
int QtAutoUpdater::Updater::scheduleUpdate ( const std::chrono::time_point< TClock, TDur > &  when)

Schedules an update for a specific timepoint.

Parameters
whenThe timepoint where the update should be started
Returns
The internal ID of this update task. Can be used to cancel the task

Schedules an update to be run at when. If when is in the past, nothing will happen and 0 will be returned. The update will be started once that time is reached (assuming that this updater instance is still alive at that timepoint).

Note
After scheduling the update, you will have no way to track of the schedule. If the updater is already running while the task is triggered, nothing will happend. The scheduled update will only work if this instance of the updater is still alive at that time.
See also
Updater::cancelScheduledUpdate, Updater::checkForUpdates

Definition at line 180 of file updater.h.

◆ scheduleUpdate() [4/5]

Q_INVOKABLE int QtAutoUpdater::Updater::scheduleUpdate ( int  delaySeconds,
bool  repeated = false 
)

Schedules an update after a specific delay, optionally repeated.

Parameters
delaySecondsThe time (in seconds) to wait until the update is started
repeatedSpecifies, whether the updater should be started every delaySeconds or only once
Returns
The internal ID of this update task. Can be used to cancel the task

Schedules an update to be run after delaySeconds seconds. If repeated is true, the updater will not just be run once, but every delaySeconds seconds (indefinitly, until this instance is destroyed or the task canceled).

Note
After scheduling the update, you will have no way to track of the schedule. If the updater is already running while the task is triggered, nothing will happend. The scheduled update will only work if this instance of the updater is still alive at that time.
See also
Updater::cancelScheduledUpdate, Updater::checkForUpdates

◆ scheduleUpdate() [5/5]

QtAutoUpdater::Updater::scheduleUpdate ( std::chrono::seconds  delaySeconds,
bool  repeated = false 
)

Schedules an update after a specific delay, optionally repeated.

Parameters
delaySecondsThe time (in seconds) to wait until the update is started
repeatedSpecifies, whether the updater should be started every delaySeconds or only once
Returns
The internal ID of this update task. Can be used to cancel the task

Schedules an update to be run after delaySeconds seconds. If repeated is true, the updater will not just be run once, but every delaySeconds seconds (indefinitly, until this instance is destroyed or the task canceled).

Note
After scheduling the update, you will have no way to track of the schedule. If the updater is already running while the task is triggered, nothing will happend. The scheduled update will only work if this instance of the updater is still alive at that time.
See also
Updater::cancelScheduledUpdate, Updater::checkForUpdates

◆ showInstaller

QtAutoUpdater::Updater::showInstaller ( QtAutoUpdater::UpdateInstaller installer,
QPrivateSignal   
)
signal

Will be emitted when a started installation requires an installer to be shown.

Parameters
installerThe installer to be shown

This signal is emitted if runUpdater() decides to perform an internal update installation. It will create an installer from the backend and pass it back via this signal. The installer should be used by some kind of UI to guide the user through the installation process.

See also
Updater::runUpdater, Updater::features, UpdateInstaller

Property Documentation

◆ features

QtAutoUpdater::Updater::features
read

Holds the features of the backend used by the updater.

Default: UpdaterBackend::CheckUpdates

These features depend on what the backend implementation supports and thus differ based on the update mechanism used for your application. The features dictate what can be done with the backend. All backends can check for updates, but installing is only supported on some in one way or another.

Accessors
READfeatures()
CONSTANT
See also
UpdaterBackend::Feature, UpdaterBackend::features()

Definition at line 31 of file updater.h.

◆ running

QtAutoUpdater::Updater::running
read

Specifies whether the updater is currently running or not.

Default: false

Convenience property that simplifies the state property into a boolean property that reports whether the updater is doing something or not. States are mapped as follows:

State Running
NoUpdates false
Checking true
Canceling true
NewUpdates false
Installing true
Error false

Checking for updates and installing is only possible when the updater is not running

Accessors
READisRunning()
NOTIFYrunningChanged()
See also
Updater::checkForUpdates, Updater::state

Definition at line 35 of file updater.h.

◆ runOnExit

QtAutoUpdater::Updater::runOnExit
read

Specifies whether an installer will be launched when the application exits.

Default: false

Specifies if an installer will be launched automatically, as soon as the application exists. This property is read only, but will be set when runUpdater() leads to an installer beeing queued to be run on exit.

To reset this property use the cancelExitRun() method. If an exit run was scheduled, this will disable it. To reenable it, call runUpdater() again

Accessors
READwillRunOnExit()
RESETcancelExitRun()
NOTIFYrunOnExitChanged()
See also
Updater::runUpdater

Definition at line 39 of file updater.h.

◆ state

QtAutoUpdater::Updater::state
read

Reports the state the updater is currently in.

Default: Updater::State::NoUpdates

The state represents what the updater is currently doing. Certain operations are only possible in certain states. For example, you can only install updates if the updater is in the NewUpdates state.

Note
If you are only interested in whether the updater is doing something or not, use the running property instead
Accessors
READstate()
NOTIFYstateChanged()
See also
Updater::checkForUpdates, Updater::running

Definition at line 33 of file updater.h.

◆ updateInfo

QtAutoUpdater::Updater::updateInfo
read

Holds extended information about the last update check.

Default: <empty list>

This property is always empty, unless the state is Updater::State::NewUpdates. In that case, it will hold the update information of those available updates. Whenever the updater leaves this state, this property will be cleared as well.

Accessors
READupdateInfo()
NOTIFYupdateInfoChanged()
See also
Updater::state, Updater::running, Updater::checkForUpdates

Definition at line 37 of file updater.h.


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