Formatting, comments, typos, or minor tweaks

* Aircraft ICAO class: hasXX methods (hasAircraftCombinedType(), ..)
* Index Variant map, contains(index)
* Deleted context_network_textmessages.cpp and moved it into impl.cpp (this was only 1 method)
* Fixed bug refs#228
This commit is contained in:
Klaus Basan
2014-05-06 12:55:29 +02:00
parent 841ea97421
commit 580ec3d8c8
14 changed files with 77 additions and 120 deletions

View File

@@ -56,8 +56,6 @@ namespace BlackCore
*/
void CContextNetwork::psFsdAircraftUpdateReceived(const CCallsign &callsign, const CAircraftSituation &situation, const CTransponder &transponder)
{
// this->log(Q_FUNC_INFO, callsign.toQString(), situation.toQString(), transponder.toQString());
CAircraftList list = this->m_aircraftsInRange.findByCallsign(callsign);
if (list.isEmpty())
{
@@ -99,8 +97,8 @@ namespace BlackCore
*/
void CContextNetwork::psFsdPilotDisconnected(const CCallsign &callsign)
{
// this->log(Q_FUNC_INFO, callsign.toQString());
this->m_aircraftsInRange.removeIf(&CAircraft::getCallsign, callsign);
this->m_otherClients.removeIf(&CClient::getCallsign, callsign);
}
/*
@@ -108,8 +106,6 @@ namespace BlackCore
*/
void CContextNetwork::psFsdFrequencyReceived(const CCallsign &callsign, const CFrequency &frequency)
{
// this->log(Q_FUNC_INFO, callsign.toQString(), frequency.toQString());
// update
CIndexVariantMap vm(CAircraft::IndexFrequencyCom1, frequency.toQVariant());
this->m_aircraftsInRange.applyIf(BlackMisc::Predicates::MemberEqual<CAircraft>(&CAircraft::getCallsign, callsign), vm);

View File

@@ -271,7 +271,6 @@ namespace BlackCore
*/
void CContextNetwork::psFsdAtcControllerDisconnected(const CCallsign &callsign)
{
// this->log(Q_FUNC_INFO, callsign.toQString());
this->m_atcStationsOnline.removeIf(&CAtcStation::getCallsign, callsign);
emit this->changedAtcStationsOnline();
this->m_atcStationsBooked.applyIf(&CAtcStation::getCallsign, callsign, CIndexVariantMap(CAtcStation::IndexIsOnline, QVariant(false)));

View File

@@ -328,4 +328,13 @@ namespace BlackCore
if (this->m_vatsimDataFileReader->interval() < interval) this->m_vatsimDataFileReader->setInterval(interval);
}
/*
* Radio text message received
*/
void CContextNetwork::psFsdTextMessageReceived(const CTextMessageList &messages)
{
if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, messages.toQString());
this->textMessagesReceived(messages); // relay
}
} // namespace

View File

@@ -23,7 +23,7 @@ namespace BlackCore
class CVatsimBookingReader;
class CVatsimDataFileReader;
//! \brief Network context implementation
//! Network context implementation
class CContextNetwork : public IContextNetwork
{
Q_OBJECT
@@ -136,28 +136,28 @@ namespace BlackCore
CVatsimDataFileReader *m_vatsimDataFileReader;
QTimer *m_dataUpdateTimer; //!< general updates such as ATIS, frequencies, see requestDataUpdates()
//! \brief Replace value by new values
//! Replace value by new values
void setAtcStationsBooked(const BlackMisc::Aviation::CAtcStationList &newStations);
//! \brief Replace value by new values
//! Replace value by new values
void setAtcStationsOnline(const BlackMisc::Aviation::CAtcStationList &newStations);
//! \brief The "central" ATC list with online ATC controllers
//! The "central" ATC list with online ATC controllers
BlackMisc::Aviation::CAtcStationList &atcStationsOnline()
{
return m_atcStationsOnline;
}
//! \brief ATC list, with booked controllers
//! ATC list, with booked controllers
BlackMisc::Aviation::CAtcStationList &atcStationsBooked()
{
return m_atcStationsBooked;
}
//! \brief Init my very onw aircraft
//! Init my very own aircraft
void initOwnAircraft();
//! \brief Get network settings
//! Get network settings
BlackMisc::Settings::CSettingsNetwork getNetworkSettings() const
{
Q_ASSERT(this->getRuntime());
@@ -166,10 +166,10 @@ namespace BlackCore
}
private slots:
//! \brief ATC bookings received
//! ATC bookings received
void psReceivedBookings(BlackMisc::Aviation::CAtcStationList bookedStations);
//! \brief Data file has been read
//! Data file has been read
void psDataFileRead();
/*!
@@ -179,7 +179,7 @@ namespace BlackCore
*/
void psFsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message);
//! \brief ATC position update
//! ATC position update
void psFsdAtcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range);
/*!
@@ -188,7 +188,7 @@ namespace BlackCore
*/
void psFsdAtcControllerDisconnected(const BlackMisc::Aviation::CCallsign &callsign);
//! \brief ATIS received
//! ATIS received
void psFsdAtisQueryReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atisMessage);
/*!
@@ -205,25 +205,25 @@ namespace BlackCore
*/
void psFsdAtisLogoffTimeQueryReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &zuluTime);
//! \brief METAR received
//! METAR received
void psFsdMetarReceived(const QString &metarMessage);
//! \brief Realname recevied
//! Realname recevied
void psFsdRealNameReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &realname);
//! \brief Plane ICAO codes received
//! Plane ICAO codes received
void psFsdIcaoCodesReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftIcao &icaoData);
//! \brief Aircraft position update received
//! Aircraft position update received
void psFsdAircraftUpdateReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CTransponder &transponder);
//! \brief Pilot disconnected
//! Pilot disconnected
void psFsdPilotDisconnected(const BlackMisc::Aviation::CCallsign &callsign);
//! \brief Frequency received
//! Frequency received
void psFsdFrequencyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency);
//! \brief Radio text messages received
//! Radio text messages received
void psFsdTextMessageReceived(const BlackMisc::Network::CTextMessageList &messages);
};
}

View File

@@ -1,27 +0,0 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "context_network_impl.h"
#include "context_runtime.h"
using namespace BlackMisc;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Network;
using namespace BlackMisc::Geo;
namespace BlackCore
{
/*
* Radio text message received
*/
void CContextNetwork::psFsdTextMessageReceived(const CTextMessageList &messages)
{
if (messages.isEmpty()) return;
// this->log(Q_FUNC_INFO, messages.toQString());
this->textMessagesReceived(messages); // relay
}
} // namespace

View File

@@ -910,13 +910,13 @@ namespace BlackCore
quint32 flags = 0;
while (*keysValues)
{
const char *key = keysValues[0];
const QString key(keysValues[0]);
const char *value = keysValues[1];
if (*value == '1')
{
if (key == net->capability_AtcInfo) { flags |= AcceptsAtisResponses; }
if (key == net->capability_AtcInfo) { flags |= AcceptsAtisResponses; }
else if (key == net->capability_InterimPos) { flags |= SupportsInterimPosUpdates; }
else if (key == net->capability_ModelDesc) { flags |= SupportsModelDescriptions; }
else if (key == net->capability_ModelDesc) { flags |= SupportsModelDescriptions; }
}
keysValues += 2;
}