From 894f1b81c82454c10e9f87907bfcb0e8bc32be08 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 11 Oct 2022 14:07:57 +0200 Subject: [PATCH] UpdateInfoPlugin: Remove unneeded scopes Change-Id: Iccb376a4b0230c3b988415c126aa0bca73b89b09 Reviewed-by: Eike Ziller --- src/plugins/updateinfo/updateinfoplugin.cpp | 50 ++++++++++----------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 03fe6a4f2f2..df8069db77a 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -204,10 +204,10 @@ void UpdateInfoPlugin::stopCheckForUpdates() static void showUpdateInfo(const QList &updates, const std::function &startUpdater) { - Utils::InfoBarEntry info(InstallUpdates, - UpdateInfoPlugin::tr("New updates are available. Start the update?")); + InfoBarEntry info(InstallUpdates, + UpdateInfoPlugin::tr("New updates are available. Start the update?")); info.addCustomButton(UpdateInfoPlugin::tr("Start Update"), [startUpdater] { - Core::ICore::infoBar()->removeInfo(InstallUpdates); + ICore::infoBar()->removeInfo(InstallUpdates); startUpdater(); }); info.setDetailsWidgetCreator([updates]() -> QWidget * { @@ -224,30 +224,28 @@ static void showUpdateInfo(const QList &updates, const std::functionsetContentsMargins(0, 0, 0, 8); return label; }); - Core::ICore::infoBar()->removeInfo(InstallUpdates); // remove any existing notifications - Core::ICore::infoBar()->unsuppressInfo(InstallUpdates); - Core::ICore::infoBar()->addInfo(info); + ICore::infoBar()->removeInfo(InstallUpdates); // remove any existing notifications + ICore::infoBar()->unsuppressInfo(InstallUpdates); + ICore::infoBar()->addInfo(info); } static void showQtUpdateInfo(const QtPackage &package, const std::function &startPackageManager) { - Utils::InfoBarEntry info(InstallQtUpdates, - UpdateInfoPlugin::tr( - "%1 is available. Check the Qt blog for details.") - .arg(package.displayName, - QString("href=\"https://www.qt.io/blog/tag/releases\""))); + InfoBarEntry info(InstallQtUpdates, UpdateInfoPlugin::tr( + "%1 is available. Check the Qt blog for details.") + .arg(package.displayName, QString("href=\"https://www.qt.io/blog/tag/releases\""))); info.addCustomButton(UpdateInfoPlugin::tr("Start Package Manager"), [startPackageManager] { - Core::ICore::infoBar()->removeInfo(InstallQtUpdates); + ICore::infoBar()->removeInfo(InstallQtUpdates); startPackageManager(); }); info.addCustomButton(UpdateInfoPlugin::tr("Open Settings"), [] { - Core::ICore::infoBar()->removeInfo(InstallQtUpdates); - Core::ICore::showOptionsDialog(FILTER_OPTIONS_PAGE_ID); + ICore::infoBar()->removeInfo(InstallQtUpdates); + ICore::showOptionsDialog(FILTER_OPTIONS_PAGE_ID); }); - Core::ICore::infoBar()->removeInfo(InstallQtUpdates); // remove any existing notifications - Core::ICore::infoBar()->unsuppressInfo(InstallQtUpdates); - Core::ICore::infoBar()->addInfo(info); + ICore::infoBar()->removeInfo(InstallQtUpdates); // remove any existing notifications + ICore::infoBar()->unsuppressInfo(InstallQtUpdates); + ICore::infoBar()->addInfo(info); } void UpdateInfoPlugin::checkForUpdatesFinished() @@ -328,23 +326,23 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString * auto mtools = ActionManager::actionContainer(Constants::M_TOOLS); ActionContainer *mmaintenanceTool = ActionManager::createMenu(M_MAINTENANCE_TOOL); - mmaintenanceTool->setOnAllDisabledBehavior(Core::ActionContainer::Hide); - mmaintenanceTool->menu()->setTitle(Tr::tr("Qt Maintenance Tool")); mtools->addMenu(mmaintenanceTool); + mmaintenanceTool->setOnAllDisabledBehavior(ActionContainer::Hide); + mmaintenanceTool->menu()->setTitle(Tr::tr("Qt Maintenance Tool")); + mtools->addMenu(mmaintenanceTool); QAction *checkForUpdatesAction = new QAction(tr("Check for Updates"), this); checkForUpdatesAction->setMenuRole(QAction::ApplicationSpecificRole); - Core::Command *checkForUpdatesCommand - = Core::ActionManager::registerAction(checkForUpdatesAction, "Updates.CheckForUpdates"); + Command *checkForUpdatesCommand = ActionManager::registerAction(checkForUpdatesAction, + "Updates.CheckForUpdates"); connect(checkForUpdatesAction, &QAction::triggered, this, &UpdateInfoPlugin::startCheckForUpdates); mmaintenanceTool->addAction(checkForUpdatesCommand); QAction *startMaintenanceToolAction = new QAction(Tr::tr("Start Maintenance Tool"), this); startMaintenanceToolAction->setMenuRole(QAction::ApplicationSpecificRole); - Core::Command *startMaintenanceToolCommand - = Core::ActionManager::registerAction(startMaintenanceToolAction, - "Updates.StartMaintenanceTool"); - connect(startMaintenanceToolAction, &QAction::triggered, this, [this]() { + Command *startMaintenanceToolCommand = ActionManager::registerAction(startMaintenanceToolAction, + "Updates.StartMaintenanceTool"); + connect(startMaintenanceToolAction, &QAction::triggered, this, [this] { startMaintenanceTool({}); }); mmaintenanceTool->addAction(startMaintenanceToolCommand); @@ -383,7 +381,7 @@ void UpdateInfoPlugin::loadSettings() const void UpdateInfoPlugin::saveSettings() { UpdateInfoPluginPrivate::Settings def; - Utils::QtcSettings *settings = ICore::settings(); + QtcSettings *settings = ICore::settings(); settings->beginGroup(UpdaterGroup); settings->setValueWithDefault(LastCheckDateKey, d->m_lastCheckDate, QDate()); settings->setValueWithDefault(AutomaticCheckKey,