Skip to content

Commit

Permalink
Merge pull request #21 from aalex420/master
Browse files Browse the repository at this point in the history
Update SimpleUpdater example
  • Loading branch information
Skycoder42 authored Feb 21, 2019
2 parents cfe49d1 + 97c6106 commit 1de4743
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
10 changes: 8 additions & 2 deletions examples/autoupdatergui/SimpleUpdaterGui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
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);
Expand Down Expand Up @@ -32,12 +31,19 @@ MainWindow::~MainWindow()
void MainWindow::initializeUpdater()
{
controller = new QtAutoUpdater::UpdateController(QStringLiteral("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
}
2 changes: 1 addition & 1 deletion examples/autoupdatergui/SimpleUpdaterGui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MainWindow : public QMainWindow

private:
Ui::MainWindow *ui;
QtAutoUpdater::UpdateController *controller;
QtAutoUpdater::UpdateController *controller = nullptr;
QtAutoUpdater::UpdateButton *updateButton;

private slots:
Expand Down
22 changes: 16 additions & 6 deletions examples/autoupdatergui/SimpleUpdaterGui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<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>
Expand All @@ -25,17 +25,27 @@
</property>
</widget>
</item>
<item>
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="quitButton">
<property name="text">
<string>Quit</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="checkUpdateButton">
<property name="text">
<string>Check for updates</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="quitButton">
<item row="1" column="1">
<widget class="QCheckBox" name="checkBox_showDetailledUpdateInformations">
<property name="text">
<string>Quit</string>
<string>Show detailled update informations?</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
Expand Down

0 comments on commit 1de4743

Please sign in to comment.