Commit 986c9560 authored by Kai Koehne's avatar Kai Koehne

QmlObserver: Fix 'Apply Changes on Save' on Mac

Use the generic FileInProjectFinder instead of some homebrewn
matching algorithm (which didn't handle the case that on  Mac OS X,
files are copied to the app bundle).

Reviewed-by: Christiaan Janssen
Task-number: QTCREATORBUG-3188
parent 26b28804
......@@ -516,16 +516,7 @@ void ClientProxy::buildDebugIdHashRecursive(const QDeclarativeDebugObjectReferen
lineNum += rx.cap(3).toInt() - 1;
}
//convert the filename to a canonical filename in case of shadow build.
bool isShadowBuild = InspectorUi::instance()->isShadowBuildProject();
if (isShadowBuild && rev == 0) {
QString shadowBuildDir = InspectorUi::instance()->debugProjectBuildDirectory();
if (filename.startsWith(shadowBuildDir)) {
ProjectExplorer::Project *debugProject = InspectorUi::instance()->debugProject();
filename = debugProject->projectDirectory() + filename.mid(shadowBuildDir.length());
}
}
filename = InspectorUi::instance()->findFileInProject(filename);
// append the debug ids in the hash
m_debugIdHash[qMakePair<QString, int>(filename, rev)][qMakePair<int, int>(lineNum, colNum)].append(ref.debugId());
......
......@@ -310,13 +310,6 @@ void InspectorUi::connected(ClientProxy *clientProxy)
}
m_debugProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
if (m_debugProject->activeTarget()
&& m_debugProject->activeTarget()->activeBuildConfiguration())
{
ProjectExplorer::BuildConfiguration *bc
= m_debugProject->activeTarget()->activeBuildConfiguration();
m_debugProjectBuildDir = bc->buildDirectory();
}
connect(m_debugProject, SIGNAL(destroyed()), SLOT(currentDebugProjectRemoved()));
m_projectFinder.setProjectDirectory(m_debugProject->projectDirectory());
......@@ -787,23 +780,9 @@ InspectorUi *InspectorUi::instance()
return m_instance;
}
ProjectExplorer::Project *InspectorUi::debugProject() const
{
return m_debugProject;
}
bool InspectorUi::isShadowBuildProject() const
{
// for .qmlproject based stuff, build dir is empty
if (!debugProject() || debugProjectBuildDirectory().isEmpty())
return false;
return (debugProject()->projectDirectory() != debugProjectBuildDirectory());
}
QString InspectorUi::debugProjectBuildDirectory() const
QString InspectorUi::findFileInProject(const QString &originalPath) const
{
return m_debugProjectBuildDir;
return m_projectFinder.findFile(originalPath);
}
void InspectorUi::setApplyChangesToQmlObserver(bool applyChanges)
......
......@@ -96,10 +96,7 @@ public:
static InspectorUi *instance();
// returns the project being currently debugged, or 0 if not debugging anything
ProjectExplorer::Project *debugProject() const;
QString debugProjectBuildDirectory() const;
bool isShadowBuildProject() const;
QString findFileInProject(const QString &file) const;
void setupUi();
bool isConnected() const;
......@@ -173,7 +170,6 @@ private:
// project is needed for matching filenames, esp. with shadow builds.
ProjectExplorer::Project *m_debugProject;
QString m_debugProjectBuildDir;
QStringList m_pendingPreviewDocumentNames;
Utils::FileInProjectFinder m_projectFinder;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment