diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 4f1ed05f126..6d12192582d 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1152,12 +1152,15 @@ bool EditorManager::closeEditors(const QList &editorsToClose, bool ask return !closingFailed; } -Core::IEditor *EditorManager::pickUnusedEditor() const +Core::IEditor *EditorManager::pickUnusedEditor(EditorView **foundView) const { foreach (IEditor *editor, openedEditors()) { EditorView *view = viewForEditor(editor); - if (!view || view->currentEditor() != editor) + if (!view || view->currentEditor() != editor) { + if (foundView) + *foundView = view; return editor; + } } return 0; } @@ -1214,8 +1217,12 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core view->addEditor(editor); view->setCurrentEditor(editor); if (!sourceView->currentEditor()) { - if (IEditor *replacement = pickUnusedEditor()) + EditorView *replacementView = 0; + if (IEditor *replacement = pickUnusedEditor(&replacementView)) { + if (replacementView) + replacementView->removeEditor(replacement); sourceView->addEditor(replacement); + } } return editor; } else if (duplicateSupported) { diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 57406c8f0e1..9890449fa4c 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -273,7 +273,7 @@ private: void closeView(Internal::EditorView *view); void emptyView(Internal::EditorView *view); static void splitNewWindow(Internal::EditorView *view); - IEditor *pickUnusedEditor() const; + IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0) const; void addDocumentToRecentFiles(IDocument *document); void updateAutoSave(); void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 7d5fb64c8bd..11106768c57 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -413,18 +413,24 @@ void QmlEngine::beginConnection(quint16 port) if (host.isEmpty()) host = QLatin1String("localhost"); - if (port > 0) { - QTC_ASSERT(startParameters().connParams.port == 0 - || startParameters().connParams.port == port, - qWarning() << "Port " << port << "from application output does not match" - << startParameters().connParams.port << "from start parameters."); - m_adapter.beginConnectionTcp(host, port); - return; - } - // no port from application output, use the one from start parameters ... - m_adapter.beginConnectionTcp(host, startParameters().qmlServerPort); + /* + * Let plugin-specific code override the port printed by the application. This is necessary + * in the case of port forwarding, when the port the application listens on is not the same that + * we want to connect to. + * NOTE: It is still necessary to wait for the output in that case, because otherwise we cannot + * be sure that the port is already open. The usual method of trying to connect repeatedly + * will not work, because the intermediate port is already open. So the connection + * will be accepted on that port but the forwarding to the target port will fail and + * the connection will be closed again (instead of returning the "connection refused" + * error that we expect). + */ + if (startParameters().qmlServerPort > 0) + port = startParameters().qmlServerPort; + + m_adapter.beginConnectionTcp(host, port); } + void QmlEngine::connectionStartupFailed() { if (m_retryOnConnectFail) { diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 38211a706e1..8dca382aa8f 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1130,6 +1130,7 @@ void GitClient::log(const QString &workingDirectory, const QStringList &fileName enableAnnotationContextMenu, args, fileNames)); editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); + editor->setDiffBaseDirectory(workingDirectory); QStringList arguments; arguments << QLatin1String("log") << QLatin1String(noColorOption) diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index 1e4adc1ba55..3563053bce5 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -121,25 +121,26 @@ void RemoteLinuxAnalyzeSupport::startExecution() { QTC_ASSERT(state() == GatheringPorts, return); - if (d->qmlProfiling && !setPort(d->qmlPort)) - return; + // Currently we support only QML profiling + QTC_ASSERT(d->qmlProfiling, return); + + if (!setPort(d->qmlPort)) + return; setState(StartingRunner); DeviceApplicationRunner *runner = appRunner(); connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteErrorOutput(QByteArray))); connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); - if (d->qmlProfiling) - connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); - QString args = arguments(); - if (d->qmlProfiling) - args += QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort); - const QString remoteCommandLine = d->qmlProfiling - ? QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args) - : QString(); + connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool))); connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString))); connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString))); + + const QString args = arguments() + + QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort); + const QString remoteCommandLine = + QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args); runner->start(device(), remoteCommandLine.toUtf8()); }