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 property int supportedScreenOrientations: {
41 // check device name and fix orientation if necessary
42 var deviceOrientations;
43 if (applicationArguments.device() === "flo") {
44 deviceOrientations = Qt.InvertedLandscapeOrientation;
45 } else if (applicationArguments.device() === "manta") {
46 deviceOrientations = Qt.LandscapeOrientation;
47 } else if (applicationArguments.device() === "mako") {
48 deviceOrientations = Qt.PortraitOrientation
49 | Qt.InvertedPortraitOrientation
50 | Qt.LandscapeOrientation
51 | Qt.InvertedLandscapeOrientation;
54 if (stages.shown && ApplicationManager.topmostApplication) {
55 return deviceOrientations & ApplicationManager.topmostApplication.supportedOrientations;
57 return deviceOrientations;
60 property bool dashShown: dash.shown && dash.available && underlay.visible
62 property real edgeSize: units.gu(2)
63 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
64 property url background
65 readonly property real panelHeight: panel.panelHeight
67 property bool sideStageEnabled: shell.width >= units.gu(100)
69 function activateApplication(appId) {
70 if (ApplicationManager.findApplication(appId)) {
71 ApplicationManager.requestFocusApplication(appId);
73 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
74 ApplicationManager.startApplication(appId, execFlags);
81 property: "applicationManager"
82 value: ApplicationManager
85 Component.onCompleted: {
86 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
90 id: backgroundSettings
91 schema.id: "org.gnome.desktop.background"
93 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
94 onGSettingsPictureChanged: {
95 shell.background = gSettingsPicture
102 Keys.onVolumeUpPressed: volumeControl.volumeUp()
103 Keys.onVolumeDownPressed: volumeControl.volumeDown()
107 objectName: "underlay"
110 // Whether the underlay is fully covered by opaque UI elements.
111 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
113 // NB! Application surfaces are stacked behind the shell one. So they can only be seen by the user
114 // through the translucent parts of the shell surface.
115 visible: !fullyCovered
120 opacity: dash.disappearingAnimationProgress
125 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
126 fillMode: Image.PreserveAspectCrop
127 horizontalAlignment: Image.AlignRight
128 verticalAlignment: Image.AlignTop
135 available: !greeter.shown && !lockscreen.shown
136 hides: [stages, launcher, panel.indicators]
137 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
138 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
142 topMargin: panel.panelHeight
145 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
146 opacity: 1.0 - disappearingAnimationProgress
147 property real disappearingAnimationProgress: stages.showProgress
149 // FIXME: only necessary because stages.showProgress is not animated
150 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
156 direction: Direction.Leftwards
158 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
159 width: shell.edgeSize
161 property real progress: stages.width
164 if (status == DirectionalDragArea.Recognized) {
165 if (ApplicationManager.empty) {
166 progress = Math.max(stages.width - stagesDragArea.width + touchX, stages.width * .3);
168 progress = stages.width - stagesDragArea.width + touchX;
175 if (!ApplicationManager.empty && progress < stages.width - units.gu(10)) {
178 stagesDragArea.progress = Qt.binding(function () { return stages.width; });
187 height: parent.height
189 visible: !fullyHidden && !ApplicationManager.empty
191 x: shown ? launcher.progress : stagesDragArea.progress
192 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
194 property bool shown: false
197 if (ApplicationManager.topmostApplication) {
198 ApplicationManager.focusApplication(ApplicationManager.topmostApplication.appId);
201 if (ApplicationManager.focusedApplicationId) {
202 ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
203 ApplicationManager.unfocusCurrentApplication();
208 // Avoid a silent "divide by zero -> NaN" situation during init as shell.width will be
209 // zero. That breaks the property binding and the function won't be reevaluated once
210 // shell.width is set, with the NaN result staying there for good.
211 property real showProgress: shell.width ? MathUtils.clamp(1 - x / shell.width, 0, 1) : 0
213 property bool fullyShown: x == 0
214 property bool fullyHidden: x == width
216 // It might technically not be fullyShown but visually it just looks so.
217 property bool roughlyFullyShown: x >= 0 && x <= units.gu(1)
228 target: ApplicationManager
229 onFocusRequested: { stages.show(); }
232 if (ApplicationManager.empty) {
239 target: DBusUnitySessionService
241 function closeAllApps() {
243 var app = ApplicationManager.get(0);
247 ApplicationManager.stopApplication(app.appId);
252 // TODO: Display a dialog to ask the user to confirm.
253 DBusUnitySessionService.Logout();
263 id: applicationsDisplayLoader
266 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
269 target: applicationsDisplayLoader.item
270 property: "dragAreaWidth"
271 value: shell.edgeSize
274 target: applicationsDisplayLoader.item
275 property: "maximizedAppTopMargin"
276 value: panel.panelHeight
279 target: applicationsDisplayLoader.item
280 property: "interactive"
281 value: stages.roughlyFullyShown
289 z: notifications.useModal ? overlay.z + 1 : overlay.z - 1
293 target: SurfaceManager
295 if (surface.type == MirSurfaceItem.InputMethod) {
296 inputMethod.surface = surface;
302 onSurfaceDestroyed: {
303 if (inputMethod.surface == surface) {
304 inputMethod.surface = null;
305 surface.parent = null;
307 if (!surface.parent) {
308 // there's no one displaying it. delete it right away
316 objectName: "lockscreen"
318 readonly property int backgroundTopMargin: -panel.panelHeight
320 hides: [launcher, panel.indicators]
323 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
324 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
326 x: required ? 0 : - width
328 height: parent.height - panel.panelHeight
329 //background: shell.background // FIXME: Commenting out as Qt was complaining about this line
333 onEntered: LightDM.Greeter.respond(passphrase);
334 onCancel: greeter.show()
336 Component.onCompleted: {
337 if (LightDM.Users.count == 1) {
338 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
344 target: LightDM.Greeter
347 if (LightDM.Users.count == 1) {
348 // TODO: There's no better way for now to determine if its a PIN or a passphrase.
350 lockscreen.alphaNumeric = false
352 lockscreen.alphaNumeric = true
354 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
359 onAuthenticationComplete: {
360 if (LightDM.Greeter.promptless) {
363 if (LightDM.Greeter.authenticated) {
366 lockscreen.clear(true);
374 opacity: greeterWrapper.showProgress * 0.8
378 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
383 height: parent.height - panel.panelHeight
386 enabled: !launcher.dashSwipe
390 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
394 objectName: "greeter"
397 hides: [launcher, panel.indicators]
400 defaultBackground: shell.background
403 height: parent.height
405 dragHandleWidth: shell.edgeSize
410 // If there is only one user, we start authenticating with that one here.
411 // If there are more users, the Greeter will handle that
412 if (LightDM.Users.count == 1) {
413 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
415 greeter.forceActiveFocus();
419 onUnlocked: greeter.hide()
421 // Update launcher items for new user
422 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
423 AccountsService.user = user;
424 LauncherModel.setUser(user);
427 onTease: launcher.tease()
430 target: ApplicationManager
431 property: "suspended"
432 value: greeter.shown && greeterWrapper.showProgress == 1
441 onDisplayPowerStateChange: {
442 // We ignore any display-off signals when the proximity sensor
443 // is active. This usually indicates something like a phone call.
444 if (status == Powerd.Off && reason != Powerd.Proximity) {
448 // No reason to chew demo CPU when user isn't watching
449 if (status == Powerd.Off) {
450 edgeDemo.paused = true;
451 } else if (status == Powerd.On) {
452 edgeDemo.paused = false;
457 function showHome() {
458 var animate = !greeter.shown && !stages.shown
460 dash.setCurrentScope("clickscope", animate, false)
464 function hideIndicatorMenu(delay) {
465 panel.hideIndicatorMenu(delay);
476 anchors.fill: parent //because this draws indicator menus
477 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
480 available: edgeDemo.panelEnabled
481 contentEnabled: edgeDemo.panelContentEnabled
484 property bool topmostApplicationIsFullscreen:
485 ApplicationManager.topmostApplication &&
486 ApplicationManager.topmostApplication.fullscreen
488 fullscreenMode: stages.roughlyFullyShown && topmostApplicationIsFullscreen
489 && !greeter.shown && !lockscreen.shown
491 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
497 readonly property bool dashSwipe: progress > 0
499 anchors.top: parent.top
500 anchors.bottom: parent.bottom
502 dragAreaWidth: shell.edgeSize
503 available: edgeDemo.launcherEnabled
506 if (edgeDemo.running)
512 if (!stages.locked) {
521 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
522 onLauncherApplicationSelected: {
523 if (!edgeDemo.running)
524 shell.activateApplication(appId)
528 panel.indicators.hide()
534 id: modalNotificationBackground
536 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
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) }
575 onFocusChanged: if (!focus) forceActiveFocus();
584 id: alphaDisclaimerLabel
585 anchors.centerIn: parent
586 visible: ApplicationManager.fake ? ApplicationManager.fake : false
588 text: "EARLY ALPHA\nNOT READY FOR USE"
591 font.weight: Font.Black
592 horizontalAlignment: Text.AlignHCenter
593 verticalAlignment: Text.AlignVCenter
594 fontSizeMode: Text.Fit
596 scale: Math.min(parent.width, parent.height) / width
601 z: alphaDisclaimerLabel.z + 10
605 indicators: panel.indicators
610 target: SessionBroadcast
611 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