1 // Copyright (C) 2012-2019 The VPaint Developers.
2 // See the COPYRIGHT file at the top-level directory of this distribution
3 // and at https://github.com/dalboris/vpaint/blob/master/COPYRIGHT
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef UPDATECHECK_H
18 #define UPDATECHECK_H
19 
20 #include <QObject>
21 
22 #include "Version.h"
23 
24 class QNetworkAccessManager;
25 class QNetworkReply;
26 class QWidget;
27 class UpdateCheckDialog;
28 
29 class UpdateCheck: public QObject
30 {
31     Q_OBJECT
32 
33 public:
34     UpdateCheck(QWidget * parent = 0);
35     virtual ~UpdateCheck();
36 
37     Version versionChecked() const;
38     Version latestVersion() const;
39     void showWhenReady();
40     void checkForUpdates();
41 
42 private slots:
43     void requestFinished_();
44     void updateSettings_();
45 
46 private:
47     QNetworkAccessManager * networkManager_;
48     QNetworkReply * reply_;
49 
50     QWidget * parent_;
51     UpdateCheckDialog * dialog_;
52 
53     Version versionToCheck_, latestVersion_;
54     bool isReady_;
55 };
56 
57 #endif // UPDATECHECK_H
58