mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Formatting, comments, minor tweaks, typos, Doxygen
This commit is contained in:
@@ -93,11 +93,11 @@ namespace BlackCore
|
||||
void statusMessage(const BlackMisc::CStatusMessage &message);
|
||||
|
||||
//! Send status messages
|
||||
//! \remarks not to be called directly, use IContextApplication::sendStatusMessages
|
||||
//! \remarks not to be called directly, use IContextApplication::sendStatusMessage(s)
|
||||
void statusMessages(const BlackMisc::CStatusMessageList &messages);
|
||||
|
||||
//! Redirect output streams as by qDebug(), qWarning(), qCritical()
|
||||
//! \remarks context mode is an important means to avoid infinite redirect loops
|
||||
//! \remarks context id is an important means to avoid infinite redirect loops
|
||||
//! never output redirected stream messages from the same context again
|
||||
void redirectedOutput(const BlackMisc::CStatusMessage &message, qint64 contextId);
|
||||
|
||||
|
||||
@@ -223,7 +223,6 @@ namespace BlackCore
|
||||
Q_ASSERT(this->m_voice);
|
||||
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
CCallsignList callsigns = this->m_voice->getVoiceRoomCallsigns(IVoice::COM1);
|
||||
qDebug() << "1" << callsigns;
|
||||
return callsigns;
|
||||
}
|
||||
|
||||
@@ -235,7 +234,6 @@ namespace BlackCore
|
||||
Q_ASSERT(this->m_voice);
|
||||
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
CCallsignList callsigns = this->m_voice->getVoiceRoomCallsigns(IVoice::COM2);
|
||||
qDebug() << "2" << callsigns;
|
||||
return callsigns;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace BlackCore
|
||||
this->m_network->sendIcaoCodesQuery(callsign);
|
||||
this->m_network->sendCapabilitiesQuery(callsign);
|
||||
this->m_network->sendServerQuery(callsign);
|
||||
this->sendFsipirCustomPackage(callsign);
|
||||
this->sendFsipirCustomPackage(callsign); // own aircraft model
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -53,9 +53,9 @@ namespace BlackCore
|
||||
dataFileUrls << "http://info.vroute.net/vatsim-data.txt";
|
||||
this->m_vatsimDataFileReader = new CVatsimDataFileReader(dataFileUrls, this);
|
||||
this->connect(this->m_vatsimDataFileReader, &CVatsimDataFileReader::dataRead, this, &CContextNetwork::psDataFileRead);
|
||||
this->m_vatsimDataFileReader->setInterval(5 * 1000); // first read
|
||||
this->m_vatsimDataFileReader->setInterval(5 * 1000); // first read, will be fixed when first read to longer period
|
||||
|
||||
// 5. Update timer for data
|
||||
// 5. Update timer for data (network data such as frequency)
|
||||
this->m_dataUpdateTimer = new QTimer(this);
|
||||
this->connect(this->m_dataUpdateTimer, &QTimer::timeout, this, &CContextNetwork::requestDataUpdates);
|
||||
this->m_dataUpdateTimer->start(30 * 1000);
|
||||
@@ -126,7 +126,7 @@ namespace BlackCore
|
||||
{
|
||||
msgs.push_back(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "Invalid user credentials"));
|
||||
}
|
||||
else if (!this->ownAircraft().getIcaoInfo().hasAircraftAndAirlineDsignator())
|
||||
else if (!this->ownAircraft().getIcaoInfo().hasAircraftAndAirlineDesignator())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "Invalid ICAO data for own aircraft"));
|
||||
}
|
||||
@@ -453,6 +453,7 @@ namespace BlackCore
|
||||
if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
const int interval = 60 * 1000;
|
||||
if (this->m_vatsimDataFileReader->interval() < interval) this->m_vatsimDataFileReader->setInterval(interval);
|
||||
this->getIContextApplication()->sendStatusMessage(CStatusMessage::getInfoMessage("Read VATSIM data file", CStatusMessage::TypeTrafficNetwork));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -71,6 +71,7 @@ namespace BlackCore
|
||||
|
||||
private slots:
|
||||
//! Station has been changed, needed to tune in/out voice room
|
||||
//! Set in runtime
|
||||
void changedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &atcStation, bool connected);
|
||||
|
||||
private:
|
||||
|
||||
@@ -164,15 +164,15 @@ namespace BlackCore
|
||||
// connect signal / slots when enabled
|
||||
QMetaObject::Connection con;
|
||||
con = QObject::connect(this->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftSituation,
|
||||
[this](const BlackMisc::Aviation::CAircraft & aircraft, const QString & originator) { QStringList l; l << "changedAircraftSituation" << aircraft.toQString() << originator; this->logSignal(this->getIContextApplication(), l);});
|
||||
[this](const BlackMisc::Aviation::CAircraft & aircraft, const QString & originator) { QStringList l; l << "changedAircraftSituation" << aircraft.toQString() << originator; this->logSignal(this->getIContextOwnAircraft(), l);});
|
||||
this->m_logSignalConnections.insert("ownaircraft", con);
|
||||
|
||||
con = QObject::connect(this->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit,
|
||||
[this](const BlackMisc::Aviation::CAircraft & aircraft, const QString & originator) { QStringList l; l << "changedAircraftCockpit" << aircraft.toQString() << originator; this->logSignal(this->getIContextApplication(), l);});
|
||||
[this](const BlackMisc::Aviation::CAircraft & aircraft, const QString & originator) { QStringList l; l << "changedAircraftCockpit" << aircraft.toQString() << originator; this->logSignal(this->getIContextOwnAircraft(), l);});
|
||||
this->m_logSignalConnections.insert("ownaircraft", con);
|
||||
|
||||
con = QObject::connect(this->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftPosition,
|
||||
[this](const BlackMisc::Aviation::CAircraft & aircraft, const QString & originator) { QStringList l; l << "changedAircraftPosition" << aircraft.toQString() << originator; this->logSignal(this->getIContextApplication(), l);});
|
||||
[this](const BlackMisc::Aviation::CAircraft & aircraft, const QString & originator) { QStringList l; l << "changedAircraftPosition" << aircraft.toQString() << originator; this->logSignal(this->getIContextOwnAircraft(), l);});
|
||||
this->m_logSignalConnections.insert("ownaircraft", con);
|
||||
}
|
||||
else
|
||||
@@ -431,13 +431,21 @@ namespace BlackCore
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
|
||||
if (this->m_contextSimulator && this->m_contextSimulator->usingLocalObjects() && this->m_contextNetwork)
|
||||
if (this->m_contextSimulator && this->m_contextSimulator->usingLocalObjects() && this->getCContextSimulator()->m_simulator)
|
||||
{
|
||||
// only connect if simulator running locally, no round trips
|
||||
if (this->getCContextSimulator()->m_simulator)
|
||||
if (this->m_contextNetwork && this->m_contextNetwork->usingLocalObjects())
|
||||
{
|
||||
c = connect(this->m_contextNetwork, &IContextNetwork::changedAircraftSituation,
|
||||
this->getCContextSimulator()->m_simulator, &ISimulator::addAircraftSituation);
|
||||
this->getCContextSimulator(), &CContextSimulator::addAircraftSituation);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
|
||||
// only if own aircraft running locally
|
||||
if (this->m_contextOwnAircraft && this->m_contextOwnAircraft->usingLocalObjects())
|
||||
{
|
||||
c = connect(this->m_contextOwnAircraft, &IContextOwnAircraft::changedAircraftCockpit,
|
||||
this->getCContextSimulator(), &CContextSimulator::updateCockpitFromContext);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,10 +124,30 @@ namespace BlackCore
|
||||
{
|
||||
Q_ASSERT(this->getIContextOwnAircraft());
|
||||
CAircraft aircraft = m_simulator->getOwnAircraft();
|
||||
|
||||
// the methods will check, if an update is really required
|
||||
// these are local (non DBus) calls
|
||||
this->getIContextOwnAircraft()->updateOwnSituation(aircraft.getSituation(), IContextSimulator::InterfaceName());
|
||||
this->getIContextOwnAircraft()->updateOwnCockpit(aircraft.getCom1System(), aircraft.getCom2System(), aircraft.getTransponder(), IContextSimulator::InterfaceName());
|
||||
}
|
||||
|
||||
void CContextSimulator::addAircraftSituation(const CCallsign &callsign, const CAircraftSituation &initialSituation)
|
||||
{
|
||||
Q_ASSERT(this->m_simulator);
|
||||
this->m_simulator->addAircraftSituation(callsign, initialSituation);
|
||||
}
|
||||
|
||||
void CContextSimulator::updateCockpitFromContext(const CAircraft &ownAircraft, const QString &originator)
|
||||
{
|
||||
Q_ASSERT(this->m_simulator);
|
||||
|
||||
// avoid loops
|
||||
if (originator.isEmpty() || originator == IContextSimulator::InterfaceName()) return;
|
||||
|
||||
// update
|
||||
this->m_simulator->updateOwnCockpit(ownAircraft);
|
||||
}
|
||||
|
||||
void CContextSimulator::setConnectionStatus(ISimulator::Status status)
|
||||
{
|
||||
if (status == ISimulator::Connected)
|
||||
@@ -156,7 +176,8 @@ namespace BlackCore
|
||||
if (!QLibrary::isLibrary(fileName))
|
||||
continue;
|
||||
|
||||
QPluginLoader loader(m_pluginsDir.absoluteFilePath(fileName));
|
||||
QString pluginPath = m_pluginsDir.absoluteFilePath(fileName);
|
||||
QPluginLoader loader(pluginPath);
|
||||
QObject *plugin = loader.instance();
|
||||
if (plugin)
|
||||
{
|
||||
@@ -172,6 +193,7 @@ namespace BlackCore
|
||||
else
|
||||
{
|
||||
qDebug() << loader.errorString();
|
||||
qDebug() << "Also check if required dll/libs of plugin exists";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,10 @@ namespace BlackCore
|
||||
|
||||
//! \copydoc IContextSimulator::unloadSimulatorPlugin()
|
||||
virtual void unloadSimulatorPlugin() override;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace BlackCore
|
||||
|
||||
@@ -102,4 +102,4 @@ namespace BlackCore
|
||||
|
||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "net.vatsim.PilotClient.BlackCore.SimulatorInterface")
|
||||
|
||||
#endif // BLACKCORE_SIMULATOR_H
|
||||
#endif // guard
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace BlackCore
|
||||
this->m_outputEnabled.insert(COM2, true);
|
||||
this->m_currentInputDevice = this->defaultAudioInputDevice();
|
||||
this->m_currentOutputDevice = this->defaultAudioOutputDevice();
|
||||
this->m_audioOutput->setVolume(1.0);
|
||||
this->m_audioOutput->setVolume(1.0); // make sure the overall sound is not muted
|
||||
|
||||
// do processing
|
||||
this->startTimer(10);
|
||||
@@ -805,7 +805,7 @@ namespace BlackCore
|
||||
this->setVoiceRoomForUnit(comUnit, vr);
|
||||
}
|
||||
|
||||
// for disconnecting the voice room will already be
|
||||
// disconnecting the voice room will already be
|
||||
// set in leave voice room
|
||||
|
||||
m_connectionStatus.insert(comUnit, newStatus);
|
||||
|
||||
Reference in New Issue
Block a user