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
24import LightDM 0.1 as LightDM
26import SessionBroadcast 0.1
33import Unity.Notifications 1.0 as NotificationBackend
38 // this is only here to select the width / height of the window if not running fullscreen
39 property bool tablet: false
40 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
41 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
43 property real edgeSize: units.gu(2)
44 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
45 property url background
46 readonly property real panelHeight: panel.panelHeight
48 property bool dashShown: dash.shown
50 property bool sideStageEnabled: shell.width >= units.gu(100)
51 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
53 function activateApplication(appId) {
54 if (ApplicationManager.findApplication(appId)) {
55 ApplicationManager.requestFocusApplication(appId);
57 if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
58 applicationsDisplayLoader.item.select(appId);
61 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
62 ApplicationManager.startApplication(appId, execFlags);
69 property: "applicationManager"
70 value: ApplicationManager
73 Component.onCompleted: {
74 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
78 id: backgroundSettings
79 schema.id: "org.gnome.desktop.background"
81 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
82 onGSettingsPictureChanged: {
83 shell.background = gSettingsPicture
90 Keys.onVolumeUpPressed: volumeControl.volumeUp()
91 Keys.onVolumeDownPressed: volumeControl.volumeDown()
96 anchors.rightMargin: stages.overlayWidth
97 clip: stages.overlayMode && !stages.painting
101 blockInput: parent.clip
106 objectName: "underlay"
108 anchors.rightMargin: -parent.anchors.rightMargin
110 // Whether the underlay is fully covered by opaque UI elements.
111 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicators.width
113 // Whether the user should see the topmost application surface (if there's one at all).
114 readonly property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
116 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
117 // through the translucent parts of the shell surface.
118 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
123 opacity: dash.disappearingAnimationProgress
128 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
129 fillMode: Image.PreserveAspectCrop
130 horizontalAlignment: Image.AlignRight
131 verticalAlignment: Image.AlignTop
138 available: !greeter.shown && !lockscreen.shown
139 hides: [stages, launcher, panel.indicators]
140 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
141 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
145 topMargin: panel.panelHeight
148 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
149 opacity: 1.0 - disappearingAnimationProgress
150 property real disappearingAnimationProgress: {
151 if (stages.overlayMode) {
154 return stages.showProgress
158 // FIXME: only necessary because stages.showProgress is not animated
159 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
166 direction: Direction.Leftwards
168 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
169 width: shell.edgeSize
171 property real progress: stages.width
174 if (status == DirectionalDragArea.Recognized) {
175 if (ApplicationManager.count == 0) {
176 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
178 progress = stages.width - stagesDragHandle.width + touchX
185 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
188 stagesDragHandle.progress = stages.width;
197 height: parent.height
201 if (overlayMode || locked) {
204 return launcher.progress
206 return stagesDragHandle.progress
210 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
212 property bool shown: false
214 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
216 property bool fullyShown: x == 0
217 property bool fullyHidden: x == width
219 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
220 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
221 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
222 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
223 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
225 function show(focusApp) {
227 panel.indicators.hide();
230 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
231 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
237 if (ApplicationManager.focusedApplicationId) {
238 ApplicationManager.unfocusCurrentApplication();
243 target: ApplicationManager
249 onFocusedApplicationIdChanged: {
250 if (ApplicationManager.focusedApplicationId.length > 0) {
253 if (!stages.overlayMode) {
259 onApplicationAdded: {
263 onApplicationRemoved: {
264 if (ApplicationManager.focusedApplicationId.length == 0) {
271 id: applicationsDisplayLoader
274 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
277 target: applicationsDisplayLoader.item
279 value: !stages.fullyShown
282 target: applicationsDisplayLoader.item
287 target: applicationsDisplayLoader.item
288 property: "dragAreaWidth"
289 value: shell.edgeSize
296 objectName: "lockscreen"
298 readonly property int backgroundTopMargin: -panel.panelHeight
300 hides: [launcher, panel.indicators]
303 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
304 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
309 bottom: parent.bottom
310 topMargin: panel.panelHeight
312 background: shell.background
316 onEntered: LightDM.Greeter.respond(passphrase);
317 onCancel: greeter.show()
319 Component.onCompleted: {
320 if (LightDM.Users.count == 1) {
321 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
327 target: LightDM.Greeter
330 if (LightDM.Users.count == 1) {
331 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
333 lockscreen.alphaNumeric = false
335 lockscreen.alphaNumeric = true
337 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
342 onAuthenticationComplete: {
343 if (LightDM.Greeter.promptless) {
346 if (LightDM.Greeter.authenticated) {
349 lockscreen.clear(true);
357 opacity: greeterWrapper.showProgress * 0.8
361 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
366 height: parent.height - panel.panelHeight
369 enabled: !launcher.dashSwipe
373 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
377 objectName: "greeter"
380 hides: [launcher, panel.indicators]
383 defaultBackground: shell.background
386 height: parent.height
388 dragHandleWidth: shell.edgeSize
393 // If there is only one user, we start authenticating with that one here.
394 // If there are more users, the Greeter will handle that
395 if (LightDM.Users.count == 1) {
396 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
398 greeter.forceActiveFocus();
402 onUnlocked: greeter.hide()
404 // Update launcher items for new user
405 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
406 AccountsService.user = user;
407 LauncherModel.setUser(user);
410 onTease: launcher.tease()
413 target: ApplicationManager
414 property: "suspended"
415 value: greeter.shown && greeterWrapper.showProgress == 1
422 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
423 || panel.indicators.shown
430 onDisplayPowerStateChange: {
431 // We ignore any display-off signals when the proximity sensor
432 // is active. This usually indicates something like a phone call.
433 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
437 // No reason to chew demo CPU when user isn't watching
438 if (status == Powerd.Off) {
439 edgeDemo.paused = true;
440 } else if (status == Powerd.On) {
441 edgeDemo.paused = false;
446 function showHome() {
447 var animate = !greeter.shown && !stages.shown
449 dash.setCurrentScope("clickscope", animate, false)
453 function hideIndicatorMenu(delay) {
454 panel.hideIndicatorMenu(delay);
464 anchors.fill: parent //because this draws indicator menus
467 available: edgeDemo.panelEnabled
468 contentEnabled: edgeDemo.panelContentEnabled
469 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
470 panelHeight: units.gu(3)
472 property string focusedAppId: ApplicationManager.focusedApplicationId
473 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
474 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
475 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
483 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
489 blockInput: launcher.shown
492 bottom: parent.bottom
495 width: launcher.width
501 readonly property bool dashSwipe: progress > 0
503 anchors.top: parent.top
504 anchors.bottom: parent.bottom
506 dragAreaWidth: shell.edgeSize
507 available: edgeDemo.launcherEnabled
510 if (edgeDemo.running)
516 if (stages.shown && !stages.overlayMode) {
517 if (!stages.locked) {
527 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
528 onLauncherApplicationSelected: {
529 if (!edgeDemo.running)
530 shell.activateApplication(appId)
534 panel.indicators.hide()
540 id: modalNotificationBackground
542 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
553 blockInput: modalNotificationBackground.visible
560 model: NotificationBackend.Model
565 height: parent.height - panel.panelHeight
570 when: overlay.width <= units.gu(60)
571 AnchorChanges { target: notifications; anchors.left: parent.left }
575 when: overlay.width > units.gu(60)
576 AnchorChanges { target: notifications; anchors.left: undefined }
577 PropertyChanges { target: notifications; width: units.gu(38) }
582 anchors { left: parent.left; right: parent.right }
583 height: parent.contentHeight
584 blockInput: height > 0
590 onFocusChanged: if (!focus) forceActiveFocus();
595 bottom: parent.bottom
598 width: shell.edgeSize
605 bottom: parent.bottom
608 width: shell.edgeSize
619 anchors.topMargin: panel.panelHeight
620 anchors.fill: parent // as needs to know the geometry of the shell
623 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
625 anchors.bottom: parent.bottom
626 anchors.left: parent.left
627 anchors.right: parent.right
628 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
630 enabled: ApplicationManager.keyboardVisible
634 anchors.centerIn: parent
635 visible: ApplicationManager.fake ? ApplicationManager.fake : false
636 text: "EARLY ALPHA\nNOT READY FOR USE"
639 font.weight: Font.Black
640 horizontalAlignment: Text.AlignHCenter
641 verticalAlignment: Text.AlignVCenter
642 fontSizeMode: Text.Fit
644 scale: Math.min(parent.width, parent.height) / width
652 indicators: panel.indicators
657 target: SessionBroadcast
658 onShowHome: showHome()
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