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,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);

View File

@ -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

View File

@ -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
}