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
123 onApplicationRunningChanged: print("***************+ application running", applicationRunning)
125 // Whether the user should see the topmost application surface (if there's one at all).
126 readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.painting
128 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
129 // through the translucent parts of the shell surface.
130 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
132 onVisibleChanged: print("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", visible, fullyCovered, applicationSurfaceShouldBeSeen,
133 applicationRunning, stages.fullyHidden, stages.painting)
137 objectName: "backgroundImage"
140 source: shell.background
141 fillMode: Image.PreserveAspectCrop
147 opacity: dash.disappearingAnimationProgress
154 available: !greeter.shown && !lockscreen.shown
155 hides: [stages, launcher, panel.indicators]
156 shown: disappearingAnimationProgress !== 1.0
157 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
161 topMargin: panel.panelHeight
164 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
165 opacity: 1.0 - disappearingAnimationProgress
166 property real disappearingAnimationProgress: {
168 return greeter.showProgress;
170 return stagesOuterContainer.showProgress;
174 // FIXME: only necessary because stagesOuterContainer.showProgress and
175 // greeterRevealer.animatedProgress are not animated
176 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
181 id: stagesOuterContainer
184 height: parent.height
186 Behavior on x {SmoothedAnimation{velocity: 600}}
188 property real showProgress: MathUtils.clamp(1 - (x + stages.x) / shell.width, 0, 1)
196 property bool fullyShown: shown && x == 0 && parent.x == 0
197 property bool fullyHidden: !shown && x == width
199 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting : false
201 available: !greeter.shown
202 hides: [panel.indicators]
205 showAnimation: StandardAnimation { property: "x"; duration: 350; to: 0; easing.type: Easing.OutCubic }
206 hideAnimation: StandardAnimation { property: "x"; duration: 350; to: width; easing.type: Easing.OutCubic }
209 height: parent.height
211 property string lastFocusedAppId
213 print("stages shown", shown)
215 if (!ApplicationManager.focusedApplicationId && lastFocusedAppId) {
216 ApplicationManager.focusApplication(lastFocusedAppId);
219 lastFocusedAppId = ApplicationManager.focusedApplicationId;
220 ApplicationManager.unfocusCurrentApplication();
225 target: ApplicationManager
226 onFocusedApplicationIdChanged: {
227 if (ApplicationManager.focusedApplicationId.length > 0) {
228 print("should show stages")
235 onApplicationAdded: {
241 id: applicationsDisplayLoader
244 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
247 target: applicationsDisplayLoader.item
249 value: !stages.fullyShown
252 target: applicationsDisplayLoader.item
257 target: applicationsDisplayLoader.item
258 property: "dragAreaWidth"
259 value: shell.edgeSize
266 anchors.top: parent.top
267 anchors.bottom: parent.bottom
268 anchors.right: parent.left
270 width: shell.edgeSize
271 direction: Direction.Leftwards
272 enabled: greeter.showProgress == 0 && edgeDemo.dashEnabled
273 property bool haveApps: ApplicationManager.count > 0
275 maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
276 // Make autocompletion impossible when !haveApps
277 edgeDragEvaluator.minDragDistance: haveApps ? maxTotalDragDistance * 0.1 : Number.MAX_VALUE
284 objectName: "lockscreen"
286 readonly property int backgroundTopMargin: -panel.panelHeight
288 hides: [launcher, panel.indicators, hud]
291 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
292 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
294 x: required ? 0 : - width
296 height: parent.height - panel.panelHeight
297 background: shell.background
300 onEntered: LightDM.Greeter.respond(passphrase);
301 onCancel: greeter.show()
303 Component.onCompleted: {
304 if (LightDM.Users.count == 1) {
305 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
312 target: LightDM.Greeter
315 if (LightDM.Users.count == 1) {
316 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
318 lockscreen.alphaNumeric = false
320 lockscreen.alphaNumeric = true
322 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
327 onAuthenticationComplete: {
328 if (LightDM.Greeter.promptless) {
331 if (LightDM.Greeter.authenticated) {
334 lockscreen.clear(true);
341 objectName: "greeter"
344 hides: [launcher, panel.indicators, hud]
347 defaultBackground: shell.background
351 height: parent.height - panel.panelHeight
353 dragHandleWidth: shell.edgeSize
355 property var previousMainApp: null
356 property var previousSideApp: null
361 // If there is only one user, we start authenticating with that one here.
362 // If there are more users, the Greeter will handle that
363 if (LightDM.Users.count == 1) {
364 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
367 greeter.forceActiveFocus();
371 onUnlocked: greeter.hide()
373 // Update launcher items for new user
374 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
375 AccountsService.user = user;
376 LauncherModel.setUser(user);
379 onLeftTeaserPressedChanged: {
380 if (leftTeaserPressed) {
388 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
389 || panel.indicators.shown || hud.shown
396 onDisplayPowerStateChange: {
397 // We ignore any display-off signals when the proximity sensor
398 // is active. This usually indicates something like a phone call.
399 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
403 // No reason to chew demo CPU when user isn't watching
404 if (status == Powerd.Off) {
405 edgeDemo.paused = true;
406 } else if (status == Powerd.On) {
407 edgeDemo.paused = false;
412 function showHome() {
413 var animate = !greeter.shown && !stages.shown
415 dash.setCurrentScope("home.scope", animate, false)
419 function hideIndicatorMenu(delay) {
420 panel.hideIndicatorMenu(delay);
430 anchors.fill: parent //because this draws indicator menus
431 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
434 available: edgeDemo.panelEnabled
435 contentEnabled: edgeDemo.panelContentEnabled
437 property string focusedAppId: ApplicationManager.focusedApplicationId
438 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
439 fullscreenMode: focusedApplication && focusedApplication.fullscreen && !greeter.shown && !lockscreen.shown
440 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
448 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
456 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
457 height: parent.height
459 available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
461 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
462 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
465 target: ApplicationManager
466 onFocusedApplicationIdChanged: hud.hide()
475 anchors.left: hud.left
476 height: parent.height
477 target: hud.revealerTarget
480 direction: Qt.RightToLeft
481 orientation: Qt.Vertical
482 handleSize: hud.handleHeight
483 onCloseClicked: target.hide()
490 enabled: hud.available
491 applicationIsOnForeground: ApplicationManager.focusedApplicationId
495 blockInput: launcher.shown
498 bottom: parent.bottom
501 width: launcher.width
507 readonly property bool dashSwipe: progress > 0
509 anchors.top: parent.top
510 anchors.bottom: parent.bottom
512 dragAreaWidth: shell.edgeSize
513 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
516 if (edgeDemo.running)
527 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
528 onLauncherApplicationSelected:{
529 if (edgeDemo.running)
533 shell.activateApplication(appId)
537 panel.indicators.hide()
547 model: NotificationBackend.Model
553 bottom: parent.bottom
554 topMargin: panel.panelHeight
559 when: overlay.width <= units.gu(60)
560 AnchorChanges { target: notifications; anchors.left: parent.left }
564 when: overlay.width > units.gu(60)
565 AnchorChanges { target: notifications; anchors.left: undefined }
566 PropertyChanges { target: notifications; width: units.gu(38) }
571 anchors { left: parent.left; right: parent.right }
572 height: parent.contentHeight
573 blockInput: height > 0
579 onFocusChanged: if (!focus) forceActiveFocus();
584 bottom: parent.bottom
587 width: shell.edgeSize
594 bottom: parent.bottom
597 width: shell.edgeSize
608 anchors.topMargin: panel.panelHeight
609 anchors.fill: parent // as needs to know the geometry of the shell
612 //FIXME: This should be handled in the input stack, keyboard shouldnt propagate
614 anchors.bottom: parent.bottom
615 anchors.left: parent.left
616 anchors.right: parent.right
617 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
619 enabled: ApplicationManager.keyboardVisible
623 anchors.centerIn: parent
624 visible: ApplicationManager.fake ? ApplicationManager.fake : false
625 text: "EARLY ALPHA\nNOT READY FOR USE"
628 font.weight: Font.Black
629 horizontalAlignment: Text.AlignHCenter
630 verticalAlignment: Text.AlignVCenter
631 fontSizeMode: Text.Fit
633 scale: Math.min(parent.width, parent.height) / width
641 indicators: panel.indicators
646 target: SessionBroadcast
647 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