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.requestFocusApplication(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 // Whether the user should see the topmost application surface (if there's one at all).
128 readonly property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
130 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
131 // through the translucent parts of the shell surface.
132 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
136 objectName: "backgroundImage"
139 source: shell.background
140 fillMode: Image.PreserveAspectCrop
146 opacity: dash.disappearingAnimationProgress
153 available: !greeter.shown && !lockscreen.shown
154 hides: [stages, launcher, panel.indicators]
155 shown: disappearingAnimationProgress !== 1.0
156 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
160 topMargin: panel.panelHeight
163 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
164 opacity: 1.0 - disappearingAnimationProgress
165 property real disappearingAnimationProgress: {
167 return greeter.showProgress;
169 if (stages.overlayMode) {
172 return stages.showProgress
176 // FIXME: only necessary because stages.showProgress and
177 // greeterRevealer.animatedProgress are not animated
178 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
185 direction: Direction.Leftwards
187 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
188 width: shell.edgeSize
190 property real progress: stages.width
193 if (status == DirectionalDragArea.Recognized) {
194 if (ApplicationManager.count == 0) {
195 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
197 progress = stages.width - stagesDragHandle.width + touchX
204 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
207 stagesDragHandle.progress = stages.width;
216 height: parent.height
220 if (overlayMode || locked) {
223 return launcher.progress
225 return stagesDragHandle.progress
229 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
231 property bool shown: false
233 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
235 property bool fullyShown: x == 0
236 property bool fullyHidden: x == width
238 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
239 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
240 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode : false
241 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth : false
242 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
246 panel.indicators.hide();
247 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0) {
248 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
259 function forceHide() {
261 if (ApplicationManager.focusedApplicationId) {
262 ApplicationManager.unfocusCurrentApplication();
267 target: ApplicationManager
273 onFocusedApplicationIdChanged: {
274 if (ApplicationManager.focusedApplicationId.length > 0) {
277 if (!stages.overlayMode) {
283 onApplicationAdded: {
289 id: applicationsDisplayLoader
292 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
295 target: applicationsDisplayLoader.item
297 value: !stages.fullyShown
300 target: applicationsDisplayLoader.item
305 target: applicationsDisplayLoader.item
306 property: "dragAreaWidth"
307 value: shell.edgeSize
314 objectName: "lockscreen"
316 readonly property int backgroundTopMargin: -panel.panelHeight
318 hides: [launcher, panel.indicators, hud]
321 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
322 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
324 x: required ? 0 : - width
326 height: parent.height - panel.panelHeight
327 background: shell.background
330 onEntered: LightDM.Greeter.respond(passphrase);
331 onCancel: greeter.show()
333 Component.onCompleted: {
334 if (LightDM.Users.count == 1) {
335 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
341 target: LightDM.Greeter
344 if (LightDM.Users.count == 1) {
345 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
347 lockscreen.alphaNumeric = false
349 lockscreen.alphaNumeric = true
351 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
356 onAuthenticationComplete: {
357 if (LightDM.Greeter.promptless) {
360 if (LightDM.Greeter.authenticated) {
363 lockscreen.clear(true);
370 objectName: "greeter"
373 hides: [launcher, panel.indicators, hud]
376 defaultBackground: shell.background
380 height: parent.height - panel.panelHeight
382 dragHandleWidth: shell.edgeSize
387 // If there is only one user, we start authenticating with that one here.
388 // If there are more users, the Greeter will handle that
389 if (LightDM.Users.count == 1) {
390 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
392 greeter.forceActiveFocus();
396 onUnlocked: greeter.hide()
398 // Update launcher items for new user
399 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
400 AccountsService.user = user;
401 LauncherModel.setUser(user);
404 onLeftTeaserPressedChanged: {
405 if (leftTeaserPressed) {
411 target: ApplicationManager
412 property: "suspended"
413 value: greeter.shown && greeter.showProgress == 1
419 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
420 || panel.indicators.shown || hud.shown
427 onDisplayPowerStateChange: {
428 // We ignore any display-off signals when the proximity sensor
429 // is active. This usually indicates something like a phone call.
430 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
434 // No reason to chew demo CPU when user isn't watching
435 if (status == Powerd.Off) {
436 edgeDemo.paused = true;
437 } else if (status == Powerd.On) {
438 edgeDemo.paused = false;
443 function showHome() {
444 var animate = !greeter.shown && !stages.shown
446 dash.setCurrentScope("home.scope", animate, false)
450 function hideIndicatorMenu(delay) {
451 panel.hideIndicatorMenu(delay);
461 anchors.fill: parent //because this draws indicator menus
462 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
465 available: edgeDemo.panelEnabled
466 contentEnabled: edgeDemo.panelContentEnabled
468 property string focusedAppId: ApplicationManager.focusedApplicationId
469 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
470 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
471 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
479 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
487 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
488 height: parent.height
490 available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
492 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
493 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
496 target: ApplicationManager
497 onFocusedApplicationIdChanged: hud.hide()
506 anchors.left: hud.left
507 height: parent.height
508 target: hud.revealerTarget
511 direction: Qt.RightToLeft
512 orientation: Qt.Vertical
513 handleSize: hud.handleHeight
514 onCloseClicked: target.hide()
521 enabled: hud.available
522 applicationIsOnForeground: ApplicationManager.focusedApplicationId
526 blockInput: launcher.shown
529 bottom: parent.bottom
532 width: launcher.width
538 readonly property bool dashSwipe: progress > 0
540 anchors.top: parent.top
541 anchors.bottom: parent.bottom
543 dragAreaWidth: shell.edgeSize
544 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
547 if (edgeDemo.running)
553 if (stages.shown && !stages.overlayMode) {
558 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
559 onLauncherApplicationSelected:{
560 if (edgeDemo.running)
564 shell.activateApplication(appId)
568 panel.indicators.hide()
578 model: NotificationBackend.Model
584 bottom: parent.bottom
585 topMargin: panel.panelHeight
590 when: overlay.width <= units.gu(60)
591 AnchorChanges { target: notifications; anchors.left: parent.left }
595 when: overlay.width > units.gu(60)
596 AnchorChanges { target: notifications; anchors.left: undefined }
597 PropertyChanges { target: notifications; width: units.gu(38) }
602 anchors { left: parent.left; right: parent.right }
603 height: parent.contentHeight
604 blockInput: height > 0
610 onFocusChanged: if (!focus) forceActiveFocus();
615 bottom: parent.bottom
618 width: shell.edgeSize
625 bottom: parent.bottom
628 width: shell.edgeSize
639 anchors.topMargin: panel.panelHeight
640 anchors.fill: parent // as needs to know the geometry of the shell
643 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
645 anchors.bottom: parent.bottom
646 anchors.left: parent.left
647 anchors.right: parent.right
648 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
650 enabled: ApplicationManager.keyboardVisible
654 anchors.centerIn: parent
655 visible: ApplicationManager.fake ? ApplicationManager.fake : false
656 text: "EARLY ALPHA\nNOT READY FOR USE"
659 font.weight: Font.Black
660 horizontalAlignment: Text.AlignHCenter
661 verticalAlignment: Text.AlignVCenter
662 fontSizeMode: Text.Fit
664 scale: Math.min(parent.width, parent.height) / width
672 indicators: panel.indicators
677 target: SessionBroadcast
678 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