diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2022-05-18 14:57:57 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2022-05-19 09:42:09 +0000 |
commit | 816a9d62282ca58d0373e88bb066fb8fc8c3efd8 (patch) | |
tree | cff22ae783da6ccd587a7b0629c13177cc6d90bf | |
parent | a1882c1caac5e28d4197312f6ec44368fd6e06a1 (diff) | |
download | qt-creator-816a9d62282ca58d0373e88bb066fb8fc8c3efd8.tar.gz |
StudioWelcome: Forward download progress to QML
Changing the order.
First we create the widget,
then we connect and then we start the download.
Change-Id: I8acfe3d19010f16056dcb5e746acfb029b8a602d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
-rw-r--r-- | src/plugins/studiowelcome/studiowelcomeplugin.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 464640162e..140e4c0ec9 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -666,13 +666,7 @@ WelcomeMode::WelcomeMode() Utils::FilePath readme = Utils::FilePath::fromUserInput(m_dataModelDownloader->targetFolder().toString() + "/readme.txt"); - m_dataModelDownloader->start(); - connect(m_dataModelDownloader, &DataModelDownloader::finished, this, [this](){ - auto source = m_modeWidget->source(); - m_modeWidget->engine()->clearComponentCache(); - m_modeWidget->setSource(source); - }); const Utils::Icon FLAT({{":/studiowelcome/images/mode_welcome_mask.png", Utils::Theme::IconsBaseColor}}); const Utils::Icon FLAT_ACTIVE({{":/studiowelcome/images/mode_welcome_mask.png", @@ -700,6 +694,19 @@ WelcomeMode::WelcomeMode() if (forceDownLoad() || !readme.exists()) // Only downloads contain the readme m_dataModelDownloader->setForceDownload(true); + connect(m_dataModelDownloader, &DataModelDownloader::progressChanged, this, [this](){ + m_modeWidget->rootObject()->setProperty("loadingProgress", m_dataModelDownloader->progress()); + }); + + connect(m_dataModelDownloader, &DataModelDownloader::finished, this, [this](){ + auto source = m_modeWidget->source(); + m_modeWidget->engine()->clearComponentCache(); + m_modeWidget->setSource(source); + m_modeWidget->rootObject()->setProperty("loadingProgress", 100); + }); + + m_dataModelDownloader->start(); + connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this](Utils::Id mode){ bool active = (mode == Core::Constants::MODE_WELCOME); m_modeWidget->rootObject()->setProperty("active", active); |