dialer and pin uis loaded only on demand

This commit is contained in:
Marco Martin 2014-10-30 16:44:32 +01:00
parent 122ada1be0
commit 8c85c31fae
2 changed files with 43 additions and 32 deletions

View file

@ -126,15 +126,15 @@ Item {
onActiveVoiceCallChanged: { onActiveVoiceCallChanged: {
if (activeVoiceCall) { if (activeVoiceCall) {
dialer.calling = true; dialerOverlay.open();
//main.activeVoiceCallPerson = people.personByPhoneNumber(activeVoiceCall.lineId); //main.activeVoiceCallPerson = people.personByPhoneNumber(activeVoiceCall.lineId);
dialer.numberEntryText = activeVoiceCall.lineId; dialerOverlay.item.numberEntryText = activeVoiceCall.lineId;
} else { } else {
dialer.calling = false; dialerOverlay.close();
dialer.numberEntryText = ''; dialer.numberEntryText = '';
main.activeVoiceCallPerson = null; //main.activeVoiceCallPerson = null;
} }
} }
@ -216,7 +216,15 @@ Item {
} }
} }
Pin { Loader {
id: dialerOverlay
function open() {
source = Qt.resolvedUrl("Dialer.qml")
dialerOverlay.item.open();
}
function close() {
dialerOverlay.item.close();
}
anchors { anchors {
left: parent.left left: parent.left
top: statusPanel.bottom top: statusPanel.bottom
@ -225,36 +233,16 @@ Item {
} }
z: 20 z: 20
} }
Loader {
Dialer { id: pinOverlay
id: dialer
anchors { anchors {
left: parent.left left: parent.left
top: statusPanel.bottom top: statusPanel.bottom
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }
z: 20 z: 21
opacity: calling ? 1 : 0 source: simManager.pinRequired != OfonoSimManager.NoPin ? Qt.resolvedUrl("Pin.qml") : ""
visible: false
Behavior on opacity {
NumberAnimation { properties: "opacity"; duration: 100 }
}
onOpacityChanged: {
visible = opacity > 0;
}
onVisibleChanged: {
opacity = visible ? 0.9 : 0;
}
onCallingChanged: {
if (!calling) {
opacity = 0;
}
}
} }
Rectangle { Rectangle {
@ -389,9 +377,9 @@ Item {
svg: stripeIcons svg: stripeIcons
elementId: "phone" elementId: "phone"
callback: function() { callback: function() {
dialerOverlay.open()
//TODO remove //TODO remove
dialer.state = "disconnected" dialerOverlay.item.state = "disconnected"
dialer.open()
} }
} }

View file

@ -28,6 +28,7 @@ Rectangle {
id: dialer id: dialer
color: "black" color: "black"
opacity: 0.8 opacity: 0.8
visible: false
state: manager.activeVoiceCall ? manager.activeVoiceCall.statusText : "disconnected" state: manager.activeVoiceCall ? manager.activeVoiceCall.statusText : "disconnected"
property color textColor: "white" property color textColor: "white"
@ -43,6 +44,10 @@ Rectangle {
opacity = 0.8; opacity = 0.8;
} }
function close() {
opacity = 0;
}
function addNumber(number) { function addNumber(number) {
status.text = status.text + number status.text = status.text + number
} }
@ -79,7 +84,25 @@ Rectangle {
return '' + h + ':' + m + ':' + s; return '' + h + ':' + m + ':' + s;
} }
onCallingChanged: if (calling) {open();} Behavior on opacity {
NumberAnimation { properties: "opacity"; duration: 100 }
}
onOpacityChanged: {
visible = opacity > 0;
}
onVisibleChanged: {
opacity = visible ? 0.9 : 0;
}
onCallingChanged: {
if (calling) {
open();
} else {
opacity = 0;
}
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent