on ffe76cc help sign in
unity8/qml/Panel/Panel.qml
198 lines 5.8 kB history raw
1/*
2 * Copyright (C) 2013-2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17import QtQuick 2.2
18import Ubuntu.Components 1.1
19import Unity.Application 0.1
20import "../Components"
21import ".."
23Item {
24 id: root
25 readonly property real panelHeight: indicatorArea.y + d.indicatorHeight
26 property alias indicators: __indicators
27 property alias callHint: __callHint
28 property bool fullscreenMode: false
30 Rectangle {
31 id: darkenedArea
32 property real darkenedOpacity: 0.6
33 anchors {
34 top: parent.top
35 topMargin: panelHeight
36 left: parent.left
37 right: parent.right
38 bottom: parent.bottom
39 }
40 color: "black"
41 opacity: indicators.unitProgress * darkenedOpacity
43 MouseArea {
44 anchors.fill: parent
45 enabled: indicators.shown
46 onClicked: if (indicators.fullyOpened) indicators.hide();
47 }
48 }
50 Item {
51 id: indicatorArea
52 objectName: "indicatorArea"
54 anchors.fill: parent
56 Behavior on anchors.topMargin {
57 NumberAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
58 }
60 BorderImage {
61 id: dropShadow
62 anchors {
63 fill: indicators
64 leftMargin: -units.gu(1)
65 bottomMargin: -units.gu(1)
66 }
67 visible: !indicators.fullyClosed
68 source: "graphics/rectangular_dropshadow.sci"
69 }
71 Rectangle {
72 id: indicatorAreaBackground
73 color: callHint.visible ? "green" : "black"
74 anchors {
75 top: parent.top
76 left: parent.left
77 right: parent.right
78 }
79 height: indicators.minimizedPanelHeight
81 Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
82 }
84 PanelSeparatorLine {
85 id: orangeLine
86 anchors {
87 top: indicatorAreaBackground.bottom
88 left: parent.left
89 right: indicators.left
90 }
91 saturation: 1 - indicators.unitProgress
92 }
94 Image {
95 anchors {
96 top: indicators.top
97 bottom: indicators.bottom
98 right: indicators.left
99 topMargin: indicatorArea.anchors.topMargin + indicators.minimizedPanelHeight
100 }
101 width: units.dp(2)
102 source: "graphics/VerticalDivider.png"
103 }
105 MouseArea {
106 anchors {
107 top: parent.top
108 left: parent.left
109 right: indicators.left
110 }
111 height: indicators.minimizedPanelHeight
112 enabled: callHint.visible
113 onClicked: callHint.showLiveCall()
114 }
116 IndicatorsMenu {
117 id: __indicators
118 objectName: "indicators"
120 anchors {
121 top: parent.top
122 right: parent.right
123 }
125 shown: false
126 width: root.width
127 minimizedPanelHeight: units.gu(3)
128 expandedPanelHeight: units.gu(7)
129 openedHeight: root.height - indicatorOrangeLine.height
131 overFlowWidth: {
132 if (callHint.visible) {
133 return Math.max(root.width - (callHint.width + units.gu(2)), 0)
134 }
135 return root.width
136 }
137 enableHint: !callHint.active && !fullscreenMode
138 panelColor: indicatorAreaBackground.color
140 onShowTapped: {
141 if (callHint.active) {
142 callHint.showLiveCall();
143 }
144 }
146 hideDragHandle {
147 anchors.bottomMargin: -indicatorOrangeLine.height
148 }
149 }
151 PanelSeparatorLine {
152 id: indicatorOrangeLine
153 anchors {
154 top: indicators.bottom
155 left: indicators.left
156 right: indicators.right
157 }
158 }
160 ActiveCallHint {
161 id: __callHint
162 anchors {
163 top: parent.top
164 left: parent.left
165 }
166 height: indicators.minimizedPanelHeight
167 visible: active && indicators.state == "initial"
168 }
169 }
171 QtObject {
172 id: d
173 readonly property real indicatorHeight: indicators.minimizedPanelHeight + indicatorOrangeLine.height
174 }
176 states: [
177 State {
178 name: "onscreen" //fully opaque and visible at top edge of screen
179 when: !fullscreenMode
180 PropertyChanges {
181 target: indicatorArea;
182 anchors.topMargin: 0
183 }
184 },
185 State {
186 name: "offscreen" //pushed off screen
187 when: fullscreenMode
188 PropertyChanges {
189 target: indicatorArea;
190 anchors.topMargin: indicators.state === "initial" ? -d.indicatorHeight : 0
191 }
192 PropertyChanges {
193 target: indicators.showDragHandle;
194 anchors.bottomMargin: -units.gu(1)
195 }
196 }
197 ]