Notify when image finished downloading

This commit is contained in:
Tobias Fella 2020-07-04 23:29:46 +02:00
parent 5a8c5854be
commit 87ddc41f32
3 changed files with 6 additions and 0 deletions

View File

@ -82,6 +82,10 @@ Feed::Feed(int index)
setRefreshing(false); setRefreshing(false);
} }
}); });
connect(&Fetcher::instance(), &Fetcher::imageDownloadFinished, this, [this](QString url) {
if(url == m_image)
Q_EMIT imageChanged(url);
});
} }
Feed::~Feed() Feed::~Feed()

View File

@ -195,6 +195,7 @@ void Fetcher::download(QString url)
file.write(data); file.write(data);
file.close(); file.close();
Q_EMIT imageDownloadFinished(url);
delete reply; delete reply;
}); });
} }

View File

@ -57,4 +57,5 @@ Q_SIGNALS:
void feedUpdated(QString url); void feedUpdated(QString url);
void feedDetailsUpdated(QString url, QString name, QString image, QString link, QString description, QDateTime lastUpdated); void feedDetailsUpdated(QString url, QString name, QString image, QString link, QString description, QDateTime lastUpdated);
void error(QString url, int errorId, QString errorString); void error(QString url, int errorId, QString errorString);
void imageDownloadFinished(QString url);
}; };