1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-06 02:32:44 +00:00

Code deduplication and bug fix

Deduplicated code in the NarrowAlbumCover and WideAlbumCover.

Additionally, this fixes a bug where the NarrowAlbumCover would behave
wrongly with album covers with an aspect ratio not equal to 1.0.

Resolves #22
This commit is contained in:
Chris Josten 2022-07-23 20:01:23 +02:00
parent 4a178ee227
commit 985a65154a
No known key found for this signature in database
GPG key ID: A69C050E9FD9FF6A
3 changed files with 44 additions and 68 deletions

View file

@ -30,16 +30,12 @@ import "../.."
Column {
id: wideAlbumCover
property ListView listview
property real releaseYear
property alias albumArt: albumArt.source
property string albumArtist
property real duration
property int songCount
property string name
property alias blurhash : albumArt.blurhash
property bool twoColumns: true
property real aspectRatio
property string type
property string description
Item { width:1; height: Theme.paddingLarge }
@ -54,21 +50,6 @@ Column {
leftMargin: 0
rightMargin: 0
title: name
description: {
if (wideAlbumCover.type == "MusicAlbum") {
//: Short description of the album: %1 -> album artist, %2 -> amount of songs, %3 -> duration, %4 -> release year
qsTr("%1\n%2 songs | %3 | %4")
.arg(albumArtist)
.arg(songCount)
.arg(Utils.ticksToText(duration))
//: Unknown album release year
.arg(releaseYear >= 0 ? releaseYear : qsTr("Unknown year"))
} else {
//: Playlist header: %1 -> amount of songs in the playlist, %2 -> Total duration
qsTr("Playlist\n%1 songs | %2")
.arg(songCount)
.arg(Utils.ticksToText(duration))
}
}
description: wideAlbumCover.description
}
}