Skip to content

Commit 895a969

Browse files
committed
added sample Arguments
1 parent 21344a8 commit 895a969

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

examples/autoupdatercore/ConsoleUpdater/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
1010
QString homePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
1111
QtAutoUpdater::Updater *updater = new QtAutoUpdater::Updater(homePath + QStringLiteral("/QtAutoUpdaterTestInstaller/maintenancetool"),
1212
nullptr);
13-
updater->runUpdaterOnExit();
13+
updater->runUpdaterOnExit(QtAutoUpdater::Updater::PassiveUpdateArguments);
1414

1515
QObject::connect(updater, &QtAutoUpdater::Updater::checkUpdatesDone, [updater](bool a, bool b){
1616
qDebug() << "Has updates:" << a

src/autoupdatercore/updater.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ using namespace QtAutoUpdater;
1111
#define DEFAULT_TOOL_PATH QStringLiteral("./maintenancetool")
1212
#endif
1313

14+
const QStringList Updater::NormalUpdateArguments = {QStringLiteral("--updater")};
15+
const QStringList Updater::PassiveUpdateArguments = {QStringLiteral("--updater"), QStringLiteral("skipPrompt=true")};
16+
const QStringList Updater::HiddenUpdateArguments = {QStringLiteral("--silentUpdate")};
17+
1418
Updater::Updater(QObject *parent) :
1519
Updater(DEFAULT_TOOL_PATH, parent)
1620
{}
@@ -90,7 +94,7 @@ void Updater::cancelScheduledUpdate(int taskId)
9094

9195
void Updater::runUpdaterOnExit(AdminAuthoriser *authoriser)
9296
{
93-
runUpdaterOnExit({QStringLiteral("--updater")}, authoriser);
97+
runUpdaterOnExit(NormalUpdateArguments, authoriser);
9498
}
9599

96100
void Updater::runUpdaterOnExit(const QStringList &arguments, AdminAuthoriser *authoriser)

src/autoupdatercore/updater.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ class Q_AUTOUPDATERCORE_EXPORT Updater : public QObject
4747
UpdateInfo(QString name, QVersionNumber version, quint64 size);
4848
};
4949

50+
static const QStringList NormalUpdateArguments;
51+
static const QStringList PassiveUpdateArguments;
52+
static const QStringList HiddenUpdateArguments;
53+
5054
//! Default constructor
5155
explicit Updater(QObject *parent = nullptr);
5256
//! Constructer with an explicitly set path

0 commit comments

Comments
 (0)