mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 21:45:34 +08:00
[AFV] Ref T739, default device handling
* renamed some device list functions * improved default device handling
This commit is contained in:
committed by
Mat Sutcliffe
parent
5150fb4e86
commit
aed1103ce6
@@ -12,6 +12,7 @@
|
||||
#include <QStringBuilder>
|
||||
#include <QHostInfo>
|
||||
#include <QtGlobal>
|
||||
#include <QAudioDeviceInfo>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -27,6 +28,15 @@ namespace BlackMisc
|
||||
m_deviceName(name), m_hostName(QHostInfo::localHostName())
|
||||
{ }
|
||||
|
||||
bool CAudioDeviceInfo::isDefault() const
|
||||
{
|
||||
if (m_deviceName.isEmpty()) { return false; }
|
||||
if (m_deviceName == "default") { return true; }
|
||||
if (this->isInputDevice() && m_deviceName == QAudioDeviceInfo::defaultInputDevice().deviceName()) { return true; }
|
||||
if (this->isOutputDevice() && m_deviceName == QAudioDeviceInfo::defaultOutputDevice().deviceName()) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAudioDeviceInfo::matchesNameTypeHostName(const CAudioDeviceInfo &device) const
|
||||
{
|
||||
return device.getType() == this->getType() &&
|
||||
@@ -45,6 +55,16 @@ namespace BlackMisc
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
CAudioDeviceInfo CAudioDeviceInfo::getDefaultOutputDevice()
|
||||
{
|
||||
return CAudioDeviceInfo(OutputDevice, QAudioDeviceInfo::defaultOutputDevice().deviceName());
|
||||
}
|
||||
|
||||
CAudioDeviceInfo CAudioDeviceInfo::getDefaultInputDevice()
|
||||
{
|
||||
return CAudioDeviceInfo(InputDevice, QAudioDeviceInfo::defaultInputDevice().deviceName());
|
||||
}
|
||||
|
||||
QString CAudioDeviceInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n)
|
||||
|
||||
Reference in New Issue
Block a user