Commit 5927d04a authored by Edric Milaret's avatar Edric Milaret

call: add audio/video muting

Refs #75601

Change-Id: Ib48aeb7e1fee4fa6af321d3e6c216841bf7cc91c
parent 5c3ff7c9
......@@ -31,11 +31,48 @@ VideoOverlay::VideoOverlay(QWidget *parent) :
actionModel_ = CallModel::instance()->userActionModel();
setAttribute(Qt::WA_NoSystemBackground);
menu_ = new QMenu(this);
auto muteAudio = new QAction("Mute Audio", this);
muteAudio->setCheckable(true);
connect(muteAudio, &QAction::triggered, [=](bool) {
actionModel_->execute(UserActionModel::Action::MUTE_AUDIO);
});
menu_->addAction(muteAudio);
auto muteVideo = new QAction("Mute Video", this);
muteVideo->setCheckable(true);
connect(muteVideo, &QAction::triggered, [=](bool) {
actionModel_->execute(UserActionModel::Action::MUTE_VIDEO);
});
menu_->addAction(muteVideo);
connect(actionModel_,&UserActionModel::dataChanged, [=](const QModelIndex& tl, const QModelIndex& br) {
const int first(tl.row()),last(br.row());
for(int i = first; i <= last;i++) {
const QModelIndex& idx = actionModel_->index(i,0);
switch (idx.data(UserActionModel::Role::ACTION).value<UserActionModel::Action>()) {
case UserActionModel::Action::MUTE_AUDIO:
muteAudio->setChecked(idx.data(Qt::CheckStateRole).value<bool>());
muteAudio->setEnabled(idx.flags() & Qt::ItemIsEnabled);
break;
case UserActionModel::Action::MUTE_VIDEO:
muteVideo->setChecked(idx.data(Qt::CheckStateRole).value<bool>());
muteVideo->setEnabled(idx.flags() & Qt::ItemIsEnabled);
break;
default:
break;
}
}
});
ui->moreButton->setMenu(menu_);
}
VideoOverlay::~VideoOverlay()
{
delete ui;
delete menu_;
}
void
......
......@@ -20,6 +20,7 @@
#define VIDEOOVERLAY_H
#include <QWidget>
#include <QMenu>
#include "useractionmodel.h"
......@@ -48,6 +49,7 @@ private slots:
private:
Ui::VideoOverlay *ui;
UserActionModel* actionModel_;
QMenu* menu_;
signals:
void setChatVisibility(bool visible);
......
......@@ -17,13 +17,6 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QPushButton" name="hangupButton">
<property name="text">
<string>Hangup</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="holdButton">
<property name="text">
......@@ -54,7 +47,7 @@
</property>
</spacer>
</item>
<item row="1" column="4">
<item row="1" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -111,7 +104,7 @@
</property>
</widget>
</item>
<item row="0" column="4" alignment="Qt::AlignRight|Qt::AlignTop">
<item row="0" column="5" alignment="Qt::AlignRight|Qt::AlignTop">
<widget class="QLabel" name="timerLabel">
<property name="palette">
<palette>
......@@ -155,6 +148,20 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="hangupButton">
<property name="text">
<string>Hangup</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="moreButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
......
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