forked from qt-creator/qt-creator
Analyzer: Handle createProjectSettings outside IAnalyzerTool
Less indirection. Change-Id: If702a0a44c1fc96510fd1c5411fda51660dde10b Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
@@ -684,11 +684,6 @@ QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QStrin
|
|||||||
return dockWidget;
|
return dockWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<IAnalyzerTool *> AnalyzerManager::tools()
|
|
||||||
{
|
|
||||||
return d->m_tools;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerManager::selectTool(IAnalyzerTool *tool, StartMode mode)
|
void AnalyzerManager::selectTool(IAnalyzerTool *tool, StartMode mode)
|
||||||
{
|
{
|
||||||
d->selectTool(d->actionFromToolAndMode(tool, mode));
|
d->selectTool(d->actionFromToolAndMode(tool, mode));
|
||||||
|
@@ -75,7 +75,6 @@ public:
|
|||||||
static Utils::FancyMainWindow *mainWindow();
|
static Utils::FancyMainWindow *mainWindow();
|
||||||
|
|
||||||
static void showMode();
|
static void showMode();
|
||||||
static QList<IAnalyzerTool *> tools();
|
|
||||||
static void selectTool(IAnalyzerTool *tool, StartMode mode);
|
static void selectTool(IAnalyzerTool *tool, StartMode mode);
|
||||||
static void startTool();
|
static void startTool();
|
||||||
static void stopTool();
|
static void stopTool();
|
||||||
|
@@ -46,7 +46,6 @@ class DetailsWidget;
|
|||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
class AnalyzerSettings;
|
|
||||||
class AbstractAnalyzerSubConfig;
|
class AbstractAnalyzerSubConfig;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
@@ -151,16 +151,18 @@ void AnalyzerGlobalSettings::registerConfig(AbstractAnalyzerSubConfig *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static QList<AnalyzerSubConfigFactory *> theAnalyzerSubConfigFactories()
|
||||||
|
{
|
||||||
|
static QList<AnalyzerSubConfigFactory *> theFactories;
|
||||||
|
return theFactories;
|
||||||
|
}
|
||||||
|
|
||||||
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect()
|
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect()
|
||||||
: AnalyzerSettings((QObject *)0), m_useGlobalSettings(true)
|
: AnalyzerSettings((QObject *)0), m_useGlobalSettings(true)
|
||||||
{
|
{
|
||||||
QList<IAnalyzerTool*> tools = AnalyzerManager::tools();
|
|
||||||
// add sub configs
|
// add sub configs
|
||||||
foreach (IAnalyzerTool *tool, tools) {
|
foreach (AnalyzerSubConfigFactory *factory, theAnalyzerSubConfigFactories())
|
||||||
AbstractAnalyzerSubConfig *config = tool->createProjectSettings();
|
m_customConfigurations.append(factory->createProjectSettings());
|
||||||
if (config)
|
|
||||||
m_customConfigurations.append(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
|
m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
|
||||||
resetCustomToGlobalSettings();
|
resetCustomToGlobalSettings();
|
||||||
@@ -184,6 +186,11 @@ AnalyzerRunConfigurationAspect::~AnalyzerRunConfigurationAspect()
|
|||||||
qDeleteAll(m_customConfigurations);
|
qDeleteAll(m_customConfigurations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnalyzerRunConfigurationAspect::registerConfigFactory(AnalyzerSubConfigFactory *factory)
|
||||||
|
{
|
||||||
|
theAnalyzerSubConfigFactories().append(factory);
|
||||||
|
}
|
||||||
|
|
||||||
QString AnalyzerRunConfigurationAspect::displayName() const
|
QString AnalyzerRunConfigurationAspect::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Analyzer Settings");
|
return tr("Analyzer Settings");
|
||||||
|
@@ -81,6 +81,17 @@ public:
|
|||||||
virtual AbstractAnalyzerSubConfig *clone() = 0;
|
virtual AbstractAnalyzerSubConfig *clone() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ANALYZER_EXPORT AnalyzerSubConfigFactory : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
AnalyzerSubConfigFactory() {}
|
||||||
|
|
||||||
|
/// Factory method to create the project tool setting
|
||||||
|
virtual AbstractAnalyzerSubConfig *createProjectSettings() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared interface for the global and per-project settings.
|
* Shared interface for the global and per-project settings.
|
||||||
*
|
*
|
||||||
@@ -168,6 +179,8 @@ public:
|
|||||||
AnalyzerRunConfigurationAspect(const AnalyzerRunConfigurationAspect *other);
|
AnalyzerRunConfigurationAspect(const AnalyzerRunConfigurationAspect *other);
|
||||||
~AnalyzerRunConfigurationAspect();
|
~AnalyzerRunConfigurationAspect();
|
||||||
|
|
||||||
|
static void registerConfigFactory(AnalyzerSubConfigFactory *factory);
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
AnalyzerRunConfigurationAspect *clone(ProjectExplorer::RunConfiguration *parent) const;
|
AnalyzerRunConfigurationAspect *clone(ProjectExplorer::RunConfiguration *parent) const;
|
||||||
|
@@ -60,11 +60,6 @@ IAnalyzerTool::IAnalyzerTool(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AbstractAnalyzerSubConfig *IAnalyzerTool::createProjectSettings()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode,
|
static bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode,
|
||||||
BuildConfiguration::BuildType buildType)
|
BuildConfiguration::BuildType buildType)
|
||||||
{
|
{
|
||||||
|
@@ -113,9 +113,6 @@ public:
|
|||||||
|
|
||||||
/// Called when tools gets deselected.
|
/// Called when tools gets deselected.
|
||||||
virtual void toolDeselected() const {}
|
virtual void toolDeselected() const {}
|
||||||
|
|
||||||
/// Factory method to create the project tool setting
|
|
||||||
virtual AbstractAnalyzerSubConfig *createProjectSettings();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -297,11 +297,6 @@ QString MemcheckTool::description() const
|
|||||||
"memory leaks");
|
"memory leaks");
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractAnalyzerSubConfig *MemcheckTool::createProjectSettings()
|
|
||||||
{
|
|
||||||
return new ValgrindProjectSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
IAnalyzerTool::ToolMode MemcheckTool::toolMode() const
|
IAnalyzerTool::ToolMode MemcheckTool::toolMode() const
|
||||||
{
|
{
|
||||||
return DebugMode;
|
return DebugMode;
|
||||||
|
@@ -89,9 +89,6 @@ public:
|
|||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
|
||||||
// Create the valgrind settings (for all valgrind tools)
|
|
||||||
Analyzer::AbstractAnalyzerSubConfig *createProjectSettings();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void settingsDestroyed(QObject *settings);
|
void settingsDestroyed(QObject *settings);
|
||||||
void maybeActiveRunConfigurationChanged();
|
void maybeActiveRunConfigurationChanged();
|
||||||
|
@@ -48,9 +48,18 @@ using namespace Analyzer;
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class ProjectSettingsFactory : public AnalyzerSubConfigFactory
|
||||||
|
{
|
||||||
|
AbstractAnalyzerSubConfig *createProjectSettings()
|
||||||
|
{
|
||||||
|
return new ValgrindProjectSettings();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||||
{
|
{
|
||||||
AnalyzerGlobalSettings::registerConfig(new ValgrindGlobalSettings());
|
AnalyzerGlobalSettings::registerConfig(new ValgrindGlobalSettings());
|
||||||
|
AnalyzerRunConfigurationAspect::registerConfigFactory(new ProjectSettingsFactory());
|
||||||
|
|
||||||
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
|
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
|
||||||
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
|
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
|
||||||
|
Reference in New Issue
Block a user