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 Ubuntu.Telephony 0.1 as Telephony
24import Unity.Launcher 0.1
26import LightDM 0.1 as LightDM
28import SessionBroadcast 0.1
35import Unity.Notifications 1.0 as NotificationBackend
36import Unity.Session 0.1
37import Unity.DashCommunicator 0.1
42 // this is only here to select the width / height of the window if not running fullscreen
43 property bool tablet: false
44 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
45 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
47 property real edgeSize: units.gu(2)
48 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
49 property url background
50 readonly property real panelHeight: panel.panelHeight
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);
66 property: "applicationManager"
67 value: ApplicationManager
70 Component.onCompleted: {
71 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
75 id: backgroundSettings
76 schema.id: "org.gnome.desktop.background"
78 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
79 onGSettingsPictureChanged: {
80 shell.background = gSettingsPicture
89 objectName: "dashCommunicator"
93 // Handle but do not filter out volume keys
94 Keys.onVolumeUpPressed: { volumeControl.volumeUp(); event.accepted = false; }
95 Keys.onVolumeDownPressed: { volumeControl.volumeDown(); event.accepted = false; }
98 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
99 dialogs.onPowerKeyPressed();
100 event.accepted = true;
102 event.accepted = false;
107 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
108 dialogs.onPowerKeyReleased();
109 event.accepted = true;
111 event.accepted = false;
118 objectName: "underlay"
121 // Whether the underlay is fully covered by opaque UI elements.
122 property bool fullyCovered: (panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth)
123 || stages.fullyShown || greeterWrapper.fullyShown
124 visible: !fullyCovered
127 anchors.fill: underlay
128 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
129 fillMode: Image.PreserveAspectCrop
130 horizontalAlignment: Image.AlignRight
131 verticalAlignment: Image.AlignTop
139 height: parent.height
140 visible: !ApplicationManager.empty
143 target: ApplicationManager
145 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
151 onFocusedApplicationIdChanged: {
152 if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
155 panel.indicators.hide();
158 onApplicationAdded: {
159 if (greeter.shown && appId != "unity8-dash") {
166 id: applicationsDisplayLoader
169 source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
172 target: applicationsDisplayLoader.item
173 property: "objectName"
177 target: applicationsDisplayLoader.item
178 property: "dragAreaWidth"
179 value: shell.edgeSize
182 target: applicationsDisplayLoader.item
183 property: "maximizedAppTopMargin"
184 // Not just using panel.panelHeight as that changes depending on the focused app.
185 value: panel.indicators.panelHeight
188 target: applicationsDisplayLoader.item
189 property: "interactive"
190 value: !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
193 target: applicationsDisplayLoader.item
194 property: "spreadEnabled"
195 value: greeter.fakeActiveForApp === "" // to support emergency dialer hack
198 target: applicationsDisplayLoader.item
199 property: "inverseProgress"
200 value: launcher.progress
207 objectName: "inputMethod"
208 anchors { fill: parent; topMargin: panel.panelHeight }
209 z: notifications.useModal || panel.indicators.shown ? overlay.z + 1 : overlay.z - 1
213 target: SurfaceManager
215 if (surface.type == MirSurfaceItem.InputMethod) {
216 inputMethod.surface = surface;
220 onSurfaceDestroyed: {
221 if (inputMethod.surface == surface) {
222 inputMethod.surface = null;
223 surface.parent = null;
225 if (!surface.parent) {
226 // there's no one displaying it. delete it right away
234 objectName: "lockscreen"
236 readonly property int backgroundTopMargin: -panel.panelHeight
238 hides: [launcher, panel.indicators]
241 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
242 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
246 height: parent.height - panel.panelHeight
247 background: shell.background
248 alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
252 onEntered: LightDM.Greeter.respond(passphrase);
253 onCancel: greeter.show()
255 greeter.fakeActiveForApp = "dialer-app"
256 shell.activateApplication("dialer-app")
260 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
262 Component.onCompleted: {
263 if (greeter.narrowMode) {
264 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
270 target: LightDM.Greeter
272 onShowGreeter: greeter.show()
275 if (greeter.narrowMode) {
276 lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
281 onPromptlessChanged: {
282 if (LightDM.Greeter.promptless) {
290 onAuthenticationComplete: {
291 if (LightDM.Greeter.promptless) {
294 if (LightDM.Greeter.authenticated) {
298 lockscreen.clear(true);
299 if (greeter.narrowMode) {
300 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
307 target: LightDM.Greeter
309 value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
315 opacity: greeterWrapper.showProgress * 0.8
319 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
324 height: parent.height - panel.panelHeight
327 enabled: !launcher.dashSwipe
331 property bool fullyShown: showProgress === 1.0
332 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
333 onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
337 objectName: "greeter"
339 signal sessionStarted() // helpful for tests
341 property string fakeActiveForApp: ""
344 hides: [launcher, panel.indicators]
347 defaultBackground: shell.background
350 height: parent.height
352 dragHandleWidth: shell.edgeSize
356 if (LightDM.Greeter.startSessionSync()) {
367 if (greeter.narrowMode) {
368 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
370 if (!LightDM.Greeter.promptless) {
374 greeter.fakeActiveForApp = "";
375 greeter.forceActiveFocus();
379 onUnlocked: greeter.hide()
381 // Update launcher items for new user
382 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
383 AccountsService.user = user;
384 LauncherModel.setUser(user);
387 onTease: launcher.tease()
390 target: ApplicationManager
391 property: "suspended"
392 value: greeter.shown && greeterWrapper.showProgress == 1
397 function showGreeterIfScreenIsOff() {
398 if (Powerd.status === Powerd.Off && !callManager.hasCalls && !edgeDemo.running) {
406 onHasCallsChanged: showGreeterIfScreenIsOff()
414 showGreeterIfScreenIsOff()
416 // No reason to chew demo CPU when user isn't watching
417 if (Powerd.status === Powerd.Off) {
418 edgeDemo.paused = true;
419 } else if (Powerd.status === Powerd.On) {
420 edgeDemo.paused = false;
425 function showHome() {
426 if (edgeDemo.running) {
430 if (LightDM.Greeter.active) {
431 if (!LightDM.Greeter.promptless) {
437 var animate = !LightDM.Greeter.active && !stages.shown
438 dash.setCurrentScope("clickscope", animate, false)
439 ApplicationManager.requestFocusApplication("unity8-dash")
442 function showDash() {
443 if (LightDM.Greeter.active && !LightDM.Greeter.promptless) {
451 ApplicationManager.requestFocusApplication("unity8-dash")
464 anchors.fill: parent //because this draws indicator menus
467 available: edgeDemo.panelEnabled && greeter.fakeActiveForApp === ""
468 contentEnabled: edgeDemo.panelContentEnabled
469 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
470 panelHeight: units.gu(3)
473 property bool topmostApplicationIsFullscreen:
474 ApplicationManager.focusedApplicationId &&
475 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
477 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
478 || greeter.fakeActiveForApp !== ""
483 objectName: "launcher"
485 readonly property bool dashSwipe: progress > 0
487 anchors.top: parent.top
488 anchors.bottom: parent.bottom
490 dragAreaWidth: shell.edgeSize
491 available: edgeDemo.launcherEnabled && greeter.fakeActiveForApp === ""
493 onShowDashHome: showHome()
495 onDashSwipeChanged: {
496 if (dashSwipe && ApplicationManager.focusedApplicationId !== "unity8-dash") {
497 dash.setCurrentScope("clickscope", false, true)
500 onLauncherApplicationSelected: {
501 if (greeter.fakeActiveForApp !== "") {
504 if (!edgeDemo.running)
505 shell.activateApplication(appId)
509 panel.indicators.hide()
515 id: modalNotificationBackground
517 visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
530 model: NotificationBackend.Model
535 height: parent.height - panel.panelHeight
540 when: overlay.width <= units.gu(60)
541 AnchorChanges { target: notifications; anchors.left: parent.left }
545 when: overlay.width > units.gu(60)
546 AnchorChanges { target: notifications; anchors.left: undefined }
547 PropertyChanges { target: notifications; width: units.gu(38) }
564 shutdownFadeOutRectangle.enabled = true;
565 shutdownFadeOutRectangle.visible = true;
566 shutdownFadeOut.start();
571 id: alphaDisclaimerLabel
572 anchors.centerIn: parent
573 visible: ApplicationManager.fake ? ApplicationManager.fake : false
575 text: "EARLY ALPHA\nNOT READY FOR USE"
578 font.weight: Font.Black
579 horizontalAlignment: Text.AlignHCenter
580 verticalAlignment: Text.AlignVCenter
581 fontSizeMode: Text.Fit
583 scale: Math.min(parent.width, parent.height) / width
588 z: alphaDisclaimerLabel.z + 10
591 indicators: panel.indicators
596 target: SessionBroadcast
597 onShowHome: showHome()
601 id: shutdownFadeOutRectangle
608 NumberAnimation on opacity {
613 if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
614 DBusUnitySessionService.Shutdown();
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