diff --git a/src/qml/ElisaMainWindow.qml b/src/qml/ElisaMainWindow.qml --- a/src/qml/ElisaMainWindow.qml +++ b/src/qml/ElisaMainWindow.qml @@ -42,7 +42,7 @@ width: persistentSettings.width height: persistentSettings.height - title: 'Elisa' + title: i18n("Elisa") property var helpAction: elisa.action("help_contents") property var quitApplication: elisa.action("file_quit") diff --git a/src/qml/GridBrowserDelegate.qml b/src/qml/GridBrowserDelegate.qml --- a/src/qml/GridBrowserDelegate.qml +++ b/src/qml/GridBrowserDelegate.qml @@ -146,6 +146,8 @@ id: replaceAndPlayButton objectName: 'replaceAndPlayButton' + scale: LayoutMirroring.enabled ? -1 : 1 + action: replaceAndPlayAction width: elisaTheme.delegateToolButtonSize diff --git a/src/qml/MediaPlayerControl.qml b/src/qml/MediaPlayerControl.qml --- a/src/qml/MediaPlayerControl.qml +++ b/src/qml/MediaPlayerControl.qml @@ -228,6 +228,11 @@ } } + 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 @@ 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 @@ 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 diff --git a/src/qml/MediaTrackDelegate.qml b/src/qml/MediaTrackDelegate.qml --- a/src/qml/MediaTrackDelegate.qml +++ b/src/qml/MediaTrackDelegate.qml @@ -133,20 +133,33 @@ visible: !detailedView text: { - var text = ""; - - text += (trackNumber > 0) ? trackNumber + "-" : ""; - text += title + ""; - - text += (artist !== albumArtist) ? " - " + artist + "" : ""; + var trackNumberString = i18nc("This is the track number substring in the next string", + "%1-", + Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0)); + + var artistString = i18nc("This is the artist substring in the next string", + " - %1", artist); + + // i18n: Possible combinations: + // 1-Title - Artist + // 1-Title + // Title - Artist + // Title + var text = i18nc("%1: track number string above (if exists). %2: track title. %3: artist string above (if applicable).", + "%1%2%3", // \u2023 + (trackNumber > 0) ? trackNumberString : "", title, + (artist !== albumArtist) ? artistString : ""); return text; } + 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 +172,6 @@ else return 0 } - Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter - Layout.fillWidth: true - - elide: Text.ElideRight } Item { @@ -213,7 +222,21 @@ LabelWithToolTip { id: mainLabelDetailed - text: (trackNumber > -1) ? trackNumber + ' - ' + title : title + text: { + var trackNumberString = i18nc("This is the track number substring in the next string", + "%1 - ", + Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0)); + + // i18n: Possible combinations: + // 1 - Title + // Title + var text = i18nc("%1: tracknumber string above (if exists). %2: track title", + "%1%2", // \u2023 + (trackNumber > -1) ? trackNumberString : "", title) + + return text; + } + horizontalAlignment: Text.AlignLeft font.weight: Font.Bold @@ -285,6 +308,8 @@ ToolButton { id: clearAndEnqueueButton + scale: LayoutMirroring.enabled ? -1 : 1 + height: elisaTheme.delegateHeight width: elisaTheme.delegateHeight @@ -303,6 +328,11 @@ 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 +342,12 @@ 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+5 // be in the safe side } } } diff --git a/src/qml/MediaTrackMetadataView.qml b/src/qml/MediaTrackMetadataView.qml --- a/src/qml/MediaTrackMetadataView.qml +++ b/src/qml/MediaTrackMetadataView.qml @@ -74,6 +74,10 @@ 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 @@ 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 { diff --git a/src/qml/PlayListEntry.qml b/src/qml/PlayListEntry.qml --- a/src/qml/PlayListEntry.qml +++ b/src/qml/PlayListEntry.qml @@ -249,18 +249,35 @@ LabelWithToolTip { id: mainCompactLabel - text: (trackNumber > -1 ? (((discNumber && !isSingleDiscAlbum) ? discNumber + ' - ' + trackNumber : trackNumber) + ' - ' + title) : title) + text: { + var trackNumberString = i18nc("This is the track number substring in the next string", + "%1 - ", + Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0)); + + var trackDiskString = i18nc("This is the track-disk substring in the next string", + "%1 - %2 - ", + Number(discNumber).toLocaleString(Qt.locale(), 'f', 0), + Number(trackNumber).toLocaleString(Qt.locale(), 'f', 0)); + + // i18n: Possible combinations + // 1 - 2 - Title + // 2 - Title + // Title + var text = i18nc("%1: one of track number or track-disk strings above (if exists). %2: track title", + "%1%2", // \u2023 + (trackNumber > -1) ? ((discNumber && !isSingleDiscAlbum) ? trackDiskString : trackNumberString) : "" + } font.weight: (isPlaying ? Font.Bold : Font.Normal) color: myPalette.text Layout.maximumWidth: mainCompactLabel.implicitWidth + 1 - Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft visible: isValid elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft } LabelWithToolTip { @@ -306,6 +323,7 @@ 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 +413,23 @@ 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+5 // be in the safe side + + horizontalAlignment: Text.AlignRight } } }