1/*
2 * Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15#ifndef UPDATER_H
16#define UPDATER_H
17
18#include <QLoggingCategory>
19#include <QObject>
20
21class QUrl;
22class QUrlQuery;
23
24namespace OCC {
25
26Q_DECLARE_LOGGING_CATEGORY(lcUpdater)
27
28class Updater : public QObject
29{
30 Q_OBJECT
31public:
32 struct Helper
33 {
34 static qint64 stringVersionToInt(const QString &version);
35 static qint64 currentVersionToInt();
36 static qint64 versionToInt(qint64 major, qint64 minor, qint64 patch, qint64 build);
37 };
38
39 static Updater *instance();
40 static QUrl updateUrl();
41
42 virtual void checkForUpdate() = 0;
43 virtual void backgroundCheckForUpdate() = 0;
44 virtual bool handleStartup() = 0;
45
46protected:
47 static QString clientVersion();
48 Updater()
49 : QObject(0)
50 {
51 }
52
53private:
54 static QString getSystemInfo();
55 static QUrlQuery getQueryParams();
56 static Updater *create();
57 static Updater *_instance;
58};
59
60} // namespace OCC
61
62#endif // UPDATER_H
63