QtAutoUpdater  3.0.0
A Qt library to automatically check for updates and install them
Classes | Public Member Functions | List of all members
de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater Class Reference

A singleton class to create instances of different QtAutoUpdater types. More...

#include <qmlautoupdatersingleton.h>

+ Inheritance diagram for de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater:

Public Member Functions

Q_INVOKABLE QVariant createInfo (QVariant identifier, QString name, const QVariant &version, QVariantMap data={}) const
 Creates a QtAutoUpdater::UpdateInfo from the given parameters.
 
Q_INVOKABLE QVariantList infosAsList (const QList< QtAutoUpdater::UpdateInfo > &infos) const
 Converts a list of QtAutoUpdater::UpdateInfos to a QVariantList, which can be consumed in QML.
 
Q_INVOKABLE QtAutoUpdater::UpdatercreateUpdater (const QString &configPath, QObject *parent=nullptr) const
 Creates an updater instance using the given configuration file. More...
 
Q_INVOKABLE QtAutoUpdater::UpdatercreateUpdater (QSettings *config, QObject *parent=nullptr) const
 Creates an updater instance using the given configuration object. More...
 
Q_INVOKABLE QtAutoUpdater::UpdatercreateUpdater (QString key, QVariantMap configuration, QObject *parent=nullptr) const
 Creates an updater instance using the given backend and configuration. More...
 
Q_INVOKABLE QtAutoUpdater::UpdatercreateUpdater (QObject *qmlConfigOrParent=nullptr) const
 Creates an updater instance using the given object as either QML configuration or as parent. More...
 
Q_INVOKABLE QtAutoUpdater::UpdatercreateUpdater (QObject *qmlConfig, QObject *parent) const
 Creates an updater instance using the given QML configuration and parent. More...
 

Detailed Description

A singleton class to create instances of different QtAutoUpdater types.

Since
3.0

Definition at line 21 of file qmlautoupdatersingleton.h.

Member Function Documentation

◆ createUpdater() [1/5]

Q_INVOKABLE QtAutoUpdater::Updater* de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::createUpdater ( const QString configPath,
QObject parent = nullptr 
) const

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

◆ createUpdater() [2/5]

Q_INVOKABLE QtAutoUpdater::Updater* de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::createUpdater ( QObject qmlConfig,
QObject parent 
) const

Creates an updater instance using the given QML configuration and parent.

Parameters
qmlConfigThe 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 qmlConfig must be an instance of Qt.labs.settings.Settings or QSettings. If it is neither, no updater can be created an nullptr gets returned

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, Qt.labs.settings.Settings, QSettings

◆ createUpdater() [3/5]

Q_INVOKABLE QtAutoUpdater::Updater* de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::createUpdater ( QObject qmlConfigOrParent = nullptr) const

Creates an updater instance using the given object as either QML configuration or as parent.

Parameters
qmlConfigOrParentThe object to be consumed
Returns
A newly created updater instance or nullptr, if unable to create one.

The qmlConfigOrParent can be interpreted in different ways. If it is a Qt.labs.settings.Settings instance, it is used as the configuration, but not as the parent. Otherwise it is used as the parent.

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, Qt.labs.settings.Settings

◆ createUpdater() [4/5]

Q_INVOKABLE QtAutoUpdater::Updater* de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::createUpdater ( QSettings config,
QObject parent = nullptr 
) const

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

◆ createUpdater() [5/5]

Q_INVOKABLE QtAutoUpdater::Updater* de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::createUpdater ( QString  key,
QVariantMap  configuration,
QObject parent = nullptr 
) const

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

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