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

videooverlay: add sip keypad to play DTMF

Change-Id: I5ea40870708bb2a25f356b01a46cf209d2798f0f
parent b0f31cfc
......@@ -1191,7 +1191,10 @@ CallWidget::deselectConversation()
currentConversationModel->selectConversation("");
LRCInstance::setSelectedConvId();
ui->smartList->selectionModel()->clear();
if (auto smartListSelectionModel = ui->smartList->selectionModel()) {
smartListSelectionModel->clear();
}
disconnect(imConnection_);
}
......
......@@ -70,7 +70,8 @@ HEADERS += ./aboutdialog.h \
./messagewebpage.h \
./pixbufmanipulator.h \
./settingswidget.h \
./updatedownloaddialog.h
./updatedownloaddialog.h \
./sipinputpanel.h
SOURCES += ./aboutdialog.cpp \
./banneditemwidget.cpp \
./conversationsfilterwidget.cpp \
......@@ -122,7 +123,8 @@ SOURCES += ./aboutdialog.cpp \
./messagewebpage.cpp \
./pixbufmanipulator.cpp \
./smartlistselectorbuttonnotifier.cpp \
./videooverlay.cpp
./videooverlay.cpp \
./sipinputpanel.cpp
FORMS += ./aboutdialog.ui \
./advancedsipsettingwidget.ui \
./callwidget.ui \
......@@ -145,5 +147,6 @@ FORMS += ./aboutdialog.ui \
./newwizardwidget.ui \
./photoboothwidget.ui \
./updateconfirmdialog.ui \
./videoview.ui
./videoview.ui \
./sipkeypad.ui
RESOURCES += ressources.qrc
......@@ -84,5 +84,6 @@
<file>images/icons/baseline-people-24px.svg</file>
<file>images/icons/round-add_a_photo-24px.svg</file>
<file>images/icons/ic_mic_white_24dp.png</file>
<file>images/icons/icon-keypad-24.png</file>
</qresource>
</RCC>
......@@ -241,6 +241,7 @@ del /s /q $(OutDir)\Jami.exp</Command>
<ClCompile Include="currentaccountcombobox.cpp" />
<ClCompile Include="aboutdialog.cpp" />
<ClCompile Include="levelmeter.cpp" />
<ClCompile Include="sipinputpanel.cpp" />
<ClCompile Include="splashscreen.cpp" />
<ClCompile Include="updatedownloaddialog.cpp" />
<ClCompile Include="downloadmanager.cpp" />
......@@ -518,6 +519,10 @@ del /s /q $(OutDir)\Jami.exp</Command>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
</QtMoc>
<QtMoc Include="sipinputpanel.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='ReleaseCompile|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(ProjectDir)..\ring-daemon\contrib\msvc\include;$(ProjectDir)..\daemon\contrib\msvc\include;$(ProjectDir)..\ring-lrc\src;$(ProjectDir)..\lrc\src;$(ProjectDir)winsparkle\include;$(ProjectDir)qrencode-win32\qrencode-win32;$(QTDIR)\include;$(QTDIR)\include\QtSvg;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtWinExtras;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtXml;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWebEngineWidgets;$(QTDIR)\include\QtWebChannel;$(QTDIR)\include\QtCore;$(QTDIR)\mkspecs\win32-msvc;.\release</IncludePath>
</QtMoc>
<ClInclude Include="utils.h" />
<QtMoc Include="videooverlay.h">
</QtMoc>
......@@ -632,6 +637,7 @@ del /s /q $(OutDir)\Jami.exp</Command>
<QtUic Include="callwidget.ui">
<SubType>Designer</SubType>
</QtUic>
<QtUic Include="sipkeypad.ui" />
<QtUic Include="updatedownloaddialog.ui" />
<QtUic Include="contactpicker.ui" />
<QtUic Include="deleteaccountdialog.ui">
......
......@@ -219,6 +219,9 @@
<ClCompile Include="levelmeter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="sipinputpanel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="aboutdialog.h">
......@@ -380,6 +383,9 @@
<QtMoc Include="splashscreen.h">
<Filter>Generated Files</Filter>
</QtMoc>
<QtMoc Include="sipinputpanel.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
......@@ -665,6 +671,9 @@
<QtUic Include="contactpicker.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="sipkeypad.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="images\FontAwesome.otf">
......
/***************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "ui_sipkeypad.h"
#include "sipinputpanel.h"
#include <QMouseEvent>
#include "lrcinstance.h"
SipInputPanel::SipInputPanel(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SIPInputPanelDialog)
, signalMapper(new QSignalMapper(this))
{
ui->setupUi(this);
setWindowFlags(Qt::CustomizeWindowHint);
setWindowFlags(Qt::Popup | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
//Adds a mapping so that when map() is signalled from the sender, the signal mapped(id) is emitted.
signalMapper->setMapping(ui->panelButton_0, 0);
signalMapper->setMapping(ui->panelButton_1, 1);
signalMapper->setMapping(ui->panelButton_2, 2);
signalMapper->setMapping(ui->panelButton_3, 3);
signalMapper->setMapping(ui->panelButton_4, 4);
signalMapper->setMapping(ui->panelButton_5, 5);
signalMapper->setMapping(ui->panelButton_6, 6);
signalMapper->setMapping(ui->panelButton_7, 7);
signalMapper->setMapping(ui->panelButton_8, 8);
signalMapper->setMapping(ui->panelButton_9, 9);
signalMapper->setMapping(ui->panelButton_hash, 10);
signalMapper->setMapping(ui->panelButton_star, 11);
connect(ui->panelButton_0, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_1, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_2, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_3, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_4, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_5, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_6, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_7, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_8, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_9, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_hash, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_star, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(panelButtonClicked(int)));
}
SipInputPanel::~SipInputPanel()
{
delete ui;
}
void
SipInputPanel::panelButtonClicked(const int& id)
{
emit sipInputPanelClicked(id);
}
void
SipInputPanel::mousePressEvent(QMouseEvent *event)
{
auto sipPanelWidgetRect = ui->SIPInputPanelWidget->contentsRect();
if (!sipPanelWidgetRect.contains(event->pos())) {
emit willClose(event);
}
}
/***************************************************************************
* Copyright (C) 2019 by Savoir-faire Linux *
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#pragma once
#include <QDialog>
#include <QSignalMapper>
namespace Ui {
class SIPInputPanelDialog;
}
class SipInputPanel : public QDialog {
Q_OBJECT
public:
SipInputPanel(QWidget* parent = nullptr);
~SipInputPanel();
signals:
void sipInputPanelClicked(int id);
void willClose(QMouseEvent *event);
private:
Ui::SIPInputPanelDialog* ui;
QSignalMapper *signalMapper;
private slots:
void panelButtonClicked(const int&);
protected:
void mousePressEvent(QMouseEvent *event);
};
This diff is collapsed.
......@@ -181,7 +181,8 @@ QWidget#messageViewLayoutWidget, QWidget#welcomePage {
QPushButton#holdButton, QPushButton#chatButton, QPushButton#noMicButton, QPushButton#noVideoButton,
QPushButton#transferButton, QPushButton#addPersonButton, QPushButton#joinButton,
QPushButton#qualityButton, QPushButton#recButton, QPushButton#transferCallButton {
QPushButton#qualityButton, QPushButton#recButton, QPushButton#transferCallButton,
QPushButton#sipInputPanelButton {
background-color: rgba(0, 0, 0, 140);
border-radius: 18px;
border: solid 1px;
......@@ -190,7 +191,8 @@ QPushButton#qualityButton, QPushButton#recButton, QPushButton#transferCallButton
QPushButton#holdButton:hover, QPushButton#chatButton:hover, QPushButton#noMicButton:hover,
QPushButton#noVideoButton:hover, QPushButton#transferButton:hover, QPushButton#addPersonButton:hover,
QPushButton#joinButton:hover, QPushButton#qualityButton:hover, QPushButton#addToContactButton:hover,
QPushButton#recButton:hover, QPushButton#transferCallButton:hover {
QPushButton#recButton:hover, QPushButton#transferCallButton:hover,
QPushButton#sipInputPanelButton:hover {
background-color: rgba(0, 192, 213, 0.6);
}
......@@ -203,7 +205,8 @@ QPushButton#recButton:pressed {
QPushButton#holdButton:checked, QPushButton#noMicButton:checked,
QPushButton#noVideoButton:checked, QPushButton#recButton:checked,
QPushButton#chatButton:checked, QPushButton#transferCallButton:checked {
QPushButton#chatButton:checked, QPushButton#transferCallButton:checked,
QPushButton#sipInputPanelButton:checked {
background-color: rgba(0, 192, 213, 0.8);
}
......@@ -729,9 +732,51 @@ SettingsWidget QListView {
/* } SettingsWidget */
QWidget#SIPInputPanelWidget {
border-radius: 10px;
background-color: rgba(255,255,255, 0.85);
}
QPushButton#panelButton_0, QPushButton#panelButton_1, QPushButton#panelButton_2,
QPushButton#panelButton_3, QPushButton#panelButton_4, QPushButton#panelButton_5,
QPushButton#panelButton_6, QPushButton#panelButton_7, QPushButton#panelButton_8,
QPushButton#panelButton_9, QPushButton#panelButton_hash {
text-align: center;
text-decoration: none;
background: #369;
color: white;
border: 0;
border-radius: 19px;
padding-bottom: 4px;
}
QPushButton#panelButton_star {
text-align: center;
text-decoration: none;
background: #369;
color: white;
border: 0;
border-radius: 19px;
padding-top: 4px;
}
QPushButton#panelButton_0:hover, QPushButton#panelButton_1:hover, QPushButton#panelButton_2:hover,
QPushButton#panelButton_3:hover, QPushButton#panelButton_4:hover, QPushButton#panelButton_5:hover,
QPushButton#panelButton_6:hover, QPushButton#panelButton_7:hover, QPushButton#panelButton_8:hover,
QPushButton#panelButton_9:hover, QPushButton#panelButton_hash:hover, QPushButton#panelButton_star:hover {
background: #47a;
}
QPushButton#panelButton_0:pressed, QPushButton#panelButton_1:pressed, QPushButton#panelButton_2:pressed,
QPushButton#panelButton_3:pressed, QPushButton#panelButton_4:pressed, QPushButton#panelButton_5:pressed,
QPushButton#panelButton_6:pressed, QPushButton#panelButton_7:pressed, QPushButton#panelButton_8:pressed,
QPushButton#panelButton_9:pressed, QPushButton#panelButton_hash:pressed, QPushButton#panelButton_star:pressed {
background: #58b;
}
QWidget#contactPickerWidget {
border-radius: 10px;
border:solid 1px transparent;
border: solid 1px transparent;
background-color: white;
}
......
......@@ -25,13 +25,15 @@
#include "lrcinstance.h"
#include "contactpicker.h"
#include "sipinputpanel.h"
#include "utils.h"
VideoOverlay::VideoOverlay(QWidget* parent) :
QWidget(parent),
ui(new Ui::VideoOverlay),
oneSecondTimer_(new QTimer(this)),
contactPicker_(new ContactPicker(this))
contactPicker_(new ContactPicker(this)),
sipInputPanel_(new SipInputPanel(this))
{
ui->setupUi(this);
......@@ -49,7 +51,10 @@ VideoOverlay::VideoOverlay(QWidget* parent) :
contactPicker_->setVisible(false);
contactPicker_->setTitle(QObject::tr("Select peer to transfer to"));
sipInputPanel_->setVisible(false);
connect(contactPicker_, &ContactPicker::contactWillDoTransfer, this, &VideoOverlay::slotWillDoTransfer);
connect(sipInputPanel_, &SipInputPanel::sipInputPanelClicked, this, &VideoOverlay::slotSIPInputPanelClicked);
}
VideoOverlay::~VideoOverlay()
......@@ -106,7 +111,8 @@ VideoOverlay::shouldShowOverlay()
return ui->bottomButtons->underMouse() ||
ui->topInfoBar->underMouse() ||
(callInfo.status == lrc::api::call::Status::PAUSED) ||
contactPicker_->isActiveWindow();
contactPicker_->isActiveWindow() ||
sipInputPanel_->isActiveWindow();
}
void
......@@ -184,9 +190,10 @@ VideoOverlay::on_recButton_clicked()
}
void
VideoOverlay::setTransferCallAvailability(bool visible)
VideoOverlay::setTransferCallAndSIPPanelAvailability(bool visible)
{
ui->transferCallButton->setVisible(visible);
ui->sipInputPanelButton->setVisible(visible);
}
void
......@@ -267,3 +274,53 @@ VideoOverlay::resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecordin
Utils::whileBlocking(ui->holdButton)->setChecked(isHolding);
Utils::whileBlocking(ui->onHoldLabel)->setVisible(isHolding);
}
void
VideoOverlay::on_sipInputPanelButton_toggled(bool checked)
{
if (callId_.empty() || !checked) {
return;
}
QPoint globalPos_button = mapToGlobal(ui->sipInputPanelButton->pos());
QPoint globalPos_bottomButtons = mapToGlobal(ui->bottomButtons->pos());
sipInputPanel_->move(globalPos_button.x(), globalPos_bottomButtons.y() - sipInputPanel_->height());
// receive the signal that ensure the button checked status is correct and contactpicker
// is properly hidden
Utils::oneShotConnect(sipInputPanel_, &SipInputPanel::willClose,
[this](QMouseEvent *event) {
sipInputPanel_->hide();
// check if current mouse position is on button
auto relativeClickPos = ui->sipInputPanelButton->mapFromGlobal(event->globalPos());
if (!ui->sipInputPanelButton->rect().contains(relativeClickPos)) {
ui->sipInputPanelButton->setChecked(false);
}
});
// for esc key, receive reject signal
Utils::oneShotConnect(sipInputPanel_, &QDialog::rejected,
[this] {
ui->sipInputPanelButton->setChecked(false);
});
sipInputPanel_->show();
}
void
VideoOverlay::slotSIPInputPanelClicked(const int& id)
{
switch (id)
{
case 10:
LRCInstance::getCurrentCallModel()->playDTMF(callId_, "#");
break;
case 11:
LRCInstance::getCurrentCallModel()->playDTMF(callId_, "*");
break;
default:
LRCInstance::getCurrentCallModel()->playDTMF(callId_, std::to_string(id));
break;
}
}
......@@ -23,6 +23,7 @@
#include <QTimer>
class ContactPicker;
class SipInputPanel;
namespace Ui {
class VideoOverlay;
......@@ -45,7 +46,7 @@ public:
bool shouldShowOverlay();
void simulateShowChatview(bool checked);
bool getShowChatView();
void setTransferCallAvailability(bool visible);
void setTransferCallAndSIPPanelAvailability(bool visible);
void setCurrentSelectedCalleeDisplayName(const QString& CalleeDisplayName);
void resetOverlay(bool isAudioMuted, bool isVideoMuted, bool isRecording, bool isHolding);
......@@ -59,11 +60,14 @@ private slots:
void on_noVideoButton_toggled(bool checked);
void on_recButton_clicked();
void on_transferCallButton_toggled(bool checked);
void on_sipInputPanelButton_toggled(bool checked);
void slotWillDoTransfer(const std::string& callId, const std::string& contactUri);
void slotSIPInputPanelClicked(const int& id);
private:
Ui::VideoOverlay* ui;
ContactPicker* contactPicker_;
SipInputPanel* sipInputPanel_;
bool dialogVisible_ = false;
QTimer* oneSecondTimer_;
std::string callId_;
......
......@@ -290,6 +290,47 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sipInputPanelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>36</width>
<height>36</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>36</width>
<height>36</height>
</size>
</property>
<property name="toolTip">
<string>Input Panel</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/icons/icon-keypad-24.png</normaloff>:/images/icons/icon-keypad-24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
......
......@@ -357,7 +357,7 @@ VideoView::pushRenderer(const std::string& callId, bool isSIP) {
auto call = callModel->getCall(callId);
// transfer call will only happen in SIP calls
this->overlay_->setTransferCallAvailability(isSIP);
this->overlay_->setTransferCallAndSIPPanelAvailability(isSIP);
this->overlay_->callStarted(callId);
this->overlay_->setVideoMuteVisibility(!LRCInstance::getCurrentCallModel()->getCall(callId).isAudioOnly);
......
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