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
39 property bool tablet:
false
40 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
41 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
43 property real edgeSize: units.gu(2)
44 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ?
"graphics/tablet_background.jpg" :
"graphics/phone_background.jpg")
45 property url background
46 readonly property real panelHeight: panel.panelHeight
48 property
bool dashShown: dash.shown
50 property
bool sideStageEnabled: shell.width >= units.gu(100)
51 readonly
property string focusedApplicationId: ApplicationManager.focusedApplicationId
53 function activateApplication(appId) {
54 if (ApplicationManager.findApplication(appId)) {
55 ApplicationManager.requestFocusApplication(appId);
57 if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
58 applicationsDisplayLoader.item.select(appId);
61 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
62 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
90 Keys.onVolumeUpPressed: volumeControl.volumeUp()
91 Keys.onVolumeDownPressed: volumeControl.volumeDown()
96 anchors.rightMargin: stages.overlayWidth
97 clip: stages.overlayMode && !stages.painting
101 blockInput: parent.clip
106 objectName:
"underlay"
108 anchors.rightMargin: -parent.anchors.rightMargin
111 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
114 readonly
property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
118 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
123 opacity: dash.disappearingAnimationProgress
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
138 available: !greeter.shown && !lockscreen.shown
139 hides: [stages, launcher, panel.indicators]
140 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
141 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
145 topMargin: panel.panelHeight
148 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
149 opacity: 1.0 - disappearingAnimationProgress
150 property real disappearingAnimationProgress: {
151 if (stages.overlayMode) {
154 return stages.showProgress
159 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
166 direction: Direction.Leftwards
168 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
169 width: shell.edgeSize
171 property real progress: stages.width
174 if (status == DirectionalDragArea.Recognized) {
175 if (ApplicationManager.count == 0) {
176 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
178 progress = stages.width - stagesDragHandle.width + touchX
185 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
188 stagesDragHandle.progress = stages.width;
197 height: parent.height
201 if (overlayMode || locked) {
204 return launcher.progress
206 return stagesDragHandle.progress
210 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
212 property bool shown:
false
214 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
216 property bool fullyShown: x == 0
217 property bool fullyHidden: x == width
219 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting :
false
220 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen :
false
221 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode :
false
222 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth :
false
223 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked :
false
225 function show(focusApp) {
227 panel.indicators.hide();
230 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
231 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
237 if (ApplicationManager.focusedApplicationId) {
238 ApplicationManager.unfocusCurrentApplication();
243 target: ApplicationManager
249 onFocusedApplicationIdChanged: {
250 if (ApplicationManager.focusedApplicationId.length > 0) {
253 if (!stages.overlayMode) {
259 onApplicationAdded: {
263 onApplicationRemoved: {
264 if (ApplicationManager.focusedApplicationId.length == 0) {
271 id: applicationsDisplayLoader
274 source: shell.sideStageEnabled ?
"Stages/StageWithSideStage.qml" :
"Stages/PhoneStage.qml"
277 target: applicationsDisplayLoader.item
279 value: !stages.fullyShown
282 target: applicationsDisplayLoader.item
287 target: applicationsDisplayLoader.item
288 property:
"dragAreaWidth"
289 value: shell.edgeSize
296 objectName:
"lockscreen"
298 readonly
property int backgroundTopMargin: -panel.panelHeight
300 hides: [launcher, panel.indicators]
303 showAnimation: StandardAnimation {
property:
"opacity"; to: 1 }
304 hideAnimation: StandardAnimation {
property:
"opacity"; to: 0 }
306 x: required ? 0 : - width
308 height: parent.height - panel.panelHeight
309 background: shell.background
313 onEntered: LightDM.Greeter.respond(passphrase);
314 onCancel: greeter.show()
316 Component.onCompleted: {
317 if (LightDM.Users.count == 1) {
318 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
324 target: LightDM.Greeter
327 if (LightDM.Users.count == 1) {
330 lockscreen.alphaNumeric =
false
332 lockscreen.alphaNumeric =
true
334 lockscreen.placeholderText = i18n.tr(
"Please enter %1").arg(text);
339 onAuthenticationComplete: {
340 if (LightDM.Greeter.promptless) {
343 if (LightDM.Greeter.authenticated) {
346 lockscreen.clear(
true);
354 opacity: greeterWrapper.showProgress * 0.8
363 height: parent.height - panel.panelHeight
366 enabled: !launcher.dashSwipe
370 readonly
property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
374 objectName:
"greeter"
377 hides: [launcher, panel.indicators]
380 defaultBackground: shell.background
383 height: parent.height
385 dragHandleWidth: shell.edgeSize
392 if (LightDM.Users.count == 1) {
393 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
395 greeter.forceActiveFocus();
399 onUnlocked: greeter.hide()
402 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
403 AccountsService.user = user;
404 LauncherModel.setUser(user);
407 onTease: launcher.tease()
410 target: ApplicationManager
411 property:
"suspended"
412 value: greeter.shown && greeterWrapper.showProgress == 1
419 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
420 || panel.indicators.shown
427 onDisplayPowerStateChange: {
430 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
435 if (status == Powerd.Off) {
436 edgeDemo.paused =
true;
437 }
else if (status == Powerd.On) {
438 edgeDemo.paused =
false;
443 function showHome() {
444 var animate = !greeter.shown && !stages.shown
446 dash.setCurrentScope(
"clickscope", animate,
false)
450 function hideIndicatorMenu(delay) {
451 panel.hideIndicatorMenu(delay);
462 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
465 available: edgeDemo.panelEnabled
466 contentEnabled: edgeDemo.panelContentEnabled
468 property string focusedAppId: ApplicationManager.focusedApplicationId
469 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
470 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
471 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
479 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
485 blockInput: launcher.shown
488 bottom: parent.bottom
491 width: launcher.width
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.shown && !stages.overlayMode) {
513 if (!stages.locked) {
523 onDashSwipeChanged:
if (dashSwipe && stages.shown) dash.setCurrentScope(
"clickscope",
false,
true)
524 onLauncherApplicationSelected: {
525 if (!edgeDemo.running)
526 shell.activateApplication(appId)
530 panel.indicators.hide()
536 id: modalNotificationBackground
538 visible: notifications.useModal && !greeter.shown && (notifications.state ==
"narrow")
549 blockInput: modalNotificationBackground.visible
556 model: NotificationBackend.Model
562 bottom: parent.bottom
563 topMargin: panel.panelHeight
568 when: overlay.width <= units.gu(60)
569 AnchorChanges { target: notifications; anchors.left: parent.left }
573 when: overlay.width > units.gu(60)
574 AnchorChanges { target: notifications; anchors.left: undefined }
575 PropertyChanges { target: notifications; width: units.gu(38) }
580 anchors { left: parent.left; right: parent.right }
581 height: parent.contentHeight
582 blockInput: height > 0
588 onFocusChanged:
if (!focus) forceActiveFocus();
593 bottom: parent.bottom
596 width: shell.edgeSize
603 bottom: parent.bottom
606 width: shell.edgeSize
617 anchors.topMargin: panel.panelHeight
623 anchors.bottom: parent.bottom
624 anchors.left: parent.left
625 anchors.right: parent.right
626 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
628 enabled: ApplicationManager.keyboardVisible
632 anchors.centerIn: parent
633 visible: ApplicationManager.fake ? ApplicationManager.fake :
false
634 text:
"EARLY ALPHA\nNOT READY FOR USE"
637 font.weight: Font.Black
638 horizontalAlignment: Text.AlignHCenter
639 verticalAlignment: Text.AlignVCenter
640 fontSizeMode: Text.Fit
642 scale: Math.min(parent.width, parent.height) / width
650 indicators: panel.indicators
655 target: SessionBroadcast
656 onShowHome: showHome()