QtAutoUpdater  3.0.0
A Qt library to automatically check for updates and install them
qmlautoupdatersingleton.h
1 #ifndef QMLAUTOUPDATERSINGLETON_H
2 #define QMLAUTOUPDATERSINGLETON_H
3 
4 #include <QtCore/QObject>
5 #include <QtCore/QSettings>
6 #include <QtCore/QPointer>
7 
8 #include <QtAutoUpdaterCore/UpdateInfo>
9 #include <QtAutoUpdaterCore/Updater>
10 #include <QtAutoUpdaterCore/UpdaterBackend>
11 
12 
13 #ifdef DOXYGEN_RUN
15 
22 #else
23 namespace QtAutoUpdater {
24 
25 class QmlAutoUpdaterSingleton : public QObject
26 #endif
27 {
28  Q_OBJECT
29 
30 public:
32  explicit QmlAutoUpdaterSingleton(QObject *parent = nullptr);
33 
35  Q_INVOKABLE QVariant createInfo(QVariant identifier, QString name, const QVariant &version, QVariantMap data = {}) const;
37  Q_INVOKABLE QVariantList infosAsList(const QList<QtAutoUpdater::UpdateInfo> &infos) const;
38 
39 
41  Q_INVOKABLE QtAutoUpdater::Updater *createUpdater(const QString &configPath,
42  QObject *parent = nullptr) const;
44  Q_INVOKABLE QtAutoUpdater::Updater *createUpdater(QSettings *config,
45  QObject *parent = nullptr) const;
48  QVariantMap configuration,
49  QObject *parent = nullptr) const;
69  Q_INVOKABLE QtAutoUpdater::Updater *createUpdater(QObject *qmlConfigOrParent = nullptr) const;
91  Q_INVOKABLE QtAutoUpdater::Updater *createUpdater(QObject *qmlConfig,
92  QObject *parent) const;
93 
94 private:
95  class QmlConfigReader : public QtAutoUpdater::UpdaterBackend::IConfigReader
96  {
97  public:
98  QmlConfigReader(QObject *qmlSettings);
99 
100  QString backend() const override;
101  std::optional<QVariant> value(const QString &key) const override;
102  QVariant value(const QString &key, const QVariant &defaultValue) const override;
103 
104  private:
105  QPointer<QObject> _qmlSettings;
106  };
107 };
108 
109 }
110 
111 #endif // QMLAUTOUPDATERSINGLETON_H
de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::createInfo
Q_INVOKABLE QVariant createInfo(QVariant identifier, QString name, const QVariant &version, QVariantMap data={}) const
Creates a QtAutoUpdater::UpdateInfo from the given parameters.
QPointer< QObject >
de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::createUpdater
Q_INVOKABLE QtAutoUpdater::Updater * createUpdater(const QString &configPath, QObject *parent=nullptr) const
Creates an updater instance using the given configuration file.
QtAutoUpdater::Updater
The main updater. Can check for updates and trigger update installations.
Definition: updater.h:26
QList< QtAutoUpdater::UpdateInfo >
QString
QtAutoUpdater::UpdaterBackend::IConfigReader
A helper interface to allow backend generic access to a backends configuration.
Definition: updaterbackend.h:39
QSettings
de::skycoder42::QtAutoUpdater::Core
The QML import for the QtAutoUpdater core QML module.
Definition: qmlautoupdatersingleton.h:14
QVariant
QObject
QtAutoUpdater
The QtAutoUpdater namespace holds all classes that are related with the updater.
Definition: adminauthoriser.h:9
de::skycoder42::QtAutoUpdater::Core::QtAutoUpdater::infosAsList
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.