File indexing completed on 2024-05-12 05:39:53
0001 /************************************************************************* 0002 * Copyright (C) 2011 by Renaud Guezennec * 0003 * * 0004 * https://rolisteam.org/ * 0005 * * 0006 * Rolisteam is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published * 0008 * by the Free Software Foundation; either version 2 of the License, * 0009 * or (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, write to the * 0018 * Free Software Foundation, Inc., * 0019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0020 *************************************************************************/ 0021 0022 #ifndef UPDATECHECKER_H 0023 #define UPDATECHECKER_H 0024 0025 #include <QNetworkAccessManager> 0026 #include <QString> 0027 #include <core_global.h> 0028 #include <memory> 0029 /** 0030 * @brief The UpdateChecker class is dedicated to check if there is new release of rolisteam. 0031 */ 0032 class CORE_EXPORT UpdateChecker : public QObject 0033 { 0034 Q_OBJECT 0035 Q_PROPERTY(bool needUpdate READ needUpdate NOTIFY needUpdateChanged) 0036 public: 0037 UpdateChecker(const QString& version, QObject* obj= nullptr); 0038 0039 bool needUpdate(); 0040 void startChecking(); 0041 0042 QString getLatestVersion(); 0043 QString getLatestVersionDate(); 0044 signals: 0045 void checkFinished(); 0046 void needUpdateChanged(); 0047 0048 private slots: 0049 void readXML(QNetworkReply* p); 0050 void setNeedUpdate(bool b); 0051 0052 private: 0053 bool m_needUpdate= false; 0054 QString m_localVersion; 0055 QString m_remoteVersion; 0056 QString m_dateRemoteVersion; 0057 QString m_changeLog; 0058 std::unique_ptr<QNetworkAccessManager> m_manager; 0059 bool m_noErrror= false; 0060 }; 0061 0062 #endif // UPDATECHECKER_H