FlightGear
next
UpdateChecker.hxx
Go to the documentation of this file.
1
// Written by James Turner, started October 2020
2
//
3
// Copyright (C) 2020 James Turner <james@flightgear.org>
4
//
5
// This program is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU General Public License as
7
// published by the Free Software Foundation; either version 2 of the
8
// License, or (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful, but
11
// WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19
#pragma once
20
21
#include <string>
22
23
#include <QObject>
24
#include <QByteArray>
25
#include <QUrl>
26
27
#include <simgear/io/HTTPRequest.hxx>
28
29
class
UpdateChecker
:
public
QObject
30
{
31
Q_OBJECT
32
33
Q_PROPERTY(
Status
status
READ
status
NOTIFY
statusChanged
)
34
Q_PROPERTY(QUrl
updateUri
READ
updateUri
NOTIFY
statusChanged
)
35
Q_PROPERTY(QString
updateVersion
READ
updateVersion
NOTIFY
statusChanged
)
36
public:
37
explicit
UpdateChecker
(QObject *parent =
nullptr
);
38
~
UpdateChecker
();
39
40
enum
Status
{
41
NoUpdate
,
42
PointUpdate
,
43
MajorUpdate
44
};
45
46
Q_ENUMS(
Status
)
47
48
49
Status
status
()
const
50
{
51
return
m_status;
52
}
53
54
QUrl
updateUri
()
const
55
{
56
return
m_updateUri;
57
}
58
59
QString
updateVersion
()
const
60
{
61
return
_currentUpdateVersion;
62
}
63
64
signals:
65
66
void
statusChanged
(
Status
status
);
67
68
public
slots:
69
void
ignoreUpdate
();
70
71
private
slots:
72
void
receivedUpdateXML(QByteArray body);
73
74
private
:
75
std::string _majorMinorVersion;
76
77
QString _currentUpdateVersion;
78
79
Status
m_status =
NoUpdate
;
80
QUrl m_updateUri;
81
82
simgear::HTTP::Request_ptr m_request;
83
};
84
UpdateChecker::updateVersion
QString updateVersion
Definition
UpdateChecker.hxx:35
UpdateChecker::UpdateChecker
UpdateChecker(QObject *parent=nullptr)
Definition
UpdateChecker.cxx:82
UpdateChecker::updateUri
QUrl updateUri
Definition
UpdateChecker.hxx:34
UpdateChecker::status
Status status
Definition
UpdateChecker.hxx:33
UpdateChecker::Status
Status
Definition
UpdateChecker.hxx:40
UpdateChecker::NoUpdate
@ NoUpdate
Definition
UpdateChecker.hxx:41
UpdateChecker::MajorUpdate
@ MajorUpdate
Definition
UpdateChecker.hxx:43
UpdateChecker::PointUpdate
@ PointUpdate
Definition
UpdateChecker.hxx:42
UpdateChecker::updateUri
QUrl updateUri() const
Definition
UpdateChecker.hxx:54
UpdateChecker::ignoreUpdate
void ignoreUpdate()
Definition
UpdateChecker.cxx:122
UpdateChecker::statusChanged
void statusChanged(Status status)
UpdateChecker::updateVersion
QString updateVersion() const
Definition
UpdateChecker.hxx:59
src
GUI
UpdateChecker.hxx
Generated on Tue Jun 3 2025 12:58:39 for FlightGear by
1.13.2