mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 06:25:37 +08:00
refs #320 Rename CAudioDevice to CAudioDeviceInfo
CAudioDevice implied a device handler instead of device information
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
#ifndef BLACKMISC_AUDIOALLCLASSES_H
|
||||
#define BLACKMISC_AUDIOALLCLASSES_H
|
||||
|
||||
#include "blackmisc/audiodevice.h"
|
||||
#include "blackmisc/audiodevicelist.h"
|
||||
#include "blackmisc/audiodeviceinfo.h"
|
||||
#include "blackmisc/audiodeviceinfolist.h"
|
||||
#include "blackmisc/voiceroom.h"
|
||||
#include "blackmisc/voiceroomlist.h"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "audiodevice.h"
|
||||
#include "audiodeviceinfo.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <tuple>
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace BlackMisc
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CAudioDevice::CAudioDevice() :
|
||||
CAudioDeviceInfo::CAudioDeviceInfo() :
|
||||
m_type(Unknown), m_deviceIndex(invalidDeviceIndex()),
|
||||
m_deviceName(""), m_hostName(BlackMisc::localHostName())
|
||||
{
|
||||
@@ -28,7 +28,7 @@ namespace BlackMisc
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CAudioDevice::CAudioDevice(DeviceType type, const qint16 index, const QString &name) :
|
||||
CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const qint16 index, const QString &name) :
|
||||
m_type(type), m_deviceIndex(index),
|
||||
m_deviceName(name), m_hostName(BlackMisc::localHostName())
|
||||
{
|
||||
@@ -38,7 +38,7 @@ namespace BlackMisc
|
||||
/*
|
||||
* As String
|
||||
*/
|
||||
QString CAudioDevice::convertToQString(bool /* i18n */) const
|
||||
QString CAudioDeviceInfo::convertToQString(bool /* i18n */) const
|
||||
{
|
||||
if (this->m_hostName.isEmpty()) return m_deviceName;
|
||||
QString s(this->m_deviceName);
|
||||
@@ -25,7 +25,7 @@ namespace BlackMisc
|
||||
* If you want to safe this object, use the name instead of the index, since the index can change after
|
||||
* a restart.
|
||||
*/
|
||||
class CAudioDevice : public CValueObjectStdTuple<CAudioDevice>
|
||||
class CAudioDeviceInfo : public CValueObjectStdTuple<CAudioDeviceInfo>
|
||||
{
|
||||
public:
|
||||
//! Type
|
||||
@@ -41,10 +41,10 @@ namespace BlackMisc
|
||||
* If m_deviceIndex is -1, default should be used. However on Windows this doesnt work. Needs
|
||||
* to be checked in Vatlib.
|
||||
*/
|
||||
CAudioDevice();
|
||||
CAudioDeviceInfo();
|
||||
|
||||
//! Constructor.
|
||||
CAudioDevice(DeviceType type, const qint16 index, const QString &getName);
|
||||
CAudioDeviceInfo(DeviceType type, const qint16 index, const QString &getName);
|
||||
|
||||
//! Get the device index
|
||||
qint16 getIndex() const { return m_deviceIndex; }
|
||||
@@ -68,15 +68,15 @@ namespace BlackMisc
|
||||
static qint16 invalidDeviceIndex() {return -2;}
|
||||
|
||||
//! Default output device
|
||||
static CAudioDevice getDefaultOutputDevice()
|
||||
static CAudioDeviceInfo getDefaultOutputDevice()
|
||||
{
|
||||
return CAudioDevice(OutputDevice, defaultDeviceIndex(), "default");
|
||||
return CAudioDeviceInfo(OutputDevice, defaultDeviceIndex(), "default");
|
||||
}
|
||||
|
||||
//! Default input device
|
||||
static CAudioDevice getDefaultInputDevice()
|
||||
static CAudioDeviceInfo getDefaultInputDevice()
|
||||
{
|
||||
return CAudioDevice(InputDevice, defaultDeviceIndex(), "default");
|
||||
return CAudioDeviceInfo(InputDevice, defaultDeviceIndex(), "default");
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -84,8 +84,8 @@ namespace BlackMisc
|
||||
virtual QString convertToQString(bool i18n = false) const override;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CAudioDevice)
|
||||
//! Device type, @see CAudioDevice::DeviceType
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CAudioDeviceInfo)
|
||||
//! Device type, @see CAudioDeviceInfo::DeviceType
|
||||
DeviceType m_type;
|
||||
/*!
|
||||
* deviceIndex is the number is the reference for the VVL. The device is selected by this index.
|
||||
@@ -100,7 +100,7 @@ namespace BlackMisc
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Audio::CAudioDevice, (o.m_type, o.m_deviceIndex, o.m_deviceName, o.m_hostName))
|
||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDevice)
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Audio::CAudioDeviceInfo, (o.m_type, o.m_deviceIndex, o.m_deviceName, o.m_hostName))
|
||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDeviceInfo)
|
||||
|
||||
#endif // guard
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "audiodevicelist.h"
|
||||
#include "audiodeviceinfolist.h"
|
||||
#include "predicates.h"
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -17,37 +17,37 @@ namespace BlackMisc
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
CAudioDeviceList::CAudioDeviceList() { }
|
||||
CAudioDeviceInfoList::CAudioDeviceInfoList() { }
|
||||
|
||||
/*
|
||||
* Construct from base class object
|
||||
*/
|
||||
CAudioDeviceList::CAudioDeviceList(const CSequence &other) :
|
||||
CAudioDeviceInfoList::CAudioDeviceInfoList(const CSequence &other) :
|
||||
CSequence(other)
|
||||
{ }
|
||||
|
||||
/*
|
||||
* Output devices
|
||||
*/
|
||||
CAudioDeviceList CAudioDeviceList::getOutputDevices() const
|
||||
CAudioDeviceInfoList CAudioDeviceInfoList::getOutputDevices() const
|
||||
{
|
||||
return this->findBy(&CAudioDevice::getType, CAudioDevice::OutputDevice);
|
||||
return this->findBy(&CAudioDeviceInfo::getType, CAudioDeviceInfo::OutputDevice);
|
||||
}
|
||||
|
||||
/*
|
||||
* Output devices
|
||||
*/
|
||||
CAudioDeviceList CAudioDeviceList::getInputDevices() const
|
||||
CAudioDeviceInfoList CAudioDeviceInfoList::getInputDevices() const
|
||||
{
|
||||
return this->findBy(&CAudioDevice::getType, CAudioDevice::InputDevice);
|
||||
return this->findBy(&CAudioDeviceInfo::getType, CAudioDeviceInfo::InputDevice);
|
||||
}
|
||||
|
||||
/*
|
||||
* Count as of type
|
||||
*/
|
||||
int CAudioDeviceList::count(CAudioDevice::DeviceType type) const
|
||||
int CAudioDeviceInfoList::count(CAudioDeviceInfo::DeviceType type) const
|
||||
{
|
||||
return std::count_if(this->begin(), this->end(), [type](const CAudioDevice &device)
|
||||
return std::count_if(this->begin(), this->end(), [type](const CAudioDeviceInfo &device)
|
||||
{
|
||||
return device.getType() == type;
|
||||
});
|
||||
@@ -56,11 +56,11 @@ namespace BlackMisc
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CAudioDeviceList::registerMetadata()
|
||||
void CAudioDeviceInfoList::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CAudioDeviceList>();
|
||||
qDBusRegisterMetaType<CAudioDeviceList>();
|
||||
registerMetaValueType<CAudioDeviceList>();
|
||||
qRegisterMetaType<CAudioDeviceInfoList>();
|
||||
qDBusRegisterMetaType<CAudioDeviceInfoList>();
|
||||
registerMetaValueType<CAudioDeviceInfoList>();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKMISC_AUDIODEVICELIST_H
|
||||
#define BLACKMISC_AUDIODEVICELIST_H
|
||||
|
||||
#include "audiodevice.h"
|
||||
#include "audiodeviceinfo.h"
|
||||
#include "sequence.h"
|
||||
#include "collection.h"
|
||||
#include <QObject>
|
||||
@@ -26,23 +26,23 @@ namespace BlackMisc
|
||||
/*!
|
||||
* Value object encapsulating a list of audio devices.
|
||||
*/
|
||||
class CAudioDeviceList : public CSequence<CAudioDevice>
|
||||
class CAudioDeviceInfoList : public CSequence<CAudioDeviceInfo>
|
||||
{
|
||||
public:
|
||||
//! Default constructor.
|
||||
CAudioDeviceList();
|
||||
CAudioDeviceInfoList();
|
||||
|
||||
//! Construct from a base class object.
|
||||
CAudioDeviceList(const CSequence &other);
|
||||
CAudioDeviceInfoList(const CSequence &other);
|
||||
|
||||
//! Get output devices in that list
|
||||
CAudioDeviceList getOutputDevices() const;
|
||||
CAudioDeviceInfoList getOutputDevices() const;
|
||||
|
||||
//! Get output devices in that list
|
||||
CAudioDeviceList getInputDevices() const;
|
||||
CAudioDeviceInfoList getInputDevices() const;
|
||||
|
||||
//! Count (as of type)
|
||||
int count(CAudioDevice::DeviceType type) const;
|
||||
int count(CAudioDeviceInfo::DeviceType type) const;
|
||||
|
||||
//! \copydoc CValueObject::toQVariant
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
@@ -57,8 +57,8 @@ namespace BlackMisc
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDeviceList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Audio::CAudioDevice>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Audio::CAudioDevice>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CAudioDeviceInfoList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Audio::CAudioDeviceInfo>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Audio::CAudioDeviceInfo>)
|
||||
|
||||
#endif //guard
|
||||
@@ -67,8 +67,8 @@ void BlackMisc::Settings::registerMetadata()
|
||||
*/
|
||||
void BlackMisc::Audio::registerMetadata()
|
||||
{
|
||||
CAudioDevice::registerMetadata();
|
||||
CAudioDeviceList::registerMetadata();
|
||||
CAudioDeviceInfo::registerMetadata();
|
||||
CAudioDeviceInfoList::registerMetadata();
|
||||
CVoiceRoom::registerMetadata();
|
||||
CVoiceRoomList::registerMetadata();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user