2013-07-24 16:41:12 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2024-07-26 22:53:52 +00:00
|
|
|
* Copyright (C) 2012 Symless Ltd.
|
2013-07-24 16:41:12 +00:00
|
|
|
*
|
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2013-07-24 16:41:12 +00:00
|
|
|
*
|
|
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QString>
|
2024-07-16 08:30:35 +00:00
|
|
|
#include <memory>
|
2013-07-24 16:41:12 +00:00
|
|
|
|
|
|
|
|
class QNetworkAccessManager;
|
|
|
|
|
class QNetworkReply;
|
2024-07-26 22:53:52 +00:00
|
|
|
class VersionCheckerTests;
|
2013-07-24 16:41:12 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
class VersionChecker : public QObject {
|
|
|
|
|
Q_OBJECT
|
2024-07-26 22:53:52 +00:00
|
|
|
|
|
|
|
|
friend class VersionCheckerTests;
|
|
|
|
|
|
2013-07-24 16:41:12 +00:00
|
|
|
public:
|
2024-07-26 22:53:52 +00:00
|
|
|
explicit VersionChecker(
|
|
|
|
|
std::shared_ptr<QNetworkAccessManager> network = nullptr);
|
|
|
|
|
void checkLatest() const;
|
2013-07-24 16:41:12 +00:00
|
|
|
public slots:
|
2024-07-02 19:07:06 +00:00
|
|
|
void replyFinished(QNetworkReply *reply);
|
2013-07-24 16:41:12 +00:00
|
|
|
signals:
|
2024-07-02 19:07:06 +00:00
|
|
|
void updateFound(const QString &version);
|
|
|
|
|
|
2013-07-24 16:41:12 +00:00
|
|
|
private:
|
2024-07-26 22:53:52 +00:00
|
|
|
static int compareVersions(const QString &left, const QString &right);
|
2019-08-22 13:02:40 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
/**
|
|
|
|
|
* \brief Converts a string stage to a integer value
|
|
|
|
|
* \param stage The string containing the stage version
|
|
|
|
|
* \return An integer representation of the stage, the higher the number the
|
|
|
|
|
* more recent the version
|
|
|
|
|
*/
|
2024-07-26 22:53:52 +00:00
|
|
|
static int getStageVersion(QString stage);
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<QNetworkAccessManager> m_network;
|
2013-07-24 16:41:12 +00:00
|
|
|
};
|