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
36import Unity.Notifications 1.0 as NotificationBackend
41 // this is only here to select the width / height of the window if not running fullscreen
42 property bool tablet: false
43 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
44 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
46 property real edgeSize: units.gu(2)
47 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
48 property url background
49 readonly property real panelHeight: panel.panelHeight
51 property bool dashShown: dash.shown
53 property bool sideStageEnabled: shell.width >= units.gu(60)
55 function activateApplication(appId) {
56 if (ApplicationManager.findApplication(appId)) {
57 print("Shell.qml: activating app", appId);
58 ApplicationManager.activateApplication(appId);
60 print("starting app", appId);
62 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
63 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
86 // This is a dummy image that is needed to determine if the picture url
87 // in backgroundSettings points to a valid picture file.
88 // We can't do this with the real background image because setting a
89 // new source in onStatusChanged triggers a binding loop detection
90 // inside Image, which causes it not to render even though a valid source
91 // would be set. We don't mind about this image staying black and just
92 // use it for verification to populate the source for the real
95 source: shell.background
101 if (status == Image.Error && source != shell.defaultBackground) {
102 shell.background = defaultBackground
111 Keys.onVolumeUpPressed: volumeControl.volumeUp()
112 Keys.onVolumeDownPressed: volumeControl.volumeDown()
116 objectName: "underlay"
119 // Whether the underlay is fully covered by opaque UI elements.
120 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
122 readonly property bool applicationRunning: ApplicationManager.focusedApplicationId.length > 0
124 // Whether the user should see the topmost application surface (if there's one at all).
125 readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.painting
127 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
128 // through the translucent parts of the shell surface.
129 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
133 objectName: "backgroundImage"
136 source: shell.background
137 fillMode: Image.PreserveAspectCrop
143 opacity: dash.disappearingAnimationProgress
150 available: !greeter.shown && !lockscreen.shown
151 hides: [stages, launcher, panel.indicators]
152 shown: disappearingAnimationProgress !== 1.0
153 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
157 topMargin: panel.panelHeight
160 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
161 opacity: 1.0 - disappearingAnimationProgress
162 property real disappearingAnimationProgress: {
164 return greeter.showProgress;
166 return stagesOuterContainer.showProgress;
170 // FIXME: only necessary because stagesOuterContainer.showProgress and
171 // greeterRevealer.animatedProgress are not animated
172 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
177 id: stagesOuterContainer
180 height: parent.height
182 Behavior on x {SmoothedAnimation{velocity: 600}}
184 property real showProgress: MathUtils.clamp(1 - (x + stages.x) / shell.width, 0, 1)
192 property bool fullyShown: shown && x == 0 && parent.x == 0
193 property bool fullyHidden: !shown && x == width
195 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
196 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen : false
198 available: !greeter.shown
199 hides: [panel.indicators]
202 showAnimation: StandardAnimation { property: "x"; duration: 350; to: 0; easing.type: Easing.OutCubic }
203 hideAnimation: StandardAnimation { property: "x"; duration: 350; to: width; easing.type: Easing.OutCubic }
206 height: parent.height
208 property string lastFocusedAppId
210 print("stages shown", shown)
212 if (!ApplicationManager.focusedApplicationId && lastFocusedAppId) {
213 ApplicationManager.focusApplication(lastFocusedAppId);
216 lastFocusedAppId = ApplicationManager.focusedApplicationId;
217 ApplicationManager.unfocusCurrentApplication();
222 target: ApplicationManager
223 onFocusedApplicationIdChanged: {
224 if (ApplicationManager.focusedApplicationId.length > 0) {
225 print("should show stages")
232 onApplicationAdded: {
238 id: applicationsDisplayLoader
241 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
244 target: applicationsDisplayLoader.item
246 value: !stages.fullyShown
249 target: applicationsDisplayLoader.item
254 target: applicationsDisplayLoader.item
255 property: "dragAreaWidth"
256 value: shell.edgeSize
263 anchors.top: parent.top
264 anchors.bottom: parent.bottom
265 anchors.right: parent.left
267 width: shell.edgeSize
268 direction: Direction.Leftwards
269 enabled: greeter.showProgress == 0 && edgeDemo.dashEnabled
270 property bool haveApps: ApplicationManager.count > 0
272 maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
273 // Make autocompletion impossible when !haveApps
274 edgeDragEvaluator.minDragDistance: haveApps ? maxTotalDragDistance * 0.1 : Number.MAX_VALUE
281 objectName: "lockscreen"
283 readonly property int backgroundTopMargin: -panel.panelHeight
285 hides: [launcher, panel.indicators, hud]
288 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
289 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
291 x: required ? 0 : - width
293 height: parent.height - panel.panelHeight
294 background: shell.background
297 onEntered: LightDM.Greeter.respond(passphrase);
298 onCancel: greeter.show()
300 Component.onCompleted: {
301 if (LightDM.Users.count == 1) {
302 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
309 target: LightDM.Greeter
312 if (LightDM.Users.count == 1) {
313 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
315 lockscreen.alphaNumeric = false
317 lockscreen.alphaNumeric = true
319 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
324 onAuthenticationComplete: {
325 if (LightDM.Greeter.promptless) {
328 if (LightDM.Greeter.authenticated) {
331 lockscreen.clear(true);
338 objectName: "greeter"
341 hides: [launcher, panel.indicators, hud]
344 defaultBackground: shell.background
348 height: parent.height - panel.panelHeight
350 dragHandleWidth: shell.edgeSize
352 property var previousMainApp: null
353 property var previousSideApp: null
358 // If there is only one user, we start authenticating with that one here.
359 // If there are more users, the Greeter will handle that
360 if (LightDM.Users.count == 1) {
361 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
364 greeter.forceActiveFocus();
368 onUnlocked: greeter.hide()
370 // Update launcher items for new user
371 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
372 AccountsService.user = user;
373 LauncherModel.setUser(user);
376 onLeftTeaserPressedChanged: {
377 if (leftTeaserPressed) {
385 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
386 || panel.indicators.shown || hud.shown
393 onDisplayPowerStateChange: {
394 // We ignore any display-off signals when the proximity sensor
395 // is active. This usually indicates something like a phone call.
396 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
400 // No reason to chew demo CPU when user isn't watching
401 if (status == Powerd.Off) {
402 edgeDemo.paused = true;
403 } else if (status == Powerd.On) {
404 edgeDemo.paused = false;
409 function showHome() {
410 var animate = !greeter.shown && !stages.shown
412 dash.setCurrentScope("home.scope", animate, false)
416 function hideIndicatorMenu(delay) {
417 panel.hideIndicatorMenu(delay);
427 anchors.fill: parent //because this draws indicator menus
428 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
431 available: edgeDemo.panelEnabled
432 contentEnabled: edgeDemo.panelContentEnabled
434 property string focusedAppId: ApplicationManager.focusedApplicationId
435 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
436 fullscreenMode: stages.painting ? stages.fullscreen :
437 focusedApplication && focusedApplication.fullscreen && !greeter.shown && !lockscreen.shown
438 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
446 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
454 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
455 height: parent.height
457 available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
459 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
460 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
463 target: ApplicationManager
464 onFocusedApplicationIdChanged: hud.hide()
473 anchors.left: hud.left
474 height: parent.height
475 target: hud.revealerTarget
478 direction: Qt.RightToLeft
479 orientation: Qt.Vertical
480 handleSize: hud.handleHeight
481 onCloseClicked: target.hide()
488 enabled: hud.available
489 applicationIsOnForeground: ApplicationManager.focusedApplicationId
493 blockInput: launcher.shown
496 bottom: parent.bottom
499 width: launcher.width
505 readonly property bool dashSwipe: progress > 0
507 anchors.top: parent.top
508 anchors.bottom: parent.bottom
510 dragAreaWidth: shell.edgeSize
511 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
514 if (edgeDemo.running)
525 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
526 onLauncherApplicationSelected:{
527 if (edgeDemo.running)
531 shell.activateApplication(appId)
535 panel.indicators.hide()
545 model: NotificationBackend.Model
551 bottom: parent.bottom
552 topMargin: panel.panelHeight
557 when: overlay.width <= units.gu(60)
558 AnchorChanges { target: notifications; anchors.left: parent.left }
562 when: overlay.width > units.gu(60)
563 AnchorChanges { target: notifications; anchors.left: undefined }
564 PropertyChanges { target: notifications; width: units.gu(38) }
569 anchors { left: parent.left; right: parent.right }
570 height: parent.contentHeight
571 blockInput: height > 0
577 onFocusChanged: if (!focus) forceActiveFocus();
582 bottom: parent.bottom
585 width: shell.edgeSize
592 bottom: parent.bottom
595 width: shell.edgeSize
606 anchors.topMargin: panel.panelHeight
607 anchors.fill: parent // as needs to know the geometry of the shell
610 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
612 anchors.bottom: parent.bottom
613 anchors.left: parent.left
614 anchors.right: parent.right
615 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
617 enabled: ApplicationManager.keyboardVisible
621 anchors.centerIn: parent
622 visible: ApplicationManager.fake ? ApplicationManager.fake : false
623 text: "EARLY ALPHA\nNOT READY FOR USE"
626 font.weight: Font.Black
627 horizontalAlignment: Text.AlignHCenter
628 verticalAlignment: Text.AlignVCenter
629 fontSizeMode: Text.Fit
631 scale: Math.min(parent.width, parent.height) / width
639 indicators: panel.indicators
644 target: SessionBroadcast
645 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