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
34import Unity.Session 0.1
39 // this is only here to select the width / height of the window if not running fullscreen
40 property bool tablet: false
41 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
42 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
44 property real edgeSize: units.gu(2)
45 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
46 property url background
47 readonly property real panelHeight: panel.panelHeight
49 property bool dashShown: dash.shown
51 property bool sideStageEnabled: shell.width >= units.gu(100)
52 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
54 function activateApplication(appId) {
55 if (ApplicationManager.findApplication(appId)) {
56 ApplicationManager.requestFocusApplication(appId);
58 if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
59 applicationsDisplayLoader.item.select(appId);
62 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
63 ApplicationManager.startApplication(appId, execFlags);
70 property: "applicationManager"
71 value: ApplicationManager
74 Component.onCompleted: {
75 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
79 id: backgroundSettings
80 schema.id: "org.gnome.desktop.background"
82 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
83 onGSettingsPictureChanged: {
84 shell.background = gSettingsPicture
91 Keys.onVolumeUpPressed: volumeControl.volumeUp()
92 Keys.onVolumeDownPressed: volumeControl.volumeDown()
97 anchors.rightMargin: stages.overlayWidth
98 clip: stages.overlayMode && !stages.painting
102 blockInput: parent.clip
107 objectName: "underlay"
109 anchors.rightMargin: -parent.anchors.rightMargin
111 // Whether the underlay is fully covered by opaque UI elements.
112 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicators.width
114 // Whether the user should see the topmost application surface (if there's one at all).
115 readonly property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
117 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
118 // through the translucent parts of the shell surface.
119 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
124 opacity: dash.disappearingAnimationProgress
131 available: !greeter.shown && !lockscreen.shown
132 hides: [stages, launcher, panel.indicators]
133 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
134 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
136 overviewHandleHeight: shell.edgeSize
140 topMargin: panel.panelHeight
143 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
144 opacity: 1.0 - disappearingAnimationProgress
145 property real disappearingAnimationProgress: {
146 if (stages.overlayMode) {
149 return stages.showProgress
153 // FIXME: only necessary because stages.showProgress is not animated
154 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
161 direction: Direction.Leftwards
163 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
164 width: shell.edgeSize
166 property real progress: stages.width
169 if (status == DirectionalDragArea.Recognized) {
170 if (ApplicationManager.count == 0) {
171 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
173 progress = stages.width - stagesDragHandle.width + touchX
180 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
183 stagesDragHandle.progress = stages.width;
192 height: parent.height
196 if (overlayMode || locked) {
199 return launcher.progress
201 return stagesDragHandle.progress
205 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
207 property bool shown: false
209 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
211 property bool fullyShown: x == 0
212 property bool fullyHidden: x == width
214 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
215 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
216 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
217 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
218 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
220 function show(focusApp) {
222 panel.indicators.hide();
225 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
226 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
232 if (ApplicationManager.focusedApplicationId) {
233 ApplicationManager.unfocusCurrentApplication();
238 target: ApplicationManager
244 onFocusedApplicationIdChanged: {
245 if (ApplicationManager.focusedApplicationId.length > 0) {
248 if (!stages.overlayMode) {
254 onApplicationAdded: {
258 onApplicationRemoved: {
259 if (ApplicationManager.focusedApplicationId.length == 0) {
266 target: DBusUnitySessionService
268 function closeAllApps() {
270 var app = ApplicationManager.get(0);
274 ApplicationManager.stopApplication(app.appId);
279 // TODO: Display a dialog to ask the user to confirm.
280 DBusUnitySessionService.Logout();
290 id: applicationsDisplayLoader
293 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
296 target: applicationsDisplayLoader.item
298 value: !stages.fullyShown
301 target: applicationsDisplayLoader.item
306 target: applicationsDisplayLoader.item
307 property: "dragAreaWidth"
308 value: shell.edgeSize
315 objectName: "lockscreen"
317 readonly property int backgroundTopMargin: -panel.panelHeight
319 hides: [launcher, panel.indicators]
322 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
323 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
325 x: required ? 0 : - width
327 height: parent.height - panel.panelHeight
328 background: shell.background
332 onEntered: LightDM.Greeter.respond(passphrase);
333 onCancel: greeter.show()
335 Component.onCompleted: {
336 if (LightDM.Users.count == 1) {
337 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
343 target: LightDM.Greeter
346 if (LightDM.Users.count == 1) {
347 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
349 lockscreen.alphaNumeric = false
351 lockscreen.alphaNumeric = true
353 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
358 onAuthenticationComplete: {
359 if (LightDM.Greeter.promptless) {
362 if (LightDM.Greeter.authenticated) {
365 lockscreen.clear(true);
373 opacity: greeterWrapper.showProgress * 0.8
377 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
382 height: parent.height - panel.panelHeight
385 enabled: !launcher.dashSwipe
389 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
393 objectName: "greeter"
396 hides: [launcher, panel.indicators]
399 defaultBackground: shell.background
402 height: parent.height
404 dragHandleWidth: shell.edgeSize
409 // If there is only one user, we start authenticating with that one here.
410 // If there are more users, the Greeter will handle that
411 if (LightDM.Users.count == 1) {
412 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
414 greeter.forceActiveFocus();
418 onUnlocked: greeter.hide()
420 // Update launcher items for new user
421 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
422 AccountsService.user = user;
423 LauncherModel.setUser(user);
426 onTease: launcher.tease()
429 target: ApplicationManager
430 property: "suspended"
431 value: greeter.shown && greeterWrapper.showProgress == 1
438 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
439 || panel.indicators.shown
446 onDisplayPowerStateChange: {
447 // We ignore any display-off signals when the proximity sensor
448 // is active. This usually indicates something like a phone call.
449 if (status == Powerd.Off && reason != Powerd.Proximity) {
453 // No reason to chew demo CPU when user isn't watching
454 if (status == Powerd.Off) {
455 edgeDemo.paused = true;
456 } else if (status == Powerd.On) {
457 edgeDemo.paused = false;
462 function showHome() {
463 var animate = !greeter.shown && !stages.shown
465 dash.setCurrentScope("clickscope", animate, false)
469 function hideIndicatorMenu(delay) {
470 panel.hideIndicatorMenu(delay);
480 anchors.fill: parent //because this draws indicator menus
483 available: edgeDemo.panelEnabled
484 contentEnabled: edgeDemo.panelContentEnabled
485 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
486 panelHeight: units.gu(3)
488 property string focusedAppId: ApplicationManager.focusedApplicationId
489 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
490 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
498 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
504 blockInput: launcher.shown
507 bottom: parent.bottom
510 width: launcher.width
516 readonly property bool dashSwipe: progress > 0
518 anchors.top: parent.top
519 anchors.bottom: parent.bottom
521 dragAreaWidth: shell.edgeSize
522 available: edgeDemo.launcherEnabled
525 if (edgeDemo.running)
531 if (stages.shown && !stages.overlayMode && !stages.locked) {
535 launcher.switchToNextState("visible");
543 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
544 onLauncherApplicationSelected: {
545 if (!edgeDemo.running)
546 shell.activateApplication(appId)
550 panel.indicators.hide()
556 id: modalNotificationBackground
558 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
569 blockInput: modalNotificationBackground.visible
576 model: NotificationBackend.Model
581 height: parent.height - panel.panelHeight
586 when: overlay.width <= units.gu(60)
587 AnchorChanges { target: notifications; anchors.left: parent.left }
591 when: overlay.width > units.gu(60)
592 AnchorChanges { target: notifications; anchors.left: undefined }
593 PropertyChanges { target: notifications; width: units.gu(38) }
598 anchors { left: parent.left; right: parent.right }
599 height: parent.contentHeight
600 blockInput: height > 0
606 onFocusChanged: if (!focus) forceActiveFocus();
611 bottom: parent.bottom
614 width: shell.edgeSize
621 bottom: parent.bottom
624 width: shell.edgeSize
635 anchors.topMargin: panel.panelHeight
636 anchors.fill: parent // as needs to know the geometry of the shell
639 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
641 anchors.bottom: parent.bottom
642 anchors.left: parent.left
643 anchors.right: parent.right
644 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
646 enabled: ApplicationManager.keyboardVisible
650 anchors.centerIn: parent
651 visible: ApplicationManager.fake ? ApplicationManager.fake : false
652 text: "EARLY ALPHA\nNOT READY FOR USE"
655 font.weight: Font.Black
656 horizontalAlignment: Text.AlignHCenter
657 verticalAlignment: Text.AlignVCenter
658 fontSizeMode: Text.Fit
660 scale: Math.min(parent.width, parent.height) / width
668 indicators: panel.indicators
673 target: SessionBroadcast
674 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