|
1 | | -#include "mainwindow.h" |
2 | | -#include "ui_mainwindow.h" |
3 | | - |
4 | | -MainWindow::MainWindow(QWidget *parent) : |
5 | | - QMainWindow(parent), |
6 | | - ui(new Ui::MainWindow), |
7 | | - updateButton(new QtAutoUpdater::UpdateButton(this)) //add this for the updater |
8 | | -{ |
9 | | - ui->setupUi(this); |
10 | | - |
11 | | - updateButton->setVisible(false); //The updateButton is not visible |
12 | | - initializeUpdater(); //Initialize the updater |
13 | | - |
14 | | - controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing |
15 | | - |
16 | | - //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) |
17 | | - connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &MainWindow::checkUpdate); |
18 | | - |
19 | | - //Connect the actionCheck_for_updates_2 to the method (starts the update check process) |
20 | | - connect(ui->actionCheck_for_updates_2, &QAction::triggered, this, &MainWindow::checkUpdate); |
21 | | -} |
22 | | - |
23 | | -MainWindow::~MainWindow() |
24 | | -{ |
25 | | - delete controller; |
26 | | - delete updateButton; |
27 | | - delete ui; |
28 | | -} |
29 | | - |
30 | | -//Initialize the updater |
31 | | -void MainWindow::initializeUpdater() |
32 | | -{ |
33 | | - controller = new QtAutoUpdater::UpdateController(QStringLiteral("maintenancetool.exe"), qApp); //Updater app name |
34 | | - if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos |
35 | | - else controller->setDetailedUpdateInfo(false); |
36 | | - |
37 | | - updateButton->setController(controller); |
38 | | -} |
39 | | - |
40 | | -//Starts update check process |
41 | | -void MainWindow::checkUpdate() |
42 | | -{ |
43 | | - if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos |
44 | | - else controller->setDetailedUpdateInfo(false); |
45 | | - controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching |
46 | | -} |
| 1 | +#include "mainwindow.h" |
| 2 | +#include "ui_mainwindow.h" |
| 3 | + |
| 4 | +MainWindow::MainWindow(QWidget *parent) : |
| 5 | + QMainWindow(parent), |
| 6 | + ui(new Ui::MainWindow), |
| 7 | + updateButton(new QtAutoUpdater::UpdateButton(this)) //add this for the updater |
| 8 | +{ |
| 9 | + ui->setupUi(this); |
| 10 | + |
| 11 | + updateButton->setVisible(false); //The updateButton is not visible |
| 12 | + initializeUpdater(); //Initialize the updater |
| 13 | + |
| 14 | + controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing |
| 15 | + |
| 16 | + //Connect the checkUpdateButton button to the checkUpdate method (starts the update check process) |
| 17 | + connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &MainWindow::checkUpdate); |
| 18 | + |
| 19 | + //Connect the actionCheck_for_updates_2 to the method (starts the update check process) |
| 20 | + connect(ui->actionCheck_for_updates_2, &QAction::triggered, this, &MainWindow::checkUpdate); |
| 21 | +} |
| 22 | + |
| 23 | +MainWindow::~MainWindow() |
| 24 | +{ |
| 25 | + delete controller; |
| 26 | + delete updateButton; |
| 27 | + delete ui; |
| 28 | +} |
| 29 | + |
| 30 | +//Initialize the updater |
| 31 | +void MainWindow::initializeUpdater() |
| 32 | +{ |
| 33 | + controller = new QtAutoUpdater::UpdateController(QStringLiteral("maintenancetool.exe"), qApp); //Updater app name |
| 34 | + if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos |
| 35 | + else controller->setDetailedUpdateInfo(false); |
| 36 | + |
| 37 | + updateButton->setController(controller); |
| 38 | +} |
| 39 | + |
| 40 | +//Starts update check process |
| 41 | +void MainWindow::checkUpdate() |
| 42 | +{ |
| 43 | + if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos |
| 44 | + else controller->setDetailedUpdateInfo(false); |
| 45 | + controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching |
| 46 | +} |
0 commit comments