AssetDownloader Add a virtual method for resolving urls

Pick-to: 6.8
Change-Id: Ie771fd955e6b44ff4825243791029c4fcea0d493
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Ali Kianian 2024-06-27 09:05:26 +03:00
parent 48e896baf6
commit 3e3cf6dca9
2 changed files with 10 additions and 2 deletions

View File

@ -385,7 +385,7 @@ void AssetDownloader::start()
}
storage->tempDir = d->m_temporaryDir->path();
d->setLocalDownloadDir(baseLocalDir(d->m_preferredLocalDownloadDir));
precheckLocalFile(d->m_offlineAssetsFilePath);
precheckLocalFile(resolvedUrl(d->m_offlineAssetsFilePath));
return SetupResult::Continue;
};
@ -405,7 +405,7 @@ void AssetDownloader::start()
return DoneResult::Error;
}
QFile file(pathFromUrl(d->m_offlineAssetsFilePath));
QFile file(pathFromUrl(resolvedUrl(d->m_offlineAssetsFilePath)));
if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Also failed to open" << d->m_offlineAssetsFilePath;
return DoneResult::Error;
@ -560,6 +560,11 @@ void AssetDownloader::start()
[this](DoneWith result) { emit finished(result == DoneWith::Success); });
}
QUrl AssetDownloader::resolvedUrl(const QUrl &url) const
{
return url;
}
} // namespace Assets::Downloader
QT_END_NAMESPACE

View File

@ -89,6 +89,9 @@ public:
public Q_SLOTS:
void start();
protected:
virtual QUrl resolvedUrl(const QUrl &url) const;
Q_SIGNALS:
void started();
void finished(bool success);