Enroute Flight Navigation
A navigation app for VFR pilots
GlobalObject.h
1/***************************************************************************
2 * Copyright (C) 2021-2025 by Stefan Kebekus *
3 * stefan.kebekus@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU 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 *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21#pragma once
22
23#include <QObject>
24#include <functional>
25
26class DemoRunner;
27class GlobalSettings;
28class Librarian;
29class QNetworkAccessManager;
30class Sensors;
31
32namespace DataManagement
33{
34class DataManager;
35class SSLErrorHandler;
36} // namespace DataManagement
37
38namespace GeoMaps
39{
40class GeoMapProvider;
41class WaypointLibrary;
42} // namespace GeoMaps
43
44namespace Flightlog
45{
46class FlightLog;
47} // namespace Flightlog
48
49namespace Navigation
50{
51class Clock;
52class Navigator;
53} // namespace Navigation
54
55namespace NOTAM
56{
57class NOTAMProvider;
58} // namespace NOTAM
59
60namespace Notifications
61{
63} // namespace Notifications
64
65namespace Traffic
66{
67class FlarmnetDB;
68class PasswordDB;
70} // namespace Traffic
71
72namespace Platform
73{
74class FileExchange;
75class PlatformAdaptor;
76} // namespace Platform
77
78namespace Positioning
79{
81} // namespace Positioning
82
83namespace Weather
84{
85class WeatherDataProvider;
86} // namespace Weather
87
110
111class GlobalObject : public QObject
112{
113 Q_OBJECT
114
115public:
120 explicit GlobalObject(QObject *parent = nullptr);
121
127 ~GlobalObject() override = default;
128
133 static void clear();
134
144 Q_INVOKABLE static bool canConstruct();
145
163 static void runOnMainThread(std::function<void()> function);
164
169 Q_INVOKABLE static Navigation::Clock* clock();
170
176
181 Q_INVOKABLE static DemoRunner* demoRunner();
182
187 Q_INVOKABLE static Traffic::FlarmnetDB* flarmnetDB();
188
194
199 Q_INVOKABLE static Flightlog::FlightLog* flightLog();
200
207
212 Q_INVOKABLE static GlobalSettings* globalSettings();
213
218 Q_INVOKABLE static Librarian* librarian();
219
225
230 Q_INVOKABLE static Sensors* sensors();
231
236 Q_INVOKABLE static Navigation::Navigator* navigator();
237
242 Q_INVOKABLE static Traffic::PasswordDB* passwordDB();
243
249
254 Q_INVOKABLE static NOTAM::NOTAMProvider* notamProvider();
255
261
266 Q_INVOKABLE static QNetworkAccessManager* networkAccessManager();
267
273
279
285
291
292protected:
301 {
302 ;
303 }
304
305private:
306 Q_DISABLE_COPY_MOVE(GlobalObject)
307
308 template <typename T>
309 static auto allocateInternal(QPointer<T> &pointer) -> T *;
310};
Manages the list of geographic maps.
Definition DataManager.h:73
Remote controls the app and takes screenshot images.
Definition DemoRunner.h:38
Flight log manager with pluggable automatic flight detection.
Definition FlightLog.h:56
Provides geographic information.
Library of user-defined waypoints.
Base class for global singleton objects.
static Q_INVOKABLE bool canConstruct()
Indicates if the static methods are ready to be used.
static Q_INVOKABLE Traffic::PasswordDB * passwordDB()
Pointer to appplication-wide static PasswordDB instance.
static Q_INVOKABLE GeoMaps::WaypointLibrary * waypointLibrary()
Pointer to appplication-wide static WaypointLibrary instance.
static Q_INVOKABLE Platform::PlatformAdaptor * platformAdaptor()
Pointer to appplication-wide static PlatformAdaptor instance.
static Q_INVOKABLE GeoMaps::GeoMapProvider * geoMapProvider()
Pointer to appplication-wide static GeoMaps::GeoMapProvider instance.
static Q_INVOKABLE Librarian * librarian()
Pointer to appplication-wide static librarian instance.
static Q_INVOKABLE Navigation::Navigator * navigator()
Pointer to appplication-wide static Navigation::Navigator instance.
static Q_INVOKABLE Positioning::PositionProvider * positionProvider()
Pointer to appplication-wide static PositionProvider instance.
static Q_INVOKABLE DataManagement::DataManager * dataManager()
Pointer to appplication-wide static GeoMaps::DataManager instance.
static Q_INVOKABLE Platform::FileExchange * fileExchange()
Pointer to appplication-wide static FileExchange instance.
static Q_INVOKABLE Sensors * sensors()
Pointer to appplication-wide static Navigation::Clock instance.
~GlobalObject() override=default
Standard deconstructor.
static void runOnMainThread(std::function< void()> function)
Run a function on the main thread once the event loop is up.
static Q_INVOKABLE Notifications::NotificationManager * notificationManager()
Pointer to appplication-wide static notification manager instance.
static Q_INVOKABLE DataManagement::SSLErrorHandler * sslErrorHandler()
Pointer to appplication-wide static QNetworkAccessManager instance.
static Q_INVOKABLE DemoRunner * demoRunner()
Pointer to appplication-wide static DemoRunner instance.
static Q_INVOKABLE Weather::WeatherDataProvider * weatherDataProvider()
Pointer to appplication-wide static WeatherDataProvider instance.
GlobalObject(QObject *parent=nullptr)
Standard constructor.
static Q_INVOKABLE Flightlog::FlightLog * flightLog()
Pointer to appplication-wide static FlightLog instance.
static Q_INVOKABLE Traffic::TrafficDataProvider * trafficDataProvider()
Pointer to appplication-wide static TrafficDataProvider instance.
static Q_INVOKABLE Traffic::FlarmnetDB * flarmnetDB()
Pointer to appplication-wide static FlarmnetDB instance.
static Q_INVOKABLE Navigation::Clock * clock()
Pointer to appplication-wide static Navigation::Clock instance.
virtual void deferredInitialization()
Non-constructor initialization.
static Q_INVOKABLE NOTAM::NOTAMProvider * notamProvider()
Pointer to appplication-wide static notification manager instance.
static void clear()
Deletes all globally defined objects.
static Q_INVOKABLE QNetworkAccessManager * networkAccessManager()
Pointer to appplication-wide static QNetworkAccessManager instance.
static Q_INVOKABLE GlobalSettings * globalSettings()
Pointer to appplication-wide static Settings instance.
Global Settings Manager.
Manage libraries and text assets.
Definition Librarian.h:40
Manage NOTAM data and download NOTAM data from the FAA if required.
This extremely simple class give accss to time and offers a few time-related functions.
Definition Clock.h:39
Main hub for navigation data.
Definition Navigator.h:43
This class manages notifications and presents them to the GUI.
Implementation of FileExchange for Android devices.
Implementation of PlatformAdaptor for Android devices.
Central Position Provider.
Sensor data.
Definition Sensors.h:43
Flarmnet database.
Definition FlarmnetDB.h:37
Password database.
Definition PasswordDB.h:37
WeatherDataProvider, weather service manager.