mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
refs #768, some minor formatting during debugging of mapping wizard
(found that some unnecessary model changed events are sent, will result in some refactoring)
This commit is contained in:
@@ -55,7 +55,6 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
namespace Context
|
namespace Context
|
||||||
{
|
{
|
||||||
|
|
||||||
//! Own context proxy
|
//! Own context proxy
|
||||||
//! \ingroup dbus
|
//! \ingroup dbus
|
||||||
class BLACKCORE_EXPORT IContextOwnAircraft : public CContext
|
class BLACKCORE_EXPORT IContextOwnAircraft : public CContext
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
ownAircraft.initComSystems();
|
ownAircraft.initComSystems();
|
||||||
ownAircraft.initTransponder();
|
ownAircraft.initTransponder();
|
||||||
CAircraftSituation situation(
|
const CAircraftSituation situation(
|
||||||
CCoordinateGeodetic(
|
CCoordinateGeodetic(
|
||||||
CLatitude::fromWgs84("N 049° 18' 17"),
|
CLatitude::fromWgs84("N 049° 18' 17"),
|
||||||
CLongitude::fromWgs84("E 008° 27' 05"),
|
CLongitude::fromWgs84("E 008° 27' 05"),
|
||||||
@@ -130,7 +130,7 @@ namespace BlackCore
|
|||||||
// reverse lookup if possible
|
// reverse lookup if possible
|
||||||
if (!ownAircraft.getModel().isLoadedFromDb() && !ownAircraft.getModelString().isEmpty())
|
if (!ownAircraft.getModel().isLoadedFromDb() && !ownAircraft.getModelString().isEmpty())
|
||||||
{
|
{
|
||||||
ownAircraft.setModel(reverseLookupModel(ownAircraft.getModelString()));
|
ownAircraft.setModel(this->reverseLookupModel(ownAircraft.getModelString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// override empty values
|
// override empty values
|
||||||
@@ -187,6 +187,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (modelString.isEmpty()) { return CAircraftModel(); }
|
if (modelString.isEmpty()) { return CAircraftModel(); }
|
||||||
if (!sApp || !sApp->hasWebDataServices()) { return CAircraftModel(); }
|
if (!sApp || !sApp->hasWebDataServices()) { return CAircraftModel(); }
|
||||||
|
if (sApp->getWebDataServices()->getModelsCount() < 1) { return CAircraftModel(); }
|
||||||
const CAircraftModel reverseLookupModel = sApp->getWebDataServices()->getModelForModelString(modelString);
|
const CAircraftModel reverseLookupModel = sApp->getWebDataServices()->getModelForModelString(modelString);
|
||||||
return reverseLookupModel;
|
return reverseLookupModel;
|
||||||
}
|
}
|
||||||
@@ -195,7 +196,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// reverse lookup if not yet from DB:
|
// reverse lookup if not yet from DB:
|
||||||
// this is the central place where we keep our own model, so we use best effort
|
// this is the central place where we keep our own model, so we use best effort
|
||||||
// to make that model as accuarate as we can
|
// to make that model as accurate as we can
|
||||||
CAircraftModel updateModel(model);
|
CAircraftModel updateModel(model);
|
||||||
if (!updateModel.isLoadedFromDb())
|
if (!updateModel.isLoadedFromDb())
|
||||||
{
|
{
|
||||||
@@ -209,10 +210,10 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateModel.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
||||||
QWriteLocker l(&m_lockAircraft);
|
QWriteLocker l(&m_lockAircraft);
|
||||||
const bool changed = (this->m_ownAircraft.getModel() != updateModel);
|
const bool changed = (this->m_ownAircraft.getModel() != updateModel);
|
||||||
if (!changed) { return false; }
|
if (!changed) { return false; }
|
||||||
updateModel.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
|
||||||
this->m_ownAircraft.setModel(updateModel);
|
this->m_ownAircraft.setModel(updateModel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -296,7 +297,7 @@ namespace BlackCore
|
|||||||
if (this->m_ownAircraft.getPilot() == pilot) { return false; }
|
if (this->m_ownAircraft.getPilot() == pilot) { return false; }
|
||||||
this->m_ownAircraft.setPilot(pilot);
|
this->m_ownAircraft.setPilot(pilot);
|
||||||
}
|
}
|
||||||
emit changedPilot(pilot);
|
emit this->changedPilot(pilot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +308,7 @@ namespace BlackCore
|
|||||||
if (this->m_ownAircraft.getCallsign() == callsign) { return false; }
|
if (this->m_ownAircraft.getCallsign() == callsign) { return false; }
|
||||||
this->m_ownAircraft.setCallsign(callsign);
|
this->m_ownAircraft.setCallsign(callsign);
|
||||||
}
|
}
|
||||||
emit changedCallsign(callsign);
|
emit this->changedCallsign(callsign);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +318,7 @@ namespace BlackCore
|
|||||||
QWriteLocker l(&m_lockAircraft);
|
QWriteLocker l(&m_lockAircraft);
|
||||||
return this->m_ownAircraft.setIcaoCodes(aircraftIcaoCode, airlineIcaoCode);
|
return this->m_ownAircraft.setIcaoCodes(aircraftIcaoCode, airlineIcaoCode);
|
||||||
}
|
}
|
||||||
emit changedAircraftIcaoCodes(aircraftIcaoCode, airlineIcaoCode);
|
emit this->changedAircraftIcaoCodes(aircraftIcaoCode, airlineIcaoCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CContextOwnAircraft::updateSelcal(const CSelcal &selcal, const CIdentifier &originator)
|
bool CContextOwnAircraft::updateSelcal(const CSelcal &selcal, const CIdentifier &originator)
|
||||||
|
|||||||
@@ -169,10 +169,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BlackMisc::Simulation::CSimulatedAircraft m_ownAircraft; //!< my aircraft
|
BlackMisc::Simulation::CSimulatedAircraft m_ownAircraft; //!< my aircraft
|
||||||
bool m_automaticVoiceRoomResolution = true; //!< automatic voice room resolution, or disable for override
|
bool m_automaticVoiceRoomResolution = true; //!< automatic voice room resolution, or disable for override
|
||||||
QString m_voiceRoom1UrlOverride; //!< overridden voice room url
|
QString m_voiceRoom1UrlOverride; //!< overridden voice room url
|
||||||
QString m_voiceRoom2UrlOverride; //!< overridden voice room url
|
QString m_voiceRoom2UrlOverride; //!< overridden voice room url
|
||||||
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft
|
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft
|
||||||
|
|
||||||
BlackMisc::CSetting<Vatsim::TCurrentTrafficServer> m_currentNetworkServer { this };
|
BlackMisc::CSetting<Vatsim::TCurrentTrafficServer> m_currentNetworkServer { this };
|
||||||
|
|
||||||
|
|||||||
@@ -179,12 +179,10 @@ namespace BlackCore
|
|||||||
static QString statusToString(int status);
|
static QString statusToString(int status);
|
||||||
|
|
||||||
//! Status to enum
|
//! Status to enum
|
||||||
//! \todo remove with Qt 5.5 when SimulatorStatus can be transferred via DBus
|
|
||||||
static SimulatorStatus statusToEnum(int status);
|
static SimulatorStatus statusToEnum(int status);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Simulator combined status
|
//! Simulator combined status
|
||||||
//! \todo Qt5.5: Make use of QFlags
|
|
||||||
void simulatorStatusChanged(int status);
|
void simulatorStatusChanged(int status);
|
||||||
|
|
||||||
//! Emitted when own aircraft model has changed
|
//! Emitted when own aircraft model has changed
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ namespace BlackCore
|
|||||||
m_maxRenderedAircraft = maxRenderedAircraft;
|
m_maxRenderedAircraft = maxRenderedAircraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool r = isRenderingRestricted();
|
const bool r = isRenderingRestricted();
|
||||||
bool e = isRenderingEnabled();
|
const bool e = isRenderingEnabled();
|
||||||
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,8 +214,8 @@ namespace BlackCore
|
|||||||
m_maxRenderedDistance = distance;
|
m_maxRenderedDistance = distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool r = isRenderingRestricted();
|
const bool r = isRenderingRestricted();
|
||||||
bool e = isRenderingEnabled();
|
const bool e = isRenderingEnabled();
|
||||||
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ namespace BlackCore
|
|||||||
CCallsignSet callsignsToBeAdded(snapshot.getEnabledAircraftCallsignsByDistance().difference(callsignsInSimulator));
|
CCallsignSet callsignsToBeAdded(snapshot.getEnabledAircraftCallsignsByDistance().difference(callsignsInSimulator));
|
||||||
if (!callsignsToBeRemoved.isEmpty())
|
if (!callsignsToBeRemoved.isEmpty())
|
||||||
{
|
{
|
||||||
int r = this->physicallyRemoveMultipleRemoteAircraft(callsignsToBeRemoved);
|
const int r = this->physicallyRemoveMultipleRemoteAircraft(callsignsToBeRemoved);
|
||||||
changed = r > 0;
|
changed = r > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ namespace BlackCore
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no rendering at all, we remove everything
|
// no rendering at all, we remove everything
|
||||||
int r = this->physicallyRemoveAllRemoteAircraft();
|
const int r = this->physicallyRemoveAllRemoteAircraft();
|
||||||
changed = r > 0;
|
changed = r > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,15 +133,15 @@ namespace BlackCore
|
|||||||
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model
|
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< default model
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_debugMessages = false; //!< Display debug messages
|
bool m_debugMessages = false; //!< Display debug messages
|
||||||
bool m_blinkCycle = false; //!< use for highlighting
|
bool m_blinkCycle = false; //!< use for highlighting
|
||||||
qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting
|
qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting
|
||||||
int m_timerCounter = 0; //!< allows to calculate n seconds
|
int m_timerCounter = 0; //!< allows to calculate n seconds
|
||||||
QTimer m_oneSecondTimer {this}; //!< multi purpose timer
|
int m_maxRenderedAircraft = MaxAircraftInfinite; //!< max.rendered aircraft
|
||||||
|
QTimer m_oneSecondTimer {this}; //!< multi purpose timer
|
||||||
BlackMisc::Simulation::CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
BlackMisc::Simulation::CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
||||||
BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored
|
BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored
|
||||||
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
||||||
int m_maxRenderedAircraft = MaxAircraftInfinite; //!< max.rendered aircraft
|
|
||||||
BlackMisc::PhysicalQuantities::CLength m_maxRenderedDistance { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()}; //!< max.distance for rendering
|
BlackMisc::PhysicalQuantities::CLength m_maxRenderedDistance { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()}; //!< max.distance for rendering
|
||||||
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots
|
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
|
|
||||||
const CSimulatedAircraft COwnAircraftAware::getOwnAircraft() const
|
const CSimulatedAircraft COwnAircraftAware::getOwnAircraft() const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->m_ownAircraftProvider, Q_FUNC_INFO, "No object available");
|
Q_ASSERT_X(this->m_ownAircraftProvider, Q_FUNC_INFO, "No object available");
|
||||||
|
|||||||
@@ -76,12 +76,16 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFsCommon::setOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model)
|
void CSimulatorFsCommon::setOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model)
|
||||||
{
|
{
|
||||||
if (getOwnAircraftModel() != model)
|
if (!model.hasModelString()) { return; }
|
||||||
|
if (this->getOwnAircraftModel() != model)
|
||||||
{
|
{
|
||||||
CAircraftModel newModel(model);
|
CAircraftModel newModel(model);
|
||||||
newModel.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
newModel.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
||||||
updateOwnModel(newModel);
|
const bool updated = this->updateOwnModel(newModel); // update in provider (normally the context)
|
||||||
emit ownAircraftModelChanged(newModel);
|
if (updated)
|
||||||
|
{
|
||||||
|
emit this->ownAircraftModelChanged(this->getOwnAircraftModel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user