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.indicatorsMenuWidth
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
123 objectName: "backgroundImage"
126 source: shell.background
127 fillMode: Image.PreserveAspectCrop
133 opacity: dash.disappearingAnimationProgress
138 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
139 fillMode: Image.PreserveAspectCrop
140 horizontalAlignment: Image.AlignRight
141 verticalAlignment: Image.AlignTop
148 available: !greeter.shown && !lockscreen.shown
149 hides: [stages, launcher, panel.indicators]
150 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
151 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
155 topMargin: panel.panelHeight
158 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
159 opacity: 1.0 - disappearingAnimationProgress
160 property real disappearingAnimationProgress: {
161 if (stages.overlayMode) {
164 return stages.showProgress
168 // FIXME: only necessary because stages.showProgress is not animated
169 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
176 direction: Direction.Leftwards
178 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
179 width: shell.edgeSize
181 property real progress: stages.width
184 if (status == DirectionalDragArea.Recognized) {
185 if (ApplicationManager.count == 0) {
186 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
188 progress = stages.width - stagesDragHandle.width + touchX
195 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
198 stagesDragHandle.progress = stages.width;
207 height: parent.height
211 if (overlayMode || locked) {
214 return launcher.progress
216 return stagesDragHandle.progress
220 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
222 property bool shown: false
224 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
226 property bool fullyShown: x == 0
227 property bool fullyHidden: x == width
229 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
230 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
231 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
232 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
233 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
235 function show(focusApp) {
237 panel.indicators.hide();
240 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
241 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
247 if (ApplicationManager.focusedApplicationId) {
248 ApplicationManager.unfocusCurrentApplication();
253 target: ApplicationManager
259 onFocusedApplicationIdChanged: {
260 if (ApplicationManager.focusedApplicationId.length > 0) {
263 if (!stages.overlayMode) {
269 onApplicationAdded: {
273 onApplicationRemoved: {
274 if (ApplicationManager.focusedApplicationId.length == 0) {
281 target: DBusUnitySessionService
283 function closeAllApps() {
285 var app = ApplicationManager.get(0);
289 ApplicationManager.stopApplication(app.appId);
294 // TODO: Display a dialog to ask the user to confirm.
295 DBusUnitySessionService.Logout();
305 id: applicationsDisplayLoader
308 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
311 target: applicationsDisplayLoader.item
313 value: !stages.fullyShown
316 target: applicationsDisplayLoader.item
321 target: applicationsDisplayLoader.item
322 property: "dragAreaWidth"
323 value: shell.edgeSize
330 objectName: "lockscreen"
332 readonly property int backgroundTopMargin: -panel.panelHeight
334 hides: [launcher, panel.indicators]
337 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
338 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
340 x: required ? 0 : - width
342 height: parent.height - panel.panelHeight
343 background: shell.background
346 onEntered: LightDM.Greeter.respond(passphrase);
347 onCancel: greeter.show()
349 Component.onCompleted: {
350 if (LightDM.Users.count == 1) {
351 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
357 target: LightDM.Greeter
360 if (LightDM.Users.count == 1) {
361 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
363 lockscreen.alphaNumeric = false
365 lockscreen.alphaNumeric = true
367 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
372 onAuthenticationComplete: {
373 if (LightDM.Greeter.promptless) {
376 if (LightDM.Greeter.authenticated) {
379 lockscreen.clear(true);
387 opacity: greeterWrapper.showProgress * 0.8
391 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
396 height: parent.height - panel.panelHeight
398 Behavior on x {SmoothedAnimation{velocity: 600}}
400 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
404 objectName: "greeter"
407 hides: [launcher, panel.indicators]
410 defaultBackground: shell.background
413 height: parent.height
415 dragHandleWidth: shell.edgeSize
420 // If there is only one user, we start authenticating with that one here.
421 // If there are more users, the Greeter will handle that
422 if (LightDM.Users.count == 1) {
423 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
425 greeter.forceActiveFocus();
429 onUnlocked: greeter.hide()
431 // Update launcher items for new user
432 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
433 AccountsService.user = user;
434 LauncherModel.setUser(user);
437 onTease: launcher.tease()
440 target: ApplicationManager
441 property: "suspended"
442 value: greeter.shown && greeterWrapper.showProgress == 1
449 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
450 || panel.indicators.shown
457 onDisplayPowerStateChange: {
458 // We ignore any display-off signals when the proximity sensor
459 // is active. This usually indicates something like a phone call.
460 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
464 // No reason to chew demo CPU when user isn't watching
465 if (status == Powerd.Off) {
466 edgeDemo.paused = true;
467 } else if (status == Powerd.On) {
468 edgeDemo.paused = false;
473 function showHome() {
474 var animate = !greeter.shown && !stages.shown
476 dash.setCurrentScope("clickscope", animate, false)
480 function hideIndicatorMenu(delay) {
481 panel.hideIndicatorMenu(delay);
491 anchors.fill: parent //because this draws indicator menus
492 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
495 available: edgeDemo.panelEnabled
496 contentEnabled: edgeDemo.panelContentEnabled
498 property string focusedAppId: ApplicationManager.focusedApplicationId
499 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
500 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
501 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
509 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
515 blockInput: launcher.shown
518 bottom: parent.bottom
521 width: launcher.width
527 readonly property bool dashSwipe: progress > 0
529 anchors.top: parent.top
530 anchors.bottom: parent.bottom
532 dragAreaWidth: shell.edgeSize
533 available: edgeDemo.launcherEnabled
536 if (edgeDemo.running)
542 if (stages.shown && !stages.overlayMode) {
543 if (!stages.locked) {
553 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
554 onLauncherApplicationSelected: {
555 if (!edgeDemo.running)
556 shell.activateApplication(appId)
560 panel.indicators.hide()
566 id: modalNotificationBackground
568 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
579 blockInput: modalNotificationBackground.visible
586 model: NotificationBackend.Model
592 bottom: parent.bottom
593 topMargin: panel.panelHeight
598 when: overlay.width <= units.gu(60)
599 AnchorChanges { target: notifications; anchors.left: parent.left }
603 when: overlay.width > units.gu(60)
604 AnchorChanges { target: notifications; anchors.left: undefined }
605 PropertyChanges { target: notifications; width: units.gu(38) }
610 anchors { left: parent.left; right: parent.right }
611 height: parent.contentHeight
612 blockInput: height > 0
618 onFocusChanged: if (!focus) forceActiveFocus();
623 bottom: parent.bottom
626 width: shell.edgeSize
633 bottom: parent.bottom
636 width: shell.edgeSize
647 anchors.topMargin: panel.panelHeight
648 anchors.fill: parent // as needs to know the geometry of the shell
651 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
653 anchors.bottom: parent.bottom
654 anchors.left: parent.left
655 anchors.right: parent.right
656 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
658 enabled: ApplicationManager.keyboardVisible
662 anchors.centerIn: parent
663 visible: ApplicationManager.fake ? ApplicationManager.fake : false
664 text: "EARLY ALPHA\nNOT READY FOR USE"
667 font.weight: Font.Black
668 horizontalAlignment: Text.AlignHCenter
669 verticalAlignment: Text.AlignVCenter
670 fontSizeMode: Text.Fit
672 scale: Math.min(parent.width, parent.height) / width
680 indicators: panel.indicators
685 target: SessionBroadcast
686 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