Analyzer: Cleanup settings handling

More flexible, less over-engineered this way.

Change-Id: I3e224a6be85d3a187056d79fd506e8cf6a32c8a9
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
hjk
2013-08-08 17:37:37 +02:00
parent 2d4afd0494
commit 5fa7b60b97
32 changed files with 282 additions and 632 deletions

View File

@@ -37,23 +37,42 @@
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzersettings.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <valgrind/valgrindsettings.h>
#include <utils/hostosinfo.h>
#include <QtPlugin>
#include <QCoreApplication>
using namespace Analyzer;
namespace Valgrind {
namespace Internal {
class ProjectSettingsFactory : public AnalyzerSubConfigFactory
static ValgrindGlobalSettings *theGlobalSettings = 0;
class ValgrindOptionsPage : public Core::IOptionsPage
{
AbstractAnalyzerSubConfig *createProjectSettings()
public:
explicit ValgrindOptionsPage()
{
return new ValgrindProjectSettings();
setId(ANALYZER_VALGRIND_SETTINGS);
setDisplayName(tr("Valgrind"));
setCategory("T.Analyzer");
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
setCategoryIcon(QLatin1String(":/images/analyzer_category.png"));
}
QWidget *createPage(QWidget *parent) {
return theGlobalSettings->createConfigWidget(parent);
}
void apply() {
theGlobalSettings->writeSettings();
}
void finish() {}
};
class ValgrindAction : public AnalyzerAction
@@ -62,10 +81,19 @@ public:
ValgrindAction() {}
};
ValgrindPlugin::~ValgrindPlugin()
{
delete theGlobalSettings;
theGlobalSettings = 0;
}
bool ValgrindPlugin::initialize(const QStringList &, QString *)
{
AnalyzerGlobalSettings::registerConfig(new ValgrindGlobalSettings());
AnalyzerRunConfigurationAspect::registerConfigFactory(new ProjectSettingsFactory());
theGlobalSettings = new ValgrindGlobalSettings();
theGlobalSettings->readSettings();
addAutoReleasedObject(new ValgrindOptionsPage());
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
@@ -122,6 +150,11 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
return true;
}
ValgrindGlobalSettings *ValgrindPlugin::globalSettings()
{
return theGlobalSettings;
}
} // namespace Internal
} // namespace Valgrind