1 #ifndef QTAUTOUPDATER_UPDATER_H
2 #define QTAUTOUPDATER_UPDATER_H
6 #include <QtCore/qobject.h>
7 #include <QtCore/qstring.h>
8 #include <QtCore/qlist.h>
9 #include <QtCore/qstringlist.h>
10 #include <QtCore/qdatetime.h>
12 #include "QtAutoUpdaterCore/qtautoupdatercore_global.h"
13 #include "QtAutoUpdaterCore/updateinfo.h"
14 #include "QtAutoUpdaterCore/adminauthoriser.h"
15 #include "QtAutoUpdaterCore/updaterbackend.h"
22 class UpdateInstaller;
31 Q_PROPERTY(QtAutoUpdater::UpdaterBackend::Features features READ features CONSTANT)
35 Q_PROPERTY(
bool running READ isRunning NOTIFY runningChanged)
39 Q_PROPERTY(
bool runOnExit READ willRunOnExit RESET cancelExitRun NOTIFY runOnExitChanged)
61 ForceOnExit = (OnExit | Force)
63 Q_DECLARE_FLAGS(InstallMode, InstallModeFlag)
86 QVariantMap configuration,
99 UpdaterBackend::Features features()
const;
103 bool isRunning()
const;
107 bool willRunOnExit()
const;
110 int scheduleUpdate(std::chrono::seconds delaySeconds,
bool repeated =
false);
112 Q_INVOKABLE
int scheduleUpdate(
int delaySeconds,
bool repeated =
false);
114 template <
typename TRep,
typename TPeriod>
115 int scheduleUpdate(
const std::chrono::duration<TRep, TPeriod> &delaySeconds,
bool repeated =
false);
117 Q_INVOKABLE
int scheduleUpdate(
const QDateTime &when);
119 template <
typename TClock,
typename TDur>
120 int scheduleUpdate(
const std::chrono::time_point<TClock, TDur> &when);
123 Q_INVOKABLE
bool runUpdater(InstallMode mode = InstallModeFlag::Parallel,
124 InstallScope scope = InstallScope::PreferInternal);
128 void checkForUpdates();
130 void abortUpdateCheck(
int killDelay = 5000);
133 void cancelScheduledUpdate(
int taskId);
136 void cancelExitRun();
142 void progressChanged(
double progress,
const QString &status, QPrivateSignal);
146 void installDone(
bool success, QPrivateSignal);
151 void runningChanged(
bool running, QPrivateSignal);
155 void runOnExitChanged(
bool runOnExit, QPrivateSignal);
167 Q_PRIVATE_SLOT(d_func(),
void _q_appAboutToExit())
169 Q_PRIVATE_SLOT(d_func(),
void _q_triggerInstallDone(
bool))
172 template<typename TRep, typename TPeriod>
173 int Updater::scheduleUpdate(const std::chrono::duration<TRep, TPeriod> &delaySeconds,
bool repeated)
175 using namespace std::chrono;
176 return scheduleUpdate(duration_cast<seconds>(delaySeconds), repeated);
179 template<
typename TClock,
typename TDur>
182 using namespace std::chrono;
184 time_point_cast<system_clock>(when)
185 .time_since_epoch())));
191 Q_DECLARE_OPERATORS_FOR_FLAGS(QtAutoUpdater::Updater::InstallMode)
193 #endif // QTAUTOUPDATER_UPDATER_H