Commit 11a5ff9b authored by Ming Rui Zhang's avatar Ming Rui Zhang

sipinputpanel: add A,B,C,D dtmf signals onto sip input panel

- migrate sip input panel to popup widget

Change-Id: Ibca204d6e7f1ea69558f20a4ec751dfb1d63d7e6
parent 609c2292
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>261</width>
<height>289</height>
<width>64</width>
<height>16</height>
</rect>
</property>
<property name="windowTitle">
......
......@@ -22,18 +22,13 @@
#include "lrcinstance.h"
SipInputPanel::SipInputPanel(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SIPInputPanelDialog)
SIPInputPanelWidget::SIPInputPanelWidget(QWidget* parent)
: PopupWidget(parent, Qt::white, PopupDialog::SpikeLabelAlignment::AlignLeft)
, ui(new Ui::SIPInputPanelWidget)
, 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);
......@@ -47,6 +42,10 @@ SipInputPanel::SipInputPanel(QWidget* parent)
signalMapper->setMapping(ui->panelButton_9, 9);
signalMapper->setMapping(ui->panelButton_hash, 10);
signalMapper->setMapping(ui->panelButton_star, 11);
signalMapper->setMapping(ui->panelButton_A, 12);
signalMapper->setMapping(ui->panelButton_B, 13);
signalMapper->setMapping(ui->panelButton_C, 14);
signalMapper->setMapping(ui->panelButton_D, 15);
connect(ui->panelButton_0, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_1, SIGNAL(clicked()), signalMapper, SLOT(map()));
......@@ -60,26 +59,21 @@ SipInputPanel::SipInputPanel(QWidget* parent)
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(ui->panelButton_A, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_B, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_C, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(ui->panelButton_D, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(panelButtonClicked(int)));
}
SipInputPanel::~SipInputPanel()
SIPInputPanelWidget::~SIPInputPanelWidget()
{
delete ui;
}
void
SipInputPanel::panelButtonClicked(const int& id)
SIPInputPanelWidget::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);
}
}
......@@ -18,31 +18,29 @@
#pragma once
#include "widgethelpers.h"
#include <QDialog>
#include <QSignalMapper>
namespace Ui {
class SIPInputPanelDialog;
class SIPInputPanelWidget;
}
class SipInputPanel : public QDialog {
class SIPInputPanelWidget : public PopupWidget {
Q_OBJECT
public:
SipInputPanel(QWidget* parent = nullptr);
~SipInputPanel();
SIPInputPanelWidget(QWidget* parent = nullptr);
~SIPInputPanelWidget();
signals:
void sipInputPanelClicked(int id);
void willClose(QMouseEvent *event);
private:
Ui::SIPInputPanelDialog* ui;
Ui::SIPInputPanelWidget* ui;
QSignalMapper *signalMapper;
private slots:
void panelButtonClicked(const int&);
protected:
void mousePressEvent(QMouseEvent *event);
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SIPInputPanelDialog</class>
<widget class="QDialog" name="SIPInputPanelDialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<class>SIPInputPanelWidget</class>
<widget class="QWidget" name="SIPInputPanelWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>160</width>
<height>236</height>
<width>226</width>
<height>216</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -19,691 +16,697 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string/>
<property name="minimumSize">
<size>
<width>0</width>
<height>216</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>216</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>15</number>
</property>
<property name="topMargin">
<number>0</number>
<number>15</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>15</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
<number>15</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="SIPInputPanelWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<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>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="ElementContainer">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>12</number>
</property>
<item row="2" column="0">
<widget class="QPushButton" name="panelButton_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>4</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>52</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>52</unicode>
</char>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="panelButton_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>6</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>54</unicode>
</char>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="panelButton_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>1</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>49</unicode>
</char>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="panelButton_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>5</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>53</unicode>
</char>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="panelButton_hash">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>#</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>35</unicode>
</char>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="panelButton_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>9</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>57</unicode>
</char>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="panelButton_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>7</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>55</unicode>
</char>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="panelButton_0">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>0</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>48</unicode>
</char>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="panelButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>2</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>50</unicode>
</char>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="panelButton_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>8</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>56</unicode>
</char>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="panelButton_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>3</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="buttonValue" stdset="0">
<char>
<unicode>51</unicode>
</char>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="panelButton_star">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>