Refactor the feed images

This commit is contained in:
Tobias Fella 2020-07-20 17:19:53 +02:00
parent d6e65e4fab
commit 88eab5b96f
4 changed files with 56 additions and 35 deletions

View File

@ -41,23 +41,8 @@ ColumnLayout {
width: parent.width width: parent.width
height: root.height * 0.2 height: root.height * 0.2
Item { FeedImage {
id: icon feed: page.feed
width: height
height: parent.height
Kirigami.Icon {
source: Fetcher.image(page.feed.image)
width: height
height: parent.height
visible: !busy.visible
}
Controls.BusyIndicator {
id: busy
width: height
height: parent.height
visible: page.feed.refreshing
}
} }
ColumnLayout { ColumnLayout {

48
src/qml/FeedImage.qml Normal file
View File

@ -0,0 +1,48 @@
/**
* Copyright 2020 Tobias Fella <fella@posteo.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.14
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.14
import org.kde.kirigami 2.12 as Kirigami
import org.kde.alligator 1.0
Item {
id: icon
width: height
height: parent.height
property QtObject feed
Kirigami.Icon {
source: Fetcher.image(feed.image)
width: height
height: parent.height
visible: !busy.visible
}
Controls.BusyIndicator {
id: busy
width: height
height: parent.height
visible: feed.refreshing
}
}

View File

@ -30,27 +30,14 @@ Kirigami.SwipeListItem {
height: Kirigami.Units.gridUnit*2 height: Kirigami.Units.gridUnit*2
Item { Item {
Item { FeedImage {
id: icon id: image
width: height feed: model.feed
height: parent.height
Kirigami.Icon {
source: Fetcher.image(model.feed.image)
width: height
height: parent.height
visible: !busy.visible
}
Controls.BusyIndicator {
id: busy
width: height
height: parent.height
visible: model.feed.refreshing
}
} }
Controls.Label { Controls.Label {
text: model.feed.name text: model.feed.name
height: parent.height height: parent.height
anchors.left: icon.right anchors.left: image.right
leftPadding: 0.5*Kirigami.Units.gridUnit leftPadding: 0.5*Kirigami.Units.gridUnit
} }
} }
@ -71,4 +58,4 @@ Kirigami.SwipeListItem {
lastFeed = model.feed.url lastFeed = model.feed.url
pageStack.push("qrc:/EntryListPage.qml", {"feed": model.feed}) pageStack.push("qrc:/EntryListPage.qml", {"feed": model.feed})
} }
} }

View File

@ -10,6 +10,7 @@
<file alias="EntryListDelegate.qml">qml/EntryListDelegate.qml</file> <file alias="EntryListDelegate.qml">qml/EntryListDelegate.qml</file>
<file alias="AddFeedSheet.qml">qml/AddFeedSheet.qml</file> <file alias="AddFeedSheet.qml">qml/AddFeedSheet.qml</file>
<file alias="FeedListDelegate.qml">qml/FeedListDelegate.qml</file> <file alias="FeedListDelegate.qml">qml/FeedListDelegate.qml</file>
<file alias="FeedImage.qml">qml/FeedImage.qml</file>
<file>qtquickcontrols2.conf</file> <file>qtquickcontrols2.conf</file>
</qresource> </qresource>
</RCC> </RCC>