Enroute Flight Navigation
A navigation app for VFR pilots
FileExchange_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 <QQmlEngine>
24
25#include "geomaps/Waypoint.h"
26#include "geomaps/VAC.h"
27#include "GlobalObject.h"
28
29namespace Platform {
30
41
43{
44 Q_OBJECT
45
46public:
48 enum FileFunction : quint8
49 {
50 UnknownFunction, /*< Unknown file */
51 FlightRouteOrWaypointLibrary, /*< File contains a flight route or a waypoint library. */
52 FlightRoute, /*< File contains a flight route. */
53 VectorMap, /*< File contains a vector map. */
54 RasterMap, /*< File contains a raster map. */
55 WaypointLibrary, /*< Waypoint library in CUP or GeoJSON format */
56 OpenAir, /*< Airspace data in openAir format */
57 Image, /*< Image without georeferencing information */
58 TripKit, /*< Trip Kit */
59 ZipFile /*< Zip File */
60 };
61 Q_ENUM(FileFunction)
62
63
64
68 explicit FileExchange_Abstract(QObject* parent = nullptr);
69
70 ~FileExchange_Abstract() override = default;
71
72
73
74 //
75 // Methods
76 //
77
78
85 Q_INVOKABLE virtual void importContent() = 0;
86
108 Q_INVOKABLE virtual QString shareContent(const QByteArray& content, const QString& mimeType, const QString& fileNameSuffix, const QString& fileNameTemplate) = 0;
109
127 Q_INVOKABLE virtual QString viewContent(const QByteArray& content, const QString& mimeType, const QString& fileNameSuffix, const QString& fileNameTemplate) = 0;
128
129public slots:
136 virtual void onGUISetupCompleted() = 0;
137
154 virtual void processFileOpenRequest(const QString& path, const QString& unmingledFilename);
155
162 void processFileOpenRequest(const QByteArray& path);
163
173 void processText(const QString& text);
174
175signals:
187 void openFileRequest(QString fileName, QString info, Platform::FileExchange_Abstract::FileFunction fileFunction);
188
196 void openVACRequest(GeoMaps::VAC vac);
197
205 void openWaypointRequest(GeoMaps::Waypoint waypoint);
206
213 void resolveURL(QString url, QString site);
214
216 void unableToProcessText(QString text);
217
218private:
219 Q_DISABLE_COPY_MOVE(FileExchange_Abstract)
220};
221
222} // namespace Platform
223
224// Declare meta types
225Q_DECLARE_METATYPE(Platform::FileExchange_Abstract)
GlobalObject(QObject *parent=nullptr)
Standard constructor.
void resolveURL(QString url, QString site)
Emitted when Google Maps URL needs to be resolved.
void unableToProcessText(QString text)
Emitted when processText was unable to parse a text item.
virtual Q_INVOKABLE QString shareContent(const QByteArray &content, const QString &mimeType, const QString &fileNameSuffix, const QString &fileNameTemplate)=0
Share content.
virtual void processFileOpenRequest(const QString &path, const QString &unmingledFilename)
Determine file function and emit openFileRequest()
void openVACRequest(GeoMaps::VAC vac)
Emitted when platform asks this app to open a VAC.
void openWaypointRequest(GeoMaps::Waypoint waypoint)
Emitted when platform asks this app to show a waypoint.
FileFunction
Functions and types of a file that this app handles.
void processText(const QString &text)
Process text.
FileExchange_Abstract(QObject *parent=nullptr)
Standard constructor.
virtual Q_INVOKABLE void importContent()=0
Import content from file.
virtual Q_INVOKABLE QString viewContent(const QByteArray &content, const QString &mimeType, const QString &fileNameSuffix, const QString &fileNameTemplate)=0
View content.
virtual void onGUISetupCompleted()=0
GUI setup completed.
void openFileRequest(QString fileName, QString info, Platform::FileExchange_Abstract::FileFunction fileFunction)
Emitted when platform asks this app to open a file.