forked from qt-creator/qt-creator
Analyzer: Flatten AnalyzerManager::addTool
Add tool/startMode combo one by one. Change-Id: I1e6cfe98fb1b1291cae6f440105991f3f99f2a6a Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
@@ -147,7 +147,7 @@ public:
|
||||
|
||||
void activateDock(Qt::DockWidgetArea area, QDockWidget *dockWidget);
|
||||
void deactivateDock(QDockWidget *dockWidget);
|
||||
void addTool(IAnalyzerTool *tool, const StartModes &modes);
|
||||
void addTool(IAnalyzerTool *tool, StartMode mode);
|
||||
void selectSavedTool();
|
||||
void selectTool(QAction *action);
|
||||
void handleToolStarted();
|
||||
@@ -537,12 +537,12 @@ void AnalyzerManagerPrivate::selectTool(QAction *action)
|
||||
updateRunActions();
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &modes)
|
||||
void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
delayedInit(); // Make sure that there is a valid IMode instance.
|
||||
|
||||
const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
|
||||
foreach (StartMode mode, modes) {
|
||||
|
||||
QString actionName = tool->displayName();
|
||||
Id menuGroup = Constants::G_ANALYZER_TOOLS;
|
||||
if (mode == StartRemote) {
|
||||
@@ -563,7 +563,8 @@ void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &mode
|
||||
m_toolBox->addItem(actionName);
|
||||
m_toolBox->blockSignals(blocked);
|
||||
connect(action, SIGNAL(triggered()), SLOT(selectMenuAction()));
|
||||
}
|
||||
|
||||
if (!m_tools.contains(tool))
|
||||
m_tools.append(tool);
|
||||
m_toolBox->setEnabled(true);
|
||||
}
|
||||
@@ -664,9 +665,9 @@ void AnalyzerManager::shutdown()
|
||||
m_instance->d->saveToolSettings(m_instance->d->m_currentAction);
|
||||
}
|
||||
|
||||
void AnalyzerManager::addTool(IAnalyzerTool *tool, const StartModes &modes)
|
||||
void AnalyzerManager::addTool(IAnalyzerTool *tool, StartMode mode)
|
||||
{
|
||||
m_instance->d->addTool(tool, modes);
|
||||
m_instance->d->addTool(tool, mode);
|
||||
}
|
||||
|
||||
QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QString &title,
|
||||
|
||||
@@ -48,8 +48,6 @@ namespace ProjectExplorer { class RunConfiguration; }
|
||||
|
||||
namespace Analyzer {
|
||||
|
||||
typedef QList<StartMode> StartModes;
|
||||
|
||||
class IAnalyzerTool;
|
||||
class AnalyzerRunControl;
|
||||
class AnalyzerManagerPrivate;
|
||||
@@ -68,8 +66,8 @@ public:
|
||||
static void extensionsInitialized();
|
||||
static void shutdown();
|
||||
|
||||
// Register a tool and initialize it.
|
||||
static void addTool(IAnalyzerTool *tool, const StartModes &mode);
|
||||
// Register a tool for a given start mode.
|
||||
static void addTool(IAnalyzerTool *tool, StartMode mode);
|
||||
|
||||
// Dockwidgets are registered to the main window.
|
||||
static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
|
||||
|
||||
@@ -46,10 +46,9 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorString)
|
||||
|
||||
StartModes modes;
|
||||
modes.append(StartMode(StartLocal));
|
||||
modes.append(StartMode(StartRemote));
|
||||
AnalyzerManager::addTool(new QmlProfilerTool(this), modes);
|
||||
IAnalyzerTool *tool = new QmlProfilerTool(this);
|
||||
AnalyzerManager::addTool(tool, StartLocal);
|
||||
AnalyzerManager::addTool(tool, StartRemote);
|
||||
|
||||
addAutoReleasedObject(new QmlProfilerRunControlFactory());
|
||||
|
||||
|
||||
@@ -52,15 +52,14 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
{
|
||||
AnalyzerGlobalSettings::registerConfig(new ValgrindGlobalSettings());
|
||||
|
||||
StartModes modes;
|
||||
if (!Utils::HostOsInfo::isWindowsHost())
|
||||
modes.append(StartMode(StartLocal));
|
||||
modes.append(StartMode(StartRemote));
|
||||
|
||||
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
|
||||
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
|
||||
AnalyzerManager::addTool(memcheckTool, modes);
|
||||
AnalyzerManager::addTool(callgrindTool, modes);
|
||||
if (!Utils::HostOsInfo::isWindowsHost()) {
|
||||
AnalyzerManager::addTool(memcheckTool, StartLocal);
|
||||
AnalyzerManager::addTool(callgrindTool, StartLocal);
|
||||
}
|
||||
AnalyzerManager::addTool(memcheckTool, StartRemote);
|
||||
AnalyzerManager::addTool(callgrindTool, StartRemote);
|
||||
|
||||
addAutoReleasedObject(new ValgrindRunControlFactory());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user