2 * Copyright (C) 2013-2016 Canonical, Ltd.
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.
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.
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/>.
18import Ubuntu.Components 1.3
19import Ubuntu.Layouts 1.0
20import Unity.Application 0.1
21import Unity.Indicators 0.1
23import Unity.ApplicationMenu 0.1
25import QtQuick.Window 2.2
26// for indicator-keyboard
27import AccountsService 0.1
28import Unity.InputInfo 0.1
30import "../ApplicationMenus"
32import "../Components/PanelState"
38 readonly property real panelHeight: panelArea.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: __applicationMenus
46 property alias indicators: __indicators
47 property bool fullscreenMode: false
48 property real panelAreaShowProgress: 1.0
49 property bool greeterShown: false
51 property string mode: "staged"
56 anchors.topMargin: panelHeight
57 visible: !indicators.fullyClosed || !applicationMenus.fullyClosed
59 hoverEnabled: true // should also eat hover events, otherwise they will pass through
62 __applicationMenus.hide();
69 property: "panelHeight"
70 value: minimizedPanelHeight
73 RegisteredApplicationMenuModel {
74 id: registeredMenuModel
75 persistentSurfaceId: PanelState.focusedPersistentSurfaceId
81 property bool revealControls: !greeterShown &&
82 !applicationMenus.shown &&
84 (decorationMouseArea.containsMouse || menuBarLoader.menusRequested)
86 property bool showWindowDecorationControls: (revealControls && PanelState.decorationsVisible) ||
87 PanelState.decorationsAlwaysVisible
89 property bool showPointerMenu: revealControls &&
90 (PanelState.decorationsVisible || mode == "staged")
92 property bool enablePointerMenu: revealControls &&
93 applicationMenus.available &&
94 applicationMenus.model
96 property bool showTouchMenu: !greeterShown &&
99 property bool enableTouchMenus: showTouchMenu &&
100 applicationMenus.available &&
101 applicationMenus.model
106 objectName: "panelArea"
110 transform: Translate {
111 y: indicators.state === "initial"
112 ? (1.0 - panelAreaShowProgress) * - minimizedPanelHeight
117 id: indicatorsDropShadow
120 margins: -units.gu(1)
122 visible: !__indicators.fullyClosed
123 source: "graphics/rectangular_dropshadow.sci"
127 id: appmenuDropShadow
129 fill: __applicationMenus
130 margins: -units.gu(1)
132 visible: !__applicationMenus.fullyClosed
133 source: "graphics/rectangular_dropshadow.sci"
139 fill: panelAreaBackground
140 bottomMargin: -units.gu(1)
142 visible: PanelState.dropShadow
143 source: "graphics/rectangular_dropshadow.sci"
147 id: panelAreaBackground
148 color: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
154 height: minimizedPanelHeight
156 Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
160 id: decorationMouseArea
161 objectName: "windowControlArea"
166 height: minimizedPanelHeight
167 hoverEnabled: !__indicators.shown
169 if (callHint.visible) {
170 callHint.showLiveCall();
175 if (!callHint.visible) {
176 // let it fall through to the window decoration of the maximized window behind, if any
177 mouse.accepted = false;
185 // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
186 // cf. https://bugreports.qt.io/browse/QTBUG-32909
187 WindowControlButtons {
188 id: windowControlButtons
189 objectName: "panelWindowControlButtons"
190 height: indicators.minimizedPanelHeight
191 opacity: d.showWindowDecorationControls ? 1 : 0
192 visible: opacity != 0
193 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
195 active: PanelState.decorationsVisible || PanelState.decorationsAlwaysVisible
196 windowIsMaximized: true
197 onCloseClicked: PanelState.closeClicked()
198 onMinimizeClicked: PanelState.minimizeClicked()
199 onMaximizeClicked: PanelState.restoreClicked()
200 closeButtonShown: PanelState.closeButtonShown
205 height: parent.height
206 enabled: d.enablePointerMenu
207 opacity: d.showPointerMenu ? 1 : 0
208 visible: opacity != 0
209 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
210 active: __applicationMenus.model
212 width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
214 property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
216 sourceComponent: MenuBar {
218 objectName: "menuBar"
219 anchors.left: parent.left
220 anchors.margins: units.gu(1)
221 height: menuBarLoader.height
222 enableKeyFilter: valid && PanelState.decorationsVisible
223 unityMenuModel: __applicationMenus.model
226 target: __applicationMenus
227 onShownChanged: bar.dismiss();
232 onShownChanged: bar.dismiss();
240 objectName: "callHint"
242 anchors.centerIn: parent
243 height: minimizedPanelHeight
245 visible: active && indicators.state == "initial" && __applicationMenus.state == "initial"
246 greeterShown: root.greeterShown
251 id: __applicationMenus
253 model: registeredMenuModel.model
254 width: root.applicationMenuWidth
255 minimizedPanelHeight: root.minimizedPanelHeight
256 expandedPanelHeight: root.expandedPanelHeight
257 openedHeight: root.height
258 alignment: Qt.AlignLeft
259 enableHint: !callHint.active && !fullscreenMode
261 panelColor: panelAreaBackground.color
264 if (callHint.active) {
265 callHint.showLiveCall();
269 showRowTitle: !expanded
270 rowTitle: PanelState.title
271 rowItemDelegate: ActionItem {
273 property int ownIndex: index
274 objectName: "appMenuItem"+index
276 width: _title.width + units.gu(2)
277 height: parent.height
280 text: model.label.replace("_", "&")
285 anchors.centerIn: parent
286 text: actionItem.text
287 horizontalAlignment: Text.AlignLeft
288 color: enabled ? theme.palette.normal.backgroundText : theme.palette.disabled.backgroundText
292 pageDelegate: PanelMenuPage {
293 menuModel: __applicationMenus.model
294 submenuIndex: modelIndex
296 factory: ApplicationMenuItemFactory {
297 rootModel: __applicationMenus.model
301 enabled: d.enableTouchMenus
302 opacity: d.showTouchMenu ? 1 : 0
303 visible: opacity != 0
304 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
307 if (!enabled) hide();
313 objectName: "indicators"
319 width: root.indicatorMenuWidth
320 minimizedPanelHeight: root.minimizedPanelHeight
321 expandedPanelHeight: root.expandedPanelHeight
322 openedHeight: root.height
324 overFlowWidth: root.width
325 enableHint: !callHint.active && !fullscreenMode
326 showOnClick: !callHint.visible
327 panelColor: panelAreaBackground.color
330 if (callHint.active) {
331 callHint.showLiveCall();
335 rowItemDelegate: IndicatorItem {
337 objectName: identifier+"-panelItem"
339 property int ownIndex: index
340 property bool overflow: parent.width - x > __indicators.overFlowWidth
341 property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator || hideKeyboardIndicator)
342 // HACK for indicator-session
343 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
344 // HACK for indicator-keyboard
345 readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && (AccountsService.keymaps.length < 2 || keyboardsModel.count == 0)
347 height: parent.height
348 expanded: indicators.expanded
349 selected: ListView.isCurrentItem
351 identifier: model.identifier
352 busName: indicatorProperties.busName
353 actionsObjectPath: indicatorProperties.actionsObjectPath
354 menuObjectPath: indicatorProperties.menuObjectPath
356 opacity: hidden ? 0.0 : 1.0
357 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
359 width: ((expanded || indicatorVisible) && !hideSessionIndicator && !hideKeyboardIndicator) ? implicitWidth : 0
361 Behavior on width { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
364 pageDelegate: PanelMenuPage {
365 objectName: modelData.identifier + "-page"
368 menuModel: delegate.menuModel
370 factory: IndicatorMenuItemFactory {
372 var context = modelData.identifier;
373 if (context && context.indexOf("fake-") === 0) {
374 context = context.substring("fake-".length)
378 rootModel: delegate.menuModel
383 busName: modelData.indicatorProperties.busName
384 actionsObjectPath: modelData.indicatorProperties.actionsObjectPath
385 menuObjectPath: modelData.indicatorProperties.menuObjectPath
389 enabled: !applicationMenus.expanded
390 opacity: !callHint.visible && !applicationMenus.expanded ? 1 : 0
391 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
394 if (!enabled) hide();
401 deviceFilter: InputInfo.Keyboard
410 name: "onscreen" //fully opaque and visible at top edge of screen
411 when: !fullscreenMode
419 name: "offscreen" //pushed off screen
424 if (indicators.state !== "initial") return 0;
425 if (applicationMenus.state !== "initial") return 0;
426 return -minimizedPanelHeight;
428 opacity: indicators.fullyClosed && applicationMenus.fullyClosed ? 0.0 : 1.0
431 target: indicators.showDragHandle;
432 anchors.bottomMargin: -units.gu(1)
435 target: applicationMenus.showDragHandle;
436 anchors.bottomMargin: -units.gu(1)
444 UbuntuNumberAnimation { target: panelArea; properties: "anchors.topMargin,opacity" }
448 UbuntuNumberAnimation { target: panelArea; properties: "anchors.topMargin,opacity" }
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list