Skip to content

Commit

Permalink
Improved design in Card View (#10)
Browse files Browse the repository at this point in the history
* Improved design in Card View

* Revert performance regression
  • Loading branch information
nicolascolla authored Dec 6, 2022
1 parent cb2ccbe commit 70ebe29
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 213 deletions.
9 changes: 5 additions & 4 deletions app/components/Card.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AbstractButton {

Image {
id: imgFrame
width: parent.width/1.2
width: parent.width
height: width
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
Expand All @@ -40,9 +40,10 @@ AbstractButton {

Loader {
id: hintLoader
anchors.verticalCenter: parent.top
anchors.top: parent.top
anchors.topMargin: units.gu(0.5)
anchors.right: parent.right
anchors.rightMargin: units.gu(-0.5)
anchors.rightMargin: units.gu(0.5)
sourceComponent: secondaryText !== "" ? hintComponent : undefined
}

Expand All @@ -52,7 +53,7 @@ AbstractButton {
color: podbird.appTheme.focusText
width: secondaryLabel.implicitWidth + units.gu(1)
height: secondaryLabel.implicitHeight + units.gu(1)
radius: units.gu(0.5)
radius: units.gu(3)
visible: secondaryLabel.text !== ""
Label {
id: secondaryLabel
Expand Down
6 changes: 3 additions & 3 deletions app/components/CardView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ GridView {

anchors {
fill: parent
margins: units.gu(1)
margins: units.gu(0)
}

cellHeight: cellSize + heightOffset
cellWidth: cellSize + widthOffset

header: Item {
width: parent.width
height: units.gu(2)
height: units.gu(0)
}

readonly property int columns: parseInt(width / itemWidth) || 1 // never drop to 0
readonly property int cellSize: width / columns
property int itemWidth: units.gu(15)
property int itemWidth: units.gu(13)
property int heightOffset: 0
property int widthOffset: 0

Expand Down
11 changes: 6 additions & 5 deletions app/ui/PodcastsTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ Page {

CardView {
id: cardView
clip: true
heightOffset: units.gu(4)
clip: false
heightOffset: units.gu(0)
widthOffset: units.gu(0)
model: sortedPodcastModel
delegate: Card {
id: albumCard
coverArt: model.image !== undefined ? model.image : Qt.resolvedUrl("../graphics/logo.png")
primaryText: model.name !== undefined ? model.name.trim() : "Undefined"
coverArt: model.image !== undefined ? model.image : Qt.resolvedUrl("../graphics/podbird.png")
secondaryText: model.episodeCount > 0 ? model.episodeCount
: ""
onClicked: {
Expand Down Expand Up @@ -217,7 +217,7 @@ Page {
Image {
height: width
width: units.gu(6)
source: model.image !== undefined ? model.image : Qt.resolvedUrl("../graphics/logo.png")
source: model.image !== undefined ? model.image : Qt.resolvedUrl("../graphics/podbird.png")
SlotsLayout.position: SlotsLayout.Leading
sourceSize { width: width; height: height }
}
Expand Down Expand Up @@ -293,3 +293,4 @@ Page {
Podcasts.updateEpisodes(refreshModel)
}
}

Loading

0 comments on commit 70ebe29

Please sign in to comment.