Work on EntryList qml (WIP)

This commit is contained in:
Bart De Vries 2021-04-08 00:03:49 +02:00
parent e092354696
commit df9dd521f3
2 changed files with 106 additions and 8 deletions

View File

@ -19,22 +19,40 @@ Kirigami.SwipeListItem {
asynchronous: true
source: entry.image === "" ? "rss" : "file://"+Fetcher.image(entry.image)
fillMode: Image.PreserveAspectFit
property int size: Kirigami.Units.iconSizes.medium
property int size: Kirigami.Units.gridUnit * 3
Layout.maximumHeight: size
Layout.maximumWidth: size
sourceSize.width: size
sourceSize.height: size
Layout.rightMargin: Kirigami.Units.smallSpacing
}
ColumnLayout {
spacing: 0
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
RowLayout{
Kirigami.Icon {
Layout.maximumHeight: 0.7 * supertitle.implicitHeight
Layout.maximumWidth: 0.7 * supertitle.implicitHeight
source: "source-playlist"
visible: entry.queueStatus
opacity: (entry.read) ? 0.4 : 0.7
}
Controls.Label {
id: supertitle
text: (entry.queueStatus ? "· " : "") + entry.updated.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + (entry.enclosure ? ( entry.enclosure.size !== 0 ? " · " + Math.floor(entry.enclosure.size/(1024*1024)) + "MB" : "") : "" )
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: (entry.read) ? 0.4 : 0.7
}
}
Controls.Label {
text: entry.title
Layout.fillWidth: true
elide: Text.ElideRight
font.weight: entry.read ? Font.Normal : Font.Bold
opacity: 1
font.weight: Font.Normal
opacity: (entry.read) ? 0.6 : 1
}
Loader {
sourceComponent: entry.enclosure && entry.enclosure.status === Enclosure.Downloading ? downloadProgress : subtitle
@ -42,11 +60,11 @@ Kirigami.SwipeListItem {
Component {
id: subtitle
Controls.Label {
text: entry.updated.toLocaleString(Qt.locale(), Locale.ShortFormat) + (entry.authors.length === 0 ? "" : " " + i18nc("by <author(s)>", "by") + " " + entry.authors[0].name)
text: (Math.floor(entry.enclosure.duration/3600) < 10 ? "0" : "") + Math.floor(entry.enclosure.duration/3600) + ":" + (Math.floor(entry.enclosure.duration/60) % 60 < 10 ? "0" : "") + Math.floor(entry.enclosure.duration/60) % 60 + ":" + (Math.floor(entry.enclosure.duration) % 60 < 10 ? "0" : "") + Math.floor(entry.enclosure.duration) % 60
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: entry.read ? 0.7 : 0.9
opacity: (entry.read) ? 0.4 : 0.7
visible: !downloadProgress.visible
}
}

View File

@ -7,6 +7,7 @@
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
@ -77,9 +78,88 @@ Kirigami.ScrollablePage {
sourceComponent: entryListDelegate
}
onOriginYChanged: contentY = originY
onOriginYChanged: contentY = originY // Why is this needed?
header: ColumnLayout {
headerPositioning: ListView.OverlayHeader
header: Item {
//anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
height: Kirigami.Units.gridUnit * 12
MouseArea {
anchors.fill: parent
onClicked: {
while(pageStack.depth > 2)
pageStack.pop()
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": feed})
}
}
Image {
id: backgroundimage
source: page.feed.image === "" ? "rss" : "file://"+Fetcher.image(page.feed.image)
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
asynchronous: true
}
GaussianBlur {
id: blur
anchors.fill: backgroundimage
source: backgroundimage
radius: 12
samples: 16
deviation: 6
}
ColorOverlay {
anchors.fill: blur
source: blur
color:"#87000000" //RGBA, but first value is actually the alpha channel
}
RowLayout {
property int size: Kirigami.Units.gridUnit * 7
property int margin: Kirigami.Units.gridUnit * 2
height: size
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: margin
anchors.rightMargin: margin
anchors.bottomMargin: margin
Image {
id: frontimage
source: page.feed.image === "" ? "rss" : "file://"+Fetcher.image(page.feed.image)
Layout.maximumHeight: parent.size
Layout.maximumWidth: parent.size
asynchronous: true
}
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: parent.margin/2
Controls.Label {
Layout.fillWidth: true
text: page.feed.name
font.pointSize: 18
horizontalAlignment: Text.AlignLeft
color: "white"
opacity: 1
wrapMode: Text.WordWrap
}
Controls.Label {
Layout.fillWidth: true
text: page.feed.authors.length === 0 ? "" : i18nc("by <author(s)>", "by") + " " + page.feed.authors[0].name
font.pointSize: 14
horizontalAlignment: Text.AlignLeft
color: "white"
opacity: 1
wrapMode: Text.WordWrap
}
}
}
}
/* ColumnLayout {
width: parent.width
spacing: 0
@ -122,6 +202,6 @@ Kirigami.ScrollablePage {
}
}
}
}
}*/
}
}