[AFV] Ref T739, audio can now be disabled from UI

This commit is contained in:
Klaus Basan
2019-10-26 02:54:11 +02:00
committed by Mat Sutcliffe
parent c8097cc899
commit 9447db00bc
10 changed files with 197 additions and 66 deletions

View File

@@ -186,13 +186,13 @@ namespace BlackCore
}
}
void CAfvClient::disconnectFrom()
void CAfvClient::disconnectFrom(bool stop)
{
if (QThread::currentThread() != thread())
{
// Method needs to be executed in the object thread since it will create new QObject children
QPointer<CAfvClient> myself(this);
QMetaObject::invokeMethod(this, [ = ]() { if (myself) disconnectFrom(); });
QMetaObject::invokeMethod(this, [ = ]() { if (myself) disconnectFrom(stop); });
return;
}
@@ -203,6 +203,8 @@ namespace BlackCore
m_connection->disconnectFrom();
}
emit connectionStatusChanged(Disconnected);
if (stop) { this->stopAudio(); }
}
QStringList CAfvClient::availableInputDevices() const

View File

@@ -94,7 +94,11 @@ namespace BlackCore
//! Disconnect from network
//! \threadsafe
//! \remark runs in thread of CAfvClient object and is ASYNC when called from another thread
Q_INVOKABLE void disconnectFrom();
//! @{
void disconnectFrom(bool stop);
Q_INVOKABLE void disconnectFrom() { this->disconnectFrom(false); }
void disconnectFromAndStop() { this->disconnectFrom(true); }
//! @}
//! Audio devices @{
Q_INVOKABLE QStringList availableInputDevices() const;