Merge lp:~haggai-eran/unity-2d/rtl-rebased into lp:unity-2d

Proposed by Haggai Eran on 2011-11-14
Status: Work in progress
Proposed branch: lp:~haggai-eran/unity-2d/rtl-rebased
Merge into: lp:unity-2d
Diff against target: 307 lines (+78/-16)
11 files modified
launcher/Launcher.qml (+21/-1)
launcher/LauncherList.qml (+5/-4)
libunity-2d-private/src/edgehitdetector.cpp (+1/-1)
libunity-2d-private/src/focuspath.cpp (+18/-4)
libunity-2d-private/src/launchermenu.cpp (+3/-1)
panel/applets/appname/appnameapplet.cpp (+3/-1)
places/GridViewWithSpacing.qml (+2/-0)
places/LensBar.qml (+1/-1)
places/MultiRangeSelectionBar.qml (+4/-2)
places/RatingStars.qml (+6/-1)
places/dash.qml (+14/-0)
To merge this branch: bzr merge lp:~haggai-eran/unity-2d/rtl-rebased
Reviewer Review Type Date Requested Status
Gerry Boland (community) 2011-11-14 Needs Fixing on 2011-11-17
Review via email: mp+82151@code.launchpad.net

Commit message

Fix several issues with unity-2d under a right-to-left locale.

    - [launcher] Move the edge hit detector one pixel to the right when in RTL locales (LP: #877292)
    - [panel] Change panel window buttons alignment when in RTL locale (LP: #858053)
    - [dash] Fix rating stars alignment when in RTL locale.
    - [dash] Switch left and right keys when in RTL locale (LP: #886686)

Description of the change

Fix several issues with unity-2d under a right-to-left locale.

    - [launcher] Move the edge hit detector one pixel to the right when in RTL locales (LP: #877292)
    - [panel] Change panel window buttons alignment when in RTL locale (LP: #858053)
    - [dash] Fix rating stars alignment when in RTL locale.
    - [dash] Switch left and right keys when in RTL locale (LP: #886686)

To post a comment you must log in.
Gerry Boland (gerboland) wrote :

Hi Haggai,
this looks great, but I found one thing you should fix:

1. In RTL, press Alt+F1, the Launcher appears
2. Press down to select nautilus
3. Press the left arrow key

Expected Result
Context menu appears

Actual Result
Nothing happens. The right arrow key opens the menu. Have a look in launcher/LauncherList.qml, lines 188 & 200.

Gerry Boland (gerboland) wrote :

Another bug:
1. Press F10. File menu gets opened
2. Press right and left

Result: left & right motions are backward.

review: Needs Fixing
Gerry Boland (gerboland) wrote :

Note I'd just like to draw to your attention the following issues not related to this commit:

Launcher
- Pips on Launcher (white triangles indicating app running) are not RTL
- Launcher grey line boundary on wrong side
- Launcher Context menu shape wrong, not a mirror image anyway. Are they too tall?

Dash
- In Filter, the "MultiRange" filter looks bad. The edge images need to be flipped
- In Filter, the "Checkboxes" of the Type area in the Files lens are too close together

Many, many thanks for your excellent work!
-G

lp:~haggai-eran/unity-2d/rtl-rebased updated on 2011-11-17
781. By Lohith D Shivamurthy on 2011-11-17

[launcher] Mouse hover at left edge of panel should not reveal launcher

782. By Olivier Tilloy on 2011-11-17

[dash] Work around a bug in QML that causes a crash when the layout is mirrored (RTL locales).

Haggai Eran (haggai-eran) wrote :

Hi,

I believe I solved the first issue you mention in commit 773. For the second one, I'm not sure, but I think it is the responsibility of unity-panel-service, isn't it?
I have changes I wanted to submit to it for issue #858072, which I also think needs unity-panel-service cooperation, but I'm waiting for my nux patches to be accepted first.

As for the rest of them, I'll try to work on them soon. By the way, how do I test the different filters?

lp:~haggai-eran/unity-2d/rtl-rebased updated on 2011-11-17
783. By Renato Araujo Oliveira Filho on 2011-11-17

[tests] Fix problems with Gtk version during the creation of QApplication for tests.

Haggai Eran (haggai-eran) wrote :

Could you elaborate why you say that launcher pips are not mirrored? They seem mirrored to me, both in their direction, and in their position.

Haggai Eran (haggai-eran) wrote :

Regarding the launcher context menu, I found two differences between the RTL and LTR versions. First, the RTL's arrow isn't centered vertically when the menu is folded, while the LTR version's arrow is centered. Second, in the RTL version, when the menus aren't folded, there is some extra padding to the left and right of the menu items.

I'm not sure what causes these differences, since the RTL CSS file and the images seem to be a simple mirror of the LTR versions.

Gerry Boland (gerboland) wrote :

> Could you elaborate why you say that launcher pips are not mirrored? They seem
> mirrored to me, both in their direction, and in their position.

Because I'm an idiot and should think before I type! Sorry, RTL does confuse my brain a little.

Gerry Boland (gerboland) wrote :

> By the way, how do I test the different filters?

Different lenses have different filters.
- Applications lens has "type" which are effectively radio-buttons (not distinguished from checkboxes in the code), and "ratings"
- Files lens has "last modified" (radio-buttons), "type" (radio) and "size" (multi-range)
- Music lens has "Genres" (checkboxes) and I possibly "Decade" (multi-range)

Haggai Eran (haggai-eran) wrote :

Okay. I believe I've fixed the spacing issue in the radio buttons under Files lens (in commit 775), and the multi-range rendering in commit 776.

There's another problem in the Files lens size filter, though. Perhaps it only affects the Hebrew locale, but the font size is too large, and the different sizes are ellipsized. While testing I reduced the "small" font size so I could read them, but perhaps the best solution would be a larger multi-range widget, or a shorter translation.

Haggai

lp:~haggai-eran/unity-2d/rtl-rebased updated on 2011-11-24
784. By Florian Boucault on 2011-11-18

Centralised configuration management into config.h. All common accesses to DConf go through there.

New APIs available:
 QConf& unity2dConfiguration()
 QConf& launcher2dConfiguration()
 QConf& panel2dConfiguration()
 QConf& unityConfiguration()
 QConf& launcherConfiguration()
 QConf& panelConfiguration()

785. By Florian Boucault on 2011-11-18

[dash] Fixed warning upon connection to updateDashModeDependingOnScreenGeometry which is a SLOT not a SIGNAL.

786. By Florian Boucault on 2011-11-21

[packaging] Bumped release version to 5.2 in debian/changelog

787. By Tiago Salem Herrmann on 2011-11-21

[dash] add selectionColor property to the search field in order to fix issue #880222

788. By Renato Araujo Oliveira Filho on 2011-11-22

[places] Rewrite RenderGrid to use only one Flickable element

* Created FocusPath element to help in the keyboard navigation;
* The code used to manually scroll the grid was removed, now everything is done by the QML Flickable element;
* This new implementation of RenderGrid allows every component be inside of this scroller, which makes the grid more flexible for moving elements around, helping in the implementation of Preview screen;

789. By Renato Araujo Oliveira Filho on 2011-11-23

[tests] Fixed Cmake files to correct works with ctest.

Now you can run the tests from the build directory using:
 - ctest (check ctest --help for more details)
 - make test

790. By Albert Astals Cid on 2011-11-24

[code] Add const & for foreach "iterators"

Avoids a copy of each object. It is true that most of those objects are
implicitly shared so the win isn't huge but we still save some atomic/mutex/something locking

Gerry Boland (gerboland) wrote :

Thanks for the commit Haggai. My apologies that we are slow in reviewing it, we currently have a high-priority task that we're working on, and it is taking up our time.

We will get to it soon. Apologies
-Gerry

lp:~haggai-eran/unity-2d/rtl-rebased updated on 2011-11-24
791. By Lohith D Shivamurthy on 2011-11-24

[launcher] Force the launcher to reposition to the beginning when Dash is summoned with Super key

792. By Gerry Boland on 2011-11-24

Rewrite KeyMonitor XEvent handler to use QSocketNotifier instead of separate thread. This singleton will now be deconstructed properly on application quit. Also free X11 objects when they're unnecessary.

Haggai Eran (haggai-eran) wrote :

Sure, I understand.

Haggai

lp:~haggai-eran/unity-2d/rtl-rebased updated on 2011-12-19
793. By Gerry Boland on 2011-11-28

[tests] Run Unit Tests with Xvfb, disabling those who will not work with this configuration. Fixes: 894381. Reviewed by Tiago Salem Herrmann.

794. By Albert Astals Cid on 2011-11-28

[launcher] Do not resend the visibleChanged(false) if we were already not visible

How does this happen:
  * You start the launcher, you have a maximized window, thus it hides
  * Then you alt+tab to another maximized window, this calls activeWindowChangedCB that calls updateVisibility that decides that has to hide the panel, thus it call hidesPanel again

This has the effect of confusing the unity2dpanel since VisibilityController::updatePanelVisibility will call Unity2dPanel::slideOut when it was already hidden, this confusion results in bug 892004. Fixes: 892004. Reviewed by Didier Roche.

795. By Lohith D Shivamurthy on 2011-11-28

[launcher] Force the launcher to reposition to the beginning when Alt-F1 is hit. Fixes: 885304. Reviewed by Gerry Boland.

796. By Lohith D Shivamurthy on 2011-11-29

Mouse move over top left corner should not reveal the launcher.

Launcher edge detector is screenheight - panel height. . Fixes: 884267. Reviewed by Gerry Boland.

797. By Alberto Mardegan on 2011-11-29

(resubmitting without prerequisite branch)

  [dash, panel] Add window controls to dash window

  Show window controls for closing, minimizing and maximizing the Dash.

One potentially big issue:

Although the Dash window state (maximized/unmaximized) is set in DConf, at the next startup the Dash ignores that settings: this is because the Dash itself determines what window mode is best right after it's started. We need to clarify with the UI designers whether this behaviour is the intended one.. Fixes: 860400. Reviewed by Didier Roche.

798. By Alberto Mardegan on 2011-11-29

[spread] Allow keyboard navigation between workspaces

Turn the Workspace repeater into a GridView, which takes care of giving the
keyboard focus to the proper child element.

Contributed by Alberto Mardegan (mardy). Fixes: 744978. Reviewed by Gerry Boland.

799. By Alberto Mardegan on 2011-11-30

[dash] Better handling of screen geometry

ScreenInfo::availableGeometry() method will return the same as QDesktopWidget::availableGeometry() returns;
A new method ScreenInfo::panelsFreeGeometry() will return the available geometry minus the launcher.

The screenGeometry and availableGeometry properties were removed from the DashDeclarative class, because they were unused (and ScreenInfo provides the same information)

Contributed by Alberto Mardegan (mardy). Fixes: . Reviewed by Gerry Boland.

800. By Michał Sawicz on 2011-11-30

[lib] make LauncherDropItem a FocusScope. Fixes: . Reviewed by Gerry Boland.

801. By Florian Boucault on 2011-11-30

[spread] Synchronize the workspaces layout between the spread and the window manager.
Force a square layout regardless of the number of workspaces requested.

WorkspacesInfo::updateWorkspaceGeometry underwent a major cleanup in order to
implement the above confidently.

_NET_NUMBER_OF_DESKTOPS and _NET_DESKTOP_LAYOUT refer to the root window's X properties.

The code had the following issues:
- if _NET_NUMBER_OF_DESKTOPS is not set and WorkspacesInfo::updateWorkspaceGeometry
  decides to default to 4, the property _NET_NUMBER_OF_DESKTOPS was not set to 4.
- "sanity checks" performed when _NET_DESKTOP_LAYOUT is set but incomplete were
  not smart enough to force a square layout and not always applied.
- the function was simply too long and convoluted to be easily understood.. Fixes: https://bugs.launchpad.net/bugs/715587. Reviewed by Lohith D Shivamurthy.

802. By Tiago Salem Herrmann on 2011-11-30

[lanucher] Fix trash and workspaces truncated highlights.

ListView is not properly calculating its height due to itemPadding variable, introduced to fix a problem with spacing.
The launcher is now considering 66 the real size of its icons instead of 54, so the selectionOutline is taken into account
when calculating its height.. Fixes: https://bugs.launchpad.net/bugs/876589. Reviewed by Gerry Boland.

803. By Albert Astals Cid on 2011-11-30

[launcher] Do not hide the launcher immediately after removing an icon. Fixes: https://bugs.launchpad.net/bugs/884410. Reviewed by Tiago Salem Herrmann.

804. By Ugo Riboni on 2011-12-01

This branch removes the use-struts dconf option and enables struts automatically when the user selects hide-mode 0 (never hide).

Please note that struts don't get enabled or disabled when entering force visible mode, since it's a temporary mode that can't be enabled by the user explicitly. In that mode whatever struts settings was in place before will be maintained.. Fixes: . Reviewed by Gerry Boland.

805. By Florian Boucault on 2011-12-01

[dash] Fixed up and generalised definition and use of literal font sizes ('small', 'medium', etc.)

Created new javascript library fontUtils.js with new fontSizeToPixels(size) function abstracted out from TextCustom.qml
Changed 'large' to be 17px instead of 16px.
Defined 'xx-large' and used it in the search input.
Removed default size case.
Changed TileHorizontal to use 'small' size (13px) instead of nothing (14px).. Fixes: . Reviewed by Michał Sawicz.

806. By Florian Boucault on 2011-12-06

[workspace switcher] Fixing up broken overlaid layout by reverting bzr revision 799.

807. By Didier Roche on 2011-12-07

Build with the new and shiny unity-core 5. UNBLOCK. Fixes: . Appoved by .

808. By Lohith D Shivamurthy on 2011-12-08

[launcher] Showing the Desktop should also reveal the launcher. Fixes: https://bugs.launchpad.net/bugs/898161. Appoved by Gerry Boland, Tiago Salem Herrmann.

809. By Lohith D Shivamurthy on 2011-12-08

[panel] Desktop label changed to 'Ubuntu' Desktop. Fixes: https://bugs.launchpad.net/bugs/869873. Appoved by Gerry Boland.

810. By Tiago Salem Herrmann on 2011-12-08

In a particular scenario unity-2d-places may abort due to a SIGABRT raised by QConf().
If for some reason (probably during a distro upgrade) the schema file isn't properly installed and
unity-2d-places is wrapped, then it simply aborts with the following message:

unity-2d-places: [FATAL] Settings schema 'com.canonical.Unity2d' is not installed

This patch adds a simple check if the schema file is present, and if not, assume the default
value. Other components like launcher and panel won't probably have this same issue since
they keep running in memory, and not launched on-the-fly.. Fixes: https://bugs.launchpad.net/bugs/857575. Appoved by .

811. By Florian Boucault on 2011-12-08

[dash] SearchEntry: elide search hint when needed.. Fixes: . Appoved by .

812. By Florian Boucault on 2011-12-08

[launcher] Fixed giving the focus to the launcher by pressing Alt+F1.

Fixes https://bugs.launchpad.net/unity-2d/+bug/901505. Fixes: . Appoved by Gerry Boland.

813. By Lohith D Shivamurthy on 2011-12-08

[launcher] tooltip positioned to center of the tile properly. Fixes: https://bugs.launchpad.net/bugs/898349. Appoved by .

814. By Florian Boucault on 2011-12-08

[launcher] Clip the GnomeBackground so that it cannot overflow the launcher.. Fixes: . Appoved by .

815. By Florian Boucault on 2011-12-08

[dash] Smoothen arrows when scaled up and down.. Fixes: . Appoved by .

816. By Florian Boucault on 2011-12-08

[dash] Implemented multi line text properly:
- multiline text not fully displayed is now elided
- not displayed lines are not clipped but simply never shown

Fixes bug https://bugs.launchpad.net/unity-2d/+bug/901491. Fixes: https://bugs.launchpad.net/bugs/901491. Appoved by Gerry Boland.

817. By Florian Boucault on 2011-12-08

[spread][dash] Remove unnecessary caching of ScreenInfo that is a singleton.. Fixes: . Appoved by .

818. By Lohith D Shivamurthy on 2011-12-09

[Dash] clicking maximize button should toggle the Dash between maximize and unmaximize state. Fixes: https://bugs.launchpad.net/bugs/860400. Appoved by Tiago Salem Herrmann.

819. By Gerry Boland on 2011-12-09

Bump libunity-core dependency to version 5 for panel (missed by commit 807). Fix 4.0 and 5.0 package conflict in PPA. Fixes: . Appoved by .

820. By Tiago Salem Herrmann on 2011-12-09

When switching between workspaces we need to invalidade the previous active window, as it belongs
to the previous active workspace.. Fixes: https://bugs.launchpad.net/bugs/897640. Appoved by Lohith D Shivamurthy.

821. By Didier Roche on 2011-12-09

Change build-dep as the nux package is now named nux 2.0. Fixes: . Appoved by .

822. By Florian Boucault on 2011-12-12

[dash] Do not unload the current page when exiting it. That does not change
the user experience at all and improves the speed at which the dash opens
up in a number of cases.

Reference: https://bugs.launchpad.net/unity-2d/+bug/881756

The workarounds crashers in the code removed by this change were still valid.. Fixes: . Appoved by Gerry Boland.

823. By Florian Boucault on 2011-12-12

[dash & spread] Do not use a timestamp to make sure the window screenshots are
refreshed but instead make use of the 'cache' property of the Image QML element
recently introduced in Qt Quick 1.1

Removed unused ScreenInfo::currentTime(). Fixes: . Appoved by Gerry Boland.

824. By Michał Sawicz on 2011-12-12

[lib] make Scrollbar abstracted. Fixes: . Appoved by .

825. By Gerry Boland on 2011-12-12

[launcher] Move to Unity-Core5 requires updating the path to shared the icon directory. Fixes Dash icon. Fixes: https://bugs.launchpad.net/bugs/903182. Appoved by .

826. By Florian Boucault on 2011-12-13

[launcher][dash] Resolved some discrepancies in layout with design:
- launcher width
- launcher tiles spacing
- search entry position and size
- filter pane position and width. Fixes: . Appoved by Andrea Cimitan.

827. By Gerry Boland on 2011-12-15

[core] Update compatibility with UnityCore5 API.

Changes
- *SearchFinished signals passing Lens::Hints
- Lens active property changed to a ViewType enum of HIDDEN, HOME_VIEW, LENS_VIEW. Update Dash to use these.. Fixes: . Appoved by Lohith D Shivamurthy, Mikkel Kamstrup Erlandsen.

828. By Daniel Nyström on 2011-12-15

Enable parallel build in debian/rules. Tested with -j13 on 12 virtual cores and it decreased build time significantly.. Fixes: . Appoved by Gerry Boland.

829. By Lohith D Shivamurthy on 2011-12-15

[dash] Centralized Configuration management into config.h. Cleanup dashsettings.cpp. Fixes: . Appoved by Gerry Boland.

830. By Florian Boucault on 2011-12-15

[spread] Windows and background are now limited in size to 512 which saves video
memory when using the OpenGL backend and can improve overall performance.. Fixes: https://bugs.launchpad.net/bugs/808716. Appoved by Gerry Boland.

831. By Gerry Boland on 2011-12-15

[tests] Add Automated User Experience testing using "Testability"

Add support for Testability, a Qt application automated testing framework, with some boilerplate code to allow easy writing of tests using Ruby's Test::Util library. Also added is a Ruby library called XDo which allows control of the X server and fake mouse, keyboard and window management.

A couple of sample tests for the launcher have been written. This required the addition of some objectName definitions to the launcher.. Fixes: https://bugs.launchpad.net/bugs/903495. Appoved by Tiago Salem Herrmann.

832. By Andrea Cimitan on 2011-12-19

Some fixes to dash layout, especially on the filters pane. Fixes: https://bugs.launchpad.net/bugs/906235. Appoved by .

Lohith D Shivamurthy (dyams) wrote :

Haggai, As you might remember, Initially I tested this branch nearly two months ago.
Unfortunately It is not merged yet :(
Very sorry about that. Today when I was reviewing this branch I found three merge conflicts.
(1) Text conflict in launcher/Launcher.qml
(2) Contents conflict in places/CenteredGridView.qml
(3) Text conflict in places/HomeShortcuts.qml
Would it be possible for you to resolve them. Please.
Your effort is very much appreciated and very very sorry about the delay. I promise we won't delay it anymore. :)

lp:~haggai-eran/unity-2d/rtl-rebased updated on 2011-12-20
833. By Albert Astals Cid on 2011-12-20

[launcher] Move the RMB menu from clicked to pressed

Fixes LP bug #813036
. Fixes: https://bugs.launchpad.net/bugs/813036. Appoved by Lohith D Shivamurthy.

Haggai Eran (haggai-eran) wrote :

Hi,

I've rebased my local branch, and solved the text conflicts, but the contents conflict requires me to make changes to the new FocusPath element. For some reason I can't compile the trunk version of unity-2d. Something about missing unity::dash::ViewType when compiling libunity2d-private. I've compiled libunity from trunk, but it doesn't contain this enum. Perhaps you can direct me on how to compile the latest version of unity-2d, and I will be able to resolve all the conflicts, and perhaps fix the right-to-left support with the new FocusPath item as well.

Gerry Boland (gerboland) wrote :

Hi Haggai,
I'll let Lohith instruct you on what you need to do to compile trunk. I want to tell you about why this branch was delayed and what I have in mind.

The high-priority project we've been working is a full User Experience testing suite. The plan is that every MR that fixes bugs and adds features must have tests attached. The changes in this MR are important and very testable, which motivated me to use it as an example case for our automated testing.

More info is available in the tests/README file for now, I've to pad out the documentation.

I plan to write tests for you - you've done enough already - and ask you to merge a branch with my tests into this MR. Then we can approve this MR!

What do you think?
-Gerry

Lohith D Shivamurthy (dyams) wrote :

@Haggai: Thank you very much.
Yes, one of the unity-2d dependencies has changed or rather upgraded to newer version and the that newer version is in staging yet.
Steps you need to follow:
$ sudo rm -f /etc/apt/sources.list.d/unity-2d-team-unity-2d-daily-oneiric.list
$ sudo add-apt-repository ppa:unity-team/staging
$ sudo apt-get update
$ sudo apt-get remove libdee-1.0-1 # IMPORTANT! Remove old libdee. Accept the removal of other packages.
$ sudo apt-get upgrade
$ sudo apt-get install libqtdee-dev libunity-core-5.0-dev libdee-dev libnux-2.0-dev libunity-dev
$ sudo apt-get install nautilus # [optional] Nautilus in PPA is held back, this installs it
Please note that this is in a very alpha stage yet, hence it *might* break your desktop sometimes.

@Gerry: Thank you from my side :)

Haggai Eran (haggai-eran) wrote :

@Gerry: I think adding tests is a great idea, especially since RTL desktops aren't commonly used, and testing could help other developers to be aware of their issues. I'm not quite familiar with automated GUI testing, so I'm glad that you plan to write them yourself this time. In the future I could learn from these tests and add them to other MRs.

@Lohith: Thank you for the detailed instructions. I'll try them soon. I'm not worried of breaking the desktop since I'm developing in a virtual machine.

lp:~haggai-eran/unity-2d/rtl-rebased updated on 2011-12-21
838. By Haggai Eran on 2011-11-17

Switch left and right keys when accessing launcher in RTL locale.

839. By Haggai Eran on 2011-11-18

[launcher] Mirror the launcher in RTL locales (LP: #854587)

840. By Haggai Eran on 2011-11-18

[dash] Fix spacing between elemenets in GridViewWithSpacing, in RTL locale.

841. By Haggai Eran on 2011-11-18

[dash] Mirror the MultiRange filter in RTL locales.

842. By Haggai Eran on 2011-12-21

[dash] Fix right-to-left keyboard navigation with the new FocusPath object.

Haggai Eran (haggai-eran) wrote :

Hi,

I've uploaded a rebased version of the branch, without the conflicts, and added a patch to the FocusPath object for correct RTL keyboard navigation.

There is still an issue with the keyboard navigation that I couldn't solve. When the filter is visible, pressing the left key should move the focus from the search bar to the filter. This is supposed to be done automatically by Qt, mirroring the setting for the right key. However, nothing happens when pressing either the left or the right key in the search bar. Pressing right in the filter works fine though.

Lohith D Shivamurthy (dyams) wrote :

Hey Haggai,
Happy New Year :)

Thank you very much. Your branch is very important for us.
As Gerry said already, He is going to write tests for you.
Let us wait for that hence We can merge your branch soon. Thank you.

Albert Astals Cid (aacid) wrote :

This branch does not cleanly merge to master anymore.

Haggai Eran (haggai-eran) wrote :

Ofcourse. Are the tests Gerry wanted to write ready? I'll gladly rebase the branch, but I rather do so with the tests available.

Gerry Boland (gerboland) wrote :

Hey Haggai,
thank you for your patience.

Right now we have LTR and RTL tests for the launcher autohide/show behaviours and dash position & mouse interactions. We need to write plenty more, but they're building up slowly.

The unity2d code has changed quite a bit, and a few more changes are in store, so this MR needs to be re-assessed.
 - [launcher] Move the edge hit detector one pixel to the right when in RTL locales (LP: #877292)
I suggest you leave this out for now. We will be replacing the edge hit detector with a pointer barrier, so this change is unnecessary.

 - [panel] Change panel window buttons alignment when in RTL locale (LP: #858053)
 - [dash] Fix rating stars alignment when in RTL locale.
These two are more visual changes, and are not suited to an automated test. In these cases, we attach a before & after screenshot, so that design can approve the visual change.

 - [dash] Switch left and right keys when in RTL locale (LP: #886686)
This change is important, but I'm suspicious of your fix. Switching left<->right keys the only way? Is unity-panel-service not able to manage this itself?

What I suggest you do is split this MR up into smaller bits, perhaps one MR per bug. Then at least we can reduce the number of things to do for proper RTL support.
Many thanks
-Gerry

Haggai Eran (haggai-eran) wrote :

Hi,

Thanks for the feedback. I'll split the MR as you requested. I'm not sure I understand how the switching of left and right keys for dash can be done inside unity-panel-service.

Regards,
Haggai

Unmerged revisions

842. By Haggai Eran on 2011-12-21

[dash] Fix right-to-left keyboard navigation with the new FocusPath object.

841. By Haggai Eran on 2011-11-18

[dash] Mirror the MultiRange filter in RTL locales.

840. By Haggai Eran on 2011-11-18

[dash] Fix spacing between elemenets in GridViewWithSpacing, in RTL locale.

839. By Haggai Eran on 2011-11-18

[launcher] Mirror the launcher in RTL locales (LP: #854587)

838. By Haggai Eran on 2011-11-17

Switch left and right keys when accessing launcher in RTL locale.

837. By Haggai Eran on 2011-11-14

[dash] Switch left and right keys when in RTL locale (LP: #886686)

836. By Haggai Eran on 2011-11-14

[dash] Fix rating stars alignment when in RTL locale.

835. By Haggai Eran on 2011-11-14

[panel] Change panel window buttons alignment when in RTL locale (LP: #858053)

834. By Haggai Eran on 2011-11-14

[launcher] Move the edge hit detector one pixel to the right when in RTL locales (LP: #877292)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/Launcher.qml'
2--- launcher/Launcher.qml 2011-12-11 22:26:34 +0000
3+++ launcher/Launcher.qml 2011-12-21 22:46:24 +0000
4@@ -16,7 +16,7 @@
5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8-import QtQuick 1.0
9+import QtQuick 1.1
10 import Unity2d 1.0 /* required for drag’n’drop handling */
11
12 LauncherDropItem {
13@@ -24,6 +24,8 @@
14
15 Accessible.name: "root"
16 focus: true
17+ LayoutMirroring.enabled: isRightToLeft()
18+ LayoutMirroring.childrenInherit: true
19
20 function clamp(x, min, max) {
21 return Math.max(Math.min(x, max), min)
22@@ -47,6 +49,24 @@
23 main.positionViewAtBeginning()
24 }
25
26+ function isRightToLeft() {
27+ return Qt.application.layoutDirection == Qt.RightToLeft
28+ }
29+
30+ function switchLeftRightKeys(key) {
31+ if (isRightToLeft()) {
32+ switch (key) {
33+ case Qt.Key_Right:
34+ return Qt.Key_Left
35+ case Qt.Key_Left:
36+ return Qt.Key_Right
37+ default:
38+ return key
39+ }
40+ }
41+ return key
42+ }
43+
44 Item {
45 anchors.fill: parent
46 clip: true
47
48=== modified file 'launcher/LauncherList.qml'
49--- launcher/LauncherList.qml 2011-12-21 09:52:15 +0000
50+++ launcher/LauncherList.qml 2011-12-21 22:46:24 +0000
51@@ -187,13 +187,14 @@
52 }
53
54 Keys.onPressed: {
55- if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter || event.key == Qt.Key_Space) {
56+ var key = switchLeftRightKeys(event.key)
57+ if (key == Qt.Key_Return || key == Qt.Key_Enter || key == Qt.Key_Space) {
58 item.menu.hide()
59 item.activate()
60 event.accepted = true
61 }
62- else if (event.key == Qt.Key_Right ||
63- (event.key == Qt.Key_F10 && (event.modifiers & Qt.ShiftModifier))) {
64+ else if (key == Qt.Key_Right ||
65+ (key == Qt.Key_F10 && (event.modifiers & Qt.ShiftModifier))) {
66 /* Show the menu first, then unfold it. Doing things in this
67 order is required because at the moment the code path that
68 adjusts the position of the menu in case it goes offscreen
69@@ -204,7 +205,7 @@
70 item.menu.setFocus()
71 event.accepted = true
72 }
73- else if (event.key == Qt.Key_Left) {
74+ else if (key == Qt.Key_Left) {
75 item.menu.hide()
76 event.accepted = true
77 }
78
79=== modified file 'libunity-2d-private/src/edgehitdetector.cpp'
80--- libunity-2d-private/src/edgehitdetector.cpp 2011-11-29 11:46:34 +0000
81+++ libunity-2d-private/src/edgehitdetector.cpp 2011-12-21 22:46:24 +0000
82@@ -58,7 +58,7 @@
83 if (QApplication::isLeftToRight()) {
84 m_mouseArea->setGeometry(rect.left(), rect.top(), 1, rect.height());
85 } else {
86- m_mouseArea->setGeometry(rect.right() - 1, rect.top(), 1, rect.height());
87+ m_mouseArea->setGeometry(rect.right(), rect.top(), 1, rect.height());
88 }
89 }
90
91
92=== modified file 'libunity-2d-private/src/focuspath.cpp'
93--- libunity-2d-private/src/focuspath.cpp 2011-11-21 18:57:43 +0000
94+++ libunity-2d-private/src/focuspath.cpp 2011-12-21 22:46:24 +0000
95@@ -22,6 +22,7 @@
96 #include <QtCore/qmath.h>
97 #include <QEvent>
98 #include <QKeyEvent>
99+#include <QApplication>
100
101 /*!
102 \qmlclass FocusPath
103@@ -297,12 +298,25 @@
104 switch(event->type()) {
105 case QEvent::KeyPress: {
106 int nextFocus = m_currentIndex;
107+ Flow flow = m_flow;
108+ if (QApplication::isRightToLeft()) {
109+ switch (m_flow) {
110+ case FocusPath::LeftToRight:
111+ flow = FocusPath::RightToLeft;
112+ break;
113+ case FocusPath::RightToLeft:
114+ flow = FocusPath::LeftToRight;
115+ break;
116+ default:
117+ break;
118+ }
119+ }
120
121 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
122 switch(keyEvent->key()) {
123 case Qt::Key_Right:
124 if ((m_direction & FocusPath::Horizontal) == FocusPath::Horizontal) {
125- switch(m_flow) {
126+ switch(flow) {
127 case FocusPath::LeftToRight:
128 nextFocus += 1;
129 break;
130@@ -319,7 +333,7 @@
131 break;
132 case Qt::Key_Left:
133 if ((m_direction & FocusPath::Horizontal) == FocusPath::Horizontal) {
134- switch(m_flow) {
135+ switch(flow) {
136 case FocusPath::LeftToRight:
137 nextFocus -= 1;
138 break;
139@@ -336,14 +350,14 @@
140 break;
141 case Qt::Key_Up:
142 if (((m_direction & FocusPath::Vertical) == FocusPath::Vertical) && (m_columns >= 0)) {
143- nextFocus = (m_flow == FocusPath::TopToBottom) ? nextFocus - 1 : nextFocus - m_columns;
144+ nextFocus = (flow == FocusPath::TopToBottom) ? nextFocus - 1 : nextFocus - m_columns;
145 } else {
146 nextFocus = -1;
147 }
148 break;
149 case Qt::Key_Down:
150 if (((m_direction & FocusPath::Vertical) == FocusPath::Vertical) && (m_columns >= 0)) {
151- nextFocus = (m_flow == FocusPath::TopToBottom) ? nextFocus + 1 : nextFocus + m_columns;
152+ nextFocus = (flow == FocusPath::TopToBottom) ? nextFocus + 1 : nextFocus + m_columns;
153 } else {
154 nextFocus = -1;
155 }
156
157=== modified file 'libunity-2d-private/src/launchermenu.cpp'
158--- libunity-2d-private/src/launchermenu.cpp 2011-12-05 06:49:40 +0000
159+++ libunity-2d-private/src/launchermenu.cpp 2011-12-21 22:46:24 +0000
160@@ -331,7 +331,9 @@
161 LauncherContextualMenu::keyPressEvent(QKeyEvent* event)
162 {
163 int key = event->key();
164- if (key == Qt::Key_Left || key == Qt::Key_Escape) {
165+ bool rtl = layoutDirection() == Qt::RightToLeft;
166+ if (!rtl && key == Qt::Key_Left ||
167+ rtl && key == Qt::Key_Right || key == Qt::Key_Escape) {
168 Q_EMIT dismissedByKeyEvent();
169 hide();
170 event->accept();
171
172=== modified file 'panel/applets/appname/appnameapplet.cpp'
173--- panel/applets/appname/appnameapplet.cpp 2011-12-02 06:41:22 +0000
174+++ panel/applets/appname/appnameapplet.cpp 2011-12-21 22:46:24 +0000
175@@ -111,8 +111,10 @@
176 } else {
177 pix = m_normalPix;
178 }
179+ bool rtl = layoutDirection() == Qt::RightToLeft;
180 int posX;
181- if (m_buttonType == PanelStyle::CloseWindowButton) {
182+ if (!rtl && m_buttonType == PanelStyle::CloseWindowButton ||
183+ rtl && m_buttonType != PanelStyle::CloseWindowButton) {
184 posX = width() - pix.width();
185 } else {
186 posX = 0;
187
188=== modified file 'places/GridViewWithSpacing.qml'
189--- places/GridViewWithSpacing.qml 2011-08-23 15:00:31 +0000
190+++ places/GridViewWithSpacing.qml 2011-12-21 22:46:24 +0000
191@@ -25,6 +25,8 @@
192 property int rows: 2
193
194 function delegateX(column) {
195+ if (isRightToLeft())
196+ column = columns - 1 - column
197 return column * horizontalSpacing / columns
198 }
199 function delegateY(row) {
200
201=== modified file 'places/LensBar.qml'
202--- places/LensBar.qml 2011-12-14 22:46:59 +0000
203+++ places/LensBar.qml 2011-12-21 22:46:24 +0000
204@@ -74,7 +74,7 @@
205 }
206
207 function handleKeyPress(key) {
208- switch (key) {
209+ switch (switchLeftRightKeys(key)) {
210 case Qt.Key_Right:
211 return selectChild(currentIndex+1)
212 case Qt.Key_Left:
213
214=== modified file 'places/MultiRangeSelectionBar.qml'
215--- places/MultiRangeSelectionBar.qml 2011-08-25 10:46:14 +0000
216+++ places/MultiRangeSelectionBar.qml 2011-12-21 22:46:24 +0000
217@@ -16,7 +16,7 @@
218 * along with this program. If not, see <http://www.gnu.org/licenses/>.
219 */
220
221-import QtQuick 1.0
222+import QtQuick 1.1
223
224 Item {
225 id: multiRangeSelectionBar
226@@ -26,7 +26,7 @@
227 property int leftPos: 0
228 property int rightPos: 100
229
230- x: leftPos
231+ x: !isRightToLeft() ? leftPos : parent.width - rightPos
232 width: rightPos - leftPos
233 height: childrenRect.height
234
235@@ -38,6 +38,7 @@
236 height: sourceSize.height
237 anchors.left: parent.left
238 anchors.top: parent.top
239+ mirror: isRightToLeft()
240 }
241
242 Image {
243@@ -59,6 +60,7 @@
244 height: sourceSize.height
245 anchors.top: parent.top
246 anchors.right: parent.right
247+ mirror: isRightToLeft()
248 }
249
250 }
251
252=== modified file 'places/RatingStars.qml'
253--- places/RatingStars.qml 2011-11-14 10:45:33 +0000
254+++ places/RatingStars.qml 2011-12-21 22:46:24 +0000
255@@ -50,7 +50,7 @@
256
257 Keys.onPressed: if (handleKeyPress(event.key)) event.accepted = true
258 function handleKeyPress(key) {
259- switch (key) {
260+ switch (switchLeftRightKeys(key)) {
261 case Qt.Key_Right:
262 incrementRating()
263 return true
264@@ -64,6 +64,9 @@
265 Row {
266 id: stars
267
268+ // Required for right-to-left mirroring
269+ anchors.left: parent.left
270+
271 Repeater {
272 model: size
273 Star {
274@@ -98,6 +101,8 @@
275
276 /* What unit is the mouse over? This is the integer part of the rating (plus one)*/
277 var rating = (posX - posXOverUnit) / unitWidth + 1
278+ if (isRightToLeft())
279+ rating = size + 1 - rating
280
281 return clamp( rating, 0, size )
282 }
283
284=== modified file 'places/dash.qml'
285--- places/dash.qml 2011-12-19 10:44:26 +0000
286+++ places/dash.qml 2011-12-21 22:46:24 +0000
287@@ -33,6 +33,20 @@
288 return Qt.application.layoutDirection == Qt.RightToLeft
289 }
290
291+ function switchLeftRightKeys(key) {
292+ if (isRightToLeft()) {
293+ switch (key) {
294+ case Qt.Key_Right:
295+ return Qt.Key_Left
296+ case Qt.Key_Left:
297+ return Qt.Key_Right
298+ default:
299+ return key
300+ }
301+ }
302+ return key
303+ }
304+
305 Binding {
306 target: dashView
307 property: "expanded"

Subscribers

People subscribed via source and target branches