manager->voiceCallManager

This commit is contained in:
Marco Martin 2015-04-20 18:08:56 +02:00
parent 974b2fcfda
commit dd1301b522
2 changed files with 14 additions and 15 deletions

View file

@ -27,14 +27,13 @@ import org.nemomobile.voicecall 1.0
Item { Item {
id: dialer id: dialer
state: manager.activeVoiceCall ? manager.activeVoiceCall.statusText : "disconnected" state: voiceCallmanager.activeVoiceCall ? voiceCallmanager.activeVoiceCall.statusText : "disconnected"
property color textColor: "white" property color textColor: "white"
property bool calling: false // needs to be connected to a system service property bool calling: false // needs to be connected to a system service
property bool enableButtons: calling property bool enableButtons: calling
property alias numberEntryText: status.text property alias numberEntryText: status.text
property VoiceCallManager manager: root.manager
property string providerId: manager.providers.id(0) property string providerId: voiceCallmanager.providers.id(0)
function addNumber(number) { function addNumber(number) {
status.text = status.text + number status.text = status.text + number
@ -44,13 +43,13 @@ Item {
if (!calling) { if (!calling) {
console.log("Calling: " + status.text); console.log("Calling: " + status.text);
dialer.calling = true; dialer.calling = true;
manager.dial(providerId, status.text); voiceCallmanager.dial(providerId, status.text);
} else { } else {
console.log("Hanging up: " + status.text); console.log("Hanging up: " + status.text);
status.text = ''; status.text = '';
dialer.calling = false; dialer.calling = false;
var call = manager.activeVoiceCall; var call = voiceCallmanager.activeVoiceCall;
if (call) { if (call) {
call.hangup(); call.hangup();
} }
@ -184,7 +183,7 @@ Item {
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
font.pixelSize: one.font.pixelSize font.pixelSize: one.font.pixelSize
color: textColor color: textColor
text: manager.activeVoiceCall ? manager.activeVoiceCall.lineId : "" text: voiceCallmanager.activeVoiceCall ? voiceCallmanager.activeVoiceCall.lineId : ""
} }
Text { Text {
Layout.fillWidth: true Layout.fillWidth: true
@ -193,7 +192,7 @@ Item {
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
font.pixelSize: theme.smallestFont.pixelSize font.pixelSize: theme.smallestFont.pixelSize
color: textColor color: textColor
text: manager.activeVoiceCall ? secondsToTimeString(manager.activeVoiceCall.duration) : '' text: voiceCallmanager.activeVoiceCall ? secondsToTimeString(voiceCallmanager.activeVoiceCall.duration) : ''
} }
RowLayout { RowLayout {
Layout.minimumHeight: parent.height / 3 Layout.minimumHeight: parent.height / 3
@ -204,7 +203,7 @@ Item {
DialerIconButton { DialerIconButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
source: dialer.state == "incoming" ? "call-start" : (manager.isMicrophoneMuted ? "audio-volume-muted" : "audio-volume-high") source: dialer.state == "incoming" ? "call-start" : (voiceCallmanager.isMicrophoneMuted ? "audio-volume-muted" : "audio-volume-high")
Rectangle { Rectangle {
z: -1 z: -1
color: dialer.state == "incoming" ? "green" : "white" color: dialer.state == "incoming" ? "green" : "white"
@ -217,11 +216,11 @@ Item {
callback: function () { callback: function () {
if (dialer.state == "incoming") { if (dialer.state == "incoming") {
if (manager.activeVoiceCall) { if (voiceCallmanager.activeVoiceCall) {
manager.activeVoiceCall.answer(); voiceCallmanager.activeVoiceCall.answer();
} }
} else { } else {
manager.isMicrophoneMuted = !manager.isMicrophoneMuted; voiceCallmanager.isMicrophoneMuted = !voiceCallmanager.isMicrophoneMuted;
} }
} }
} }
@ -241,8 +240,8 @@ Item {
} }
callback: function () { callback: function () {
if (manager.activeVoiceCall) { if (voiceCallmanager.activeVoiceCall) {
manager.activeVoiceCall.hangup(); voiceCallmanager.activeVoiceCall.hangup();
} }
} }
} }

View file

@ -88,8 +88,8 @@ ApplicationWindow {
id: netop id: netop
} }
property VoiceCallManager manager: VoiceCallManager { VoiceCallManager {
id: manager id: voiceCallmanager
onActiveVoiceCallChanged: { onActiveVoiceCallChanged: {
if (activeVoiceCall) { if (activeVoiceCall) {