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) : ...@@ -31,11 +31,48 @@ VideoOverlay::VideoOverlay(QWidget *parent) :
actionModel_ = CallModel::instance()->userActionModel(); actionModel_ = CallModel::instance()->userActionModel();
setAttribute(Qt::WA_NoSystemBackground); 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() VideoOverlay::~VideoOverlay()
{ {
delete ui; delete ui;
delete menu_;
} }
void void
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define VIDEOOVERLAY_H #define VIDEOOVERLAY_H
#include <QWidget> #include <QWidget>
#include <QMenu>
#include "useractionmodel.h" #include "useractionmodel.h"
...@@ -48,6 +49,7 @@ private slots: ...@@ -48,6 +49,7 @@ private slots:
private: private:
Ui::VideoOverlay *ui; Ui::VideoOverlay *ui;
UserActionModel* actionModel_; UserActionModel* actionModel_;
QMenu* menu_;
signals: signals:
void setChatVisibility(bool visible); void setChatVisibility(bool visible);
......
...@@ -17,13 +17,6 @@ ...@@ -17,13 +17,6 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <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"> <item row="1" column="1">
<widget class="QPushButton" name="holdButton"> <widget class="QPushButton" name="holdButton">
<property name="text"> <property name="text">
...@@ -54,7 +47,7 @@ ...@@ -54,7 +47,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="4"> <item row="1" column="5">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -111,7 +104,7 @@ ...@@ -111,7 +104,7 @@
</property> </property>
</widget> </widget>
</item> </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"> <widget class="QLabel" name="timerLabel">
<property name="palette"> <property name="palette">
<palette> <palette>
...@@ -155,6 +148,20 @@ ...@@ -155,6 +148,20 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<resources/> <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