mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
Minor fixes, style
* make sure ATC view is updated when disconnected * prepared rounding, can be enabled at any time
This commit is contained in:
committed by
Mat Sutcliffe
parent
1deeaf39e8
commit
e1498adc8e
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
@@ -50,7 +51,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (tokens.size() < 7)
|
if (tokens.size() < 7)
|
||||||
{
|
{
|
||||||
BlackMisc::CLogMessage(static_cast<AtcDataUpdate *>(nullptr)).warning(u"Wrong number of arguments.");
|
CLogMessage(static_cast<AtcDataUpdate *>(nullptr)).warning(u"Wrong number of arguments.");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -881,8 +881,11 @@ namespace BlackCore
|
|||||||
|
|
||||||
CFrequency freq(atcDataUpdate.m_frequencykHz, CFrequencyUnit::kHz());
|
CFrequency freq(atcDataUpdate.m_frequencykHz, CFrequencyUnit::kHz());
|
||||||
freq.switchUnit(CFrequencyUnit::MHz()); // we would not need to bother, but this makes it easier to identify
|
freq.switchUnit(CFrequencyUnit::MHz()); // we would not need to bother, but this makes it easier to identify
|
||||||
const CLength networkRange(atcDataUpdate.m_visibleRange, CLengthUnit::NM());
|
|
||||||
|
|
||||||
|
// Here we could round to channel spacing, based on https://discordapp.com/channels/539048679160676382/539486489977946112/651514202405601291
|
||||||
|
// CComSystem::roundToChannelSpacing(freq, CComSystem::ChannelSpacing25KHz);
|
||||||
|
|
||||||
|
const CLength networkRange(atcDataUpdate.m_visibleRange, CLengthUnit::NM());
|
||||||
const CLength range = fixAtcRange(networkRange, cs);
|
const CLength range = fixAtcRange(networkRange, cs);
|
||||||
const CCoordinateGeodetic position(atcDataUpdate.m_latitude, atcDataUpdate.m_longitude, 0);
|
const CCoordinateGeodetic position(atcDataUpdate.m_latitude, atcDataUpdate.m_longitude, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
this->clearOnlineViews();
|
this->clearOnlineViews();
|
||||||
|
this->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
m_columns.addColumn(CColumn("frequency", { CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter()));
|
m_columns.addColumn(CColumn("frequency", { CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter()));
|
||||||
m_columns.addColumn(CColumn::standardString("transponder", { CSimulatedAircraft::IndexTransponder, CTransponder::IndexTransponderCodeAndModeFormatted }));
|
m_columns.addColumn(CColumn::standardString("transponder", { CSimulatedAircraft::IndexTransponder, CTransponder::IndexTransponderCodeAndModeFormatted }));
|
||||||
m_columns.addColumn(CColumn("latitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLatitude }, new CLatLonFormatter()));
|
m_columns.addColumn(CColumn("latitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLatitude }, new CLatLonFormatter()));
|
||||||
m_columns.addColumn(CColumn("longitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLongitude }, new CLatLonFormatter()));
|
m_columns.addColumn(CColumn("longitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLongitude }, new CLatLonFormatter()));
|
||||||
|
|
||||||
// default sort order
|
// default sort order
|
||||||
@@ -101,7 +101,7 @@ namespace BlackGui
|
|||||||
m_columns.addColumnIncognito(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
|
m_columns.addColumnIncognito(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
|
||||||
m_columns.addColumn(CColumn::standardString("icao", CSimulatedAircraft::IndexCombinedIcaoLiveryString));
|
m_columns.addColumn(CColumn::standardString("icao", CSimulatedAircraft::IndexCombinedIcaoLiveryString));
|
||||||
m_columns.addColumn(CColumn::standardString("model", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelString}));
|
m_columns.addColumn(CColumn::standardString("model", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelString}));
|
||||||
m_columns.addColumn(CColumn::standardString("type", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelTypeAsString}));
|
m_columns.addColumn(CColumn::standardString("type", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelTypeAsString}));
|
||||||
m_columns.addColumn(CColumn::standardString("desc.", "description", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexDescription}));
|
m_columns.addColumn(CColumn::standardString("desc.", "description", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexDescription}));
|
||||||
m_columns.addColumn(CColumn::standardString("aircraft", "rendered vs. network aircraft ICAO", CSimulatedAircraft::IndexNetworkModelAircraftIcaoDifference));
|
m_columns.addColumn(CColumn::standardString("aircraft", "rendered vs. network aircraft ICAO", CSimulatedAircraft::IndexNetworkModelAircraftIcaoDifference));
|
||||||
m_columns.addColumn(CColumn::standardString("livery", "rendered vs. network livery", CSimulatedAircraft::IndexNetworkModelLiveryDifference));
|
m_columns.addColumn(CColumn::standardString("livery", "rendered vs. network livery", CSimulatedAircraft::IndexNetworkModelLiveryDifference));
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
#include "blackgui/models/listmodelcallsignobjects.h"
|
#include "blackgui/models/listmodelcallsignobjects.h"
|
||||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
|
|
||||||
class QObject;
|
|
||||||
|
|
||||||
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
|
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -41,7 +39,7 @@ namespace BlackGui
|
|||||||
explicit CSimulatedAircraftListModel(QObject *parent = nullptr);
|
explicit CSimulatedAircraftListModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CSimulatedAircraftListModel() {}
|
virtual ~CSimulatedAircraftListModel() override {}
|
||||||
|
|
||||||
//! Mode
|
//! Mode
|
||||||
void setAircraftMode(AircraftMode mode);
|
void setAircraftMode(AircraftMode mode);
|
||||||
|
|||||||
@@ -328,27 +328,27 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved());
|
case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved());
|
case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved());
|
case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexAltitude: return this->getAltitude().propertyByIndex(index.copyFrontRemoved());
|
case IndexAltitude: return this->getAltitude().propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexHeading: return m_heading.propertyByIndex(index.copyFrontRemoved());
|
case IndexHeading: return m_heading.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexPitch: return m_pitch.propertyByIndex(index.copyFrontRemoved());
|
case IndexPitch: return m_pitch.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexPBHInfo: return CVariant::fromValue(this->getPBHInfo());
|
case IndexPBHInfo: return CVariant::fromValue(this->getPBHInfo());
|
||||||
case IndexBank: return m_bank.propertyByIndex(index.copyFrontRemoved());
|
case IndexBank: return m_bank.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved());
|
case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexSceneryOffset: return m_sceneryOffset.propertyByIndex(index.copyFrontRemoved());
|
case IndexSceneryOffset: return m_sceneryOffset.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexGroundSpeed: return m_groundSpeed.propertyByIndex(index.copyFrontRemoved());
|
case IndexGroundSpeed: return m_groundSpeed.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexGroundElevationPlane: return m_groundElevationPlane.propertyByIndex(index.copyFrontRemoved());
|
case IndexGroundElevationPlane: return m_groundElevationPlane.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
|
case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexIsOnGround: return CVariant::fromValue(m_onGround);
|
case IndexIsOnGround: return CVariant::fromValue(m_onGround);
|
||||||
case IndexIsOnGroundString: return CVariant::fromValue(this->onGroundAsString());
|
case IndexIsOnGroundString: return CVariant::fromValue(this->onGroundAsString());
|
||||||
case IndexOnGroundReliability: return CVariant::fromValue(m_onGroundDetails);
|
case IndexOnGroundReliability: return CVariant::fromValue(m_onGroundDetails);
|
||||||
case IndexOnGroundReliabilityString: return CVariant::fromValue(this->getOnGroundDetailsAsString());
|
case IndexOnGroundReliabilityString: return CVariant::fromValue(this->getOnGroundDetailsAsString());
|
||||||
case IndexGroundElevationInfo: return CVariant::fromValue(this->getGroundElevationInfo());
|
case IndexGroundElevationInfo: return CVariant::fromValue(this->getGroundElevationInfo());
|
||||||
case IndexGroundElevationInfoTransferred: return CVariant::fromValue(this->isGroundElevationInfoTransferred());
|
case IndexGroundElevationInfoTransferred: return CVariant::fromValue(this->isGroundElevationInfoTransferred());
|
||||||
case IndexGroundElevationInfoString: return CVariant::fromValue(this->getGroundElevationInfoAsString());
|
case IndexGroundElevationInfoString: return CVariant::fromValue(this->getGroundElevationInfoAsString());
|
||||||
case IndexGroundElevationPlusInfo: return CVariant::fromValue(this->getGroundElevationAndInfo());
|
case IndexGroundElevationPlusInfo: return CVariant::fromValue(this->getGroundElevationAndInfo());
|
||||||
case IndexCanLikelySkipNearGroundInterpolation: return CVariant::fromValue(this->canLikelySkipNearGroundInterpolation());
|
case IndexCanLikelySkipNearGroundInterpolation: return CVariant::fromValue(this->canLikelySkipNearGroundInterpolation());
|
||||||
default: return CValueObject::propertyByIndex(index);
|
default: return CValueObject::propertyByIndex(index);
|
||||||
}
|
}
|
||||||
@@ -363,16 +363,16 @@ namespace BlackMisc
|
|||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexPosition: m_position.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexPosition: m_position.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexPitch: m_pitch.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexPitch: m_pitch.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexBank: m_bank.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexBank: m_bank.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexCG: m_cg.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexCG: m_cg.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexSceneryOffset: m_sceneryOffset.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexSceneryOffset: m_sceneryOffset.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexGroundSpeed: m_groundSpeed.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexGroundSpeed: m_groundSpeed.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexGroundElevationPlane: m_groundElevationPlane.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexGroundElevationPlane: m_groundElevationPlane.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexCallsign: m_correspondingCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexCallsign: m_correspondingCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexIsOnGround: m_onGround = variant.toInt(); break;
|
case IndexIsOnGround: m_onGround = variant.toInt(); break;
|
||||||
case IndexOnGroundReliability: m_onGroundDetails = variant.toInt(); break;
|
case IndexOnGroundReliability: m_onGroundDetails = variant.toInt(); break;
|
||||||
case IndexGroundElevationInfo: m_elvInfo = variant.toInt(); break;
|
case IndexGroundElevationInfo: m_elvInfo = variant.toInt(); break;
|
||||||
case IndexGroundElevationInfoTransferred: m_isElvInfoTransferred = variant.toBool(); break;
|
case IndexGroundElevationInfoTransferred: m_isElvInfoTransferred = variant.toBool(); break;
|
||||||
case IndexGroundElevationPlusInfo: break;
|
case IndexGroundElevationPlusInfo: break;
|
||||||
case IndexCanLikelySkipNearGroundInterpolation: break;
|
case IndexCanLikelySkipNearGroundInterpolation: break;
|
||||||
@@ -390,11 +390,11 @@ namespace BlackMisc
|
|||||||
case IndexPosition: return m_position.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPosition());
|
case IndexPosition: return m_position.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPosition());
|
||||||
case IndexAltitude: return this->getAltitude().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getAltitude());
|
case IndexAltitude: return this->getAltitude().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getAltitude());
|
||||||
case IndexPBHInfo: // fall through
|
case IndexPBHInfo: // fall through
|
||||||
case IndexPitch: return m_pitch.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPitch());
|
case IndexPitch: return m_pitch.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPitch());
|
||||||
case IndexBank: return m_bank.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getBank());
|
case IndexBank: return m_bank.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getBank());
|
||||||
case IndexCG: return m_cg.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCG());
|
case IndexCG: return m_cg.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCG());
|
||||||
case IndexSceneryOffset: return m_sceneryOffset.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getSceneryOffset());
|
case IndexSceneryOffset: return m_sceneryOffset.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getSceneryOffset());
|
||||||
case IndexGroundSpeed: return m_groundSpeed.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundSpeed());
|
case IndexGroundSpeed: return m_groundSpeed.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundSpeed());
|
||||||
case IndexGroundElevationPlane:
|
case IndexGroundElevationPlane:
|
||||||
case IndexGroundElevationPlusInfo:
|
case IndexGroundElevationPlusInfo:
|
||||||
{
|
{
|
||||||
@@ -585,9 +585,9 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// "extreme" values for which we are surely not on ground
|
// "extreme" values for which we are surely not on ground
|
||||||
if (qAbs(this->getPitch().value(CAngleUnit::deg())) > 20) { if (details) { *details = QStringLiteral("max.pitch"); }; return true; } // some tail wheel aircraft already have 11° pitch on ground
|
if (qAbs(this->getPitch().value(CAngleUnit::deg())) > 20) { if (details) { *details = QStringLiteral("max.pitch"); } return true; } // some tail wheel aircraft already have 11° pitch on ground
|
||||||
if (qAbs(this->getBank().value(CAngleUnit::deg())) > 10) { if (details) { *details = QStringLiteral("max.bank"); }; return true; }
|
if (qAbs(this->getBank().value(CAngleUnit::deg())) > 10) { if (details) { *details = QStringLiteral("max.bank"); } return true; }
|
||||||
if (this->getGroundSpeed() > sureRotateSpeed) { if (details) { *details = u"gs. > vr " % sureRotateSpeed.valueRoundedWithUnit(1); }; return true; }
|
if (this->getGroundSpeed() > sureRotateSpeed) { if (details) { *details = u"gs. > vr " % sureRotateSpeed.valueRoundedWithUnit(1); } return true; }
|
||||||
|
|
||||||
// use the most accurate or reliable guesses here first
|
// use the most accurate or reliable guesses here first
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
@@ -643,7 +643,7 @@ namespace BlackMisc
|
|||||||
if (this->getGroundSpeed() < guessedRotateSpeed)
|
if (this->getGroundSpeed() < guessedRotateSpeed)
|
||||||
{
|
{
|
||||||
this->setOnGround(OnGround, CAircraftSituation::OnGroundByGuessing);
|
this->setOnGround(OnGround, CAircraftSituation::OnGroundByGuessing);
|
||||||
if (details) { *details = QStringLiteral("Guessing, max.guessed gs.") + guessedRotateSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1); };
|
if (details) { *details = QStringLiteral("Guessing, max.guessed gs.") + guessedRotateSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1); }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -726,7 +726,7 @@ namespace BlackMisc
|
|||||||
QString CAircraftSituation::getGroundElevationAndInfo() const
|
QString CAircraftSituation::getGroundElevationAndInfo() const
|
||||||
{
|
{
|
||||||
static const QString n("null");
|
static const QString n("null");
|
||||||
if (m_groundElevationPlane.isNull()) { return n; };
|
if (m_groundElevationPlane.isNull()) { return n; }
|
||||||
|
|
||||||
return m_groundElevationPlane.getAltitude().toQString(true) %
|
return m_groundElevationPlane.getAltitude().toQString(true) %
|
||||||
u" [" % this->getGroundElevationInfoAsString() % u']';
|
u" [" % this->getGroundElevationInfoAsString() % u']';
|
||||||
|
|||||||
@@ -376,8 +376,8 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexCallsign: m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexCallsign: m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexPilot: m_pilot.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexPilot: m_pilot.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexRelativeDistance: m_relativeDistance.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexRelativeDistance: m_relativeDistance.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexCom1System: m_com1system.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexCom1System: m_com1system.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexCom2System: m_com2system.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexCom2System: m_com2system.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
|
|||||||
Reference in New Issue
Block a user