change callback a bit

make the keypad on call ui send dtmf on the call
This commit is contained in:
Marco Martin 2015-04-21 10:54:30 +02:00
parent 63300072c4
commit ad195790e8
6 changed files with 78 additions and 20 deletions

View file

@ -45,6 +45,11 @@ Item {
return '' + h + ':' + m + ':' + s;
}
onStatusChanged: {
if (status != 1) {
dialerButton.checked = false;
}
}
ColumnLayout {
id: activeCallUi
@ -61,8 +66,9 @@ Item {
Layout.fillHeight: true
Layout.minimumHeight: parent.height/2
contentWidth: topContents.width;
contentWidth: topContents.width
contentHeight: topContents.height
interactive: status == 1;
Row {
id: topContents
Avatar {
@ -72,6 +78,12 @@ Item {
Dialpad {
width: topFlickable.width
height: topFlickable.height
callback: function (string) {
if (voiceCallmanager.activeVoiceCall) {
voiceCallmanager.activeVoiceCall.sendDtmf(string);
}
}
}
}

View file

@ -51,11 +51,6 @@ Item {
}
}
function fromContacts() {
console.log("Should get from contacts!");
status.text = "+41 76 555 5555"
}
ColumnLayout {
id: dialPadArea
@ -75,7 +70,15 @@ Item {
}
Dialpad {
callback: function (string) {
addNumber(string);
}
pressedCallback: function (string) {
voiceCallmanager.startDtmfTone(string);
}
releasedCallback: function (string) {
voiceCallmanager.stopDtmfTone();
}
}
RowLayout {
@ -104,7 +107,7 @@ Item {
enabled: status.text.length > 0
opacity: enabled ? 1 : 0.5
source: "edit-clear"
callback: function() {
callback: function(text) {
if (status.text.length > 0) {
status.text = status.text.substr(0, status.text.length - 1);
}

View file

@ -36,25 +36,53 @@ PlasmaComponents.Label {
property alias sub: longHold.text
property var callback
property var pressedCallback
property var releasedCallback
MouseArea {
anchors.fill: parent
onPressed: voiceCallmanager.startDtmfTone(parent.text);
onReleased: voiceCallmanager.stopDtmfTone();
onCanceled: voiceCallmanager.stopDtmfTone();
onPressed: {
if (pressedCallback) {
pressedCallback(parent.text);
} else if (pad.pressedCallback) {
pad.pressedCallback(parent.text);
}
}
onReleased: {
if (releasedCallback) {
releasedCallback(parent.text);
} else if (pad.releasedCallback) {
pad.releasedCallback(parent.text);
}
}
onCanceled: {
if (releasedCallback) {
releasedCallback(parent.text);
} else if (pad.releasedCallback) {
pad.releasedCallback(parent.text);
}
}
onClicked: {
if (callback) {
callback();
} else {
addNumber(parent.text);
callback(parent.text);
} else if (pad.callback) {
pad.callback(parent.text);
}
}
onPressAndHold: {
var text;
if (longHold.visible) {
addNumber(longHold.text);
text = longHold.text;
} else {
addNumber(parent.text);
text = parent.text;
}
if (callback) {
callback(text);
} else if (pad.callback) {
pad.callback(text);
}
}
}

View file

@ -30,6 +30,8 @@ Item {
Layout.fillHeight: true
property var callback
property var pressedCallback
property var releasedCallback
property string sub
property alias source: icon.source
property alias text: label.text
@ -55,17 +57,24 @@ Item {
anchors.fill: parent
onClicked: {
if (callback) {
callback();
callback(parent.text);
} else {
addNumber(parent.text);
}
}
onPressAndHold: {
if (parent.sub.length > 0) {
addNumber(parent.sub);
var text;
if (longHold.visible) {
text = longHold.text;
} else {
addNumber(parent.text);
text = parent.text;
}
if (callback) {
callback(text);
} else if (pad.callback) {
pad.callback(text);
}
}
}

View file

@ -27,6 +27,10 @@ GridLayout {
id: pad
columns: 3
property var callback
property var pressedCallback
property var releasedCallback
property int buttonHeight: parent.height / 6
Layout.fillWidth: true

View file

@ -116,6 +116,7 @@ ApplicationWindow {
anchors.fill: parent
when: root.visible && root.status == 0
source: Qt.resolvedUrl("Dialer/Dialer.qml")
z: root.status == 0 ? 2 : 0
opacity: root.status == 0 ? 1 : 0
Behavior on opacity {
OpacityAnimator {
@ -130,6 +131,7 @@ ApplicationWindow {
when: root.status > 0
source: Qt.resolvedUrl("Call/CallPage.qml")
opacity: root.status > 0 ? 1 : 0
z: root.status > 0 ? 2 : 0
Behavior on opacity {
OpacityAnimator {
duration: units.shortDuration