Enroute Flight Navigation
A navigation app for VFR pilots
PlatformAdaptor_Abstract.h
1/***************************************************************************
2 * Copyright (C) 2019-2024 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 <QQmlEngine>
25#include <QQuickItem>
26
27#include "GlobalObject.h"
28
29
30namespace Platform {
31
51
53{
54 Q_OBJECT
55
56public:
61 explicit PlatformAdaptor_Abstract(QObject* parent = nullptr);
62
63 // No default constructor, important for QML singleton
64 explicit PlatformAdaptor_Abstract() = delete;
65
66 ~PlatformAdaptor_Abstract() override = default;
67
68 // factory function for QML singleton
69 static Platform::PlatformAdaptor_Abstract* create(QQmlEngine* /*unused*/, QJSEngine* /*unused*/)
70 {
72 }
73
74
75 //
76 // Methods
77 //
78
83 Q_INVOKABLE static QString clipboardText();
84
91 Q_INVOKABLE virtual QString currentSSID() { return {}; }
92
100 Q_INVOKABLE virtual void disableScreenSaver() {}
101
114 Q_INVOKABLE virtual void lockWifi(bool lock) { Q_UNUSED(lock) }
115
125 Q_INVOKABLE virtual void openSatView(const QGeoCoordinate& coordinate);
126
140 Q_INVOKABLE virtual void setupInputMethodEventFilter(QQuickItem* item) { Q_UNUSED(item) }
141
146 Q_INVOKABLE virtual QString systemInfo();
147
153 Q_INVOKABLE virtual void vibrateBrief() {}
154
161 Q_INVOKABLE virtual void vibrateLong() {}
162
168 Q_INVOKABLE virtual QString language();
169
178 Q_INVOKABLE static void saveScreenshot(const QImage& image, const QString& path);
179
180public slots:
189 virtual void onGUISetupCompleted() {}
190
191
192signals:
200 void error(const QString& message);
201
208
214
215private:
216 Q_DISABLE_COPY_MOVE(PlatformAdaptor_Abstract)
217
218};
219
220} // namespace Platform
GlobalObject(QObject *parent=nullptr)
Standard constructor.
static Q_INVOKABLE Platform::PlatformAdaptor_Abstract * platformAdaptor()
Pointer to appplication-wide static PlatformAdaptor instance.
Interface to platform-specific functionality.
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 void onGUISetupCompleted()
Signal handler: GUI setup completed.
virtual Q_INVOKABLE void disableScreenSaver()
Disable the screen saver.
void wifiConnected()
Emitted when a new WiFi connections becomes available.
void error(const QString &message)
Emitted when an error occurs.
virtual Q_INVOKABLE void setupInputMethodEventFilter(QQuickItem *item)
Workaround for QTBUG-80790.
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.
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.