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
122 objectName:
"backgroundImage"
125 source: shell.background
126 fillMode: Image.PreserveAspectCrop
132 opacity: dash.disappearingAnimationProgress
137 source: shell.width > shell.height ?
"Dash/graphics/paper_landscape.png" :
"Dash/graphics/paper_portrait.png"
138 fillMode: Image.PreserveAspectCrop
139 horizontalAlignment: Image.AlignRight
140 verticalAlignment: Image.AlignTop
147 available: !greeter.shown && !lockscreen.shown
148 hides: [stages, launcher, panel.indicators]
149 shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
150 enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
154 topMargin: panel.panelHeight
157 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
158 opacity: 1.0 - disappearingAnimationProgress
159 property real disappearingAnimationProgress: {
160 if (stages.overlayMode) {
163 return stages.showProgress
168 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
175 direction: Direction.Leftwards
177 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
178 width: shell.edgeSize
180 property real progress: stages.width
183 if (status == DirectionalDragArea.Recognized) {
184 if (ApplicationManager.count == 0) {
185 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
187 progress = stages.width - stagesDragHandle.width + touchX
194 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
197 stagesDragHandle.progress = stages.width;
206 height: parent.height
210 if (overlayMode || locked) {
213 return launcher.progress
215 return stagesDragHandle.progress
219 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
221 property bool shown:
false
223 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
225 property bool fullyShown: x == 0
226 property bool fullyHidden: x == width
228 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting :
false
229 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen :
false
230 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode :
false
231 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth :
false
232 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked :
false
234 function show(focusApp) {
236 panel.indicators.hide();
239 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
240 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
246 if (ApplicationManager.focusedApplicationId) {
247 ApplicationManager.unfocusCurrentApplication();
252 target: ApplicationManager
258 onFocusedApplicationIdChanged: {
259 if (ApplicationManager.focusedApplicationId.length > 0) {
262 if (!stages.overlayMode) {
268 onApplicationAdded: {
272 onApplicationRemoved: {
273 if (ApplicationManager.focusedApplicationId.length == 0) {
280 id: applicationsDisplayLoader
283 source: shell.sideStageEnabled ?
"Stages/StageWithSideStage.qml" :
"Stages/PhoneStage.qml"
286 target: applicationsDisplayLoader.item
288 value: !stages.fullyShown
291 target: applicationsDisplayLoader.item
296 target: applicationsDisplayLoader.item
297 property:
"dragAreaWidth"
298 value: shell.edgeSize
305 objectName:
"lockscreen"
307 readonly
property int backgroundTopMargin: -panel.panelHeight
309 hides: [launcher, panel.indicators]
312 showAnimation: StandardAnimation {
property:
"opacity"; to: 1 }
313 hideAnimation: StandardAnimation {
property:
"opacity"; to: 0 }
315 x: required ? 0 : - width
317 height: parent.height - panel.panelHeight
318 background: shell.background
321 onEntered: LightDM.Greeter.respond(passphrase);
322 onCancel: greeter.show()
324 Component.onCompleted: {
325 if (LightDM.Users.count == 1) {
326 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
332 target: LightDM.Greeter
335 if (LightDM.Users.count == 1) {
338 lockscreen.alphaNumeric =
false
340 lockscreen.alphaNumeric =
true
342 lockscreen.placeholderText = i18n.tr(
"Please enter %1").arg(text);
347 onAuthenticationComplete: {
348 if (LightDM.Greeter.promptless) {
351 if (LightDM.Greeter.authenticated) {
354 lockscreen.clear(
true);
362 opacity: greeterWrapper.showProgress * 0.8
371 height: parent.height - panel.panelHeight
373 Behavior on x {SmoothedAnimation{velocity: 600}}
375 readonly
property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
379 objectName:
"greeter"
382 hides: [launcher, panel.indicators]
385 defaultBackground: shell.background
388 height: parent.height
390 dragHandleWidth: shell.edgeSize
397 if (LightDM.Users.count == 1) {
398 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
400 greeter.forceActiveFocus();
404 onUnlocked: greeter.hide()
407 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
408 AccountsService.user = user;
409 LauncherModel.setUser(user);
412 onTease: launcher.tease()
415 target: ApplicationManager
416 property:
"suspended"
417 value: greeter.shown && greeterWrapper.showProgress == 1
424 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
425 || panel.indicators.shown
432 onDisplayPowerStateChange: {
435 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
440 if (status == Powerd.Off) {
441 edgeDemo.paused =
true;
442 }
else if (status == Powerd.On) {
443 edgeDemo.paused =
false;
448 function showHome() {
449 var animate = !greeter.shown && !stages.shown
451 dash.setCurrentScope(
"clickscope", animate,
false)
455 function hideIndicatorMenu(delay) {
456 panel.hideIndicatorMenu(delay);
467 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
470 available: edgeDemo.panelEnabled
471 contentEnabled: edgeDemo.panelContentEnabled
473 property string focusedAppId: ApplicationManager.focusedApplicationId
474 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
475 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
476 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
484 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
490 blockInput: launcher.shown
493 bottom: parent.bottom
496 width: launcher.width
502 readonly
property bool dashSwipe: progress > 0
504 anchors.top: parent.top
505 anchors.bottom: parent.bottom
507 dragAreaWidth: shell.edgeSize
508 available: edgeDemo.launcherEnabled
511 if (edgeDemo.running)
517 if (stages.shown && !stages.overlayMode) {
518 if (!stages.locked) {
528 onDashSwipeChanged:
if (dashSwipe && stages.shown) dash.setCurrentScope(
"clickscope",
false,
true)
529 onLauncherApplicationSelected: {
530 if (!edgeDemo.running)
531 shell.activateApplication(appId)
535 panel.indicators.hide()
541 id: modalNotificationBackground
543 visible: notifications.useModal && !greeter.shown && (notifications.state ==
"narrow")
554 blockInput: modalNotificationBackground.visible
561 model: NotificationBackend.Model
567 bottom: parent.bottom
568 topMargin: panel.panelHeight
573 when: overlay.width <= units.gu(60)
574 AnchorChanges { target: notifications; anchors.left: parent.left }
578 when: overlay.width > units.gu(60)
579 AnchorChanges { target: notifications; anchors.left: undefined }
580 PropertyChanges { target: notifications; width: units.gu(38) }
585 anchors { left: parent.left; right: parent.right }
586 height: parent.contentHeight
587 blockInput: height > 0
593 onFocusChanged:
if (!focus) forceActiveFocus();
598 bottom: parent.bottom
601 width: shell.edgeSize
608 bottom: parent.bottom
611 width: shell.edgeSize
622 anchors.topMargin: panel.panelHeight
628 anchors.bottom: parent.bottom
629 anchors.left: parent.left
630 anchors.right: parent.right
631 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
633 enabled: ApplicationManager.keyboardVisible
637 anchors.centerIn: parent
638 visible: ApplicationManager.fake ? ApplicationManager.fake :
false
639 text:
"EARLY ALPHA\nNOT READY FOR USE"
642 font.weight: Font.Black
643 horizontalAlignment: Text.AlignHCenter
644 verticalAlignment: Text.AlignVCenter
645 fontSizeMode: Text.Fit
647 scale: Math.min(parent.width, parent.height) / width
655 indicators: panel.indicators
660 target: SessionBroadcast
661 onShowHome: showHome()