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#include "GlobalObject.h"
25#include "geomaps/Waypoint.h"
26#include "geomaps/VAC.h"
27
28namespace Platform {
29
40
42{
43 Q_OBJECT
44
45public:
47 enum FileFunction : quint8
48 {
49 UnknownFunction, /*< Unknown file */
50 FlightRouteOrWaypointLibrary, /*< File contains a flight route or a waypoint library. */
51 FlightRoute, /*< File contains a flight route. */
52 VectorMap, /*< File contains a vector map. */
53 RasterMap, /*< File contains a raster map. */
54 WaypointLibrary, /*< Waypoint library in CUP or GeoJSON format */
55 OpenAir, /*< Airspace data in openAir format */
56 Image, /*< Image without georeferencing information */
57 TripKit, /*< Trip Kit */
58 ZipFile /*< Zip File */
59 };
60 Q_ENUM(FileFunction)
61
62
63
67 explicit FileExchange_Abstract(QObject* parent = nullptr);
68
69 ~FileExchange_Abstract() override = default;
70
71
72
73 //
74 // Methods
75 //
76
77
84 Q_INVOKABLE virtual void importContent() = 0;
85
104 Q_INVOKABLE virtual QString shareContent(const QByteArray& content, const QString& mimeType, const QString& fileNameTemplate) = 0;
105
120 Q_INVOKABLE virtual QString viewContent(const QByteArray& content, const QString& mimeType, const QString& fileNameTemplate) = 0;
121
122public slots:
129 virtual void onGUISetupCompleted() = 0;
130
147 virtual void processFileOpenRequest(const QString& path, const QString& unmingledFilename);
148
155 void processFileOpenRequest(const QByteArray& path);
156
166 void processText(const QString& text);
167
168signals:
180 void openFileRequest(QString fileName, QString info, Platform::FileExchange_Abstract::FileFunction fileFunction);
181
189 void openVACRequest(GeoMaps::VAC vac);
190
198 void openWaypointRequest(GeoMaps::Waypoint waypoint);
199
206 void resolveURL(QString url, QString site);
207
209 void unableToProcessText(QString text);
210
211private:
212 Q_DISABLE_COPY_MOVE(FileExchange_Abstract)
213};
214
215} // namespace Platform
216
217// Declare meta types
218Q_DECLARE_METATYPE(Platform::FileExchange_Abstract)
GlobalObject(QObject *parent=nullptr)
Standard constructor.
virtual Q_INVOKABLE QString viewContent(const QByteArray &content, const QString &mimeType, const QString &fileNameTemplate)=0
View content.
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 &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 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.