wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
UpdateChecker.h
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
7
8#pragma once
9
10#include <QNetworkAccessManager>
11#include <QObject>
12#include <QString>
13#include <QUrl>
14#include <QVersionNumber>
15
28class UpdateChecker : public QObject
29{
30 Q_OBJECT
31
32 friend class TestUpdateChecker;
33
34public:
35 explicit UpdateChecker(QObject *parent = nullptr);
36
43 void checkForUpdates();
44
45signals:
52 void updateAvailable(const QString &latestVersion, const QUrl &downloadUrl, const QUrl &releaseUrl);
53
54private:
55 void onReplyFinished(class QNetworkReply *reply);
56
57 QNetworkAccessManager m_network;
61 QUrl m_apiUrl;
62
65 void setApiUrlForTesting(const QUrl &url) { m_apiUrl = url; }
66};
67
75QString releaseAssetKey(const QString &platform, const QString &arch);
76
83bool shouldOfferUpdate(const QString &tagName, const QVersionNumber &currentVersion, const QString &skippedVersion);
84
94bool isSafeGitHubUrl(const QUrl &url);
bool isSafeGitHubUrl(const QUrl &url)
True when url is safe to download from or hand to the OS's URL handler.
QString releaseAssetKey(const QString &platform, const QString &arch)
The key in latest-release.json holding the download URL for the given platform ("Windows"/"macOS"/"Li...
bool shouldOfferUpdate(const QString &tagName, const QVersionNumber &currentVersion, const QString &skippedVersion)
True when the release tagged tagName should be offered to a user running currentVersion who may have ...
UpdateChecker(QObject *parent=nullptr)
void updateAvailable(const QString &latestVersion, const QUrl &downloadUrl, const QUrl &releaseUrl)
Emitted when a newer release is available and has not been suppressed.
friend class TestUpdateChecker
void checkForUpdates()
Initiates an asynchronous version check.