refs #315 Removed old/deprecated CRuntime::logSlot, changed contexts to use new CRuntime::logSlot.

Network context was already using new CRuntime::logSlot as of commit:81c68058.
This commit is contained in:
Mathew Sutcliffe
2014-08-18 00:18:04 +01:00
parent 45f23127bb
commit 96ca38a3db
10 changed files with 57 additions and 62 deletions

View File

@@ -49,7 +49,7 @@ namespace BlackCore
*/ */
void CContextApplication::notifyAboutComponentChange(uint component, uint action) void CContextApplication::notifyAboutComponentChange(uint component, uint action)
{ {
if (this->getRuntime()->isSlotLogForApplicationEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(component), QString::number(action)); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { QString::number(component), QString::number(action) });
this->componentChanged(component, action); this->componentChanged(component, action);
} }
@@ -58,7 +58,7 @@ namespace BlackCore
*/ */
bool CContextApplication::writeToFile(const QString &fileName, const QString &content) bool CContextApplication::writeToFile(const QString &fileName, const QString &content)
{ {
if (this->getRuntime()->isSlotLogForApplicationEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, fileName, content.left(25)); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { fileName, content.left(25) });
if (fileName.isEmpty()) return false; if (fileName.isEmpty()) return false;
QFile file(fileName); QFile file(fileName);
bool success = false; bool success = false;
@@ -76,7 +76,7 @@ namespace BlackCore
*/ */
QString CContextApplication::readFromFile(const QString &fileName) QString CContextApplication::readFromFile(const QString &fileName)
{ {
if (this->getRuntime()->isSlotLogForApplicationEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, fileName); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, fileName);
QFile file(fileName); QFile file(fileName);
QString content; QString content;
if (fileName.isEmpty()) return content; if (fileName.isEmpty()) return content;

View File

@@ -50,6 +50,8 @@ namespace BlackCore
virtual bool existsFile(const QString &fileName) override; virtual bool existsFile(const QString &fileName) override;
protected: protected:
static const auto c_logContext = CRuntime::LogForApplication;
//! Constructor //! Constructor
CContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime); CContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime);

View File

@@ -76,7 +76,7 @@ namespace BlackCore
CVoiceRoomList CContextAudio::getComVoiceRoomsWithAudioStatus() const CVoiceRoomList CContextAudio::getComVoiceRoomsWithAudioStatus() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return getComVoiceRooms(); return getComVoiceRooms();
} }
@@ -86,7 +86,7 @@ namespace BlackCore
CVoiceRoom CContextAudio::getCom1VoiceRoom(bool withAudioStatus) const CVoiceRoom CContextAudio::getCom1VoiceRoom(bool withAudioStatus) const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, withAudioStatus);
// We always have the audio status due to shared status // We always have the audio status due to shared status
return m_channelCom1->getVoiceRoom(); return m_channelCom1->getVoiceRoom();
} }
@@ -97,7 +97,7 @@ namespace BlackCore
CVoiceRoom CContextAudio::getCom2VoiceRoom(bool withAudioStatus) const CVoiceRoom CContextAudio::getCom2VoiceRoom(bool withAudioStatus) const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, withAudioStatus);
// We always have the audio status due to shared status // We always have the audio status due to shared status
return m_channelCom2->getVoiceRoom(); return m_channelCom2->getVoiceRoom();
} }
@@ -108,7 +108,7 @@ namespace BlackCore
CVoiceRoomList CContextAudio::getComVoiceRooms() const CVoiceRoomList CContextAudio::getComVoiceRooms() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CVoiceRoomList voiceRoomList; CVoiceRoomList voiceRoomList;
voiceRoomList.push_back(m_channelCom1->getVoiceRoom()); voiceRoomList.push_back(m_channelCom1->getVoiceRoom());
voiceRoomList.push_back(m_channelCom2->getVoiceRoom()); voiceRoomList.push_back(m_channelCom2->getVoiceRoom());
@@ -121,7 +121,7 @@ namespace BlackCore
void CContextAudio::leaveAllVoiceRooms() void CContextAudio::leaveAllVoiceRooms()
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
m_channelCom1->leaveVoiceRoom(); m_channelCom1->leaveVoiceRoom();
m_channelCom2->leaveVoiceRoom(); m_channelCom2->leaveVoiceRoom();
} }
@@ -132,7 +132,7 @@ namespace BlackCore
CAudioDeviceList CContextAudio::getAudioDevices() const CAudioDeviceList CContextAudio::getAudioDevices() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return this->m_voice->audioDevices(); return this->m_voice->audioDevices();
} }
@@ -142,7 +142,7 @@ namespace BlackCore
CAudioDeviceList CContextAudio::getCurrentAudioDevices() const CAudioDeviceList CContextAudio::getCurrentAudioDevices() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CAudioDeviceList devices; CAudioDeviceList devices;
devices.push_back(this->m_voice->getCurrentInputDevice()); devices.push_back(this->m_voice->getCurrentInputDevice());
devices.push_back(this->m_voice->getCurrentOutputDevice()); devices.push_back(this->m_voice->getCurrentOutputDevice());
@@ -156,7 +156,7 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
Q_ASSERT(audioDevice.getType() != CAudioDevice::Unknown); Q_ASSERT(audioDevice.getType() != CAudioDevice::Unknown);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, audioDevice.toQString()); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, audioDevice.toQString());
if (audioDevice.getType() == CAudioDevice::InputDevice) if (audioDevice.getType() == CAudioDevice::InputDevice)
{ {
this->m_voice->setInputDevice(audioDevice); this->m_voice->setInputDevice(audioDevice);
@@ -173,7 +173,7 @@ namespace BlackCore
void CContextAudio::setVolumes(const CComSystem &com1, const CComSystem &com2) void CContextAudio::setVolumes(const CComSystem &com1, const CComSystem &com2)
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, com1.toQString(), com2.toQString()); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { com1.toQString(), com2.toQString() });
// volumes // volumes
qint32 vol1 = com1.getVolumeOutput(); qint32 vol1 = com1.getVolumeOutput();
@@ -192,7 +192,7 @@ namespace BlackCore
bool CContextAudio::isMuted() const bool CContextAudio::isMuted() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return m_channelCom1->isMuted() && m_channelCom2->isMuted(); return m_channelCom1->isMuted() && m_channelCom2->isMuted();
} }
@@ -203,7 +203,7 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
Q_ASSERT(newRooms.size() == 2); Q_ASSERT(newRooms.size() == 2);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, newRooms.toQString()); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, newRooms.toQString());
CVoiceRoomList currentRooms = getComVoiceRooms(); CVoiceRoomList currentRooms = getComVoiceRooms();
CVoiceRoom currentRoom1 = currentRooms[0]; CVoiceRoom currentRoom1 = currentRooms[0];
@@ -244,7 +244,7 @@ namespace BlackCore
CCallsignList CContextAudio::getCom1RoomCallsigns() const CCallsignList CContextAudio::getCom1RoomCallsigns() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return m_channelCom1->getVoiceRoomCallsigns(); return m_channelCom1->getVoiceRoomCallsigns();
} }
@@ -254,7 +254,7 @@ namespace BlackCore
CCallsignList CContextAudio::getCom2RoomCallsigns() const CCallsignList CContextAudio::getCom2RoomCallsigns() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return m_channelCom2->getVoiceRoomCallsigns(); return m_channelCom2->getVoiceRoomCallsigns();
} }
@@ -266,7 +266,7 @@ namespace BlackCore
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
Q_ASSERT(this->getRuntime()); Q_ASSERT(this->getRuntime());
if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList(); if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList();
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return this->getIContextNetwork()->getUsersForCallsigns(this->getCom1RoomCallsigns()); return this->getIContextNetwork()->getUsersForCallsigns(this->getCom1RoomCallsigns());
} }
@@ -278,7 +278,7 @@ namespace BlackCore
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
Q_ASSERT(this->getRuntime()); Q_ASSERT(this->getRuntime());
if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList(); if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList();
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return this->getIContextNetwork()->getUsersForCallsigns(this->getCom2RoomCallsigns()); return this->getIContextNetwork()->getUsersForCallsigns(this->getCom2RoomCallsigns());
} }
@@ -288,7 +288,7 @@ namespace BlackCore
void CContextAudio::playSelcalTone(const CSelcal &selcal) const void CContextAudio::playSelcalTone(const CSelcal &selcal) const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, selcal.toQString()); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, selcal.toQString());
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice(); CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice); BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice);
} }
@@ -299,7 +299,7 @@ namespace BlackCore
void CContextAudio::playNotification(uint notification, bool considerSettings) const void CContextAudio::playNotification(uint notification, bool considerSettings) const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(notification)); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, QString::number(notification));
BlackSound::CNotificationSounds::Notification notificationSound = static_cast<BlackSound::CNotificationSounds::Notification>(notification); BlackSound::CNotificationSounds::Notification notificationSound = static_cast<BlackSound::CNotificationSounds::Notification>(notification);
if (considerSettings) if (considerSettings)
@@ -326,7 +326,7 @@ namespace BlackCore
void CContextAudio::runMicrophoneTest() void CContextAudio::runMicrophoneTest()
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
this->m_voice->runMicrophoneTest(); this->m_voice->runMicrophoneTest();
} }
@@ -336,7 +336,7 @@ namespace BlackCore
void CContextAudio::runSquelchTest() void CContextAudio::runSquelchTest()
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
this->m_voice->runSquelchTest(); this->m_voice->runSquelchTest();
} }
@@ -346,7 +346,7 @@ namespace BlackCore
QString CContextAudio::getMicrophoneTestResult() const QString CContextAudio::getMicrophoneTestResult() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return this->m_voice->micTestResultAsString(); return this->m_voice->micTestResultAsString();
} }
@@ -356,7 +356,7 @@ namespace BlackCore
double CContextAudio::getSquelchValue() const double CContextAudio::getSquelchValue() const
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
return static_cast<double>(this->m_voice->inputSquelch()); return static_cast<double>(this->m_voice->inputSquelch());
} }
@@ -366,7 +366,7 @@ namespace BlackCore
void CContextAudio::enableAudioLoopback(bool enable) void CContextAudio::enableAudioLoopback(bool enable)
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
m_voice->enableAudioLoopback(enable); m_voice->enableAudioLoopback(enable);
} }

View File

@@ -131,6 +131,8 @@ namespace BlackCore
void ps_initNotificationSounds(); void ps_initNotificationSounds();
private: private:
static const auto c_logContext = CRuntime::LogForAudio;
//! Connection in transition //! Connection in transition
bool inTransitionState() const; bool inTransitionState() const;

View File

@@ -70,7 +70,7 @@ namespace BlackCore
*/ */
void CContextOwnAircraft::resolveVoiceRooms() void CContextOwnAircraft::resolveVoiceRooms()
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
if (this->m_voiceRoom1UrlOverride.isEmpty() && this->m_voiceRoom2UrlOverride.isEmpty() && !this->m_automaticVoiceRoomResolution) return; if (this->m_voiceRoom1UrlOverride.isEmpty() && this->m_voiceRoom2UrlOverride.isEmpty() && !this->m_automaticVoiceRoomResolution) return;
if (!this->getIContextNetwork()) return; // no chance to resolve rooms if (!this->getIContextNetwork()) return; // no chance to resolve rooms
if (!this->getIContextAudio()) return; // no place to set rooms if (!this->getIContextAudio()) return; // no place to set rooms
@@ -95,7 +95,7 @@ namespace BlackCore
*/ */
void CContextOwnAircraft::updateOwnAircraft(const BlackMisc::Aviation::CAircraft &aircraft, const QString &originator) void CContextOwnAircraft::updateOwnAircraft(const BlackMisc::Aviation::CAircraft &aircraft, const QString &originator)
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, ownAircraft().toQString(), originator); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { ownAircraft().toQString(), originator });
// trigger the correct signals // trigger the correct signals
bool changedCockpit = this->updateOwnCockpit(aircraft.getCom1System(), aircraft.getCom2System(), aircraft.getTransponder(), originator); bool changedCockpit = this->updateOwnCockpit(aircraft.getCom1System(), aircraft.getCom2System(), aircraft.getTransponder(), originator);
@@ -122,7 +122,7 @@ namespace BlackCore
*/ */
bool CContextOwnAircraft::updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude, const QString &originator) bool CContextOwnAircraft::updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude, const QString &originator)
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, position.toQString(), altitude.toQString(), originator); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { position.toQString(), altitude.toQString(), originator });
bool changed = (this->m_ownAircraft.getPosition() != position); bool changed = (this->m_ownAircraft.getPosition() != position);
if (changed) this->m_ownAircraft.setPosition(position); if (changed) this->m_ownAircraft.setPosition(position);
@@ -145,7 +145,7 @@ namespace BlackCore
*/ */
bool CContextOwnAircraft::updateOwnSituation(const BlackMisc::Aviation::CAircraftSituation &situation, const QString &originator) bool CContextOwnAircraft::updateOwnSituation(const BlackMisc::Aviation::CAircraftSituation &situation, const QString &originator)
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, situation.toQString()); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, situation.toQString());
bool changed = this->m_ownAircraft.getSituation() != situation; bool changed = this->m_ownAircraft.getSituation() != situation;
if (!changed) return changed; if (!changed) return changed;
@@ -163,7 +163,7 @@ namespace BlackCore
*/ */
bool CContextOwnAircraft::updateOwnCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder, const QString &originator) bool CContextOwnAircraft::updateOwnCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder, const QString &originator)
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, com1.toQString(), com2.toQString(), transponder.toQString()); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { com1.toQString(), com2.toQString(), transponder.toQString() });
bool changed = this->m_ownAircraft.hasChangedCockpitData(com1, com2, transponder); bool changed = this->m_ownAircraft.hasChangedCockpitData(com1, com2, transponder);
if (changed) if (changed)
{ {
@@ -185,7 +185,7 @@ namespace BlackCore
void CContextOwnAircraft::setAudioOutputVolumes(int outputVolumeCom1, int outputVolumeCom2) void CContextOwnAircraft::setAudioOutputVolumes(int outputVolumeCom1, int outputVolumeCom2)
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(outputVolumeCom1), QString::number(outputVolumeCom2)); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { QString::number(outputVolumeCom1), QString::number(outputVolumeCom2) });
CComSystem com1 = this->m_ownAircraft.getCom1System(); CComSystem com1 = this->m_ownAircraft.getCom1System();
com1.setVolumeOutput(outputVolumeCom1); com1.setVolumeOutput(outputVolumeCom1);
@@ -215,7 +215,7 @@ namespace BlackCore
*/ */
void CContextOwnAircraft::setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url) void CContextOwnAircraft::setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url)
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, voiceRoom1Url, voiceRoom2Url); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { voiceRoom1Url, voiceRoom2Url });
this->m_voiceRoom1UrlOverride = voiceRoom1Url.trimmed(); this->m_voiceRoom1UrlOverride = voiceRoom1Url.trimmed();
this->m_voiceRoom2UrlOverride = voiceRoom2Url.trimmed(); this->m_voiceRoom2UrlOverride = voiceRoom2Url.trimmed();
@@ -227,7 +227,7 @@ namespace BlackCore
*/ */
void CContextOwnAircraft::enableAutomaticVoiceRoomResolution(bool enable) void CContextOwnAircraft::enableAutomaticVoiceRoomResolution(bool enable)
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, enable); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, enable);
this->m_automaticVoiceRoomResolution = enable; this->m_automaticVoiceRoomResolution = enable;
} }
@@ -236,7 +236,7 @@ namespace BlackCore
*/ */
CAircraft CContextOwnAircraft::getOwnAircraft() const CAircraft CContextOwnAircraft::getOwnAircraft() const
{ {
if (this->getRuntime()->isSlotLogForOwnAircraftEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, this->m_ownAircraft.toQString()); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, this->m_ownAircraft.toQString());
return this->m_ownAircraft; return this->m_ownAircraft;
} }

View File

@@ -79,6 +79,8 @@ namespace BlackCore
void ps_changedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &atcStation, bool connected); void ps_changedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &atcStation, bool connected);
private: private:
static const auto c_logContext = CRuntime::LogForOwnAircraft;
BlackMisc::Aviation::CAircraft m_ownAircraft; //!< my aircraft BlackMisc::Aviation::CAircraft m_ownAircraft; //!< my aircraft
bool m_automaticVoiceRoomResolution; //!< voice room override bool m_automaticVoiceRoomResolution; //!< voice room override
QString m_voiceRoom1UrlOverride; //!< overridden voice room url QString m_voiceRoom1UrlOverride; //!< overridden voice room url

View File

@@ -247,15 +247,6 @@ namespace BlackCore
qDebug() << "signal" << s << values; qDebug() << "signal" << s << values;
} }
void CRuntime::logSlot(const char *func, const QString &p1, const QString &p2, const QString &p3, const QString &p4) const
{
if (p1.isEmpty()) { qDebug() << func; return; }
if (p2.isEmpty()) { qDebug() << func << p1; return; }
if (p3.isEmpty()) { qDebug() << func << p1 << p2; return; }
if (p4.isEmpty()) { qDebug() << func << p1 << p2 << p3; return; }
qDebug() << func << p1 << p2 << p3 << p4;
}
void CRuntime::logSlot(const char *func, const QString &param) const void CRuntime::logSlot(const char *func, const QString &param) const
{ {
qDebug() << func << param; qDebug() << func << param;

View File

@@ -190,19 +190,6 @@ namespace BlackCore
//! \threadsafe //! \threadsafe
bool isSlotLogEnabledFor(LogContext context) const; bool isSlotLogEnabledFor(LogContext context) const;
//! Slot logging
//! \deprecated Use a brace-initialized QStringList
void logSlot(const char *func, const QString &param, const QString &p2, const QString &p3 = "", const QString &p4 = "") const;
//! Slot logging
void logSlot(const char *func, const QString &param = "") const;
//! Slot logging
void logSlot(const char *func, const QStringList &params) const;
//! Slot logging for bool value
void logSlot(const char *func, bool boolValue) const;
//! Slot logging from a specific context //! Slot logging from a specific context
void logSlot(LogContext ctx, const char *func, const QString &param = "") const; void logSlot(LogContext ctx, const char *func, const QString &param = "") const;
@@ -352,6 +339,15 @@ namespace BlackCore
//! disconnect log signals (connected via connection to log them) //! disconnect log signals (connected via connection to log them)
void disconnectLogSignals(const QString &name); void disconnectLogSignals(const QString &name);
//! Slot logging
void logSlot(const char *func, const QString &param = "") const;
//! Slot logging
void logSlot(const char *func, const QStringList &params) const;
//! Slot logging for bool value
void logSlot(const char *func, bool boolValue) const;
}; };
} }
#endif // guard #endif // guard

View File

@@ -51,42 +51,42 @@ namespace BlackCore
bool CContextSimulator::isConnected() const bool CContextSimulator::isConnected() const
{ {
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
if (!m_simulator) return false; if (!m_simulator) return false;
return m_simulator->isConnected(); return m_simulator->isConnected();
} }
bool CContextSimulator::canConnect() bool CContextSimulator::canConnect()
{ {
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
if (!m_simulator) return false; if (!m_simulator) return false;
return m_simulator->canConnect(); return m_simulator->canConnect();
} }
bool CContextSimulator::connectTo() bool CContextSimulator::connectTo()
{ {
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
if (!m_simulator) return false; if (!m_simulator) return false;
return m_simulator->connectTo(); return m_simulator->connectTo();
} }
void CContextSimulator::asyncConnectTo() void CContextSimulator::asyncConnectTo()
{ {
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
if (!m_simulator || m_canConnectResult.isRunning()) return; // already checking if (!m_simulator || m_canConnectResult.isRunning()) return; // already checking
m_simulator->asyncConnectTo(); m_simulator->asyncConnectTo();
} }
bool CContextSimulator::disconnectFrom() bool CContextSimulator::disconnectFrom()
{ {
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
if (!m_simulator) return false; if (!m_simulator) return false;
return m_simulator->disconnectFrom(); return m_simulator->disconnectFrom();
} }
BlackSim::CSimulatorInfo CContextSimulator::getSimulatorInfo() const BlackSim::CSimulatorInfo CContextSimulator::getSimulatorInfo() const
{ {
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
if (!m_simulator) return BlackSim::CSimulatorInfo::UnspecifiedSim(); if (!m_simulator) return BlackSim::CSimulatorInfo::UnspecifiedSim();
return m_simulator->getSimulatorInfo(); return m_simulator->getSimulatorInfo();
} }

View File

@@ -122,6 +122,8 @@ namespace BlackCore
void ps_textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages); void ps_textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
private: private:
static const auto c_logContext = CRuntime::LogForSimulator;
//! \brief find and catalog all simulator plugins //! \brief find and catalog all simulator plugins
void findSimulatorPlugins(); void findSimulatorPlugins();