mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +08:00
Ref T565, "canTalk" utility functions
This commit is contained in:
committed by
Mat Sutcliffe
parent
a049ee7025
commit
5ac1f65756
@@ -91,5 +91,10 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
return (m_channel.contains("ATIS", Qt::CaseInsensitive));
|
return (m_channel.contains("ATIS", Qt::CaseInsensitive));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CVoiceRoom::canTalkTo() const
|
||||||
|
{
|
||||||
|
return this->isConnected() && !this->isAtis();
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace BlackMisc
|
|||||||
//! Properties by index
|
//! Properties by index
|
||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
IndexHostname = BlackMisc::CPropertyIndex::GlobalIndexCVoiceRoom,
|
IndexHostname = CPropertyIndex::GlobalIndexCVoiceRoom,
|
||||||
IndexChannel,
|
IndexChannel,
|
||||||
IndexUrl,
|
IndexUrl,
|
||||||
IndexConnected,
|
IndexConnected,
|
||||||
@@ -68,23 +68,26 @@ namespace BlackMisc
|
|||||||
void setVoiceRoomUrl(const QString &serverUrl);
|
void setVoiceRoomUrl(const QString &serverUrl);
|
||||||
|
|
||||||
//! Valid voice room object?
|
//! Valid voice room object?
|
||||||
bool isValid() const { return !this->m_hostname.isEmpty() && !this->m_channel.isEmpty(); }
|
bool isValid() const { return !m_hostname.isEmpty() && !m_channel.isEmpty(); }
|
||||||
|
|
||||||
//! Is connected?
|
//! Is connected?
|
||||||
bool isConnected() const { return this->isValid() && this->m_connected; }
|
bool isConnected() const { return this->isValid() && m_connected; }
|
||||||
|
|
||||||
//! Set connection status
|
//! Set connection status
|
||||||
void setConnected(bool isConnected) { this->m_connected = isConnected; }
|
void setConnected(bool isConnected) { m_connected = isConnected; }
|
||||||
|
|
||||||
//! Is audio playing in this room?
|
//! Is audio playing in this room?
|
||||||
bool isAudioPlaying() const { return this->m_audioPlaying; }
|
bool isAudioPlaying() const { return m_audioPlaying; }
|
||||||
|
|
||||||
//! Set audio playing
|
//! Set audio playing
|
||||||
void setAudioPlaying(bool playing) { this->m_audioPlaying = playing; }
|
void setAudioPlaying(bool playing) { m_audioPlaying = playing; }
|
||||||
|
|
||||||
//! Is ATIS voice channel
|
//! Is ATIS voice channel
|
||||||
bool isAtis() const;
|
bool isAtis() const;
|
||||||
|
|
||||||
|
//! Can talk to channel
|
||||||
|
bool canTalkTo() const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||||
|
|
||||||
@@ -115,8 +118,8 @@ namespace BlackMisc
|
|||||||
BLACK_METAMEMBER(audioPlaying)
|
BLACK_METAMEMBER(audioPlaying)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
} // Voice
|
} // ns
|
||||||
} // BlackMisc
|
} // ns
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CVoiceRoom)
|
Q_DECLARE_METATYPE(BlackMisc::Audio::CVoiceRoom)
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,16 @@ namespace BlackMisc
|
|||||||
CSequence(other)
|
CSequence(other)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
int CVoiceRoomList::countCanTalkTo() const
|
||||||
|
{
|
||||||
|
int c = 0;
|
||||||
|
for (const CVoiceRoom &r : *this)
|
||||||
|
{
|
||||||
|
if (r.canTalkTo()) { c++; }
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
const CVoiceRoomList &CVoiceRoomList::twoEmptyRooms()
|
const CVoiceRoomList &CVoiceRoomList::twoEmptyRooms()
|
||||||
{
|
{
|
||||||
static CVoiceRoomList emptyRooms;
|
static CVoiceRoomList emptyRooms;
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ namespace BlackMisc
|
|||||||
//! Construct from a base class object.
|
//! Construct from a base class object.
|
||||||
CVoiceRoomList(const CSequence &other);
|
CVoiceRoomList(const CSequence &other);
|
||||||
|
|
||||||
|
//! Count how many rooms can be talked to
|
||||||
|
int countCanTalkTo() const;
|
||||||
|
|
||||||
//! Frequently needed for voice room resolutions
|
//! Frequently needed for voice room resolutions
|
||||||
static const CVoiceRoomList &twoEmptyRooms();
|
static const CVoiceRoomList &twoEmptyRooms();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user