Commit df91b0bb authored by hjk's avatar hjk

analyzer: cleanup

parent 64eba7e1
......@@ -709,7 +709,6 @@ void AnalyzerManager::addTool(IAnalyzerTool *tool)
{
d->delayedInit(); // be sure that there is a valid IMode instance
Internal::AnalyzerPlugin *plugin = Internal::AnalyzerPlugin::instance();
QAction *action = new QAction(tool->displayName(), d->m_toolGroup);
action->setData(d->m_tools.count());
action->setCheckable(true);
......@@ -736,8 +735,7 @@ void AnalyzerManager::addTool(IAnalyzerTool *tool)
d->m_toolBox->setEnabled(d->m_toolBox->count() > 1);
tool->initialize(plugin);
tool->initialize();
}
QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QString &title,
......
......@@ -139,7 +139,7 @@ void AnalyzerOutputPane::setCurrentIndex(int i)
}
}
void AnalyzerOutputPane::add(IAnalyzerOutputPaneAdapter *adapter)
void AnalyzerOutputPane::addAdapter(IAnalyzerOutputPaneAdapter *adapter)
{
if (m_adapters.isEmpty())
m_adapters.push_back(0); // Index for leading dummy widgets.
......@@ -153,25 +153,26 @@ void AnalyzerOutputPane::add(IAnalyzerOutputPaneAdapter *adapter)
void AnalyzerOutputPane::addToWidgets(IAnalyzerOutputPaneAdapter *adapter)
{
QTC_ASSERT(m_paneWidget, return; )
QWidget *toolPaneWidget = adapter->paneWidget();
QWidget *toolPaneWidget = adapter->paneWidget();
QTC_ASSERT(toolPaneWidget, return; )
m_paneStackedLayout->addWidget(toolPaneWidget);
QWidget *toolBarWidget = adapter->toolBarWidget(); // Might be 0
m_toolbarStackedWidget->addWidget(toolBarWidget ? toolBarWidget : AnalyzerUtils::createDummyWidget());
}
void AnalyzerOutputPane::setTool(IAnalyzerTool *t)
void AnalyzerOutputPane::setTool(IAnalyzerTool *tool)
{
if (debug)
qDebug() << "AnalyzerOutputPane::setTool" << t;
qDebug() << "AnalyzerOutputPane::setTool" << tool;
// No tool. show dummy label.
IAnalyzerOutputPaneAdapter *adapter = t ? t->outputPaneAdapter() :
static_cast<IAnalyzerOutputPaneAdapter *>(0);
IAnalyzerOutputPaneAdapter *adapter = 0;
if (tool)
adapter = tool->outputPaneAdapter();
// Re-show or add.
if (adapter) {
int index = m_adapters.indexOf(adapter);
if (index == -1) {
add(adapter);
addAdapter(adapter);
index = m_adapters.size();
}
setCurrentIndex(index);
......@@ -182,7 +183,7 @@ void AnalyzerOutputPane::setTool(IAnalyzerTool *t)
}
}
QWidget * AnalyzerOutputPane::outputWidget(QWidget *parent)
QWidget *AnalyzerOutputPane::outputWidget(QWidget *parent)
{
if (debug)
qDebug() << "AnalyzerOutputPane::outputWidget";
......
......@@ -45,6 +45,7 @@ class StyledSeparator;
namespace Analyzer {
class IAnalyzerTool;
class IAnalyzerOutputPaneAdapter;
namespace Internal {
class AnalyzerOutputPane : public Core::IOutputPane
......@@ -53,7 +54,7 @@ class AnalyzerOutputPane : public Core::IOutputPane
public:
explicit AnalyzerOutputPane(QObject *parent = 0);
void setTool(IAnalyzerTool *t);
void setTool(IAnalyzerTool *tool);
// IOutputPane
virtual QWidget *outputWidget(QWidget *parent);
virtual QList<QWidget *> toolBarWidgets() const;
......@@ -79,10 +80,10 @@ private slots:
private:
void clearTool();
inline int currentIndex() const;
inline IAnalyzerOutputPaneAdapter *currentAdapter() const;
int currentIndex() const;
IAnalyzerOutputPaneAdapter *currentAdapter() const;
void setCurrentIndex(int );
void add(IAnalyzerOutputPaneAdapter *adapter);
void addAdapter(IAnalyzerOutputPaneAdapter *adapter);
void addToWidgets(IAnalyzerOutputPaneAdapter *adapter);
void createWidgets(QWidget *paneParent);
bool isInitialized() const { return m_paneWidget != 0; }
......
......@@ -32,17 +32,12 @@
**
**************************************************************************/
#ifndef ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
#define ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
#include <projectexplorer/runconfiguration.h>
#include <analyzerbase/analyzerbase_global.h>
QT_BEGIN_NAMESPACE
class QStandardItemModel;
QT_END_NAMESPACE
namespace Utils {
class DetailsWidget;
}
......@@ -66,6 +61,6 @@ private:
Utils::DetailsWidget *m_detailsWidget;
};
}
} // namespace Analyzer
#endif // ANALYZER_INTERNAL_ANALYZERRUNCONFIGWIDGET_H
......@@ -53,7 +53,8 @@ using namespace Analyzer::Internal;
// AnalyzerRunControl::Private ///////////////////////////////////////////
class AnalyzerRunControl::Private {
class AnalyzerRunControl::Private
{
public:
Private();
......@@ -62,11 +63,8 @@ public:
};
AnalyzerRunControl::Private::Private()
: m_isRunning(false)
, m_engine(0)
{
}
: m_isRunning(false) , m_engine(0)
{}
// AnalyzerRunControl ////////////////////////////////////////////////////
......
......@@ -44,7 +44,6 @@
namespace Analyzer {
class IAnalyzerEngine;
class AnalyzerStartParameters;
class ANALYZER_EXPORT AnalyzerRunControl: public ProjectExplorer::RunControl
......
......@@ -45,29 +45,21 @@
#include <QtCore/QSettings>
using namespace Analyzer;
using namespace Analyzer::Internal;
static const char groupC[] = "Analyzer";
namespace Analyzer {
AnalyzerGlobalSettings *AnalyzerGlobalSettings::m_instance = 0;
AbstractAnalyzerSubConfig::AbstractAnalyzerSubConfig(QObject *parent)
: QObject(parent)
{
}
AbstractAnalyzerSubConfig::~AbstractAnalyzerSubConfig()
: QObject(parent)
{
}
AnalyzerSettings::AnalyzerSettings(QObject *parent)
: QObject(parent)
{
}
AnalyzerSettings::~AnalyzerSettings()
: QObject(parent)
{
}
......@@ -175,10 +167,6 @@ AnalyzerProjectSettings::AnalyzerProjectSettings(QObject *parent)
fromMap(gs->toMap());
}
AnalyzerProjectSettings::~AnalyzerProjectSettings()
{
}
QString AnalyzerProjectSettings::displayName() const
{
return tr("Analyzer Settings");
......@@ -193,3 +181,5 @@ QVariantMap AnalyzerProjectSettings::toMap() const
{
return AnalyzerSettings::toMap();
}
} // namespace Analyzer
......@@ -44,12 +44,10 @@
namespace Analyzer {
class AnalyzerSettings;
/**
* Utility function to set @p val if @p key is present in @p map.
*/
template <typename T> static void setIfPresent(const QVariantMap &map, const QString &key, T *val)
template <typename T> void setIfPresent(const QVariantMap &map, const QString &key, T *val)
{
if (!map.contains(key))
return;
......@@ -65,9 +63,9 @@ template <typename T> static void setIfPresent(const QVariantMap &map, const QSt
class ANALYZER_EXPORT AbstractAnalyzerSubConfig : public QObject
{
Q_OBJECT
public:
AbstractAnalyzerSubConfig(QObject *parent);
virtual ~AbstractAnalyzerSubConfig();
/// return a list of default values
virtual QVariantMap defaults() const = 0;
......@@ -91,8 +89,8 @@ public:
class ANALYZER_EXPORT AbstractAnalyzerSubConfigFactory
{
public:
AbstractAnalyzerSubConfigFactory(){}
virtual ~AbstractAnalyzerSubConfigFactory(){}
AbstractAnalyzerSubConfigFactory() {}
virtual ~AbstractAnalyzerSubConfigFactory() {}
virtual AbstractAnalyzerSubConfig *createGlobalSubConfig(QObject *parent) = 0;
virtual AbstractAnalyzerSubConfig *createProjectSubConfig(QObject *parent) = 0;
......@@ -113,8 +111,6 @@ template<class GlobalConfigT, class ProjectConfigT>
class ANALYZER_EXPORT AnalyzerSubConfigFactory : public AbstractAnalyzerSubConfigFactory
{
public:
AnalyzerSubConfigFactory(){}
AbstractAnalyzerSubConfig *createGlobalSubConfig(QObject *parent)
{
return new GlobalConfigT(parent);
......@@ -134,9 +130,8 @@ public:
class ANALYZER_EXPORT AnalyzerSettings : public QObject
{
Q_OBJECT
public:
virtual ~AnalyzerSettings();
public:
template<class T>
T *subConfig() const
{
......@@ -176,6 +171,7 @@ protected:
class ANALYZER_EXPORT AnalyzerGlobalSettings : public AnalyzerSettings
{
Q_OBJECT
public:
static AnalyzerGlobalSettings *instance();
~AnalyzerGlobalSettings();
......@@ -201,21 +197,21 @@ private:
* rc->extraAspect<AnalyzerProjectSettings>()->subConfig<YourProjectConfig>()->...
* @endcode
*/
class ANALYZER_EXPORT AnalyzerProjectSettings : public AnalyzerSettings, public ProjectExplorer::IRunConfigurationAspect
class ANALYZER_EXPORT AnalyzerProjectSettings
: public AnalyzerSettings, public ProjectExplorer::IRunConfigurationAspect
{
Q_OBJECT
public:
AnalyzerProjectSettings(QObject *parent = 0);
virtual ~AnalyzerProjectSettings();
QString displayName() const;
virtual QVariantMap toMap() const;
protected:
virtual bool fromMap(const QVariantMap &map);
};
}
} // namespace Analyzer
#endif // ANALYZER_INTERNAL_ANALYZERSETTINGS_H
......@@ -56,7 +56,8 @@
using namespace Analyzer;
using namespace Core;
void moveCursorToEndOfName(QTextCursor *tc) {
static void moveCursorToEndOfName(QTextCursor *tc)
{
QTextDocument *doc = tc->document();
if (!doc)
return;
......
......@@ -39,8 +39,7 @@ QT_BEGIN_NAMESPACE
class QWidget;
QT_END_NAMESPACE
namespace CPlusPlus
{
namespace CPlusPlus {
class Symbol;
}
......
......@@ -34,7 +34,7 @@
#include "ianalyzerengine.h"
using namespace Analyzer;
namespace Analyzer {
IAnalyzerEngine::IAnalyzerEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
......@@ -43,10 +43,6 @@ IAnalyzerEngine::IAnalyzerEngine(const AnalyzerStartParameters &sp,
{
}
IAnalyzerEngine::~IAnalyzerEngine()
{
}
ProjectExplorer::RunConfiguration *IAnalyzerEngine::runConfiguration() const
{
return m_runConfig;
......@@ -56,3 +52,5 @@ AnalyzerStartParameters IAnalyzerEngine::startParameters() const
{
return m_sp;
}
} // namespace Analyzer
......@@ -62,7 +62,6 @@ class ANALYZER_EXPORT IAnalyzerEngine : public QObject
public:
explicit IAnalyzerEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
virtual ~IAnalyzerEngine();
/// start analyzation process
virtual void start() = 0;
......
......@@ -42,7 +42,7 @@
#include <QtCore/QAbstractItemModel>
#include <QtCore/QModelIndex>
using namespace Analyzer;
namespace Analyzer {
IAnalyzerTool::IAnalyzerTool(QObject *parent) :
QObject(parent)
......@@ -64,9 +64,6 @@ IAnalyzerOutputPaneAdapter::IAnalyzerOutputPaneAdapter(QObject *parent) :
{
}
IAnalyzerOutputPaneAdapter::~IAnalyzerOutputPaneAdapter()
{
}
/*!
\class Analyzer::ListItemViewOutputPaneAdapter
......@@ -185,3 +182,5 @@ int ListItemViewOutputPaneAdapter::rowCount() const
{
return m_listView ? m_listView->model()->rowCount() : 0;
}
} // namespace Analyzer
......@@ -37,18 +37,20 @@
#include <QtCore/QObject>
QT_FORWARD_DECLARE_CLASS(QAbstractItemView)
QT_FORWARD_DECLARE_CLASS(QAbstractItemModel)
QT_FORWARD_DECLARE_CLASS(QWidget)
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QAbstractItemModel;
class QWidget;
QT_END_NAMESPACE
namespace Analyzer {
class ANALYZER_EXPORT IAnalyzerOutputPaneAdapter : public QObject
{
Q_OBJECT
public:
explicit IAnalyzerOutputPaneAdapter(QObject *parent = 0);
virtual ~IAnalyzerOutputPaneAdapter();
virtual QWidget *toolBarWidget() = 0;
virtual QWidget *paneWidget() = 0;
......@@ -70,6 +72,7 @@ signals:
class ANALYZER_EXPORT ListItemViewOutputPaneAdapter : public IAnalyzerOutputPaneAdapter
{
Q_OBJECT
public:
explicit ListItemViewOutputPaneAdapter(QObject *parent = 0);
......@@ -101,6 +104,6 @@ private:
bool m_showOnRowsInserted;
};
}
} // namespace Analyzer
#endif // IANALYZEROUTPUTPANEADAPTER_H
......@@ -43,10 +43,6 @@ namespace ProjectExplorer {
class RunConfiguration;
}
namespace ExtensionSystem {
class IPlugin;
}
namespace Analyzer {
class AnalyzerStartParameters;
......@@ -93,7 +89,7 @@ public:
* The implementation should setup widgets for the output pane here and optionally add
* dock widgets in the analyzation mode if wanted.
*/
virtual void initialize(ExtensionSystem::IPlugin *plugin) = 0;
virtual void initialize() = 0;
/// gets called after all analyzation tools where initialized.
virtual void extensionsInitialized() = 0;
......
......@@ -41,8 +41,8 @@
namespace Analyzer {
StartRemoteDialog::StartRemoteDialog(QWidget *parent, Qt::WindowFlags f)
: QDialog(parent, f)
, m_ui(new Ui::StartRemoteDialog)
: QDialog(parent, f)
, m_ui(new Ui::StartRemoteDialog)
{
m_ui->setupUi(this);
......@@ -144,4 +144,4 @@ QString StartRemoteDialog::workingDirectory() const
return m_ui->workingDirectory->text();
}
}
} // namespace Analyzer
......@@ -41,18 +41,9 @@
#include <QtCore/QtPlugin>
using namespace Analyzer;
using namespace Callgrind;
using namespace Callgrind::Internal;
CallgrindPlugin::CallgrindPlugin()
{
}
CallgrindPlugin::~CallgrindPlugin()
{
}
namespace Callgrind {
namespace Internal {
bool CallgrindPlugin::initialize(const QStringList &/*arguments*/, QString */*errorString*/)
{
......@@ -66,7 +57,9 @@ bool CallgrindPlugin::initialize(const QStringList &/*arguments*/, QString */*er
void CallgrindPlugin::extensionsInitialized()
{
}
Q_EXPORT_PLUGIN(CallgrindPlugin)
} // namespace Internal
} // namespace Callgrind
Q_EXPORT_PLUGIN(Callgrind::Internal::CallgrindPlugin)
......@@ -43,8 +43,7 @@ class CallgrindPlugin : public ExtensionSystem::IPlugin
Q_OBJECT
public:
CallgrindPlugin();
~CallgrindPlugin();
CallgrindPlugin() {}
virtual bool initialize(const QStringList &arguments, QString *errorString);
virtual void extensionsInitialized();
......
......@@ -57,11 +57,6 @@ AbstractCallgrindSettings::AbstractCallgrindSettings(QObject *parent)
}
AbstractCallgrindSettings::~AbstractCallgrindSettings()
{
}
void AbstractCallgrindSettings::setEnableCacheSim(bool enable)
{
if (m_enableCacheSim == enable)
......
......@@ -50,7 +50,6 @@ class AbstractCallgrindSettings : public Analyzer::AbstractAnalyzerSubConfig
public:
AbstractCallgrindSettings(QObject *parent = 0);
virtual ~AbstractCallgrindSettings();
inline bool enableCacheSim() const { return m_enableCacheSim; }
inline bool enableBranchSim() const { return m_enableBranchSim; }
......
......@@ -82,8 +82,6 @@
// shared/cplusplus includes
#include <Symbols.h>
using namespace Callgrind;
using namespace Analyzer;
using namespace Core;
using namespace Valgrind::Callgrind;
......@@ -136,7 +134,7 @@ IAnalyzerTool::ToolMode CallgrindTool::mode() const
return ReleaseMode;
}
void CallgrindTool::initialize(ExtensionSystem::IPlugin */*plugin*/)
void CallgrindTool::initialize()
{
AnalyzerManager *am = AnalyzerManager::instance();
......@@ -491,5 +489,5 @@ bool CallgrindTool::canRunRemotely() const
return true;
}
}
}
} // namespace Internal
} // namespace Callgrind
......@@ -38,32 +38,22 @@
#include <QtCore/QVector>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QAction;
class QComboBox;
class QSortFilterProxyModel;
class QMenu;
class QModelIndex;
QT_END_NAMESPACE
namespace Valgrind {
namespace Callgrind {
class CostView;
class DataModel;
class DataProxyModel;
class Function;
class ParseData;
class StackBrowser;
class Visualisation;
}
}
namespace TextEditor
{
namespace TextEditor {
class ITextEditor;
}
namespace Core
{
namespace Core {
class IEditor;
}
......@@ -87,7 +77,7 @@ public:
virtual QString displayName() const;
virtual ToolMode mode() const;
virtual void initialize(ExtensionSystem::IPlugin *plugin);
virtual void initialize();
virtual void extensionsInitialized();
virtual void initializeDockWidgets();
......
......@@ -48,16 +48,6 @@ using namespace Memcheck;
using namespace Memcheck::Internal;
MemcheckPlugin::MemcheckPlugin()
{
}
MemcheckPlugin::~MemcheckPlugin()
{
}
bool MemcheckPlugin::initialize(const QStringList &/*arguments*/, QString */*errorString*/)
{
typedef AnalyzerSubConfigFactory<MemcheckGlobalSettings, MemcheckProjectSettings> MemcheckConfigFactory;
......@@ -70,7 +60,6 @@ bool MemcheckPlugin::initialize(const QStringList &/*arguments*/, QString */*err
void MemcheckPlugin::extensionsInitialized()
{
}