2 * Copyright (C) 2013 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 AccountsService 0.1
20import Unity.Application 0.1
21import Ubuntu.Components 0.1
22import Ubuntu.Gestures 0.1
23import Unity.Launcher 0.1
25import SessionBroadcast 0.1
26import SessionManager 0.1
32import Unity.Notifications 1.0 as NotificationBackend
37 readonly property real panelHeight: panel.panelHeight
39 property bool dashShown: dash.shown
41 property bool sideStageEnabled: shell.width >= units.gu(100)
42 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
44 function activateApplication(appId) {
45 if (ApplicationManager.findApplication(appId)) {
46 ApplicationManager.requestFocusApplication(appId);
48 if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
49 applicationsDisplayLoader.item.select(appId);
52 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
53 ApplicationManager.startApplication(appId, execFlags);
60 property: "applicationManager"
61 value: ApplicationManager
64 Component.onCompleted: {
65 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
69 id: backgroundSettings
70 schema.id: "org.gnome.desktop.background"
72 backgroundSource: backgroundSettings.pictureUri
77 anchors.rightMargin: stages.overlayWidth
78 clip: stages.overlayMode && !stages.painting
82 blockInput: parent.clip
87 objectName: "underlay"
89 anchors.rightMargin: -parent.anchors.rightMargin
91 // Whether the underlay is fully covered by opaque UI elements.
92 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
94 // Whether the user should see the topmost application surface (if there's one at all).
95 readonly property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
97 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
98 // through the translucent parts of the shell surface.
99 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
104 opacity: dash.disappearingAnimationProgress
109 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
110 fillMode: Image.PreserveAspectCrop
111 horizontalAlignment: Image.AlignRight
112 verticalAlignment: Image.AlignTop
119 hides: [stages, launcher, panel.indicators]
120 shown: disappearingAnimationProgress !== 1.0
121 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
125 topMargin: panel.panelHeight
128 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
129 opacity: 1.0 - disappearingAnimationProgress
130 property real disappearingAnimationProgress: {
131 if (stages.overlayMode) {
134 return stages.showProgress
138 // FIXME: only necessary because stages.showProgress is not animated
139 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
146 direction: Direction.Leftwards
148 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
149 width: shell.edgeSize
151 property real progress: stages.width
154 if (status == DirectionalDragArea.Recognized) {
155 if (ApplicationManager.count == 0) {
156 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
158 progress = stages.width - stagesDragHandle.width + touchX
165 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
168 stagesDragHandle.progress = stages.width;
177 height: parent.height
181 if (overlayMode || locked) {
184 return launcher.progress
186 return stagesDragHandle.progress
190 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
192 property bool shown: false
194 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
196 property bool fullyShown: x == 0
197 property bool fullyHidden: x == width
199 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
200 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
201 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
202 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
203 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
205 function show(focusApp) {
207 panel.indicators.hide();
209 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
210 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
216 if (ApplicationManager.focusedApplicationId) {
217 ApplicationManager.unfocusCurrentApplication();
222 target: ApplicationManager
228 onFocusedApplicationIdChanged: {
229 if (ApplicationManager.focusedApplicationId.length > 0) {
232 if (!stages.overlayMode) {
238 onApplicationAdded: {
242 onApplicationRemoved: {
243 if (ApplicationManager.focusedApplicationId.length == 0) {
250 target: ApplicationManager
251 property: "suspended"
252 value: !SessionManager.active
256 id: applicationsDisplayLoader
259 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
262 target: applicationsDisplayLoader.item
264 value: !stages.fullyShown
267 target: applicationsDisplayLoader.item
272 target: applicationsDisplayLoader.item
273 property: "dragAreaWidth"
274 value: shell.edgeSize
281 blockInput: ApplicationManager.focusedApplicationId.length === 0 || launcher.shown
282 || panel.indicators.shown
289 onDisplayPowerStateChange: {
290 // We ignore any display-off signals when the proximity sensor
291 // is active. This usually indicates something like a phone call.
292 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
293 SessionManager.lock();
296 // No reason to chew demo CPU when user isn't watching
297 if (status == Powerd.Off) {
298 edgeDemo.paused = true;
299 } else if (status == Powerd.On) {
300 edgeDemo.paused = false;
305 function showHome(fromLauncher) {
306 var animate = fromLauncher && !stages.shown
307 dash.setCurrentScope("clickscope", animate, false)
318 anchors.fill: parent //because this draws indicator menus
319 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
322 available: edgeDemo.panelEnabled
323 contentEnabled: edgeDemo.panelContentEnabled
325 property string focusedAppId: ApplicationManager.focusedApplicationId
326 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
327 fullscreenMode: focusedApplication && stages.fullscreen
328 searchVisible: dash.shown && dash.searchable
336 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
342 blockInput: launcher.shown
345 bottom: parent.bottom
348 width: launcher.width
354 readonly property bool dashSwipe: progress > 0
356 anchors.top: parent.top
357 anchors.bottom: parent.bottom
359 dragAreaWidth: shell.edgeSize
360 available: edgeDemo.launcherEnabled
363 if (edgeDemo.running)
370 if (stages.shown && !stages.overlayMode) {
371 if (!stages.locked) {
377 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
378 onLauncherApplicationSelected: {
379 if (!edgeDemo.running)
380 shell.activateApplication(appId)
384 panel.indicators.hide()
390 id: modalNotificationBackground
392 visible: notifications.useModal && (notifications.state == "narrow")
403 blockInput: modalNotificationBackground.visible
410 model: NotificationBackend.Model
416 bottom: parent.bottom
417 topMargin: panel.panelHeight
422 when: overlay.width <= units.gu(60)
423 AnchorChanges { target: notifications; anchors.left: parent.left }
427 when: overlay.width > units.gu(60)
428 AnchorChanges { target: notifications; anchors.left: undefined }
429 PropertyChanges { target: notifications; width: units.gu(38) }
434 anchors { left: parent.left; right: parent.right }
435 height: parent.contentHeight
436 blockInput: height > 0
441 target: SessionManager
443 if (!SessionManager.active) {
445 panel.indicators.hide()
454 bottom: parent.bottom
457 width: shell.edgeSize
464 bottom: parent.bottom
467 width: shell.edgeSize
472 anchors.topMargin: panel.panelHeight
473 anchors.fill: parent // as needs to know the geometry of the shell
476 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
478 anchors.bottom: parent.bottom
479 anchors.left: parent.left
480 anchors.right: parent.right
481 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
483 enabled: ApplicationManager.keyboardVisible
487 anchors.centerIn: parent
488 visible: ApplicationManager.fake ? ApplicationManager.fake : false
489 text: "EARLY ALPHA\nNOT READY FOR USE"
492 font.weight: Font.Black
493 horizontalAlignment: Text.AlignHCenter
494 verticalAlignment: Text.AlignVCenter
495 fontSizeMode: Text.Fit
497 scale: Math.min(parent.width, parent.height) / width
504 indicators: panel.indicators
509 target: SessionBroadcast
510 onShowHome: showHome(false)
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