Skip to content

Commit c436df4

Browse files
authored
Update mainwindow.cpp
1 parent 8dc5950 commit c436df4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

examples/autoupdatergui/simpleUpdaterGui/mainwindow.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,34 @@ MainWindow::MainWindow(QWidget *parent) :
1313

1414
controller->start(QtAutoUpdater::UpdateController::InfoLevel); //Search for updates. Display a message if updates found, otherwise do nothing
1515

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)
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);
2721
}
2822

2923
MainWindow::~MainWindow()
3024
{
25+
delete controller;
26+
delete updateButton;
3127
delete ui;
3228
}
3329

3430
//Initialize the updater
3531
void MainWindow::initializeUpdater()
3632
{
3733
controller = new QtAutoUpdater::UpdateController("maintenancetool.exe", qApp); //Updater app name
38-
controller->setDetailedUpdateInfo(true);
34+
if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos
35+
else controller->setDetailedUpdateInfo(false);
36+
3937
updateButton->setController(controller);
4038
}
4139

4240
//Starts update check process
4341
void MainWindow::checkUpdate()
4442
{
43+
if(ui->checkBox_showDetailledUpdateInformations->isChecked()) controller->setDetailedUpdateInfo(true); //If checkbox is checked, show detailled update infos
44+
else controller->setDetailedUpdateInfo(false);
4545
controller->start(QtAutoUpdater::UpdateController::ProgressLevel); //Check for updates. Displays a progress bar when searching
4646
}

0 commit comments

Comments
 (0)