Enroute Flight Navigation
A navigation app for VFR pilots
PlatformAdaptor_Abstract.h
1/***************************************************************************
2 * Copyright (C) 2019-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 <QGeoCoordinate>
24#include <QMarginsF>
25#include <QQmlEngine>
26#include <QQuickItem>
27
28#include "GlobalObject.h"
29#include "traffic/ConnectionInfo.h"
30
31
32namespace Platform {
33
53
55{
56 Q_OBJECT
57
58public:
63 explicit PlatformAdaptor_Abstract(QObject* parent = nullptr);
64
65 ~PlatformAdaptor_Abstract() override = default;
66
67
68 //
69 // Properties
70 //
71
85 Q_PROPERTY(QMarginsF safeInsets READ safeInsets NOTIFY safeInsetsChanged)
86
87
88 //
89 // Getter Methods
90 //
91
92
96 [[nodiscard]] virtual QMarginsF safeInsets() const { return {}; }
97
98
99 //
100 // Methods
101 //
102
107 Q_INVOKABLE static QString clipboardText();
108
114 Q_INVOKABLE static bool setClipboardText(const QString& text);
115
122 Q_INVOKABLE virtual QString currentSSID() { return {}; }
123
131 Q_INVOKABLE virtual void disableScreenSaver() {}
132
145 Q_INVOKABLE virtual void lockWifi(bool lock) { Q_UNUSED(lock) }
146
155 Q_INVOKABLE virtual void openSatView(const QGeoCoordinate& coordinate);
156
170 Q_INVOKABLE virtual void setupInputMethodEventFilter(QQuickItem* item) { Q_UNUSED(item) }
171
176 Q_INVOKABLE virtual QString versionNameForDisplay();
177
182 Q_INVOKABLE virtual QString systemInfo();
183
189 Q_INVOKABLE virtual void vibrateBrief() {}
190
197 Q_INVOKABLE virtual void vibrateLong() {}
198
204 Q_INVOKABLE virtual QString language();
205
214 Q_INVOKABLE static void saveScreenshot(const QImage& image, const QString& path);
215
220 virtual QVector<Traffic::ConnectionInfo> serialPortConnectionInfos();
221
222public slots:
231 virtual void onGUISetupCompleted() {}
232
233
234signals:
237
245 void error(const QString& message);
246
253
259
266
267private:
268 Q_DISABLE_COPY_MOVE(PlatformAdaptor_Abstract)
269
270};
271
272} // namespace Platform
GlobalObject(QObject *parent=nullptr)
Standard constructor.
virtual Q_INVOKABLE void vibrateBrief()
Make the device briefly vibrate.
static Q_INVOKABLE void saveScreenshot(const QImage &image, const QString &path)
Save image as a raster graphic file in path.
virtual QVector< Traffic::ConnectionInfo > serialPortConnectionInfos()
Connection infos for all available serial port connections.
virtual Q_INVOKABLE QString versionNameForDisplay()
Returns the application version and adds git commit hash, if it's not the main branch.
virtual void onGUISetupCompleted()
Signal handler: GUI setup completed.
void serialPortsChanged()
Emitted when a serial port configuration changes.
virtual Q_INVOKABLE void disableScreenSaver()
Disable the screen saver.
void safeInsetsChanged()
Notifier signal.
void wifiConnected()
Emitted when a new WiFi connections becomes available.
void error(const QString &message)
Emitted when an error occurs.
virtual QMarginsF safeInsets() const
Getter function for the property with the same name.
virtual Q_INVOKABLE void setupInputMethodEventFilter(QQuickItem *item)
Workaround for QTBUG-80790.
QMarginsF safeInsets
Safe-area insets of the application window (Android only).
virtual Q_INVOKABLE void vibrateLong()
Make the device vibrate for a longer period.
virtual Q_INVOKABLE QString language()
Language code that is to be used in the GUI.
PlatformAdaptor_Abstract(QObject *parent=nullptr)
Standard constructor.
virtual Q_INVOKABLE QString systemInfo()
Information about the system, in HTML format.
virtual Q_INVOKABLE QString currentSSID()
SSID of current Wi-Fi network.
static Q_INVOKABLE QString clipboardText()
Content of ClipBoard.
virtual Q_INVOKABLE void lockWifi(bool lock)
Lock connection to Wi-Fi network.
static Q_INVOKABLE bool setClipboardText(const QString &text)
Set text content to ClipBoard.
virtual Q_INVOKABLE void openSatView(const QGeoCoordinate &coordinate)
Open an external app or web site showing a satellite view.
void languageChanged()
Emitted when the OS requests a language change.