Solve issue of filter InlineMessages not showing up

This commit is contained in:
Bart De Vries 2023-01-20 16:54:36 +01:00
parent 9ead23ff59
commit db41655c5f
5 changed files with 92 additions and 100 deletions

View File

@ -34,31 +34,29 @@ Kirigami.ScrollablePage {
contextualActions: episodeList.defaultActionList
Kirigami.PlaceholderMessage {
visible: episodeList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18n("No Downloads")
}
Component {
id: episodeListDelegate
GenericEntryDelegate {
listView: episodeList
isDownloads: true
}
}
GenericEntryListView {
id: episodeList
visible: count !== 0
isDownloads: true
reuseItems: true
Kirigami.PlaceholderMessage {
visible: episodeList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18n("No Downloads")
}
model: DownloadModel
delegate: episodeListDelegate
delegate: Component {
id: episodeListDelegate
GenericEntryDelegate {
listView: episodeList
isDownloads: true
}
}
section {
delegate: Kirigami.ListSectionHeader {

View File

@ -14,7 +14,7 @@ import org.kde.kirigami 2.19 as Kirigami
import org.kde.kasts 1.0
Kirigami.ScrollablePage {
id: episodeListPage
title: i18n("Episode List")
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
@ -51,6 +51,63 @@ Kirigami.ScrollablePage {
visible: episodeProxyModel.filterType == EpisodeProxyModel.NoFilter
}
contextualActions: episodeList.defaultActionList
GenericEntryListView {
id: episodeList
anchors.fill: parent
reuseItems: true
Kirigami.PlaceholderMessage {
visible: episodeList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18n("No Episodes Available")
}
model: EpisodeProxyModel {
id: episodeProxyModel
}
delegate: Component {
id: episodeListDelegate
GenericEntryDelegate {
listView: episodeList
}
}
Kirigami.InlineMessage {
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
margins: Kirigami.Units.largeSpacing
bottomMargin: Kirigami.Units.largeSpacing + ( errorNotification.visible ? errorNotification.height + Kirigami.Units.largeSpacing : 0 ) + ( updateNotification.visible ? updateNotification.height + Kirigami.Units.largeSpacing : 0 ) + ( updateSyncNotification.visible ? updateSyncNotification.height + Kirigami.Units.largeSpacing : 0 )
}
type: Kirigami.MessageType.Information
visible: episodeProxyModel.filterType != EpisodeProxyModel.NoFilter
text: textMetrics.text
width: Math.min(textMetrics.width + 2 * Kirigami.Units.largeSpacing + 10 * Kirigami.Units.gridUnit, parent.width - anchors.leftMargin - anchors.rightMargin)
actions: [
Kirigami.Action {
id: resetButton
icon.name: "edit-delete-remove"
text: i18n("Reset")
onTriggered: {
episodeProxyModel.filterType = EpisodeProxyModel.NoFilter;
}
}
]
TextMetrics {
id: textMetrics
text: i18n("Filter Active: ") + episodeProxyModel.filterName
}
}
}
Kirigami.Dialog {
id: filterTypeOverlay
@ -90,64 +147,4 @@ Kirigami.ScrollablePage {
}
}
}
Kirigami.InlineMessage {
z: 2
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
margins: Kirigami.Units.largeSpacing
bottomMargin: Kirigami.Units.largeSpacing + ( errorNotification.visible ? errorNotification.height + Kirigami.Units.largeSpacing : 0 ) + ( updateNotification.visible ? updateNotification.height + Kirigami.Units.largeSpacing : 0 ) + ( updateSyncNotification.visible ? updateSyncNotification.height + Kirigami.Units.largeSpacing : 0 )
}
type: Kirigami.MessageType.Information
visible: episodeProxyModel.filterType != EpisodeProxyModel.NoFilter
TextMetrics {
id: textMetrics
text: i18n("Filter Active: ") + episodeProxyModel.filterName
}
text: textMetrics.text
width: Math.min(textMetrics.width + 2 * Kirigami.Units.largeSpacing + 10 * Kirigami.Units.gridUnit, parent.width - anchors.leftMargin - anchors.rightMargin)
actions: [
Kirigami.Action {
id: resetButton
icon.name: "edit-delete-remove"
text: i18n("Reset")
onTriggered: {
episodeProxyModel.filterType = EpisodeProxyModel.NoFilter;
}
}
]
}
contextualActions: episodeList.defaultActionList
Kirigami.PlaceholderMessage {
visible: episodeList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18n("No Episodes Available")
}
Component {
id: episodeListDelegate
GenericEntryDelegate {
listView: episodeList
}
}
EpisodeProxyModel {
id: episodeProxyModel
}
GenericEntryListView {
id: episodeList
anchors.fill: parent
visible: count !== 0
reuseItems: true
model: episodeProxyModel
delegate: episodeListDelegate
}
}

View File

@ -80,7 +80,6 @@ Kirigami.ScrollablePage {
GenericEntryListView {
id: entryList
visible: true
reuseItems: true
currentIndex: -1

View File

@ -15,7 +15,6 @@ import org.kde.kasts 1.0
ListView {
id: listView
visible: count !== 0
clip: true
property bool isQueue: false
property bool isDownloads: false

View File

@ -40,29 +40,20 @@ Kirigami.ScrollablePage {
contextualActions: queueList.defaultActionList
Kirigami.PlaceholderMessage {
visible: queueList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18nc("@info", "Queue is empty")
}
Component {
id: delegateComponent
GenericEntryDelegate {
isQueue: true
listView: queueList
}
}
GenericEntryListView {
id: queueList
isQueue: true
visible: count !== 0
anchors.fill: parent
Kirigami.PlaceholderMessage {
visible: queueList.count === 0
width: Kirigami.Units.gridUnit * 20
anchors.centerIn: parent
text: i18nc("@info", "Queue is empty")
}
header: ColumnLayout {
anchors.right: parent.right
anchors.left: parent.left
@ -80,6 +71,14 @@ Kirigami.ScrollablePage {
id: queueModel
}
Component {
id: delegateComponent
GenericEntryDelegate {
isQueue: true
listView: queueList
}
}
delegate: Kirigami.DelegateRecycler {
width: queueList.width
sourceComponent: delegateComponent