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
35import Unity.Notifications 1.0 as NotificationBackend
40 // this is only here to select the width / height of the window if not running fullscreen
41 property bool tablet: false
42 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
43 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
45 property real edgeSize: units.gu(2)
46 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
47 property url background
48 readonly property real panelHeight: panel.panelHeight
50 property bool dashShown: dash.shown
52 property bool sideStageEnabled: shell.width >= units.gu(60)
54 function activateApplication(appId) {
55 if (ApplicationManager.findApplication(appId)) {
56 ApplicationManager.activateApplication(appId);
59 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
60 ApplicationManager.startApplication(appId, execFlags);
67 property: "applicationManager"
68 value: ApplicationManager
71 Component.onCompleted: {
72 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
76 id: backgroundSettings
77 schema.id: "org.gnome.desktop.background"
79 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
80 onGSettingsPictureChanged: {
81 shell.background = gSettingsPicture
84 // This is a dummy image that is needed to determine if the picture url
85 // in backgroundSettings points to a valid picture file.
86 // We can't do this with the real background image because setting a
87 // new source in onStatusChanged triggers a binding loop detection
88 // inside Image, which causes it not to render even though a valid source
89 // would be set. We don't mind about this image staying black and just
90 // use it for verification to populate the source for the real
93 source: shell.background
99 if (status == Image.Error && source != shell.defaultBackground) {
100 shell.background = defaultBackground
109 Keys.onVolumeUpPressed: volumeControl.volumeUp()
110 Keys.onVolumeDownPressed: volumeControl.volumeDown()
115 anchors.rightMargin: stages.overlayWidth
116 clip: stages.overlayMode && !stages.painting
120 objectName: "underlay"
122 anchors.rightMargin: -parent.anchors.rightMargin
124 // Whether the underlay is fully covered by opaque UI elements.
125 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
127 readonly property bool applicationRunning: ApplicationManager.focusedApplicationId.length > 0
129 // Whether the user should see the topmost application surface (if there's one at all).
130 readonly property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
132 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
133 // through the translucent parts of the shell surface.
134 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
138 objectName: "backgroundImage"
141 source: shell.background
142 fillMode: Image.PreserveAspectCrop
148 opacity: dash.disappearingAnimationProgress
155 available: !greeter.shown && !lockscreen.shown
156 hides: [stages, launcher, panel.indicators]
157 shown: disappearingAnimationProgress !== 1.0
158 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
162 topMargin: panel.panelHeight
165 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
166 opacity: 1.0 - disappearingAnimationProgress
167 property real disappearingAnimationProgress: {
169 return greeter.showProgress;
171 if (stages.overlayMode) {
174 return stages.showProgress
178 // FIXME: only necessary because stages.showProgress and
179 // greeterRevealer.animatedProgress are not animated
180 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
187 direction: Direction.Leftwards
189 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
190 width: shell.edgeSize
192 property real progress: stages.width
195 if (status == DirectionalDragArea.Recognized) {
196 if (ApplicationManager.count == 0) {
197 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
199 progress = stages.width - stagesDragHandle.width + touchX
206 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
209 stagesDragHandle.progress = stages.width;
218 height: parent.height
222 if (overlayMode || locked) {
225 return launcher.progress
227 return stagesDragHandle.progress
231 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
233 property bool shown: false
235 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
237 property bool fullyShown: x == 0
238 property bool fullyHidden: x == width
240 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
241 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
242 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
243 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
244 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
248 panel.indicators.hide();
249 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0) {
250 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
260 if (ApplicationManager.focusedApplicationId) {
261 ApplicationManager.unfocusCurrentApplication();
266 target: ApplicationManager
272 onFocusedApplicationIdChanged: {
273 if (ApplicationManager.focusedApplicationId.length > 0) {
276 if (!stages.overlayMode) {
282 onApplicationAdded: {
288 id: applicationsDisplayLoader
291 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
294 target: applicationsDisplayLoader.item
296 value: !stages.fullyShown
299 target: applicationsDisplayLoader.item
304 target: applicationsDisplayLoader.item
305 property: "dragAreaWidth"
306 value: shell.edgeSize
313 objectName: "lockscreen"
315 readonly property int backgroundTopMargin: -panel.panelHeight
317 hides: [launcher, panel.indicators, hud]
320 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
321 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
323 x: required ? 0 : - width
325 height: parent.height - panel.panelHeight
326 background: shell.background
329 onEntered: LightDM.Greeter.respond(passphrase);
330 onCancel: greeter.show()
332 Component.onCompleted: {
333 if (LightDM.Users.count == 1) {
334 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
340 target: LightDM.Greeter
343 if (LightDM.Users.count == 1) {
344 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
346 lockscreen.alphaNumeric = false
348 lockscreen.alphaNumeric = true
350 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
355 onAuthenticationComplete: {
356 if (LightDM.Greeter.promptless) {
359 if (LightDM.Greeter.authenticated) {
362 lockscreen.clear(true);
369 objectName: "greeter"
372 hides: [launcher, panel.indicators, hud]
375 defaultBackground: shell.background
379 height: parent.height - panel.panelHeight
381 dragHandleWidth: shell.edgeSize
386 // If there is only one user, we start authenticating with that one here.
387 // If there are more users, the Greeter will handle that
388 if (LightDM.Users.count == 1) {
389 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
391 greeter.forceActiveFocus();
395 onUnlocked: greeter.hide()
397 // Update launcher items for new user
398 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
399 AccountsService.user = user;
400 LauncherModel.setUser(user);
403 onLeftTeaserPressedChanged: {
404 if (leftTeaserPressed) {
410 target: ApplicationManager
411 property: "suspended"
418 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
419 || panel.indicators.shown || hud.shown
426 onDisplayPowerStateChange: {
427 // We ignore any display-off signals when the proximity sensor
428 // is active. This usually indicates something like a phone call.
429 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
433 // No reason to chew demo CPU when user isn't watching
434 if (status == Powerd.Off) {
435 edgeDemo.paused = true;
436 } else if (status == Powerd.On) {
437 edgeDemo.paused = false;
442 function showHome() {
443 var animate = !greeter.shown && !stages.shown
445 dash.setCurrentScope("home.scope", animate, false)
449 function hideIndicatorMenu(delay) {
450 panel.hideIndicatorMenu(delay);
460 anchors.fill: parent //because this draws indicator menus
461 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
464 available: edgeDemo.panelEnabled
465 contentEnabled: edgeDemo.panelContentEnabled
467 property string focusedAppId: ApplicationManager.focusedApplicationId
468 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
469 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
470 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
478 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
486 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
487 height: parent.height
489 available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
491 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
492 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
495 target: ApplicationManager
496 onFocusedApplicationIdChanged: hud.hide()
505 anchors.left: hud.left
506 height: parent.height
507 target: hud.revealerTarget
510 direction: Qt.RightToLeft
511 orientation: Qt.Vertical
512 handleSize: hud.handleHeight
513 onCloseClicked: target.hide()
520 enabled: hud.available
521 applicationIsOnForeground: ApplicationManager.focusedApplicationId
525 blockInput: launcher.shown
528 bottom: parent.bottom
531 width: launcher.width
537 readonly property bool dashSwipe: progress > 0
539 anchors.top: parent.top
540 anchors.bottom: parent.bottom
542 dragAreaWidth: shell.edgeSize
543 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
546 if (edgeDemo.running)
552 if (stages.shown && !stages.overlayMode) {
557 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
558 onLauncherApplicationSelected:{
559 if (edgeDemo.running)
563 shell.activateApplication(appId)
567 panel.indicators.hide()
577 model: NotificationBackend.Model
583 bottom: parent.bottom
584 topMargin: panel.panelHeight
589 when: overlay.width <= units.gu(60)
590 AnchorChanges { target: notifications; anchors.left: parent.left }
594 when: overlay.width > units.gu(60)
595 AnchorChanges { target: notifications; anchors.left: undefined }
596 PropertyChanges { target: notifications; width: units.gu(38) }
601 anchors { left: parent.left; right: parent.right }
602 height: parent.contentHeight
603 blockInput: height > 0
609 onFocusChanged: if (!focus) forceActiveFocus();
614 bottom: parent.bottom
617 width: shell.edgeSize
624 bottom: parent.bottom
627 width: shell.edgeSize
638 anchors.topMargin: panel.panelHeight
639 anchors.fill: parent // as needs to know the geometry of the shell
642 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
644 anchors.bottom: parent.bottom
645 anchors.left: parent.left
646 anchors.right: parent.right
647 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
649 enabled: ApplicationManager.keyboardVisible
653 anchors.centerIn: parent
654 visible: ApplicationManager.fake ? ApplicationManager.fake : false
655 text: "EARLY ALPHA\nNOT READY FOR USE"
658 font.weight: Font.Black
659 horizontalAlignment: Text.AlignHCenter
660 verticalAlignment: Text.AlignVCenter
661 fontSizeMode: Text.Fit
663 scale: Math.min(parent.width, parent.height) / width
671 indicators: panel.indicators
676 target: SessionBroadcast
677 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