From d53c29d50fff866023f849d626b975710d4f2721 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 29 Aug 2021 17:29:30 +0200 Subject: [PATCH] Documentation was updated. --- docs/d0/d8a/class_m_utils_1_1_update_checker.html | 6 +++--- docs/d0/dd7/_version_8h_source.html | 2 +- docs/d2/d7d/class_m_utils_1_1_update_checker-members.html | 2 +- docs/d6/d83/_update_checker_8h_source.html | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/d0/d8a/class_m_utils_1_1_update_checker.html b/docs/d0/d8a/class_m_utils_1_1_update_checker.html index 93248a9..3dc9f23 100644 --- a/docs/d0/d8a/class_m_utils_1_1_update_checker.html +++ b/docs/d0/d8a/class_m_utils_1_1_update_checker.html @@ -123,9 +123,9 @@ void messageLogged (co - - + + diff --git a/docs/d0/dd7/_version_8h_source.html b/docs/d0/dd7/_version_8h_source.html index e1537e6..74846e4 100644 --- a/docs/d0/dd7/_version_8h_source.html +++ b/docs/d0/dd7/_version_8h_source.html @@ -67,7 +67,7 @@ $(function() {
Version.h
-
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2021 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
22 #pragma once
23 
24 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QString>
29 #include <QDate>
30 #include <QTime>
31 
32 namespace MUtils
33 {
34  class Version
35  {
36  public:
37  //Get Library Version Numbers
38  MUTILS_API static const quint32 &lib_version_major(void);
39  MUTILS_API static const quint32 &lib_version_minor(void);
40 
41  //Get Library Build Date/Time
42  MUTILS_API static const QDate lib_build_date(void);
43  MUTILS_API static const QTime lib_build_time(void);
44 
45  //Get Application Build Date/Time
46  MUTILS_API static const QDate app_build_date(const char *const date_str = build_date_raw());
47  MUTILS_API static const QTime app_build_time(const char *const time_str = build_time_raw());
48 
49  //Compiler detection
50  static const char *const compiler_version(void)
51  {
52  static const char *const COMPILER_VERS =
53  #if defined(__INTEL_COMPILER)
54  #if (__INTEL_COMPILER >= 1500)
55  "ICL 15." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
56  #elif (__INTEL_COMPILER >= 1400)
57  "ICL 14." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
58  #elif (__INTEL_COMPILER >= 1300)
59  "ICL 13." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
60  #elif (__INTEL_COMPILER >= 1200)
61  "ICL 12." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
62  #elif (__INTEL_COMPILER >= 1100)
63  "ICL 11.x";
64  #elif (__INTEL_COMPILER >= 1000)
65  "ICL 10.x";
66  #else
67  #error Compiler is not supported!
68  #endif
69  #elif defined(_MSC_VER)
70  #if (_MSC_VER == 1928)
71  "MSVC 2019.8";
72  #elif (_MSC_VER == 1927)
73  "MSVC 2019.7";
74  #elif (_MSC_VER == 1926)
75  "MSVC 2019.6";
76  #elif (_MSC_VER == 1925)
77  "MSVC 2019.5";
78  #elif (_MSC_VER == 1924)
79  "MSVC 2019.4";
80  #elif (_MSC_VER == 1923)
81  "MSVC 2019.3";
82  #elif (_MSC_VER == 1922)
83  "MSVC 2019.2";
84  #elif (_MSC_VER == 1921)
85  "MSVC 2019.1";
86  #elif (_MSC_VER == 1920)
87  "MSVC 2019.0";
88  #elif (_MSC_VER == 1916)
89  "MSVC 2017.9";
90  #elif (_MSC_VER == 1915)
91  "MSVC 2017.8";
92  #elif (_MSC_VER == 1914)
93  "MSVC 2017.7";
94  #elif (_MSC_VER == 1913)
95  "MSVC 2017.6";
96  #elif (_MSC_VER == 1912)
97  "MSVC 2017.5";
98  #elif (_MSC_VER == 1911)
99  "MSVC 2017.4";
100  #elif (_MSC_VER == 1910)
101  "MSVC 2017.2";
102  #elif (_MSC_VER == 1900)
103  #if (_MSC_FULL_VER == 190023026)
104  "MSVC 2015";
105  #elif (_MSC_FULL_VER == 190023506)
106  "MSVC 2015.1";
107  #elif (_MSC_FULL_VER == 190023918)
108  "MSVC 2015.2";
109  #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
110  "MSVC 2015.3";
111  #else
112  #error Compiler version is not supported yet!
113  #endif
114  #elif (_MSC_VER == 1800)
115  #if (_MSC_FULL_VER == 180021005)
116  "MSVC 2013";
117  #elif (_MSC_FULL_VER == 180030501)
118  "MSVC 2013.2";
119  #elif (_MSC_FULL_VER == 180030723)
120  "MSVC 2013.3";
121  #elif (_MSC_FULL_VER == 180031101)
122  "MSVC 2013.4";
123  #elif (_MSC_FULL_VER == 180040629)
124  "MSVC 2013.5";
125  #else
126  #error Compiler version is not supported yet!
127  #endif
128  #elif (_MSC_VER == 1700)
129  #if (_MSC_FULL_VER == 170050727)
130  "MSVC 2012";
131  #elif (_MSC_FULL_VER == 170051106)
132  "MSVC 2012.1";
133  #elif (_MSC_FULL_VER == 170060315)
134  "MSVC 2012.2";
135  #elif (_MSC_FULL_VER == 170060610)
136  "MSVC 2012.3";
137  #elif (_MSC_FULL_VER == 170061030)
138  "MSVC 2012.4";
139  #else
140  #error Compiler version is not supported yet!
141  #endif
142  #elif (_MSC_VER == 1600)
143  #if (_MSC_FULL_VER >= 160040219)
144  "MSVC 2010-SP1";
145  #else
146  "MSVC 2010";
147  #endif
148  #else
149  #error Compiler is not supported!
150  #endif
151  #else
152  #error Compiler is not supported!
153  #endif
154  return COMPILER_VERS;
155  }
156 
157  //Architecture detection
158  static const char *const compiler_arch(void)
159  {
160  static const char *const COMPILER_ARCH =
161  #if defined(_M_X64)
162  "x64";
163  #elif defined(_M_IX86)
164  "x86";
165  #else
166  #error Architecture is not supported!
167  #endif
168  return COMPILER_ARCH;
169  }
170 
171  private:
172  //Raw Build date
173  static const char *const build_date_raw(void)
174  {
175  static const char *const RAW_BUILD_DATE = __DATE__;
176  return RAW_BUILD_DATE;
177  }
178 
179  //Raw Build time
180  static const char *const build_time_raw(void)
181  {
182  static const char *const RAW_BUILD_TIME = __TIME__;
183  return RAW_BUILD_TIME;
184  }
185 
186  //Disable construction
187  Version(void) { throw 666; }
188  Version(const Version&) { throw 666; }
189  };
190 }
191 
Definition: Version.h:34
+
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2021 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
22 #pragma once
23 
24 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QString>
29 #include <QDate>
30 #include <QTime>
31 
32 namespace MUtils
33 {
34  class Version
35  {
36  public:
37  //Get Library Version Numbers
38  MUTILS_API static const quint32 &lib_version_major(void);
39  MUTILS_API static const quint32 &lib_version_minor(void);
40 
41  //Get Library Build Date/Time
42  MUTILS_API static const QDate lib_build_date(void);
43  MUTILS_API static const QTime lib_build_time(void);
44 
45  //Get Application Build Date/Time
46  MUTILS_API static const QDate app_build_date(const char *const date_str = build_date_raw());
47  MUTILS_API static const QTime app_build_time(const char *const time_str = build_time_raw());
48 
49  //Compiler detection
50  static const char *const compiler_version(void)
51  {
52  static const char *const COMPILER_VERS =
53  #if defined(__INTEL_COMPILER)
54  #if (__INTEL_COMPILER >= 1500)
55  "ICL 15." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
56  #elif (__INTEL_COMPILER >= 1400)
57  "ICL 14." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
58  #elif (__INTEL_COMPILER >= 1300)
59  "ICL 13." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
60  #elif (__INTEL_COMPILER >= 1200)
61  "ICL 12." MUTILS_MAKE_STRING(__INTEL_COMPILER_BUILD_DATE);
62  #elif (__INTEL_COMPILER >= 1100)
63  "ICL 11.x";
64  #elif (__INTEL_COMPILER >= 1000)
65  "ICL 10.x";
66  #else
67  #error Compiler is not supported!
68  #endif
69  #elif defined(_MSC_VER)
70  #if (_MSC_VER == 1929)
71  #if (_MSC_FULL_VER < 192930133)
72  "MSVC 2019.10";
73  #else
74  "MSVC 2019.11";
75  #endif
76  #elif (_MSC_VER == 1928)
77  #if (_MSC_FULL_VER < 192829910)
78  "MSVC 2019.8";
79  #else
80  "MSVC 2019.9";
81  #endif
82  #elif (_MSC_VER == 1927)
83  "MSVC 2019.7";
84  #elif (_MSC_VER == 1926)
85  "MSVC 2019.6";
86  #elif (_MSC_VER == 1925)
87  "MSVC 2019.5";
88  #elif (_MSC_VER == 1924)
89  "MSVC 2019.4";
90  #elif (_MSC_VER == 1923)
91  "MSVC 2019.3";
92  #elif (_MSC_VER == 1922)
93  "MSVC 2019.2";
94  #elif (_MSC_VER == 1921)
95  "MSVC 2019.1";
96  #elif (_MSC_VER == 1920)
97  "MSVC 2019.0";
98  #elif (_MSC_VER == 1916)
99  "MSVC 2017.9";
100  #elif (_MSC_VER == 1915)
101  "MSVC 2017.8";
102  #elif (_MSC_VER == 1914)
103  "MSVC 2017.7";
104  #elif (_MSC_VER == 1913)
105  "MSVC 2017.6";
106  #elif (_MSC_VER == 1912)
107  "MSVC 2017.5";
108  #elif (_MSC_VER == 1911)
109  "MSVC 2017.4";
110  #elif (_MSC_VER == 1910)
111  "MSVC 2017.2";
112  #elif (_MSC_VER == 1900)
113  #if (_MSC_FULL_VER == 190023026)
114  "MSVC 2015";
115  #elif (_MSC_FULL_VER == 190023506)
116  "MSVC 2015.1";
117  #elif (_MSC_FULL_VER == 190023918)
118  "MSVC 2015.2";
119  #elif (_MSC_FULL_VER == 190024210) || (_MSC_FULL_VER == 190024215)
120  "MSVC 2015.3";
121  #else
122  #error Compiler version is not supported yet!
123  #endif
124  #elif (_MSC_VER == 1800)
125  #if (_MSC_FULL_VER == 180021005)
126  "MSVC 2013";
127  #elif (_MSC_FULL_VER == 180030501)
128  "MSVC 2013.2";
129  #elif (_MSC_FULL_VER == 180030723)
130  "MSVC 2013.3";
131  #elif (_MSC_FULL_VER == 180031101)
132  "MSVC 2013.4";
133  #elif (_MSC_FULL_VER == 180040629)
134  "MSVC 2013.5";
135  #else
136  #error Compiler version is not supported yet!
137  #endif
138  #elif (_MSC_VER == 1700)
139  #if (_MSC_FULL_VER == 170050727)
140  "MSVC 2012";
141  #elif (_MSC_FULL_VER == 170051106)
142  "MSVC 2012.1";
143  #elif (_MSC_FULL_VER == 170060315)
144  "MSVC 2012.2";
145  #elif (_MSC_FULL_VER == 170060610)
146  "MSVC 2012.3";
147  #elif (_MSC_FULL_VER == 170061030)
148  "MSVC 2012.4";
149  #else
150  #error Compiler version is not supported yet!
151  #endif
152  #elif (_MSC_VER == 1600)
153  #if (_MSC_FULL_VER >= 160040219)
154  "MSVC 2010-SP1";
155  #else
156  "MSVC 2010";
157  #endif
158  #else
159  #error Compiler is not supported!
160  #endif
161  #else
162  #error Compiler is not supported!
163  #endif
164  return COMPILER_VERS;
165  }
166 
167  //Architecture detection
168  static const char *const compiler_arch(void)
169  {
170  static const char *const COMPILER_ARCH =
171  #if defined(_M_X64)
172  "x64";
173  #elif defined(_M_IX86)
174  "x86";
175  #else
176  #error Architecture is not supported!
177  #endif
178  return COMPILER_ARCH;
179  }
180 
181  private:
182  //Raw Build date
183  static const char *const build_date_raw(void)
184  {
185  static const char *const RAW_BUILD_DATE = __DATE__;
186  return RAW_BUILD_DATE;
187  }
188 
189  //Raw Build time
190  static const char *const build_time_raw(void)
191  {
192  static const char *const RAW_BUILD_TIME = __TIME__;
193  return RAW_BUILD_TIME;
194  }
195 
196  //Disable construction
197  Version(void) { throw 666; }
198  Version(const Version&) { throw 666; }
199  };
200 }
201 
Definition: Version.h:34
This file contains miscellaneous functions that are generally useful for Qt-based applications...
Global MUtils namespace.
Definition: CPUFeatures.h:37
diff --git a/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html b/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html index 43b393f..080f925 100644 --- a/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html +++ b/docs/d2/d7d/class_m_utils_1_1_update_checker-members.html @@ -84,7 +84,7 @@ $(function() {
- + diff --git a/docs/d6/d83/_update_checker_8h_source.html b/docs/d6/d83/_update_checker_8h_source.html index c5a5af9..a9de319 100644 --- a/docs/d6/d83/_update_checker_8h_source.html +++ b/docs/d6/d83/_update_checker_8h_source.html @@ -67,7 +67,7 @@ $(function() {
UpdateChecker.h
-
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2021 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
22 #pragma once
23 
24 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QThread>
29 #include <QDate>
30 
31 class QUrl;
32 
34 
35 namespace MUtils
36 {
37  class MUTILS_API UpdateCheckerInfo
38  {
39  friend class UpdateChecker;
40 
41  public:
42  UpdateCheckerInfo(void);
43  void resetInfo(void);
44  bool isComplete(void);
45 
46  const quint32 &getBuildNo(void) const { return m_buildNo; }
47  const QDate &getBuildDate(void) const { return m_buildDate; }
48  const QString &getDownloadSite(void) const { return m_downloadSite; }
49  const QString &getDownloadAddress(void) const { return m_downloadAddress; }
50  const QString &getDownloadFilename(void) const { return m_downloadFilename; }
51  const QString &getDownloadFilecode(void) const { return m_downloadFilecode; }
52  const QString &getDownloadChecksum(void) const { return m_downloadChecksum; }
53 
54  private:
55  quint32 m_buildNo;
56  QDate m_buildDate;
57  QString m_downloadSite;
58  QString m_downloadAddress;
59  QString m_downloadFilename;
60  QString m_downloadFilecode;
61  QString m_downloadChecksum;
62  };
63 
64  // ----------------------------------------------------------------
65 
66  class MUTILS_API UpdateChecker : public QThread
67  {
68  Q_OBJECT
69 
70  public:
71  enum
72  {
73  UpdateStatus_NotStartedYet = 0,
74  UpdateStatus_CheckingConnection = 1,
75  UpdateStatus_FetchingUpdates = 2,
76  UpdateStatus_CompletedUpdateAvailable = 3,
77  UpdateStatus_CompletedNoUpdates = 4,
78  UpdateStatus_CompletedNewVersionOlder = 5,
79  UpdateStatus_ErrorNoConnection = 6,
80  UpdateStatus_ErrorConnectionTestFailed = 7,
81  UpdateStatus_ErrorFetchUpdateInfo = 8,
82  UpdateStatus_CancelledByUser = 9
83  }
84  update_status_t;
85 
86  UpdateChecker(const QString &binCurl, const QString &binGnuPG, const QString &binKeys, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode = false);
87  ~UpdateChecker(void);
88 
89  const int getUpdateStatus(void) const { return m_status; }
90  const bool getSuccess(void) const { return m_success; };
91  const int getMaximumProgress(void) const { return m_maxProgress; };
92  const int getCurrentProgress(void) const { return m_progress; };
93  const UpdateCheckerInfo *getUpdateInfo(void) const { return m_updateInfo.data(); }
94 
95  bool cancel(void) { return m_cancelled.ref(); }
96 
97  public slots:
98  void start(Priority = InheritPriority);
99 
100  protected:
101  void run(void);
102  void checkForUpdates(void);
103  void testMirrorsList(void);
104 
105  signals:
106  void statusChanged(const int status);
107  void progressChanged(const int progress);
108  void messageLogged(const QString &text);
109 
110  private:
111  const int m_maxProgress;
112  QScopedPointer<UpdateCheckerInfo> m_updateInfo;
113 
114  const bool m_betaUpdates;
115  const bool m_testMode;
116 
117  const QString m_applicationId;
118  const quint32 m_installedBuildNo;
119 
120  const QString m_binaryCurl;
121  const QString m_binaryGnuPG;
122  const QString m_binaryKeys;
123 
124  const QScopedPointer<const QHash<QString, QString>> m_environment;
125 
126  QAtomicInt m_success;
127  QAtomicInt m_cancelled;
128 
129  int m_status;
130  int m_progress;
131 
132  inline void setStatus(const int status);
133  inline void setProgress(const int progress);
134  inline void log(const QString &str1, const QString &str2 = QString(), const QString &str3 = QString(), const QString &str4 = QString());
135 
136  bool getUpdateInfo(const QString &url, const QString &outFileVers, const QString &outFileSign);
137  bool tryContactHost(const QString &hostname, const int &timeoutMsec);
138  bool parseVersionInfo(const QString &file, UpdateCheckerInfo *const updateInfo);
139 
140  bool getFile(const QUrl &url, const QString &outFile, const unsigned int maxRedir = 8U);
141  bool checkSignature(const QString &file, const QString &signature);
142  bool tryUpdateMirror(UpdateCheckerInfo *updateInfo, const QString &url, const bool &quick);
143 
144  bool execCurl(const QStringList &args, const QString &workingDir, const int timeout);
145  int execProcess(const QString &programFile, const QStringList &args, const QString &workingDir, const int timeout);
146  };
147 }
This file contains miscellaneous functions that are generally useful for Qt-based applications...
+
1 // MuldeR's Utilities for Qt
3 // Copyright (C) 2004-2021 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // http://www.gnu.org/licenses/lgpl-2.1.txt
21 
22 #pragma once
23 
24 //MUtils
25 #include <MUtils/Global.h>
26 
27 //Qt
28 #include <QThread>
29 #include <QDate>
30 
31 class QUrl;
32 
34 
35 namespace MUtils
36 {
37  class MUTILS_API UpdateCheckerInfo
38  {
39  friend class UpdateChecker;
40 
41  public:
42  UpdateCheckerInfo(void);
43  void resetInfo(void);
44  bool isComplete(void);
45 
46  const quint32 &getBuildNo(void) const { return m_buildNo; }
47  const QDate &getBuildDate(void) const { return m_buildDate; }
48  const QString &getDownloadSite(void) const { return m_downloadSite; }
49  const QString &getDownloadAddress(void) const { return m_downloadAddress; }
50  const QString &getDownloadFilename(void) const { return m_downloadFilename; }
51  const QString &getDownloadFilecode(void) const { return m_downloadFilecode; }
52  const QString &getDownloadChecksum(void) const { return m_downloadChecksum; }
53 
54  private:
55  quint32 m_buildNo;
56  QDate m_buildDate;
57  QString m_downloadSite;
58  QString m_downloadAddress;
59  QString m_downloadFilename;
60  QString m_downloadFilecode;
61  QString m_downloadChecksum;
62  };
63 
64  // ----------------------------------------------------------------
65 
66  class MUTILS_API UpdateChecker : public QThread
67  {
68  Q_OBJECT
69 
70  public:
71  enum
72  {
73  UpdateStatus_NotStartedYet = 0,
74  UpdateStatus_CheckingConnection = 1,
75  UpdateStatus_FetchingUpdates = 2,
76  UpdateStatus_CompletedUpdateAvailable = 3,
77  UpdateStatus_CompletedNoUpdates = 4,
78  UpdateStatus_CompletedNewVersionOlder = 5,
79  UpdateStatus_ErrorNoConnection = 6,
80  UpdateStatus_ErrorConnectionTestFailed = 7,
81  UpdateStatus_ErrorFetchUpdateInfo = 8,
82  UpdateStatus_CancelledByUser = 9
83  }
84  update_status_t;
85 
86  UpdateChecker(const QString &binCurl, const QString &binVerify, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode = false);
87  ~UpdateChecker(void);
88 
89  const int getUpdateStatus(void) const { return m_status; }
90  const bool getSuccess(void) const { return m_success; };
91  const int getMaximumProgress(void) const { return m_maxProgress; };
92  const int getCurrentProgress(void) const { return m_progress; };
93  const UpdateCheckerInfo *getUpdateInfo(void) const { return m_updateInfo.data(); }
94 
95  bool cancel(void) { return m_cancelled.ref(); }
96 
97  public slots:
98  void start(Priority = InheritPriority);
99 
100  protected:
101  void run(void);
102  void checkForUpdates(void);
103  void testMirrorsList(void);
104 
105  signals:
106  void statusChanged(const int status);
107  void progressChanged(const int progress);
108  void messageLogged(const QString &text);
109 
110  private:
111  const int m_maxProgress;
112  QScopedPointer<UpdateCheckerInfo> m_updateInfo;
113 
114  const bool m_betaUpdates;
115  const bool m_testMode;
116 
117  const QString m_applicationId;
118  const quint32 m_installedBuildNo;
119 
120  const QString m_binaryCurl;
121  const QString m_binaryVerify;
122 
123  const QScopedPointer<const QHash<QString, QString>> m_environment;
124 
125  QAtomicInt m_success;
126  QAtomicInt m_cancelled;
127 
128  int m_status;
129  int m_progress;
130 
131  inline void setStatus(const int status);
132  inline void setProgress(const int progress);
133  inline void log(const QString &str1, const QString &str2 = QString(), const QString &str3 = QString(), const QString &str4 = QString());
134 
135  bool getUpdateInfo(const QString &url, const QString &outFileVers, const QString &outFileSign);
136  bool tryContactHost(const QString &hostname, const int &timeoutMsec);
137  bool parseVersionInfo(const QString &file, UpdateCheckerInfo *const updateInfo);
138 
139  bool getFile(const QUrl &url, const QString &outFile, const unsigned int maxRedir = 8U);
140  bool checkSignature(const QString &file, const QString &signature);
141  bool tryUpdateMirror(UpdateCheckerInfo *updateInfo, const QString &url, const bool &quick);
142 
143  bool execCurl(const QStringList &args, const QString &workingDir, const int timeout);
144  int execProcess(const QString &programFile, const QStringList &args, const QString &workingDir, const int timeout);
145  };
146 }
This file contains miscellaneous functions that are generally useful for Qt-based applications...
Definition: UpdateChecker.h:37
Global MUtils namespace.
Definition: CPUFeatures.h:37
Definition: UpdateChecker.h:66

Public Member Functions

UpdateChecker (const QString &binCurl, const QString &binGnuPG, const QString &binKeys, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode=false)
 
UpdateChecker (const QString &binCurl, const QString &binVerify, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode=false)
 
const int getUpdateStatus (void) const
 
statusChanged(const int status) (defined in MUtils::UpdateChecker)MUtils::UpdateCheckersignal
testMirrorsList(void) (defined in MUtils::UpdateChecker)MUtils::UpdateCheckerprotected
update_status_t (defined in MUtils::UpdateChecker)MUtils::UpdateChecker
UpdateChecker(const QString &binCurl, const QString &binGnuPG, const QString &binKeys, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode=false) (defined in MUtils::UpdateChecker)MUtils::UpdateChecker
UpdateChecker(const QString &binCurl, const QString &binVerify, const QString &applicationId, const quint32 &installedBuildNo, const bool betaUpdates, const bool testMode=false) (defined in MUtils::UpdateChecker)MUtils::UpdateChecker
UpdateStatus_CancelledByUser enum value (defined in MUtils::UpdateChecker)MUtils::UpdateChecker
UpdateStatus_CheckingConnection enum value (defined in MUtils::UpdateChecker)MUtils::UpdateChecker
UpdateStatus_CompletedNewVersionOlder enum value (defined in MUtils::UpdateChecker)MUtils::UpdateChecker