Skip to content

Commit 1de4743

Browse files
authored
Merge pull request #21 from aalex420/master
Update SimpleUpdater example
2 parents cfe49d1 + 97c6106 commit 1de4743

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

examples/autoupdatergui/SimpleUpdaterGui/mainwindow.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
MainWindow::MainWindow(QWidget *parent) :
55
QMainWindow(parent),
66
ui(new Ui::MainWindow),
7-
controller(nullptr), //add this
87
updateButton(new QtAutoUpdater::UpdateButton(this)) //and this for the updater
98
{
109
ui->setupUi(this);
@@ -32,12 +31,19 @@ MainWindow::~MainWindow()
3231
void MainWindow::initializeUpdater()
3332
{
3433
controller = new QtAutoUpdater::UpdateController(QStringLiteral("maintenancetool.exe"), qApp); //Updater app name
35-
controller->setDetailedUpdateInfo(true);
34+
if(ui->checkBox_showDetailledUpdateInformations->isChecked())
35+
controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos
36+
else
37+
controller->setDetailedUpdateInfo(false);
3638
updateButton->setController(controller);
3739
}
3840

3941
//Starts update check process
4042
void MainWindow::checkUpdate()
4143
{
44+
if(ui->checkBox_showDetailledUpdateInformations->isChecked())
45+
controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos
46+
else
47+
controller->setDetailedUpdateInfo(false);
4248
controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching
4349
}

examples/autoupdatergui/SimpleUpdaterGui/mainwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MainWindow : public QMainWindow
2020

2121
private:
2222
Ui::MainWindow *ui;
23-
QtAutoUpdater::UpdateController *controller;
23+
QtAutoUpdater::UpdateController *controller = nullptr;
2424
QtAutoUpdater::UpdateButton *updateButton;
2525

2626
private slots:

examples/autoupdatergui/SimpleUpdaterGui/mainwindow.ui

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<string>MainWindow</string>
1515
</property>
1616
<widget class="QWidget" name="centralWidget">
17-
<layout class="QVBoxLayout" name="verticalLayout">
18-
<item>
17+
<layout class="QGridLayout" name="gridLayout">
18+
<item row="0" column="0" colspan="2">
1919
<widget class="QLabel" name="label">
2020
<property name="text">
2121
<string>Software tests updates.&lt;br/&gt;The software looks for updates when launching the application.&lt;br/&gt;If updates are found then the Update utility opens, otherwise nothing happens.</string>
@@ -25,17 +25,27 @@
2525
</property>
2626
</widget>
2727
</item>
28-
<item>
28+
<item row="2" column="0" colspan="2">
29+
<widget class="QPushButton" name="quitButton">
30+
<property name="text">
31+
<string>Quit</string>
32+
</property>
33+
</widget>
34+
</item>
35+
<item row="1" column="0">
2936
<widget class="QPushButton" name="checkUpdateButton">
3037
<property name="text">
3138
<string>Check for updates</string>
3239
</property>
3340
</widget>
3441
</item>
35-
<item>
36-
<widget class="QPushButton" name="quitButton">
42+
<item row="1" column="1">
43+
<widget class="QCheckBox" name="checkBox_showDetailledUpdateInformations">
3744
<property name="text">
38-
<string>Quit</string>
45+
<string>Show detailled update informations?</string>
46+
</property>
47+
<property name="checked">
48+
<bool>true</bool>
3949
</property>
4050
</widget>
4151
</item>

0 commit comments

Comments
 (0)