forked from qt-creator/qt-creator
Analyzers: Various cleanups
Fallout after the demise of IAnalizerTool. Change-Id: I68f936ed5f2929dc4f09a408bdf6b0ea38e568ef Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -153,14 +153,9 @@ public:
|
|||||||
void handleToolFinished();
|
void handleToolFinished();
|
||||||
void saveToolSettings(Id toolId);
|
void saveToolSettings(Id toolId);
|
||||||
void loadToolSettings(Id toolId);
|
void loadToolSettings(Id toolId);
|
||||||
|
|
||||||
// Convenience.
|
|
||||||
bool isActionRunnable(AnalyzerAction *action) const;
|
bool isActionRunnable(AnalyzerAction *action) const;
|
||||||
|
|
||||||
public slots:
|
|
||||||
void startTool();
|
void startTool();
|
||||||
void selectToolboxAction(int);
|
void selectToolboxAction(int);
|
||||||
void selectMenuAction();
|
|
||||||
void modeChanged(IMode *mode);
|
void modeChanged(IMode *mode);
|
||||||
void resetLayout();
|
void resetLayout();
|
||||||
void updateRunActions();
|
void updateRunActions();
|
||||||
@@ -472,15 +467,6 @@ void AnalyzerManagerPrivate::selectSavedTool()
|
|||||||
selectAction(m_actions.first());
|
selectAction(m_actions.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerManagerPrivate::selectMenuAction()
|
|
||||||
{
|
|
||||||
AnalyzerManager::showMode();
|
|
||||||
AnalyzerAction *action = qobject_cast<AnalyzerAction *>(sender());
|
|
||||||
QTC_ASSERT(action, return);
|
|
||||||
selectAction(action);
|
|
||||||
startTool();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerManagerPrivate::selectToolboxAction(int index)
|
void AnalyzerManagerPrivate::selectToolboxAction(int index)
|
||||||
{
|
{
|
||||||
selectAction(m_actions[index]);
|
selectAction(m_actions[index]);
|
||||||
@@ -540,7 +526,13 @@ void AnalyzerManagerPrivate::addAction(AnalyzerAction *action)
|
|||||||
m_actions.append(action);
|
m_actions.append(action);
|
||||||
m_toolBox->addItem(action->text());
|
m_toolBox->addItem(action->text());
|
||||||
m_toolBox->blockSignals(blocked);
|
m_toolBox->blockSignals(blocked);
|
||||||
connect(action, &QAction::triggered, this, &AnalyzerManagerPrivate::selectMenuAction);
|
|
||||||
|
connect(action, &QAction::triggered, this, [this, action] {
|
||||||
|
AnalyzerManager::showMode();
|
||||||
|
selectAction(action);
|
||||||
|
startTool();
|
||||||
|
});
|
||||||
|
|
||||||
m_toolBox->setEnabled(true);
|
m_toolBox->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,10 +635,10 @@ QDockWidget *AnalyzerManager::createDockWidget(Core::Id toolId,
|
|||||||
return dockWidget;
|
return dockWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerManager::selectTool(Id toolId, StartMode mode)
|
void AnalyzerManager::selectTool(Id actionId)
|
||||||
{
|
{
|
||||||
foreach (AnalyzerAction *action, d->m_actions)
|
foreach (AnalyzerAction *action, d->m_actions)
|
||||||
if (action->toolId() == toolId && action->startMode() == mode)
|
if (action->actionId() == actionId)
|
||||||
d->selectAction(action);
|
d->selectAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ public:
|
|||||||
static Utils::FancyMainWindow *mainWindow();
|
static Utils::FancyMainWindow *mainWindow();
|
||||||
|
|
||||||
static void showMode();
|
static void showMode();
|
||||||
static void selectTool(Core::Id toolId, StartMode mode);
|
static void selectTool(Core::Id actionId);
|
||||||
static void startTool();
|
static void startTool();
|
||||||
static void stopTool();
|
static void stopTool();
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
|
|||||||
"applications using QML.");
|
"applications using QML.");
|
||||||
|
|
||||||
action = new AnalyzerAction(this);
|
action = new AnalyzerAction(this);
|
||||||
action->setActionId("QmlProfiler.Local");
|
action->setActionId(QmlProfilerLocalActionId);
|
||||||
action->setToolId(QmlProfilerToolId);
|
action->setToolId(QmlProfilerToolId);
|
||||||
action->setWidgetCreator(widgetCreator);
|
action->setWidgetCreator(widgetCreator);
|
||||||
action->setRunControlCreator(runControlCreator);
|
action->setRunControlCreator(runControlCreator);
|
||||||
@@ -80,7 +80,7 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
|
|||||||
AnalyzerManager::addAction(action);
|
AnalyzerManager::addAction(action);
|
||||||
|
|
||||||
action = new AnalyzerAction(this);
|
action = new AnalyzerAction(this);
|
||||||
action->setActionId("QmlProfiler.Remote");
|
action->setActionId(QmlProfilerRemoteActionId);
|
||||||
action->setToolId(QmlProfilerToolId);
|
action->setToolId(QmlProfilerToolId);
|
||||||
action->setWidgetCreator(widgetCreator);
|
action->setWidgetCreator(widgetCreator);
|
||||||
action->setRunControlCreator(runControlCreator);
|
action->setRunControlCreator(runControlCreator);
|
||||||
|
@@ -601,7 +601,7 @@ void QmlProfilerTool::showLoadDialog()
|
|||||||
if (ModeManager::currentMode()->id() != MODE_ANALYZE)
|
if (ModeManager::currentMode()->id() != MODE_ANALYZE)
|
||||||
AnalyzerManager::showMode();
|
AnalyzerManager::showMode();
|
||||||
|
|
||||||
AnalyzerManager::selectTool("QmlProfiler", StartRemote);
|
AnalyzerManager::selectTool(QmlProfilerRemoteActionId);
|
||||||
|
|
||||||
QString filename = QFileDialog::getOpenFileName(ICore::mainWindow(), tr("Load QML Trace"), QString(),
|
QString filename = QFileDialog::getOpenFileName(ICore::mainWindow(), tr("Load QML Trace"), QString(),
|
||||||
tr("QML traces (*%1)").arg(QLatin1String(TraceFileExtension)));
|
tr("QML traces (*%1)").arg(QLatin1String(TraceFileExtension)));
|
||||||
|
@@ -43,6 +43,8 @@ namespace QmlProfiler {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char QmlProfilerToolId[] = "QmlProfiler";
|
const char QmlProfilerToolId[] = "QmlProfiler";
|
||||||
|
const char QmlProfilerLocalActionId[] = "QmlProfiler.Local";
|
||||||
|
const char QmlProfilerRemoteActionId[] = "QmlProfiler.Remote";
|
||||||
|
|
||||||
class QmlProfilerTool : public QObject
|
class QmlProfilerTool : public QObject
|
||||||
{
|
{
|
||||||
|
@@ -906,7 +906,7 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
|
|||||||
|
|
||||||
m_toggleCollectFunction = qualifiedFunctionName + QLatin1String("()");
|
m_toggleCollectFunction = qualifiedFunctionName + QLatin1String("()");
|
||||||
|
|
||||||
AnalyzerManager::selectTool(CallgrindToolId, StartLocal);
|
AnalyzerManager::selectTool(CallgrindLocalActionId);
|
||||||
AnalyzerManager::startTool();
|
AnalyzerManager::startTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,6 +37,8 @@ namespace Valgrind {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char CallgrindToolId[] = "Callgrind";
|
const char CallgrindToolId[] = "Callgrind";
|
||||||
|
const char CallgrindLocalActionId[] = "Callgrind.Local";
|
||||||
|
const char CallgrindRemoteActionId[] = "Callgrind.Remote";
|
||||||
|
|
||||||
class CallgrindToolPrivate;
|
class CallgrindToolPrivate;
|
||||||
|
|
||||||
|
@@ -178,7 +178,7 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
|||||||
AnalyzerManager::addAction(action);
|
AnalyzerManager::addAction(action);
|
||||||
|
|
||||||
action = new AnalyzerAction(this);
|
action = new AnalyzerAction(this);
|
||||||
action->setActionId("Callgrind.Local");
|
action->setActionId(CallgrindLocalActionId);
|
||||||
action->setToolId(CallgrindToolId);
|
action->setToolId(CallgrindToolId);
|
||||||
action->setWidgetCreator(cgWidgetCreator);
|
action->setWidgetCreator(cgWidgetCreator);
|
||||||
action->setRunControlCreator(cgRunControlCreator);
|
action->setRunControlCreator(cgRunControlCreator);
|
||||||
@@ -206,7 +206,7 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
|||||||
AnalyzerManager::addAction(action);
|
AnalyzerManager::addAction(action);
|
||||||
|
|
||||||
action = new AnalyzerAction(this);
|
action = new AnalyzerAction(this);
|
||||||
action->setActionId("Callgrind.Remote");
|
action->setActionId(CallgrindRemoteActionId);
|
||||||
action->setToolId(CallgrindToolId);
|
action->setToolId(CallgrindToolId);
|
||||||
action->setWidgetCreator(cgWidgetCreator);
|
action->setWidgetCreator(cgWidgetCreator);
|
||||||
action->setRunControlCreator(cgRunControlCreator);
|
action->setRunControlCreator(cgRunControlCreator);
|
||||||
|
Reference in New Issue
Block a user