From 64da7b15d9d39a4580d5316d9bc59849e19c2621 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 15 Jul 2021 11:52:40 +0200 Subject: [PATCH] Disambiguate the build actions in locator and shortcut settings By setting a whatsThis text and using that in locator. Amends 3bd490acdb41d287c1870a8b064b92a858d35352 Fixes: QTCREATORBUG-26002 Change-Id: I55c196456eb0eaec880da4479a0a75105f649b01 Reviewed-by: Christian Kandeler --- src/plugins/coreplugin/menubarfilter.cpp | 4 ++- .../projectexplorer/projectexplorer.cpp | 28 +++++++++++++++---- .../qbsprojectmanagerplugin.cpp | 4 +++ .../qmakeprojectmanagerplugin.cpp | 6 ++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/plugins/coreplugin/menubarfilter.cpp b/src/plugins/coreplugin/menubarfilter.cpp index 354a0e7b367..207959f2d74 100644 --- a/src/plugins/coreplugin/menubarfilter.cpp +++ b/src/plugins/coreplugin/menubarfilter.cpp @@ -101,7 +101,9 @@ QList MenuBarFilter::matchesForAction(QAction *action, QList entries; if (!m_enabledActions.contains(action)) return entries; - const QString text = Utils::stripAccelerator(action->text()); + const QString whatsThis = action->whatsThis(); + const QString text = Utils::stripAccelerator(action->text()) + + (whatsThis.isEmpty() ? QString() : QString(" (" + whatsThis + ")")); if (QMenu *menu = action->menu()) { if (processedMenus.contains(menu)) return entries; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index c52154cb59f..a6e7046c098 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1137,36 +1137,48 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // deploy session dd->m_deploySessionAction = new QAction(tr("Deploy"), this); + dd->m_deploySessionAction->setWhatsThis(tr("Deploy All Projects")); cmd = ActionManager::registerAction(dd->m_deploySessionAction, Constants::DEPLOYSESSION); + cmd->setDescription(dd->m_deploySessionAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_ALLPROJECTS); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); // rebuild session action dd->m_rebuildSessionAction = new QAction(Icons::REBUILD.icon(), tr("Rebuild"), this); + dd->m_rebuildSessionAction->setWhatsThis(tr("Rebuild All Projects")); cmd = ActionManager::registerAction(dd->m_rebuildSessionAction, Constants::REBUILDSESSION); + cmd->setDescription(dd->m_rebuildSessionAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_ALLPROJECTS); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); dd->m_rebuildSessionForAllConfigsAction = new QAction(Icons::REBUILD.icon(), tr("Rebuild"), this); + dd->m_rebuildSessionForAllConfigsAction->setWhatsThis( + tr("Rebuild All Projects for All Configurations")); cmd = ActionManager::registerAction(dd->m_rebuildSessionForAllConfigsAction, Constants::REBUILDSESSIONALLCONFIGS); + cmd->setDescription(dd->m_rebuildSessionForAllConfigsAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_ALLPROJECTS_ALLCONFIGURATIONS); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); // clean session dd->m_cleanSessionAction = new QAction(Utils::Icons::CLEAN.icon(), tr("Clean"), this); + dd->m_cleanSessionAction->setWhatsThis(tr("Clean All Projects")); cmd = ActionManager::registerAction(dd->m_cleanSessionAction, Constants::CLEANSESSION); + cmd->setDescription(dd->m_cleanSessionAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_ALLPROJECTS); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); dd->m_cleanSessionForAllConfigsAction = new QAction(Utils::Icons::CLEAN.icon(), tr("Clean"), this); + dd->m_cleanSessionForAllConfigsAction->setWhatsThis( + tr("Clean All Projects for All Configurations")); cmd = ActionManager::registerAction(dd->m_cleanSessionForAllConfigsAction, Constants::CLEANSESSIONALLCONFIGS); + cmd->setDescription(dd->m_cleanSessionForAllConfigsAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_ALLPROJECTS_ALLCONFIGURATIONS); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); @@ -1212,39 +1224,45 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // deploy action dd->m_deployAction = new QAction(tr("Deploy"), this); + dd->m_deployAction->setWhatsThis(tr("Deploy Project")); cmd = ActionManager::registerAction(dd->m_deployAction, Constants::DEPLOY); cmd->setAttribute(Command::CA_UpdateText); - cmd->setDescription(dd->m_deployAction->text()); + cmd->setDescription(dd->m_deployAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); // rebuild action dd->m_rebuildAction = new QAction(Icons::REBUILD.icon(), tr("Rebuild"), this); + dd->m_rebuildAction->setWhatsThis(tr("Rebuild Project")); cmd = ActionManager::registerAction(dd->m_rebuildAction, Constants::REBUILD); cmd->setAttribute(Command::CA_UpdateText); - cmd->setDescription(dd->m_rebuildAction->text()); + cmd->setDescription(dd->m_rebuildAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); dd->m_rebuildProjectForAllConfigsAction = new QAction(Icons::REBUILD.icon(), tr("Rebuild"), this); + dd->m_rebuildProjectForAllConfigsAction->setWhatsThis( + tr("Rebuild Project for All Configurations")); cmd = ActionManager::registerAction(dd->m_rebuildProjectForAllConfigsAction, Constants::REBUILDALLCONFIGS); cmd->setAttribute(Command::CA_UpdateText); - cmd->setDescription(dd->m_rebuildProjectForAllConfigsAction->text()); + cmd->setDescription(dd->m_rebuildProjectForAllConfigsAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_PROJECT_ALLCONFIGURATIONS); // clean action dd->m_cleanAction = new QAction(Utils::Icons::CLEAN.icon(), tr("Clean"), this); + dd->m_cleanAction->setWhatsThis(tr("Clean Project")); cmd = ActionManager::registerAction(dd->m_cleanAction, Constants::CLEAN); cmd->setAttribute(Command::CA_UpdateText); - cmd->setDescription(dd->m_cleanAction->text()); + cmd->setDescription(dd->m_cleanAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_PROJECT); dd->m_cleanProjectForAllConfigsAction = new QAction(Utils::Icons::CLEAN.icon(), tr("Clean"), this); + dd->m_cleanProjectForAllConfigsAction->setWhatsThis(tr("Clean Project for All Configurations")); cmd = ActionManager::registerAction(dd->m_cleanProjectForAllConfigsAction, Constants::CLEANALLCONFIGS); cmd->setAttribute(Command::CA_UpdateText); - cmd->setDescription(dd->m_cleanProjectForAllConfigsAction->text()); + cmd->setDescription(dd->m_cleanProjectForAllConfigsAction->whatsThis()); mbuild->addAction(cmd, Constants::G_BUILD_PROJECT_ALLCONFIGURATIONS); // cancel build action diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index 992047bb1fa..f96a86656eb 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -190,9 +190,11 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * this, &QbsProjectManagerPlugin::cleanProductContextMenu); m_cleanProduct = new QAction(Utils::Icons::CLEAN.icon(), tr("Clean"), this); + m_cleanProduct->setWhatsThis(tr("Clean Product")); command = Core::ActionManager::registerAction(m_cleanProduct, Constants::ACTION_CLEAN_PRODUCT); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); + command->setDescription(m_cleanProduct->whatsThis()); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PRODUCT); connect(m_cleanProduct, &QAction::triggered, this, &QbsProjectManagerPlugin::cleanProduct); @@ -205,10 +207,12 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * this, &QbsProjectManagerPlugin::rebuildProductContextMenu); m_rebuildProduct = new QAction(ProjectExplorer::Icons::REBUILD.icon(), tr("Rebuild"), this); + m_rebuildProduct->setWhatsThis(tr("Rebuild Product")); command = Core::ActionManager::registerAction(m_rebuildProduct, Constants::ACTION_REBUILD_PRODUCT); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); + command->setDescription(m_rebuildProduct->whatsThis()); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_PRODUCT); connect(m_rebuildProduct, &QAction::triggered, this, &QbsProjectManagerPlugin::rebuildProduct); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index 01da9cad48f..603f683f304 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -246,19 +246,21 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString d->m_rebuildSubProjectAction = new QAction(Icons::REBUILD.icon(), tr("Rebuild"), this); + d->m_rebuildSubProjectAction->setWhatsThis(tr("Rebuild Subproject")); command = ActionManager::registerAction(d->m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext); command->setAttribute(Command::CA_Hide); command->setAttribute(Command::CA_UpdateText); - command->setDescription(d->m_rebuildSubProjectAction->text()); + command->setDescription(d->m_rebuildSubProjectAction->whatsThis()); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_SUBPROJECT); connect(d->m_rebuildSubProjectAction, &QAction::triggered, d, &QmakeProjectManagerPluginPrivate::rebuildSubDirContextMenu); d->m_cleanSubProjectAction = new QAction(Utils::Icons::CLEAN.icon(),tr("Clean"), this); + d->m_cleanSubProjectAction->setWhatsThis(tr("Clean Subproject")); command = ActionManager::registerAction(d->m_cleanSubProjectAction, Constants::CLEANSUBDIR, projectContext); command->setAttribute(Command::CA_Hide); command->setAttribute(Command::CA_UpdateText); - command->setDescription(d->m_cleanSubProjectAction->text()); + command->setDescription(d->m_cleanSubProjectAction->whatsThis()); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_SUBPROJECT); connect(d->m_cleanSubProjectAction, &QAction::triggered, d, &QmakeProjectManagerPluginPrivate::cleanSubDirContextMenu);