Enroute Flight Navigation
A navigation app for VFR pilots
FileExchange_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 <QQmlEngine>
24#include "GlobalObject.h"
25#include "geomaps/Waypoint.h"
26
27namespace Platform {
28
39
41{
42 Q_OBJECT
43
44public:
46 enum FileFunction : quint8
47 {
48 UnknownFunction, /*< Unknown file */
49 FlightRouteOrWaypointLibrary, /*< File contains a flight route or a waypoint library. */
50 FlightRoute, /*< File contains a flight route. */
51 VectorMap, /*< File contains a vector map. */
52 RasterMap, /*< File contains a raster map. */
53 WaypointLibrary, /*< Waypoint library in CUP or GeoJSON format */
54 OpenAir, /*< Airspace data in openAir format */
55 VAC, /*< Visual Approach Chart */
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
139 virtual void processFileOpenRequest(const QString& path);
140
147 void processFileOpenRequest(const QByteArray& path);
148
158 void processText(const QString& text);
159
160signals:
172 void openFileRequest(QString fileName, QString info, Platform::FileExchange_Abstract::FileFunction fileFunction);
173
181 void openWaypointRequest(GeoMaps::Waypoint waypoint);
182
189 void resolveURL(QString url, QString site);
190
192 void unableToProcessText(QString text);
193
194private:
195 Q_DISABLE_COPY_MOVE(FileExchange_Abstract)
196};
197
198} // namespace Platform
199
200// Declare meta types
201Q_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.
void openWaypointRequest(GeoMaps::Waypoint waypoint)
Emitted when platform asks this app to show a waypoint.
virtual void processFileOpenRequest(const QString &path)
Determine file function and emit openFileRequest()
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.