forked from qt-creator/qt-creator
QmlProfiler: rename requestId into typeId
No need to invent a new name for the same thing. Change-Id: I370ec7be9c762642ae35e4f7a60ff9f5eb8ae3fe Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -267,11 +267,11 @@ void QmlProfilerDataModel::finalize()
|
|||||||
d->detailsRewriter->reloadDocuments();
|
d->detailsRewriter->reloadDocuments();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerDataModel::detailsChanged(int requestId, const QString &newString)
|
void QmlProfilerDataModel::detailsChanged(int typeId, const QString &newString)
|
||||||
{
|
{
|
||||||
Q_D(QmlProfilerDataModel);
|
Q_D(QmlProfilerDataModel);
|
||||||
QTC_ASSERT(requestId < d->eventTypes.count(), return);
|
QTC_ASSERT(typeId < d->eventTypes.count(), return);
|
||||||
d->eventTypes[requestId].setData(newString);
|
d->eventTypes[typeId].setData(newString);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlProfiler
|
} // namespace QmlProfiler
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ signals:
|
|||||||
void allTypesLoaded();
|
void allTypesLoaded();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void detailsChanged(int requestId, const QString &newString);
|
void detailsChanged(int typeId, const QString &newString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class QmlProfilerDataModelPrivate;
|
class QmlProfilerDataModelPrivate;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ QmlProfilerDetailsRewriter::QmlProfilerDetailsRewriter(Utils::FileInProjectFinde
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId,
|
void QmlProfilerDetailsRewriter::requestDetailsForLocation(int typeId,
|
||||||
const QmlEventLocation &location)
|
const QmlEventLocation &location)
|
||||||
{
|
{
|
||||||
QString localFile;
|
QString localFile;
|
||||||
@@ -113,7 +113,7 @@ void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId,
|
|||||||
if (m_pendingEvents.isEmpty())
|
if (m_pendingEvents.isEmpty())
|
||||||
connectQmlModel();
|
connectQmlModel();
|
||||||
|
|
||||||
m_pendingEvents.insert(localFile, {location, requestId});
|
m_pendingEvents.insert(localFile, {location, typeId});
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerDetailsRewriter::reloadDocuments()
|
void QmlProfilerDetailsRewriter::reloadDocuments()
|
||||||
@@ -132,7 +132,7 @@ void QmlProfilerDetailsRewriter::reloadDocuments()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerDetailsRewriter::rewriteDetailsForLocation(
|
void QmlProfilerDetailsRewriter::rewriteDetailsForLocation(
|
||||||
const QString &source, QmlJS::Document::Ptr doc, int requestId,
|
const QString &source, QmlJS::Document::Ptr doc, int typeId,
|
||||||
const QmlEventLocation &location)
|
const QmlEventLocation &location)
|
||||||
{
|
{
|
||||||
PropertyVisitor propertyVisitor;
|
PropertyVisitor propertyVisitor;
|
||||||
@@ -144,7 +144,7 @@ void QmlProfilerDetailsRewriter::rewriteDetailsForLocation(
|
|||||||
const quint32 startPos = node->firstSourceLocation().begin();
|
const quint32 startPos = node->firstSourceLocation().begin();
|
||||||
const quint32 len = node->lastSourceLocation().end() - startPos;
|
const quint32 len = node->lastSourceLocation().end() - startPos;
|
||||||
|
|
||||||
emit rewriteDetailsString(requestId, source.mid(startPos, len).simplified());
|
emit rewriteDetailsString(typeId, source.mid(startPos, len).simplified());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerDetailsRewriter::connectQmlModel()
|
void QmlProfilerDetailsRewriter::connectQmlModel()
|
||||||
@@ -185,7 +185,7 @@ void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc)
|
|||||||
const bool sourceHasContents = !source.isEmpty();
|
const bool sourceHasContents = !source.isEmpty();
|
||||||
for (auto it = first; it != m_pendingEvents.end() && it.key() == fileName;) {
|
for (auto it = first; it != m_pendingEvents.end() && it.key() == fileName;) {
|
||||||
if (sourceHasContents)
|
if (sourceHasContents)
|
||||||
rewriteDetailsForLocation(source, doc, it->requestId, it->location);
|
rewriteDetailsForLocation(source, doc, it->typeId, it->location);
|
||||||
it = m_pendingEvents.erase(it);
|
it = m_pendingEvents.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,17 +43,17 @@ public:
|
|||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
void clearRequests();
|
void clearRequests();
|
||||||
void requestDetailsForLocation(int requestId, const QmlEventLocation &location);
|
void requestDetailsForLocation(int typeId, const QmlEventLocation &location);
|
||||||
void reloadDocuments();
|
void reloadDocuments();
|
||||||
void documentReady(QmlJS::Document::Ptr doc);
|
void documentReady(QmlJS::Document::Ptr doc);
|
||||||
|
|
||||||
struct PendingEvent {
|
struct PendingEvent {
|
||||||
QmlEventLocation location;
|
QmlEventLocation location;
|
||||||
int requestId;
|
int typeId;
|
||||||
};
|
};
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rewriteDetailsString(int requestId, const QString &details);
|
void rewriteDetailsString(int typeId, const QString &details);
|
||||||
void eventDetailsChanged();
|
void eventDetailsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
Utils::FileInProjectFinder *m_projectFinder;
|
Utils::FileInProjectFinder *m_projectFinder;
|
||||||
QHash<QString, QString> m_filesCache;
|
QHash<QString, QString> m_filesCache;
|
||||||
|
|
||||||
void rewriteDetailsForLocation(const QString &source, QmlJS::Document::Ptr doc, int requestId,
|
void rewriteDetailsForLocation(const QString &source, QmlJS::Document::Ptr doc, int typeId,
|
||||||
const QmlEventLocation &location);
|
const QmlEventLocation &location);
|
||||||
void connectQmlModel();
|
void connectQmlModel();
|
||||||
void disconnectQmlModel();
|
void disconnectQmlModel();
|
||||||
|
|||||||
Reference in New Issue
Block a user