Commit 15438e08 authored by Safa AlFulaij's avatar Safa AlFulaij Committed by Alexander Stippich
Browse files

Various general and RTL fixes

Reviewers: #elisa, astippich

Reviewed By: #elisa, astippich

Subscribers: astippich, mgallien

Tags: #elisa

Differential Revision: https://phabricator.kde.org/D10144
parent c02ecfed
......@@ -41,7 +41,7 @@ ApplicationWindow {
width: persistentSettings.width
height: persistentSettings.height
title: 'Elisa'
title: i18n("Elisa")
property var goBackAction: elisa.action("go_back")
......
......@@ -146,6 +146,8 @@ FocusScope {
id: replaceAndPlayButton
objectName: 'replaceAndPlayButton'
scale: LayoutMirroring.enabled ? -1 : 1
action: replaceAndPlayAction
width: elisaTheme.delegateToolButtonSize
......
......@@ -228,6 +228,11 @@ FocusScope {
}
}
TextMetrics {
id: durationTextMetrics
text: i18nc("This is used to preserve a fixed width for the duration text.", "00:00:00")
}
LabelWithToolTip {
id: positionLabel
......@@ -239,8 +244,10 @@ FocusScope {
Layout.fillHeight: true
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.preferredWidth: durationTextMetrics.width+5 // be in the safe side
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignRight
ProgressIndicator {
id: timeIndicator
......@@ -323,8 +330,10 @@ FocusScope {
Layout.fillHeight: true
Layout.rightMargin: !LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 10) : 0
Layout.leftMargin: LayoutMirroring.enabled ? (elisaTheme.layoutHorizontalMargin * 10) : 0
Layout.preferredWidth: durationTextMetrics.width
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
ProgressIndicator {
id: durationIndicator
......
......@@ -133,20 +133,36 @@ FocusScope {
visible: !detailedView
text: {
var text = "<b>";
text += (trackNumber > 0) ? trackNumber + "-" : "";
text += title + "</b>";
text += (artist !== albumArtist) ? " - <i>" + artist + "</i>" : "";
return text;
if (trackNumber > 0) {
if (artist !== albumArtist)
return i18nc("%1: track number. %2: track title. %3: artist name",
"<b>%1-%2</b> - <i>%3</i>",
Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0),
title, artist);
else
return i18nc("%1: track number. %2: track title.",
"<b>%1-%2</b>",
Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0),
title);
} else {
if (artist !== albumArtist)
return i18nc("%1: track title. %2: artist name",
"<b>%1</b> - <i>%2</i>",
title, artist);
else
return i18nc("%1: track title",
"<b>%1</b>",
title);
}
}
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
color: myPalette.text
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true
Layout.leftMargin: {
if (!LayoutMirroring.enabled)
return (!isSingleDiscAlbum ? elisaTheme.layoutHorizontalMargin * 4 : elisaTheme.layoutHorizontalMargin)
......@@ -159,10 +175,6 @@ FocusScope {
else
return 0
}
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true
elide: Text.ElideRight
}
Item {
......@@ -213,7 +225,15 @@ FocusScope {
LabelWithToolTip {
id: mainLabelDetailed
text: (trackNumber > -1) ? trackNumber + ' - ' + title : title
text: {
if (trackNumber > -1) {
return i18nc("%1: track number. %2: track title", "%1 - %2",
Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0), title);
} else {
return title;
}
}
horizontalAlignment: Text.AlignLeft
font.weight: Font.Bold
......@@ -285,6 +305,8 @@ FocusScope {
ToolButton {
id: clearAndEnqueueButton
scale: LayoutMirroring.enabled ? -1 : 1
height: elisaTheme.delegateHeight
width: elisaTheme.delegateHeight
......@@ -303,6 +325,11 @@ FocusScope {
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
}
TextMetrics {
id: durationTextMetrics
text: i18nc("This is used to preserve a fixed width for the duration text.", "00:00")
}
LabelWithToolTip {
id: durationLabel
......@@ -312,10 +339,12 @@ FocusScope {
color: myPalette.text
elide: Text.ElideRight
horizontalAlignment: Text.AlignRight
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.preferredWidth: durationTextMetrics.width+1 // be in the safe side
}
}
}
......
......@@ -74,6 +74,10 @@ Dialog {
anchors.fill: parent
spacing: 0
// This is needed since Dialog doesn't inherit from Item
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
ListView {
id: trackData
......@@ -95,7 +99,8 @@ Dialog {
Layout.preferredWidth: trackData.width * 0.3
Layout.minimumHeight: textSize.height
Layout.rightMargin: elisaTheme.layoutHorizontalMargin
Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
}
Text {
......
......@@ -249,7 +249,19 @@ FocusScope {
LabelWithToolTip {
id: mainCompactLabel
text: (trackNumber > -1 ? (((discNumber && !isSingleDiscAlbum) ? discNumber + ' - ' + trackNumber : trackNumber) + ' - ' + title) : title)
text: {
if (trackNumber > -1) {
if (discNumber && !isSingleDiscAlbum)
return i18nc("%1: disk number. %2: track number. %3: track title", "%1 - %2 - %3",
Number(discNumber).toLocaleString(Qt.locale(), 'f', 0),
Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0), title);
else
return i18nc("%1: track number. %2: track title", "%1 - %2",
Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0), title);
} else {
return title;
}
}
font.weight: (isPlaying ? Font.Bold : Font.Normal)
color: myPalette.text
......@@ -261,6 +273,7 @@ FocusScope {
visible: isValid
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
}
LabelWithToolTip {
......@@ -306,6 +319,7 @@ FocusScope {
implicitWidth: elisaTheme.smallDelegateToolButtonSize
opacity: 0
scale: LayoutMirroring.enabled ? -1 : 1 // We can mirror the symmetrical pause icon
visible: opacity > 0.1
action: !(isPlaying == MediaPlayList.IsPlaying) ? playNow : pauseNow
......@@ -395,14 +409,23 @@ FocusScope {
starSize: elisaTheme.ratingStarSize
}
TextMetrics {
id: durationTextMetrics
text: i18nc("This is used to preserve a fixed width for the duration text.", "00:00")
}
LabelWithToolTip {
id: durationLabel
text: duration
color: myPalette.text
elide: Text.ElideRight
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.preferredWidth: durationTextMetrics.width+1 // be in the safe side
horizontalAlignment: Text.AlignRight
}
}
}
......
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