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
34import Unity.Notifications 1.0 as NotificationBackend
35import Unity.Session 0.1
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 && dash.available && underlay.visible
52 property bool sideStageEnabled: shell.width >= units.gu(100)
53 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
55 function activateApplication(appId) {
56 if (ApplicationManager.findApplication(appId)) {
57 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
88 Keys.onVolumeUpPressed: volumeControl.volumeUp()
89 Keys.onVolumeDownPressed: volumeControl.volumeDown()
93 objectName: "underlay"
96 // Whether the underlay is fully covered by opaque UI elements.
97 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
99 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
100 // through the translucent parts of the shell surface.
101 visible: !fullyCovered
106 opacity: dash.disappearingAnimationProgress
111 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
112 fillMode: Image.PreserveAspectCrop
113 horizontalAlignment: Image.AlignRight
114 verticalAlignment: Image.AlignTop
121 available: !greeter.shown && !lockscreen.shown
122 hides: [stages, launcher, panel.indicators]
123 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
124 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
128 topMargin: panel.panelHeight
131 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
132 opacity: 1.0 - disappearingAnimationProgress
133 property real disappearingAnimationProgress: stages.showProgress
135 // FIXME: only necessary because stages.showProgress is not animated
136 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
142 direction: Direction.Leftwards
144 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
145 width: shell.edgeSize
147 property real progress: stages.width
150 if (status == DirectionalDragArea.Recognized) {
151 if (ApplicationManager.empty) {
152 progress = Math.max(stages.width - stagesDragArea.width + touchX, stages.width * .3);
154 progress = stages.width - stagesDragArea.width + touchX;
161 if (!ApplicationManager.empty && progress < stages.width - units.gu(10)) {
164 stagesDragArea.progress = Qt.binding(function () { return stages.width; });
173 height: parent.height
175 visible: !fullyHidden && !ApplicationManager.empty
177 x: shown ? launcher.progress : stagesDragArea.progress
178 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
180 property bool shown: false
183 if (ApplicationManager.topmostApplication) {
184 ApplicationManager.focusApplication(ApplicationManager.topmostApplication.appId);
187 if (ApplicationManager.focusedApplicationId) {
188 ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
189 ApplicationManager.unfocusCurrentApplication();
194 // Avoid a silent "divide by zero -> NaN" situation during init as shell.width will be
195 // zero. That breaks the property binding and the function won't be reevaluated once
196 // shell.width is set, with the NaN result staying there for good.
197 property real showProgress: shell.width ? MathUtils.clamp(1 - x / shell.width, 0, 1) : 0
199 property bool fullyShown: x == 0
200 property bool fullyHidden: x == width
202 // It might technically not be fullyShown but visually it just looks so.
203 property bool roughlyFullyShown: x >= 0 && x <= units.gu(1)
214 target: ApplicationManager
222 onApplicationAdded: {
229 if (ApplicationManager.empty) {
236 target: DBusUnitySessionService
238 function closeAllApps() {
240 var app = ApplicationManager.get(0);
244 ApplicationManager.stopApplication(app.appId);
249 // TODO: Display a dialog to ask the user to confirm.
250 DBusUnitySessionService.Logout();
260 id: applicationsDisplayLoader
263 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
266 target: applicationsDisplayLoader.item
267 property: "dragAreaWidth"
268 value: shell.edgeSize
271 target: applicationsDisplayLoader.item
272 property: "maximizedAppTopMargin"
273 // Not just using panel.panelHeight as that changes depending on the focused app.
274 value: panel.indicators.panelHeight
277 target: applicationsDisplayLoader.item
278 property: "interactive"
279 value: stages.roughlyFullyShown
287 z: notifications.useModal || panel.indicators.shown ? overlay.z + 1 : overlay.z - 1
291 target: SurfaceManager
293 if (surface.type == MirSurfaceItem.InputMethod) {
294 inputMethod.surface = surface;
298 onSurfaceDestroyed: {
299 if (inputMethod.surface == surface) {
300 inputMethod.surface = null;
301 surface.parent = null;
303 if (!surface.parent) {
304 // there's no one displaying it. delete it right away
312 objectName: "lockscreen"
314 readonly property int backgroundTopMargin: -panel.panelHeight
316 hides: [launcher, panel.indicators]
319 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
320 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
322 x: required ? 0 : - width
324 height: parent.height - panel.panelHeight
325 //background: shell.background // FIXME: Commenting out as Qt was complaining about this line
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);
370 opacity: greeterWrapper.showProgress * 0.8
374 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
379 height: parent.height - panel.panelHeight
382 enabled: !launcher.dashSwipe
386 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
390 objectName: "greeter"
393 hides: [launcher, panel.indicators]
396 defaultBackground: shell.background
399 height: parent.height
401 dragHandleWidth: shell.edgeSize
406 // If there is only one user, we start authenticating with that one here.
407 // If there are more users, the Greeter will handle that
408 if (LightDM.Users.count == 1) {
409 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
411 greeter.forceActiveFocus();
415 onUnlocked: greeter.hide()
417 // Update launcher items for new user
418 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
419 AccountsService.user = user;
420 LauncherModel.setUser(user);
423 onTease: launcher.tease()
426 target: ApplicationManager
427 property: "suspended"
428 value: greeter.shown && greeterWrapper.showProgress == 1
437 onDisplayPowerStateChange: {
438 // We ignore any display-off signals when the proximity sensor
439 // is active. This usually indicates something like a phone call.
440 if (status == Powerd.Off && reason != Powerd.Proximity) {
444 // No reason to chew demo CPU when user isn't watching
445 if (status == Powerd.Off) {
446 edgeDemo.paused = true;
447 } else if (status == Powerd.On) {
448 edgeDemo.paused = false;
453 function showHome() {
454 var animate = !greeter.shown && !stages.shown
456 dash.setCurrentScope("clickscope", animate, false)
460 function hideIndicatorMenu(delay) {
461 panel.hideIndicatorMenu(delay);
472 anchors.fill: parent //because this draws indicator menus
475 available: edgeDemo.panelEnabled
476 contentEnabled: edgeDemo.panelContentEnabled
477 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
478 panelHeight: units.gu(3)
481 property bool topmostApplicationIsFullscreen:
482 ApplicationManager.topmostApplication &&
483 ApplicationManager.topmostApplication.fullscreen
485 fullscreenMode: stages.roughlyFullyShown && topmostApplicationIsFullscreen
486 && !greeter.shown && !lockscreen.shown
492 readonly property bool dashSwipe: progress > 0
494 anchors.top: parent.top
495 anchors.bottom: parent.bottom
497 dragAreaWidth: shell.edgeSize
498 available: edgeDemo.launcherEnabled
501 if (edgeDemo.running)
507 if (!stages.locked) {
511 launcher.switchToNextState("visible");
519 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
520 onLauncherApplicationSelected: {
521 if (!edgeDemo.running)
522 shell.activateApplication(appId)
526 panel.indicators.hide()
532 id: modalNotificationBackground
534 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
547 model: NotificationBackend.Model
552 height: parent.height - 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) }
571 onFocusChanged: if (!focus) forceActiveFocus();
580 id: alphaDisclaimerLabel
581 anchors.centerIn: parent
582 visible: ApplicationManager.fake ? ApplicationManager.fake : false
584 text: "EARLY ALPHA\nNOT READY FOR USE"
587 font.weight: Font.Black
588 horizontalAlignment: Text.AlignHCenter
589 verticalAlignment: Text.AlignVCenter
590 fontSizeMode: Text.Fit
592 scale: Math.min(parent.width, parent.height) / width
597 z: alphaDisclaimerLabel.z + 10
601 indicators: panel.indicators
606 target: SessionBroadcast
607 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