Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 2181
Merged at revision: 2188
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 117 lines (+28/-6)
5 files modified
components.api (+1/-0)
examples/ubuntu-ui-toolkit-gallery/MainPage.qml (+4/-4)
examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml (+1/-2)
src/UbuntuToolkit/ucapplication.cpp (+18/-0)
src/UbuntuToolkit/ucapplication_p.h (+4/-0)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/realLayoutDirectionChange
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zsombor Egri Approve
Adnane Belmadiaf (community) Approve
Review via email: mp+318359@code.launchpad.net

Commit message

Change layoutDirection from gallery (via UCApplication)

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2181. By Cris Dywan

Update components.api

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Adnane Belmadiaf (daker) wrote :

LGTM, i still see some issues in RTL mode with APL but they are not related to this MR.

review: Approve
Revision history for this message
Zsombor Egri (zsombi) wrote :

All fine, thanks for having it!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components.api'
--- components.api 2017-02-21 14:57:05 +0000
+++ components.api 2017-02-27 15:48:33 +0000
@@ -1635,6 +1635,7 @@
1635Ubuntu.Components.UCApplication 1.0 0.1: QtObject1635Ubuntu.Components.UCApplication 1.0 0.1: QtObject
1636 property string applicationName1636 property string applicationName
1637 property QtObject inputMethod1637 property QtObject inputMethod
1638 property Qt.LayoutDirection layoutDirection
1638Ubuntu.Components.UCFontUtils 1.0 0.1: QtObject1639Ubuntu.Components.UCFontUtils 1.0 0.1: QtObject
1639 function double sizeToPixels(string size)1640 function double sizeToPixels(string size)
1640 function double modularScale(string size)1641 function double modularScale(string size)
16411642
=== modified file 'examples/ubuntu-ui-toolkit-gallery/MainPage.qml'
--- examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2016-06-17 13:42:23 +0000
+++ examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2017-02-27 15:48:33 +0000
@@ -30,14 +30,14 @@
30 Action {30 Action {
31 text: i18n.tr('Right to Left')31 text: i18n.tr('Right to Left')
32 iconName: 'flash-on'32 iconName: 'flash-on'
33 visible: !gallery.rtl33 visible: UbuntuApplication.layoutDirection == Qt.LeftToRight
34 onTriggered: gallery.rtl = !gallery.rtl34 onTriggered: UbuntuApplication.layoutDirection = Qt.RightToLeft
35 },35 },
36 Action {36 Action {
37 text: i18n.tr('Left to Right')37 text: i18n.tr('Left to Right')
38 iconName: 'flash-off'38 iconName: 'flash-off'
39 visible: gallery.rtl39 visible: UbuntuApplication.layoutDirection == Qt.RightToLeft
40 onTriggered: gallery.rtl = !gallery.rtl40 onTriggered: UbuntuApplication.layoutDirection = Qt.LeftToRight
41 },41 },
42 Action {42 Action {
43 text: i18n.tr('Use dark theme')43 text: i18n.tr('Use dark theme')
4444
=== modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml'
--- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2016-01-18 12:50:44 +0000
+++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2017-02-27 15:48:33 +0000
@@ -29,9 +29,8 @@
29 width: units.gu(120)29 width: units.gu(120)
30 height: units.gu(75)30 height: units.gu(75)
3131
32 LayoutMirroring.enabled: rtl32 LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
33 LayoutMirroring.childrenInherit: true33 LayoutMirroring.childrenInherit: true
34 property bool rtl: Qt.application.layoutDirection == Qt.RightToLeft
3534
36 AdaptivePageLayout {35 AdaptivePageLayout {
37 id: layout36 id: layout
3837
=== modified file 'src/UbuntuToolkit/ucapplication.cpp'
--- src/UbuntuToolkit/ucapplication.cpp 2017-02-09 11:00:07 +0000
+++ src/UbuntuToolkit/ucapplication.cpp 2017-02-27 15:48:33 +0000
@@ -42,6 +42,10 @@
42 // Make sure we receive application name changes from C++ modules42 // Make sure we receive application name changes from C++ modules
43 connect(QCoreApplication::instance(), &QCoreApplication::applicationNameChanged,43 connect(QCoreApplication::instance(), &QCoreApplication::applicationNameChanged,
44 this, &UCApplication::applicationNameChanged);44 this, &UCApplication::applicationNameChanged);
45 // Changes to the default layout direction (RTL, LTR)
46 QGuiApplication* application = qobject_cast<QGuiApplication*>(QCoreApplication::instance());
47 connect(application, &QGuiApplication::layoutDirectionChanged,
48 this, &UCApplication::layoutDirectionChanged);
45}49}
4650
47UCApplication::~UCApplication()51UCApplication::~UCApplication()
@@ -91,4 +95,18 @@
91 m_inputMethod = inputMethod;95 m_inputMethod = inputMethod;
92}96}
9397
98/*!
99 * \internal
100 * The (default) layout direction. Can be overridden for testing,
101 * unlike Qt.application.layoutDirection.
102 */
103Qt::LayoutDirection UCApplication::layoutDirection() {
104 return QGuiApplication::layoutDirection();
105}
106
107void UCApplication::setLayoutDirection(Qt::LayoutDirection layoutDirection) {
108 return QGuiApplication::setLayoutDirection(layoutDirection);
109}
110
111
94UT_NAMESPACE_END112UT_NAMESPACE_END
95113
=== modified file 'src/UbuntuToolkit/ucapplication_p.h'
--- src/UbuntuToolkit/ucapplication_p.h 2016-09-09 17:49:07 +0000
+++ src/UbuntuToolkit/ucapplication_p.h 2017-02-27 15:48:33 +0000
@@ -33,6 +33,7 @@
33 Q_OBJECT33 Q_OBJECT
34 Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)34 Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)
35 Q_PROPERTY(QObject* inputMethod READ inputMethod WRITE setInputMethod NOTIFY inputMethodChanged)35 Q_PROPERTY(QObject* inputMethod READ inputMethod WRITE setInputMethod NOTIFY inputMethodChanged)
36 Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
3637
37private:38private:
38 Q_DISABLE_COPY(UCApplication)39 Q_DISABLE_COPY(UCApplication)
@@ -53,11 +54,13 @@
53 // getter54 // getter
54 QString applicationName();55 QString applicationName();
55 QObject* inputMethod();56 QObject* inputMethod();
57 Qt::LayoutDirection layoutDirection();
5658
57 // setter59 // setter
58 void setContext(QQmlContext* context);60 void setContext(QQmlContext* context);
59 void setApplicationName(const QString& applicationName);61 void setApplicationName(const QString& applicationName);
60 void setInputMethod(QObject* inputMethod);62 void setInputMethod(QObject* inputMethod);
63 void setLayoutDirection(Qt::LayoutDirection layoutDirection);
6164
62private:65private:
63 QQmlContext* m_context;66 QQmlContext* m_context;
@@ -67,6 +70,7 @@
67Q_SIGNALS:70Q_SIGNALS:
68 void applicationNameChanged();71 void applicationNameChanged();
69 void inputMethodChanged();72 void inputMethodChanged();
73 void layoutDirectionChanged();
70};74};
7175
72UT_NAMESPACE_END76UT_NAMESPACE_END

Subscribers

People subscribed via source and target branches