mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Formatting (#879)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
20921b79b8
commit
f71cb04cd2
@@ -185,8 +185,8 @@ namespace BlackMisc
|
||||
{
|
||||
// we already have some booking dates, we will verify those now
|
||||
// and will set the most appropriate booking dates
|
||||
CTime timeDiffBooking(bookedStation.bookedWhen());
|
||||
CTime timeDiffOnline(this->bookedWhen()); // diff to now
|
||||
const CTime timeDiffBooking(bookedStation.bookedWhen());
|
||||
const CTime timeDiffOnline(this->bookedWhen()); // diff to now
|
||||
if (timeDiffBooking.isNegativeWithEpsilonConsidered() && timeDiffOnline.isNegativeWithEpsilonConsidered())
|
||||
{
|
||||
// both in past
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
CCallsignSet::CCallsignSet() { }
|
||||
|
||||
CCallsignSet::CCallsignSet(const CCollection<CCallsign> &other) :
|
||||
@@ -37,6 +36,5 @@ namespace BlackMisc
|
||||
qDBusRegisterMetaType<CCallsignSet>();
|
||||
registerMetaValueType<CCallsignSet>();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace BlackMisc
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
@@ -10,36 +10,52 @@
|
||||
#include "blackmisc/aviation/flightplan.h"
|
||||
#include "blackmisc/iconlist.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
CFlightPlan::CFlightPlan() { }
|
||||
|
||||
CFlightPlan::CFlightPlan(const QString &equipmentIcao, const CAirportIcaoCode &originAirportIcao, const CAirportIcaoCode &destinationAirportIcao, const CAirportIcaoCode &alternateAirportIcao, QDateTime takeoffTimePlanned, QDateTime takeoffTimeActual, const PhysicalQuantities::CTime &enrouteTime, const PhysicalQuantities::CTime &fuelTime, const CAltitude &cruiseAltitude, const PhysicalQuantities::CSpeed &cruiseTrueAirspeed, CFlightPlan::FlightRules flightRules, const QString &route, const QString &remarks)
|
||||
: m_equipmentIcao(equipmentIcao), m_originAirportIcao(originAirportIcao), m_destinationAirportIcao(destinationAirportIcao), m_alternateAirportIcao(alternateAirportIcao),
|
||||
m_takeoffTimePlanned(takeoffTimePlanned), m_takeoffTimeActual(takeoffTimeActual), m_enrouteTime(enrouteTime), m_fuelTime(fuelTime),
|
||||
m_cruiseAltitude(cruiseAltitude), m_cruiseTrueAirspeed(cruiseTrueAirspeed), m_flightRules(flightRules),
|
||||
m_route(route.trimmed().left(MaxRouteLength).toUpper()), m_remarks(remarks.trimmed().left(MaxRemarksLength).toUpper())
|
||||
{
|
||||
m_enrouteTime.switchUnit(BlackMisc::PhysicalQuantities::CTimeUnit::hrmin());
|
||||
m_fuelTime.switchUnit(BlackMisc::PhysicalQuantities::CTimeUnit::hrmin());
|
||||
}
|
||||
|
||||
QString CFlightPlan::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s;
|
||||
s.append(m_equipmentIcao);
|
||||
s.append(" ").append(m_originAirportIcao.toQString(i18n));
|
||||
s.append(" ").append(m_destinationAirportIcao.toQString(i18n));
|
||||
s.append(" ").append(m_alternateAirportIcao.toQString(i18n));
|
||||
s.append(" ").append(m_takeoffTimePlanned.toString("ddhhmm"));
|
||||
s.append(" ").append(m_takeoffTimeActual.toString("ddhhmm"));
|
||||
s.append(" ").append(m_enrouteTime.toQString(i18n));
|
||||
s.append(" ").append(m_fuelTime.toQString(i18n));
|
||||
s.append(" ").append(m_cruiseAltitude.toQString(i18n));
|
||||
s.append(" ").append(m_cruiseTrueAirspeed.toQString(i18n));
|
||||
switch (m_flightRules)
|
||||
{
|
||||
case VFR: s.append(" VFR"); break;
|
||||
case IFR: s.append(" IFR"); break;
|
||||
case SVFR: s.append(" SVFR"); break;
|
||||
default: s.append(" ???"); break;
|
||||
}
|
||||
s.append(" ").append(m_route);
|
||||
s.append(" / ").append(m_remarks);
|
||||
const QString s = m_equipmentIcao
|
||||
% QLatin1Char(' ') % m_originAirportIcao.toQString(i18n)
|
||||
% QLatin1Char(' ') % m_destinationAirportIcao.toQString(i18n)
|
||||
% QLatin1Char(' ') % m_alternateAirportIcao.toQString(i18n)
|
||||
% QLatin1Char(' ') % m_takeoffTimePlanned.toString("ddhhmm")
|
||||
% QLatin1Char(' ') % m_takeoffTimeActual.toString("ddhhmm")
|
||||
% QLatin1Char(' ') % m_enrouteTime.toQString(i18n)
|
||||
% QLatin1Char(' ') % m_fuelTime.toQString(i18n)
|
||||
% QLatin1Char(' ') % m_cruiseAltitude.toQString(i18n)
|
||||
% QLatin1Char(' ') % m_cruiseTrueAirspeed.toQString(i18n)
|
||||
% QLatin1Char(' ') % m_route
|
||||
% QLatin1Char(' ') % m_remarks;
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString CFlightPlan::flightruleToString(CFlightPlan::FlightRules rule)
|
||||
{
|
||||
switch (rule)
|
||||
{
|
||||
case VFR: return QLatin1Literal("VFR");
|
||||
case IFR: return QLatin1Literal("IFR");
|
||||
case SVFR: return QLatin1Literal("SVFR");
|
||||
default: return QLatin1Literal("???");
|
||||
}
|
||||
}
|
||||
|
||||
BlackMisc::CIcon CFlightPlan::toIcon() const
|
||||
{
|
||||
return BlackMisc::CIcon::iconByIndex(CIcons::StandardIconAppFlightPlan16);
|
||||
|
||||
@@ -49,20 +49,12 @@ namespace BlackMisc
|
||||
static constexpr int MaxRouteLength = 150; //!< Max route length
|
||||
|
||||
//! Default constructor
|
||||
CFlightPlan() = default;
|
||||
CFlightPlan();
|
||||
|
||||
//! Constructor
|
||||
CFlightPlan(const QString &equipmentIcao, const CAirportIcaoCode &originAirportIcao, const CAirportIcaoCode &destinationAirportIcao, const CAirportIcaoCode &alternateAirportIcao,
|
||||
QDateTime takeoffTimePlanned, QDateTime takeoffTimeActual, const PhysicalQuantities::CTime &enrouteTime, const PhysicalQuantities::CTime &fuelTime,
|
||||
const CAltitude &cruiseAltitude, const PhysicalQuantities::CSpeed &cruiseTrueAirspeed, FlightRules flightRules, const QString &route, const QString &remarks)
|
||||
: m_equipmentIcao(equipmentIcao), m_originAirportIcao(originAirportIcao), m_destinationAirportIcao(destinationAirportIcao), m_alternateAirportIcao(alternateAirportIcao),
|
||||
m_takeoffTimePlanned(takeoffTimePlanned), m_takeoffTimeActual(takeoffTimeActual), m_enrouteTime(enrouteTime), m_fuelTime(fuelTime),
|
||||
m_cruiseAltitude(cruiseAltitude), m_cruiseTrueAirspeed(cruiseTrueAirspeed), m_flightRules(flightRules),
|
||||
m_route(route.trimmed().left(MaxRouteLength).toUpper()), m_remarks(remarks.trimmed().left(MaxRemarksLength).toUpper())
|
||||
{
|
||||
m_enrouteTime.switchUnit(BlackMisc::PhysicalQuantities::CTimeUnit::hrmin());
|
||||
m_fuelTime.switchUnit(BlackMisc::PhysicalQuantities::CTimeUnit::hrmin());
|
||||
}
|
||||
const CAltitude &cruiseAltitude, const PhysicalQuantities::CSpeed &cruiseTrueAirspeed, FlightRules flightRules, const QString &route, const QString &remarks);
|
||||
|
||||
//! Set ICAO aircraft equipment code string (e.g. "T/A320/F")
|
||||
void setEquipmentIcao(const QString &equipmentIcao) { m_equipmentIcao = equipmentIcao; }
|
||||
@@ -178,7 +170,7 @@ namespace BlackMisc
|
||||
//! Flight plan already sent
|
||||
bool wasSentOrLoaded() const { return m_lastSentOrLoaded.isValid() && !m_lastSentOrLoaded.isNull(); }
|
||||
|
||||
//! \brief Received before n ms
|
||||
//! Received before n ms
|
||||
qint64 timeDiffSentOrLoadedMs() const
|
||||
{
|
||||
return this->m_lastSentOrLoaded.msecsTo(QDateTime::currentDateTimeUtc());
|
||||
@@ -193,8 +185,11 @@ namespace BlackMisc
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! Rules to string
|
||||
static const QString flightruleToString(FlightRules rule);
|
||||
|
||||
private:
|
||||
QString m_equipmentIcao;
|
||||
QString m_equipmentIcao; //!< e.g. "T/A320/F"
|
||||
CAirportIcaoCode m_originAirportIcao;
|
||||
CAirportIcaoCode m_destinationAirportIcao;
|
||||
CAirportIcaoCode m_alternateAirportIcao;
|
||||
|
||||
@@ -412,11 +412,10 @@ namespace BlackMisc
|
||||
* When a derived class and a base class both inherit from Mixin::JsonByTuple,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_JSON(DERIVED) \
|
||||
using ::BlackMisc::Mixin::JsonByMetaClass<DERIVED>::toJson; \
|
||||
#define BLACKMISC_DECLARE_USING_MIXIN_JSON(DERIVED) \
|
||||
using ::BlackMisc::Mixin::JsonByMetaClass<DERIVED>::toJson; \
|
||||
using ::BlackMisc::Mixin::JsonByMetaClass<DERIVED>::convertFromJson;
|
||||
|
||||
} // Mixin
|
||||
} // BlackMisc
|
||||
} // guard
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
{
|
||||
fails++;
|
||||
// normally a consecutive order of metatypes, we allow a space before we break
|
||||
if (fails > 3) { return meta; }
|
||||
if (fails > 3) { break; }
|
||||
continue;
|
||||
}
|
||||
QMetaType metaType(mt);
|
||||
|
||||
@@ -17,11 +17,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
|
||||
CUserList::CUserList() { }
|
||||
|
||||
CUserList::CUserList(const CSequence &other) : CSequence<CUser>(other)
|
||||
{ }
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "blackmisc/network/user.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -38,7 +37,6 @@ namespace BlackMisc
|
||||
//! Construct from a base class object.
|
||||
CUserList(const CSequence &other);
|
||||
};
|
||||
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -693,10 +693,10 @@ namespace BlackMisc
|
||||
|
||||
CAircraftModel CAircraftModel::fromDatabaseJson(const QJsonObject &json, const QString prefix)
|
||||
{
|
||||
QString modelString(json.value(prefix + "modelstring").toString());
|
||||
QString modelDescription(json.value(prefix + "description").toString());
|
||||
QString modelName(json.value(prefix + "name").toString());
|
||||
QString modelMode(json.value(prefix + "mode").toString());
|
||||
const QString modelString(json.value(prefix + "modelstring").toString());
|
||||
const QString modelDescription(json.value(prefix + "description").toString());
|
||||
const QString modelName(json.value(prefix + "name").toString());
|
||||
const QString modelMode(json.value(prefix + "mode").toString());
|
||||
|
||||
const CSimulatorInfo simInfo = CSimulatorInfo::fromDatabaseJson(json, prefix);
|
||||
const CAircraftIcaoCode aircraftIcao(CAircraftIcaoCode::fromDatabaseJson(json, "ac_"));
|
||||
|
||||
@@ -11,17 +11,13 @@
|
||||
#define BLACKMISCTEST_TESTCONTAINERS_H
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \ingroup testblackmisc
|
||||
*/
|
||||
//! \file
|
||||
//! \ingroup testblackmisc
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
//! Testing containers
|
||||
class CTestContainers : public QObject
|
||||
{
|
||||
@@ -39,7 +35,6 @@ namespace BlackMiscTest
|
||||
void dictionaryBasics();
|
||||
void timestampList();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -29,9 +29,6 @@ using namespace BlackMisc::Math;
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
/*
|
||||
* Geo classes tests
|
||||
*/
|
||||
void CTestGeo::geoBasics()
|
||||
{
|
||||
CLatitude lati(10, CAngleUnit::deg());
|
||||
@@ -48,7 +45,6 @@ namespace BlackMiscTest
|
||||
CCoordinateGeodetic equator = { 0.0, 70.354683 };
|
||||
QCOMPARE(calculateEuclideanDistance(northPole, equator), std::sqrt(2.0f));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
//! Geo classes tests
|
||||
class CTestGeo : public QObject
|
||||
{
|
||||
@@ -38,7 +37,6 @@ namespace BlackMiscTest
|
||||
//! CCoordinateGeodetic unit tests
|
||||
void coordinateGeodetic();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
Reference in New Issue
Block a user