Nux

Merge lp://qastaging/~haggai-eran/nux/rtl-rebased into lp://qastaging/nux

Proposed by Didier Roche-Tolomelli
Status: Needs review
Proposed branch: lp://qastaging/~haggai-eran/nux/rtl-rebased
Merge into: lp://qastaging/nux
Diff against target: 701 lines (+229/-89) (has conflicts)
7 files modified
Nux/Area.cpp (+11/-0)
Nux/Area.h (+16/-0)
Nux/HLayout.cpp (+152/-89)
Nux/Layout.cpp (+16/-0)
Nux/Layout.h (+3/-0)
Nux/Nux.cpp (+28/-0)
Nux/Nux.h (+3/-0)
Text conflict in Nux/HLayout.cpp
Text conflict in Nux/Nux.cpp
To merge this branch: bzr merge lp://qastaging/~haggai-eran/nux/rtl-rebased
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Francis Ginther Abstain
Jay Taoko Pending
Review via email: mp+103814@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2011-11-14.

Description of the change

Hi,

Here's my branch rebased against trunk. I hope the changes are more clear now.

There's still a problem with this patch to HLayout, though. When in right-to-left state, it packs child elements to the layout starting from the last on the list, instead of starting from the first, in order to get them in reverse order. However, it seems that for some of the widgets this doesn't work very well. I checked the CheckBox example, and the AbstractCheckedButton::ComputeContentSize code depends on the fact that the HLayout will first allocate space to the checkbox, and afterwards to the label. When using a right-to-left direction, the label is laid out first, and then the checkbox is positioned out of the widget's bounds.

Should I change my patch to pack the children in their logical order, starting from the rightmost edge, or should I leave the code as it is, and try to fix uses like the AbstractCheckedButton?

Regards,
Haggai

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote : Posted in a previous version of this proposal

Haggai

Selecting right to left has to be done per layout. Lets say you have an horizontal layout that has a checkbox followed by a button, and the button is followed by a combobox. In LTR order you get this:
 checkbox | button | combobox

If you make the HLayout to be RTL then the content will look like this:

 combobox| button | checkbox

This should work out fine because only a specific HLayout has been been changed to RTL.

So you have to select only the layouts of the interface that need to be inverted. Rather than having SetDefaultDirection in Nux.cpp, it should be a function member of LinearLayout. Then for each layout (HLayout or VLayout), you will be able to decide if it goes from LTR or RTL. Individual views like the Checkbox, will remain un-affected.

How about that?

Revision history for this message
Haggai Eran (haggai-eran) wrote : Posted in a previous version of this proposal

Jay,

I agree that we should be able to set directionality on per-layout basis. I even implemented it as a member of Area. However, I think that the default when using an RTL locale should be right to left, for all widgets, and not just specific HLayouts.

In the example you described, you could show the detailed widgets like this (in LTR):

[ combobox ↓ | button | [x] checkbox ]

Then, I expect the RTL rendering to be like this:

[ checkbox [x] | button | ↓ combobox ]

The internal layout of comboboxes and checkboxes should also be mirrored.

Please compare how GTK looks in LTR and RTL in the following two screenshots of the widget factory:
http://i44.tinypic.com/2lks0e8.jpg
http://i43.tinypic.com/25ri0ds.png

Haggai

Revision history for this message
Jay Taoko (jaytaoko) wrote : Posted in a previous version of this proposal

Ok, I see how it is. I think many widget will have to have support for a RTL design.
But first we can get this branch in since it has global support for RTL at the layout level. Then the next step would be to go to each individual widgets that requires it and review the design.

It is up to me now to review and adapt this branch and see that we can merge it. We now have the requirement of proposing tests along side major features. Can you think of some way we can test the features of this branch?

Revision history for this message
Haggai Eran (haggai-eran) wrote : Posted in a previous version of this proposal

Hi,

I think that perhaps rewriting the code to pack in the same order as in LTR might still have some advantages. I've tried to think on how that would work. Instead of walking the list of HLayout children in reverse, and packing them to the left, I'll walk the list in the usual order, and pack from right to left.

As far as I can see, I would only need to change HLayout::ComputeContentSize, and HLayout::ComputeContentPosition, which would make the changes simpler. I'm sure in both cases other widget will need to be modified, but if any widget's layout depends on the order of children's placement, then that order wouldn't change.

Regarding tests, I suppose that a tests for HLayout can be modified to test the RTL case as well, but I cannot find such a test (perhaps my tree isn't updated). I imagine a test that creates an HLayout, with several children that are using different settings for scaling, vertical placement, etc. and asserting there placement. What do you think?

Revision history for this message
Francis Ginther (fginther) wrote :

Review was claimed by accident, please ignore.

review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:521
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~haggai-eran/nux/rtl-rebased/+merge/103814/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/nux-ci/17/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/nux-raring-amd64-ci/17/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/nux-raring-armhf-ci/17/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/nux-raring-i386-ci/17/console

Click here to trigger a rebuild:
http://s-jenkins:8080/job/nux-ci/17/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

521. By Haggai Eran

Change LayoutContentDistribution only when in RTL mode.

520. By Haggai Eran

More HLayout changes toward right-to-left support.

519. By Haggai Eran

Add right-to-left mirroring support. Implement mirroring for HLayout.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches