From c57d71a46ca6d113b8af8ecd9e07628c6fe237cd Mon Sep 17 00:00:00 2001 From: Stefan Kebekus Date: Sat, 18 Apr 2020 21:11:01 +0200 Subject: [PATCH] Source code modernization --- CMakeLists.txt | 9 +++++-- buildscript-android-release.sh | 3 +-- src/Aircraft.h | 25 ++++---------------- src/Airspace.h | 19 +++------------ src/AviationUnits.h | 7 ++---- src/Downloadable.h | 19 +++------------ src/DownloadableGroup.h | 21 ++++------------ src/DownloadableGroupWatcher.h | 19 +++------------ src/FlightRoute.h | 19 +++------------ src/FlightRoute_Leg.h | 19 +++------------ src/GeoMapProvider.h | 21 ++++------------ src/Geoid.h | 5 +--- src/GlobalSettings.h | 16 +++---------- src/MapManager.h | 19 +++------------ src/MobileAdaptor.h | 18 +++++++------- src/SatNav.h | 17 +++---------- src/ScaleQuickItem.h | 16 ++++++------- src/Share.h | 7 +++--- src/TileHandler.h | 19 +++------------ src/TileServer.h | 20 +++------------- src/Waypoint.h | 21 ++++------------ src/Wind.h | 21 ++++------------ src/qml/dialogs/AltitudeCorrectionDialog.qml | 10 ++++---- src/qml/dialogs/ErrorDialog.qml | 6 ++--- src/qml/dialogs/FirstRunDialog.qml | 6 ++--- src/qml/dialogs/LongTextDialog.qml | 6 ++--- src/qml/dialogs/SatNavStatusDialog.qml | 10 ++++---- src/qml/dialogs/UpdateMapDialog.qml | 6 ++--- src/qml/dialogs/WaypointDescription.qml | 10 ++++---- src/qml/items/AutoSizingMenu.qml | 6 ++--- src/qml/items/FlightMap.qml | 6 ++--- src/qml/items/MFM.qml | 9 +++---- src/qml/items/NavBar.qml | 8 +++---- src/qml/main.qml | 12 +++++----- src/qml/pages/BugReportPage.qml | 6 ++--- src/qml/pages/FlightRouteAddWPPage.qml | 8 +++---- src/qml/pages/FlightRoutePage.qml | 8 +++---- src/qml/pages/InfoPage.qml | 10 ++++---- src/qml/pages/MapManager.qml | 8 +++---- src/qml/pages/MapPage.qml | 10 ++++---- src/qml/pages/NearbyAirfields.qml | 10 ++++---- src/qml/pages/ParticipatePage.qml | 8 +++---- src/qml/pages/SettingsPage.qml | 8 +++---- 43 files changed, 167 insertions(+), 364 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80e6b20f3..d2c77da68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.13) include(ExternalProject) -include(GNUInstallDirs) option(BUILD_DOC "Build documentation" OFF) @@ -19,6 +18,12 @@ math(EXPR PROJECT_VERSION_CODE 10000*${PROJECT_VERSION_MAJOR}+100*${PROJECT_VERS add_compile_definitions(PROJECT_VERSION="${PROJECT_VERSION}") +# +# Installation +# + +include(GNUInstallDirs) + # # Qt Setup # @@ -36,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # find_package(Doxygen) -find_package(Qt5 5.12 COMPONENTS Concurrent Core Gui Positioning Quick QuickWidgets Sql Svg REQUIRED) +find_package(Qt5 5.14 COMPONENTS Concurrent Core Gui Positioning Quick QuickWidgets Sql Svg REQUIRED) if( ANDROID ) find_package(Qt5 5.14 COMPONENTS AndroidExtras REQUIRED) endif() diff --git a/buildscript-android-release.sh b/buildscript-android-release.sh index f9b77933d..61850737f 100755 --- a/buildscript-android-release.sh +++ b/buildscript-android-release.sh @@ -59,8 +59,7 @@ cmake /home/kebekus/Software/projects/enroute \ -DCMAKE_C_COMPILER:STRING=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/clang \ -DCMAKE_FIND_ROOT_PATH:STRING=$Qt5_DIR_ANDROID \ -DCMAKE_PREFIX_PATH:STRING=$Qt5_DIR_ANDROID \ - -DCMAKE_TOOLCHAIN_FILE:PATH=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \ - -DQT_QMAKE_EXECUTABLE:STRING=$Qt5_DIR_ANDROID/bin/qmake + -DCMAKE_TOOLCHAIN_FILE:PATH=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake # This is bizarrely necessary, or else 'android_deployment_settings.json' # will lack our custom AndroidManifest and the SSL libraries diff --git a/src/Aircraft.h b/src/Aircraft.h index abb159efc..d87861b31 100644 --- a/src/Aircraft.h +++ b/src/Aircraft.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef AIRCRAFT_H -#define AIRCRAFT_H +#pragma once #include @@ -40,18 +39,6 @@ class Aircraft : public QObject { */ explicit Aircraft(QObject *parent = nullptr); - // No copy constructor - Aircraft(Aircraft const &) = delete; - - // No assign operator - Aircraft &operator=(Aircraft const &) = delete; - - // No move constructor - Aircraft(Aircraft &&) = delete; - - // No move assignment operator - Aircraft &operator=(Aircraft &&) = delete; - // Standard destructor ~Aircraft() override = default; @@ -86,8 +73,7 @@ class Aircraft : public QObject { * number that lies in the interval [minAircraftSpeed, maxAircraftSpeed] * or NaN if the cruise speed has not been set. */ - Q_PROPERTY( - double descentSpeedInKT READ descentSpeedInKT WRITE setDescentSpeedInKT NOTIFY valChanged) + Q_PROPERTY(double descentSpeedInKT READ descentSpeedInKT WRITE setDescentSpeedInKT NOTIFY valChanged) /*! \brief Getter function for property of the same name * @@ -111,8 +97,7 @@ class Aircraft : public QObject { * number that lies in the interval [minFuelConsumption, * maxFuelConsumption] or NaN if no value has been set. */ - Q_PROPERTY(double fuelConsumptionInLPH READ fuelConsumptionInLPH WRITE setFuelConsumptionInLPH - NOTIFY valChanged) + Q_PROPERTY(double fuelConsumptionInLPH READ fuelConsumptionInLPH WRITE setFuelConsumptionInLPH NOTIFY valChanged) /*! \brief Getter function for property of the same name * @@ -147,6 +132,8 @@ class Aircraft : public QObject { void valChanged(); private: + Q_DISABLE_COPY_MOVE(Aircraft) + static constexpr double minAircraftSpeed = 40.0; static constexpr double maxAircraftSpeed = 400.0; static constexpr double minFuelConsuption = 5.0; @@ -158,5 +145,3 @@ class Aircraft : public QObject { QSettings settings; }; - -#endif diff --git a/src/Airspace.h b/src/Airspace.h index 3de86baa5..0d5aa3e44 100644 --- a/src/Airspace.h +++ b/src/Airspace.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef AIRSPACE_H -#define AIRSPACE_H +#pragma once #include #include @@ -48,18 +47,6 @@ class Airspace : public QObject { */ explicit Airspace(const QJsonObject &geoJSONObject, QObject *parent = nullptr); - // No copy constructor - Airspace(Airspace const &) = delete; - - // No assign operator - Airspace &operator=(Airspace const &) = delete; - - // No move constructor - Airspace(Airspace &&) = delete; - - // No move assignment operator - Airspace &operator=(Airspace &&) = delete; - // Standard destructor ~Airspace() override = default; @@ -157,11 +144,11 @@ class Airspace : public QObject { QString upperBound() const { return _upperBound; } private: + Q_DISABLE_COPY_MOVE(Airspace) + QString _name{}; QString _CAT{}; QString _upperBound{}; QString _lowerBound{}; QGeoPolygon _polygon{}; }; - -#endif diff --git a/src/AviationUnits.h b/src/AviationUnits.h index 0028efdba..2f9d4a594 100644 --- a/src/AviationUnits.h +++ b/src/AviationUnits.h @@ -18,13 +18,12 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#pragma once + #include #include #include -#ifndef AVIATIONUNITS_H -#define AVIATIONUNITS_H - /*! \brief Conversion between units used in aviation * * This class contains a few static methods that help with the conversion of @@ -412,5 +411,3 @@ class AviationUnits { return {}; return AviationUnits::Time::fromS(dist.toM() / speed.toMPS()); } - -#endif diff --git a/src/Downloadable.h b/src/Downloadable.h index 3008ef885..83ef94302 100644 --- a/src/Downloadable.h +++ b/src/Downloadable.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef DOWNLOADABLE_H -#define DOWNLOADABLE_H +#pragma once #include #include @@ -76,18 +75,6 @@ class Downloadable : public QObject { explicit Downloadable(QUrl url, const QString &localFileName, QNetworkAccessManager *networkAccessManager, QObject *parent = nullptr); - // No copy constructor - Downloadable(Downloadable const &) = delete; - - // No assign operator - Downloadable &operator=(Downloadable const &) = delete; - - // No move constructor - Downloadable(Downloadable &&) = delete; - - // No move assignment operator - Downloadable &operator=(Downloadable &&) = delete; - /*! \brief Standard destructor * * This destructor will stop all running downloads and delete all temporary @@ -443,6 +430,8 @@ private slots: void downloadHeaderFinished(); private: + Q_DISABLE_COPY_MOVE(Downloadable) + // Pointer the QNetworkAccessManager that will be used for all the // downloading QPointer _networkAccessManager; @@ -479,5 +468,3 @@ private slots: // Section name QString _section {}; }; - -#endif // DOWNLOADABLE_H diff --git a/src/DownloadableGroup.h b/src/DownloadableGroup.h index 52f5e2d1d..aeb57e30e 100644 --- a/src/DownloadableGroup.h +++ b/src/DownloadableGroup.h @@ -18,9 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef DOWNLOADABLEGROUP_H -#define DOWNLOADABLEGROUP_H - +#pragma once #include "DownloadableGroupWatcher.h" @@ -43,18 +41,6 @@ class DownloadableGroup : public DownloadableGroupWatcher */ explicit DownloadableGroup(QObject *parent=nullptr); - // No copy constructor - DownloadableGroup(DownloadableGroup const&) = delete; - - // No assign operator - DownloadableGroup& operator =(DownloadableGroup const&) = delete; - - // No move constructor - DownloadableGroup(DownloadableGroup&&) = delete; - - // No move assignment operator - DownloadableGroup& operator=(DownloadableGroup&&) = delete; - /*! \brief Adds a Downloadable to the group This method adds a Downloadable object to the group. @@ -75,6 +61,7 @@ class DownloadableGroup : public DownloadableGroupWatcher @param downloadable Pointer to the Downloadable to be removed. */ void removeFromGroup(Downloadable *downloadable); -}; -#endif // DOWNLOADABLEGROUP_H +private: + Q_DISABLE_COPY_MOVE(DownloadableGroup) +}; diff --git a/src/DownloadableGroupWatcher.h b/src/DownloadableGroupWatcher.h index 519768ff6..9e77c77c5 100644 --- a/src/DownloadableGroupWatcher.h +++ b/src/DownloadableGroupWatcher.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef DownloadableGroupWatcher_H -#define DownloadableGroupWatcher_H +#pragma once #include @@ -37,18 +36,6 @@ class DownloadableGroupWatcher : public QObject Q_OBJECT public: - // No copy constructor - DownloadableGroupWatcher(DownloadableGroupWatcher const&) = delete; - - // No assign operator - DownloadableGroupWatcher& operator =(DownloadableGroupWatcher const&) = delete; - - // No move constructor - DownloadableGroupWatcher(DownloadableGroupWatcher&&) = delete; - - // No move assignment operator - DownloadableGroupWatcher& operator=(DownloadableGroupWatcher&&) = delete; - /*! \brief List of Downloadables in this group This property holds the list of Downloadable objects in the group. The @@ -209,6 +196,8 @@ protected slots: QList> _downloadables; private: + Q_DISABLE_COPY_MOVE(DownloadableGroupWatcher) + // Provisions to provide the signal localFileContentChanged_delayed void emitLocalFileContentChanged_delayed(); QTimer emitLocalFileContentChanged_delayedTimer; @@ -220,5 +209,3 @@ protected slots: bool _cachedUpdatable {false}; // Cached value for the 'updatable' property QString _cachedUpdateSize {}; // Cached value for the 'updateSize' property }; - -#endif // DownloadableGroupWatcher_H diff --git a/src/FlightRoute.h b/src/FlightRoute.h index 4e87809e3..a2a63cb04 100644 --- a/src/FlightRoute.h +++ b/src/FlightRoute.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef FLIGHTROUTE_H -#define FLIGHTROUTE_H +#pragma once #include #include @@ -64,18 +63,6 @@ class FlightRoute : public QObject */ explicit FlightRoute(Aircraft *aircraft, Wind *wind, QObject *parent = nullptr); - // No copy constructor - FlightRoute(FlightRoute const&) = delete; - - // No assign operator - FlightRoute& operator =(FlightRoute const&) = delete; - - // No move constructor - FlightRoute(FlightRoute&&) = delete; - - // No move assignment operator - FlightRoute& operator=(FlightRoute&&) = delete; - // Standard destructor ~FlightRoute() override = default; @@ -236,6 +223,8 @@ private slots: void updateLegs(); private: + Q_DISABLE_COPY_MOVE(FlightRoute) + // Used to check compatibility when loading/saving static const quint16 streamVersion = 1; @@ -250,5 +239,3 @@ private slots: }; #include "FlightRoute_Leg.h" - -#endif diff --git a/src/FlightRoute_Leg.h b/src/FlightRoute_Leg.h index f822c5a5c..19919c499 100644 --- a/src/FlightRoute_Leg.h +++ b/src/FlightRoute_Leg.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef FLIGHTROUTE_LEG_H -#define FLIGHTROUTE_LEG_H +#pragma once #include @@ -54,18 +53,6 @@ class FlightRoute::Leg : public QObject */ explicit Leg(const Waypoint* start, const Waypoint *end, Aircraft *aircraft, Wind *wind, QObject *parent = nullptr); - // No copy constructor - Leg(Leg const&) = delete; - - // No assign operator - Leg& operator =(Leg const&) = delete; - - // No move constructor - Leg(Leg&&) = delete; - - // No move assignment operator - Leg& operator=(Leg&&) = delete; - // Standard destructor ~Leg() override = default; @@ -169,6 +156,8 @@ class FlightRoute::Leg : public QObject void valChanged(); private: + Q_DISABLE_COPY_MOVE(Leg) + // Necessary data for computation of wind triangle? bool hasDataForWindTriangle() const; @@ -180,5 +169,3 @@ class FlightRoute::Leg : public QObject QPointer _aircraft {nullptr}; QPointer _wind {nullptr}; }; - -#endif diff --git a/src/GeoMapProvider.h b/src/GeoMapProvider.h index 9de87944d..ee49d8819 100644 --- a/src/GeoMapProvider.h +++ b/src/GeoMapProvider.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef GEOMAPPROVIDER_H -#define GEOMAPPROVIDER_H +#pragma once #include #include @@ -72,18 +71,6 @@ class GeoMapProvider : public QObject */ explicit GeoMapProvider(MapManager *manager, GlobalSettings* settings, QObject *parent = nullptr); - // No copy constructor - GeoMapProvider(GeoMapProvider const&) = delete; - - // No assign operator - GeoMapProvider& operator =(GeoMapProvider const&) = delete; - - // No move constructor - GeoMapProvider(GeoMapProvider&&) = delete; - - // No move assignment operator - GeoMapProvider& operator=(GeoMapProvider&&) = delete; - // Standard destructor ~GeoMapProvider() override = default; @@ -182,6 +169,8 @@ class GeoMapProvider : public QObject void styleFileURLChanged(); private: + Q_DISABLE_COPY_MOVE(GeoMapProvider) + // This method simplifies strings by replacing all special characters with // analogues. So, "Neuchâtel" become "Neuchatel", "Épinal" becomes "Epinal" // and "Allgäu" becomes "Allgau" @@ -235,5 +224,3 @@ class GeoMapProvider : public QObject QList> _airspaces_; // Cache: Airspaces }; - -#endif diff --git a/src/Geoid.h b/src/Geoid.h index 0930ade38..010c8d67d 100644 --- a/src/Geoid.h +++ b/src/Geoid.h @@ -17,8 +17,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef GEOID_H -#define GEOID_H +#pragma once #include @@ -78,5 +77,3 @@ class Geoid const static qint32 egm96_cols = 1440; const static qint32 egm96_size = egm96_rows * egm96_cols; }; - -#endif // GEOID_H diff --git a/src/GlobalSettings.h b/src/GlobalSettings.h index 5fefaa2ba..192f0e3d3 100644 --- a/src/GlobalSettings.h +++ b/src/GlobalSettings.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef GlobalSettings_H -#define GlobalSettings_H +#pragma once #include #include @@ -39,16 +38,7 @@ class GlobalSettings : public QObject { Q_OBJECT -private: - Q_DISABLE_COPY(GlobalSettings) - public: - // Delete the move constructor - GlobalSettings& operator=(GlobalSettings&&) = delete; - - // Delete the copy assignment constructor - GlobalSettings(GlobalSettings&&) = delete; - /*! \brief Standard constructor * * @param parent The standard QObject parent pointer @@ -132,7 +122,7 @@ class GlobalSettings : public QObject void keepScreenOnChanged(); private: + Q_DISABLE_COPY_MOVE(GlobalSettings) + QSettings *settings; }; - -#endif // satNav_H diff --git a/src/MapManager.h b/src/MapManager.h index f40f1b140..f782f1c31 100644 --- a/src/MapManager.h +++ b/src/MapManager.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef MAPMANAGER_H -#define MAPMANAGER_H +#pragma once #include @@ -66,18 +65,6 @@ class MapManager : public QObject @param parent The standard QObject parent pointer. */ explicit MapManager(QNetworkAccessManager *networkAccessManager, QObject *parent=nullptr); - - // No copy constructor - MapManager(MapManager const&) = delete; - - // No assign operator - MapManager& operator =(MapManager const&) = delete; - - // No move constructor - MapManager(MapManager&&) = delete; - - // No move assignment operator - MapManager& operator=(MapManager&&) = delete; /*! \brief Destructor @@ -199,6 +186,8 @@ private slots: void autoUpdateGeoMapList(); private: + Q_DISABLE_COPY_MOVE(MapManager) + // This method returns a list of files in the download directory that have no // corresponding entry in _aviationMaps. QList unattachedFiles() const; @@ -221,5 +210,3 @@ private slots: // objects constructed by this class QPointer _networkAccessManager; }; - -#endif // MAPMANAGER_H diff --git a/src/MobileAdaptor.h b/src/MobileAdaptor.h index c20618604..29881e5cc 100644 --- a/src/MobileAdaptor.h +++ b/src/MobileAdaptor.h @@ -19,8 +19,7 @@ ***************************************************************************/ -#ifndef MOBILEADAPTOR_H -#define MOBILEADAPTOR_H +#pragma once #include @@ -46,14 +45,14 @@ public slots: On Android, hides the android splash screen. On other platforms, this does nothing. The implementation ensures that QtAndroid::hideSplashScreen is called (only once, regardless of how often this slot is used). - */ + */ void hideSplashScreen(); /*! \brief Make the device briefly vibrate On Android, make the device briefly vibrate. On other platforms, this does nothing. - */ + */ void vibrateBrief(); /*! \brief On Android, disables the screen lock @@ -62,17 +61,18 @@ public slots: @param on If set to 'true', the screen will never switch off while the app is shown to the user. - */ + */ void keepScreenOn(bool on); /*! \brief Shows a notifaction, indicating that a download is in progress - @param show If set to 'true', a notification will be shown. If set to 'false', any existing notification will be withdrawn - */ + @param show If set to 'true', a notification will be shown. If set to + 'false', any existing notification will be withdrawn + */ void showDownloadNotification(bool show); private: + Q_DISABLE_COPY_MOVE(MobileAdaptor) + bool splashScreenHidden {false}; }; - -#endif // ANDROIDADAPTOR_H diff --git a/src/SatNav.h b/src/SatNav.h index 821fc65ac..364cb131c 100644 --- a/src/SatNav.h +++ b/src/SatNav.h @@ -18,9 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ - -#ifndef SatNav_H -#define SatNav_H +#pragma once #include #include @@ -59,16 +57,7 @@ class SatNav : public QObject { Q_OBJECT -private: - Q_DISABLE_COPY(SatNav) - public: - // Delete the move constructor - SatNav& operator=(SatNav&&) = delete; - - // Delete the copy assignment constructor - SatNav(SatNav&&) = delete; - /*! \brief Standard constructor @param parent The standard QObject parent pointer @@ -504,6 +493,8 @@ private slots: void timeout(); private: + Q_DISABLE_COPY_MOVE(SatNav) + // Aircraft is considered flying is speed is at least this high static constexpr double minFlightSpeedInKT = 30.0; // Coordinates of EDTF airfield @@ -537,5 +528,3 @@ private slots: // to call timeout() after timeoutThreshold milliseconds of no data. QTimer timeoutCounter; }; - -#endif // satNav_H diff --git a/src/ScaleQuickItem.h b/src/ScaleQuickItem.h index 10920bf22..4e4ee113b 100644 --- a/src/ScaleQuickItem.h +++ b/src/ScaleQuickItem.h @@ -18,9 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ - -#ifndef SCALEQUICKITEM_H -#define SCALEQUICKITEM_H +#pragma once #include @@ -52,17 +50,17 @@ class ScaleQuickItem : public QQuickPaintedItem /*! \brief Getter function for the property with the same name @returns Property pixelPer10km - */ + */ qreal pixelPer10km() const {return _pixelPer10km;} /*! \brief Setter function for the property with the same name - + @param _pxp10k Property pixelPer10km */ void setPixelPer10km(qreal _pxp10k); - + /*! \brief Re-implemented from QQuickPaintedItem to implement painting - + @param painter Pointer to the QPainter used for painting */ void paint(QPainter *painter) override; @@ -72,7 +70,7 @@ class ScaleQuickItem : public QQuickPaintedItem void pixelPer10kmChanged(); private: + Q_DISABLE_COPY_MOVE(ScaleQuickItem) + qreal _pixelPer10km {0.0}; }; - -#endif // SCALE_H diff --git a/src/Share.h b/src/Share.h index ac72429fa..5d8683c3c 100644 --- a/src/Share.h +++ b/src/Share.h @@ -17,8 +17,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef SHARE_H -#define SHARE_H +#pragma once #include @@ -165,6 +164,8 @@ class Share : public QObject void fileReceived(const QString& fname); private: + Q_DISABLE_COPY_MOVE(Share) + static Share* mInstance; QString mSavePath; @@ -173,5 +174,3 @@ class Share : public QObject QString tempDir(); void outgoingIntent(const QString& methodName, const QString& filePath, const QString& mimeType); }; - -#endif // SHARE_H diff --git a/src/TileHandler.h b/src/TileHandler.h index 896005f5a..8ffecd407 100644 --- a/src/TileHandler.h +++ b/src/TileHandler.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef TILEHANDLER_H -#define TILEHANDLER_H +#pragma once #include #include @@ -66,18 +65,6 @@ class TileHandler : public QHttpEngine::Handler */ explicit TileHandler(const QList>& mbtileFiles, const QString& baseURLName, QObject *parent = nullptr); - // No copy constructor - TileHandler(TileHandler const&) = delete; - - // No assign operator - TileHandler& operator =(TileHandler const&) = delete; - - // No move constructor - TileHandler(TileHandler&&) = delete; - - // No move assignment operator - TileHandler& operator=(TileHandler&&) = delete; - // Destructor ~TileHandler() override; @@ -200,6 +187,8 @@ private slots: void removeFile(const QString& localFileName); private: + Q_DISABLE_COPY_MOVE(TileHandler) + QSet databaseConnections; QString _name; @@ -216,5 +205,3 @@ private slots: bool hasDBError {false}; }; - -#endif // TILEHANDLER diff --git a/src/TileServer.h b/src/TileServer.h index 765927ca0..1af422261 100644 --- a/src/TileServer.h +++ b/src/TileServer.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef TILESERVER_H -#define TILESERVER_H +#pragma once #include #include @@ -71,18 +70,6 @@ class TileServer : public QHttpEngine::Server */ explicit TileServer(QUrl baseUrl=QUrl(), QObject *parent = nullptr); - // No copy constructor - TileServer(TileServer const&) = delete; - - // No assign operator - TileServer& operator =(TileServer const&) = delete; - - // No move constructor - TileServer(TileServer&&) = delete; - - // No move assignment operator - TileServer& operator=(TileServer&&) = delete; - // Standard destructor ~TileServer() override = default; @@ -126,6 +113,8 @@ public slots: void removeMbtilesFileSet(const QString& path); private: + Q_DISABLE_COPY_MOVE(TileServer) + void setUpTileHandlers(); QPointer currentFileSystemHandler; @@ -134,6 +123,3 @@ public slots: QUrl _baseUrl; }; - - -#endif diff --git a/src/Waypoint.h b/src/Waypoint.h index 21e6288f6..4f0afa66b 100644 --- a/src/Waypoint.h +++ b/src/Waypoint.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef WAYPOINT_H -#define WAYPOINT_H +#pragma once #include #include @@ -87,19 +86,7 @@ class Waypoint : public QObject @param parent The standard QObject parent pointer */ explicit Waypoint(QDataStream &stream, QObject *parent = nullptr); - - // No copy constructor - Waypoint(Waypoint const&) = delete; - - // No assign operator - Waypoint& operator =(Waypoint const&) = delete; - - // No move constructor - Waypoint(Waypoint&&) = delete; - - // No move assignment operator - Waypoint& operator=(Waypoint&&) = delete; - + // Standard destructor ~Waypoint() = default; @@ -185,11 +172,11 @@ class Waypoint : public QObject Q_INVOKABLE QString wayFrom(const QGeoCoordinate& position) const; private: + Q_DISABLE_COPY_MOVE(Waypoint) + // Used to check compatibility when loading/saving static const quint16 streamVersion = 5; QGeoCoordinate _coordinate; QMultiMap _properties; }; - -#endif diff --git a/src/Wind.h b/src/Wind.h index 8b55c9f31..032c1abd3 100644 --- a/src/Wind.h +++ b/src/Wind.h @@ -18,8 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef WIND_H -#define WIND_H +#pragma once #include @@ -40,19 +39,7 @@ class Wind : public QObject @param parent The standard QObject parent pointer */ explicit Wind(QObject *parent = nullptr); - - // No copy constructor - Wind(Wind const&) = delete; - - // No assign operator - Wind& operator =(Wind const&) = delete; - - // No move constructor - Wind(Wind&&) = delete; - - // No move assignment operator - Wind& operator=(Wind&&) = delete; - + // Standard destructor ~Wind() override = default; @@ -121,6 +108,8 @@ class Wind : public QObject void valChanged(); private: + Q_DISABLE_COPY_MOVE(Wind) + static constexpr double minWindSpeed = 0.0; static constexpr double maxWindSpeed = 100.0; static constexpr double minWindDirection = 0.0; @@ -131,5 +120,3 @@ class Wind : public QObject QSettings settings; }; - -#endif diff --git a/src/qml/dialogs/AltitudeCorrectionDialog.qml b/src/qml/dialogs/AltitudeCorrectionDialog.qml index e9250a1f7..ef246914a 100644 --- a/src/qml/dialogs/AltitudeCorrectionDialog.qml +++ b/src/qml/dialogs/AltitudeCorrectionDialog.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 import enroute 1.0 diff --git a/src/qml/dialogs/ErrorDialog.qml b/src/qml/dialogs/ErrorDialog.qml index 31b633730..394026691 100644 --- a/src/qml/dialogs/ErrorDialog.qml +++ b/src/qml/dialogs/ErrorDialog.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 Dialog { id: dlg diff --git a/src/qml/dialogs/FirstRunDialog.qml b/src/qml/dialogs/FirstRunDialog.qml index 5b9b4aaa2..c68fc9342 100644 --- a/src/qml/dialogs/FirstRunDialog.qml +++ b/src/qml/dialogs/FirstRunDialog.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 LongTextDialog { id: frRld diff --git a/src/qml/dialogs/LongTextDialog.qml b/src/qml/dialogs/LongTextDialog.qml index f7f158039..4401e32b1 100644 --- a/src/qml/dialogs/LongTextDialog.qml +++ b/src/qml/dialogs/LongTextDialog.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 Dialog { id: dlg diff --git a/src/qml/dialogs/SatNavStatusDialog.qml b/src/qml/dialogs/SatNavStatusDialog.qml index 67f38bd87..04580d131 100644 --- a/src/qml/dialogs/SatNavStatusDialog.qml +++ b/src/qml/dialogs/SatNavStatusDialog.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 import enroute 1.0 diff --git a/src/qml/dialogs/UpdateMapDialog.qml b/src/qml/dialogs/UpdateMapDialog.qml index 264b05f33..0d57d8232 100644 --- a/src/qml/dialogs/UpdateMapDialog.qml +++ b/src/qml/dialogs/UpdateMapDialog.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 LongTextDialog { id: mud diff --git a/src/qml/dialogs/WaypointDescription.qml b/src/qml/dialogs/WaypointDescription.qml index cb5eac189..399c16382 100644 --- a/src/qml/dialogs/WaypointDescription.qml +++ b/src/qml/dialogs/WaypointDescription.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 -import QtQuick.Shapes 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Layouts 1.14 +import QtQuick.Shapes 1.14 import enroute 1.0 diff --git a/src/qml/items/AutoSizingMenu.qml b/src/qml/items/AutoSizingMenu.qml index 20f6a2e9e..f547e356c 100644 --- a/src/qml/items/AutoSizingMenu.qml +++ b/src/qml/items/AutoSizingMenu.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 Menu { width: { diff --git a/src/qml/items/FlightMap.qml b/src/qml/items/FlightMap.qml index cbbed1ed7..72c35d04a 100644 --- a/src/qml/items/FlightMap.qml +++ b/src/qml/items/FlightMap.qml @@ -18,9 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtLocation 5.12 -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtLocation 5.14 +import QtQuick 2.14 +import QtQuick.Controls 2.14 import enroute 1.0 diff --git a/src/qml/items/MFM.qml b/src/qml/items/MFM.qml index 5f13bb549..f21a499d9 100644 --- a/src/qml/items/MFM.qml +++ b/src/qml/items/MFM.qml @@ -18,10 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtLocation 5.12 -import QtPositioning 5.12 -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtLocation 5.14 +import QtPositioning 5.14 +import QtQml 2.14 +import QtQuick 2.14 +import QtQuick.Controls 2.14 import enroute 1.0 diff --git a/src/qml/items/NavBar.qml b/src/qml/items/NavBar.qml index 5cc2d57f9..274d4b62c 100644 --- a/src/qml/items/NavBar.qml +++ b/src/qml/items/NavBar.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,9 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 Rectangle { id: grid diff --git a/src/qml/main.qml b/src/qml/main.qml index 4250d9fad..7c612ba2d 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,11 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 -import QtSensors 5.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 +import QtSensors 5.14 import enroute 1.0 diff --git a/src/qml/pages/BugReportPage.qml b/src/qml/pages/BugReportPage.qml index 7bb8d5bd4..526578843 100644 --- a/src/qml/pages/BugReportPage.qml +++ b/src/qml/pages/BugReportPage.qml @@ -18,9 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Layouts 1.14 Page { id: pg diff --git a/src/qml/pages/FlightRouteAddWPPage.qml b/src/qml/pages/FlightRouteAddWPPage.qml index e105929d0..600f3eda0 100644 --- a/src/qml/pages/FlightRouteAddWPPage.qml +++ b/src/qml/pages/FlightRouteAddWPPage.qml @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 Page { id: page diff --git a/src/qml/pages/FlightRoutePage.qml b/src/qml/pages/FlightRoutePage.qml index 0d831923c..9e0c0b31c 100644 --- a/src/qml/pages/FlightRoutePage.qml +++ b/src/qml/pages/FlightRoutePage.qml @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 import enroute 1.0 diff --git a/src/qml/pages/InfoPage.qml b/src/qml/pages/InfoPage.qml index d98b423d7..81e42938d 100644 --- a/src/qml/pages/InfoPage.qml +++ b/src/qml/pages/InfoPage.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 Page { id: pg diff --git a/src/qml/pages/MapManager.qml b/src/qml/pages/MapManager.qml index 75574afd2..34b09462f 100644 --- a/src/qml/pages/MapManager.qml +++ b/src/qml/pages/MapManager.qml @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 import "../items" diff --git a/src/qml/pages/MapPage.qml b/src/qml/pages/MapPage.qml index 6cd71343c..a322bc434 100644 --- a/src/qml/pages/MapPage.qml +++ b/src/qml/pages/MapPage.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtLocation 5.12 -import QtPositioning 5.12 -import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtLocation 5.14 +import QtPositioning 5.14 +import QtQuick 2.14 +import QtQuick.Controls 2.14 import enroute 1.0 diff --git a/src/qml/pages/NearbyAirfields.qml b/src/qml/pages/NearbyAirfields.qml index feecbb3e2..37ee31dc5 100644 --- a/src/qml/pages/NearbyAirfields.qml +++ b/src/qml/pages/NearbyAirfields.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 import enroute 1.0 diff --git a/src/qml/pages/ParticipatePage.qml b/src/qml/pages/ParticipatePage.qml index 77dcc67f9..b89a1b132 100644 --- a/src/qml/pages/ParticipatePage.qml +++ b/src/qml/pages/ParticipatePage.qml @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Stefan Kebekus * + * Copyright (C) 2019-2020 by Stefan Kebekus * * stefan.kebekus@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -18,9 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Layouts 1.14 Page { id: pg diff --git a/src/qml/pages/SettingsPage.qml b/src/qml/pages/SettingsPage.qml index a30ea929b..a2e61f5de 100644 --- a/src/qml/pages/SettingsPage.qml +++ b/src/qml/pages/SettingsPage.qml @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Controls.Material 2.14 +import QtQuick.Layouts 1.14 Page { title: qsTr("Settings")