From dfdadf275ddfdbd6736959c01a4d96b7819026a3 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 28 Jan 2019 19:59:54 +0100 Subject: [PATCH 01/10] Updated code --- .../simpleUpdaterGui/mainwindow.cpp | 93 +++++++++---------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp index 36c6fd35..db830f45 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp +++ b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp @@ -1,47 +1,46 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow), - controller(nullptr), //add this - updateButton(new QtAutoUpdater::UpdateButton(this)) //and this for the updater -{ - ui->setupUi(this); - - updateButton->setVisible(false); //The updateButton is not visible - initializeUpdater(); //Initialize the updater - - controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing - - connect(ui->checkUpdateButton, - SIGNAL(clicked()), - this, - SLOT(checkUpdate()) - ); //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) - - connect(ui->actionCheck_for_updates_2, - SIGNAL(triggered(bool)), - this, - SLOT(checkUpdate()) - ); //Connect the actionCheck_for_updates_2 to the method (starts the update check process) -} - -MainWindow::~MainWindow() -{ - delete ui; -} - -//Initialize the updater -void MainWindow::initializeUpdater() -{ - controller = new QtAutoUpdater::UpdateController("maintenancetool.exe", qApp); //Updater app name - controller->setDetailedUpdateInfo(true); - updateButton->setController(controller); -} - -//Starts update check process -void MainWindow::checkUpdate() -{ - controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching -} +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow), + updateButton(new QtAutoUpdater::UpdateButton(this)) //add this for the updater +{ + ui->setupUi(this); + + updateButton->setVisible(false); //The updateButton is not visible + initializeUpdater(); //Initialize the updater + + controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing + + connect(ui->checkUpdateButton, + SIGNAL(clicked()), + this, + SLOT(checkUpdate()) + ); //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) + + connect(ui->actionCheck_for_updates_2, + SIGNAL(triggered(bool)), + this, + SLOT(checkUpdate()) + ); //Connect the actionCheck_for_updates_2 to the method (starts the update check process) +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +//Initialize the updater +void MainWindow::initializeUpdater() +{ + controller = new QtAutoUpdater::UpdateController("maintenancetool.exe", qApp); //Updater app name + controller->setDetailedUpdateInfo(true); + updateButton->setController(controller); +} + +//Starts update check process +void MainWindow::checkUpdate() +{ + controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching +} From 8dc595046af75b5ac0bbd1ef8a644f6ad04f11a8 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 01:47:00 +0100 Subject: [PATCH 02/10] Update main.cpp --- examples/autoupdatergui/simpleUpdaterGui/main.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/autoupdatergui/simpleUpdaterGui/main.cpp b/examples/autoupdatergui/simpleUpdaterGui/main.cpp index c50539bb..b6d7555e 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/main.cpp +++ b/examples/autoupdatergui/simpleUpdaterGui/main.cpp @@ -9,22 +9,19 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); //Translate app - QString locale = QLocale::system().name().section('_', 0, 0); QTranslator translator; - translator.load(QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + translator.load(QLocale(), QStringLiteral("qt"), QStringLiteral("_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); a.installTranslator(&translator); //Translate updater QTranslator translatorUpdater; - - translatorUpdater.load(QString("translations/qtautoupdatergui_") + locale + QString(".qm")); + translatorUpdater.load(QLocale(), QStringLiteral("qtautoupdatergui"), QStringLiteral("_"), QStringLiteral("translations")); a.installTranslator(&translatorUpdater); //Launch GUI MainWindow w; - w.show(); return a.exec(); From c436df4dc0b7b00b48d7cf44f25bc3f91e81f53d Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 01:47:15 +0100 Subject: [PATCH 03/10] Update mainwindow.cpp --- .../simpleUpdaterGui/mainwindow.cpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp index db830f45..b68b6bad 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp +++ b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp @@ -13,21 +13,17 @@ MainWindow::MainWindow(QWidget *parent) : controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing - connect(ui->checkUpdateButton, - SIGNAL(clicked()), - this, - SLOT(checkUpdate()) - ); //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) - - connect(ui->actionCheck_for_updates_2, - SIGNAL(triggered(bool)), - this, - SLOT(checkUpdate()) - ); //Connect the actionCheck_for_updates_2 to the method (starts the update check process) + //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) + connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &MainWindow::checkUpdate); + + //Connect the actionCheck_for_updates_2 to the method (starts the update check process) + connect(ui->actionCheck_for_updates_2, &QAction::triggered, this, &MainWindow::checkUpdate); } MainWindow::~MainWindow() { + delete controller; + delete updateButton; delete ui; } @@ -35,12 +31,16 @@ MainWindow::~MainWindow() void MainWindow::initializeUpdater() { controller = new QtAutoUpdater::UpdateController("maintenancetool.exe", qApp); //Updater app name - controller->setDetailedUpdateInfo(true); + if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos + else controller->setDetailedUpdateInfo(false); + updateButton->setController(controller); } //Starts update check process void MainWindow::checkUpdate() { + if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos + else controller->setDetailedUpdateInfo(false); controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching } From c16ffaf1f1c069a85f8a4137e6f756bfb4364fb6 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 01:47:30 +0100 Subject: [PATCH 04/10] Update mainwindow.h --- examples/autoupdatergui/simpleUpdaterGui/mainwindow.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.h b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.h index 8ccc1ce7..a23b6411 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.h +++ b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.h @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -16,7 +15,7 @@ class MainWindow : public QMainWindow Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); + explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: From 552e513a11a4ede2b76722848fb334d4a05dd0bb Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 01:47:49 +0100 Subject: [PATCH 05/10] Update mainwindow.ui --- .../simpleUpdaterGui/mainwindow.ui | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.ui b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.ui index 5d9aec5b..20835c53 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.ui +++ b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.ui @@ -14,8 +14,8 @@ MainWindow - - + + Software tests updates.<br/>The software looks for updates when launching the application.<br/>If updates are found then the Update utility opens, otherwise nothing happens. @@ -25,17 +25,27 @@ - + + + + Quit + + + + Check for updates - - + + - Quit + Show detailled update informations? + + + true @@ -47,7 +57,7 @@ 0 0 442 - 21 + 20 From 3212b6925d2b3bda7fc8beba9fcd0d707910888d Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 01:48:06 +0100 Subject: [PATCH 06/10] Update simpleUpdaterGui.pro --- .../simpleUpdaterGui/simpleUpdaterGui.pro | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/examples/autoupdatergui/simpleUpdaterGui/simpleUpdaterGui.pro b/examples/autoupdatergui/simpleUpdaterGui/simpleUpdaterGui.pro index 871503fd..79154bef 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/simpleUpdaterGui.pro +++ b/examples/autoupdatergui/simpleUpdaterGui/simpleUpdaterGui.pro @@ -1,15 +1,10 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2017-08-10T22:02:40 -# -#------------------------------------------------- +TEMPLATE = app -QT += core gui widgets autoupdatergui -CONFIG += C++11 +QT += core gui widgets autoupdatergui -TARGET = simpleUpdaterGui +CONFIG += C++11 -TEMPLATE = app +TARGET = SimpleUpdaterGui SOURCES += \ main.cpp \ @@ -21,16 +16,5 @@ HEADERS += \ FORMS += \ mainwindow.ui -target.path = $$[QT_INSTALL_EXAMPLES]/autoupdatergui/simpleUpdaterGui +target.path = $$[QT_INSTALL_EXAMPLES]/autoupdatergui/$$TARGET INSTALLS += target - -#not found by linker? -unix:!mac { - LIBS += -L$$OUT_PWD/../../../lib #required to make this the first place to search - LIBS += -L$$[QT_INSTALL_LIBS] -licudata - LIBS += -L$$[QT_INSTALL_LIBS] -licui18n - LIBS += -L$$[QT_INSTALL_LIBS] -licuuc -} - -#add lib dir to rpath -mac: QMAKE_LFLAGS += '-Wl,-rpath,\'$$OUT_PWD/../../../lib\'' From 9dc9ff6ea4640400e46cd62549e77979648867fe Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 01:51:40 +0100 Subject: [PATCH 07/10] Update mainwindow.cpp --- examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp index b68b6bad..03a0fe1d 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp +++ b/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp @@ -30,7 +30,7 @@ MainWindow::~MainWindow() //Initialize the updater void MainWindow::initializeUpdater() { - controller = new QtAutoUpdater::UpdateController("maintenancetool.exe", qApp); //Updater app name + controller = new QtAutoUpdater::UpdateController(QStringLiteral("maintenancetool.exe"), qApp); //Updater app name if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos else controller->setDetailedUpdateInfo(false); From 41864980ee830dbe4f37f730514ed3b7fb50f842 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 02:37:03 +0100 Subject: [PATCH 08/10] Update autoupdatergui.pro --- examples/autoupdatergui/autoupdatergui.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/autoupdatergui/autoupdatergui.pro b/examples/autoupdatergui/autoupdatergui.pro index 5d6e3b3d..2b82fb7c 100644 --- a/examples/autoupdatergui/autoupdatergui.pro +++ b/examples/autoupdatergui/autoupdatergui.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -SUBDIRS += WidgetsUpdater simpleUpdaterGui \ No newline at end of file +SUBDIRS += WidgetsUpdater SimpleUpdaterGui From 0a80566329d6cd69a60b46a29cba12175dcdef7b Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 02:46:01 +0100 Subject: [PATCH 09/10] Updated example --- .../SimpleUpdaterGui.pro} | 0 .../main.cpp | 0 .../mainwindow.cpp | 92 +++++++++---------- .../mainwindow.h | 0 .../mainwindow.ui | 0 5 files changed, 46 insertions(+), 46 deletions(-) rename examples/autoupdatergui/{simpleUpdaterGui/simpleUpdaterGui.pro => impleUpdaterGui/SimpleUpdaterGui.pro} (100%) rename examples/autoupdatergui/{simpleUpdaterGui => impleUpdaterGui}/main.cpp (100%) rename examples/autoupdatergui/{simpleUpdaterGui => impleUpdaterGui}/mainwindow.cpp (97%) rename examples/autoupdatergui/{simpleUpdaterGui => impleUpdaterGui}/mainwindow.h (100%) rename examples/autoupdatergui/{simpleUpdaterGui => impleUpdaterGui}/mainwindow.ui (100%) diff --git a/examples/autoupdatergui/simpleUpdaterGui/simpleUpdaterGui.pro b/examples/autoupdatergui/impleUpdaterGui/SimpleUpdaterGui.pro similarity index 100% rename from examples/autoupdatergui/simpleUpdaterGui/simpleUpdaterGui.pro rename to examples/autoupdatergui/impleUpdaterGui/SimpleUpdaterGui.pro diff --git a/examples/autoupdatergui/simpleUpdaterGui/main.cpp b/examples/autoupdatergui/impleUpdaterGui/main.cpp similarity index 100% rename from examples/autoupdatergui/simpleUpdaterGui/main.cpp rename to examples/autoupdatergui/impleUpdaterGui/main.cpp diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp b/examples/autoupdatergui/impleUpdaterGui/mainwindow.cpp similarity index 97% rename from examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp rename to examples/autoupdatergui/impleUpdaterGui/mainwindow.cpp index 03a0fe1d..99dd7589 100644 --- a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp +++ b/examples/autoupdatergui/impleUpdaterGui/mainwindow.cpp @@ -1,46 +1,46 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow), - updateButton(new QtAutoUpdater::UpdateButton(this)) //add this for the updater -{ - ui->setupUi(this); - - updateButton->setVisible(false); //The updateButton is not visible - initializeUpdater(); //Initialize the updater - - controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing - - //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) - connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &MainWindow::checkUpdate); - - //Connect the actionCheck_for_updates_2 to the method (starts the update check process) - connect(ui->actionCheck_for_updates_2, &QAction::triggered, this, &MainWindow::checkUpdate); -} - -MainWindow::~MainWindow() -{ - delete controller; - delete updateButton; - delete ui; -} - -//Initialize the updater -void MainWindow::initializeUpdater() -{ - controller = new QtAutoUpdater::UpdateController(QStringLiteral("maintenancetool.exe"), qApp); //Updater app name - if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos - else controller->setDetailedUpdateInfo(false); - - updateButton->setController(controller); -} - -//Starts update check process -void MainWindow::checkUpdate() -{ - if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos - else controller->setDetailedUpdateInfo(false); - controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching -} +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow), + updateButton(new QtAutoUpdater::UpdateButton(this)) //add this for the updater +{ + ui->setupUi(this); + + updateButton->setVisible(false); //The updateButton is not visible + initializeUpdater(); //Initialize the updater + + controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing + + //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) + connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &MainWindow::checkUpdate); + + //Connect the actionCheck_for_updates_2 to the method (starts the update check process) + connect(ui->actionCheck_for_updates_2, &QAction::triggered, this, &MainWindow::checkUpdate); +} + +MainWindow::~MainWindow() +{ + delete controller; + delete updateButton; + delete ui; +} + +//Initialize the updater +void MainWindow::initializeUpdater() +{ + controller = new QtAutoUpdater::UpdateController(QStringLiteral("maintenancetool.exe"), qApp); //Updater app name + if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos + else controller->setDetailedUpdateInfo(false); + + updateButton->setController(controller); +} + +//Starts update check process +void MainWindow::checkUpdate() +{ + if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos + else controller->setDetailedUpdateInfo(false); + controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching +} diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.h b/examples/autoupdatergui/impleUpdaterGui/mainwindow.h similarity index 100% rename from examples/autoupdatergui/simpleUpdaterGui/mainwindow.h rename to examples/autoupdatergui/impleUpdaterGui/mainwindow.h diff --git a/examples/autoupdatergui/simpleUpdaterGui/mainwindow.ui b/examples/autoupdatergui/impleUpdaterGui/mainwindow.ui similarity index 100% rename from examples/autoupdatergui/simpleUpdaterGui/mainwindow.ui rename to examples/autoupdatergui/impleUpdaterGui/mainwindow.ui From bdd203c829ffe3152877be3195fa4596f21411ef Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 19 Feb 2019 02:46:26 +0100 Subject: [PATCH 10/10] Updated example --- .../{impleUpdaterGui => SimpleUpdaterGui}/SimpleUpdaterGui.pro | 0 .../autoupdatergui/{impleUpdaterGui => SimpleUpdaterGui}/main.cpp | 0 .../{impleUpdaterGui => SimpleUpdaterGui}/mainwindow.cpp | 0 .../{impleUpdaterGui => SimpleUpdaterGui}/mainwindow.h | 0 .../{impleUpdaterGui => SimpleUpdaterGui}/mainwindow.ui | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename examples/autoupdatergui/{impleUpdaterGui => SimpleUpdaterGui}/SimpleUpdaterGui.pro (100%) rename examples/autoupdatergui/{impleUpdaterGui => SimpleUpdaterGui}/main.cpp (100%) rename examples/autoupdatergui/{impleUpdaterGui => SimpleUpdaterGui}/mainwindow.cpp (100%) rename examples/autoupdatergui/{impleUpdaterGui => SimpleUpdaterGui}/mainwindow.h (100%) rename examples/autoupdatergui/{impleUpdaterGui => SimpleUpdaterGui}/mainwindow.ui (100%) diff --git a/examples/autoupdatergui/impleUpdaterGui/SimpleUpdaterGui.pro b/examples/autoupdatergui/SimpleUpdaterGui/SimpleUpdaterGui.pro similarity index 100% rename from examples/autoupdatergui/impleUpdaterGui/SimpleUpdaterGui.pro rename to examples/autoupdatergui/SimpleUpdaterGui/SimpleUpdaterGui.pro diff --git a/examples/autoupdatergui/impleUpdaterGui/main.cpp b/examples/autoupdatergui/SimpleUpdaterGui/main.cpp similarity index 100% rename from examples/autoupdatergui/impleUpdaterGui/main.cpp rename to examples/autoupdatergui/SimpleUpdaterGui/main.cpp diff --git a/examples/autoupdatergui/impleUpdaterGui/mainwindow.cpp b/examples/autoupdatergui/SimpleUpdaterGui/mainwindow.cpp similarity index 100% rename from examples/autoupdatergui/impleUpdaterGui/mainwindow.cpp rename to examples/autoupdatergui/SimpleUpdaterGui/mainwindow.cpp diff --git a/examples/autoupdatergui/impleUpdaterGui/mainwindow.h b/examples/autoupdatergui/SimpleUpdaterGui/mainwindow.h similarity index 100% rename from examples/autoupdatergui/impleUpdaterGui/mainwindow.h rename to examples/autoupdatergui/SimpleUpdaterGui/mainwindow.h diff --git a/examples/autoupdatergui/impleUpdaterGui/mainwindow.ui b/examples/autoupdatergui/SimpleUpdaterGui/mainwindow.ui similarity index 100% rename from examples/autoupdatergui/impleUpdaterGui/mainwindow.ui rename to examples/autoupdatergui/SimpleUpdaterGui/mainwindow.ui