on xenial help sign in
single line active call hint
commitcdc76fd6d82090ce5611872d382c38bb457ac48d authorNick Dedekind <nicholas.dedekind@gmail.com> dateMon 23 Jun 2014, 16:23 (12 years ago) parente01825c
3 files changed+149−275
qml/Panel/ActiveCallHint.qml+73−132 qml/Panel/Indicators.qml+1−2 qml/Panel/Panel.qml+75−141
qml/Panel/ActiveCallHint.qml+73−132
@@ -25,9 +25,10 @@ Item {
2525
2626 property bool active: callManager.callIndicatorVisible
2727 readonly property QtObject contactWatcher: _contactWatcher
28− property int alternateLabelInterval: 4000
28+ property int alternateLabelInterval: 6000
2929 property color color: Qt.rgba(0.1, 0.6, 0.1, 1.0)
3030 property color colorFlash: Qt.lighter(color)
31+ implicitWidth: row.x + row.width
3132
3233 Component.onCompleted: {
3334 telepathyHelper.registerChannelObserver("unity8");
@@ -37,59 +38,14 @@ Item {
3738 ApplicationManager.requestFocusApplication("dialer-app");
3839 }
3940
40− Rectangle {
41− id: background
42− anchors.fill: parent
43− color: callHint.color
44−
45− states: [
46− State {
47− name: "fade-down"
48− },
49− State {
50− name: "fade-up"
51− PropertyChanges { target: background; color: callHint.colorFlash }
52− }
53− ]
54− state: "fade-down"
55−
56− transitions: [
57− Transition {
58− to: "fade-up";
59− ColorAnimation { duration: 260; easing.type: Easing.InQuart }
60− },
61− Transition {
62− to: "fade-down";
63− ColorAnimation { duration: 150; easing.type: Easing.OutQuad }
64− }
65− ]
66−
67− Timer {
68− running: callHint.active && color != colorFlash
69− interval: background.state == "fade-down" ? 3000 : 400
70− repeat: true
71− onTriggered: {
72− if (background.state == "fade-down") {
73− background.state = "fade-up";
74− } else {
75− background.state = "fade-down";
76− }
77− }
78− }
79− }
80−
8141 Component {
82− id: contactColumnRow
42+ id: contactColumn
8343
8444 Column {
8545 id: column
8646 objectName: "contactColumn"
8747
88− anchors {
89− left: parent.left
90− right: parent.right
91− }
92− height: childrenRect.height
48+ anchors.left: parent.left
9349
9450 Component.onCompleted: {
9551 if (index === 0) {
@@ -100,15 +56,16 @@ Item {
10056 }
10157
10258 Label {
103− id: contactLabel
104− objectName: "contactLabel"
59+ height: callHint.height
60+ verticalAlignment: Text.AlignVCenter
61+ text: i18n.tr("Tap to return to call...");
62+ }
10563
106− anchors {
107− left: parent.left
108− right: parent.right
109− }
64+ Label {
65+ objectName: "contactLabel"
11066 height: callHint.height
11167 verticalAlignment: Text.AlignVCenter
68+ width: Math.max(contentWidth, 1)
11269
11370 text: {
11471 if (!d.activeCall) {
@@ -120,76 +77,84 @@ Item {
12077 }
12178 }
12279 }
123−
124− Label {
125− id: returnLabel
126−
127− anchors {
128− left: parent.left
129− right: parent.right
130− }
131− height: callHint.height
132− verticalAlignment: Text.AlignVCenter
133− text: i18n.tr("Tap to return to call...");
134− }
13580 }
13681 }
13782
138− PathView {
139− id: labelPathView
140− objectName: "labelPathView"
141−
83+ Row {
84+ id: row
14285 anchors {
14386 top: parent.top
87+ bottom: parent.bottom
14488 left: parent.left
145− leftMargin:units.gu(1)
146− right: time.left
89+ leftMargin: units.gu(1)
14790 }
148− height: columnHeight > callHint.height ? callHint.height : columnHeight
149− clip: true
150−
151− property Column column1
152− property Column column2
153− property int columnHeight: column1 ? column1.height : 0
154−
155− delegate: contactColumnRow
156− model: 2
157− offset: 0
158− interactive: false
159−
160− path: Path {
161− startY: -labelPathView.columnHeight / 2
162− PathLine {
163− y: labelPathView.columnHeight * 1.5
91+ spacing: units.gu(1)
92+
93+ Label {
94+ id: time
95+ objectName: "timeLabel"
96+
97+ anchors {
98+ top: parent.top
99+ bottom: parent.bottom
100+ }
101+ verticalAlignment: Text.AlignVCenter
102+ horizontalAlignment: Text.AlignRight
103+ text: {
104+ var m = Math.round(d.callTime/60);
105+ var ss = d.callTime % 60;
106+ if (ss >= 10) {
107+ return m + ":" + ss;
108+ } else {
109+ return m + ":0" + ss;
110+ }
164111 }
165112 }
166113
167− Behavior on offset {
168− id: offsetBehaviour
169− SmoothedAnimation {
170− id: offsetAnimation
171− // ensure we go faster than the label switch
172− duration: alternateLabelInterval / 2
173− velocity: 0.75
174− easing.type: Easing.InOutQuad
114+ PathView {
115+ id: labelPathView
116+ objectName: "labelPathView"
117+
118+ anchors {
119+ top: parent.top
120+ bottom: parent.bottom
121+ }
122+ width: column1 && column2 ? Math.max(column1.width, column1.width) : 0
123+ clip: true
124+
125+ property Column column1
126+ property Column column2
127+ property int columnHeight: column1 ? column1.height : 0
128+
129+ delegate: contactColumn
130+ model: 2
131+ offset: 0
132+ interactive: false
133+
134+ path: Path {
135+ startY: -labelPathView.columnHeight / 2
136+ PathLine {
137+ y: labelPathView.columnHeight * 1.5
138+ }
175139 }
176− }
177− }
178140
179− // Fade in text
180− Rectangle {
181− anchors.fill: parent
182− gradient: Gradient {
183− GradientStop { position: 0.0; color: background.color }
184− GradientStop { position: 0.25; color: Qt.rgba(background.color.r, background.color.g, background.color.b, 0.0) }
185− GradientStop { position: 0.75; color: Qt.rgba(background.color.r, background.color.g, background.color.b, 0.0) }
186− GradientStop { position: 1.0; color: background.color }
141+ Behavior on offset {
142+ id: offsetBehaviour
143+ SmoothedAnimation {
144+ id: offsetAnimation
145+ // ensure we go faster than the label switch
146+ duration: alternateLabelTimer.interval / 2
147+ velocity: 0.75
148+ easing.type: Easing.InOutQuad
149+ }
150+ }
187151 }
188152 }
189153
190154 Timer {
155+ id: alternateLabelTimer
191156 running: callHint.active
192− interval: alternateLabelInterval
157+ interval: labelPathView.offset % 1.0 !== 0 ? alternateLabelInterval : alternateLabelInterval/4
193158 repeat: true
194159
195160 onRunningChanged: {
@@ -205,31 +170,6 @@ Item {
205170 }
206171 }
207172
208− Label {
209− id: time
210− objectName: "timeLabel"
211−
212− anchors {
213− right: parent.right
214− rightMargin:units.gu(1)
215− top: parent.top
216− }
217− height: parent.height
218− verticalAlignment: Text.AlignVCenter
219− text: {
220− if (!d.activeCall) {
221− return "0:00";
222− }
223− var m = Math.round(d.activeCall.elapsedTime/60);
224− var ss = d.activeCall.elapsedTime % 60;
225− if (ss >= 10) {
226− return m + ":" + ss;
227− } else {
228− return m + ":0" + ss;
229− }
230− }
231− }
232−
233173 Telephony.ContactWatcher {
234174 id: _contactWatcher
235175 objectName: "contactWatcher"
@@ -245,5 +185,6 @@ Item {
245185 }
246186 return callManager.backgroundCall;
247187 }
188+ property int callTime: activeCall ? activeCall.elapsedTime : 0
248189 }
249190}
qml/Panel/Indicators.qml+1−2
@@ -43,7 +43,6 @@ Showable {
4343 property real unitProgress: (height - panelHeight) / (openedHeight - panelHeight)
4444 property bool enableHint: true
4545 property real showHintBottomMargin: 0
46− property real showHintHeightOffset: 0
4746
4847 signal showTapped(point position)
4948
@@ -346,7 +345,7 @@ Showable {
346345 anchors.bottomMargin: showHintBottomMargin
347346 anchors.left: parent.left
348347 anchors.right: parent.right
349− height: panelHeight + showHintHeightOffset
348+ height: panelHeight
350349 direction: Direction.Downwards
351350 enabled: !indicators.shown && indicators.available
352351 hintDisplacement: enableHint ? indicators.hintValue : 0
qml/Panel/Panel.qml+75−141
@@ -22,7 +22,7 @@ import "../Components/ListItems"
2222
2323Item {
2424 id: root
25− readonly property real panelHeight: nonIndicatorArea.y + nonIndicatorArea.height
25+ readonly property real panelHeight: indicatorArea.y + d.indicatorHeight
2626 property alias indicators: __indicators
2727 property alias callHint: __callHint
2828 property bool fullscreenMode: false
@@ -56,9 +56,10 @@ Item {
5656 id: darkenedArea
5757 property real darkenedOpacity: 0.6
5858 anchors {
59+ top: parent.top
60+ topMargin: panelHeight
5961 left: parent.left
6062 right: parent.right
61− top: nonIndicatorArea.bottom
6263 bottom: parent.bottom
6364 }
6465 color: "black"
@@ -71,60 +72,11 @@ Item {
7172 }
7273 }
7374
74− PanelBackground {
75− anchors.fill: nonIndicatorArea
76− }
77−
78− Item {
79− id: nonIndicatorArea
80− objectName: "indicatorArea"
81−
82− anchors {
83− top: callHint.bottom
84− left: parent.left
85− right: parent.right
86− }
87− height: d.indicatorHeight
88−
89− PanelSeparatorLine {
90− id: leftSeparatorLine
91− anchors {
92− bottom: parent.bottom
93− left: parent.left
94− right: parent.right
95− }
96− saturation: 1 - indicators.unitProgress
97− }
98−
99− MouseArea {
100− id: nonIndicatorMouseArea
101− enabled: callHint.active
102− anchors {
103− top: parent.top
104− left: parent.left
105− right: parent.right
106− }
107− height: indicators.panelHeight/2
108− onClicked: callHint.activate();
109− }
110− }
111−
112− // eater
113− MouseArea {
114− anchors.fill: callHint
115− onClicked: callHint.activate()
116− }
117−
11875 Item {
11976 id: indicatorArea
12077 objectName: "indicatorArea"
12178
122− anchors {
123− top: callHint.bottom
124− right: parent.right
125− bottom: parent.bottom
126− }
127− width: indicators.width
79+ anchors.fill: parent
12880
12981 Behavior on anchors.topMargin { StandardAnimation {} }
13082
@@ -146,15 +98,34 @@ Item {
14698 bottom: indicators.bottom
14799 right: indicators.left
148100
149− topMargin: nonIndicatorArea.anchors.topMargin + indicators.panelHeight
101+ topMargin: indicatorArea.anchors.topMargin + indicators.panelHeight
150102 }
151103
152104 width: units.dp(2)
153105 source: "graphics/VerticalDivider.png"
154106 }
155107
156− PanelBackground {
157− anchors.fill: indicators
108+ Rectangle {
109+ id: indicatorAreaBackground
110+ color: callHint.visible ? "green" : "black"
111+ anchors {
112+ top: parent.top
113+ left: parent.left
114+ right: parent.right
115+ }
116+ height: indicators.panelHeight
117+
118+ Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
119+ }
120+
121+ PanelSeparatorLine {
122+ id: nonIndicatorAreaSeparatorLine
123+ anchors {
124+ top: indicatorAreaBackground.bottom
125+ left: parent.left
126+ right: indicators.left
127+ }
128+ saturation: 1 - indicators.unitProgress
158129 }
159130
160131 Indicators {
@@ -169,91 +140,80 @@ Item {
169140 width: (root.width > units.gu(60)) ? units.gu(40) : root.width
170141 shown: false
171142 panelHeight: units.gu(3)
172− openedHeight: root.height - (callHint.y + callHint.height)
173− overFlowWidth: search.state=="hidden" ? root.width : root.width - search.width
143+ openedHeight: root.height
144+ overFlowWidth: {
145+ if (callHint.visible) {
146+ return Math.max(root.width - (callHint.width + units.gu(2)), 0)
147+ }
148+ return search.state=="hidden" ? root.width : root.width - search.width
149+ }
174150
175151 enableHint: !callHint.active && !fullscreenMode
176152 showHintBottomMargin: fullscreenMode ? -panelHeight : 0
177− showHintHeightOffset: callHint.active ? callHint.height : 0
178153
179154 onShowTapped: {
180155 if (callHint.active) {
181− var callHintScenePosition = callHint.mapToItem(null, callHint.x, callHint.y);
182− var indicatorScenePosition = mapToItem(null, x, y);
183−
184− // tapped on callHint
185− if (position.y > callHintScenePosition.y && position.y <= callHintScenePosition.y + callHint.height) {
186− callHint.activate();
187− // tapped on top half of indicator
188− } else if (!fullscreenMode && position.y > indicatorScenePosition.y && position.y < indicatorScenePosition.y + panelHeight/2) {
189− callHint.activate();
190− }
156+ callHint.activate();
191157 }
192158 }
193159 }
194160
195− PanelSeparatorLine {
196− id: indicatorsSeparatorLine
197− visible: true
198− anchors {
199− top: indicators.bottom
200− left: indicatorDividor.left
201− right: indicators.right
202− }
203− }
204− }
205−
206− SearchIndicator {
207− id: search
208− objectName: "search"
209− enabled: root.searchVisible
161+ SearchIndicator {
162+ id: search
163+ objectName: "search"
164+ enabled: root.searchVisible
210165
211− state: {
212− if (parent.width < indicators.width + width) {
213− if (indicators.state != "initial") {
214− return "hidden";
166+ state: {
167+ if (callHint.visible) {
168+ return "hidden"
169+ }
170+ if (parent.width < indicators.width + width) {
171+ if (indicators.state != "initial") {
172+ return "hidden";
173+ }
174+ }
175+ if (root.searchVisible && !indicators.showAll) {
176+ return "visible";
215177 }
178+ return "hidden";
216179 }
217− if (root.searchVisible && !indicators.showAll) {
218− return "visible";
180+ anchors {
181+ top: parent.top
182+ left: parent.left
219183 }
220− return "hidden";
221− }
184+ height: indicators.panelHeight
222185
223− anchors {
224− top: nonIndicatorArea.top
225− bottom: nonIndicatorArea.bottom
226− left: nonIndicatorArea.left
186+ mouseArea {
187+ onClicked: root.searchClicked()
188+ }
227189 }
228190
229− mouseArea {
230− onClicked: root.searchClicked()
231− }
232− }
191+ ActiveCallHint {
192+ id: __callHint
193+ anchors {
194+ top: parent.top
195+ left: parent.left
196+ }
197+ height: indicators.panelHeight
198+ visible: active && indicators.state == "initial"
233199
234− ActiveCallHint {
235− id: __callHint
236− anchors {
237− left: parent.left
238− right: parent.right
200+ Component.onCompleted: console.log("callHint " + width)
239201 }
240− height: units.gu(3)
241− y: -height
242202
243− states: [
244− State {
245− name: "active"
246− when: callHint.active
247− PropertyChanges { target: callHint; y: 0 }
248− PropertyChanges { target: search.mouseArea; anchors.topMargin: -callHint.height/3 }
203+ PanelSeparatorLine {
204+ id: indicatorsSeparatorLine
205+ visible: true
206+ anchors {
207+ top: indicators.bottom
208+ left: indicatorDividor.left
209+ right: indicators.right
249210 }
250− ]
251− Behavior on y { StandardAnimation {} }
211+ }
252212 }
253213
254214 QtObject {
255215 id: d
256− readonly property real indicatorHeight: indicators.panelHeight + leftSeparatorLine.height
216+ readonly property real indicatorHeight: indicators.panelHeight + indicatorsSeparatorLine.height
257217 }
258218
259219 states: [
@@ -264,33 +224,7 @@ Item {
264224 State {
265225 name: "offscreen" //pushed off screen
266226 when: fullscreenMode
267− PropertyChanges { target: nonIndicatorArea; anchors.topMargin: -d.indicatorHeight }
268227 PropertyChanges { target: indicatorArea; anchors.topMargin: indicators.state === "initial" ? -d.indicatorHeight : 0 }
269228 }
270229 ]
271−
272− transitions: [
273− Transition {
274− to: "onscreen"
275− SequentialAnimation {
276− ParallelAnimation {
277− StandardAnimation { target: nonIndicatorArea; property: "anchors.topMargin" }
278− StandardAnimation { target: indicatorArea; property: "anchors.topMargin" }
279− }
280− PropertyAction { target: search; property: "z"; value: 2 }
281− PropertyAction { target: indicatorArea; property: "z"; value: 2 }
282− }
283− },
284− Transition {
285− to: "offscreen"
286− SequentialAnimation {
287− PropertyAction { target: search; property: "z"; value: 0 }
288− PropertyAction { target: indicatorArea; property: "z"; value: 0 }
289− ParallelAnimation {
290− StandardAnimation { target: nonIndicatorArea; property: "anchors.topMargin" }
291− StandardAnimation { target: indicatorArea; property: "anchors.topMargin" }
292− }
293− }
294− }
295− ]
296230}