@@ -16,19 +16,40 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19+import Ubuntu.Layouts 1.0
19import Unity.Application 0.1
20import Unity.Application 0.1
21+import Unity.Indicators 0.1
23+import Unity.ApplicationMenu 0.1
25+import QtQuick.Window 2.2
26+// for indicator-keyboard
27+import AccountsService 0.1
28+import Unity.InputInfo 0.1
30+import "../ApplicationMenus"
20import "../Components"
31import "../Components"
21import "../Components/PanelState"
32import "../Components/PanelState"
22import ".."
33import ".."
26− readonly property real panelHeight: indicatorArea.y + d.indicatorHeight
38+ readonly property real panelHeight: indicatorArea.y + minimizedPanelHeight
40+ property real minimizedPanelHeight: units.gu(3)
41+ property real expandedPanelHeight: units.gu(7)
42+ property real indicatorMenuWidth: width
43+ property real applicationMenuWidth: width
45+ property alias applicationMenus: fakeApplicationMenus
27 property alias indicators: __indicators
46 property alias indicators: __indicators
28− property alias callHint: __callHint
29 property bool fullscreenMode: false
47 property bool fullscreenMode: false
30 property real indicatorAreaShowProgress: 1.0
48 property real indicatorAreaShowProgress: 1.0
31 property bool locked: false
49 property bool locked: false
50+ property bool greeterShown: false
52+ property string mode: "staged"
33 MouseArea {
54 MouseArea {
34 anchors.fill: parent
55 anchors.fill: parent
@@ -42,7 +63,17 @@ Item {
43 target: PanelState
64 target: PanelState
44 property: "panelHeight"
65 property: "panelHeight"
45− value: indicators.minimizedPanelHeight
66+ value: minimizedPanelHeight
70+ id: fakeApplicationMenus
71+ model: registeredMenuModel.model
74+ RegisteredApplicationMenuModel {
75+ id: registeredMenuModel
76+ persistentSurfaceId: PanelState.focusedPersistentSurfaceId
@@ -53,25 +84,24 @@ Item {
54 transform: Translate {
85 transform: Translate {
55 y: indicators.state === "initial"
86 y: indicators.state === "initial"
56− ? (1.0 - indicatorAreaShowProgress) * -d.indicatorHeight
87+ ? (1.0 - indicatorAreaShowProgress) * - minimizedPanelHeight
60 BorderImage {
91 BorderImage {
61 id: indicatorsDropShadow
92 id: indicatorsDropShadow
63− fill: indicators
94+ fill: __indicators
64− leftMargin: -units.gu(1)
65− bottomMargin: -units.gu(1)
95+ margins: -units.gu(1)
67− visible: !indicators.fullyClosed
97+ visible: !__indicators.fullyClosed
68 source: "graphics/rectangular_dropshadow.sci"
98 source: "graphics/rectangular_dropshadow.sci"
71 BorderImage {
101 BorderImage {
72 id: panelDropShadow
102 id: panelDropShadow
73 anchors {
103 anchors {
74− fill: indicatorAreaBackground
104+ fill: panelAreaBackground
75 bottomMargin: -units.gu(1)
105 bottomMargin: -units.gu(1)
77 visible: PanelState.dropShadow && !callHint.visible
107 visible: PanelState.dropShadow && !callHint.visible
@@ -79,59 +109,289 @@ Item {
81 Rectangle {
111 Rectangle {
82− id: indicatorAreaBackground
112+ id: panelAreaBackground
83− color: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
113+ color: theme.palette.normal.background
84 anchors {
114 anchors {
85 top: parent.top
115 top: parent.top
86 left: parent.left
116 left: parent.left
87 right: parent.right
117 right: parent.right
89− height: indicators.minimizedPanelHeight
119+ height: minimizedPanelHeight
91 Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
121 Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
126+ sourceComponent: mode == "staged" ? stagedLeftPanelComponent : windowedLeftPanelComponent
128+ height: minimizedPanelHeight
130+ opacity: root.locked ? 0 : 1
131+ visible: opacity != 0
132+ Behavior on opacity { UbuntuNumberAnimation {} }
136+ id: stagedLeftPanelComponent
94− MouseArea {
138+ MouseArea {
139+ id: decorationMouseArea
95− objectName: "windowControlArea"
140+ objectName: "windowControlArea"
96− anchors {
141+ anchors {
98− left: parent.left
142+ left: parent.left
99− right: indicators.left
143+ right: parent.right
101− height: indicators.minimizedPanelHeight
145+ height: minimizedPanelHeight
102− hoverEnabled: true
146+ hoverEnabled: !__indicators.shown
148+ if (callHint.visible) {
103− onClicked: if (callHint.visible) { callHint.showLiveCall(); }
149+ callHint.showLiveCall();
105− onPressed: {
153+ BorderImage {
154+ id: applicationMenusDropShadow
156+ fill: __applicationMenus
157+ margins: -units.gu(1)
159+ visible: !__applicationMenus.fullyClosed
160+ source: "graphics/rectangular_dropshadow.sci"
164+ id: __applicationMenus
166+ hides: fakeApplicationMenus.hides
167+ model: fakeApplicationMenus.model
169+ width: root.applicationMenuWidth
170+ minimizedPanelHeight: root.minimizedPanelHeight
171+ expandedPanelHeight: root.expandedPanelHeight
172+ openedHeight: root.height
173+ enableHint: !callHint.active && !fullscreenMode
106− if (!callHint.visible) {
174+ showOnClick: !callHint.visible
107− // let it fall through to the window decoration of the maximized window behind, if any
175+ panelColor: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
108− mouse.accepted = false;
176+ alignment: Qt.AlignLeft
178+ showRowTitle: !expanded
179+ rowTitle: PanelState.title
180+ rowItemDelegate: ActionItem {
182+ property int ownIndex: index
184+ width: _title.width + units.gu(2)
185+ height: parent.height
188+ text: model.label.replace("_", "&")
193+ anchors.centerIn: parent
194+ text: actionItem.text
195+ horizontalAlignment: Text.AlignLeft
196+ color: enabled ? "white" : "#5d5d5d"
200+ pageDelegate: IndicatorPage {
202+ context: "application-menu"
203+ menuModel: __applicationMenus.model
204+ submenuIndex: modelIndex
207+ enabled: !root.locked && model
208+ opacity: !indicators.expanded ? 1 : 0
209+ visible: opacity != 0
210+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
213+ target: fakeApplicationMenus
214+ property: "expanded"
215+ value: __applicationMenus.expanded
219+ target: fakeApplicationMenus
220+ onHide: __applicationMenus.hide();
221+ onShow: __applicationMenus.show();
227+ x: __applicationMenus.x + __applicationMenus.barWidth
228+ height: parent.height
230+ visible: active && (indicators.state == "initial" && __applicationMenus.state == "initial")
231+ greeterShown: root.greeterShown
235+ target: __indicators
236+ property: "overFlowWidth"
238+ var width = root.width;
239+ if (callHint.visible) {
240+ width -= callHint.width;
242+ if (__applicationMenus.visible) {
243+ width -= __applicationMenus.barWidth;
245+ return Math.max(width, 0);
249+ target: panelAreaBackground
251+ value: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
254+ target: __indicators
255+ property: "enableHint"
256+ value: !callHint.active && !__indicators.fullscreenMode
259+ target: __indicators
260+ property: "showOnClick"
261+ value: !callHint.visible
264+ target: __indicators
266+ if (callHint.active) {
267+ callHint.showLiveCall();
112− // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
274+ Component {
113− // cf. https://bugreports.qt.io/browse/QTBUG-32909
275+ id: windowedLeftPanelComponent
114− WindowControlButtons {
276+
115− id: windowControlButtons
277+ MouseArea {
116− objectName: "panelWindowControlButtons"
278+ id: decorationMouseArea
279+ objectName: "windowControlArea"
117 anchors {
280 anchors {
118 left: parent.left
281 left: parent.left
119− top: parent.top
282+ right: parent.right
121− height: indicators.minimizedPanelHeight
284+ height: minimizedPanelHeight
122−
285+ hoverEnabled: !__indicators.shown
123− visible: ((PanelState.buttonsVisible && parent.containsMouse) || PanelState.buttonsAlwaysVisible)
286+ onClicked: if (callHint.visible) { callHint.showLiveCall(); }
124− && !root.locked && !callHint.visible
287+
289+ if (!callHint.visible) {
290+ // let it fall through to the window decoration of the maximized window behind, if any
291+ mouse.accepted = false;
295+ property bool showWindowControls: (PanelState.decorationsVisible && (containsMouse || menuBarLoader.menusRequested)) || PanelState.decorationsAlwaysVisible
297+ // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
298+ // cf. https://bugreports.qt.io/browse/QTBUG-32909
299+ WindowControlButtons {
300+ id: windowControlButtons
301+ objectName: "panelWindowControlButtons"
306+ height: indicators.minimizedPanelHeight
307+ opacity: decorationMouseArea.showWindowControls ? 1 : 0
308+ visible: opacity != 0
309+ Behavior on opacity { UbuntuNumberAnimation {} }
125− active: PanelState.buttonsVisible || PanelState.buttonsAlwaysVisible
311+ active: PanelState.decorationsVisible || PanelState.decorationsAlwaysVisible
126− windowIsMaximized: true
312+ windowIsMaximized: true
127− onCloseClicked: PanelState.closeClicked()
313+ onCloseClicked: PanelState.closeClicked()
128− onMinimizeClicked: PanelState.minimizeClicked()
314+ onMinimizeClicked: PanelState.minimizeClicked()
129− onMaximizeClicked: PanelState.restoreClicked()
315+ onMaximizeClicked: PanelState.restoreClicked()
130− closeButtonShown: PanelState.closeButtonShown
316+ closeButtonShown: PanelState.closeButtonShown
322+ left: windowControlButtons.right
323+ leftMargin: units.gu(3)
325+ height: parent.height
326+ opacity: windowControlButtons.opacity
327+ visible: opacity != 0
328+ active: fakeApplicationMenus.model
330+ property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
332+ sourceComponent: MenuBarLoader {
333+ height: menuBarLoader.height
334+ enableKeyFilter: valid && PanelState.decorationsVisible
335+ unityMenuModel: fakeApplicationMenus.model
341+ objectName: "windowDecorationTitle"
344+ leftMargin: units.gu(1)
345+ verticalCenter: parent.verticalCenter
348+ opacity: !decorationMouseArea.showWindowControls ? 1 : 0
349+ visible: opacity != 0
350+ verticalAlignment: Text.AlignVCenter
352+ font.weight: PanelState.decorationsVisible ? Font.Light : Font.Medium
353+ text: PanelState.title
354+ elide: Text.ElideRight
356+ Behavior on opacity { UbuntuNumberAnimation {} }
361+ anchors.centerIn: parent
362+ height: minimizedPanelHeight
364+ visible: active && indicators.state == "initial"
365+ greeterShown: root.greeterShown
369+ target: panelAreaBackground
371+ value: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
374+ target: __indicators
375+ property: "enableHint"
376+ value: !callHint.active && !__indicators.fullscreenMode
379+ target: __indicators
380+ property: "showOnClick"
381+ value: !callHint.visible
384+ target: __indicators
386+ if (callHint.active) {
387+ callHint.showLiveCall();
134− IndicatorsMenu {
394+ PanelMenu {
135 id: __indicators
395 id: __indicators
136 objectName: "indicators"
396 objectName: "indicators"
@@ -139,72 +399,77 @@ Item {
139 top: parent.top
399 top: parent.top
140 right: parent.right
400 right: parent.right
142−
402+ width: root.indicatorMenuWidth
144− width: root.width - (windowControlButtons.visible ? windowControlButtons.width + titleLabel.width : 0)
145− minimizedPanelHeight: units.gu(3)
403+ minimizedPanelHeight: root.minimizedPanelHeight
146− expandedPanelHeight: units.gu(7)
404+ expandedPanelHeight: root.expandedPanelHeight
147 openedHeight: root.height
405 openedHeight: root.height
149− overFlowWidth: {
407+ overFlowWidth: root.width
150− if (callHint.visible) {
151− return Math.max(root.width - (callHint.width + units.gu(2)), 0)
155− enableHint: !callHint.active && !fullscreenMode
408+ enableHint: !fullscreenMode
156− showOnClick: !callHint.visible
409+ showOnClick: true
157− panelColor: indicatorAreaBackground.color
410+ panelColor: panelAreaBackground.color
159− onShowTapped: {
412+ onShownChanged: {
160− if (callHint.active) {
413+ if (d.menuBar) d.menuBar.close();
161− callHint.showLiveCall();
166− Label {
416+ rowItemDelegate: IndicatorItem {
167− id: titleLabel
417+ id: indicatorItem
168− objectName: "windowDecorationTitle"
418+ objectName: identifier+"-panelItem"
170− left: parent.left
420+ property int ownIndex: index
171− right: __indicators.left
421+ property bool overflow: parent.width - x > __indicators.overFlowWidth
172− top: parent.top
422+ property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator || hideKeyboardIndicator)
173− leftMargin: units.gu(1)
423+ // HACK for indicator-session
174− rightMargin: units.gu(1)
424+ readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
175− topMargin: units.gu(0.5)
425+ // HACK for indicator-keyboard
176− bottomMargin: units.gu(0.5)
426+ readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && (AccountsService.keymaps.length < 2 || keyboardsModel.count == 0)
428+ height: parent.height
429+ expanded: indicators.expanded
430+ selected: ListView.isCurrentItem
432+ identifier: model.identifier
433+ busName: indicatorProperties.busName
434+ actionsObjectPath: indicatorProperties.actionsObjectPath
435+ menuObjectPath: indicatorProperties.menuObjectPath
437+ opacity: hidden ? 0.0 : 1.0
438+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
440+ width: ((expanded || indicatorVisible) && !hideSessionIndicator && !hideKeyboardIndicator) ? implicitWidth : 0
442+ Behavior on width { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
179− height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
180− opacity: !windowControlButtons.visible && !root.locked && !callHint.visible ? 1 : 0
181− visible: opacity != 0
182− verticalAlignment: Text.AlignVCenter
184− font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium
185− text: PanelState.title
186− elide: Text.ElideRight
188− Behavior on opacity { UbuntuNumberAnimation {} }
191− // TODO here would the Locally integrated menus come
445+ pageDelegate: IndicatorPage {
447+ objectName: context + "-page"
448+ context: modelData.identifier
193− ActiveCallHint {
451+ menuModel: delegate.menuModel
194− id: __callHint
452+ IndicatorDelegate {
195− anchors {
453+ id: delegate
196− top: parent.top
454+ busName: modelData.indicatorProperties.busName
197− left: parent.left
455+ actionsObjectPath: modelData.indicatorProperties.actionsObjectPath
456+ menuObjectPath: modelData.indicatorProperties.menuObjectPath
199− height: indicators.minimizedPanelHeight
459+
200− visible: active && indicators.state == "initial"
460+ enabled: !applicationMenus.expanded
461+ opacity: !applicationMenus.expanded ? 1 : 0
462+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
204− QtObject {
466+ InputDeviceModel {
205− id: d
467+ id: keyboardsModel
206− objectName: "panelPriv"
468+ deviceFilter: InputInfo.Keyboard
207− readonly property real indicatorHeight: indicators.minimizedPanelHeight
469+ }
210 states: [
475 states: [
@@ -222,7 +487,7 @@ Item {
222 when: fullscreenMode
487 when: fullscreenMode
223 PropertyChanges {
488 PropertyChanges {
224 target: indicatorArea;
489 target: indicatorArea;
225− anchors.topMargin: indicators.state === "initial" ? -d.indicatorHeight : 0
490+ anchors.topMargin: indicators.state === "initial" ? - minimizedPanelHeight : 0
226 opacity: indicators.fullyClosed ? 0.0 : 1.0
491 opacity: indicators.fullyClosed ? 0.0 : 1.0
228 PropertyChanges {
493 PropertyChanges {