mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #381, adjust GUI for new voice vatlib
* Only 1 volume * No tests (squelch ...) * loopback * required backed functions in context
This commit is contained in:
@@ -73,7 +73,7 @@ namespace BlackCore
|
||||
virtual QString getPathAndContextId() const { return this->buildPathAndContextId(ObjectPath()); }
|
||||
|
||||
//! Factory method
|
||||
static IContextAudio *create(CRuntime *parent, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn);
|
||||
static IContextAudio *create(CRuntime *runtime, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn);
|
||||
|
||||
//! \brief Destructor
|
||||
virtual ~IContextAudio() {}
|
||||
@@ -137,6 +137,9 @@ namespace BlackCore
|
||||
//! Set voice output volume (0..300)
|
||||
virtual void setVoiceOutputVolume(int volume) = 0;
|
||||
|
||||
//! Voice output volume (0..300)
|
||||
virtual int getVoiceOutputVolume() const = 0;
|
||||
|
||||
//! Set mute state
|
||||
virtual void setMute(bool mute) = 0;
|
||||
|
||||
@@ -156,6 +159,9 @@ namespace BlackCore
|
||||
//! Enable audio loopback
|
||||
virtual void enableAudioLoopback(bool enable = true) = 0;
|
||||
|
||||
//! Is loobback enabled?
|
||||
virtual bool isAudioLoopbackEnabled() const = 0;
|
||||
|
||||
//! Command line was entered
|
||||
virtual bool parseCommandLine(const QString &commandLine) = 0;
|
||||
};
|
||||
|
||||
@@ -211,11 +211,18 @@ namespace BlackCore
|
||||
|
||||
void CContextAudio::setVoiceOutputVolume(int volume)
|
||||
{
|
||||
Q_ASSERT(m_voiceOutputDevice);
|
||||
m_outDeviceVolume = volume;
|
||||
if (!isMuted()) m_voiceOutputDevice->setOutputVolume(m_outDeviceVolume);
|
||||
if (!isMuted()) { m_voiceOutputDevice->setOutputVolume(m_outDeviceVolume); }
|
||||
emit changedAudioVolume(volume);
|
||||
}
|
||||
|
||||
int CContextAudio::getVoiceOutputVolume() const
|
||||
{
|
||||
Q_ASSERT(m_voiceOutputDevice);
|
||||
return m_voiceOutputDevice->getOutputVolume();
|
||||
}
|
||||
|
||||
void CContextAudio::setMute(bool muted)
|
||||
{
|
||||
if (this->isMuted() == muted) { return; } // avoid roundtrips / unnecessary signals
|
||||
@@ -407,12 +414,23 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextAudio::enableAudioLoopback(bool enable)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(this->m_audioMixer);
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (enable)
|
||||
{
|
||||
m_audioMixer->makeMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_audioMixer->removeMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
}
|
||||
}
|
||||
|
||||
bool CContextAudio::isAudioLoopbackEnabled() const
|
||||
{
|
||||
Q_ASSERT(this->m_audioMixer);
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
return this->m_audioMixer->hasMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
}
|
||||
|
||||
bool CContextAudio::parseCommandLine(const QString &commandLine)
|
||||
@@ -439,10 +457,11 @@ namespace BlackCore
|
||||
}
|
||||
else if (parser.commandStartsWith("vol") && parser.countParts() > 1)
|
||||
{
|
||||
qint32 v = parser.toInt(1);
|
||||
int v = parser.toInt(1);
|
||||
if (v >= 0 && v <= 300)
|
||||
{
|
||||
setVoiceOutputVolume(v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -473,7 +492,7 @@ namespace BlackCore
|
||||
break;
|
||||
case IVoiceChannel::ConnectingFailed:
|
||||
case IVoiceChannel::DisconnectedError:
|
||||
qWarning() << "Voice room COM1 error";
|
||||
CLogMessage(this).warning("Voice channel disconnecting error");
|
||||
// intentional fall-through
|
||||
case IVoiceChannel::Disconnected:
|
||||
if (this->getIContextOwnAircraft())
|
||||
|
||||
@@ -78,9 +78,12 @@ namespace BlackCore
|
||||
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDeviceInfo &audioDevice) override;
|
||||
|
||||
//!\copydoc IContext::setVoiceOutputVolume
|
||||
//! \copydoc IContext::setVoiceOutputVolume
|
||||
virtual void setVoiceOutputVolume(int volume) override;
|
||||
|
||||
//! \copydoc IContext::getVoiceOutputVolume
|
||||
virtual int getVoiceOutputVolume() const override;
|
||||
|
||||
//! \copydoc ICOntext::setMute
|
||||
virtual void setMute(bool muted) override;
|
||||
|
||||
@@ -96,14 +99,15 @@ namespace BlackCore
|
||||
//! \copydoc IContextAudio::enableAudioLoopback()
|
||||
virtual void enableAudioLoopback(bool enable = true) override;
|
||||
|
||||
//! \copydoc ICOntextAudio::isAudioLoopbackEnabled
|
||||
virtual bool isAudioLoopbackEnabled() const override;
|
||||
|
||||
//! \addtogroup commandline
|
||||
//! @{
|
||||
//! <pre>
|
||||
//! .mute mute CContextAudio
|
||||
//! .unmute unmute CContextAudio
|
||||
//! .vol .volume volume 0..100 set volume CContextAudio
|
||||
//! .vol1 .volume1 volume 0..100 set volume COM1 CContextAudio
|
||||
//! .vol2 .volume2 volume 0..100 set volume COM2 CContextAudio
|
||||
//! .vol .volume volume 0..300 set volume CContextAudio
|
||||
//! </pre>
|
||||
//! @}
|
||||
//! \copydoc IContextAudio::parseCommandLine
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackCore
|
||||
void CContextAudioProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
bool s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"changedVoiceRooms", this, SIGNAL(changedVoiceRooms(BlackMisc::Audio::CVoiceRoomList, bool)));
|
||||
"changedVoiceRooms", this, SIGNAL(changedVoiceRooms(BlackMisc::Audio::CVoiceRoomList, bool)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"changedAudioVolume", this, SIGNAL(changedAudioVolume(int)));
|
||||
@@ -151,6 +151,11 @@ namespace BlackCore
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("setVoiceOutputVolume"), volume);
|
||||
}
|
||||
|
||||
int CContextAudioProxy::getVoiceOutputVolume() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<int>(QLatin1Literal("getVoiceOutputVolume"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Toggle mute
|
||||
*/
|
||||
@@ -172,7 +177,15 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextAudioProxy::enableAudioLoopback(bool enable)
|
||||
{
|
||||
return this->m_dBusInterface->callDBus(QLatin1Literal("enableAudioLoopback"), enable);
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("enableAudioLoopback"), enable);
|
||||
}
|
||||
|
||||
/*
|
||||
* Loopback
|
||||
*/
|
||||
bool CContextAudioProxy::isAudioLoopbackEnabled() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isAudioLoopbackEnabled"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -84,6 +84,9 @@ namespace BlackCore
|
||||
//!\copydoc IContext::setVoiceOutputVolume
|
||||
virtual void setVoiceOutputVolume(int volume) override;
|
||||
|
||||
//! \copydoc IContext::getVoiceOutputVolume
|
||||
virtual int getVoiceOutputVolume() const override;
|
||||
|
||||
//! \copydoc IContextAudio::setMute
|
||||
virtual void setMute(bool muted) override;
|
||||
|
||||
@@ -99,6 +102,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextAudio::enableAudioLoopback()
|
||||
virtual void enableAudioLoopback(bool enable = true) override;
|
||||
|
||||
//! \copydoc IContextAudio::isAudioLoopbackEnabled()
|
||||
virtual bool isAudioLoopbackEnabled() const override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::parseCommandLine
|
||||
virtual bool parseCommandLine(const QString &commandLine) override;
|
||||
|
||||
|
||||
@@ -32,21 +32,21 @@ namespace BlackGui
|
||||
ui(new Ui::CAudioSetupComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->prb_SetupAudioTestProgress->hide();
|
||||
this->m_timerAudioTests = new QTimer(this);
|
||||
|
||||
bool c = connect(this->ui->tb_ExpandNotificationSounds, &QToolButton::toggled, this, &CAudioSetupComponent::ps_onToggleNotificationSoundsVisibility);
|
||||
Q_ASSERT(c);
|
||||
c = connect(this->ui->cb_SetupAudioLoopback, &QCheckBox::toggled, this, &CAudioSetupComponent::ps_onLoopbackToggled);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
|
||||
CAudioSetupComponent::~CAudioSetupComponent()
|
||||
{ }
|
||||
|
||||
/*
|
||||
* Runtime set
|
||||
*/
|
||||
void CAudioSetupComponent::runtimeHasBeenSet()
|
||||
{
|
||||
if (!this->getIContextSettings()) qFatal("Settings missing");
|
||||
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CAudioSetupComponent::ps_changedSettings);
|
||||
this->connect(this->m_timerAudioTests, &QTimer::timeout, this, &CAudioSetupComponent::ps_audioTestUpdate);
|
||||
|
||||
// based on audio context
|
||||
Q_ASSERT(this->getIContextAudio());
|
||||
@@ -54,22 +54,22 @@ namespace BlackGui
|
||||
{
|
||||
this->initAudioDeviceLists();
|
||||
|
||||
// default
|
||||
this->ui->cb_SetupAudioLoopback->setChecked(this->getIContextAudio()->isAudioLoopbackEnabled());
|
||||
|
||||
// the connects depend on initAudioDeviceLists
|
||||
bool connected = this->connect(this->ui->cb_SetupAudioInputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_audioDeviceSelected(int)));
|
||||
bool connected = this->connect(this->ui->cb_SetupAudioInputDevice, static_cast<void (QComboBox::*)(int)> (&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::ps_audioDeviceSelected);
|
||||
Q_ASSERT(connected);
|
||||
connected = this->connect(this->ui->cb_SetupAudioOutputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_audioDeviceSelected(int)));
|
||||
connected = this->connect(this->ui->cb_SetupAudioOutputDevice, static_cast<void (QComboBox::*)(int)> (&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::ps_audioDeviceSelected);
|
||||
Q_ASSERT(connected);
|
||||
Q_UNUSED(connected);
|
||||
|
||||
this->connect(this->ui->pb_SetupAudioMicrophoneTest, &QPushButton::clicked, this, &CAudioSetupComponent::ps_startAudioTest);
|
||||
this->connect(this->ui->pb_SetupAudioSquelchTest, &QPushButton::clicked, this, &CAudioSetupComponent::ps_startAudioTest);
|
||||
|
||||
// context
|
||||
// this->connect(this->getIContextAudio(), &IContextAudio::audioTestCompleted, this, &CAudioSetupComponent::ps_audioTestUpdate);
|
||||
this->connect(this->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioSetupComponent::ps_onAudioDevicesChanged);
|
||||
this->connect(this->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioSetupComponent::ps_onCurrentAudioDevicesChanged);
|
||||
}
|
||||
this->reloadSettings();
|
||||
this->ui->tb_ExpandNotificationSounds->setChecked(false); // collapse
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::ps_changedSettings(uint typeValue)
|
||||
@@ -79,9 +79,6 @@ namespace BlackGui
|
||||
Q_UNUSED(type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reload settings
|
||||
*/
|
||||
void CAudioSetupComponent::reloadSettings()
|
||||
{
|
||||
// local copy
|
||||
@@ -93,9 +90,11 @@ namespace BlackGui
|
||||
this->ui->cb_SetupAudioNotificationVoiceRoom->setChecked(as.getNotificationFlag(BlackSound::CNotificationSounds::NotificationVoiceRoomJoined));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set audio device lists
|
||||
*/
|
||||
void CAudioSetupComponent::ps_onToggleNotificationSoundsVisibility(bool checked)
|
||||
{
|
||||
this->ui->fr_NotificationSoundsInner->setVisible(checked);
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::initAudioDeviceLists()
|
||||
{
|
||||
if (!this->getIContextAudio()) { return; }
|
||||
@@ -103,118 +102,31 @@ namespace BlackGui
|
||||
this->ps_onCurrentAudioDevicesChanged(this->getIContextAudio()->getCurrentAudioDevices());
|
||||
}
|
||||
|
||||
/*
|
||||
* Notification sounds
|
||||
*/
|
||||
bool CAudioSetupComponent::playNotificationSounds() const
|
||||
{
|
||||
return this->ui->cb_SetupAudioPlayNotificationSounds->isChecked();
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the voice tests
|
||||
*/
|
||||
void CAudioSetupComponent::ps_startAudioTest()
|
||||
{
|
||||
if (!this->getIContextAudio())
|
||||
{
|
||||
CLogMessage(this).error("voice context not available");
|
||||
return;
|
||||
}
|
||||
if (this->m_timerAudioTests->isActive())
|
||||
{
|
||||
CLogMessage(this).error("test running, wait until completed");
|
||||
return;
|
||||
}
|
||||
|
||||
QObject *sender = QObject::sender();
|
||||
this->m_timerAudioTests->start(600); // I let this run for <x>ms, so there is enough overhead to really complete it
|
||||
this->ui->prb_SetupAudioTestProgress->setValue(0);
|
||||
this->ui->pte_SetupAudioTestActionAndResult->clear();
|
||||
if (sender == this->ui->pb_SetupAudioMicrophoneTest)
|
||||
{
|
||||
this->m_audioTestRunning = MicrophoneTest;
|
||||
// this->getIContextAudio()->runMicrophoneTest();
|
||||
this->ui->pte_SetupAudioTestActionAndResult->appendPlainText("Speak normally for 5 seconds");
|
||||
}
|
||||
else if (sender == this->ui->pb_SetupAudioSquelchTest)
|
||||
{
|
||||
this->m_audioTestRunning = SquelchTest;
|
||||
// this->getIContextAudio()->runSquelchTest();
|
||||
this->ui->pte_SetupAudioTestActionAndResult->appendPlainText("Silence for 5 seconds");
|
||||
}
|
||||
this->ui->prb_SetupAudioTestProgress->setVisible(true);
|
||||
this->ui->pb_SetupAudioMicrophoneTest->setEnabled(false);
|
||||
this->ui->pb_SetupAudioSquelchTest->setEnabled(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the voice tests
|
||||
*/
|
||||
void CAudioSetupComponent::ps_audioTestUpdate()
|
||||
{
|
||||
Q_ASSERT(this->getIContextAudio());
|
||||
if (!this->getIContextAudio()) return;
|
||||
int v = this->ui->prb_SetupAudioTestProgress->value();
|
||||
QObject *sender = this->sender();
|
||||
|
||||
if (v < 100 && (sender == m_timerAudioTests))
|
||||
{
|
||||
// timer update, increasing progress
|
||||
this->ui->prb_SetupAudioTestProgress->setValue(v + 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_timerAudioTests->stop();
|
||||
this->ui->prb_SetupAudioTestProgress->setValue(100);
|
||||
if (sender == m_timerAudioTests) return; // just timer update
|
||||
|
||||
// getting here we assume the audio test finished signal
|
||||
// fetch results
|
||||
this->ui->pte_SetupAudioTestActionAndResult->clear();
|
||||
if (this->m_audioTestRunning == SquelchTest)
|
||||
{
|
||||
// double s = this->getIContextAudio()->getSquelchValue();
|
||||
double s = 0.0;
|
||||
this->ui->pte_SetupAudioTestActionAndResult->appendPlainText(QString::number(s));
|
||||
}
|
||||
else if (this->m_audioTestRunning == MicrophoneTest)
|
||||
{
|
||||
// QString m = this->getIContextAudio()->getMicrophoneTestResult();
|
||||
QString m;
|
||||
this->ui->pte_SetupAudioTestActionAndResult->appendPlainText(m);
|
||||
}
|
||||
this->m_audioTestRunning = NoAudioTest;
|
||||
this->m_timerAudioTests->stop();
|
||||
this->ui->pb_SetupAudioMicrophoneTest->setEnabled(true);
|
||||
this->ui->pb_SetupAudioSquelchTest->setEnabled(true);
|
||||
this->ui->prb_SetupAudioTestProgress->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Select audio device
|
||||
*/
|
||||
void CAudioSetupComponent::ps_audioDeviceSelected(int index)
|
||||
{
|
||||
if (!this->getIContextAudio()) return;
|
||||
if (index < 0)return;
|
||||
if (index < 0) { return; }
|
||||
|
||||
CAudioDeviceInfoList devices = this->getIContextAudio()->getAudioDevices();
|
||||
if (devices.isEmpty()) return;
|
||||
if (devices.isEmpty()) { return; }
|
||||
CAudioDeviceInfo selectedDevice;
|
||||
QObject *sender = QObject::sender();
|
||||
if (sender == this->ui->cb_SetupAudioInputDevice)
|
||||
{
|
||||
CAudioDeviceInfoList inputDevices = devices.getInputDevices();
|
||||
if (index >= inputDevices.size()) return;
|
||||
if (index >= inputDevices.size()) { return; }
|
||||
selectedDevice = inputDevices[index];
|
||||
this->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
||||
}
|
||||
else if (sender == this->ui->cb_SetupAudioOutputDevice)
|
||||
{
|
||||
CAudioDeviceInfoList outputDevices = devices.getOutputDevices();
|
||||
if (index >= outputDevices.size()) return;
|
||||
if (index >= outputDevices.size()) { return; }
|
||||
selectedDevice = outputDevices[index];
|
||||
this->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
||||
}
|
||||
@@ -222,7 +134,7 @@ namespace BlackGui
|
||||
|
||||
void CAudioSetupComponent::ps_onCurrentAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
for(auto &device : devices)
|
||||
for (auto &device : devices)
|
||||
{
|
||||
if (device.getType() == CAudioDeviceInfo::InputDevice)
|
||||
{
|
||||
@@ -240,7 +152,7 @@ namespace BlackGui
|
||||
this->ui->cb_SetupAudioOutputDevice->clear();
|
||||
this->ui->cb_SetupAudioInputDevice->clear();
|
||||
|
||||
for(auto &device : devices)
|
||||
for (auto &device : devices)
|
||||
{
|
||||
if (device.getType() == CAudioDeviceInfo::InputDevice)
|
||||
{
|
||||
@@ -253,5 +165,12 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::ps_onLoopbackToggled(bool loopback)
|
||||
{
|
||||
Q_ASSERT(this->getIContextAudio());
|
||||
if (this->getIContextAudio()->isAudioLoopbackEnabled() == loopback) { return; }
|
||||
this->getIContextAudio()->enableAudioLoopback(loopback);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -53,12 +53,6 @@ namespace BlackGui
|
||||
//! Settings have been changed
|
||||
void ps_changedSettings(uint typeValue);
|
||||
|
||||
//! start the MIC tests (Squelch)
|
||||
void ps_startAudioTest();
|
||||
|
||||
//! Audio test updates (timer) for progressbar and fetching results
|
||||
void ps_audioTestUpdate();
|
||||
|
||||
/*!
|
||||
* \brief Audio device selected
|
||||
* \param index audio device index (COM1, COM2)
|
||||
@@ -71,21 +65,17 @@ namespace BlackGui
|
||||
//! Audio devices changed
|
||||
void ps_onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
||||
|
||||
private:
|
||||
//! Audio test modes
|
||||
enum AudioTest
|
||||
{
|
||||
NoAudioTest,
|
||||
SquelchTest,
|
||||
MicrophoneTest
|
||||
};
|
||||
//! Loopback toggled
|
||||
void ps_onLoopbackToggled(bool loopback);
|
||||
|
||||
//! Visibilty (show/hide buttons)
|
||||
void ps_onToggleNotificationSoundsVisibility(bool checked);
|
||||
|
||||
private:
|
||||
//! Audio device lists from settings
|
||||
void initAudioDeviceLists();
|
||||
|
||||
QScopedPointer<Ui::CAudioSetupComponent> ui;
|
||||
QTimer *m_timerAudioTests; //!< audio tests: progress bar, disable/enable buttons
|
||||
AudioTest m_audioTestRunning = NoAudioTest;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -20,23 +20,23 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AudioSetup">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="fl_SetupAudio">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
@@ -96,143 +96,112 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SetupAudioVoiceTests">
|
||||
<widget class="QLabel" name="lbl_SetupAudioLoopback">
|
||||
<property name="text">
|
||||
<string>Tests</string>
|
||||
<string>Test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="wi_SetupAudioTests" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_SetupAudioTestsTop">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hl_SetupAudioTests">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_SetupAudioSquelchTest">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Squelch test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_SetupAudioMicrophoneTest">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mic. test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_SetupAudioTestActionAndResult">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioLoopback">
|
||||
<property name="text">
|
||||
<string>Result</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPlainTextEdit" name="pte_SetupAudioTestActionAndResult">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QProgressBar" name="prb_SetupAudioTestProgress">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lbl_SetupAudioNotificationSounds">
|
||||
<property name="text">
|
||||
<string>Notification sounds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPlayNotificationSounds">
|
||||
<property name="text">
|
||||
<string>play notification sounds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessage">
|
||||
<property name="text">
|
||||
<string>notification for text messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoom">
|
||||
<property name="text">
|
||||
<string>notification for join/leave voice room</string>
|
||||
<string>Loopback, test sound input to output loop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gl_NotificationSounds">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lbl_NotificationSounds">
|
||||
<property name="text">
|
||||
<string>Notification sounds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QToolButton" name="tb_ExpandNotificationSounds">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Toggle visibility</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/toggle-expand.png</normaloff>
|
||||
<normalon>:/diagona/icons/diagona/icons/toggle.png</normalon>:/diagona/icons/diagona/icons/toggle-expand.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QFrame" name="fr_NotificationSoundsInner">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoom">
|
||||
<property name="text">
|
||||
<string>notification for join/leave voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPlayNotificationSounds">
|
||||
<property name="text">
|
||||
<string>play notification sounds</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessage">
|
||||
<property name="text">
|
||||
<string>notification for text messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vs_AudioSetup">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>143</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -25,13 +25,10 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
bool c = connect(this->ui->pb_ShowWinMixer, &QPushButton::pressed, this, &CAudioVolumeComponent::ps_onWindowsMixerRequested);
|
||||
Q_ASSERT(c);
|
||||
|
||||
c = connect(this->ui->hs_VolumeCom1, &QSlider::sliderReleased, this, &CAudioVolumeComponent::ps_changeVolume);
|
||||
c = connect(this->ui->hs_Volume, &QSlider::valueChanged, this, &CAudioVolumeComponent::ps_changeOutputVolumeFromSlider);
|
||||
Q_ASSERT(c);
|
||||
|
||||
c = connect(this->ui->hs_VolumeCom2, &QSlider::sliderReleased, this, &CAudioVolumeComponent::ps_changeVolume);
|
||||
c = connect(this->ui->sb_Volume, static_cast<void (QSpinBox::*)(int)> (&QSpinBox::valueChanged), this, &CAudioVolumeComponent::ps_changeOutputVolumeFromSpinBox);
|
||||
Q_ASSERT(c);
|
||||
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
|
||||
@@ -43,13 +40,22 @@ namespace BlackGui
|
||||
// from audio context
|
||||
bool c = connect(this->getIContextAudio(), &IContextAudio::changedMute, this, &CAudioVolumeComponent::ps_onMuteChanged);
|
||||
Q_ASSERT(c);
|
||||
// connect(this->getIContextAudio(), &IContextAudio::changedAudioVolumes, this, &CAudioVolumeComponent::ps_onVolumesChanged);
|
||||
connect(this->getIContextAudio(), &IContextAudio::changedAudioVolume, this, &CAudioVolumeComponent::ps_onOutputVolumeChanged);
|
||||
Q_ASSERT(c);
|
||||
|
||||
// to audio audio context
|
||||
c = connect(this->ui->pb_Mute, &QPushButton::toggled, this->getIContextAudio(), &IContextAudio::setMute);
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c);
|
||||
|
||||
if (this->getIContextAudio()->isUsingImplementingObject())
|
||||
{
|
||||
this->ui->lbl_ContextLocation->setText("local");
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ui->lbl_ContextLocation->setText("remote");
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::ps_onMuteChanged(bool muted)
|
||||
@@ -58,21 +64,57 @@ namespace BlackGui
|
||||
this->ui->pb_Mute->setChecked(muted);
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::ps_onVolumesChanged(qint32 com1Volume, qint32 com2Volume)
|
||||
void CAudioVolumeComponent::ps_onOutputVolumeChanged(int volume)
|
||||
{
|
||||
this->ui->hs_VolumeCom1->setValue(com1Volume);
|
||||
this->ui->hs_VolumeCom2->setValue(com2Volume);
|
||||
this->ui->hs_VolumeCom1->setToolTip(QString::number(com1Volume));
|
||||
this->ui->hs_VolumeCom2->setToolTip(QString::number(com2Volume));
|
||||
this->ui->hs_Volume->setToolTip(QString::number(volume));
|
||||
|
||||
// comparisons to avoid rountrips
|
||||
QString v = QString::number(volume);
|
||||
if (volume != this->ui->sb_Volume->value())
|
||||
{
|
||||
this->ui->sb_Volume->setValue(volume);
|
||||
this->ui->sb_Volume->setToolTip(v);
|
||||
}
|
||||
|
||||
|
||||
if (volume > 100)
|
||||
{
|
||||
int v = volume - 100;
|
||||
volume = 100 + v / 5;
|
||||
}
|
||||
|
||||
if (volume != this->ui->hs_Volume->value())
|
||||
{
|
||||
this->ui->hs_Volume->setValue(volume);
|
||||
this->ui->hs_Volume->setToolTip(v);
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::ps_changeVolume()
|
||||
void CAudioVolumeComponent::ps_changeOutputVolumeFromSlider(int volume)
|
||||
{
|
||||
qint32 v1 = this->ui->hs_VolumeCom1->value();
|
||||
qint32 v2 = this->ui->hs_VolumeCom2->value();
|
||||
this->ui->hs_VolumeCom1->setToolTip(QString::number(v1));
|
||||
this->ui->hs_VolumeCom2->setToolTip(QString::number(v2));
|
||||
// this->getIContextAudio()->setVolumes(v1, v2);
|
||||
if (volume > 100)
|
||||
{
|
||||
// 100 -> 100, 120 -> 200, 140 -> 300
|
||||
int v = volume - 100;
|
||||
volume = 100 + v * 5;
|
||||
}
|
||||
this->ui->hs_Volume->setToolTip(QString::number(volume));
|
||||
|
||||
Q_ASSERT(this->getIContextAudio());
|
||||
if (this->getIContextAudio()->getVoiceOutputVolume() != volume)
|
||||
{
|
||||
this->getIContextAudio()->setVoiceOutputVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::ps_changeOutputVolumeFromSpinBox(int volume)
|
||||
{
|
||||
this->ui->sb_Volume->setToolTip(QString::number(volume));
|
||||
Q_ASSERT(this->getIContextAudio());
|
||||
if (this->getIContextAudio()->getVoiceOutputVolume() != volume)
|
||||
{
|
||||
this->getIContextAudio()->setVoiceOutputVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioVolumeComponent::ps_onWindowsMixerRequested()
|
||||
|
||||
@@ -45,10 +45,13 @@ namespace BlackGui
|
||||
void ps_onMuteChanged(bool muted);
|
||||
|
||||
//! Volumes changed (elsewhere)
|
||||
void ps_onVolumesChanged(qint32 com1Volume, qint32 com2Volume);
|
||||
void ps_onOutputVolumeChanged(int volume);
|
||||
|
||||
//! Change values because of volume GUI controls
|
||||
void ps_changeVolume();
|
||||
void ps_changeOutputVolumeFromSlider(int volume);
|
||||
|
||||
//! Change values because of volume GUI controls
|
||||
void ps_changeOutputVolumeFromSpinBox(int volume);
|
||||
|
||||
//! Requested windows mixer
|
||||
void ps_onWindowsMixerRequested();
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>275</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -36,10 +36,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="fl_AudioVolume">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_Sound">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
@@ -56,50 +53,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_VolumeCom1">
|
||||
<property name="text">
|
||||
<string>Volume COM1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="hs_VolumeCom1">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="sliderPosition">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_VolumeCom2">
|
||||
<widget class="QLabel" name="lbl_Volume">
|
||||
<property name="text">
|
||||
<string>Volume COM2</string>
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSlider" name="hs_VolumeCom2">
|
||||
<widget class="QSlider" name="hs_Volume">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>140</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="sliderPosition">
|
||||
<number>50</number>
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksAbove</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@@ -174,7 +157,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="hs_AudioSoundButtons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -189,6 +172,26 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lbl_ContextLocation">
|
||||
<property name="text">
|
||||
<string>local</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="sb_Volume">
|
||||
<property name="maximum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>90</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -225,6 +225,10 @@ QLabel {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QToolButton {
|
||||
background-color: transparent; /* transparent tool buttons */
|
||||
}
|
||||
|
||||
QLineEdit {
|
||||
background: transparent;
|
||||
border: 1px solid green;
|
||||
|
||||
@@ -308,6 +308,10 @@
|
||||
<file>icons/diagona/icons/speaker-network.png</file>
|
||||
<file>icons/diagona/icons/speaker--pencil.png</file>
|
||||
<file>icons/diagona/icons/speaker--plus.png</file>
|
||||
<file>icons/diagona/icons/toggle.png</file>
|
||||
<file>icons/diagona/icons/toggle-expand.png</file>
|
||||
<file>icons/diagona/icons/toggle-small.png</file>
|
||||
<file>icons/diagona/icons/toggle-small-expand.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/own">
|
||||
<file>icons/own/app.jpg</file>
|
||||
|
||||
Reference in New Issue
Block a user