diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml index 4f2a71eca19..609ceffb3cc 100644 --- a/src/plugins/qmlprofiler/qml/MainView.qml +++ b/src/plugins/qmlprofiler/qml/MainView.qml @@ -179,7 +179,7 @@ Rectangle { ButtonsBar { id: buttonsBar - enabled: false + enabled: timelineModelAggregator.height > 0 anchors.top: parent.top anchors.left: parent.left width: 150 diff --git a/src/plugins/qmlprofiler/qml/Overview.qml b/src/plugins/qmlprofiler/qml/Overview.qml index 3e2a3183abb..f5ebcc1677f 100644 --- a/src/plugins/qmlprofiler/qml/Overview.qml +++ b/src/plugins/qmlprofiler/qml/Overview.qml @@ -29,7 +29,6 @@ ****************************************************************************/ import QtQuick 2.1 -import Monitor 1.0 import "Overview.js" as Plotter Canvas { diff --git a/src/plugins/qmlprofiler/qml/RangeDetails.qml b/src/plugins/qmlprofiler/qml/RangeDetails.qml index 7bab74a0cfe..678c2588824 100644 --- a/src/plugins/qmlprofiler/qml/RangeDetails.qml +++ b/src/plugins/qmlprofiler/qml/RangeDetails.qml @@ -29,7 +29,6 @@ ****************************************************************************/ import QtQuick 2.1 -import Monitor 1.0 Item { id: rangeDetails diff --git a/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml b/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml index 9e8dfcff093..e4e2b612d3d 100644 --- a/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml +++ b/src/plugins/qmlprofiler/qml/SelectionRangeDetails.qml @@ -29,7 +29,6 @@ ****************************************************************************/ import QtQuick 2.1 -import Monitor 1.0 Item { id: selectionRangeDetails diff --git a/src/plugins/qmlprofiler/qml/TimelineContent.qml b/src/plugins/qmlprofiler/qml/TimelineContent.qml index 39593f9a454..998c5c108ba 100644 --- a/src/plugins/qmlprofiler/qml/TimelineContent.qml +++ b/src/plugins/qmlprofiler/qml/TimelineContent.qml @@ -30,7 +30,7 @@ import QtQuick 2.0 import QtQuick.Controls 1.2 -import Monitor 1.0 +import TimelineRenderer 1.0 import QtQml.Models 2.1 ScrollView { diff --git a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp index b183463fea9..595886e999b 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp @@ -102,7 +102,6 @@ QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateMan this, SLOT(profilerStateChanged())); updateDisplay(); - connect(parent,SIGNAL(resized()),this,SLOT(reposition())); } QmlProfilerStateWidget::~QmlProfilerStateWidget() diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 2cbca776ea2..6f4bd27db77 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -128,8 +128,6 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) d->m_clearButton = 0; d->m_timeLabel = 0; - qmlRegisterType("Monitor", 1, 0,"TimelineRenderer"); - d->m_profilerState = new QmlProfilerStateManager(this); connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged())); connect(d->m_profilerState, SIGNAL(clientRecordingChanged()), this, SLOT(clientRecordingChanged())); diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index ce8fa400aaa..2c279f4c5dc 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -70,11 +70,6 @@ class QmlProfilerTraceView::QmlProfilerTraceViewPrivate { public: QmlProfilerTraceViewPrivate(QmlProfilerTraceView *qq) : q(qq) {} - ~QmlProfilerTraceViewPrivate() - { - delete m_mainView; - } - QmlProfilerTraceView *q; QmlProfilerStateManager *m_profilerState; @@ -104,6 +99,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT groupLayout->setContentsMargins(0, 0, 0, 0); groupLayout->setSpacing(0); + qmlRegisterType("TimelineRenderer", 1, 0, "TimelineRenderer"); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); @@ -113,8 +109,6 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT QWidget *mainViewContainer = QWidget::createWindowContainer(d->m_mainView); mainViewContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - enableToolbar(false); - groupLayout->addWidget(mainViewContainer); setLayout(groupLayout); @@ -122,20 +116,9 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT d->m_viewContainer = container; d->m_modelProxy = new TimelineModelAggregator(modelManager->notesModel(), this); - setModelManager(modelManager); - d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"), - d->m_modelProxy); - d->m_profilerState = profilerState; - - // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin - setMinimumHeight(170); -} - -void QmlProfilerTraceView::setModelManager(QmlProfilerModelManager *modelManager) -{ d->m_modelManager = modelManager; - connect(modelManager,SIGNAL(dataAvailable()), - d->m_modelProxy,SIGNAL(dataAvailable())); + + connect(modelManager,SIGNAL(dataAvailable()), d->m_modelProxy,SIGNAL(dataAvailable())); // external models pushed on top foreach (QmlProfilerTimelineModel *timelineModel, @@ -143,37 +126,37 @@ void QmlProfilerTraceView::setModelManager(QmlProfilerModelManager *modelManager d->m_modelProxy->addModel(timelineModel); } - d->m_modelProxy->addModel(new QmlProfilerAnimationsModel(modelManager, - d->m_modelProxy)); + d->m_modelProxy->addModel(new QmlProfilerAnimationsModel(modelManager, d->m_modelProxy)); for (int i = 0; i < QmlDebug::MaximumRangeType; ++i) d->m_modelProxy->addModel(new QmlProfilerRangeModel(modelManager, (QmlDebug::RangeType)i, d->m_modelProxy)); // Connect this last so that it's executed after the models have updated their data. - connect(modelManager->qmlModel(), SIGNAL(changed()), - d->m_modelProxy, SIGNAL(stateChanged())); - connect(d->m_modelManager, SIGNAL(stateChanged()), - this, SLOT(profilerDataModelStateChanged())); -} + connect(modelManager->qmlModel(), SIGNAL(changed()), d->m_modelProxy, SIGNAL(stateChanged())); + connect(d->m_modelManager, SIGNAL(stateChanged()), this, SLOT(profilerDataModelStateChanged())); + d->m_profilerState = profilerState; -QmlProfilerTraceView::~QmlProfilerTraceView() -{ - delete d; -} + // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin + setMinimumHeight(170); -///////////////////////////////////////////////////////// -// Initialize widgets -void QmlProfilerTraceView::reset() -{ - d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl); + d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"), + d->m_modelProxy); + d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), + d->m_zoomControl); d->m_mainView->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/MainView.qml"))); QQuickItem *rootObject = d->m_mainView->rootObject(); connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition())); } +QmlProfilerTraceView::~QmlProfilerTraceView() +{ + delete d->m_mainView; + delete d; +} + ///////////////////////////////////////////////////////// bool QmlProfilerTraceView::hasValidSelection() const { @@ -183,12 +166,6 @@ bool QmlProfilerTraceView::hasValidSelection() const return false; } -void QmlProfilerTraceView::enableToolbar(bool enable) -{ - QMetaObject::invokeMethod(d->m_mainView->rootObject(), "enableButtonsBar", - Q_ARG(QVariant,QVariant(enable))); -} - qint64 QmlProfilerTraceView::selectionStart() const { QQuickItem *rootObject = d->m_mainView->rootObject(); @@ -249,13 +226,6 @@ void QmlProfilerTraceView::updateCursorPosition() emit typeSelected(rootObject->property("typeId").toInt()); } -//////////////////////////////////////////////////////// -void QmlProfilerTraceView::resizeEvent(QResizeEvent *event) -{ - QWidget::resizeEvent(event); - emit resized(); -} - void QmlProfilerTraceView::mousePressEvent(QMouseEvent *event) { d->m_zoomControl->setWindowLocked(true); @@ -325,12 +295,10 @@ void QmlProfilerTraceView::profilerDataModelStateChanged() case QmlProfilerDataState::Empty: break; case QmlProfilerDataState::ClearingData: d->m_mainView->hide(); - enableToolbar(false); break; case QmlProfilerDataState::AcquiringData: break; case QmlProfilerDataState::ProcessingData: break; case QmlProfilerDataState::Done: - enableToolbar(true); d->m_mainView->show(); break; default: diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.h b/src/plugins/qmlprofiler/qmlprofilertraceview.h index 8c609ceda50..e404eee824a 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.h +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.h @@ -46,17 +46,17 @@ namespace Internal { class QmlProfilerStateManager; class QmlProfilerViewManager; - class QmlProfilerTraceView : public QWidget { Q_OBJECT public: - explicit QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState); + explicit QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, + QmlProfilerViewManager *container, + QmlProfilerModelManager *modelManager, + QmlProfilerStateManager *profilerState); ~QmlProfilerTraceView(); - void reset(); - bool hasValidSelection() const; qint64 selectionStart() const; qint64 selectionEnd() const; @@ -72,7 +72,6 @@ private slots: void profilerDataModelStateChanged(); protected: - virtual void resizeEvent(QResizeEvent *event); virtual void contextMenuEvent(QContextMenuEvent *event); virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); @@ -80,15 +79,10 @@ protected: signals: void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columNumber); void typeSelected(int typeId); - void resized(); - -private: - void enableToolbar(bool); private: class QmlProfilerTraceViewPrivate; QmlProfilerTraceViewPrivate *d; - void setModelManager(QmlProfilerModelManager *modelManager); }; class QmlProfilerQuickView : public QQuickView { diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp index 348f4764f9c..c698d68f5c5 100644 --- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp @@ -100,8 +100,6 @@ void QmlProfilerViewManager::createViews() d->traceView->setWindowTitle(tr("Timeline")); connect(d->traceView, SIGNAL(gotoSourceLocation(QString,int,int)), this, SIGNAL(gotoSourceLocation(QString,int,int))); - d->traceView->reset(); - d->eventsView = new QmlProfilerEventsWidget(mw, d->profilerTool, this, d->profilerModelManager);