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 function activateApplication(appId) {
54 if (ApplicationManager.findApplication(appId)) {
55 print("Shell.qml: activating app", appId);
56 ApplicationManager.activateApplication(appId);
58 print("starting app", appId);
61// var execFlags = sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
62 var execFlags = ApplicationManager.ForceMainStage;
64 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
87 // This is a dummy image that is needed to determine if the picture url
88 // in backgroundSettings points to a valid picture file.
89 // We can't do this with the real background image because setting a
90 // new source in onStatusChanged triggers a binding loop detection
91 // inside Image, which causes it not to render even though a valid source
92 // would be set. We don't mind about this image staying black and just
93 // use it for verification to populate the source for the real
96 source: shell.background
102 if (status == Image.Error && source != shell.defaultBackground) {
103 shell.background = defaultBackground
112 Keys.onVolumeUpPressed: volumeControl.volumeUp()
113 Keys.onVolumeDownPressed: volumeControl.volumeDown()
117 objectName: "underlay"
120 // Whether the underlay is fully covered by opaque UI elements.
121 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
123 readonly property bool applicationRunning: ApplicationManager.focusedApplicationId.length > 0
124 onApplicationRunningChanged: print("***************+ application running", applicationRunning)
126 // Whether the user should see the topmost application surface (if there's one at all).
127 readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.painting
129 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
130 // through the translucent parts of the shell surface.
131 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
133 onVisibleChanged: print("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", visible, fullyCovered, applicationSurfaceShouldBeSeen,
134 applicationRunning, stages.fullyHidden, stages.painting)
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 return stagesOuterContainer.showProgress;
175 // FIXME: only necessary because stagesOuterContainer.showProgress and
176 // greeterRevealer.animatedProgress are not animated
177 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
182 id: stagesOuterContainer
185 height: parent.height
187 Behavior on x {SmoothedAnimation{velocity: 600}}
189 property real showProgress: MathUtils.clamp(1 - (x + stages.x) / shell.width, 0, 1)
197 property bool fullyShown: shown && x == 0 && parent.x == 0
198 property bool fullyHidden: !shown && x == width
200 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
202 available: !greeter.shown
203 hides: [panel.indicators]
206 showAnimation: StandardAnimation { property: "x"; duration: 350; to: 0; easing.type: Easing.OutCubic }
207 hideAnimation: StandardAnimation { property: "x"; duration: 350; to: width; easing.type: Easing.OutCubic }
210 height: parent.height
212 property string lastFocusedAppId
214 print("stages shown", shown)
216 if (!ApplicationManager.focusedApplicationId && lastFocusedAppId) {
217 ApplicationManager.focusApplication(lastFocusedAppId);
220 lastFocusedAppId = ApplicationManager.focusedApplicationId;
221 ApplicationManager.unfocusCurrentApplication();
226 target: ApplicationManager
227 onFocusedApplicationIdChanged: {
228 if (ApplicationManager.focusedApplicationId.length > 0) {
229 print("should show stages")
236 onApplicationAdded: {
242 id: applicationsDisplayLoader
245// source: "Stages/StageWithSideStage.qml"
246 source: "Stages/PhoneStage.qml"
249 target: applicationsDisplayLoader.item
251 value: !stages.fullyShown
254 target: applicationsDisplayLoader.item
259 target: applicationsDisplayLoader.item
260 property: "dragAreaWidth"
261 value: shell.edgeSize
268 anchors.top: parent.top
269 anchors.bottom: parent.bottom
270 anchors.right: parent.left
272 width: shell.edgeSize
273 direction: Direction.Leftwards
274 enabled: greeter.showProgress == 0 && edgeDemo.dashEnabled
275 property bool haveApps: ApplicationManager.count > 0
277 maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
278 // Make autocompletion impossible when !haveApps
279 edgeDragEvaluator.minDragDistance: haveApps ? maxTotalDragDistance * 0.1 : Number.MAX_VALUE
286 objectName: "lockscreen"
288 readonly property int backgroundTopMargin: -panel.panelHeight
290 hides: [launcher, panel.indicators, hud]
293 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
294 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
296 x: required ? 0 : - width
298 height: parent.height - panel.panelHeight
299 background: shell.background
302 onEntered: LightDM.Greeter.respond(passphrase);
303 onCancel: greeter.show()
305 Component.onCompleted: {
306 if (LightDM.Users.count == 1) {
307 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
314 target: LightDM.Greeter
317 if (LightDM.Users.count == 1) {
318 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
320 lockscreen.alphaNumeric = false
322 lockscreen.alphaNumeric = true
324 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
329 onAuthenticationComplete: {
330 if (LightDM.Greeter.promptless) {
333 if (LightDM.Greeter.authenticated) {
336 lockscreen.clear(true);
343 objectName: "greeter"
346 hides: [launcher, panel.indicators, hud]
349 defaultBackground: shell.background
353 height: parent.height - panel.panelHeight
355 dragHandleWidth: shell.edgeSize
357 property var previousMainApp: null
358 property var previousSideApp: null
363 // If there is only one user, we start authenticating with that one here.
364 // If there are more users, the Greeter will handle that
365 if (LightDM.Users.count == 1) {
366 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
369 greeter.forceActiveFocus();
373 onUnlocked: greeter.hide()
375 // Update launcher items for new user
376 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
377 AccountsService.user = user;
378 LauncherModel.setUser(user);
381 onLeftTeaserPressedChanged: {
382 if (leftTeaserPressed) {
390 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
391 || panel.indicators.shown || hud.shown
398 onDisplayPowerStateChange: {
399 // We ignore any display-off signals when the proximity sensor
400 // is active. This usually indicates something like a phone call.
401 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
405 // No reason to chew demo CPU when user isn't watching
406 if (status == Powerd.Off) {
407 edgeDemo.paused = true;
408 } else if (status == Powerd.On) {
409 edgeDemo.paused = false;
414 function showHome() {
415 var animate = !greeter.shown && !stages.shown
417 dash.setCurrentScope("home.scope", animate, false)
421 function hideIndicatorMenu(delay) {
422 panel.hideIndicatorMenu(delay);
432 anchors.fill: parent //because this draws indicator menus
433 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
436 available: edgeDemo.panelEnabled
437 contentEnabled: edgeDemo.panelContentEnabled
439 property string focusedAppId: ApplicationManager.focusedApplicationId
440 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
441 fullscreenMode: focusedApplication && focusedApplication.fullscreen && !greeter.shown && !lockscreen.shown
442 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
450 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
458 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
459 height: parent.height
461 available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
463 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
464 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
467 target: ApplicationManager
468 onFocusedApplicationIdChanged: hud.hide()
477 anchors.left: hud.left
478 height: parent.height
479 target: hud.revealerTarget
482 direction: Qt.RightToLeft
483 orientation: Qt.Vertical
484 handleSize: hud.handleHeight
485 onCloseClicked: target.hide()
492 enabled: hud.available
493 applicationIsOnForeground: ApplicationManager.focusedApplicationId
497 blockInput: launcher.shown
500 bottom: parent.bottom
503 width: launcher.width
509 readonly property bool dashSwipe: progress > 0
511 anchors.top: parent.top
512 anchors.bottom: parent.bottom
514 dragAreaWidth: shell.edgeSize
515 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
518 if (edgeDemo.running)
529 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
530 onLauncherApplicationSelected:{
531 if (edgeDemo.running)
535 shell.activateApplication(appId)
539 panel.indicators.hide()
549 model: NotificationBackend.Model
555 bottom: parent.bottom
556 topMargin: panel.panelHeight
561 when: overlay.width <= units.gu(60)
562 AnchorChanges { target: notifications; anchors.left: parent.left }
566 when: overlay.width > units.gu(60)
567 AnchorChanges { target: notifications; anchors.left: undefined }
568 PropertyChanges { target: notifications; width: units.gu(38) }
573 anchors { left: parent.left; right: parent.right }
574 height: parent.contentHeight
575 blockInput: height > 0
581 onFocusChanged: if (!focus) forceActiveFocus();
586 bottom: parent.bottom
589 width: shell.edgeSize
596 bottom: parent.bottom
599 width: shell.edgeSize
610 anchors.topMargin: panel.panelHeight
611 anchors.fill: parent // as needs to know the geometry of the shell
614 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
616 anchors.bottom: parent.bottom
617 anchors.left: parent.left
618 anchors.right: parent.right
619 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
621 enabled: ApplicationManager.keyboardVisible
625 anchors.centerIn: parent
626 visible: ApplicationManager.fake ? ApplicationManager.fake : false
627 text: "EARLY ALPHA\nNOT READY FOR USE"
630 font.weight: Font.Black
631 horizontalAlignment: Text.AlignHCenter
632 verticalAlignment: Text.AlignVCenter
633 fontSizeMode: Text.Fit
635 scale: Math.min(parent.width, parent.height) / width
643 indicators: panel.indicators
648 target: SessionBroadcast
649 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