From 7468c35b9a2f301609f207748d2f4f3d09cdfde7 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Fri, 9 Apr 2021 23:39:41 +0200 Subject: [PATCH] Enable autoDownload There seems to still be a problem with the images not being fetched for the newly added queue items. --- src/datamanager.cpp | 16 ++++++++++++++-- src/qml/QueueDelegate.qml | 2 +- src/qml/SettingsPage.qml | 9 ++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/datamanager.cpp b/src/datamanager.cpp index 4ff4a6db..113ce60d 100644 --- a/src/datamanager.cpp +++ b/src/datamanager.cpp @@ -62,8 +62,14 @@ DataManager::DataManager() query.bindValue(QStringLiteral(":new"), true); Database::instance().execute(query); while (query.next()) { - addtoQueue(feedurl, query.value(QStringLiteral("id")).toString()); + QString const id = query.value(QStringLiteral("id")).toString(); + addtoQueue(feedurl, id); + if (AlligatorSettings::self()->autoDownload()) { + if (getEntry(id)->hasEnclosure()) + getEntry(id)->enclosure()->download(); + } } + } Q_EMIT feedEntriesUpdated(feedurl); @@ -322,7 +328,12 @@ void DataManager::moveQueueItem(const int &from, const int &to) void DataManager::removeQueueItem(const int &index) { qDebug() << m_queuemap; - // First remove the item from the internal data structure + // Unset "new" state + getEntry(m_queuemap[index])->setNew(false); + // TODO: Make sure to unset the pointer in the Audio class once it's been + // ported to c++ + + // Remove the item from the internal data structure const QString id = m_queuemap[index]; m_queuemap.removeAt(index); @@ -347,6 +358,7 @@ void DataManager::removeQueueItem(Entry* entry) { removeQueueItem(m_queuemap.indexOf(entry->id())); } + void DataManager::importFeeds(const QString &path) { QUrl url(path); diff --git a/src/qml/QueueDelegate.qml b/src/qml/QueueDelegate.qml index 0ab1d85c..26e8c3bd 100644 --- a/src/qml/QueueDelegate.qml +++ b/src/qml/QueueDelegate.qml @@ -24,7 +24,7 @@ Kirigami.SwipeListItem { } Image { asynchronous: true - source: entry.image === "" ? "rss" : "file://"+Fetcher.image(entry.image) + source: entry.image === "" ? "logo.png" : "file://"+Fetcher.image(entry.image) fillMode: Image.PreserveAspectFit property int size: Kirigami.Units.gridUnit * 3 sourceSize.width: size diff --git a/src/qml/SettingsPage.qml b/src/qml/SettingsPage.qml index d10904b3..14fadbae 100644 --- a/src/qml/SettingsPage.qml +++ b/src/qml/SettingsPage.qml @@ -38,7 +38,13 @@ Kirigami.ScrollablePage { checked: AlligatorSettings.autoQueue text: i18n("Automatically queue new episodes") - onToggled: AlligatorSettings.autoQueue = checked + onToggled: { + AlligatorSettings.autoQueue = checked + if (!checked) { + autoDownload.checked = false + AlligatorSettings.autoDownload = false + } + } } Controls.CheckBox { @@ -46,6 +52,7 @@ Kirigami.ScrollablePage { checked: AlligatorSettings.autoDownload text: i18n("Automatically download new episodes") + enabled: autoQueue.checked onToggled: AlligatorSettings.autoDownload = checked }