-
Notifications
You must be signed in to change notification settings - Fork 207
/
ryupdatechecker.h
51 lines (43 loc) · 1.3 KB
/
ryupdatechecker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef RYUPDATECHECKER_H
#define RYUPDATECHECKER_H
#include <QtCore>
#include <QtNetwork>
#ifdef Q_OS_MAC
#define CURRENT_VERSION "1.0.140220"
#endif
#ifdef Q_OS_LINUX
#define CURRENT_VERSION "0.5.09.21"
#endif
#ifdef Q_OS_WIN
#define CURRENT_VERSION "1.0.140220"
#endif
#define RYTHEM_UPDATE_PREFIX "http://rythem.alloyteam.com/update.php?"
#define RYTHEM_UPDATE_URL(sys) RYTHEM_UPDATE_PREFIX # sys
class RyUpdateChecker : public QObject
{
Q_OBJECT
public:
explicit RyUpdateChecker(QObject *parent = 0);
bool isLargeThanCurrent(const QString& otherVersion,bool* isOk=0);
signals:
void gotNew(const QString& oldVersion,const QString& newVersion,const QString& updateUrl,const QString& log);
void updated();
void updateError(QNetworkReply::NetworkError err);
public slots:
#ifdef Q_OS_MAC
void check(QString url=RYTHEM_UPDATE_URL(mac),QString currentVersion=CURRENT_VERSION);
#endif
#ifdef Q_OS_WIN32
void check(QString url=RYTHEM_UPDATE_URL(windows),QString currentVersion=CURRENT_VERSION);
#endif
#ifdef Q_OS_X11
void check(QString url=RYTHEM_UPDATE_URL(x11),QString currentVersion=CURRENT_VERSION);
#endif
private slots:
void finished(QNetworkReply* reply);
private:
QNetworkAccessManager manager;
QString _currentVersion;
bool _isChecking;
};
#endif // RYUPDATECHECKER_H