Enable autoDownload

There seems to still be a problem with the images not being fetched for
the newly added queue items.
This commit is contained in:
Bart De Vries 2021-04-09 23:39:41 +02:00
parent 718a9ef734
commit 7468c35b9a
3 changed files with 23 additions and 4 deletions

View File

@ -62,10 +62,16 @@ DataManager::DataManager()
query.bindValue(QStringLiteral(":new"), true); query.bindValue(QStringLiteral(":new"), true);
Database::instance().execute(query); Database::instance().execute(query);
while (query.next()) { 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); Q_EMIT feedEntriesUpdated(feedurl);
}); });
@ -322,7 +328,12 @@ void DataManager::moveQueueItem(const int &from, const int &to)
void DataManager::removeQueueItem(const int &index) void DataManager::removeQueueItem(const int &index)
{ {
qDebug() << m_queuemap; 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]; const QString id = m_queuemap[index];
m_queuemap.removeAt(index); m_queuemap.removeAt(index);
@ -347,6 +358,7 @@ void DataManager::removeQueueItem(Entry* entry)
{ {
removeQueueItem(m_queuemap.indexOf(entry->id())); removeQueueItem(m_queuemap.indexOf(entry->id()));
} }
void DataManager::importFeeds(const QString &path) void DataManager::importFeeds(const QString &path)
{ {
QUrl url(path); QUrl url(path);

View File

@ -24,7 +24,7 @@ Kirigami.SwipeListItem {
} }
Image { Image {
asynchronous: true asynchronous: true
source: entry.image === "" ? "rss" : "file://"+Fetcher.image(entry.image) source: entry.image === "" ? "logo.png" : "file://"+Fetcher.image(entry.image)
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
property int size: Kirigami.Units.gridUnit * 3 property int size: Kirigami.Units.gridUnit * 3
sourceSize.width: size sourceSize.width: size

View File

@ -38,7 +38,13 @@ Kirigami.ScrollablePage {
checked: AlligatorSettings.autoQueue checked: AlligatorSettings.autoQueue
text: i18n("Automatically queue new episodes") text: i18n("Automatically queue new episodes")
onToggled: AlligatorSettings.autoQueue = checked onToggled: {
AlligatorSettings.autoQueue = checked
if (!checked) {
autoDownload.checked = false
AlligatorSettings.autoDownload = false
}
}
} }
Controls.CheckBox { Controls.CheckBox {
@ -46,6 +52,7 @@ Kirigami.ScrollablePage {
checked: AlligatorSettings.autoDownload checked: AlligatorSettings.autoDownload
text: i18n("Automatically download new episodes") text: i18n("Automatically download new episodes")
enabled: autoQueue.checked
onToggled: AlligatorSettings.autoDownload = checked onToggled: AlligatorSettings.autoDownload = checked
} }