Analyzer: Reduce explicit use of RunMode enum

Change-Id: Idcdeb2b42879f419154902e685d0d13e8cae8b33
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-02-19 17:20:38 +01:00
parent 813e995ebf
commit 63247edd90
3 changed files with 12 additions and 11 deletions

View File

@@ -564,15 +564,18 @@ void AnalyzerManagerPrivate::saveToolSettings(Id toolId)
void AnalyzerManagerPrivate::updateRunActions()
{
QString disabledReason;
if (m_isRunning)
bool enabled = true;
if (m_isRunning) {
disabledReason = tr("An analysis is still in progress.");
else if (!m_currentAction)
enabled = false;
} else if (!m_currentAction) {
disabledReason = tr("No analyzer tool selected.");
else
ProjectExplorerPlugin::canRun(SessionManager::startupProject(),
m_currentAction->runMode(), &disabledReason);
enabled = false;
} else {
enabled = m_currentAction->isRunnable(&disabledReason);
}
m_startAction->setEnabled(!m_isRunning && m_currentAction && m_currentAction->isRunnable());
m_startAction->setEnabled(enabled);
m_startAction->setToolTip(disabledReason);
m_toolBox->setEnabled(!m_isRunning);
m_stopAction->setEnabled(m_isRunning);

View File

@@ -62,12 +62,12 @@ AnalyzerAction::AnalyzerAction(QObject *parent)
: QAction(parent)
{}
bool AnalyzerAction::isRunnable() const
bool AnalyzerAction::isRunnable(QString *reason) const
{
if (m_startMode == StartRemote)
return true;
return ProjectExplorerPlugin::canRun(SessionManager::startupProject(), runMode(), 0);
return ProjectExplorerPlugin::canRun(SessionManager::startupProject(), m_runMode, reason);
}
AnalyzerRunControl *AnalyzerAction::tryCreateRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) const

View File

@@ -90,10 +90,8 @@ public:
Core::Id toolId() const { return m_toolId; }
void setToolId(Core::Id id) { m_toolId = id; }
ProjectExplorer::RunMode runMode() const { return m_runMode; }
void setRunMode(ProjectExplorer::RunMode mode) { m_runMode = mode; }
bool isRunnable() const;
bool isRunnable(QString *reason = 0) const;
/// Creates all widgets used by the tool.
/// Returns a control widget which will be shown in the status bar when