diff --git a/src/plugins/coreplugin/shellcommand.cpp b/src/plugins/coreplugin/shellcommand.cpp index a236c906e4d..a1ddd083ebc 100644 --- a/src/plugins/coreplugin/shellcommand.cpp +++ b/src/plugins/coreplugin/shellcommand.cpp @@ -40,12 +40,17 @@ ShellCommand::ShellCommand(const QString &workingDirectory, const QProcessEnviro this, &ShellCommand::coreAboutToClose); } +FutureProgress *ShellCommand::futureProgress() const +{ + return m_progress.data(); +} + void ShellCommand::addTask(QFuture &future) { const QString name = displayName(); const auto id = Core::Id::fromString(name + QLatin1String(".action")); if (hasProgressParser()) { - ProgressManager::addTask(future, name, id); + m_progress = ProgressManager::addTask(future, name, id); } else { // add a timed tasked based on timeout // we cannot access the future interface directly, so we need to create a new one @@ -58,7 +63,7 @@ void ShellCommand::addTask(QFuture &future) watcher->deleteLater(); }); watcher->setFuture(future); - ProgressManager::addTimedTask(*fi, name, id, qMax(2, timeoutS() / 5)/*itsmagic*/); + m_progress = ProgressManager::addTimedTask(*fi, name, id, qMax(2, timeoutS() / 5)/*itsmagic*/); } } diff --git a/src/plugins/coreplugin/shellcommand.h b/src/plugins/coreplugin/shellcommand.h index a5cd59bfa6c..b960bae94d0 100644 --- a/src/plugins/coreplugin/shellcommand.h +++ b/src/plugins/coreplugin/shellcommand.h @@ -27,8 +27,12 @@ #include "core_global.h" +#include "progressmanager/futureprogress.h" + #include +#include + namespace Core { class CORE_EXPORT ShellCommand : public Utils::ShellCommand @@ -38,10 +42,15 @@ class CORE_EXPORT ShellCommand : public Utils::ShellCommand public: ShellCommand(const QString &workingDirectory, const QProcessEnvironment &environment); + FutureProgress *futureProgress() const; + protected: void addTask(QFuture &future) override; virtual void coreAboutToClose(); + +private: + QPointer m_progress; }; } // namespace Core diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 8f9e5da6fad..0a9f13a814f 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -67,6 +67,7 @@ class UpdateInfoPluginPrivate public: QString m_maintenanceTool; QPointer m_checkUpdatesCommand; + QPointer m_progress; QString m_collectedOutput; QTimer *m_checkUpdatesTimer = nullptr; @@ -124,6 +125,7 @@ void UpdateInfoPlugin::startCheckForUpdates() QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QLatin1String("QT_LOGGING_RULES"), QLatin1String("*=false")); d->m_checkUpdatesCommand = new ShellCommand(QString(), env); + d->m_checkUpdatesCommand->setDisplayName(tr("Checking for Updates")); connect(d->m_checkUpdatesCommand, &ShellCommand::stdOutText, this, &UpdateInfoPlugin::collectCheckForUpdatesOutput); connect(d->m_checkUpdatesCommand, &ShellCommand::finished, this, &UpdateInfoPlugin::checkForUpdatesFinished); d->m_checkUpdatesCommand->addJob(Utils::FileName(QFileInfo(d->m_maintenanceTool)), QStringList(QLatin1String("--checkupdates")), @@ -131,6 +133,11 @@ void UpdateInfoPlugin::startCheckForUpdates() /*workingDirectory=*/QString(), [](int /*exitCode*/) { return Utils::SynchronousProcessResponse::Finished; }); d->m_checkUpdatesCommand->execute(); + d->m_progress = d->m_checkUpdatesCommand->futureProgress(); + if (d->m_progress) { + d->m_progress->setKeepOnFinish(FutureProgress::KeepOnFinishTillUserInteraction); + d->m_progress->setSubtitleVisibleInStatusBar(true); + } emit checkForUpdatesRunningChanged(true); } @@ -168,6 +175,8 @@ void UpdateInfoPlugin::checkForUpdatesFinished() startUpdater(); } else { emit newUpdatesAvailable(false); + if (d->m_progress) + d->m_progress->setSubtitle(tr("No updates found.")); } }