forked from qt-creator/qt-creator
Analyzer: Slim down AnalyzerManager interface
Change-Id: Ia6f4ba7a342d3ba2dfbf30511192155daf02a8d6 Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include "analyzerplugin.h"
|
#include "analyzerplugin.h"
|
||||||
#include "ianalyzertool.h"
|
#include "ianalyzertool.h"
|
||||||
#include "analyzersettings.h"
|
#include "analyzersettings.h"
|
||||||
|
#include "analyzerruncontrol.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/findplaceholder.h>
|
#include <coreplugin/findplaceholder.h>
|
||||||
@@ -730,18 +731,6 @@ void AnalyzerManager::showPermanentStatusMessage(const QString &message)
|
|||||||
showStatusMessage(message, -1);
|
showStatusMessage(message, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AnalyzerManager::msgToolStarted(const QString &name)
|
|
||||||
{
|
|
||||||
return tr("Tool \"%1\" started...").arg(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AnalyzerManager::msgToolFinished(const QString &name, int issuesFound)
|
|
||||||
{
|
|
||||||
return issuesFound ?
|
|
||||||
tr("Tool \"%1\" finished, %n issues were found.", 0, issuesFound).arg(name) :
|
|
||||||
tr("Tool \"%1\" finished, no issues were found.").arg(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerManager::showMode()
|
void AnalyzerManager::showMode()
|
||||||
{
|
{
|
||||||
if (m_instance->d->m_mode)
|
if (m_instance->d->m_mode)
|
||||||
@@ -774,9 +763,14 @@ AnalyzerRunControl *AnalyzerManager::createRunControl(
|
|||||||
ProjectExplorer::RunMode runMode,
|
ProjectExplorer::RunMode runMode,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
foreach (IAnalyzerTool *tool, m_instance->d->m_tools)
|
foreach (IAnalyzerTool *tool, m_instance->d->m_tools) {
|
||||||
if (tool->runMode() == runMode)
|
if (tool->runMode() == runMode) {
|
||||||
return tool->createRunControl(sp, runConfiguration);
|
AnalyzerRunControl *rc = tool->createRunControl(sp, runConfiguration);
|
||||||
|
showStatusMessage(tr("Tool \"%1\" started...").arg(rc->displayName()));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
*errorMessage = tr("No analyzer tool selected.");
|
*errorMessage = tr("No analyzer tool selected.");
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -85,9 +85,6 @@ public:
|
|||||||
static void stopTool();
|
static void stopTool();
|
||||||
|
|
||||||
// Convenience functions.
|
// Convenience functions.
|
||||||
static QString msgToolStarted(const QString &name);
|
|
||||||
static QString msgToolFinished(const QString &name, int issuesFound);
|
|
||||||
|
|
||||||
static void showStatusMessage(const QString &message, int timeoutMS = 10000);
|
static void showStatusMessage(const QString &message, int timeoutMS = 10000);
|
||||||
static void showPermanentStatusMessage(const QString &message);
|
static void showPermanentStatusMessage(const QString &message);
|
||||||
|
|
||||||
|
@@ -593,8 +593,6 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa
|
|||||||
rc->setToggleCollectFunction(m_toggleCollectFunction);
|
rc->setToggleCollectFunction(m_toggleCollectFunction);
|
||||||
m_toggleCollectFunction.clear();
|
m_toggleCollectFunction.clear();
|
||||||
|
|
||||||
AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(q->displayName()));
|
|
||||||
|
|
||||||
QTC_ASSERT(m_visualisation, return rc);
|
QTC_ASSERT(m_visualisation, return rc);
|
||||||
|
|
||||||
// apply project settings
|
// apply project settings
|
||||||
|
@@ -460,7 +460,6 @@ AnalyzerRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters
|
|||||||
connect(engine, SIGNAL(internalParserError(QString)),
|
connect(engine, SIGNAL(internalParserError(QString)),
|
||||||
this, SLOT(internalParserError(QString)));
|
this, SLOT(internalParserError(QString)));
|
||||||
connect(engine, SIGNAL(finished()), this, SLOT(finished()));
|
connect(engine, SIGNAL(finished()), this, SLOT(finished()));
|
||||||
AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(displayName()));
|
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,11 +544,14 @@ void MemcheckTool::updateErrorFilter()
|
|||||||
|
|
||||||
void MemcheckTool::finished()
|
void MemcheckTool::finished()
|
||||||
{
|
{
|
||||||
const int n = m_errorModel->rowCount();
|
const int issuesFound = m_errorModel->rowCount();
|
||||||
m_goBack->setEnabled(n > 1);
|
m_goBack->setEnabled(issuesFound > 1);
|
||||||
m_goNext->setEnabled(n > 1);
|
m_goNext->setEnabled(issuesFound > 1);
|
||||||
const QString msg = AnalyzerManager::msgToolFinished(displayName(), n);
|
AnalyzerManager::showStatusMessage((issuesFound > 0
|
||||||
AnalyzerManager::showStatusMessage(msg);
|
? AnalyzerManager::tr("Tool \"%1\" finished, %n issues were found.", 0, issuesFound)
|
||||||
|
: AnalyzerManager::tr("Tool \"%1\" finished, no issues were found."))
|
||||||
|
.arg(displayName()));
|
||||||
|
|
||||||
setBusyCursor(false);
|
setBusyCursor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user