Commit b9ec6278 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Ming Rui Zhang

audiometer: allow metering during calls

Change-Id: I82c8d1a573cfc078e1c5e460a0f407015e1ca1cd
parent 01c69521
...@@ -703,8 +703,9 @@ AdvancedSIPSettingsWidget::lineEditVoiceMailDialCodeEditFinished() ...@@ -703,8 +703,9 @@ AdvancedSIPSettingsWidget::lineEditVoiceMailDialCodeEditFinished()
} }
bool bool
AdvancedSIPSettingsWidget::eventFilter(QObject * object, QEvent * event) AdvancedSIPSettingsWidget::eventFilter(QObject* object, QEvent* event)
{ {
Q_UNUSED(object);
if (event->type() == QEvent::Wheel) { if (event->type() == QEvent::Wheel) {
return true; return true;
} }
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <QPixmap> #include <QPixmap>
#include <QBuffer> #include <QBuffer>
#include <QtConcurrent/QtConcurrent>
#include <memory> #include <memory>
...@@ -304,6 +305,35 @@ public: ...@@ -304,6 +305,35 @@ public:
return instance().netWorkManager_.get(); return instance().netWorkManager_.get();
} }
static void startAudioMeter(bool async)
{
auto f = [] {
if (!LRCInstance::getActiveCalls().size()) {
LRCInstance::avModel().startAudioDevice();
}
LRCInstance::avModel().setAudioMeterState(true);
};
if (async) {
QtConcurrent::run(f);
} else {
f();
}
}
static void stopAudioMeter(bool async)
{
auto f = [] {
if (!LRCInstance::getActiveCalls().size()) {
LRCInstance::avModel().stopAudioDevice();
}
LRCInstance::avModel().setAudioMeterState(false);
};
if (async) {
QtConcurrent::run(f);
} else {
f();
}
}
signals: signals:
void accountListChanged(); void accountListChanged();
......
...@@ -995,11 +995,7 @@ void SettingsWidget::populateAVSettings() ...@@ -995,11 +995,7 @@ void SettingsWidget::populateAVSettings()
this, &SettingsWidget::slotAudioInputIndexChanged); this, &SettingsWidget::slotAudioInputIndexChanged);
connect(&LRCInstance::avModel(), &lrc::api::AVModel::audioMeter, connect(&LRCInstance::avModel(), &lrc::api::AVModel::audioMeter,
[this](const std::string& id, float level) { this, &SettingsWidget::slotAudioMeter, Qt::UniqueConnection);
if (id == "audiolayer_id") {
ui->audioInputMeter->setLevel(level);
}
});
// audio output devices // audio output devices
disconnect(ui->outputComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), disconnect(ui->outputComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
...@@ -1132,38 +1128,25 @@ SettingsWidget::slotVideoDeviceListChanged() ...@@ -1132,38 +1128,25 @@ SettingsWidget::slotVideoDeviceListChanged()
populateVideoSettings(); populateVideoSettings();
} }
void SettingsWidget::startAudioMeter(bool async) void
SettingsWidget::slotAudioMeter(const std::string& id, float level)
{ {
if (LRCInstance::getActiveCalls().size()) { if (id == "audiolayer_id") {
return; qDebug() << "audioMeter: " << level;
ui->audioInputMeter->setLevel(level);
} }
}
void SettingsWidget::startAudioMeter(bool async)
{
ui->audioInputMeter->start(); ui->audioInputMeter->start();
auto f = [this] { LRCInstance::startAudioMeter(async);
LRCInstance::avModel().startAudioDevice();
LRCInstance::avModel().setAudioMeterState(true);
};
if (async) {
QtConcurrent::run(f);
} else {
f();
}
} }
void SettingsWidget::stopAudioMeter(bool async) void SettingsWidget::stopAudioMeter(bool async)
{ {
if (LRCInstance::getActiveCalls().size()) {
return;
}
ui->audioInputMeter->stop(); ui->audioInputMeter->stop();
auto f = [this] { LRCInstance::stopAudioMeter(async);
LRCInstance::avModel().stopAudioDevice();
LRCInstance::avModel().setAudioMeterState(false);
};
if (async) {
QtConcurrent::run(f);
} else {
f();
}
} }
void void
......
...@@ -147,5 +147,6 @@ private slots: ...@@ -147,5 +147,6 @@ private slots:
void slotFormatBoxCurrentIndexChanged(int index); void slotFormatBoxCurrentIndexChanged(int index);
void slotSetHardwareAccel(bool state); void slotSetHardwareAccel(bool state);
void slotVideoDeviceListChanged(); void slotVideoDeviceListChanged();
void slotAudioMeter(const std::string& id, float level);
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment