Merge lp:~nikwen/ubuntu-system-settings/update-label-center-fix into lp:ubuntu-system-settings

Proposed by Niklas Wenzel
Status: Rejected
Rejected by: Sebastien Bacher
Proposed branch: lp:~nikwen/ubuntu-system-settings/update-label-center-fix
Merge into: lp:ubuntu-system-settings
Diff against target: 44 lines (+15/-2)
1 file modified
plugins/system-update/PageComponent.qml (+15/-2)
To merge this branch: bzr merge lp:~nikwen/ubuntu-system-settings/update-label-center-fix
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Needs Fixing
Review via email: mp+252177@code.launchpad.net

Commit message

Center the "No updates" label properly. Fixes LP: #1429280

Description of the change

Attempt to center the "No updates" label properly. See LP: #1429280.

I haven't tested it yet (didn't compile on Utopic), but I hope that it will work.
If not, we can try to center it in the Flickable directly.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, could you explain the logic behind the change/what do you think is buggy at the moment? The change doesn't seem to address the issue...

review: Needs Information
Revision history for this message
Sebastien Bacher (seb128) wrote :

in fact it seems that the issue is that the flickable anchors.top target the top of the screen and not the bottom of the title/header...

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Have you actually given this a try yet? I've had this fix the issue for some other apps I worked on so I hoped it might work here as well. If not, I'll adjust it.

(I wasn't able to compile it on Utopic so I can't test myself.)

Revision history for this message
Sebastien Bacher (seb128) wrote :

Yes, I tried it, and no need to compile it's a change to a plugin qml, you can edit it in place on the disk...

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ok, thanks. If it's that easy I will try to fix it properly tomorrow.
I'll have an exam tomorrow, so I don't have time to do it right now. ;)

Revision history for this message
Sebastien Bacher (seb128) wrote :

No hurry, thanks for working on the issue and good luck for tomorrow! ;-)

1346. By Niklas Wenzel

Revert last changes

1347. By Niklas Wenzel

Another approach

1348. By Niklas Wenzel

Fix flickable value

1349. By Niklas Wenzel

Fix app header height calculation

Revision history for this message
Niklas Wenzel (nikwen) wrote :

I haven't tried this yet but I used the same approach in my Forum Browser app and it worked fine there.
Since I still haven't got my chroot set up properly, would you mind giving this a try again? Thank you in advance. :)

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, you don't need a chroot to test the qml change, there is no compilation needed, you can directly edit on the device

the issue has to do with the flickable, using "flickable: none" makes it properly center

Not sure I like adding a workaround though, we should understand the issue/real problem with the toolkit and fix it properly if we can

review: Needs Fixing
Revision history for this message
Sebastien Bacher (seb128) wrote :

one way that seems to fix it is using that anchoring for the "notification" object

" top: flickable.top
            topMargin: flickable.topMargin
..."

Revision history for this message
Sebastien Bacher (seb128) wrote :

I've also opened bug #1445016 on the uitk, ideally they would give us access to the header to anchor to its bottom for cases like that are not automatically handled

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thank you for your replies, Sebastian.

The reason why I didn't test the code was that afaik I'd have to make my image writable for that, which I'd prefer not to do at the moment.
Your fix looks much nicer than the one I found. It's simply much less of a change. Looks like I'll use that one in my Forum Browser app as well. Thanks!

If you submit a MP with your change, I'll happily approve it after testing.

Btw, I commented on the bug you opened. ;)

Revision history for this message
Sebastien Bacher (seb128) wrote :

changing to "work in progress", that's not ready to land and doesn't need to be on the reviews list

Revision history for this message
Niklas Wenzel (nikwen) wrote :

In my opinion we can also close this as the workaround I provided was rejected. The one fixing this will probably open a new MP anyway.

Unmerged revisions

1349. By Niklas Wenzel

Fix app header height calculation

1348. By Niklas Wenzel

Fix flickable value

1347. By Niklas Wenzel

Another approach

1346. By Niklas Wenzel

Revert last changes

1345. By Niklas Wenzel

Attempt to center Label properly

1344. By Launchpad Translations on behalf of system-settings-touch

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/system-update/PageComponent.qml'
2--- plugins/system-update/PageComponent.qml 2015-03-16 13:51:36 +0000
3+++ plugins/system-update/PageComponent.qml 2015-04-10 20:10:45 +0000
4@@ -35,7 +35,7 @@
5 objectName: "systemUpdatesPage"
6
7 title: installingImageUpdate.visible ? "" : i18n.tr("Updates")
8- flickable: installingImageUpdate.visible ? null : scrollWidget
9+ flickable: (installingImageUpdate.visible || appHeaderHeight === 0) ? null : scrollWidget
10
11 property bool installAll: false
12 property bool includeSystemUpdate: false
13@@ -47,6 +47,9 @@
14 property var notificationAction;
15 property string errorDialogText: ""
16
17+ //Needed for workaround to truly center the "No updates available" label in the free area, excluding the area covered by the header (see the updateNotification definition below)
18+ property real appHeaderHeight: 0
19+
20 onUpdatesAvailableChanged: {
21 if (updatesAvailable < 1 && root.state != "SEARCHING")
22 root.state = "NOUPDATES";
23@@ -690,11 +693,21 @@
24 color: "transparent"
25
26 Label {
27- anchors.centerIn: updateNotification
28 text: updateNotification.text
29 width: updateNotification.width
30 horizontalAlignment: Text.AlignHCenter
31 wrapMode: Text.Wrap
32+
33+ //Workaround to truly center the label in the free area, excluding the area covered by the header
34+
35+ anchors {
36+ centerIn: updateNotification
37+ verticalCenterOffset: appHeaderHeight / 2
38+ }
39+
40+ Component.onCompleted: { //Determines header height (needed for offset), which automatically sets the flickable above
41+ appHeaderHeight = main.height - root.height //main is the MainView
42+ }
43 }
44 }
45

Subscribers

People subscribed via source and target branches