From b338f017c9da9c3846f4bcf6b99c9438baee42c3 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 18 May 2020 21:00:05 +0200 Subject: [PATCH] Make functions more generic --- src/fetcher.cpp | 8 ++++---- src/fetcher.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fetcher.cpp b/src/fetcher.cpp index 73dc1e2d..49bf20f0 100644 --- a/src/fetcher.cpp +++ b/src/fetcher.cpp @@ -144,7 +144,7 @@ void Fetcher::processEnclosure(Syndication::EnclosurePtr enclosure, Syndication: QString Fetcher::image(QString url) { - QString path = imagePath(url); + QString path = filePath(url); if (QFileInfo::exists(path)) { return path; } @@ -167,11 +167,11 @@ QString Fetcher::image(QString url) void Fetcher::removeImage(QString url) { - qDebug() << imagePath(url); - QFile(imagePath(url)).remove(); + qDebug() << filePath(url); + QFile(filePath(url)).remove(); } -QString Fetcher::imagePath(QString url) +QString Fetcher::filePath(QString url) { return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/") + QString::fromStdString(QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md5).toHex().toStdString()); } diff --git a/src/fetcher.h b/src/fetcher.h index b158f53f..a6ee1cf4 100644 --- a/src/fetcher.h +++ b/src/fetcher.h @@ -42,7 +42,7 @@ private: Fetcher(); Fetcher(const Fetcher &); - QString imagePath(QString); + QString filePath(QString); void processFeed(Syndication::FeedPtr feed, QUrl url); void processEntry(Syndication::ItemPtr entry, QUrl url); void processAuthor(Syndication::PersonPtr author, Syndication::ItemPtr entry, QUrl url);