Enroute Flight Navigation
A navigation app for VFR pilots
PlatformAdaptor_Android.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 <QObject>
24#include <QPointer>
25#include <QTimer>
26#include <QWindow>
27#include <QtGlobal>
28
29#include "platform/PlatformAdaptor_Abstract.h"
30
31namespace Platform {
32
34
35
37{
38 Q_OBJECT
39 QML_ELEMENT
40 QML_SINGLETON
41
42public:
47 explicit PlatformAdaptor(QObject *parent = nullptr);
48
49 // No default constructor, important for QML singleton
50 explicit PlatformAdaptor() = delete;
51
52 // factory function for QML singleton
53 static Platform::PlatformAdaptor* create(QQmlEngine* /*unused*/, QJSEngine* /*unused*/)
54 {
56 }
57
58 ~PlatformAdaptor() override = default;
59
60
61 //
62 // Getter Methods
63 //
64
69 [[nodiscard]] QMarginsF safeInsets() const override { return m_safeInsets; }
70
71
72 //
73 // Methods
74 //
75
80 QString currentSSID() override;
81
83 void disableScreenSaver() override;
84
89 void lockWifi(bool lock) override;
90
95 QVector<Traffic::ConnectionInfo> serialPortConnectionInfos() override;
96
101 QString systemInfo() override;
102
104 void vibrateBrief() override;
105
107 void vibrateLong() override;
108
110 void onGUISetupCompleted() override;
111
112
113protected:
115 void deferredInitialization() override;
116
117private slots:
118 // Poll the safe-area insets of the application window via JNI and update
119 // the property safeInsets. Connected to a number of change signals in
120 // the constructor.
121 void updateSafeInsets();
122
123private:
124 Q_DISABLE_COPY_MOVE(PlatformAdaptor)
125
126 bool splashScreenHidden {false};
127 QMarginsF m_safeInsets;
128 QPointer<QWindow> m_watchedWindow;
129};
130
131} // namespace Platform
static Q_INVOKABLE Platform::PlatformAdaptor * platformAdaptor()
Pointer to appplication-wide static PlatformAdaptor instance.
Interface to platform-specific functionality.
Implementation of PlatformAdaptor for Android devices.
void onGUISetupCompleted() override
Implements a pure virtual method from PlatformAdaptor_Abstract.
void deferredInitialization() override
Re-implements a virtual method from PlatformAdaptor_Abstract.
void vibrateLong() override
Implements a pure virtual method from PlatformAdaptor_Abstract.
PlatformAdaptor(QObject *parent=nullptr)
Standard constructor.
QMarginsF safeInsets() const override
Re-implements a virtual method from PlatformAdaptor_Abstract.
QString systemInfo() override
Information about the system, in HTML format.
QVector< Traffic::ConnectionInfo > serialPortConnectionInfos() override
Re-implements a virtual method from PlatformAdaptor_Abstract.
void disableScreenSaver() override
Implements a pure virtual method from PlatformAdaptor_Abstract.
void lockWifi(bool lock) override
Implements s pure virtual method from PlatformAdaptor_Abstract.
QString currentSSID() override
Implements a pure virtual method from PlatformAdaptor_Abstract.
void vibrateBrief() override
Implements a pure virtual method from PlatformAdaptor_Abstract.