QmlProfiler: Remove slots declarations and Qt4 connections

The signals from QML are relayed through the respective models, so that
we don't have to use Qt4 connections there.

Change-Id: I864b49061c1f28acbebfc7378bfe39f96d3cae18
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2017-09-07 14:07:10 +02:00
parent c4b5048836
commit 046e4db97a
20 changed files with 48 additions and 69 deletions

View File

@@ -85,10 +85,9 @@ signals:
void depthChanged(int depth); void depthChanged(int depth);
void maximumDepthChanged(); void maximumDepthChanged();
private slots: private:
void rebuild(); void rebuild();
private:
QQmlComponent *m_delegate = nullptr; QQmlComponent *m_delegate = nullptr;
QAbstractItemModel *m_model = nullptr; QAbstractItemModel *m_model = nullptr;
int m_sizeRole = 0; int m_sizeRole = 0;

View File

@@ -50,7 +50,7 @@ public:
QByteArray read(); QByteArray read();
bool waitForReadyRead(int msecs = 3000); bool waitForReadyRead(int msecs = 3000);
Q_SIGNALS: signals:
void readyRead(); void readyRead();
void invalidPacket(); void invalidPacket();

View File

@@ -36,7 +36,6 @@ Rectangle {
property bool lockItemSelection : false property bool lockItemSelection : false
signal updateCursorPosition
property string fileName: "" property string fileName: ""
property int lineNumber: -1 property int lineNumber: -1
property int columnNumber: 0 property int columnNumber: 0
@@ -242,7 +241,7 @@ Rectangle {
var newTypeId = model.typeId(selectedItem); var newTypeId = model.typeId(selectedItem);
if (newTypeId !== typeId) { if (newTypeId !== typeId) {
typeId = newTypeId; typeId = newTypeId;
root.updateCursorPosition(); timelineModelAggregator.updateCursorPosition();
} }
} else { } else {
selectedModel = -1; selectedModel = -1;

View File

@@ -61,6 +61,7 @@ public:
signals: signals:
void modelsChanged(); void modelsChanged();
void heightChanged(); void heightChanged();
void updateCursorPosition();
private: private:
class TimelineModelAggregatorPrivate; class TimelineModelAggregatorPrivate;

View File

@@ -87,7 +87,6 @@ public:
QHash<int, QByteArray> roleNames() const override; QHash<int, QByteArray> roleNames() const override;
QmlProfilerModelManager *modelManager() const; QmlProfilerModelManager *modelManager() const;
public slots:
void loadEvent(const QmlEvent &event, const QmlEventType &type); void loadEvent(const QmlEvent &event, const QmlEventType &type);
void finalize(); void finalize();
void onModelManagerStateChanged(); void onModelManagerStateChanged();
@@ -95,6 +94,10 @@ public slots:
void loadNotes(int typeId, bool emitSignal); void loadNotes(int typeId, bool emitSignal);
void clear(); void clear();
signals:
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
void typeSelected(int typeIndex);
private: private:
QVariant lookup(const FlameGraphData &data, int role) const; QVariant lookup(const FlameGraphData &data, int role) const;
FlameGraphData *pushChild(FlameGraphData *parent, const QmlEvent &data); FlameGraphData *pushChild(FlameGraphData *parent, const QmlEvent &data);

View File

@@ -67,10 +67,9 @@ FlameGraphView::FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent
layout->addWidget(m_content); layout->addWidget(m_content);
setLayout(layout); setLayout(layout);
connect(m_content->rootObject(), SIGNAL(typeSelected(int)), connect(m_model, &FlameGraphModel::typeSelected, this, &FlameGraphView::typeSelected);
this, SIGNAL(typeSelected(int))); connect(m_model, &FlameGraphModel::gotoSourceLocation,
connect(m_content->rootObject(), SIGNAL(gotoSourceLocation(QString,int,int)), this, &FlameGraphView::gotoSourceLocation);
this, SIGNAL(gotoSourceLocation(QString,int,int)));
} }
void FlameGraphView::selectByTypeId(int typeIndex) void FlameGraphView::selectByTypeId(int typeIndex)

View File

@@ -40,7 +40,6 @@ class FlameGraphView : public QmlProfilerEventsView
public: public:
FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent = nullptr); FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent = nullptr);
public slots:
void selectByTypeId(int typeIndex) override; void selectByTypeId(int typeIndex) override;
void onVisibleFeaturesChanged(quint64 features) override; void onVisibleFeaturesChanged(quint64 features) override;

View File

@@ -32,8 +32,6 @@ import "../flamegraph/"
ScrollView { ScrollView {
id: root id: root
signal typeSelected(int typeIndex)
signal gotoSourceLocation(string filename, int line, int column)
property int selectedTypeId: -1 property int selectedTypeId: -1
property int sizeRole: QmlProfilerFlameGraphModel.DurationRole property int sizeRole: QmlProfilerFlameGraphModel.DurationRole
@@ -157,9 +155,9 @@ ScrollView {
onClicked: { onClicked: {
if (flamegraphItem.FlameGraph.dataValid) { if (flamegraphItem.FlameGraph.dataValid) {
tooltip.selectedNode = flamegraphItem; tooltip.selectedNode = flamegraphItem;
root.typeSelected(flamegraphItem.FlameGraph.data( flameGraphModel.typeSelected(flamegraphItem.FlameGraph.data(
QmlProfilerFlameGraphModel.TypeIdRole)); QmlProfilerFlameGraphModel.TypeIdRole));
root.gotoSourceLocation( flameGraphModel.gotoSourceLocation(
flamegraphItem.FlameGraph.data( flamegraphItem.FlameGraph.data(
QmlProfilerFlameGraphModel.FilenameRole), QmlProfilerFlameGraphModel.FilenameRole),
flamegraphItem.FlameGraph.data( flamegraphItem.FlameGraph.data(
@@ -269,7 +267,7 @@ ScrollView {
onClearSelection: { onClearSelection: {
selectedTypeId = -1; selectedTypeId = -1;
selectedNode = null; selectedNode = null;
root.typeSelected(-1); flameGraphModel.typeSelected(-1);
} }
dialogTitle: { dialogTitle: {

View File

@@ -44,10 +44,9 @@ public:
explicit QmlProfilerConfigWidget(QmlProfilerSettings *settings, QWidget *parent = 0); explicit QmlProfilerConfigWidget(QmlProfilerSettings *settings, QWidget *parent = 0);
~QmlProfilerConfigWidget(); ~QmlProfilerConfigWidget();
private slots: private:
void updateUi(); void updateUi();
private:
Ui::QmlProfilerConfigWidget *m_ui; Ui::QmlProfilerConfigWidget *m_ui;
QmlProfilerSettings *m_settings; QmlProfilerSettings *m_settings;
}; };

View File

@@ -40,14 +40,13 @@ public:
QmlProfilerEventsView(QWidget *parent = 0) : QWidget(parent) {} QmlProfilerEventsView(QWidget *parent = 0) : QWidget(parent) {}
virtual void clear() {} virtual void clear() {}
virtual void selectByTypeId(int typeIndex) = 0;
virtual void onVisibleFeaturesChanged(quint64 features) = 0;
signals: signals:
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber); void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
void typeSelected(int typeIndex); void typeSelected(int typeIndex);
void showFullRange(); void showFullRange();
public slots:
virtual void selectByTypeId(int typeIndex) = 0;
virtual void onVisibleFeaturesChanged(quint64 features) = 0;
}; };
} // namespace QmlProfiler } // namespace QmlProfiler

View File

@@ -56,7 +56,6 @@ public:
qint64 duration() const; qint64 duration() const;
bool isRestrictedToRange() const; bool isRestrictedToRange() const;
public slots:
void clear(); void clear();
void setTime(qint64 startTime, qint64 endTime); void setTime(qint64 startTime, qint64 endTime);
@@ -135,6 +134,15 @@ public:
static const char *featureName(ProfileFeature feature); static const char *featureName(ProfileFeature feature);
void clear();
void restrictToRange(qint64 startTime, qint64 endTime);
bool isRestrictedToRange() const;
void startAcquiring();
void save(const QString &filename);
void load(const QString &filename);
signals: signals:
void error(const QString &error); void error(const QString &error);
void stateChanged(); void stateChanged();
@@ -145,21 +153,10 @@ signals:
void visibleFeaturesChanged(quint64 features); void visibleFeaturesChanged(quint64 features);
void recordedFeaturesChanged(quint64 features); void recordedFeaturesChanged(quint64 features);
public slots:
void clear();
void restrictToRange(qint64 startTime, qint64 endTime);
bool isRestrictedToRange() const;
void startAcquiring();
void save(const QString &filename);
void load(const QString &filename);
private: private:
void setState(State state); void setState(State state);
void detailsChanged(int typeId, const QString &newString); void detailsChanged(int typeId, const QString &newString);
private:
class QmlProfilerModelManagerPrivate; class QmlProfilerModelManagerPrivate;
QmlProfilerModelManagerPrivate *d; QmlProfilerModelManagerPrivate *d;
}; };

View File

@@ -51,6 +51,12 @@ public:
QString currentStateAsString(); QString currentStateAsString();
void setCurrentState(QmlProfilerState newState);
void setClientRecording(bool recording);
void setServerRecording(bool recording);
void setRequestedFeatures(quint64 features);
void setRecordedFeatures(quint64 features);
signals: signals:
void stateChanged(); void stateChanged();
void clientRecordingChanged(bool); void clientRecordingChanged(bool);
@@ -58,13 +64,6 @@ signals:
void requestedFeaturesChanged(quint64); void requestedFeaturesChanged(quint64);
void recordedFeaturesChanged(quint64); void recordedFeaturesChanged(quint64);
public slots:
void setCurrentState(QmlProfilerState newState);
void setClientRecording(bool recording);
void setServerRecording(bool recording);
void setRequestedFeatures(quint64 features);
void setRecordedFeatures(quint64 features);
private: private:
class QmlProfilerStateManagerPrivate; class QmlProfilerStateManagerPrivate;
QmlProfilerStateManagerPrivate *d; QmlProfilerStateManagerPrivate *d;

View File

@@ -41,13 +41,12 @@ public:
QmlProfilerModelManager *modelManager, QWidget *parent = 0); QmlProfilerModelManager *modelManager, QWidget *parent = 0);
~QmlProfilerStateWidget(); ~QmlProfilerStateWidget();
private slots: private:
void showText(const QString &text); void showText(const QString &text);
void updateDisplay(); void updateDisplay();
void update(); void update();
void reposition(); void reposition();
private:
class QmlProfilerStateWidgetPrivate; class QmlProfilerStateWidgetPrivate;
QmlProfilerStateWidgetPrivate *d; QmlProfilerStateWidgetPrivate *d;
}; };

View File

@@ -87,11 +87,9 @@ private:
void loadEvent(const QmlEvent &event, const QmlEventType &type); void loadEvent(const QmlEvent &event, const QmlEventType &type);
void finalize(); void finalize();
private slots:
void dataChanged(); void dataChanged();
void notesChanged(int typeIndex); void notesChanged(int typeIndex);
private:
class QmlProfilerStatisticsModelPrivate; class QmlProfilerStatisticsModelPrivate;
QmlProfilerStatisticsModelPrivate *d; QmlProfilerStatisticsModelPrivate *d;
}; };

View File

@@ -82,7 +82,6 @@ public:
QString summary(const QVector<int> &typeIds) const; QString summary(const QVector<int> &typeIds) const;
QStringList details(int typeId) const; QStringList details(int typeId) const;
public slots:
void selectByTypeId(int typeIndex) override; void selectByTypeId(int typeIndex) override;
void onVisibleFeaturesChanged(quint64 features) override; void onVisibleFeaturesChanged(quint64 features) override;
@@ -121,27 +120,24 @@ public:
void setShowExtendedStatistics(bool); void setShowExtendedStatistics(bool);
bool showExtendedStatistics() const; bool showExtendedStatistics() const;
signals:
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
void typeSelected(int typeIndex);
public slots:
void clear(); void clear();
void jumpToItem(const QModelIndex &index); void jumpToItem(const QModelIndex &index);
void selectType(int typeIndex); void selectType(int typeIndex);
void buildModel(); void buildModel();
void updateNotes(int typeIndex); void updateNotes(int typeIndex);
signals:
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
void typeSelected(int typeIndex);
private: private:
void selectItem(const QStandardItem *item); void selectItem(const QStandardItem *item);
void setHeaderLabels(); void setHeaderLabels();
void parseModel(); void parseModel();
QStandardItem *itemFromIndex(const QModelIndex &index) const; QStandardItem *itemFromIndex(const QModelIndex &index) const;
private:
class QmlProfilerStatisticsMainViewPrivate; class QmlProfilerStatisticsMainViewPrivate;
QmlProfilerStatisticsMainViewPrivate *d; QmlProfilerStatisticsMainViewPrivate *d;
}; };
class QmlProfilerStatisticsRelativesView : public Utils::TreeView class QmlProfilerStatisticsRelativesView : public Utils::TreeView
@@ -152,15 +148,14 @@ public:
QWidget *parent); QWidget *parent);
~QmlProfilerStatisticsRelativesView(); ~QmlProfilerStatisticsRelativesView();
signals:
void typeClicked(int typeIndex);
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
public slots:
void displayType(int typeIndex); void displayType(int typeIndex);
void jumpToItem(const QModelIndex &); void jumpToItem(const QModelIndex &);
void clear(); void clear();
signals:
void typeClicked(int typeIndex);
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
private: private:
void rebuildTree(const QmlProfilerStatisticsRelativesModel::QmlStatisticsRelativesMap &map); void rebuildTree(const QmlProfilerStatisticsRelativesModel::QmlStatisticsRelativesMap &map);
void updateHeader(); void updateHeader();

View File

@@ -55,14 +55,13 @@ public:
virtual void loadEvent(const QmlEvent &event, const QmlEventType &type) = 0; virtual void loadEvent(const QmlEvent &event, const QmlEventType &type) = 0;
virtual void finalize() = 0; virtual void finalize() = 0;
private slots:
void dataChanged();
void onVisibleFeaturesChanged(quint64 features);
protected: protected:
void announceFeatures(quint64 features); void announceFeatures(quint64 features);
private: private:
void dataChanged();
void onVisibleFeaturesChanged(quint64 features);
const Message m_message; const Message m_message;
const RangeType m_rangeType; const RangeType m_rangeType;
const ProfileFeature m_mainFeature; const ProfileFeature m_mainFeature;

View File

@@ -64,7 +64,6 @@ public:
static QmlProfilerClientManager *clientManager(); static QmlProfilerClientManager *clientManager();
public slots:
void profilerStateChanged(); void profilerStateChanged();
void serverRecordingChanged(); void serverRecordingChanged();
void clientsDisconnected(); void clientsDisconnected();
@@ -74,7 +73,7 @@ public slots:
void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columnNumber); void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columnNumber);
private slots: private:
void clearData(); void clearData();
void showErrorDialog(const QString &error); void showErrorDialog(const QString &error);
void profilerDataModelStateChanged(); void profilerDataModelStateChanged();
@@ -90,7 +89,6 @@ private slots:
void toggleRequestedFeature(QAction *action); void toggleRequestedFeature(QAction *action);
void toggleVisibleFeature(QAction *action); void toggleVisibleFeature(QAction *action);
private:
void updateRunActions(); void updateRunActions();
void clearDisplay(); void clearDisplay();
template<ProfileFeature feature> template<ProfileFeature feature>

View File

@@ -53,7 +53,6 @@ public:
void setRecording(bool); void setRecording(bool);
quint64 recordedFeatures() const; quint64 recordedFeatures() const;
public slots:
void clearData(); void clearData();
void sendRecordingStatus(int engineId = -1); void sendRecordingStatus(int engineId = -1);
void setRequestedFeatures(quint64 features); void setRequestedFeatures(quint64 features);

View File

@@ -183,8 +183,8 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
d->m_zoomControl); d->m_zoomControl);
d->m_mainView->setSource(QUrl(QLatin1String("qrc:/timeline/MainView.qml"))); d->m_mainView->setSource(QUrl(QLatin1String("qrc:/timeline/MainView.qml")));
QQuickItem *rootObject = d->m_mainView->rootObject(); connect(d->m_modelProxy, &Timeline::TimelineModelAggregator::updateCursorPosition,
connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition())); this, &QmlProfilerTraceView::updateCursorPosition);
} }
QmlProfilerTraceView::~QmlProfilerTraceView() QmlProfilerTraceView::~QmlProfilerTraceView()

View File

@@ -55,7 +55,6 @@ public:
bool isUsable() const; bool isUsable() const;
bool isSuspended() const; bool isSuspended() const;
public slots:
void clear(); void clear();
void selectByTypeId(int typeId); void selectByTypeId(int typeId);
void selectByEventIndex(int modelId, int eventIndex); void selectByEventIndex(int modelId, int eventIndex);