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

Proposed by Haggai Eran
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) Needs Fixing
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.
Revision history for this message
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.

Revision history for this message
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
Revision history for this message
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
781. By Lohith D Shivamurthy

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

782. By Olivier Tilloy

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

Revision history for this message
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
783. By Renato Araujo Oliveira Filho

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

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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)

Revision history for this message
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
784. By Florian Boucault

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

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

786. By Florian Boucault

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

787. By Tiago Salem Herrmann

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

788. By Renato Araujo Oliveira Filho

[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

[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

[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

Revision history for this message
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
791. By Lohith D Shivamurthy

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

792. By Gerry Boland

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.

Revision history for this message
Haggai Eran (haggai-eran) wrote :

Sure, I understand.

Haggai

lp:~haggai-eran/unity-2d/rtl-rebased updated
793. By Gerry Boland

[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

[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

[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

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

(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

[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

[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

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

801. By Florian Boucault

[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

[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

[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

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

[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

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

807. By Didier Roche-Tolomelli

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

808. By Lohith D Shivamurthy

[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

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

810. By Tiago Salem Herrmann

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

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

812. By Florian Boucault

[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

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

814. By Florian Boucault

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

815. By Florian Boucault

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

816. By Florian Boucault

[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

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

818. By Lohith D Shivamurthy

[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

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

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-Tolomelli

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

822. By Florian Boucault

[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

[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

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

825. By Gerry Boland

[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

[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

[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

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

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

830. By Florian Boucault

[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

[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

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

Revision history for this message
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
833. By Albert Astals Cid

[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.

Revision history for this message
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.

Revision history for this message
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

Revision history for this message
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 :)

Revision history for this message
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
838. By Haggai Eran

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

839. By Haggai Eran

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

840. By Haggai Eran

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

841. By Haggai Eran

[dash] Mirror the MultiRange filter in RTL locales.

842. By Haggai Eran

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

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Albert Astals Cid (aacid) wrote :

This branch does not cleanly merge to master anymore.

Revision history for this message
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.

Revision history for this message
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

Revision history for this message
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

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

841. By Haggai Eran

[dash] Mirror the MultiRange filter in RTL locales.

840. By Haggai Eran

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

839. By Haggai Eran

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

838. By Haggai Eran

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

837. By Haggai Eran

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

836. By Haggai Eran

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

835. By Haggai Eran

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

834. By Haggai Eran

[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
=== modified file 'launcher/Launcher.qml'
--- launcher/Launcher.qml 2011-12-11 22:26:34 +0000
+++ launcher/Launcher.qml 2011-12-21 22:46:24 +0000
@@ -16,7 +16,7 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */17 */
1818
19import QtQuick 1.019import QtQuick 1.1
20import Unity2d 1.0 /* required for drag’n’drop handling */20import Unity2d 1.0 /* required for drag’n’drop handling */
2121
22LauncherDropItem {22LauncherDropItem {
@@ -24,6 +24,8 @@
2424
25 Accessible.name: "root"25 Accessible.name: "root"
26 focus: true26 focus: true
27 LayoutMirroring.enabled: isRightToLeft()
28 LayoutMirroring.childrenInherit: true
2729
28 function clamp(x, min, max) {30 function clamp(x, min, max) {
29 return Math.max(Math.min(x, max), min)31 return Math.max(Math.min(x, max), min)
@@ -47,6 +49,24 @@
47 main.positionViewAtBeginning()49 main.positionViewAtBeginning()
48 }50 }
4951
52 function isRightToLeft() {
53 return Qt.application.layoutDirection == Qt.RightToLeft
54 }
55
56 function switchLeftRightKeys(key) {
57 if (isRightToLeft()) {
58 switch (key) {
59 case Qt.Key_Right:
60 return Qt.Key_Left
61 case Qt.Key_Left:
62 return Qt.Key_Right
63 default:
64 return key
65 }
66 }
67 return key
68 }
69
50 Item {70 Item {
51 anchors.fill: parent71 anchors.fill: parent
52 clip: true72 clip: true
5373
=== modified file 'launcher/LauncherList.qml'
--- launcher/LauncherList.qml 2011-12-21 09:52:15 +0000
+++ launcher/LauncherList.qml 2011-12-21 22:46:24 +0000
@@ -187,13 +187,14 @@
187 }187 }
188188
189 Keys.onPressed: {189 Keys.onPressed: {
190 if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter || event.key == Qt.Key_Space) {190 var key = switchLeftRightKeys(event.key)
191 if (key == Qt.Key_Return || key == Qt.Key_Enter || key == Qt.Key_Space) {
191 item.menu.hide()192 item.menu.hide()
192 item.activate()193 item.activate()
193 event.accepted = true194 event.accepted = true
194 }195 }
195 else if (event.key == Qt.Key_Right ||196 else if (key == Qt.Key_Right ||
196 (event.key == Qt.Key_F10 && (event.modifiers & Qt.ShiftModifier))) {197 (key == Qt.Key_F10 && (event.modifiers & Qt.ShiftModifier))) {
197 /* Show the menu first, then unfold it. Doing things in this198 /* Show the menu first, then unfold it. Doing things in this
198 order is required because at the moment the code path that199 order is required because at the moment the code path that
199 adjusts the position of the menu in case it goes offscreen200 adjusts the position of the menu in case it goes offscreen
@@ -204,7 +205,7 @@
204 item.menu.setFocus()205 item.menu.setFocus()
205 event.accepted = true206 event.accepted = true
206 }207 }
207 else if (event.key == Qt.Key_Left) {208 else if (key == Qt.Key_Left) {
208 item.menu.hide()209 item.menu.hide()
209 event.accepted = true210 event.accepted = true
210 }211 }
211212
=== modified file 'libunity-2d-private/src/edgehitdetector.cpp'
--- libunity-2d-private/src/edgehitdetector.cpp 2011-11-29 11:46:34 +0000
+++ libunity-2d-private/src/edgehitdetector.cpp 2011-12-21 22:46:24 +0000
@@ -58,7 +58,7 @@
58 if (QApplication::isLeftToRight()) {58 if (QApplication::isLeftToRight()) {
59 m_mouseArea->setGeometry(rect.left(), rect.top(), 1, rect.height());59 m_mouseArea->setGeometry(rect.left(), rect.top(), 1, rect.height());
60 } else {60 } else {
61 m_mouseArea->setGeometry(rect.right() - 1, rect.top(), 1, rect.height());61 m_mouseArea->setGeometry(rect.right(), rect.top(), 1, rect.height());
62 }62 }
63}63}
6464
6565
=== modified file 'libunity-2d-private/src/focuspath.cpp'
--- libunity-2d-private/src/focuspath.cpp 2011-11-21 18:57:43 +0000
+++ libunity-2d-private/src/focuspath.cpp 2011-12-21 22:46:24 +0000
@@ -22,6 +22,7 @@
22#include <QtCore/qmath.h>22#include <QtCore/qmath.h>
23#include <QEvent>23#include <QEvent>
24#include <QKeyEvent>24#include <QKeyEvent>
25#include <QApplication>
2526
26/*!27/*!
27 \qmlclass FocusPath28 \qmlclass FocusPath
@@ -297,12 +298,25 @@
297 switch(event->type()) {298 switch(event->type()) {
298 case QEvent::KeyPress: {299 case QEvent::KeyPress: {
299 int nextFocus = m_currentIndex;300 int nextFocus = m_currentIndex;
301 Flow flow = m_flow;
302 if (QApplication::isRightToLeft()) {
303 switch (m_flow) {
304 case FocusPath::LeftToRight:
305 flow = FocusPath::RightToLeft;
306 break;
307 case FocusPath::RightToLeft:
308 flow = FocusPath::LeftToRight;
309 break;
310 default:
311 break;
312 }
313 }
300314
301 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);315 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
302 switch(keyEvent->key()) {316 switch(keyEvent->key()) {
303 case Qt::Key_Right:317 case Qt::Key_Right:
304 if ((m_direction & FocusPath::Horizontal) == FocusPath::Horizontal) {318 if ((m_direction & FocusPath::Horizontal) == FocusPath::Horizontal) {
305 switch(m_flow) {319 switch(flow) {
306 case FocusPath::LeftToRight:320 case FocusPath::LeftToRight:
307 nextFocus += 1;321 nextFocus += 1;
308 break;322 break;
@@ -319,7 +333,7 @@
319 break;333 break;
320 case Qt::Key_Left:334 case Qt::Key_Left:
321 if ((m_direction & FocusPath::Horizontal) == FocusPath::Horizontal) {335 if ((m_direction & FocusPath::Horizontal) == FocusPath::Horizontal) {
322 switch(m_flow) {336 switch(flow) {
323 case FocusPath::LeftToRight:337 case FocusPath::LeftToRight:
324 nextFocus -= 1;338 nextFocus -= 1;
325 break;339 break;
@@ -336,14 +350,14 @@
336 break;350 break;
337 case Qt::Key_Up:351 case Qt::Key_Up:
338 if (((m_direction & FocusPath::Vertical) == FocusPath::Vertical) && (m_columns >= 0)) {352 if (((m_direction & FocusPath::Vertical) == FocusPath::Vertical) && (m_columns >= 0)) {
339 nextFocus = (m_flow == FocusPath::TopToBottom) ? nextFocus - 1 : nextFocus - m_columns;353 nextFocus = (flow == FocusPath::TopToBottom) ? nextFocus - 1 : nextFocus - m_columns;
340 } else {354 } else {
341 nextFocus = -1;355 nextFocus = -1;
342 }356 }
343 break;357 break;
344 case Qt::Key_Down:358 case Qt::Key_Down:
345 if (((m_direction & FocusPath::Vertical) == FocusPath::Vertical) && (m_columns >= 0)) {359 if (((m_direction & FocusPath::Vertical) == FocusPath::Vertical) && (m_columns >= 0)) {
346 nextFocus = (m_flow == FocusPath::TopToBottom) ? nextFocus + 1 : nextFocus + m_columns;360 nextFocus = (flow == FocusPath::TopToBottom) ? nextFocus + 1 : nextFocus + m_columns;
347 } else {361 } else {
348 nextFocus = -1;362 nextFocus = -1;
349 }363 }
350364
=== modified file 'libunity-2d-private/src/launchermenu.cpp'
--- libunity-2d-private/src/launchermenu.cpp 2011-12-05 06:49:40 +0000
+++ libunity-2d-private/src/launchermenu.cpp 2011-12-21 22:46:24 +0000
@@ -331,7 +331,9 @@
331LauncherContextualMenu::keyPressEvent(QKeyEvent* event)331LauncherContextualMenu::keyPressEvent(QKeyEvent* event)
332{332{
333 int key = event->key();333 int key = event->key();
334 if (key == Qt::Key_Left || key == Qt::Key_Escape) {334 bool rtl = layoutDirection() == Qt::RightToLeft;
335 if (!rtl && key == Qt::Key_Left ||
336 rtl && key == Qt::Key_Right || key == Qt::Key_Escape) {
335 Q_EMIT dismissedByKeyEvent();337 Q_EMIT dismissedByKeyEvent();
336 hide();338 hide();
337 event->accept();339 event->accept();
338340
=== modified file 'panel/applets/appname/appnameapplet.cpp'
--- panel/applets/appname/appnameapplet.cpp 2011-12-02 06:41:22 +0000
+++ panel/applets/appname/appnameapplet.cpp 2011-12-21 22:46:24 +0000
@@ -111,8 +111,10 @@
111 } else {111 } else {
112 pix = m_normalPix;112 pix = m_normalPix;
113 }113 }
114 bool rtl = layoutDirection() == Qt::RightToLeft;
114 int posX;115 int posX;
115 if (m_buttonType == PanelStyle::CloseWindowButton) {116 if (!rtl && m_buttonType == PanelStyle::CloseWindowButton ||
117 rtl && m_buttonType != PanelStyle::CloseWindowButton) {
116 posX = width() - pix.width();118 posX = width() - pix.width();
117 } else {119 } else {
118 posX = 0;120 posX = 0;
119121
=== modified file 'places/GridViewWithSpacing.qml'
--- places/GridViewWithSpacing.qml 2011-08-23 15:00:31 +0000
+++ places/GridViewWithSpacing.qml 2011-12-21 22:46:24 +0000
@@ -25,6 +25,8 @@
25 property int rows: 225 property int rows: 2
2626
27 function delegateX(column) {27 function delegateX(column) {
28 if (isRightToLeft())
29 column = columns - 1 - column
28 return column * horizontalSpacing / columns30 return column * horizontalSpacing / columns
29 }31 }
30 function delegateY(row) {32 function delegateY(row) {
3133
=== modified file 'places/LensBar.qml'
--- places/LensBar.qml 2011-12-14 22:46:59 +0000
+++ places/LensBar.qml 2011-12-21 22:46:24 +0000
@@ -74,7 +74,7 @@
74 }74 }
7575
76 function handleKeyPress(key) {76 function handleKeyPress(key) {
77 switch (key) {77 switch (switchLeftRightKeys(key)) {
78 case Qt.Key_Right:78 case Qt.Key_Right:
79 return selectChild(currentIndex+1)79 return selectChild(currentIndex+1)
80 case Qt.Key_Left:80 case Qt.Key_Left:
8181
=== modified file 'places/MultiRangeSelectionBar.qml'
--- places/MultiRangeSelectionBar.qml 2011-08-25 10:46:14 +0000
+++ places/MultiRangeSelectionBar.qml 2011-12-21 22:46:24 +0000
@@ -16,7 +16,7 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */17 */
1818
19import QtQuick 1.019import QtQuick 1.1
2020
21Item {21Item {
22 id: multiRangeSelectionBar22 id: multiRangeSelectionBar
@@ -26,7 +26,7 @@
26 property int leftPos: 026 property int leftPos: 0
27 property int rightPos: 10027 property int rightPos: 100
2828
29 x: leftPos29 x: !isRightToLeft() ? leftPos : parent.width - rightPos
30 width: rightPos - leftPos30 width: rightPos - leftPos
31 height: childrenRect.height31 height: childrenRect.height
3232
@@ -38,6 +38,7 @@
38 height: sourceSize.height38 height: sourceSize.height
39 anchors.left: parent.left39 anchors.left: parent.left
40 anchors.top: parent.top40 anchors.top: parent.top
41 mirror: isRightToLeft()
41 }42 }
4243
43 Image {44 Image {
@@ -59,6 +60,7 @@
59 height: sourceSize.height60 height: sourceSize.height
60 anchors.top: parent.top61 anchors.top: parent.top
61 anchors.right: parent.right62 anchors.right: parent.right
63 mirror: isRightToLeft()
62 }64 }
6365
64}66}
6567
=== modified file 'places/RatingStars.qml'
--- places/RatingStars.qml 2011-11-14 10:45:33 +0000
+++ places/RatingStars.qml 2011-12-21 22:46:24 +0000
@@ -50,7 +50,7 @@
5050
51 Keys.onPressed: if (handleKeyPress(event.key)) event.accepted = true51 Keys.onPressed: if (handleKeyPress(event.key)) event.accepted = true
52 function handleKeyPress(key) {52 function handleKeyPress(key) {
53 switch (key) {53 switch (switchLeftRightKeys(key)) {
54 case Qt.Key_Right:54 case Qt.Key_Right:
55 incrementRating()55 incrementRating()
56 return true56 return true
@@ -64,6 +64,9 @@
64 Row {64 Row {
65 id: stars65 id: stars
6666
67 // Required for right-to-left mirroring
68 anchors.left: parent.left
69
67 Repeater {70 Repeater {
68 model: size71 model: size
69 Star {72 Star {
@@ -98,6 +101,8 @@
98101
99 /* What unit is the mouse over? This is the integer part of the rating (plus one)*/102 /* What unit is the mouse over? This is the integer part of the rating (plus one)*/
100 var rating = (posX - posXOverUnit) / unitWidth + 1103 var rating = (posX - posXOverUnit) / unitWidth + 1
104 if (isRightToLeft())
105 rating = size + 1 - rating
101106
102 return clamp( rating, 0, size )107 return clamp( rating, 0, size )
103 }108 }
104109
=== modified file 'places/dash.qml'
--- places/dash.qml 2011-12-19 10:44:26 +0000
+++ places/dash.qml 2011-12-21 22:46:24 +0000
@@ -33,6 +33,20 @@
33 return Qt.application.layoutDirection == Qt.RightToLeft33 return Qt.application.layoutDirection == Qt.RightToLeft
34 }34 }
3535
36 function switchLeftRightKeys(key) {
37 if (isRightToLeft()) {
38 switch (key) {
39 case Qt.Key_Right:
40 return Qt.Key_Left
41 case Qt.Key_Left:
42 return Qt.Key_Right
43 default:
44 return key
45 }
46 }
47 return key
48 }
49
36 Binding {50 Binding {
37 target: dashView51 target: dashView
38 property: "expanded"52 property: "expanded"

Subscribers

People subscribed via source and target branches