forked from qt-creator/qt-creator
QmlDesigner: Fix bundle material json file donwload path
Also small renames to add clarity. Fixes: QDS-12998 Change-Id: I1b38fa501bcc606f13675a98c5543709d15ac615 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -44,7 +44,7 @@ ContentLibraryMaterialsModel::ContentLibraryMaterialsModel(ContentLibraryWidget
|
|||||||
|
|
||||||
void ContentLibraryMaterialsModel::loadBundle()
|
void ContentLibraryMaterialsModel::loadBundle()
|
||||||
{
|
{
|
||||||
if (fetchBundleMetadata() && fetchBundleIcons())
|
if (fetchBundleJsonFile() && fetchBundleIcons())
|
||||||
loadMaterialBundle();
|
loadMaterialBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,19 +152,20 @@ bool ContentLibraryMaterialsModel::fetchBundleIcons()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentLibraryMaterialsModel::fetchBundleMetadata()
|
bool ContentLibraryMaterialsModel::fetchBundleJsonFile()
|
||||||
{
|
{
|
||||||
Utils::FilePath jsonFilePath = m_bundlePath.pathAppended("material_bundle.json");
|
Utils::FilePath jsonFilePath = m_bundlePath.pathAppended("material_bundle.json");
|
||||||
|
|
||||||
if (jsonFilePath.exists() && jsonFilePath.fileSize() > 0)
|
if (jsonFilePath.exists() && jsonFilePath.fileSize() > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QString metaFileUrl = m_baseUrl + "/material_bundle.json";
|
QString bundleJsonUrl = m_baseUrl + "/material_bundle.json";
|
||||||
|
|
||||||
FileDownloader *downloader = new FileDownloader(this);
|
FileDownloader *downloader = new FileDownloader(this);
|
||||||
downloader->setUrl(metaFileUrl);
|
downloader->setUrl(bundleJsonUrl);
|
||||||
downloader->setProbeUrl(false);
|
downloader->setProbeUrl(false);
|
||||||
downloader->setDownloadEnabled(true);
|
downloader->setDownloadEnabled(true);
|
||||||
downloader->setTargetFilePath(m_bundlePath.toFSPathString());
|
downloader->setTargetFilePath(jsonFilePath.toFSPathString());
|
||||||
|
|
||||||
QObject::connect(downloader, &FileDownloader::finishedChanged, this,
|
QObject::connect(downloader, &FileDownloader::finishedChanged, this,
|
||||||
[this, downloader] {
|
[this, downloader] {
|
||||||
|
@@ -62,7 +62,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void loadMaterialBundle();
|
void loadMaterialBundle();
|
||||||
bool fetchBundleIcons();
|
bool fetchBundleIcons();
|
||||||
bool fetchBundleMetadata();
|
bool fetchBundleJsonFile();
|
||||||
bool isValidIndex(int idx) const;
|
bool isValidIndex(int idx) const;
|
||||||
void downloadSharedFiles();
|
void downloadSharedFiles();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user