mirror of https://github.com/KDE/kasts.git
Optimize image loading (partially) and improve QueueDelegate
This commit is contained in:
parent
ddb64c5f42
commit
5efd4f85f8
|
@ -32,7 +32,7 @@ QVariant EntriesModel::data(const QModelIndex &index, int role) const
|
|||
{
|
||||
if (role != 0)
|
||||
return QVariant();
|
||||
qDebug() << "fetching item" << index.row();
|
||||
//qDebug() << "fetching item" << index.row();
|
||||
return QVariant::fromValue(DataManager::instance().getEntry(m_feed, index.row()));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,15 @@ import org.kde.alligator 1.0
|
|||
Kirigami.SwipeListItem {
|
||||
|
||||
contentItem: RowLayout {
|
||||
Kirigami.Icon {
|
||||
source: entry.image === "" ? "rss" : Fetcher.image(entry.image)
|
||||
height: parent.height
|
||||
width: height
|
||||
Image {
|
||||
asynchronous: true
|
||||
source: entry.image === "" ? "rss" : "file://"+Fetcher.image(entry.image)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
property int size: Kirigami.Units.iconSizes.medium
|
||||
Layout.maximumHeight: size
|
||||
Layout.maximumWidth: size
|
||||
sourceSize.width: size
|
||||
sourceSize.height: size
|
||||
}
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
|
|
|
@ -20,15 +20,15 @@ Kirigami.SwipeListItem {
|
|||
contentItem: Kirigami.BasicListItem {
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
text: model.feed.name
|
||||
icon: model.feed.refreshing ? "view-refresh" : model.feed.image === "" ? "rss" : Fetcher.image(model.feed.image)
|
||||
iconSize: Kirigami.Units.iconSizes.large
|
||||
subtitle: i18np("%1 unread entry", "%1 unread entries", model.feed.unreadEntryCount)
|
||||
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)
|
||||
|
||||
onClicked: {
|
||||
lastFeed = model.feed.url
|
||||
lastFeed = feed.url
|
||||
|
||||
pageStack.push("qrc:/EntryListPage.qml", {"feed": model.feed})
|
||||
pageStack.push("qrc:/EntryListPage.qml", {"feed": feed})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ Kirigami.SwipeListItem {
|
|||
Kirigami.Action {
|
||||
icon.name: "delete"
|
||||
onTriggered: {
|
||||
if(pageStack.depth > 1 && model.feed.url === lastFeed)
|
||||
if(pageStack.depth > 1 && feed.url === lastFeed)
|
||||
while(pageStack.depth > 1)
|
||||
pageStack.pop()
|
||||
feedsModel.removeFeed(index)
|
||||
|
|
|
@ -22,21 +22,33 @@ Kirigami.SwipeListItem {
|
|||
listView: queueList
|
||||
onMoveRequested: DataManager.moveQueueItem(oldIndex, newIndex)
|
||||
}
|
||||
Kirigami.Icon {
|
||||
source: entry.image === "" ? "rss" : Fetcher.image(entry.image)
|
||||
property int size: Kirigami.Units.iconSizes.medium
|
||||
Layout.minimumHeight: size
|
||||
Layout.minimumWidth: size
|
||||
Image {
|
||||
asynchronous: true
|
||||
source: entry.image === "" ? "rss" : "file://"+Fetcher.image(entry.image)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
property int size: Kirigami.Units.gridUnit * 3
|
||||
sourceSize.width: size
|
||||
sourceSize.height: size
|
||||
Layout.maximumHeight: size
|
||||
Layout.maximumWidth: size
|
||||
Layout.rightMargin:Kirigami.Units.smallSpacing
|
||||
}
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Controls.Label {
|
||||
text: entry.updated.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + (entry.enclosure ? " · " + Math.floor(entry.enclosure.size/(1024*1024)) + "MB" : "")
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font: Kirigami.Theme.smallFont
|
||||
opacity: 0.7
|
||||
}
|
||||
Controls.Label {
|
||||
text: entry.title
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font.weight: entry.read ? Font.Normal : Font.Bold
|
||||
font.weight: Font.Normal
|
||||
opacity: 1
|
||||
}
|
||||
Loader {
|
||||
|
@ -45,11 +57,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: 0.7
|
||||
visible: !downloadProgress.visible
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +92,7 @@ Kirigami.SwipeListItem {
|
|||
audio.entry = entry
|
||||
audio.play()
|
||||
}
|
||||
visible: entry.enclosure && entry.enclosure.status === Enclosure.Downloaded
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Download")
|
||||
|
|
Loading…
Reference in New Issue