Skip to content

Commit fbb14f5

Browse files
committed
update console sample
1 parent 895a969 commit fbb14f5

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

examples/autoupdatercore/ConsoleUpdater/main.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
#include <QCoreApplication>
22
#include <QDebug>
33
#include <QStandardPaths>
4-
#include <updater.h>
4+
#include <QtAutoUpdaterCore/Updater>
55

66
int main(int argc, char *argv[])
77
{
88
QCoreApplication a(argc, argv);
9+
if(a.arguments().size() < 2) {
10+
qCritical() << "Usage: ConsoleUpdater <path_to_maintenancetool>";
11+
return EXIT_FAILURE;
12+
}
913

10-
QString homePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
11-
QtAutoUpdater::Updater *updater = new QtAutoUpdater::Updater(homePath + QStringLiteral("/QtAutoUpdaterTestInstaller/maintenancetool"),
14+
QtAutoUpdater::Updater *updater = new QtAutoUpdater::Updater(a.arguments()[1],
1215
nullptr);
13-
updater->runUpdaterOnExit(QtAutoUpdater::Updater::PassiveUpdateArguments);
1416

15-
QObject::connect(updater, &QtAutoUpdater::Updater::checkUpdatesDone, [updater](bool a, bool b){
16-
qDebug() << "Has updates:" << a
17-
<< "\nHas errors:" << b
17+
QObject::connect(updater, &QtAutoUpdater::Updater::checkUpdatesDone, [updater](bool hasUpdate, bool hasError){
18+
qDebug() << "Has updates:" << hasUpdate
19+
<< "\nHas errors:" << hasError
1820
<< "\nError string:" << updater->errorLog();
1921
qDebug() << updater->updateInfo();
22+
if(hasUpdate)
23+
updater->runUpdaterOnExit(QtAutoUpdater::Updater::PassiveUpdateArguments);
2024
qApp->quit();
2125
});
2226

examples/autoupdatergui/WidgetsUpdater/mainwindow.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <QFileDialog>
44
#include <QDebug>
55
#include <QSettings>
6-
#include <updatebutton.h>
76

87
MainWindow::MainWindow(QWidget *parent) :
98
QMainWindow(parent),

examples/autoupdatergui/WidgetsUpdater/mainwindow.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define MAINWINDOW_H
33

44
#include <QMainWindow>
5-
#include <updatecontroller.h>
6-
#include <updatebutton.h>
5+
#include <QtAutoUpdaterGui/UpdateController>
6+
#include <QtAutoUpdaterGui/UpdateButton>
77

88
namespace Ui {
99
class MainWindow;

0 commit comments

Comments
 (0)