Commit 745f82bf authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/2.8' into HEAD

Conflicts:
	src/plugins/coreplugin/editormanager/editormanager.cpp

Change-Id: I59ce346c85803f5496a22bdadf7dca09e59d3174
parents 360366ae 56bdad14
......@@ -1152,12 +1152,15 @@ bool EditorManager::closeEditors(const QList<IEditor*> &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) {
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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)
......
......@@ -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());
}
......
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