1 /* 2 * Copyright (C) 2014 Nicolas Bonnefon and other contributors 3 * 4 * This file is part of glogg. 5 * 6 * glogg is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * glogg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with glogg. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef VERSIONCHECKER_H 21 #define VERSIONCHECKER_H 22 23 #include <QObject> 24 #include <QtNetwork> 25 26 // This class compares the current version number with the latest 27 // stored on a central server 28 class VersionChecker : public QObject 29 { 30 Q_OBJECT 31 32 public: 33 VersionChecker(); 34 ~VersionChecker(); 35 36 // Starts an asynchronous check for a newer version if it is needed. 37 // A newVersionFound signal is sent if one is found. 38 // In case of error or if no new version is found, no signal is emitted. 39 void startCheck(); 40 41 signals: 42 // New version "version" is available 43 void newVersionFound( const QString& version ); 44 45 private slots: 46 // Called when download is finished 47 void downloadFinished( QNetworkReply* ); 48 49 private: 50 static const char* VERSION_URL; 51 52 QNetworkAccessManager manager_; 53 }; 54 55 #endif 56