Mercurial > hg > forks > UniversalIndentGUI
annotate src/UpdateCheckDialog.cpp @ 768:f3631db17328
Updated all date occurrences to the year 2011.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1045 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Thu, 21 Apr 2011 15:17:51 +0000 |
parents | ac165b6ae67e |
children | 01f01ab124a1 |
rev | line source |
---|---|
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
1 /*************************************************************************** |
768
f3631db17328
Updated all date occurrences to the year 2011.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
751
diff
changeset
|
2 * Copyright (C) 2006-2011 by Thomas Schweitzer * |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
3 * thomas-schweitzer(at)arcor.de * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
4 * * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License version 2.0 as * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
8 * * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
12 * GNU General Public License for more details. * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
13 * * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
15 * along with this program in the file LICENSE.GPL; if not, write to the * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
16 * Free Software Foundation, Inc., * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
18 ***************************************************************************/ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
19 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
20 #include "UpdateCheckDialog.h" |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
21 #include "ui_UpdateCheckDialog.h" |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
22 |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
23 #include "UiGuiSettings.h" |
652
d7b4ce40ceb9
From now on using an extra file and functions for gathering the version, build date and revision. This uncouples the connection between the MainWindow and AboutDialog and UpdateCheckDialog a bit by reducing the number of needed constructor parameters.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
648
diff
changeset
|
24 #include "UiGuiVersion.h" |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
25 |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
26 #include <QMessageBox> |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
27 #include <QDesktopServices> |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
28 #include <QNetworkAccessManager> |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
29 #include <QTimer> |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
30 #include <QDate> |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
31 #include <QUrl> |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
32 #include <QRegExpValidator> |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
33 #include <QNetworkRequest> |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
34 #include <QNetworkReply> |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
35 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
36 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
37 \class UpdateCheckDialog |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
38 \ingroup grp_MainWindow |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
39 \brief UpdateCheckDialog is a dialog widget that contains functions |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
40 for online checking for a new version of UniversalIndentGUI. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
41 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
42 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
43 /*! |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
44 \brief Initializes member variables and stores the version of UiGui and a pointer to the _settings object. |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
45 */ |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
46 UpdateCheckDialog::UpdateCheckDialog(QSharedPointer<UiGuiSettings> settings, QWidget *parent) : QDialog(parent), |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
47 _manualUpdateRequested(false), |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
48 _currentNetworkReply(NULL), |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
49 _roleOfClickedButton(QDialogButtonBox::InvalidRole) |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
50 { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
51 _updateCheckDialogForm = new Ui::UpdateCheckDialog(); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
52 _updateCheckDialogForm->setupUi(this); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
53 |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
54 // Create object for _networkAccessManager request and connect it with the request return handler. |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
55 _networkAccessManager = new QNetworkAccessManager(this); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
56 connect( _networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(QNetworkReply*)) ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
57 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
58 // Create a timer object used for the progress bar. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
59 _updateCheckProgressTimer = new QTimer(this); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
60 _updateCheckProgressTimer->setInterval(5); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
61 connect( _updateCheckProgressTimer, SIGNAL(timeout()), this, SLOT(updateUpdateCheckProgressBar()) ); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
62 _updateCheckProgressCounter = 0; |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
63 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
64 // Connect the dialogs buttonbox with a button click handler. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
65 connect( _updateCheckDialogForm->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(handleUpdateCheckDialogButtonClicked(QAbstractButton*)) ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
66 |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
67 _settings = settings; |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
68 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
69 // This dialog is always modal. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
70 setModal(true); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
71 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
72 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
73 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
74 /*! |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
75 \brief On destroy cancels any currently running network request. |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
76 */ |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
77 UpdateCheckDialog::~UpdateCheckDialog() { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
78 disconnect( _networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(QNetworkReply*)) ); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
79 if (_currentNetworkReply != NULL) |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
80 _currentNetworkReply->abort(); |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
81 } |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
82 |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
83 |
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
84 /*! |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
85 \brief This slot should be called, if an update check is manually invoked. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
86 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
87 In difference to the automatic update check, during manual update check request |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
88 a modal progress indicator dialog will be shown. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
89 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
90 void UpdateCheckDialog::checkForUpdateAndShowDialog() { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
91 _manualUpdateRequested = true; |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
92 getPadXMLFile(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
93 showCheckingForUpdateDialog(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
94 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
95 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
96 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
97 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
98 \brief This slot should be called, if an update check is automatically invoked. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
99 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
100 An automatic invoked update check should run in background, so the user |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
101 gets not interrupted by a dialog box. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
102 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
103 void UpdateCheckDialog::checkForUpdate() { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
104 _manualUpdateRequested = false; |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
105 getPadXMLFile(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
106 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
107 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
108 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
109 /*! |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
110 \brief This function tries to download the UniversalIndentGui pad file from the SourceForge server. |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
111 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
112 void UpdateCheckDialog::getPadXMLFile() { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
113 //_networkAccessManager->setHost("universalindent.sourceforge.net"); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
114 //_networkAccessManager->get("/universalindentgui_pad.xml"); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
115 _currentNetworkReply = _networkAccessManager->get(QNetworkRequest(QUrl("http://universalindent.sourceforge.net/universalindentgui_pad.xml"))); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
116 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
117 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
118 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
119 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
120 \brief This slot is called after the update check has returned, either by successfully |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
121 retrieving the pad file, or on any kind of network error. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
122 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
123 Shows a message if check was successful or not. Offers the user to go to the |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
124 download page if a newer version exists. In case of an error during update |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
125 check, a message box with the error will be displayed. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
126 */ |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
127 void UpdateCheckDialog::checkResultsOfFetchedPadXMLFile(QNetworkReply *networkReply) { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
128 Q_ASSERT(_currentNetworkReply == networkReply); |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
129 |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
130 // Stop the progress bar timer. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
131 _updateCheckProgressTimer->stop(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
132 |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
133 if ( networkReply->error() == QNetworkReply::NoError ) { |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
134 // Try to find the version string. |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
135 QString returnedString = networkReply->readAll(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
136 int leftPosition = returnedString.indexOf("<Program_Version>"); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
137 int rightPosition = returnedString.indexOf("</Program_Version>"); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
138 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
139 // If the version string could be found in the returned string, show an update dialog and set last update check date. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
140 if ( leftPosition != -1 && rightPosition != -1 ) { |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
141 // Get the pure version string from returned string. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
142 returnedString = returnedString.mid( leftPosition+17, rightPosition-(leftPosition+17) ); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
143 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
144 // Create integer values from the version strings. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
145 int versionOnServerInt = convertVersionStringToNumber( returnedString ); |
652
d7b4ce40ceb9
From now on using an extra file and functions for gathering the version, build date and revision. This uncouples the connection between the MainWindow and AboutDialog and UpdateCheckDialog a bit by reducing the number of needed constructor parameters.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
648
diff
changeset
|
146 int currentVersionInt = convertVersionStringToNumber( PROGRAM_VERSION_STRING ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
147 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
148 // Only show update dialog, if the current version number is lower than the one received from the server. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
149 if ( versionOnServerInt > currentVersionInt && currentVersionInt >= 0 && versionOnServerInt >= 0 ) { |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
150 // Show message box whether to download the new version. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
151 showNewVersionAvailableDialog(returnedString); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
152 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
153 // If yes clicked, open the download url in the default browser. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
154 if ( _roleOfClickedButton == QDialogButtonBox::YesRole ) { |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
155 QDesktopServices::openUrl( QUrl("_networkAccessManager://sourceforge.net/project/showfiles.php?group_id=167482") ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
156 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
157 } |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
158 else if ( _manualUpdateRequested ) { |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
159 showNoNewVersionAvailableDialog(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
160 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
161 // Set last update check date. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
162 _settings->setValueByName("LastUpdateCheck", QDate::currentDate()); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
163 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
164 // In the returned string, the version string could not be found. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
165 else { |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
166 QMessageBox::warning(this, tr("Update check error"), tr("There was an error while trying to check for an update! The retrieved file did not contain expected content.") ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
167 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
168 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
169 // If there was some error while trying to retrieve the update info from server and not cancel was pressed. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
170 else if ( _roleOfClickedButton != QDialogButtonBox::RejectRole ) { |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
171 QMessageBox::warning(this, tr("Update check error"), tr("There was an error while trying to check for an update! Error was : %1").arg(networkReply->errorString()) ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
172 } |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
173 _manualUpdateRequested = false; |
725
fc850ee753bd
[fix] Bug ID 2135872: A zombie process kept on running if UiGUI was quit during the update check in background if no internet connection is available.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
670
diff
changeset
|
174 networkReply->deleteLater(); |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
175 _currentNetworkReply = NULL; |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
176 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
177 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
178 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
179 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
180 \brief Displays the progress bar during update check. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
181 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
182 For displaying activity during update check, a timer is started to |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
183 updated the progress bar. The user can press a cancel button to |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
184 stop the update check. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
185 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
186 void UpdateCheckDialog::showCheckingForUpdateDialog() { |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
187 // Reset the progress bar. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
188 _updateCheckProgressCounter = 0; |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
189 _updateCheckDialogForm->progressBar->setValue(_updateCheckProgressCounter); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
190 _updateCheckDialogForm->progressBar->setInvertedAppearance( false ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
191 |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
192 _updateCheckProgressTimer->start(); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
193 _updateCheckDialogForm->progressBar->show(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
194 setWindowTitle( tr("Checking for update...") ); |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
195 _updateCheckDialogForm->label->setText( tr("Checking whether a newer version is available") ); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
196 _updateCheckDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::Cancel); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
197 show(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
198 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
199 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
200 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
201 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
202 \brief Displays the dialog with info about the new available version. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
203 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
204 void UpdateCheckDialog::showNewVersionAvailableDialog(QString newVersion) { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
205 _updateCheckDialogForm->progressBar->hide(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
206 setWindowTitle( tr("Update available") ); |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
207 _updateCheckDialogForm->label->setText( tr("A newer version of UniversalIndentGUI is available.\nYour version is %1. New version is %2.\nDo you want to go to the download website?").arg(PROGRAM_VERSION_STRING).arg(newVersion) ); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
208 _updateCheckDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::No|QDialogButtonBox::NoButton|QDialogButtonBox::Yes); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
209 exec(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
210 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
211 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
212 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
213 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
214 \brief Displays the dialog, that no new version is available. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
215 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
216 void UpdateCheckDialog::showNoNewVersionAvailableDialog() { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
217 _updateCheckDialogForm->progressBar->hide(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
218 setWindowTitle( tr("No new update available") ); |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
219 _updateCheckDialogForm->label->setText( tr("You already have the latest version of UniversalIndentGUI.") ); |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
220 _updateCheckDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::Ok); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
221 exec(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
222 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
223 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
224 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
225 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
226 \brief This slot is called, when a button in the dialog is clicked. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
227 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
228 If the clicked button was the cancel button, the user wants to cancel |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
229 the update check. So the _networkAccessManager request is aborted and the timer for the |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
230 progress bar animation is stopped. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
231 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
232 In any case if a button is clicked, the dialog box will be closed. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
233 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
234 void UpdateCheckDialog::handleUpdateCheckDialogButtonClicked(QAbstractButton *clickedButton) { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
235 _roleOfClickedButton = _updateCheckDialogForm->buttonBox->buttonRole(clickedButton); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
236 |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
237 if ( _roleOfClickedButton == QDialogButtonBox::RejectRole ) { |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
238 // Abort the _networkAccessManager request. |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
239 _currentNetworkReply->abort(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
240 // Stop the progress bar timer. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
241 _updateCheckProgressTimer->stop(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
242 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
243 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
244 accept(); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
245 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
246 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
247 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
248 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
249 \brief This slot is responsible for the animation of the update check progress bar. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
250 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
251 void UpdateCheckDialog::updateUpdateCheckProgressBar() { |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
252 // Depending on the progress bar direction, decrease or increase the progressbar value. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
253 if ( _updateCheckDialogForm->progressBar->invertedAppearance() ) { |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
254 _updateCheckProgressCounter--; |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
255 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
256 else { |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
257 _updateCheckProgressCounter++; |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
258 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
259 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
260 // If the progress bar reaches 0 or 100 as value, swap the animation direction. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
261 if ( _updateCheckProgressCounter == 0 || _updateCheckProgressCounter == 100 ) { |
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
262 _updateCheckDialogForm->progressBar->setInvertedAppearance( !_updateCheckDialogForm->progressBar->invertedAppearance() ); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
263 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
264 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
265 // Update the progress bar value. |
751
ac165b6ae67e
Done some refactoring:
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
727
diff
changeset
|
266 _updateCheckDialogForm->progressBar->setValue(_updateCheckProgressCounter); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
267 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
268 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
269 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
270 /*! |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
271 \brief Converts the as string given version \a versionString to an integer number. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
272 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
273 The \a versionString must have the format x.x.x where each x represents a number |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
274 of a maximum of 999. If the input format is wrong, -1 will be returned.The first |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
275 number will be multiplied by 1000000 the second by 1000 and then all three will |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
276 be summarized. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
277 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
278 Thus for example 12.5.170 will result in 12005170. |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
279 */ |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
280 int UpdateCheckDialog::convertVersionStringToNumber(QString versionString) { |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
281 int versionInteger = 0; |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
282 int pos = 0; |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
283 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
284 QRegExp regEx("\\d{1,3}.\\d{1,3}.\\d{1,3}"); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
285 QRegExpValidator validator(regEx, NULL); |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
286 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
287 if ( validator.validate(versionString, pos) == QValidator::Acceptable ) { |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
288 QStringList versionNumberStringList = versionString.split("."); |
670
44beb2ae34c9
[fix] Bug ID 2594251 : The new version check didn't work anymore since version 1.0.1. http://universalindent.sf.net/issue/bug/2594251
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
652
diff
changeset
|
289 versionInteger = versionNumberStringList.at(0).toInt() * 1000000; |
44beb2ae34c9
[fix] Bug ID 2594251 : The new version check didn't work anymore since version 1.0.1. http://universalindent.sf.net/issue/bug/2594251
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
652
diff
changeset
|
290 versionInteger += versionNumberStringList.at(1).toInt() * 1000; |
44beb2ae34c9
[fix] Bug ID 2594251 : The new version check didn't work anymore since version 1.0.1. http://universalindent.sf.net/issue/bug/2594251
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
652
diff
changeset
|
291 versionInteger += versionNumberStringList.at(2).toInt(); |
638
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
292 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
293 else { |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
294 versionInteger = -1; |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
295 } |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
296 |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
297 return versionInteger; |
94734b9eb54f
Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff
changeset
|
298 } |