refs #316 Changed blackcore to use CLogMessage to emit messages.

Also changed functions which always returned CStatusMessageList containing a single CStatusMessage,
to return CStatusMessage instead for simplicity.
This commit is contained in:
Mathew Sutcliffe
2014-09-25 20:41:21 +01:00
parent b16b02c3d6
commit 5d123f798a
24 changed files with 178 additions and 190 deletions

View File

@@ -13,6 +13,7 @@
#include "blackmisc/notificationsounds.h"
#include "blackmisc/voiceroomlist.h"
#include "blackmisc/hotkeyfunction.h"
#include "blackmisc/logmessage.h"
#include <QTimer>
@@ -76,7 +77,7 @@ namespace BlackCore
CVoiceRoomList CContextAudio::getComVoiceRoomsWithAudioStatus() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return getComVoiceRooms();
}
@@ -86,7 +87,7 @@ namespace BlackCore
CVoiceRoom CContextAudio::getCom1VoiceRoom(bool withAudioStatus) const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, withAudioStatus);
CLogMessage().debug(this) << Q_FUNC_INFO << withAudioStatus;
// We always have the audio status due to shared status
return m_channelCom1->getVoiceRoom();
}
@@ -97,7 +98,7 @@ namespace BlackCore
CVoiceRoom CContextAudio::getCom2VoiceRoom(bool withAudioStatus) const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, withAudioStatus);
CLogMessage().debug(this) << Q_FUNC_INFO << withAudioStatus;
// We always have the audio status due to shared status
return m_channelCom2->getVoiceRoom();
}
@@ -108,7 +109,7 @@ namespace BlackCore
CVoiceRoomList CContextAudio::getComVoiceRooms() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
CVoiceRoomList voiceRoomList;
voiceRoomList.push_back(m_channelCom1->getVoiceRoom());
voiceRoomList.push_back(m_channelCom2->getVoiceRoom());
@@ -121,7 +122,7 @@ namespace BlackCore
void CContextAudio::leaveAllVoiceRooms()
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
m_channelCom1->leaveVoiceRoom();
m_channelCom2->leaveVoiceRoom();
}
@@ -132,7 +133,7 @@ namespace BlackCore
CAudioDeviceList CContextAudio::getAudioDevices() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return this->m_voice->audioDevices();
}
@@ -142,7 +143,7 @@ namespace BlackCore
CAudioDeviceList CContextAudio::getCurrentAudioDevices() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
CAudioDeviceList devices;
devices.push_back(this->m_voice->getCurrentInputDevice());
devices.push_back(this->m_voice->getCurrentOutputDevice());
@@ -156,7 +157,7 @@ namespace BlackCore
{
Q_ASSERT(this->m_voice);
Q_ASSERT(audioDevice.getType() != CAudioDevice::Unknown);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, audioDevice.toQString());
CLogMessage().debug(this) << Q_FUNC_INFO << audioDevice;
if (audioDevice.getType() == CAudioDevice::InputDevice)
{
this->m_voice->setInputDevice(audioDevice);
@@ -173,7 +174,7 @@ namespace BlackCore
void CContextAudio::setVolumes(const CComSystem &com1, const CComSystem &com2)
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, { com1.toQString(), com2.toQString() });
CLogMessage().debug(this) << Q_FUNC_INFO << com1 << com2;
// volumes
qint32 vol1 = com1.getVolumeOutput();
@@ -192,7 +193,7 @@ namespace BlackCore
bool CContextAudio::isMuted() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return m_channelCom1->isMuted() && m_channelCom2->isMuted();
}
@@ -203,7 +204,7 @@ namespace BlackCore
{
Q_ASSERT(this->m_voice);
Q_ASSERT(newRooms.size() == 2);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, newRooms.toQString());
CLogMessage().debug(this) << Q_FUNC_INFO << newRooms;
CVoiceRoomList currentRooms = getComVoiceRooms();
CVoiceRoom currentRoom1 = currentRooms[0];
@@ -244,7 +245,7 @@ namespace BlackCore
CCallsignList CContextAudio::getCom1RoomCallsigns() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return m_channelCom1->getVoiceRoomCallsigns();
}
@@ -254,7 +255,7 @@ namespace BlackCore
CCallsignList CContextAudio::getCom2RoomCallsigns() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return m_channelCom2->getVoiceRoomCallsigns();
}
@@ -266,7 +267,7 @@ namespace BlackCore
Q_ASSERT(this->m_voice);
Q_ASSERT(this->getRuntime());
if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList();
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return this->getIContextNetwork()->getUsersForCallsigns(this->getCom1RoomCallsigns());
}
@@ -278,7 +279,7 @@ namespace BlackCore
Q_ASSERT(this->m_voice);
Q_ASSERT(this->getRuntime());
if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList();
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return this->getIContextNetwork()->getUsersForCallsigns(this->getCom2RoomCallsigns());
}
@@ -288,7 +289,7 @@ namespace BlackCore
void CContextAudio::playSelcalTone(const CSelcal &selcal) const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, selcal.toQString());
CLogMessage().debug(this) << Q_FUNC_INFO << selcal;
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice);
}
@@ -299,7 +300,7 @@ namespace BlackCore
void CContextAudio::playNotification(uint notification, bool considerSettings) const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO, QString::number(notification));
CLogMessage().debug(this) << Q_FUNC_INFO << notification;
auto notificationSound = static_cast<BlackSound::CNotificationSounds::Notification>(notification);
if (considerSettings)
@@ -326,7 +327,7 @@ namespace BlackCore
void CContextAudio::runMicrophoneTest()
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
this->m_voice->runMicrophoneTest();
}
@@ -336,7 +337,7 @@ namespace BlackCore
void CContextAudio::runSquelchTest()
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
this->m_voice->runSquelchTest();
}
@@ -346,7 +347,7 @@ namespace BlackCore
QString CContextAudio::getMicrophoneTestResult() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return this->m_voice->micTestResultAsString();
}
@@ -356,7 +357,7 @@ namespace BlackCore
double CContextAudio::getSquelchValue() const
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
return static_cast<double>(this->m_voice->inputSquelch());
}
@@ -366,7 +367,7 @@ namespace BlackCore
void CContextAudio::enableAudioLoopback(bool enable)
{
Q_ASSERT(this->m_voice);
this->getRuntime()->logSlot(c_logContext, Q_FUNC_INFO);
CLogMessage().debug(this) << Q_FUNC_INFO;
m_voice->enableAudioLoopback(enable);
}