Skip to content

Commit

Permalink
Source code modernization
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kebekus committed Apr 18, 2020
1 parent 172ca2a commit c57d71a
Show file tree
Hide file tree
Showing 43 changed files with 167 additions and 364 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

cmake_minimum_required(VERSION 3.13)
include(ExternalProject)
include(GNUInstallDirs)
option(BUILD_DOC "Build documentation" OFF)


Expand All @@ -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
#
Expand All @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions buildscript-android-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 5 additions & 20 deletions src/Aircraft.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#ifndef AIRCRAFT_H
#define AIRCRAFT_H
#pragma once

#include <QSettings>

Expand All @@ -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;

Expand Down Expand Up @@ -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
*
Expand All @@ -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
*
Expand Down Expand Up @@ -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;
Expand All @@ -158,5 +145,3 @@ class Aircraft : public QObject {

QSettings settings;
};

#endif
19 changes: 3 additions & 16 deletions src/Airspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#ifndef AIRSPACE_H
#define AIRSPACE_H
#pragma once

#include <QGeoPolygon>
#include <QJsonObject>
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
7 changes: 2 additions & 5 deletions src/AviationUnits.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#pragma once

#include <QGeoCoordinate>
#include <QString>
#include <QtMath>

#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
Expand Down Expand Up @@ -412,5 +411,3 @@ class AviationUnits {
return {};
return AviationUnits::Time::fromS(dist.toM() / speed.toMPS());
}

#endif
19 changes: 3 additions & 16 deletions src/Downloadable.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#ifndef DOWNLOADABLE_H
#define DOWNLOADABLE_H
#pragma once

#include <QFile>
#include <QFileInfo>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<QNetworkAccessManager> _networkAccessManager;
Expand Down Expand Up @@ -479,5 +468,3 @@ private slots:
// Section name
QString _section {};
};

#endif // DOWNLOADABLE_H
21 changes: 4 additions & 17 deletions src/DownloadableGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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.
Expand All @@ -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)
};
19 changes: 3 additions & 16 deletions src/DownloadableGroupWatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#ifndef DownloadableGroupWatcher_H
#define DownloadableGroupWatcher_H
#pragma once

#include <QTimer>

Expand All @@ -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
Expand Down Expand Up @@ -209,6 +196,8 @@ protected slots:
QList<QPointer<Downloadable>> _downloadables;

private:
Q_DISABLE_COPY_MOVE(DownloadableGroupWatcher)

// Provisions to provide the signal localFileContentChanged_delayed
void emitLocalFileContentChanged_delayed();
QTimer emitLocalFileContentChanged_delayedTimer;
Expand All @@ -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
19 changes: 3 additions & 16 deletions src/FlightRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#ifndef FLIGHTROUTE_H
#define FLIGHTROUTE_H
#pragma once

#include <QLocale>
#include <QPointer>
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -250,5 +239,3 @@ private slots:
};

#include "FlightRoute_Leg.h"

#endif
19 changes: 3 additions & 16 deletions src/FlightRoute_Leg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QPointer>

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -180,5 +169,3 @@ class FlightRoute::Leg : public QObject
QPointer<Aircraft> _aircraft {nullptr};
QPointer<Wind> _wind {nullptr};
};

#endif
Loading

0 comments on commit c57d71a

Please sign in to comment.