Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
software_update.h
Go to the documentation of this file.
1
9
10#ifndef SOFTWARE_UPDATE_H
11#define SOFTWARE_UPDATE_H
12
13#include <QObject>
14#include <QUrl>
15#include <QMutex>
16#include <QScopedPointer>
17#include <QTimer>
18#include <QVersionNumber>
19
20class QNetworkAccessManager;
21class QNetworkReply;
23
28public:
32 void accept();
33
39 void reject(const QString &reason = {});
40
45 bool isAccepted() const;
46
52 QString reason() const;
53
54private:
55 bool accepted_ = false;
56 bool rejected_ = false;
57 QString reason_;
58};
59
64 QString title;
65 QVersionNumber version;
66 QVersionNumber shortVersion;
71 QString os;
72 qint64 length = 0;
73 QString edSignature;
74};
75
87class SoftwareUpdate : public QObject
88{
89 Q_OBJECT
90public:
92 SoftwareUpdate(const SoftwareUpdate &) = delete;
93
96
101 static SoftwareUpdate *instance();
102
113 void init(bool runWithoutSilentCheck = false);
114
118 void cleanup();
119
130 static void performUIUpdate();
131
135 static QString info();
136
144 static bool plattformSupported();
145
146/**** Utility functions for manipulating the automatic update check through the UI ****/
147
154void startAutoCheck(int intervalSeconds = 0);
155
159void stopAutoCheck();
160
165bool isAutoCheckEnabled() const;
166
167signals:
173 void updateAvailable(QString newVersion, QString releaseNotes);
174
179 void updateCheckFailed(const QString &errorString);
180
192
198
199private:
200 static SoftwareUpdate *instance_;
201 static QMutex mutex_;
202 static QMutex updateMutex_;
203
204 QTimer *updateCheckTimer_;
205 QNetworkAccessManager *networkAccessManager_;
206 QScopedPointer<SoftwareUpdateBackend> backend_;
207 QNetworkReply *pendingReply_ = nullptr;
208
213 QUrl updateUrl() const;
214
220 QList<AppcastItem> parseAppcast(const QByteArray &data) const;
221
222
223private slots:
228 void onNetworkReplyFinished(QNetworkReply *reply);
229
235 void checkForUpdates();
236
237
238protected:
243 explicit SoftwareUpdate(QObject *parent = nullptr);
244
247};
248
249#endif /* SOFTWARE_UPDATE_H */
An event object passed to shutdown listeners to allow vetoing.
Definition software_update.h:27
QString reason() const
Return the reason provided to the most recent reject() call.
Definition software_update.cpp:70
void accept()
Signal that this listener consents to the shutdown.
Definition software_update.cpp:54
bool isAccepted() const
Return whether the shutdown has been accepted.
Definition software_update.cpp:66
void reject(const QString &reason={})
Veto the shutdown with an optional explanatory message.
Definition software_update.cpp:60
Definition software_update_backend.h:31
void stopAutoCheck()
Stop the periodic automatic update check.
Definition software_update.cpp:233
static void performUIUpdate()
Definition software_update.cpp:187
void updateCheckFailed(const QString &errorString)
Emitted when the update check fails.
void updateAvailable(QString newVersion, QString releaseNotes)
Emitted when a new software update is available.
static bool plattformSupported()
Definition software_update.cpp:138
SoftwareUpdate & operator=(const SoftwareUpdate &)=delete
Deleted copy-assignment operator — SoftwareUpdate is a singleton.
void appShutdownRequested(ShutdownEvent *shutdownEvent)
Emitted when the application requests a shutdown to perform an update.
static SoftwareUpdate * instance()
Return the singleton SoftwareUpdate instance.
Definition software_update.cpp:96
void init(bool runWithoutSilentCheck=false)
Definition software_update.cpp:106
~SoftwareUpdate()
Destroy the SoftwareUpdate singleton and release all resources.
Definition software_update.cpp:91
void startAutoCheck(int intervalSeconds=0)
Start the periodic automatic update check.
Definition software_update.cpp:208
static QString info()
Definition software_update.cpp:131
void updateEngaged()
Emitted when the update process is engaged.
void cleanup()
Definition software_update.cpp:200
bool isAutoCheckEnabled() const
Return whether the periodic automatic update check is enabled.
Definition software_update.cpp:242
SoftwareUpdate(const SoftwareUpdate &)=delete
Deleted copy constructor — SoftwareUpdate is a singleton.
A single entry from a Sparkle-compatible appcast feed.
Definition software_update.h:63
QUrl releaseNotesUrl
Definition software_update.h:68
QVersionNumber shortVersion
Definition software_update.h:66
qint64 length
Definition software_update.h:72
QVersionNumber version
Definition software_update.h:65
QString title
Definition software_update.h:64
QString edSignature
Definition software_update.h:73
QString os
Definition software_update.h:71
QUrl downloadUrl
Definition software_update.h:67