Ming Rui Zhang | 44dba71 | 2020-08-25 14:32:34 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 by Savoir-faire Linux |
| 3 | * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | import QtQuick 2.14 |
| 20 | import QtQuick.Controls 2.14 |
| 21 | import QtQuick.Layouts 1.14 |
| 22 | import QtQuick.Controls.Universal 2.12 |
| 23 | import net.jami.Models 1.0 |
| 24 | |
| 25 | import "../../commoncomponents" |
| 26 | |
| 27 | /* |
| 28 | * SipInputPanel is a key pad that is designed to be |
| 29 | * used in sip calls. |
| 30 | */ |
| 31 | Popup { |
| 32 | id: sipInputPanelPopUp |
| 33 | |
| 34 | /* |
| 35 | * Space between sipInputPanelRect and grid layout |
| 36 | */ |
| 37 | property int sipPanelPadding: 20 |
| 38 | |
| 39 | contentWidth: sipInputPanelRectGridLayout.implicitWidth + 20 |
| 40 | contentHeight: sipInputPanelRectGridLayout.implicitHeight + 20 |
| 41 | |
| 42 | padding: 0 |
| 43 | |
| 44 | modal: true |
| 45 | |
| 46 | contentItem: Rectangle { |
| 47 | id: sipInputPanelRect |
| 48 | |
| 49 | radius: 10 |
| 50 | |
| 51 | GridLayout { |
| 52 | id: sipInputPanelRectGridLayout |
| 53 | |
| 54 | anchors.centerIn: parent |
| 55 | |
| 56 | columns: 4 |
| 57 | |
| 58 | Repeater { |
| 59 | id: sipInputPanelRectGridLayoutRepeater |
| 60 | model: ["1", "2", "3", "A", "4", "5", "6", "B", "7", |
| 61 | "8", "9", "C", "*", "0", "#", "D"] |
| 62 | |
| 63 | HoverableButton { |
| 64 | id: sipInputPanelButton |
| 65 | |
| 66 | Layout.preferredWidth: 30 |
| 67 | Layout.preferredHeight: 30 |
| 68 | |
| 69 | radius: 30 |
| 70 | buttonText: modelData |
| 71 | buttonTextColor: "white" |
| 72 | checkable: false |
| 73 | backgroundColor: JamiTheme.sipInputButtonBackgroundColor |
| 74 | onEnterColor: JamiTheme.sipInputButtonHoverColor |
| 75 | onExitColor: JamiTheme.sipInputButtonBackgroundColor |
| 76 | onPressColor: JamiTheme.sipInputButtonPressColor |
| 77 | onReleaseColor: JamiTheme.sipInputButtonHoverColor |
| 78 | |
| 79 | toolTipText: modelData |
| 80 | |
| 81 | onClicked: { |
| 82 | CallAdapter.sipInputPanelPlayDTMF(modelData) |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | background: Rectangle { |
| 90 | color: "transparent" |
| 91 | } |
| 92 | } |