From e574ba97f1a9b76c69b32c987454148056ea11a7 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Mon, 24 Jun 2024 15:07:31 +0300 Subject: [PATCH] QmlDesigner: Fix bundle material json file donwload path Also small renames to add clarity. Fixes: QDS-12998 Change-Id: I1b38fa501bcc606f13675a98c5543709d15ac615 Reviewed-by: Miikka Heikkinen --- .../contentlibrary/contentlibrarymaterialsmodel.cpp | 11 ++++++----- .../contentlibrary/contentlibrarymaterialsmodel.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp index 10d44a2842b..d5a3e1349a7 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp @@ -44,7 +44,7 @@ ContentLibraryMaterialsModel::ContentLibraryMaterialsModel(ContentLibraryWidget void ContentLibraryMaterialsModel::loadBundle() { - if (fetchBundleMetadata() && fetchBundleIcons()) + if (fetchBundleJsonFile() && fetchBundleIcons()) loadMaterialBundle(); } @@ -152,19 +152,20 @@ bool ContentLibraryMaterialsModel::fetchBundleIcons() return false; } -bool ContentLibraryMaterialsModel::fetchBundleMetadata() +bool ContentLibraryMaterialsModel::fetchBundleJsonFile() { Utils::FilePath jsonFilePath = m_bundlePath.pathAppended("material_bundle.json"); if (jsonFilePath.exists() && jsonFilePath.fileSize() > 0) return true; - QString metaFileUrl = m_baseUrl + "/material_bundle.json"; + QString bundleJsonUrl = m_baseUrl + "/material_bundle.json"; + FileDownloader *downloader = new FileDownloader(this); - downloader->setUrl(metaFileUrl); + downloader->setUrl(bundleJsonUrl); downloader->setProbeUrl(false); downloader->setDownloadEnabled(true); - downloader->setTargetFilePath(m_bundlePath.toFSPathString()); + downloader->setTargetFilePath(jsonFilePath.toFSPathString()); QObject::connect(downloader, &FileDownloader::finishedChanged, this, [this, downloader] { diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h index 5472c14f365..5d1ad8f5506 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.h @@ -62,7 +62,7 @@ signals: private: void loadMaterialBundle(); bool fetchBundleIcons(); - bool fetchBundleMetadata(); + bool fetchBundleJsonFile(); bool isValidIndex(int idx) const; void downloadSharedFiles();