Commit 13cc1b4a authored by Safa AlFulaij's avatar Safa AlFulaij Committed by Matthieu Gallien

Add Right To Left support.

Summary: Support Right To Left interface in the UI and the configuration.

Test Plan: Everything works as expected.

Reviewers: #elisa, mgallien

Reviewed By: #elisa, mgallien

Subscribers: mgallien

Differential Revision: https://phabricator.kde.org/D7685
parent 79502702
......@@ -139,7 +139,18 @@ Item {
color: myPalette.text
Layout.leftMargin: (!isSingleDiscAlbum ? elisaTheme.layoutHorizontalMargin * 4 : elisaTheme.layoutHorizontalMargin)
Layout.leftMargin: {
if (!LayoutMirroring.enabled)
return (!isSingleDiscAlbum ? elisaTheme.layoutHorizontalMargin * 4 : elisaTheme.layoutHorizontalMargin)
else
return 0
}
Layout.rightMargin: {
if (LayoutMirroring.enabled)
return (!isSingleDiscAlbum ? elisaTheme.layoutHorizontalMargin * 4 : elisaTheme.layoutHorizontalMargin)
else
return 0
}
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true
......@@ -168,7 +179,8 @@ Item {
Layout.preferredHeight: elisaTheme.delegateHeight * 0.75
Layout.preferredWidth: elisaTheme.delegateHeight * 0.75
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
RatingStar {
......@@ -191,7 +203,8 @@ Item {
elide: "ElideRight"
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
}
}
......
......@@ -142,7 +142,8 @@ Item {
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.maximumWidth: elisaTheme.smallImageSize
Layout.maximumHeight: elisaTheme.smallImageSize
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
visible: artistName !== undefined
width: elisaTheme.smallImageSize
......
......@@ -189,7 +189,8 @@ Item {
Layout.preferredWidth: contentZone.height * 0.9
Layout.minimumWidth: contentZone.height * 0.9
Layout.maximumWidth: contentZone.height * 0.9
Layout.leftMargin: contentZone.width * 0.15
Layout.leftMargin: !LayoutMirroring.enabled ? contentZone.width * 0.15 : 0
Layout.rightMargin: LayoutMirroring.enabled ? contentZone.width * 0.15 : 0
Image {
id: oldMainIcon
......@@ -255,7 +256,8 @@ Item {
spacing: 0
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.fillWidth: true
Layout.fillHeight: true
......
......@@ -26,6 +26,7 @@ import QtQuick.Window 2.2
Label {
id: theLabel
horizontalAlignment: Text.AlignLeft
renderType: Text.NativeRendering
Loader {
......
......@@ -80,7 +80,8 @@ Item {
Layout.fillWidth: true
Layout.bottomMargin: titleHeight.height + elisaTheme.layoutVerticalMargin * 2
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
LabelWithToolTip {
text: i18nc("before the TextField input of the filter", "Filter: ")
......@@ -136,7 +137,8 @@ Item {
color: myPalette.text
Layout.bottomMargin: 0
Layout.leftMargin: elisaTheme.layoutHorizontalMargin * 2
Layout.leftMargin: !LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 2) : 0
Layout.rightMargin: LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 2) : 0
}
RatingStar {
......
......@@ -80,7 +80,8 @@ Item {
Layout.fillWidth: true
Layout.bottomMargin: titleHeight.height + elisaTheme.layoutVerticalMargin * 2
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
LabelWithToolTip {
text: i18nc("before the TextField input of the filter", "Filter: ")
......
......@@ -79,7 +79,8 @@ Item {
Layout.fillWidth: true
Layout.bottomMargin: titleHeight.height + elisaTheme.layoutVerticalMargin * 2
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
LabelWithToolTip {
text: i18nc("before the TextField input of the filter", "Filter: ")
......@@ -132,7 +133,8 @@ Item {
color: myPalette.text
Layout.bottomMargin: 0
Layout.leftMargin: elisaTheme.layoutHorizontalMargin * 2
Layout.leftMargin: !LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 2) : 0
Layout.rightMargin: LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 2) : 0
}
RatingStar {
......
......@@ -112,7 +112,8 @@ Item {
text: i18n("Repeat")
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
Item {
......
......@@ -69,7 +69,7 @@ Item {
Image {
id: previousButton
source: Qt.resolvedUrl(elisaTheme.skipBackwardIcon)
source: Qt.resolvedUrl(LayoutMirroring.enabled ? elisaTheme.skipForwardIcon : elisaTheme.skipBackwardIcon)
Layout.preferredWidth: elisaTheme.smallControlButtonHeight
Layout.preferredHeight: elisaTheme.smallControlButtonHeight
......@@ -172,7 +172,7 @@ Item {
Image {
id: nextButton
source: Qt.resolvedUrl(elisaTheme.skipForwardIcon)
source: Qt.resolvedUrl(LayoutMirroring.enabled ? elisaTheme.skipBackwardIcon : elisaTheme.skipForwardIcon)
Layout.preferredWidth: elisaTheme.smallControlButtonHeight
Layout.preferredHeight: elisaTheme.smallControlButtonHeight
......@@ -181,7 +181,8 @@ Item {
Layout.maximumHeight: elisaTheme.smallControlButtonHeight
Layout.minimumWidth: elisaTheme.smallControlButtonHeight
Layout.minimumHeight: elisaTheme.smallControlButtonHeight
Layout.rightMargin: elisaTheme.smallControlButtonHeight
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.smallControlButtonHeight : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.smallControlButtonHeight : 0
sourceSize.width: elisaTheme.smallControlButtonHeight
sourceSize.height: elisaTheme.smallControlButtonHeight
......@@ -201,7 +202,8 @@ Item {
Layout.maximumHeight: elisaTheme.smallControlButtonHeight
Layout.minimumWidth: elisaTheme.smallControlButtonHeight
Layout.minimumHeight: elisaTheme.smallControlButtonHeight
Layout.rightMargin: elisaTheme.smallControlButtonHeight
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.smallControlButtonHeight : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.smallControlButtonHeight : 0
enabled: skipForwardEnabled
......@@ -227,7 +229,8 @@ Item {
Layout.alignment: Qt.AlignVCenter
Layout.fillHeight: true
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
verticalAlignment: Text.AlignVCenter
......@@ -248,7 +251,8 @@ Item {
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
enabled: musicWidget.seekable && musicWidget.playEnabled
......@@ -309,7 +313,8 @@ Item {
Layout.alignment: Qt.AlignVCenter
Layout.fillHeight: true
Layout.rightMargin: elisaTheme.layoutHorizontalMargin * 10
Layout.rightMargin: !LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 10) : 0
Layout.leftMargin: LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 10) : 0
verticalAlignment: Text.AlignVCenter
......@@ -334,7 +339,8 @@ Item {
Layout.maximumHeight: elisaTheme.smallControlButtonHeight
Layout.minimumWidth: elisaTheme.smallControlButtonHeight
Layout.minimumHeight: elisaTheme.smallControlButtonHeight
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
sourceSize.width: elisaTheme.smallControlButtonHeight
sourceSize.height: elisaTheme.smallControlButtonHeight
......@@ -354,7 +360,8 @@ Item {
Layout.maximumHeight: elisaTheme.smallControlButtonHeight
Layout.minimumWidth: elisaTheme.smallControlButtonHeight
Layout.minimumHeight: elisaTheme.smallControlButtonHeight
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
MouseArea {
anchors.fill: parent
......@@ -380,7 +387,8 @@ Item {
Layout.preferredWidth: elisaTheme.volumeSliderWidth
Layout.maximumWidth: elisaTheme.volumeSliderWidth
Layout.minimumWidth: elisaTheme.volumeSliderWidth
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
width: elisaTheme.volumeSliderWidth
......
......@@ -34,6 +34,9 @@ ApplicationWindow {
minimumWidth: 1000
minimumHeight: 600
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
x: persistentSettings.x
y: persistentSettings.y
width: persistentSettings.width
......
......@@ -146,7 +146,8 @@ Item {
color: myPalette.text
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.fillWidth: true
Layout.topMargin: elisaTheme.layoutVerticalMargin / 2
......@@ -168,7 +169,8 @@ Item {
color: myPalette.text
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.fillWidth: true
Layout.bottomMargin: elisaTheme.layoutVerticalMargin / 2
......@@ -199,7 +201,8 @@ Item {
action: clearAndEnqueue
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
RatingStar {
......@@ -223,7 +226,8 @@ Item {
elide: "ElideRight"
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
}
}
......
......@@ -39,7 +39,7 @@ Item {
Action {
id: goPreviousAction
text: i18nc("navigate back in the views stack", "Back")
iconName: "go-previous"
iconName: (Qt.application.layoutDirection == Qt.RightToLeft) ? "go-next" : "go-previous"
onTriggered:
{
if (listingView.depth > 1) {
......@@ -57,7 +57,8 @@ Item {
ToolButton {
action: goPreviousAction
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
Image {
......@@ -79,7 +80,8 @@ Item {
Layout.preferredWidth: elisaTheme.coverImageSize / 2
Layout.minimumWidth: elisaTheme.coverImageSize / 2
Layout.maximumWidth: elisaTheme.coverImageSize / 2
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
ColumnLayout {
......@@ -89,7 +91,8 @@ Item {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
TextMetrics {
id: albumTextSize
......@@ -147,7 +150,8 @@ Item {
Button {
action: enqueueAction
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
Button {
......
......@@ -205,7 +205,8 @@ RowLayout {
Layout.minimumHeight: starSize * 1.5
Layout.minimumWidth: starSize * 1.5
Layout.rightMargin: starSize * 0.5
Layout.rightMargin: !LayoutMirroring.enabled ? (starSize * 0.5) : 0
Layout.leftMargin: LayoutMirroring.enabled ? (starSize * 0.5) : 0
Image {
width: starSize * 1.5
......
......@@ -50,7 +50,8 @@ Rectangle {
text: item ? item.message : ""
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.alignment: Qt.AlignHCenter
visible: topItem.height > height
......@@ -63,7 +64,8 @@ Rectangle {
text: item ? item.mainButtonText : ""
iconName: item ? item.mainButtonIconName : ""
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.alignment: Qt.AlignHCenter
Layout.maximumHeight: elisaTheme.delegateHeight
......@@ -79,7 +81,8 @@ Rectangle {
text: item ? item.secondaryButtonText : ""
iconName: item ? item.secondaryButtonIconName: ""
Layout.leftMargin: elisaTheme.layoutHorizontalMargin
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.alignment: Qt.AlignHCenter
Layout.maximumHeight: elisaTheme.delegateHeight
......
......@@ -30,6 +30,9 @@ Item {
implicitWidth: 400
implicitHeight: 200
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
ConfigModule.buttons: ConfigModule.Help|ConfigModule.Apply
SystemPalette {
......@@ -121,7 +124,8 @@ Item {
ColumnLayout {
Layout.fillHeight: true
Layout.leftMargin: 0.3 * 30
Layout.leftMargin: !LayoutMirroring.enabled ? (0.3 * 30) : 0
Layout.rightMargin: LayoutMirroring.enabled ? (0.3 * 30) : 0
Button {
text: i18n("Add new path")
......
......@@ -50,7 +50,7 @@ Item {
iconicThumbnailSource: (headerBarManager.image.toString() !== '' ? headerBarManager.image : Qt.resolvedUrl(elisaTheme.albumCover))
ThumbnailToolButton {
iconSource: Qt.resolvedUrl(elisaTheme.skipBackwardIcon)
iconSource: Qt.resolvedUrl(LayoutMirroring.enabled ? elisaTheme.skipForwardIcon : elisaTheme.skipBackwardIcon)
onClicked: playListControler.skipPreviousTrack()
enabled: manageMediaPlayerControl.skipBackwardControlEnabled
}
......@@ -62,7 +62,7 @@ Item {
}
ThumbnailToolButton {
iconSource: Qt.resolvedUrl(elisaTheme.skipForwardIcon)
iconSource: Qt.resolvedUrl(LayoutMirroring.enabled ? elisaTheme.skipBackwardIcon : elisaTheme.skipForwardIcon)
onClicked: playListControler.skipNextTrack()
enabled: manageMediaPlayerControl.skipForwardControlEnabled
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment