UniversalIndentGUI 1.2.0
|
UpdateCheckDialog is a dialog widget that contains functions for online checking for a new version of UniversalIndentGUI. More...
#include <UpdateCheckDialog.h>
Public Slots | |
void | checkForUpdate () |
This slot should be called, if an update check is automatically invoked. | |
void | checkForUpdateAndShowDialog () |
This slot should be called, if an update check is manually invoked. | |
Public Member Functions | |
UpdateCheckDialog (QSharedPointer< UiGuiSettings > settings, QWidget *parent=NULL) | |
Initializes member variables and stores the version of UiGui and a pointer to the _settings object. | |
~UpdateCheckDialog () | |
On destroy cancels any currently running network request. | |
Private Slots | |
void | checkResultsOfFetchedPadXMLFile (QNetworkReply *networkReply) |
This slot is called after the update check has returned, either by successfully retrieving the pad file, or on any kind of network error. | |
void | handleUpdateCheckDialogButtonClicked (QAbstractButton *clickedButton) |
This slot is called, when a button in the dialog is clicked. | |
void | initProxySettings () |
void | updateUpdateCheckProgressBar () |
This slot is responsible for the animation of the update check progress bar. | |
Private Member Functions | |
int | convertVersionStringToNumber (QString versionString) |
Converts the as string given version versionString to an integer number. | |
void | getPadXMLFile () |
This function tries to download the UniversalIndentGui pad file from the SourceForge server. | |
void | showCheckingForUpdateDialog () |
Displays the progress bar during update check. | |
void | showNewVersionAvailableDialog (QString newVersion) |
Displays the dialog with info about the new available version. | |
void | showNoNewVersionAvailableDialog () |
Displays the dialog, that no new version is available. | |
Private Attributes | |
QNetworkReply * | _currentNetworkReply |
bool | _manualUpdateRequested |
QNetworkAccessManager * | _networkAccessManager |
QDialogButtonBox::ButtonRole | _roleOfClickedButton |
QSharedPointer< UiGuiSettings > | _settings |
Ui::UpdateCheckDialog * | _updateCheckDialogForm |
int | _updateCheckProgressCounter |
QTimer * | _updateCheckProgressTimer |
UpdateCheckDialog is a dialog widget that contains functions for online checking for a new version of UniversalIndentGUI.
Definition at line 37 of file UpdateCheckDialog.h.
UpdateCheckDialog::UpdateCheckDialog | ( | QSharedPointer< UiGuiSettings > | settings, |
QWidget * | parent = NULL |
||
) |
Initializes member variables and stores the version of UiGui and a pointer to the _settings object.
Definition at line 47 of file UpdateCheckDialog.cpp.
References _networkAccessManager, _settings, _updateCheckDialogForm, _updateCheckProgressCounter, _updateCheckProgressTimer, checkResultsOfFetchedPadXMLFile(), handleUpdateCheckDialogButtonClicked(), initProxySettings(), and updateUpdateCheckProgressBar().
UpdateCheckDialog::~UpdateCheckDialog | ( | ) |
On destroy cancels any currently running network request.
Definition at line 86 of file UpdateCheckDialog.cpp.
References _currentNetworkReply, _networkAccessManager, and checkResultsOfFetchedPadXMLFile().
void UpdateCheckDialog::checkForUpdate | ( | ) | [slot] |
This slot should be called, if an update check is automatically invoked.
An automatic invoked update check should run in background, so the user gets not interrupted by a dialog box.
Definition at line 112 of file UpdateCheckDialog.cpp.
References _manualUpdateRequested, and getPadXMLFile().
Referenced by MainWindow::MainWindow().
void UpdateCheckDialog::checkForUpdateAndShowDialog | ( | ) | [slot] |
This slot should be called, if an update check is manually invoked.
In difference to the automatic update check, during manual update check request a modal progress indicator dialog will be shown.
Definition at line 99 of file UpdateCheckDialog.cpp.
References _manualUpdateRequested, getPadXMLFile(), and showCheckingForUpdateDialog().
void UpdateCheckDialog::checkResultsOfFetchedPadXMLFile | ( | QNetworkReply * | networkReply | ) | [private, slot] |
This slot is called after the update check has returned, either by successfully retrieving the pad file, or on any kind of network error.
Shows a message if check was successful or not. Offers the user to go to the download page if a newer version exists. In case of an error during update check, a message box with the error will be displayed.
Definition at line 136 of file UpdateCheckDialog.cpp.
References _currentNetworkReply, _manualUpdateRequested, _roleOfClickedButton, _settings, _updateCheckProgressTimer, convertVersionStringToNumber(), PROGRAM_VERSION_STRING, showNewVersionAvailableDialog(), and showNoNewVersionAvailableDialog().
Referenced by UpdateCheckDialog(), and ~UpdateCheckDialog().
int UpdateCheckDialog::convertVersionStringToNumber | ( | QString | versionString | ) | [private] |
Converts the as string given version versionString to an integer number.
The versionString must have the format x.x.x where each x represents a number of a maximum of 999. If the input format is wrong, -1 will be returned.The first number will be multiplied by 1000000 the second by 1000 and then all three will be summarized.
Thus for example 12.5.170 will result in 12005170.
Definition at line 290 of file UpdateCheckDialog.cpp.
Referenced by checkResultsOfFetchedPadXMLFile().
void UpdateCheckDialog::getPadXMLFile | ( | ) | [private] |
This function tries to download the UniversalIndentGui pad file from the SourceForge server.
Definition at line 121 of file UpdateCheckDialog.cpp.
References _currentNetworkReply, and _networkAccessManager.
Referenced by checkForUpdate(), and checkForUpdateAndShowDialog().
void UpdateCheckDialog::handleUpdateCheckDialogButtonClicked | ( | QAbstractButton * | clickedButton | ) | [private, slot] |
This slot is called, when a button in the dialog is clicked.
If the clicked button was the cancel button, the user wants to cancel the update check. So the _networkAccessManager request is aborted and the timer for the progress bar animation is stopped.
In any case if a button is clicked, the dialog box will be closed.
Definition at line 244 of file UpdateCheckDialog.cpp.
References _currentNetworkReply, _roleOfClickedButton, _updateCheckDialogForm, and _updateCheckProgressTimer.
Referenced by UpdateCheckDialog().
void UpdateCheckDialog::initProxySettings | ( | ) | [private, slot] |
Definition at line 310 of file UpdateCheckDialog.cpp.
References _networkAccessManager, and _settings.
Referenced by UpdateCheckDialog().
void UpdateCheckDialog::showCheckingForUpdateDialog | ( | ) | [private] |
Displays the progress bar during update check.
For displaying activity during update check, a timer is started to updated the progress bar. The user can press a cancel button to stop the update check.
Definition at line 196 of file UpdateCheckDialog.cpp.
References _updateCheckDialogForm, _updateCheckProgressCounter, and _updateCheckProgressTimer.
Referenced by checkForUpdateAndShowDialog().
void UpdateCheckDialog::showNewVersionAvailableDialog | ( | QString | newVersion | ) | [private] |
Displays the dialog with info about the new available version.
Definition at line 214 of file UpdateCheckDialog.cpp.
References _updateCheckDialogForm, and PROGRAM_VERSION_STRING.
Referenced by checkResultsOfFetchedPadXMLFile().
void UpdateCheckDialog::showNoNewVersionAvailableDialog | ( | ) | [private] |
Displays the dialog, that no new version is available.
Definition at line 226 of file UpdateCheckDialog.cpp.
References _updateCheckDialogForm.
Referenced by checkResultsOfFetchedPadXMLFile().
void UpdateCheckDialog::updateUpdateCheckProgressBar | ( | ) | [private, slot] |
This slot is responsible for the animation of the update check progress bar.
Definition at line 261 of file UpdateCheckDialog.cpp.
References _updateCheckDialogForm, and _updateCheckProgressCounter.
Referenced by UpdateCheckDialog().
QNetworkReply* UpdateCheckDialog::_currentNetworkReply [private] |
Definition at line 67 of file UpdateCheckDialog.h.
Referenced by checkResultsOfFetchedPadXMLFile(), getPadXMLFile(), handleUpdateCheckDialogButtonClicked(), and ~UpdateCheckDialog().
bool UpdateCheckDialog::_manualUpdateRequested [private] |
Definition at line 65 of file UpdateCheckDialog.h.
Referenced by checkForUpdate(), checkForUpdateAndShowDialog(), and checkResultsOfFetchedPadXMLFile().
QNetworkAccessManager* UpdateCheckDialog::_networkAccessManager [private] |
Definition at line 66 of file UpdateCheckDialog.h.
Referenced by getPadXMLFile(), initProxySettings(), UpdateCheckDialog(), and ~UpdateCheckDialog().
QDialogButtonBox::ButtonRole UpdateCheckDialog::_roleOfClickedButton [private] |
Definition at line 68 of file UpdateCheckDialog.h.
Referenced by checkResultsOfFetchedPadXMLFile(), and handleUpdateCheckDialogButtonClicked().
QSharedPointer<UiGuiSettings> UpdateCheckDialog::_settings [private] |
Definition at line 64 of file UpdateCheckDialog.h.
Referenced by checkResultsOfFetchedPadXMLFile(), initProxySettings(), and UpdateCheckDialog().
Ui::UpdateCheckDialog* UpdateCheckDialog::_updateCheckDialogForm [private] |
Definition at line 56 of file UpdateCheckDialog.h.
Referenced by handleUpdateCheckDialogButtonClicked(), showCheckingForUpdateDialog(), showNewVersionAvailableDialog(), showNoNewVersionAvailableDialog(), UpdateCheckDialog(), and updateUpdateCheckProgressBar().
int UpdateCheckDialog::_updateCheckProgressCounter [private] |
Definition at line 70 of file UpdateCheckDialog.h.
Referenced by showCheckingForUpdateDialog(), UpdateCheckDialog(), and updateUpdateCheckProgressBar().
QTimer* UpdateCheckDialog::_updateCheckProgressTimer [private] |
Definition at line 69 of file UpdateCheckDialog.h.
Referenced by checkResultsOfFetchedPadXMLFile(), handleUpdateCheckDialogButtonClicked(), showCheckingForUpdateDialog(), and UpdateCheckDialog().