mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 05:28:09 +08:00
Doxygen, renaming, formatting
* Formatting, renaming to current schema * Minor tweaks
This commit is contained in:
@@ -104,9 +104,9 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
/*
|
||||
* Merge with booking
|
||||
* Merge with booking, both (online/booking will be updated)
|
||||
*/
|
||||
int CAtcStationList::mergeWithBooking(CAtcStation &bookedAtcStation)
|
||||
int CAtcStationList::mergeWithBooking(CAtcStation &bookedAtcStation)
|
||||
{
|
||||
int c = 0;
|
||||
bookedAtcStation.setOnline(false); // reset
|
||||
@@ -170,9 +170,13 @@ namespace BlackMisc
|
||||
// both ways
|
||||
onlineAtcStation.syncronizeControllerData(bookedAtcStation);
|
||||
if (onlineAtcStation.hasValidDistance())
|
||||
{
|
||||
bookedAtcStation.setDistanceToPlane(onlineAtcStation.getDistanceToPlane());
|
||||
}
|
||||
else if (bookedAtcStation.hasValidDistance())
|
||||
{
|
||||
onlineAtcStation.setDistanceToPlane(bookedAtcStation.getDistanceToPlane());
|
||||
}
|
||||
|
||||
// update
|
||||
*i = onlineAtcStation;
|
||||
@@ -181,6 +185,7 @@ namespace BlackMisc
|
||||
|
||||
// normally 1 expected, as I should find
|
||||
// only one online station for this booking
|
||||
Q_ASSERT(c == 0 || c == 1);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace BlackMisc
|
||||
//! Update distances to coordinate, usually own aircraft's position
|
||||
void calculateDistancesToPlane(const BlackMisc::Geo::CCoordinateGeodetic &position);
|
||||
|
||||
//! Merge with ATC station representing booking information
|
||||
//! Merge with ATC station representing booking information.
|
||||
//! Both sides (booking, online station) will be updated.
|
||||
//! \remarks Can be used if the stored data in this list are online ATC stations
|
||||
int mergeWithBooking(CAtcStation &bookedAtcStation);
|
||||
|
||||
|
||||
@@ -226,7 +226,9 @@ bool BlackMisc::equalQVariants(const QVariant &v1, const QVariant &v2)
|
||||
*/
|
||||
int BlackMisc::compareQVariants(const QVariant &v1, const QVariant &v2)
|
||||
{
|
||||
if (v1 == v2) return 0; // compares on primitives or on address
|
||||
// Compares this QVariant with v and returns true if they are equal; otherwise returns false.
|
||||
// In the case of custom types, their equalness operators are not called. Instead the values' addresses are compared.
|
||||
if (v1 == v2) return 0;
|
||||
|
||||
if (!v1.isValid() || !v2.isValid()) qFatal("Invalid variants");
|
||||
if (v1.type() != v2.type()) qFatal("Mismatching types");
|
||||
@@ -274,7 +276,7 @@ int BlackMisc::compareQVariants(const QVariant &v1, const QVariant &v2)
|
||||
break;
|
||||
}
|
||||
|
||||
// BlackObject
|
||||
// CValueObject
|
||||
if (v1Type == QMetaType::User)
|
||||
{
|
||||
const CValueObject *cs1 = CValueObject::fromQVariant(v1);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackMisc
|
||||
*/
|
||||
CVoiceCapabilities::CVoiceCapabilities(const QString &flightPlanRemarks)
|
||||
{
|
||||
this->fromFlightPlanRemarks(flightPlanRemarks);
|
||||
this->setFromFlightPlanRemarks(flightPlanRemarks);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -50,8 +50,8 @@ namespace BlackMisc
|
||||
static const QString r("voice listening only");
|
||||
return r;
|
||||
}
|
||||
default:
|
||||
case Unknown:
|
||||
default:
|
||||
{
|
||||
static const QString u("unknown");
|
||||
return u;
|
||||
@@ -61,15 +61,16 @@ namespace BlackMisc
|
||||
return QString(""); // never reached
|
||||
}
|
||||
|
||||
void CVoiceCapabilities::fromFlightPlanRemarks(const QString &flightPlanRemarks)
|
||||
void CVoiceCapabilities::setFromFlightPlanRemarks(const QString &flightPlanRemarks)
|
||||
{
|
||||
// http://www.vatpac.org/cms/index.php?option=com_content&view=article&id=608&Itemid=213
|
||||
if (flightPlanRemarks.isEmpty())
|
||||
{
|
||||
this->m_voiceCapabilities = Unknown;
|
||||
this->setCapabilities(Unknown);
|
||||
return;
|
||||
}
|
||||
|
||||
QString r = flightPlanRemarks.toLower();
|
||||
const QString r = flightPlanRemarks.toLower();
|
||||
if (r.contains("/v/") || r.contains("/voice/"))
|
||||
{
|
||||
this->setCapabilities(Voice);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
|
||||
//!< Voice capabilities
|
||||
//! Voice capabilities
|
||||
enum VoiceCapabilities
|
||||
{
|
||||
Unknown,
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*! Wrapper container for shared lockable pointer.
|
||||
/*!
|
||||
* Wrapper container for shared lockable pointer.
|
||||
* Provides BasicLockable characteristics to be used
|
||||
* with std::lock_guard
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "testing.h"
|
||||
#include "nwvoicecapabilities.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Geo;
|
||||
@@ -34,20 +35,20 @@ namespace BlackMisc
|
||||
// from WGS is slow, so static const (only 1 time init)
|
||||
// https://dev.vatsim-germany.org/issues/322#note-2
|
||||
static const CCoordinateGeodetic geoPos = CCoordinateGeodetic::fromWgs84("48° 21′ 13″ N", "11° 47′ 09″ E", CLength(index, CLengthUnit::ft()));
|
||||
|
||||
QString cs = QString("%1_TWR").arg(index);
|
||||
QString usr = QString("Joe %1").arg(index);
|
||||
QString id = QString("00000%1").arg(index).right(6);
|
||||
double f = 118.0 + (index % 30) * 0.25;
|
||||
|
||||
QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
const QDateTime dtFrom = QDateTime::currentDateTimeUtc();
|
||||
const QDateTime dtUntil = dtFrom.addSecs(60 * 60.0); // 1 hour
|
||||
const CUser user(id, usr);
|
||||
|
||||
if (byPropertyIndex)
|
||||
{
|
||||
CAtcStation station;
|
||||
station.setPropertyByIndex(CCallsign(cs).toQVariant(), CAtcStation::IndexCallsign);
|
||||
station.setPropertyByIndex(CUser(id, usr).toQVariant(), CAtcStation::IndexController);
|
||||
station.setPropertyByIndex(user.toQVariant(), CAtcStation::IndexController);
|
||||
station.setPropertyByIndex(CFrequency(f, CFrequencyUnit::MHz()).toQVariant(), CAtcStation::IndexFrequency);
|
||||
station.setPropertyByIndex(CLength(50, CLengthUnit::km()).toQVariant(), CAtcStation::IndexRange);
|
||||
station.setPropertyByIndex(geoPos.toQVariant(), CAtcStation::IndexPosition);
|
||||
@@ -59,7 +60,7 @@ namespace BlackMisc
|
||||
}
|
||||
else
|
||||
{
|
||||
CAtcStation station(CCallsign(cs), CUser(id, usr),
|
||||
CAtcStation station(CCallsign(cs), user,
|
||||
CFrequency(f, CFrequencyUnit::MHz()),
|
||||
geoPos, CLength(50, CLengthUnit::km()), false, dtFrom, dtUntil);
|
||||
station.setDistanceToPlane(CLength(index + 1, CLengthUnit::NM()));
|
||||
@@ -134,7 +135,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CTesting::parseWgs(int times)
|
||||
{
|
||||
static QStringList wgsLatLng(
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
#ifndef BLACKMISC_TESTING_H
|
||||
#define BLACKMISC_TESTING_H
|
||||
|
||||
#include "avallclasses.h"
|
||||
|
||||
#include "avatcstationlist.h"
|
||||
|
||||
/*!
|
||||
* Generate data for testing purposes.
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
#include <QFuture>
|
||||
#include <QCoreApplication>
|
||||
|
||||
// Header only class, to avoid orward instantiation across subprojects
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*!
|
||||
* Support for threaded based reading and parsing tasks such
|
||||
* as data files via http, or file system and parsing (such as FSX models)
|
||||
*
|
||||
* \remarks Header only class to avoid forward instantiations across subprojects
|
||||
*/
|
||||
template <class FutureRet = void> class CThreadedReader
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user