18 import AccountsService 0.1
20 import Unity.Application 0.1
21 import Ubuntu.Components 0.1
22 import Ubuntu.Gestures 0.1
23 import Unity.Launcher 0.1
24 import LightDM 0.1 as LightDM
26 import SessionBroadcast 0.1
32 import "Notifications"
33 import Unity.Notifications 1.0 as NotificationBackend
34 import Unity.Session 0.1
40 property bool tablet:
false
41 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
42 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
44 property real edgeSize: units.gu(2)
45 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ?
"graphics/tablet_background.jpg" :
"graphics/phone_background.jpg")
46 property url background
47 readonly property real panelHeight: panel.panelHeight
49 property
bool dashShown: dash.shown
51 property
bool sideStageEnabled: shell.width >= units.gu(100)
52 readonly
property string focusedApplicationId: ApplicationManager.focusedApplicationId
54 function activateApplication(appId) {
55 if (ApplicationManager.findApplication(appId)) {
56 ApplicationManager.requestFocusApplication(appId);
58 if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
59 applicationsDisplayLoader.item.select(appId);
62 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
63 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
91 Keys.onVolumeUpPressed: volumeControl.volumeUp()
92 Keys.onVolumeDownPressed: volumeControl.volumeDown()
97 anchors.rightMargin: stages.overlayWidth
98 clip: stages.overlayMode && !stages.painting
102 blockInput: parent.clip
107 objectName:
"underlay"
109 anchors.rightMargin: -parent.anchors.rightMargin
112 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
115 readonly
property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
119 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
124 opacity: dash.disappearingAnimationProgress
129 source: shell.width > shell.height ?
"Dash/graphics/paper_landscape.png" :
"Dash/graphics/paper_portrait.png"
130 fillMode: Image.PreserveAspectCrop
131 horizontalAlignment: Image.AlignRight
132 verticalAlignment: Image.AlignTop
139 available: !greeter.shown && !lockscreen.shown
140 hides: [stages, launcher, panel.indicators]
141 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
142 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
146 topMargin: panel.panelHeight
149 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
150 opacity: 1.0 - disappearingAnimationProgress
151 property real disappearingAnimationProgress: {
152 if (stages.overlayMode) {
155 return stages.showProgress
160 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
167 direction: Direction.Leftwards
169 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
170 width: shell.edgeSize
172 property real progress: stages.width
175 if (status == DirectionalDragArea.Recognized) {
176 if (ApplicationManager.count == 0) {
177 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
179 progress = stages.width - stagesDragHandle.width + touchX
186 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
189 stagesDragHandle.progress = stages.width;
198 height: parent.height
202 if (overlayMode || locked) {
205 return launcher.progress
207 return stagesDragHandle.progress
211 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
213 property bool shown:
false
215 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
217 property bool fullyShown: x == 0
218 property bool fullyHidden: x == width
220 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting :
false
221 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen :
false
222 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode :
false
223 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth :
false
224 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked :
false
226 function show(focusApp) {
228 panel.indicators.hide();
231 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
232 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
238 if (ApplicationManager.focusedApplicationId) {
239 ApplicationManager.unfocusCurrentApplication();
244 target: ApplicationManager
250 onFocusedApplicationIdChanged: {
251 if (ApplicationManager.focusedApplicationId.length > 0) {
254 if (!stages.overlayMode) {
260 onApplicationAdded: {
264 onApplicationRemoved: {
265 if (ApplicationManager.focusedApplicationId.length == 0) {
274 function closeAllApps() {
276 var app = ApplicationManager.get(0);
280 ApplicationManager.stopApplication(app.appId);
296 id: applicationsDisplayLoader
299 source: shell.sideStageEnabled ?
"Stages/StageWithSideStage.qml" :
"Stages/PhoneStage.qml"
302 target: applicationsDisplayLoader.item
304 value: !stages.fullyShown
307 target: applicationsDisplayLoader.item
312 target: applicationsDisplayLoader.item
313 property:
"dragAreaWidth"
314 value: shell.edgeSize
321 objectName:
"lockscreen"
323 readonly
property int backgroundTopMargin: -panel.panelHeight
325 hides: [launcher, panel.indicators]
328 showAnimation: StandardAnimation {
property:
"opacity"; to: 1 }
329 hideAnimation: StandardAnimation {
property:
"opacity"; to: 0 }
331 x: required ? 0 : - width
333 height: parent.height - panel.panelHeight
334 background: shell.background
338 onEntered: LightDM.Greeter.respond(passphrase);
339 onCancel: greeter.show()
341 Component.onCompleted: {
342 if (LightDM.Users.count == 1) {
343 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
349 target: LightDM.Greeter
352 if (LightDM.Users.count == 1) {
355 lockscreen.alphaNumeric =
false
357 lockscreen.alphaNumeric =
true
359 lockscreen.placeholderText = i18n.tr(
"Please enter %1").arg(text);
364 onAuthenticationComplete: {
365 if (LightDM.Greeter.promptless) {
368 if (LightDM.Greeter.authenticated) {
371 lockscreen.clear(
true);
379 opacity: greeterWrapper.showProgress * 0.8
388 height: parent.height - panel.panelHeight
391 enabled: !launcher.dashSwipe
395 readonly
property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
399 objectName:
"greeter"
402 hides: [launcher, panel.indicators]
405 defaultBackground: shell.background
408 height: parent.height
410 dragHandleWidth: shell.edgeSize
417 if (LightDM.Users.count == 1) {
418 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
420 greeter.forceActiveFocus();
424 onUnlocked: greeter.hide()
427 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
428 AccountsService.user = user;
429 LauncherModel.setUser(user);
432 onTease: launcher.tease()
435 target: ApplicationManager
436 property:
"suspended"
437 value: greeter.shown && greeterWrapper.showProgress == 1
444 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
445 || panel.indicators.shown
452 onDisplayPowerStateChange: {
455 if (status == Powerd.Off && reason != Powerd.Proximity) {
460 if (status == Powerd.Off) {
461 edgeDemo.paused =
true;
462 }
else if (status == Powerd.On) {
463 edgeDemo.paused =
false;
468 function showHome() {
469 var animate = !greeter.shown && !stages.shown
471 dash.setCurrentScope(
"clickscope", animate,
false)
475 function hideIndicatorMenu(delay) {
476 panel.hideIndicatorMenu(delay);
487 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
490 available: edgeDemo.panelEnabled
491 contentEnabled: edgeDemo.panelContentEnabled
493 property string focusedAppId: ApplicationManager.focusedApplicationId
494 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
495 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
496 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
504 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
510 blockInput: launcher.shown
513 bottom: parent.bottom
516 width: launcher.width
522 readonly
property bool dashSwipe: progress > 0
524 anchors.top: parent.top
525 anchors.bottom: parent.bottom
527 dragAreaWidth: shell.edgeSize
528 available: edgeDemo.launcherEnabled
531 if (edgeDemo.running)
537 if (stages.shown && !stages.overlayMode) {
538 if (!stages.locked) {
548 onDashSwipeChanged:
if (dashSwipe && stages.shown) dash.setCurrentScope(
"clickscope",
false,
true)
549 onLauncherApplicationSelected: {
550 if (!edgeDemo.running)
551 shell.activateApplication(appId)
555 panel.indicators.hide()
561 id: modalNotificationBackground
563 visible: notifications.useModal && !greeter.shown && (notifications.state ==
"narrow")
574 blockInput: modalNotificationBackground.visible
581 model: NotificationBackend.Model
587 bottom: parent.bottom
588 topMargin: panel.panelHeight
593 when: overlay.width <= units.gu(60)
594 AnchorChanges { target: notifications; anchors.left: parent.left }
598 when: overlay.width > units.gu(60)
599 AnchorChanges { target: notifications; anchors.left: undefined }
600 PropertyChanges { target: notifications; width: units.gu(38) }
605 anchors { left: parent.left; right: parent.right }
606 height: parent.contentHeight
607 blockInput: height > 0
613 onFocusChanged:
if (!focus) forceActiveFocus();
618 bottom: parent.bottom
621 width: shell.edgeSize
628 bottom: parent.bottom
631 width: shell.edgeSize
642 anchors.topMargin: panel.panelHeight
648 anchors.bottom: parent.bottom
649 anchors.left: parent.left
650 anchors.right: parent.right
651 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
653 enabled: ApplicationManager.keyboardVisible
657 anchors.centerIn: parent
658 visible: ApplicationManager.fake ? ApplicationManager.fake :
false
659 text:
"EARLY ALPHA\nNOT READY FOR USE"
662 font.weight: Font.Black
663 horizontalAlignment: Text.AlignHCenter
664 verticalAlignment: Text.AlignVCenter
665 fontSizeMode: Text.Fit
667 scale: Math.min(parent.width, parent.height) / width
675 indicators: panel.indicators
680 target: SessionBroadcast
681 onShowHome: showHome()
Q_SCRIPTABLE void Logout()