mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Updated CVoiceVatlib::getComVoiceRoomsWithAudioStatus() to const
Callsign split for user onRoomUserReceived Check in CVoiceVatlib::addTemporaryCallsignForRoom
This commit is contained in:
@@ -130,7 +130,7 @@ namespace BlackCore
|
||||
* Get COM1/2 voice rooms, which then allows to retrieve information
|
||||
* such as audio status etc.
|
||||
*/
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() = 0;
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const = 0;
|
||||
|
||||
/*!
|
||||
* Get COM1/2 voice rooms, const and with no status update
|
||||
|
||||
@@ -145,10 +145,10 @@ namespace BlackCore
|
||||
/*
|
||||
* Get voice rooms, with the latest status updated
|
||||
*/
|
||||
BlackMisc::Voice::CVoiceRoomList CVoiceVatlib::getComVoiceRoomsWithAudioStatus()
|
||||
BlackMisc::Voice::CVoiceRoomList CVoiceVatlib::getComVoiceRoomsWithAudioStatus() const
|
||||
{
|
||||
Q_ASSERT_X(m_voiceRooms.size() == 2, "CVoiceClientVatlib", "Wrong numer of COM voice rooms");
|
||||
|
||||
CVoiceRoomList voiceRooms;
|
||||
if (m_voice->IsValid() && m_voice->IsSetup())
|
||||
{
|
||||
// valid state, update
|
||||
@@ -158,10 +158,16 @@ namespace BlackCore
|
||||
com2.setConnected(m_voice->IsRoomConnected(static_cast<qint32>(COM2)));
|
||||
com1.setAudioPlaying(com1.isConnected() ? m_voice->IsAudioPlaying(static_cast<qint32>(COM1)) : false);
|
||||
com2.setAudioPlaying(com2.isConnected() ? m_voice->IsAudioPlaying(static_cast<qint32>(COM2)) : false);
|
||||
this->setVoiceRoomForUnit(COM1, com1);
|
||||
this->setVoiceRoomForUnit(COM2, com2);
|
||||
voiceRooms.push_back(com1);
|
||||
voiceRooms.push_back(com2);
|
||||
}
|
||||
return this->m_voiceRooms;
|
||||
else
|
||||
{
|
||||
CVoiceRoom def;
|
||||
voiceRooms.push_back(def);
|
||||
voiceRooms.push_back(def);
|
||||
}
|
||||
return voiceRooms;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -524,7 +530,7 @@ namespace BlackCore
|
||||
m_voice->GetRoomUserList(static_cast<qint32>(comUnit), onRoomUserReceived, this);
|
||||
m_temporaryUserRoomIndex = CVoiceVatlib::InvalidRoomIndex; // reset
|
||||
|
||||
// we have all current users in m_voi
|
||||
// we have all current users in m_temporaryVoiceRoomCallsigns
|
||||
foreach(CCallsign callsign, m_voiceRoomCallsigns.value(comUnit))
|
||||
{
|
||||
if (!m_temporaryVoiceRoomCallsigns.contains(callsign))
|
||||
@@ -588,11 +594,19 @@ namespace BlackCore
|
||||
QString callsign = QString(name);
|
||||
if (callsign.isEmpty()) return;
|
||||
|
||||
// add user
|
||||
// add callsign
|
||||
CVoiceVatlib *voiceClientVatlib = cbvar_cast_voice(cbVar);
|
||||
ComUnit comUnit = static_cast<ComUnit>(voiceClientVatlib->temporaryUserRoomIndex());
|
||||
|
||||
// add user
|
||||
// callsign might contain: VATSIM id, user name
|
||||
if (callsign.contains(" "))
|
||||
{
|
||||
QStringList parts = callsign.split(" ");
|
||||
callsign = parts[0];
|
||||
// I throw away VATSIM id here, maybe we could use it
|
||||
}
|
||||
|
||||
voiceClientVatlib->addTemporaryCallsignForRoom(comUnit, CCallsign(callsign));
|
||||
}
|
||||
|
||||
@@ -637,6 +651,7 @@ namespace BlackCore
|
||||
*/
|
||||
void CVoiceVatlib::addTemporaryCallsignForRoom(const ComUnit /** comUnit **/, const CCallsign &callsign)
|
||||
{
|
||||
if (m_temporaryVoiceRoomCallsigns.contains(callsign)) return;
|
||||
m_temporaryVoiceRoomCallsigns.push_back(callsign);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,60 +66,49 @@ namespace BlackCore
|
||||
virtual qint32 micTestResult() const;
|
||||
virtual QString micTestResultAsString() const;
|
||||
|
||||
|
||||
public slots:
|
||||
/*!
|
||||
* \brief ATC station callsign, used for voice room designator
|
||||
* \param callsign
|
||||
* \copydoc IVoice::setMyAircraftCallsign()
|
||||
*/
|
||||
virtual void setMyAircraftCallsign(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
/*!
|
||||
* \brief Join a given voice room
|
||||
* \param comUnit
|
||||
* \param voiceRoom
|
||||
* \copydoc IVoice::joinVoiceRoom()
|
||||
*/
|
||||
virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom);
|
||||
|
||||
/*!
|
||||
* \brief Leave voice room
|
||||
* \param comUnit
|
||||
* \copydoc IVoice::leaveVoiceRoom()
|
||||
*/
|
||||
virtual void leaveVoiceRoom(const ComUnit comUnit);
|
||||
|
||||
/*!
|
||||
* \brief Leave all voice rooms
|
||||
* \copydoc IVoice::leaveAllVoiceRooms()
|
||||
*/
|
||||
virtual void leaveAllVoiceRooms();
|
||||
|
||||
/*!
|
||||
* \brief Room output volume as per COM unit
|
||||
* \param comUnit
|
||||
* \param volumne
|
||||
* \copydoc IVoice::setRoomOutputVolume()
|
||||
*/
|
||||
virtual void setRoomOutputVolume(const ComUnit comUnit, const qint32 volumne);
|
||||
|
||||
/*!
|
||||
* \brief Start transmitting ("talk")
|
||||
* \param comUnit
|
||||
* \copydoc IVoice::startTransmitting()
|
||||
*/
|
||||
virtual void startTransmitting(const ComUnit comUnit);
|
||||
|
||||
/*!
|
||||
* \brief Stop transmitting ("talk")
|
||||
* \param comUnit
|
||||
* \copydoc IVoice::stopTransmitting()
|
||||
*/
|
||||
virtual void stopTransmitting(const ComUnit comUnit);
|
||||
|
||||
/*!
|
||||
* Get COM1/2 voice rooms, which then allows to retrieve information
|
||||
* such as connection status etc.
|
||||
* \return
|
||||
* \copydoc IVoice::getComVoiceRoomsWithAudioStatus()
|
||||
*/
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus();
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const;
|
||||
|
||||
/*!
|
||||
* \brief Voice rooms, const version with no updates
|
||||
* \copydoc IVoice::getComVoiceRooms()
|
||||
*/
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const
|
||||
{
|
||||
@@ -127,17 +116,15 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Get voice room callsigns
|
||||
* \param comUnit COM1/2
|
||||
* \return
|
||||
* \copydoc IVoice::getVoiceRoomCallsigns()
|
||||
*/
|
||||
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const;
|
||||
|
||||
/*!
|
||||
* \brief Switch audio output
|
||||
* \param comUnit
|
||||
* \param enable
|
||||
*/
|
||||
* \brief Switch audio output, enable or disable given COM unit.
|
||||
* \param comUnit
|
||||
* \param enable enable or disable output
|
||||
*/
|
||||
virtual void switchAudioOutput(const ComUnit comUnit, bool enable);
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user