2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
#include "qmlprofilerviewmanager.h"
|
|
|
|
|
|
|
|
|
|
#include "qmlprofilertool.h"
|
2012-05-16 12:16:45 +02:00
|
|
|
#include "qmlprofilerstatewidget.h"
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
#include <utils/qtcassert.h>
|
2016-02-24 14:42:52 +01:00
|
|
|
#include <debugger/analyzer/analyzermanager.h>
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
#include <QDockWidget>
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
using namespace Debugger;
|
|
|
|
|
using namespace Utils;
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
|
2013-08-08 13:28:08 +02:00
|
|
|
QmlProfilerModelManager *modelManager,
|
2012-02-24 10:47:17 +01:00
|
|
|
QmlProfilerStateManager *profilerState)
|
2017-06-27 16:14:24 +02:00
|
|
|
: QObject(parent)
|
2012-02-24 10:47:17 +01:00
|
|
|
{
|
2017-06-27 16:14:24 +02:00
|
|
|
setObjectName("QML Profiler View Manager");
|
|
|
|
|
m_profilerState = profilerState;
|
|
|
|
|
m_profilerModelManager = modelManager;
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2017-06-27 16:14:24 +02:00
|
|
|
QTC_ASSERT(m_profilerModelManager, return);
|
|
|
|
|
QTC_ASSERT(m_profilerState, return);
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2017-06-27 16:14:24 +02:00
|
|
|
m_traceView = new QmlProfilerTraceView(0, this, m_profilerModelManager);
|
|
|
|
|
connect(m_traceView, &QmlProfilerTraceView::gotoSourceLocation,
|
2015-10-30 12:35:17 +01:00
|
|
|
this, &QmlProfilerViewManager::gotoSourceLocation);
|
2017-06-27 16:14:24 +02:00
|
|
|
connect(m_traceView, &QmlProfilerTraceView::typeSelected,
|
2015-12-04 16:54:58 +01:00
|
|
|
this, &QmlProfilerViewManager::typeSelected);
|
|
|
|
|
connect(this, &QmlProfilerViewManager::typeSelected,
|
2017-06-27 16:14:24 +02:00
|
|
|
m_traceView, &QmlProfilerTraceView::selectByTypeId);
|
2016-02-26 14:14:49 +01:00
|
|
|
|
2017-06-27 16:14:24 +02:00
|
|
|
new QmlProfilerStateWidget(m_profilerState, m_profilerModelManager, m_traceView);
|
2015-12-04 16:54:58 +01:00
|
|
|
|
2016-05-12 11:57:29 +02:00
|
|
|
auto perspective = new Utils::Perspective;
|
|
|
|
|
perspective->setName(tr("QML Profiler"));
|
2016-02-26 14:14:49 +01:00
|
|
|
|
2016-12-14 13:50:20 +01:00
|
|
|
auto prepareEventsView = [this](QmlProfilerEventsView *view) {
|
2015-12-04 16:54:58 +01:00
|
|
|
connect(view, &QmlProfilerEventsView::typeSelected,
|
|
|
|
|
this, &QmlProfilerViewManager::typeSelected);
|
|
|
|
|
connect(this, &QmlProfilerViewManager::typeSelected,
|
|
|
|
|
view, &QmlProfilerEventsView::selectByTypeId);
|
2017-06-27 16:14:24 +02:00
|
|
|
connect(m_profilerModelManager, &QmlProfilerModelManager::visibleFeaturesChanged,
|
2015-12-04 16:54:58 +01:00
|
|
|
view, &QmlProfilerEventsView::onVisibleFeaturesChanged);
|
|
|
|
|
connect(view, &QmlProfilerEventsView::gotoSourceLocation,
|
|
|
|
|
this, &QmlProfilerViewManager::gotoSourceLocation);
|
|
|
|
|
connect(view, &QmlProfilerEventsView::showFullRange,
|
2017-06-27 16:14:24 +02:00
|
|
|
this, [this](){ m_profilerModelManager->restrictToRange(-1, -1);});
|
|
|
|
|
new QmlProfilerStateWidget(m_profilerState, m_profilerModelManager, view);
|
2016-12-14 13:50:20 +01:00
|
|
|
};
|
|
|
|
|
|
2017-06-27 16:14:24 +02:00
|
|
|
m_statisticsView = new QmlProfilerStatisticsView(m_profilerModelManager);
|
|
|
|
|
prepareEventsView(m_statisticsView);
|
|
|
|
|
m_flameGraphView = new FlameGraphView(m_profilerModelManager);
|
|
|
|
|
prepareEventsView(m_flameGraphView);
|
2016-12-14 13:50:20 +01:00
|
|
|
|
2016-12-14 13:54:25 +01:00
|
|
|
QByteArray anchorDockId;
|
2017-06-27 16:14:24 +02:00
|
|
|
if (m_traceView->isUsable()) {
|
|
|
|
|
anchorDockId = m_traceView->objectName().toLatin1();
|
|
|
|
|
perspective->addOperation({anchorDockId, m_traceView, {}, Perspective::SplitVertical});
|
|
|
|
|
perspective->addOperation({m_flameGraphView->objectName().toLatin1(), m_flameGraphView,
|
2016-12-14 13:54:25 +01:00
|
|
|
anchorDockId, Perspective::AddToTab});
|
|
|
|
|
} else {
|
2017-06-27 16:14:24 +02:00
|
|
|
anchorDockId = m_flameGraphView->objectName().toLatin1();
|
|
|
|
|
perspective->addOperation({anchorDockId, m_flameGraphView, {},
|
2016-12-14 13:54:25 +01:00
|
|
|
Perspective::SplitVertical});
|
|
|
|
|
}
|
2017-06-27 16:14:24 +02:00
|
|
|
perspective->addOperation({m_statisticsView->objectName().toLatin1(), m_statisticsView,
|
2016-12-14 13:50:20 +01:00
|
|
|
anchorDockId, Perspective::AddToTab});
|
|
|
|
|
perspective->addOperation({anchorDockId, 0, {}, Perspective::Raise});
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
Debugger::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerViewManager::clear()
|
|
|
|
|
{
|
2017-06-27 16:14:24 +02:00
|
|
|
m_traceView->clear();
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfiler
|