Redesign feedlistpage and feedlistdelegate

This commit is contained in:
Bart De Vries 2021-04-21 10:46:30 +02:00
parent 3870338e65
commit 2b5597cbd6
2 changed files with 72 additions and 19 deletions

View File

@ -1,5 +1,6 @@
/**
* SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
* SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
@ -7,32 +8,72 @@
import QtQuick 2.14
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import QtGraphicalEffects 1.15
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kirigami 2.15 as Kirigami
import org.kde.alligator 1.0
Kirigami.SwipeListItem {
Item {
leftPadding: 0
rightPadding: 0
property int cardSize
property int cardMargin
contentItem: Kirigami.BasicListItem {
anchors.top: parent.top
anchors.bottom: parent.bottom
text: feed.name
icon: feed.refreshing ? "view-refresh" : feed.image === "" ? "rss" : Fetcher.image(feed.image)
iconSize: Kirigami.Units.iconSizes.medium
subtitle: i18np("%1 unread entry", "%1 unread entries", feed.unreadEntryCount)
Image {
id: img
asynchronous: true
source: feed.image === "" ? "logo.png" : "file://"+Fetcher.image(feed.image)
fillMode: Image.PreserveAspectFit
x: cardMargin
y: cardMargin
sourceSize.width: cardSize
sourceSize.height: cardSize
height: cardSize - cardMargin
width: cardSize - cardMargin
//layer.enabled: true
layer.effect: OpacityMask {
maskSource: Item {
width: img.width
height: img.height
Rectangle {
anchors.centerIn: parent
width: img.adapt ? img.width : Math.min(img.width, img.height)
height: img.adapt ? img.height : width
radius: Math.min(width, height)/5
}
}
}
MouseArea {
anchors.fill: parent
onClicked: {
lastFeed = feed.url
pageStack.push("qrc:/EntryListPage.qml", {"feed": feed})
}
}
}
actions: [
Rectangle {
id: rectangle
visible: feed.unreadEntryCount > 0
anchors.top: img.top
anchors.right: img.right
width: img.width/5
height: img.height/5
color: Kirigami.Theme.highlightColor
}
Controls.Label {
id: countLabel
visible: feed.unreadEntryCount > 0
anchors.centerIn: rectangle
anchors.margins: Kirigami.Units.smallSpacing
text: feed.unreadEntryCount
font.bold: true
color: Kirigami.Theme.highlightedTextColor
}
/*actions: [
Kirigami.Action {
icon.name: "delete"
onTriggered: {
@ -43,6 +84,6 @@ Kirigami.SwipeListItem {
}
}
]
]*/
}

View File

@ -1,5 +1,6 @@
/**
* SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
* SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
@ -14,6 +15,7 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.alligator 1.0
Kirigami.ScrollablePage {
id: subscriptionPage
title: i18n("Subscriptions")
property var lastFeed: ""
@ -66,15 +68,25 @@ Kirigami.ScrollablePage {
text: i18n("No Feeds added yet")
}
ListView {
GridView {
id: feedList
visible: count !== 0
anchors.fill: parent
property int cardSize: width/3 - cardMargin //Kirigami.Units.gridUnit * 10
property int cardMargin: Kirigami.Units.smallSpacing
cellWidth: cardSize + cardMargin
cellHeight: cardSize + cardMargin
model: FeedsModel {
id: feedsModel
}
delegate: FeedListDelegate { }
delegate: FeedListDelegate {
cardSize: feedList.cardSize
cardMargin: feedList.cardMargin
}
}
FileDialog {