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