AutoTest: Correct enabled state of context menu items

Permanently enable (De)Select All and allow triggering a
rescan also if there is a build running.

Task-number: QTCREATORBUG-19940
Change-Id: Ia0e8a5da135c3c59aba4ab179ae2970c25d470f3
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-02-28 13:08:05 +01:00
parent 383d53ddbd
commit 79e1a8a042
2 changed files with 7 additions and 12 deletions

View File

@@ -192,16 +192,16 @@ void AutotestPlugin::onRunSelectedTriggered()
void AutotestPlugin::updateMenuItemsEnabledState()
{
const bool enabled = !ProjectExplorer::BuildManager::isBuilding()
&& !TestRunner::instance()->isTestRunning()
&& TestTreeModel::instance()->parser()->state() == TestCodeParser::Idle
const bool canScan = !TestRunner::instance()->isTestRunning()
&& TestTreeModel::instance()->parser()->state() == TestCodeParser::Idle;
const bool hasTests = TestTreeModel::instance()->hasTests();
const bool canRun = hasTests && canScan
&& ProjectExplorer::ProjectExplorerPlugin::canRunStartupProject(
ProjectExplorer::Constants::NORMAL_RUN_MODE);
const bool hasTests = TestTreeModel::instance()->hasTests();
ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()->setEnabled(enabled && hasTests);
ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action()->setEnabled(enabled && hasTests);
ActionManager::command(Constants::ACTION_SCAN_ID)->action()->setEnabled(enabled);
ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()->setEnabled(canRun);
ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action()->setEnabled(canRun);
ActionManager::command(Constants::ACTION_SCAN_ID)->action()->setEnabled(canScan);
}
QList<QObject *> AutotestPlugin::createTestObjects() const