forked from qt-creator/qt-creator
Analyzer: Reduce explicit use of RunMode enum
Change-Id: Idcdeb2b42879f419154902e685d0d13e8cae8b33 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -564,15 +564,18 @@ void AnalyzerManagerPrivate::saveToolSettings(Id toolId)
|
|||||||
void AnalyzerManagerPrivate::updateRunActions()
|
void AnalyzerManagerPrivate::updateRunActions()
|
||||||
{
|
{
|
||||||
QString disabledReason;
|
QString disabledReason;
|
||||||
if (m_isRunning)
|
bool enabled = true;
|
||||||
|
if (m_isRunning) {
|
||||||
disabledReason = tr("An analysis is still in progress.");
|
disabledReason = tr("An analysis is still in progress.");
|
||||||
else if (!m_currentAction)
|
enabled = false;
|
||||||
|
} else if (!m_currentAction) {
|
||||||
disabledReason = tr("No analyzer tool selected.");
|
disabledReason = tr("No analyzer tool selected.");
|
||||||
else
|
enabled = false;
|
||||||
ProjectExplorerPlugin::canRun(SessionManager::startupProject(),
|
} else {
|
||||||
m_currentAction->runMode(), &disabledReason);
|
enabled = m_currentAction->isRunnable(&disabledReason);
|
||||||
|
}
|
||||||
|
|
||||||
m_startAction->setEnabled(!m_isRunning && m_currentAction && m_currentAction->isRunnable());
|
m_startAction->setEnabled(enabled);
|
||||||
m_startAction->setToolTip(disabledReason);
|
m_startAction->setToolTip(disabledReason);
|
||||||
m_toolBox->setEnabled(!m_isRunning);
|
m_toolBox->setEnabled(!m_isRunning);
|
||||||
m_stopAction->setEnabled(m_isRunning);
|
m_stopAction->setEnabled(m_isRunning);
|
||||||
|
@@ -62,12 +62,12 @@ AnalyzerAction::AnalyzerAction(QObject *parent)
|
|||||||
: QAction(parent)
|
: QAction(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool AnalyzerAction::isRunnable() const
|
bool AnalyzerAction::isRunnable(QString *reason) const
|
||||||
{
|
{
|
||||||
if (m_startMode == StartRemote)
|
if (m_startMode == StartRemote)
|
||||||
return true;
|
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
|
AnalyzerRunControl *AnalyzerAction::tryCreateRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) const
|
||||||
|
@@ -90,10 +90,8 @@ public:
|
|||||||
Core::Id toolId() const { return m_toolId; }
|
Core::Id toolId() const { return m_toolId; }
|
||||||
void setToolId(Core::Id id) { m_toolId = id; }
|
void setToolId(Core::Id id) { m_toolId = id; }
|
||||||
|
|
||||||
ProjectExplorer::RunMode runMode() const { return m_runMode; }
|
|
||||||
void setRunMode(ProjectExplorer::RunMode mode) { m_runMode = mode; }
|
void setRunMode(ProjectExplorer::RunMode mode) { m_runMode = mode; }
|
||||||
|
bool isRunnable(QString *reason = 0) const;
|
||||||
bool isRunnable() const;
|
|
||||||
|
|
||||||
/// Creates all widgets used by the tool.
|
/// Creates all widgets used by the tool.
|
||||||
/// Returns a control widget which will be shown in the status bar when
|
/// Returns a control widget which will be shown in the status bar when
|
||||||
|
Reference in New Issue
Block a user