99#include < QtAutoUpdaterCore/Updater>
1010#include < QtAutoUpdaterCore/UpdaterBackend>
1111
12+
13+ #ifdef DOXYGEN_RUN
14+ namespace de ::skycoder42::QtAutoUpdater::Core {
15+
16+ /* ! @brief A singleton class to create instances of different QtAutoUpdater types
17+ *
18+ * @extends QtQml.QtObject
19+ * @since 3.0
20+ */
21+ class QtAutoUpdater
22+ #else
23+ namespace QtAutoUpdater {
24+
1225class QmlAutoUpdaterSingleton : public QObject
26+ #endif
1327{
1428 Q_OBJECT
1529
1630public:
31+ // ! @private
1732 explicit QmlAutoUpdaterSingleton (QObject *parent = nullptr );
1833
34+ // ! Creates a QtAutoUpdater::UpdateInfo from the given parameters
1935 Q_INVOKABLE QVariant createInfo (QVariant identifier, QString name, const QVariant &version, QVariantMap data = {}) const ;
36+ // ! Converts a list of QtAutoUpdater::UpdateInfos to a QVariantList, which can be consumed in QML
2037 Q_INVOKABLE QVariantList infosAsList (const QList<QtAutoUpdater::UpdateInfo> &infos) const ;
2138
2239
40+ // ! @copydoc QtAutoUpdater::Updater::create(const QString &, QObject*)
2341 Q_INVOKABLE QtAutoUpdater::Updater *createUpdater (const QString &configPath,
2442 QObject *parent = nullptr ) const ;
43+ // ! @copydoc QtAutoUpdater::Updater::create(QSettings *, QObject*)
2544 Q_INVOKABLE QtAutoUpdater::Updater *createUpdater (QSettings *config,
2645 QObject *parent = nullptr ) const ;
46+ // ! @copydoc QtAutoUpdater::Updater::create(QString, QVariantMap, QObject*)
2747 Q_INVOKABLE QtAutoUpdater::Updater *createUpdater (QString key,
28- QVariantMap arguments ,
48+ QVariantMap configuration ,
2949 QObject *parent = nullptr ) const ;
50+ /* ! @brief Creates an updater instance using the given object as either QML configuration or as parent
51+ *
52+ * @param qmlConfigOrParent The object to be consumed
53+ * @returns A newly created updater instance or `nullptr`, if unable to create one.
54+ *
55+ * The qmlConfigOrParent can be interpreted in different ways. If it is a Qt.labs.settings.Settings instance,
56+ * it is used as the configuration, but not as the parent. Otherwise it is used as the parent.
57+ *
58+ * The backend is loaded based on the given configuration. It must contain the "backend" entry, set to
59+ * the updater backend to be used. If the backend is missing or invalid, nullptr is returned. Otherwise
60+ * the created instance, initialized using the given configuration.
61+ *
62+ * @attention For some update installations, an updater needs to be launched on exit of the running
63+ * application. This only works if the updater lives long enough to catch the
64+ * QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need
65+ * to be run on exit, you should use either `qApp` or `nullptr` as parent for the updater.
66+ *
67+ * @sa Updater::supportedUpdaterBackends, @ref backends_TODO "Updater Backend Plugins", Qt.labs.settings.Settings
68+ */
3069 Q_INVOKABLE QtAutoUpdater::Updater *createUpdater (QObject *qmlConfigOrParent = nullptr ) const ;
70+ /* ! @brief Creates an updater instance using the given QML configuration and parent
71+ *
72+ * @param qmlConfig The configuration object
73+ * @param parent The object to be set as the parent for the created updater
74+ * @returns A newly created updater instance or `nullptr`, if unable to create one.
75+ *
76+ * The qmlConfig must be an instance of Qt.labs.settings.Settings or QSettings. If it is neither, no updater
77+ * can be created an nullptr gets returned
78+ *
79+ * The backend is loaded based on the given configuration. It must contain the "backend" entry, set to
80+ * the updater backend to be used. If the backend is missing or invalid, nullptr is returned. Otherwise
81+ * the created instance, initialized using the given configuration.
82+ *
83+ * @attention For some update installations, an updater needs to be launched on exit of the running
84+ * application. This only works if the updater lives long enough to catch the
85+ * QCoreApplication::aboutToQuit signal! This means when creating an updater for a backend that may need
86+ * to be run on exit, you should use either `qApp` or `nullptr` as parent for the updater.
87+ *
88+ * @sa Updater::supportedUpdaterBackends, @ref backends_TODO "Updater Backend Plugins", Qt.labs.settings.Settings,
89+ * QSettings
90+ */
3191 Q_INVOKABLE QtAutoUpdater::Updater *createUpdater (QObject *qmlConfig,
3292 QObject *parent) const ;
3393
@@ -46,4 +106,6 @@ class QmlAutoUpdaterSingleton : public QObject
46106 };
47107};
48108
109+ }
110+
49111#endif // QMLAUTOUPDATERSINGLETON_H
0 commit comments