diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-07-19 17:48:57 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-07-21 12:27:43 +0200 |
commit | 51a9ff7d4ead754838b675c3184ea7f56e0eb2fe (patch) | |
tree | 0ce64c9114246f94f1a42cc2edc81022ca918af9 /src/plugins/qmljsinspector | |
parent | ebf4212f71a2a58fd7aaa1abc246c873e41a3b91 (diff) | |
download | qt-creator-51a9ff7d4ead754838b675c3184ea7f56e0eb2fe.tar.gz |
Qml Tooling: Fix debugging & profiling of .qml files loaded from resources
Don't expect that every url specifying a file is a local file url. Instead
let FileInProjectFinder handle urls with other schemes gracefully, too.
Change-Id: I72457d502ff1caf52f588e8ec41ab260882d1cf5
Reviewed-on: http://codereview.qt.nokia.com/1840
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
Diffstat (limited to 'src/plugins/qmljsinspector')
-rw-r--r-- | src/plugins/qmljsinspector/qmljsclientproxy.cpp | 10 | ||||
-rw-r--r-- | src/plugins/qmljsinspector/qmljsinspector.cpp | 10 | ||||
-rw-r--r-- | src/plugins/qmljsinspector/qmljsinspector.h | 2 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.cpp b/src/plugins/qmljsinspector/qmljsclientproxy.cpp index aff9c46e7f..e2257459d8 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.cpp +++ b/src/plugins/qmljsinspector/qmljsclientproxy.cpp @@ -510,23 +510,23 @@ void ClientProxy::objectTreeFetched(QDeclarativeDebugQuery::State state) void ClientProxy::buildDebugIdHashRecursive(const QDeclarativeDebugObjectReference& ref) { - QString filename = ref.source().url().toLocalFile(); + QUrl fileUrl = ref.source().url(); int lineNum = ref.source().lineNumber(); int colNum = ref.source().columnNumber(); int rev = 0; // handle the case where the url contains the revision number encoded. (for object created by the debugger) static QRegExp rx("(.*)_(\\d+):(\\d+)$"); - if (rx.exactMatch(filename)) { - filename = rx.cap(1); + if (rx.exactMatch(fileUrl.path())) { + fileUrl.setPath(rx.cap(1)); rev = rx.cap(2).toInt(); lineNum += rx.cap(3).toInt() - 1; } - filename = InspectorUi::instance()->findFileInProject(filename); + const QString filePath = InspectorUi::instance()->findFileInProject(fileUrl); // append the debug ids in the hash - m_debugIdHash[qMakePair<QString, int>(filename, rev)][qMakePair<int, int>(lineNum, colNum)].append(ref.debugId()); + m_debugIdHash[qMakePair<QString, int>(filePath, rev)][qMakePair<int, int>(lineNum, colNum)].append(ref.debugId()); foreach (const QDeclarativeDebugObjectReference &it, ref.children()) buildDebugIdHashRecursive(it); diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index 5a2ffbdcc5..bc204ded6a 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -676,12 +676,8 @@ void InspectorUi::gotoObjectReferenceDefinition(const QDeclarativeDebugObjectRef } QDeclarativeDebugFileReference source = obj.source(); - QString fileName = source.url().toLocalFile(); - if (source.lineNumber() < 0 || !QFile::exists(fileName)) - return; - - fileName = m_projectFinder.findFile(fileName); + const QString fileName = m_projectFinder.findFile(source.url()); Core::EditorManager *editorManager = Core::EditorManager::instance(); Core::IEditor *currentEditor = editorManager->currentEditor(); @@ -789,9 +785,9 @@ InspectorUi *InspectorUi::instance() return m_instance; } -QString InspectorUi::findFileInProject(const QString &originalPath) const +QString InspectorUi::findFileInProject(const QUrl &url) const { - return m_projectFinder.findFile(originalPath); + return m_projectFinder.findFile(url); } void InspectorUi::setApplyChangesToQmlInspector(bool applyChanges) diff --git a/src/plugins/qmljsinspector/qmljsinspector.h b/src/plugins/qmljsinspector/qmljsinspector.h index 697011f41e..72762e363b 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.h +++ b/src/plugins/qmljsinspector/qmljsinspector.h @@ -95,7 +95,7 @@ public: static InspectorUi *instance(); - QString findFileInProject(const QString &file) const; + QString findFileInProject(const QUrl &fileUrl) const; void setupUi(); bool isConnected() const; |