Commit f3bd7412 authored by hjk's avatar hjk

Debugger: Remove return value from AnalyzerManager::createDockWidget()

Change-Id: If6cd2a68f2f99a1977ded0f05a12790194143274
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 6492d164
......@@ -126,7 +126,8 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString
addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory(m_analyzerTool));
addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage);
auto widgetCreator = [tool] { return tool->createWidgets(); };
AnalyzerManager::registerToolbar(ClangStaticAnalyzerPerspectiveId, tool->createWidgets());
auto runControlCreator = [tool](ProjectExplorer::RunConfiguration *runConfiguration,
Core::Id runMode) {
return tool->createRunControl(runConfiguration, runMode);
......@@ -135,24 +136,21 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString
const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the clang project "
"to find bugs.");
Perspective perspective(ClangStaticAnalyzerPerspective);
perspective.addDock(ClangStaticAnalyzerDock, Core::Id(), Perspective::SplitVertical);
AnalyzerManager::addPerspective(perspective);
AnalyzerManager::registerPerspective(ClangStaticAnalyzerPerspectiveId, {
{ ClangStaticAnalyzerDockId, Core::Id(), Perspective::SplitVertical }
});
ActionDescription desc;
desc.setText(tr("Clang Static Analyzer"));
desc.setToolTip(toolTip);
desc.setEnabled(false);
desc.setRunMode(Constants::CLANGSTATICANALYZER_RUN_MODE);
desc.setPerspectiveId(ClangStaticAnalyzerPerspective);
desc.setActionId(ClangStaticAnalyzerAction);
desc.setWidgetCreator(widgetCreator);
desc.setPerspectiveId(ClangStaticAnalyzerPerspectiveId);
desc.setRunControlCreator(runControlCreator);
desc.setCustomToolStarter([tool](ProjectExplorer::RunConfiguration *rc) {
tool->startTool(rc);
});
desc.setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
AnalyzerManager::addAction(desc);
AnalyzerManager::registerAction(ClangStaticAnalyzerActionId, desc);
return true;
}
......
......@@ -104,7 +104,7 @@ QWidget *ClangStaticAnalyzerTool::createWidgets()
this, &ClangStaticAnalyzerTool::handleStateUpdate);
}
AnalyzerManager::createDockWidget(m_diagnosticView, ClangStaticAnalyzerDock);
AnalyzerManager::registerDockWidget(ClangStaticAnalyzerDockId, m_diagnosticView);
//
// Toolbar widget
......@@ -291,7 +291,7 @@ void ClangStaticAnalyzerTool::handleStateUpdate()
message += tr("%n issues found (%1 suppressed).", 0, issuesFound)
.arg(issuesFound - issuesVisible);
}
AnalyzerManager::showPermanentStatusMessage(ClangStaticAnalyzerPerspective, message);
AnalyzerManager::showPermanentStatusMessage(ClangStaticAnalyzerPerspectiveId, message);
}
} // namespace Internal
......
......@@ -38,11 +38,10 @@ class ClangStaticAnalyzerDiagnosticFilterModel;
class ClangStaticAnalyzerDiagnosticModel;
class ClangStaticAnalyzerDiagnosticView;
class Diagnostic;
class DummyRunConfiguration;
const char ClangStaticAnalyzerPerspective[] = "ClangStaticAnalyzerPerspective";
const char ClangStaticAnalyzerAction[] = "ClangStaticAnalyzerAction";
const char ClangStaticAnalyzerDock[] = "ClangStaticAnalyzerDock";
const char ClangStaticAnalyzerPerspectiveId[] = "ClangStaticAnalyzer.Perspective";
const char ClangStaticAnalyzerActionId[] = "ClangStaticAnalyzer.Action";
const char ClangStaticAnalyzerDockId[] = "ClangStaticAnalyzer.Dock";
class ClangStaticAnalyzerTool : public QObject
{
......
......@@ -89,7 +89,7 @@ void ClangStaticAnalyzerUnitTests::testProject()
CppTools::Tests::ProjectOpenerAndCloser projectManager;
const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true);
QVERIFY(projectInfo.isValid());
AnalyzerManager::selectAction(ClangStaticAnalyzerPerspective, /* alsoRunIt = */ true);
AnalyzerManager::selectAction(ClangStaticAnalyzerPerspectiveId, /* alsoRunIt = */ true);
QSignalSpy waiter(m_analyzerTool, SIGNAL(finished(bool)));
QVERIFY(waiter.wait(30000));
const QList<QVariant> arguments = waiter.takeFirst();
......
......@@ -85,9 +85,6 @@ public:
Core::Id menuGroup() const { return m_menuGroup; }
void setMenuGroup(Core::Id menuGroup) { m_menuGroup = menuGroup; }
Core::Id actionId() const { return m_actionId; }
void setActionId(Core::Id id) { m_actionId = id; }
Core::Id perspectiveId() const { return m_perspective; }
void setPerspectiveId(Core::Id id) { m_perspective = id; }
void setToolMode(QFlags<ToolMode> mode) { m_toolMode = mode; }
......@@ -96,13 +93,6 @@ public:
void setRunMode(Core::Id mode) { m_runMode = mode; }
bool isRunnable(QString *reason = 0) const;
/// Creates all widgets used by the tool.
/// Returns a control widget which will be shown in the status bar when
/// this tool is selected.
typedef std::function<QWidget *()> WidgetCreator;
QWidget *createWidget() const { return m_widgetCreator(); }
void setWidgetCreator(const WidgetCreator &creator) { m_widgetCreator = creator; }
/// Returns a new engine for the given start parameters.
/// Called each time the tool is launched.
typedef std::function<AnalyzerRunControl *(ProjectExplorer::RunConfiguration *runConfiguration,
......@@ -126,19 +116,13 @@ public:
QString text() const { return m_text; }
void setText(const QString &text) { m_text = text; }
bool enabled() const { return m_enabled; }
void setEnabled(bool enabled) { m_enabled = enabled; }
private:
bool m_enabled = false;
QString m_text;
QString m_toolTip;
Core::Id m_menuGroup;
Core::Id m_actionId;
Core::Id m_perspective;
QFlags<ToolMode> m_toolMode = AnyMode;
Core::Id m_runMode;
WidgetCreator m_widgetCreator;
RunControlCreator m_runControlCreator;
ToolStarter m_customToolStarter;
ToolPreparer m_toolPreparer;
......@@ -156,11 +140,10 @@ public:
static void shutdown();
// Register a tool for a given start mode.
static void addAction(const ActionDescription &desc);
static void addPerspective(const Perspective &perspective);
// Dockwidgets are registered to the main window.
static QDockWidget *createDockWidget(QWidget *widget, Core::Id dockId);
static void registerAction(Core::Id actionId, const ActionDescription &desc);
static void registerPerspective(Core::Id perspectiveId, const Perspective &perspective);
static void registerDockWidget(Core::Id dockId, QWidget *widget);
static void registerToolbar(Core::Id toolbarId, QWidget *widget);
static void enableMainWindow(bool on);
......
......@@ -201,10 +201,12 @@ enum DebuggerEngineType
enum DebuggerLanguage
{
AnyLanguage = 0x0,
NoLanguage = 0x0,
CppLanguage = 0x1,
QmlLanguage = 0x2
QmlLanguage = 0x2,
AnyLanguage = CppLanguage | QmlLanguage
};
Q_DECLARE_FLAGS(DebuggerLanguages, DebuggerLanguage)
} // namespace Debugger
......
......@@ -66,7 +66,6 @@ QIcon locationMarkIcon();
const CPlusPlus::Snapshot &cppCodeModelSnapshot();
bool hasSnapshots();
void openTextEditor(const QString &titlePattern, const QString &contents);
bool isActiveDebugLanguage(int language);
// void runTest(const QString &fileName);
void showMessage(const QString &msg, int channel, int timeout = -1);
......
......@@ -43,12 +43,15 @@ namespace Internal {
MainWindowBase::MainWindowBase()
{
m_controlsStackWidget = new QStackedWidget;
m_statusLabelsStackWidget= new QStackedWidget;
m_statusLabelsStackWidget = new QStackedWidget;
m_toolBox = new QComboBox;
setDockNestingEnabled(true);
setDockActionsVisible(false);
setDocumentMode(true);
connect(this, &FancyMainWindow::resetLayout,
this, &MainWindowBase::resetCurrentPerspective);
}
MainWindowBase::~MainWindowBase()
......@@ -61,42 +64,52 @@ MainWindowBase::~MainWindowBase()
}
}
void MainWindowBase::addPerspective(const Perspective &perspective)
void MainWindowBase::registerPerspective(Id perspectiveId, const Perspective &perspective)
{
m_perspectiveForPerspectiveId.insert(perspectiveId, perspective);
}
void MainWindowBase::registerToolbar(Id perspectiveId, QWidget *widget)
{
m_perspectives.append(perspective);
m_toolbarForPerspectiveId.insert(perspectiveId, widget);
m_controlsStackWidget->addWidget(widget);
StatusLabel * const toolStatusLabel = new StatusLabel;
m_statusLabelForPerspectiveId[perspectiveId] = toolStatusLabel;
m_statusLabelsStackWidget->addWidget(toolStatusLabel);
}
void MainWindowBase::showStatusMessage(Id perspective, const QString &message, int timeoutMS)
{
StatusLabel *statusLabel = m_statusLabelForPerspective.value(perspective);
StatusLabel *statusLabel = m_statusLabelForPerspectiveId.value(perspective);
QTC_ASSERT(statusLabel, return);
statusLabel->showStatusMessage(message, timeoutMS);
}
void MainWindowBase::restorePerspective(Id perspectiveId,
std::function<QWidget *()> creator,
bool fromStoredSettings)
void MainWindowBase::resetCurrentPerspective()
{
if (!perspectiveId.isValid())
return;
loadPerspectiveHelper(m_currentPerspectiveId, false);
}
if (!m_defaultSettings.contains(perspectiveId) && creator) {
QWidget *widget = creator();
QTC_CHECK(widget);
m_defaultSettings.insert(perspectiveId);
QTC_CHECK(!m_controlsWidgetForPerspective.contains(perspectiveId));
m_controlsWidgetForPerspective[perspectiveId] = widget;
m_controlsStackWidget->addWidget(widget);
StatusLabel * const toolStatusLabel = new StatusLabel;
m_statusLabelForPerspective[perspectiveId] = toolStatusLabel;
m_statusLabelsStackWidget->addWidget(toolStatusLabel);
}
void MainWindowBase::restorePerspective(Id perspectiveId)
{
loadPerspectiveHelper(perspectiveId, true);
}
const Perspective *perspective = findPerspective(perspectiveId);
QTC_ASSERT(perspective, return);
void MainWindowBase::loadPerspectiveHelper(Id perspectiveId, bool fromStoredSettings)
{
QTC_ASSERT(perspectiveId.isValid(), return);
foreach (const Perspective::Split &split, perspective->splits()) {
// Clean up old perspective.
closeCurrentPerspective();
m_currentPerspectiveId = perspectiveId;
QTC_ASSERT(m_perspectiveForPerspectiveId.contains(perspectiveId), return);
const auto splits = m_perspectiveForPerspectiveId.value(perspectiveId).splits();
for (const Perspective::Split &split : splits) {
QDockWidget *dock = m_dockForDockId.value(split.dockId);
QTC_ASSERT(dock, continue);
addDockWidget(split.area, dock);
QDockWidget *existing = m_dockForDockId.value(split.existing);
if (!existing && split.area == Qt::BottomDockWidgetArea)
......@@ -116,30 +129,30 @@ void MainWindowBase::restorePerspective(Id perspectiveId,
}
if (!split.visibleByDefault)
dock->hide();
else
dock->show();
}
if (fromStoredSettings) {
QSettings *settings = ICore::settings();
settings->beginGroup(m_settingsName + perspectiveId.toString());
settings->beginGroup(perspectiveId.toString());
if (settings->value(QLatin1String("ToolSettingsSaved"), false).toBool())
restoreSettings(settings);
settings->endGroup();
}
QTC_CHECK(m_controlsWidgetForPerspective.contains(perspectiveId));
m_controlsStackWidget->setCurrentWidget(m_controlsWidgetForPerspective.value(perspectiveId));
m_statusLabelsStackWidget->setCurrentWidget(m_statusLabelForPerspective.value(perspectiveId));
QTC_CHECK(m_toolbarForPerspectiveId.contains(perspectiveId));
m_controlsStackWidget->setCurrentWidget(m_toolbarForPerspectiveId.value(perspectiveId));
m_statusLabelsStackWidget->setCurrentWidget(m_statusLabelForPerspectiveId.value(perspectiveId));
}
void MainWindowBase::closePerspective(Id perspectiveId)
void MainWindowBase::closeCurrentPerspective()
{
if (!perspectiveId.isValid())
if (!m_currentPerspectiveId.isValid())
return;
savePerspective(perspectiveId);
const Perspective *perspective = findPerspective(perspectiveId);
QTC_ASSERT(perspective, return);
foreach (Id dockId, perspective->docks()) {
QDockWidget *dockWidget = m_dockForDockId.value(dockId);
saveCurrentPerspective();
foreach (QDockWidget *dockWidget, m_dockForDockId) {
QTC_ASSERT(dockWidget, continue);
removeDockWidget(dockWidget);
dockWidget->hide();
......@@ -148,25 +161,19 @@ void MainWindowBase::closePerspective(Id perspectiveId)
}
}
const Perspective *MainWindowBase::findPerspective(Id perspectiveId) const
{
foreach (const Perspective &perspective, m_perspectives)
if (perspective.id() == perspectiveId)
return &perspective;
return 0;
}
void MainWindowBase::savePerspective(Id perspectiveId)
void MainWindowBase::saveCurrentPerspective()
{
if (!m_currentPerspectiveId.isValid())
return;
QSettings *settings = ICore::settings();
settings->beginGroup(m_settingsName + perspectiveId.toString());
settings->beginGroup(m_currentPerspectiveId.toString());
saveSettings(settings);
settings->setValue(QLatin1String("ToolSettingsSaved"), true);
settings->endGroup();
settings->setValue(m_lastSettingsName, perspectiveId.toString());
settings->setValue(m_lastSettingsName, m_currentPerspectiveId.toString());
}
QDockWidget *MainWindowBase::createDockWidget(QWidget *widget, Id dockId)
QDockWidget *MainWindowBase::registerDockWidget(Id dockId, QWidget *widget)
{
QTC_ASSERT(!widget->objectName().isEmpty(), return 0);
QDockWidget *dockWidget = addDockForWidget(widget);
......@@ -175,14 +182,9 @@ QDockWidget *MainWindowBase::createDockWidget(QWidget *widget, Id dockId)
return dockWidget;
}
QString MainWindowBase::settingsName() const
{
return m_settingsName;
}
void MainWindowBase::setSettingsName(const QString &settingsName)
Core::Id MainWindowBase::currentPerspectiveId() const
{
m_settingsName = settingsName;
return m_currentPerspectiveId;
}
QString MainWindowBase::lastSettingsName() const
......
......@@ -38,6 +38,7 @@
#include <QSet>
#include <functional>
#include <initializer_list>
QT_BEGIN_NAMESPACE
class QComboBox;
......@@ -51,33 +52,32 @@ class ANALYZER_EXPORT Perspective
public:
enum SplitType { SplitVertical, SplitHorizontal, AddToTab };
struct Split {
class Split
{
public:
Split() = default;
Split(Core::Id e, Core::Id d, SplitType t, bool v, Qt::DockWidgetArea a)
: existing(e), dockId(d), splitType(t), visibleByDefault(v), area(a)
{}
Core::Id existing;
Split(Core::Id dockId, Core::Id existing, SplitType splitType,
bool visibleByDefault = true,
Qt::DockWidgetArea area = Qt::BottomDockWidgetArea);
Core::Id dockId;
Core::Id existing;
SplitType splitType;
bool visibleByDefault;
Qt::DockWidgetArea area;
};
typedef QVector<Split> Splits;
Perspective(Core::Id id = Core::Id()) : m_id(id) {}
Perspective() = default;
Perspective(std::initializer_list<Split> splits);
Core::Id id() const { return m_id; }
void addDock(Core::Id dockId, Core::Id existing, SplitType splitType,
bool visibleByDefault = true,
Qt::DockWidgetArea area = Qt::BottomDockWidgetArea);
void addSplit(const Split &split);
Splits splits() const { return m_splits; }
QList<Core::Id> docks() const { return m_docks; }
QVector<Split> splits() const { return m_splits; }
QVector<Core::Id> docks() const { return m_docks; }
private:
Core::Id m_id;
QList<Core::Id> m_docks;
Splits m_splits;
QVector<Core::Id> m_docks;
QVector<Split> m_splits;
};
} // Analyzer
......@@ -95,8 +95,9 @@ const char DOCKWIDGET_STACK[] = "Debugger.Docks.Stack";
const char DOCKWIDGET_SOURCE_FILES[] = "Debugger.Docks.SourceFiles";
const char DOCKWIDGET_THREADS[] = "Debugger.Docks.Threads";
const char DOCKWIDGET_WATCHERS[] = "Debugger.Docks.LocalsAndWatchers";
const char DOCKWIDGET_QML_INSPECTOR[] = "Debugger.Docks.QmlInspector";
const char DOCKWIDGET_DEFAULT_AREA[] = "Debugger.Docks.DefaultArea";
const char CppPerspectiveId[] = "Debugger.Perspective.Cpp";
const char QmlPerspectiveId[] = "Debugger.Perspective.Qml";
class MainWindowBase : public Utils::FancyMainWindow
{
......@@ -110,35 +111,34 @@ public:
QStackedWidget *controlsStack() const { return m_controlsStackWidget; }
QStackedWidget *statusLabelsStack() const { return m_statusLabelsStackWidget; }
void addPerspective(const Analyzer::Perspective &perspective);
void showStatusMessage(Core::Id perspective, const QString &message, int timeoutMS);
void registerPerspective(Core::Id perspectiveId, const Analyzer::Perspective &perspective);
void registerToolbar(Core::Id perspectiveId, QWidget *widget);
QDockWidget *registerDockWidget(Core::Id dockId, QWidget *widget);
const Analyzer::Perspective *findPerspective(Core::Id perspectiveId) const;
void restorePerspective(Core::Id perspectiveId,
std::function<QWidget *()> creator,
bool fromStoredSettings);
void savePerspective(Core::Id perspectiveId);
void closePerspective(Core::Id perspectiveId);
void saveCurrentPerspective();
void closeCurrentPerspective();
void resetCurrentPerspective();
void restorePerspective(Core::Id perspectiveId);
QString settingsName() const;
void setSettingsName(const QString &settingsName);
void showStatusMessage(Core::Id perspective, const QString &message, int timeoutMS);
QString lastSettingsName() const;
void setLastSettingsName(const QString &lastSettingsName);
QDockWidget *createDockWidget(QWidget *widget, Core::Id dockId);
Core::Id currentPerspectiveId() const;
private:
QString m_settingsName;
void loadPerspectiveHelper(Core::Id perspectiveId, bool fromStoredSettings = true);
Core::Id m_currentPerspectiveId;
QString m_lastSettingsName;
QComboBox *m_toolBox;
QStackedWidget *m_controlsStackWidget;
QStackedWidget *m_statusLabelsStackWidget;
QHash<Core::Id, QDockWidget *> m_dockForDockId;
QList<Analyzer::Perspective> m_perspectives;
QHash<Core::Id, QWidget *> m_controlsWidgetForPerspective;
QHash<Core::Id, Utils::StatusLabel *> m_statusLabelForPerspective;
QSet<Core::Id> m_defaultSettings;
QHash<Core::Id, QWidget *> m_toolbarForPerspectiveId;
QHash<Core::Id, Analyzer::Perspective> m_perspectiveForPerspectiveId;
QHash<Core::Id, Utils::StatusLabel *> m_statusLabelForPerspectiveId;
// list of dock widgets to prevent memory leak
typedef QPointer<QDockWidget> DockPtr;
......
This diff is collapsed.
......@@ -41,10 +41,9 @@ const char ANALYZER[] = "Analyzer";
const char TraceFileExtension[] = ".qtd";
const char QmlProfilerTimelineDock[] = "QmlProfilerTimelineDock";
const char QmlProfilerPerspective[] = "QmlProfilerPerspective";
const char QmlProfilerLocalActionId[] = "QmlProfiler.Local";
const char QmlProfilerPerspectiveId[] = "QmlProfiler.Perspective";
const char QmlProfilerTimelineDockId[] = "QmlProfiler.Timeline.Dock";
const char QmlProfilerLocalActionId[] = "QmlProfiler.Local";
const char QmlProfilerRemoteActionId[] = "QmlProfiler.Remote";
const char QmlProfilerLoadActionId[] =
......
......@@ -49,11 +49,19 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
{
Q_UNUSED(arguments)
QmlProfilerPlugin::instance = this;
if (!Utils::HostOsInfo::canCreateOpenGLContext(errorString))
return false;
return true;
}
void QmlProfilerPlugin::extensionsInitialized()
{
factory = ExtensionSystem::PluginManager::getObject<QmlProfilerTimelineModelFactory>();
auto tool = new QmlProfilerTool(this);
auto widgetCreator = [tool] { return tool->createWidgets(); };
auto runControlCreator = [tool](ProjectExplorer::RunConfiguration *runConfiguration, Core::Id) {
return tool->createRunControl(runConfiguration);
};
......@@ -65,20 +73,16 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
ActionDescription desc;
desc.setText(tr("QML Profiler"));
desc.setToolTip(description);
desc.setActionId(Constants::QmlProfilerLocalActionId);
desc.setPerspectiveId(Constants::QmlProfilerPerspective);
desc.setWidgetCreator(widgetCreator);
desc.setPerspectiveId(Constants::QmlProfilerPerspectiveId);
desc.setRunControlCreator(runControlCreator);
desc.setToolPreparer([tool] { return tool->prepareTool(); });
desc.setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
desc.setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
AnalyzerManager::addAction(desc);
AnalyzerManager::registerAction(Constants::QmlProfilerLocalActionId, desc);
desc.setText(tr("QML Profiler (External)"));
desc.setToolTip(description);
desc.setActionId(Constants::QmlProfilerRemoteActionId);
desc.setPerspectiveId(Constants::QmlProfilerPerspective);
desc.setWidgetCreator(widgetCreator);
desc.setPerspectiveId(Constants::QmlProfilerPerspectiveId);
desc.setRunControlCreator(runControlCreator);
desc.setCustomToolStarter([tool](ProjectExplorer::RunConfiguration *rc) {
tool->startRemoteTool(rc);
......@@ -86,18 +90,12 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
desc.setToolPreparer([tool] { return tool->prepareTool(); });
desc.setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
desc.setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
AnalyzerManager::addAction(desc);
AnalyzerManager::registerAction(Constants::QmlProfilerRemoteActionId, desc);
addAutoReleasedObject(new QmlProfilerRunControlFactory());
addAutoReleasedObject(new Internal::QmlProfilerOptionsPage());
QmlProfilerPlugin::instance = this;
return true;
}
void QmlProfilerPlugin::extensionsInitialized()
{
factory = ExtensionSystem::PluginManager::getObject<QmlProfilerTimelineModelFactory>();
AnalyzerManager::registerToolbar(Constants::QmlProfilerPerspectiveId, tool->createWidgets());
}
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
......
......@@ -90,12 +90,13 @@ void QmlProfilerViewManager::createViews()
this, &QmlProfilerViewManager::typeSelected);
connect(this, &QmlProfilerViewManager::typeSelected,
d->traceView, &QmlProfilerTraceView::selectByTypeId);
AnalyzerManager::createDockWidget(d->traceView, Constants::QmlProfilerTimelineDock);
AnalyzerManager::registerDockWidget(Constants::QmlProfilerTimelineDockId, d->traceView);
new QmlProfilerStateWidget(d->profilerState, d->profilerModelManager, d->traceView);
Perspective perspective(Constants::QmlProfilerPerspective);
perspective.addDock(Constants::QmlProfilerTimelineDock, Core::Id(), Perspective::SplitVertical);
Perspective perspective;
perspective.addSplit({Constants::QmlProfilerTimelineDockId, Core::Id(),
Perspective::SplitVertical});
d->eventsViews << new QmlProfilerStatisticsView(0, d->profilerModelManager);
if (d->eventsViewFactory)
......@@ -104,7 +105,7 @@ void QmlProfilerViewManager::createViews()
// Clear settings if the new views aren't there yet. Otherwise we get glitches
QSettings *settings = Core::ICore::settings();
settings->beginGroup(QLatin1String("AnalyzerViewSettings_") +
QLatin1String(QmlProfiler::Constants::QmlProfilerPerspective));
QLatin1String(QmlProfiler::Constants::QmlProfilerPerspectiveId));
foreach (QmlProfilerEventsView *view, d->eventsViews) {
connect(view, &QmlProfilerEventsView::typeSelected,
......@@ -118,14 +119,14 @@ void QmlProfilerViewManager::createViews()
connect(view, &QmlProfilerEventsView::showFullRange,
this, [this](){restrictEventsToRange(-1, -1);});
Core::Id dockId = Core::Id::fromString(view->objectName());
QDockWidget *eventsDock = AnalyzerManager::createDockWidget(view, dockId);
perspective.addDock(dockId, Constants::QmlProfilerTimelineDock, Perspective::AddToTab);
AnalyzerManager::registerDockWidget(dockId, view);
perspective.addSplit({dockId, Constants::QmlProfilerTimelineDockId, Perspective::AddToTab});
new QmlProfilerStateWidget(d->profilerState, d->profilerModelManager, view);
if (!settings->contains(eventsDock->objectName()))
if (!settings->contains(view->parent()->objectName())) // parent() is QDockWidget.
settings->remove(QString());
}
AnalyzerManager::addPerspective(perspective);
AnalyzerManager::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
settings->endGroup();
QTC_ASSERT(qobject_cast<QDockWidget *>(d->traceView->parentWidget()), return);
......
......@@ -53,7 +53,7 @@ CallgrindRunControl::CallgrindRunControl(ProjectExplorer::RunConfiguration *runC
void CallgrindRunControl::showStatusMessage(const QString &msg)
{
AnalyzerManager::showPermanentStatusMessage(CallgrindPerspective, msg);
AnalyzerManager::showPermanentStatusMessage(CallgrindPerspectiveId, msg);
}