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