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
34 import "Notifications"
35 import Unity.Notifications 1.0 as NotificationBackend
41 property bool tablet:
false
42 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
43 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
45 property real edgeSize: units.gu(2)
46 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ?
"graphics/tablet_background.jpg" :
"graphics/phone_background.jpg")
47 property url background
48 readonly property real panelHeight: panel.panelHeight
50 property
bool dashShown: dash.shown
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 if (stages.locked && ApplicationManager.focusedApplicationId == appId) {
60 applicationsDisplayLoader.item.select(appId);
63 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
64 ApplicationManager.startApplication(appId, execFlags);
71 property:
"applicationManager"
72 value: ApplicationManager
75 Component.onCompleted: {
76 Theme.name =
"Ubuntu.Components.Themes.SuruGradient"
80 id: backgroundSettings
81 schema.id:
"org.gnome.desktop.background"
83 property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
84 onGSettingsPictureChanged: {
85 shell.background = gSettingsPicture
92 Keys.onVolumeUpPressed: volumeControl.volumeUp()
93 Keys.onVolumeDownPressed: volumeControl.volumeDown()
98 anchors.rightMargin: stages.overlayWidth
99 clip: stages.overlayMode && !stages.painting
103 blockInput: parent.clip
108 objectName:
"underlay"
110 anchors.rightMargin: -parent.anchors.rightMargin
113 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
116 readonly
property bool applicationSurfaceShouldBeSeen: stages.shown && !stages.painting && !stages.overlayMode
120 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
124 objectName:
"backgroundImage"
127 source: shell.background
128 fillMode: Image.PreserveAspectCrop
134 opacity: dash.disappearingAnimationProgress
139 source: shell.width > shell.height ?
"Dash/graphics/paper_landscape.png" :
"Dash/graphics/paper_portrait.png"
140 fillMode: Image.PreserveAspectCrop
141 horizontalAlignment: Image.AlignRight
142 verticalAlignment: Image.AlignTop
149 available: !greeter.shown && !lockscreen.shown
150 hides: [stages, launcher, panel.indicators]
151 shown: disappearingAnimationProgress !== 1.0
152 enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
156 topMargin: panel.panelHeight
159 contentScale: 1.0 - 0.2 * disappearingAnimationProgress
160 opacity: 1.0 - disappearingAnimationProgress
161 property real disappearingAnimationProgress: {
163 return greeter.showProgress;
165 if (stages.overlayMode) {
168 return stages.showProgress
174 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
181 direction: Direction.Leftwards
183 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
184 width: shell.edgeSize
186 property real progress: stages.width
189 if (status == DirectionalDragArea.Recognized) {
190 if (ApplicationManager.count == 0) {
191 progress = Math.max(stages.width - stagesDragHandle.width + touchX, stages.width * .3)
193 progress = stages.width - stagesDragHandle.width + touchX
200 if (ApplicationManager.count > 0 && progress < stages.width - units.gu(10)) {
203 stagesDragHandle.progress = stages.width;
212 height: parent.height
216 if (overlayMode || locked) {
219 return launcher.progress
221 return stagesDragHandle.progress
225 Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
227 property bool shown:
false
229 property real showProgress: overlayMode ? 0 : MathUtils.clamp(1 - x / shell.width, 0, 1)
231 property bool fullyShown: x == 0
232 property bool fullyHidden: x == width
234 property bool painting: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.painting :
false
235 property bool fullscreen: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.fullscreen :
false
236 property bool overlayMode: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayMode :
false
237 property int overlayWidth: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.overlayWidth :
false
238 property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked :
false
240 function show(focusApp) {
242 panel.indicators.hide();
245 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
246 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
252 if (ApplicationManager.focusedApplicationId) {
253 ApplicationManager.unfocusCurrentApplication();
258 target: ApplicationManager
264 onFocusedApplicationIdChanged: {
265 if (ApplicationManager.focusedApplicationId.length > 0) {
268 if (!stages.overlayMode) {
274 onApplicationAdded: {
278 onApplicationRemoved: {
279 if (ApplicationManager.focusedApplicationId.length == 0) {
286 id: applicationsDisplayLoader
289 source: shell.sideStageEnabled ?
"Stages/StageWithSideStage.qml" :
"Stages/PhoneStage.qml"
292 target: applicationsDisplayLoader.item
294 value: !stages.fullyShown
297 target: applicationsDisplayLoader.item
302 target: applicationsDisplayLoader.item
303 property:
"dragAreaWidth"
304 value: shell.edgeSize
311 objectName:
"lockscreen"
313 readonly
property int backgroundTopMargin: -panel.panelHeight
315 hides: [launcher, panel.indicators, hud]
318 showAnimation: StandardAnimation {
property:
"opacity"; to: 1 }
319 hideAnimation: StandardAnimation {
property:
"opacity"; to: 0 }
321 x: required ? 0 : - width
323 height: parent.height - panel.panelHeight
324 background: shell.background
327 onEntered: LightDM.Greeter.respond(passphrase);
328 onCancel: greeter.show()
330 Component.onCompleted: {
331 if (LightDM.Users.count == 1) {
332 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
338 target: LightDM.Greeter
341 if (LightDM.Users.count == 1) {
344 lockscreen.alphaNumeric =
false
346 lockscreen.alphaNumeric =
true
348 lockscreen.placeholderText = i18n.tr(
"Please enter %1").arg(text);
353 onAuthenticationComplete: {
354 if (LightDM.Greeter.promptless) {
357 if (LightDM.Greeter.authenticated) {
360 lockscreen.clear(
true);
367 objectName:
"greeter"
370 hides: [launcher, panel.indicators, hud]
373 defaultBackground: shell.background
377 height: parent.height - panel.panelHeight
379 dragHandleWidth: shell.edgeSize
386 if (LightDM.Users.count == 1) {
387 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
389 greeter.forceActiveFocus();
393 onUnlocked: greeter.hide()
396 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
397 AccountsService.user = user;
398 LauncherModel.setUser(user);
401 onLeftTeaserPressedChanged: {
402 if (leftTeaserPressed) {
408 target: ApplicationManager
409 property:
"suspended"
410 value: greeter.shown && greeter.showProgress == 1
416 blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
417 || panel.indicators.shown || hud.shown
424 onDisplayPowerStateChange: {
427 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
432 if (status == Powerd.Off) {
433 edgeDemo.paused =
true;
434 }
else if (status == Powerd.On) {
435 edgeDemo.paused =
false;
440 function showHome() {
441 var animate = !greeter.shown && !stages.shown
443 dash.setCurrentScope(
"clickscope", animate,
false)
447 function hideIndicatorMenu(delay) {
448 panel.hideIndicatorMenu(delay);
459 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
462 available: edgeDemo.panelEnabled
463 contentEnabled: edgeDemo.panelContentEnabled
465 property string focusedAppId: ApplicationManager.focusedApplicationId
466 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
467 fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
468 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
476 height: (panel.fullscreenMode) ? shell.edgeSize : panel.panelHeight
484 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
485 height: parent.height
487 available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
489 showAnimation: StandardAnimation {
property:
"y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
490 hideAnimation: StandardAnimation {
property:
"y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
493 target: ApplicationManager
494 onFocusedApplicationIdChanged: hud.hide()
503 anchors.left: hud.left
504 height: parent.height
505 target: hud.revealerTarget
508 direction: Qt.RightToLeft
509 orientation: Qt.Vertical
510 handleSize: hud.handleHeight
511 onCloseClicked: target.hide()
518 enabled: hud.available
519 applicationIsOnForeground: ApplicationManager.focusedApplicationId
523 blockInput: launcher.shown
526 bottom: parent.bottom
529 width: launcher.width
535 readonly
property bool dashSwipe: progress > 0
537 anchors.top: parent.top
538 anchors.bottom: parent.bottom
540 dragAreaWidth: shell.edgeSize
541 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
544 if (edgeDemo.running)
550 if (stages.shown && !stages.overlayMode) {
551 if (!stages.locked) {
557 onDashSwipeChanged:
if (dashSwipe && stages.shown) dash.setCurrentScope(
"clickscope",
false,
true)
558 onLauncherApplicationSelected: {
559 if (!edgeDemo.running)
560 shell.activateApplication(appId)
564 panel.indicators.hide()
574 model: NotificationBackend.Model
580 bottom: parent.bottom
581 topMargin: panel.panelHeight
586 when: overlay.width <= units.gu(60)
587 AnchorChanges { target: notifications; anchors.left: parent.left }
591 when: overlay.width > units.gu(60)
592 AnchorChanges { target: notifications; anchors.left: undefined }
593 PropertyChanges { target: notifications; width: units.gu(38) }
598 anchors { left: parent.left; right: parent.right }
599 height: parent.contentHeight
600 blockInput: height > 0
606 onFocusChanged:
if (!focus) forceActiveFocus();
611 bottom: parent.bottom
614 width: shell.edgeSize
621 bottom: parent.bottom
624 width: shell.edgeSize
635 anchors.topMargin: panel.panelHeight
641 anchors.bottom: parent.bottom
642 anchors.left: parent.left
643 anchors.right: parent.right
644 height: ApplicationManager.keyboardVisible ? ApplicationManager.keyboardHeight : 0
646 enabled: ApplicationManager.keyboardVisible
650 anchors.centerIn: parent
651 visible: ApplicationManager.fake ? ApplicationManager.fake :
false
652 text:
"EARLY ALPHA\nNOT READY FOR USE"
655 font.weight: Font.Black
656 horizontalAlignment: Text.AlignHCenter
657 verticalAlignment: Text.AlignVCenter
658 fontSizeMode: Text.Fit
660 scale: Math.min(parent.width, parent.height) / width
668 indicators: panel.indicators
673 target: SessionBroadcast
674 onShowHome: showHome()