Enroute Flight Navigation
A navigation app for VFR pilots
DemoRunner.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 <QQmlApplicationEngine>
24#include <QQmlEngine>
25#include <QQuickWindow>
26
27#include "GlobalObject.h"
28#include "weather/Observer.h"
29
30
37
38class DemoRunner : public QObject {
39 Q_OBJECT
40 QML_ELEMENT
41 QML_SINGLETON
42
43public:
50 explicit DemoRunner(QObject *parent = nullptr);
51
52 // No default constructor, important for QML singleton
53 explicit DemoRunner() = delete;
54
55 // Standard destructor
56 ~DemoRunner() override = default;
57
58 // factory function for QML singleton
59 static DemoRunner* create(QQmlEngine* /*unused*/, QJSEngine* /*unused*/)
60 {
62 }
63
70 void setEngine(QQmlApplicationEngine* engine);
71
72public slots:
73 // Begin to remote-control the app
74 void generateGooglePlayScreenshots();
75
76 // Begin to remote-control the app
77 void generateIosScreenshots();
78
79 // Begin to remote-control the app
80 void generateMacosScreenshots();
81
82 // Begin to remote-control the app
83 void generateManualScreenshots();
84
96
97signals:
100
105 void requestOpenDrawer(bool open);
106
113 void requestOpenDialog(QString url, QVariantMap properties);
114
121 void requestOpenPage(QString url);
122
125
127 void requestFollowGPS(bool val);
128
130 void requestMapBearing(double bearing);
131
136 void requestMapBearingPolicy(int bearing);
137
140
143
146
149
152
155
158
163 void requestShowSideView(bool show);
164
168
173 void requestVAC(QString vacName);
174
176 void requestZoomLevel(double newZoom);
177
178private:
179 Q_DISABLE_COPY_MOVE(DemoRunner)
180
181 QPointer<QQmlApplicationEngine> m_engine;
182
183 void generateScreenshotsForDevices(const QStringList &, bool);
184
185 static void saveScreenshot(bool, QQuickWindow *, const QString&);
186 // Warnings and errors reported by the QML engine since setEngine() was
187 // called, see runSmokeTest()
188 QStringList m_qmlProblems;
189
190};
void requestClosePages()
Emitted to indicate that the GUI return to the main page.
void requestOpenAircraftPage()
Emitted to indicate that the GUI should open the "Aircraft" page.
void requestOpenWeatherPage()
Emitted to indicate that the GUI should open the "Weather" page.
void runSmokeTest()
Open every page and dialog once, then quit.
void requestOpenNearbyPage()
Emitted to indicate that the GUI should open the "Nearby" page.
void requestMapBearing(double bearing)
Emitted to set bearing of the moving map.
DemoRunner(QObject *parent=nullptr)
Creates a new DemoRunner.
void requestMapBearingPolicy(int bearing)
Emitted to indicate that the GUI should set a map bearing.
void requestShowWindTab()
Emitted to indicate that the GUI should show the "Wind" tab of the "Route & Wind" page.
void requestOpenDialog(QString url, QVariantMap properties)
Emitted to request that a dialog is opened via Global.dialogLoader.
void requestFollowGPS(bool val)
Emitted to set followGPS mode in the moving map.
void requestOpenRoutePage()
Emitted to indicate that the GUI should open the "Route & Wind" page.
void requestZoomLevel(double newZoom)
Emitted to set a zoom level in the moving map.
void requestOpenPage(QString url)
Emitted to request that a page is pushed onto the main stack view.
void requestOpenDrawer(bool open)
Emitted to request that the drawer with the main menu opens or closes.
void setEngine(QQmlApplicationEngine *engine)
Set pointer to QQmlApplicationEngine.
void requestCloseWaypointDescription()
Emitted to indicate that the GUI close open the "Waypoint Description" dialog.
void requestOpenWeatherDialog(Weather::Observer *obs)
Emitted to indicate that the GUI should open the "Weather" page.
void requestOpenWaypointDescription(GeoMaps::Waypoint waypoint)
Emitted to indicate that the GUI should open the "Waypoint Description" dialog.
void requestOpenFlightRouteAddWPDialog()
Emitted to indicate that the GUI should open the "Add Waypoint" dialog.
void requestVAC(QString vacName)
Emitted to indicate that the GUI should set a VAC.
void requestShowSideView(bool show)
Emitted to indicate that the GUI should show the aircraft side view.
Waypoint, such as an airfield, a navaid station or a reporting point.
Definition Waypoint.h:43
static Q_INVOKABLE DemoRunner * demoRunner()
Pointer to appplication-wide static DemoRunner instance.
Holds and updates METAR and TAF for a given waypoint.
Definition Observer.h:37