Fixes around audio "on remote computer"

* Better options to debug
* Fixes as of n2, https://dev.vatsim-germany.org/boards/22/topics/1792?r=1802#message-1802
* Doxygen
This commit is contained in:
Klaus Basan
2014-06-06 22:52:44 +02:00
parent c3f7a7c179
commit 0a7be12efa
6 changed files with 58 additions and 21 deletions

View File

@@ -17,7 +17,7 @@ namespace BlackMisc
*/
CAudioDevice::CAudioDevice() :
m_type(Unknown), m_deviceIndex(invalidDeviceIndex()),
m_deviceName(""), m_hostName(CAudioDevice::hostName())
m_deviceName(""), m_hostName(CAudioDevice::computerHostName())
{
// void
}
@@ -27,7 +27,7 @@ namespace BlackMisc
*/
CAudioDevice::CAudioDevice(DeviceType type, const qint16 index, const QString &name) :
m_type(type), m_deviceIndex(index),
m_deviceName(name), m_hostName(CAudioDevice::hostName())
m_deviceName(name), m_hostName(CAudioDevice::computerHostName())
{
// void
}
@@ -35,10 +35,10 @@ namespace BlackMisc
/*
* Host name
*/
QString CAudioDevice::hostName()
const QString &CAudioDevice::computerHostName()
{
QHostInfo hostInfo = QHostInfo::fromName(QHostInfo::localHostName());
return hostInfo.localHostName();
static const QString hostName = QHostInfo::fromName(QHostInfo::localHostName()).localHostName();
return hostName;
}
/*
@@ -100,7 +100,7 @@ namespace BlackMisc
if (this->m_hostName.isEmpty()) return m_deviceName;
QString s(this->m_deviceName);
s.append(" [");
s.append(this->hostName());
s.append(this->getHostName());
s.append("]");
return s;
}

View File

@@ -42,25 +42,25 @@ namespace BlackMisc
*/
CAudioDevice();
//! \brief Constructor.
//! Constructor.
CAudioDevice(DeviceType type, const qint16 index, const QString &getName);
//! \copydoc CValueObject::toQVariant
virtual QVariant toQVariant() const override
{
return QVariant::fromValue(*this);
}
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
//! \brief Get the device index
//! Get the device index
qint16 getIndex() const { return m_deviceIndex; }
//! Get the device name
const QString &getName() const { return m_deviceName; }
//! \brief Type
//! Host name
const QString &getHostName() const { return m_hostName; }
//! Type
DeviceType getType() const { return m_type; }
//! \brief Valid audio device object?
//! Valid audio device object?
bool isValid() const { return m_deviceIndex >= -1 && !m_deviceName.isEmpty(); }
//! \brief Equal operator ==
@@ -78,7 +78,7 @@ namespace BlackMisc
//! \copydoc CValueObject::fromJson
void fromJson(const QJsonObject &json) override;
//! \brief Register metadata
//! Register metadata
static void registerMetadata();
//! \copydoc TupleConverter<>::jsonMembers()
@@ -137,11 +137,8 @@ namespace BlackMisc
QString m_hostName;
private:
/*!
* \brief Own host name
* \return
*/
static QString hostName();
//! Own host name
static const QString &computerHostName();
};
} // Audio