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: {
if (activeVoiceCall) {
dialer.calling = true;
dialerOverlay.open();
//main.activeVoiceCallPerson = people.personByPhoneNumber(activeVoiceCall.lineId);
dialer.numberEntryText = activeVoiceCall.lineId;
dialerOverlay.item.numberEntryText = activeVoiceCall.lineId;
} else {
dialer.calling = false;
dialerOverlay.close();
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 {
left: parent.left
top: statusPanel.bottom
@ -225,36 +233,16 @@ Item {
}
z: 20
}
Dialer {
id: dialer
Loader {
id: pinOverlay
anchors {
left: parent.left
top: statusPanel.bottom
right: parent.right
bottom: parent.bottom
}
z: 20
opacity: calling ? 1 : 0
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;
}
}
z: 21
source: simManager.pinRequired != OfonoSimManager.NoPin ? Qt.resolvedUrl("Pin.qml") : ""
}
Rectangle {
@ -389,9 +377,9 @@ Item {
svg: stripeIcons
elementId: "phone"
callback: function() {
dialerOverlay.open()
//TODO remove
dialer.state = "disconnected"
dialer.open()
dialerOverlay.item.state = "disconnected"
}
}

View file

@ -28,6 +28,7 @@ Rectangle {
id: dialer
color: "black"
opacity: 0.8
visible: false
state: manager.activeVoiceCall ? manager.activeVoiceCall.statusText : "disconnected"
property color textColor: "white"
@ -43,6 +44,10 @@ Rectangle {
opacity = 0.8;
}
function close() {
opacity = 0;
}
function addNumber(number) {
status.text = status.text + number
}
@ -79,7 +84,25 @@ Rectangle {
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 {
anchors.fill: parent