Commit 65654e4a authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/2.7'

Conflicts:
	src/plugins/android/androidrunner.cpp
	src/plugins/clearcase/clearcasesync.cpp
	src/plugins/fakevim/fakevimhandler.cpp
	tests/auto/ioutils/ioutils.pro

Change-Id: I31587b8a4dd6aacc1e76803159da51a972878370
parents 2d2a8994 bb13b8d6
......@@ -92,14 +92,15 @@ release/
/doc/api/html/
/doc/pluginhowto/html/
/dist/gdb/python/
/dist/gdb/qtcreator-*/
/dist/gdb/source/
/dist/gdb/staging/
/dist/gdb/*.gz
.moc/
.obj/
.pch/
.rcc/
.uic/
/dist/gdb/qtcreator-*/
/dist/gdb/source/
/dist/gdb/staging/
ipch/
tmp/
# ignore both a directory as well as a symlink
......
......@@ -40,7 +40,7 @@
You can also specify indentation settings separately for C++ and QML files
either globally or for the open project. For more information, see
\l{Indenting Code}.
\l{Indenting Text or Code}.
You can perform the following configuration actions:
......@@ -53,7 +53,7 @@
{definition files for syntax highlighting} for other types of files
than C++ or QML in \gui{Generic Highlighter}.
\li Set \l{Indenting Code}{tabs, indentation, the handling of
\li Set \l{Indenting Text or Code}{tabs, indentation, the handling of
whitespace, and mouse operations} in \gui Behavior.
\li Set various display properties, for example,
......
......@@ -63,10 +63,10 @@
\QC anticipates what you are going to write and completes code
and code snippets for elements, properties, and IDs.
\li \l{Indenting Code}
\li \l{Indenting Text or Code}
\QC indents code according to rules that you specify either
globally for all files or separately for text, C++, or QML files.
\QC indents text and code according to rules that you specify separately for
files that contain C++ or QML code and for other text files.
\li \l{Using Qt Quick Toolbars}
......
......@@ -1004,44 +1004,29 @@
\page creator-indenting-code.html
\nextpage qt-quick-toolbars.html
\title Indenting Code
\title Indenting Text or Code
When you type code, it is indented automatically according to the selected
text editor and code style options. Select a block to indent it when you
When you type text or code, it is indented automatically according to the selected
text editor or code style options. Select a block to indent it when you
press \key Tab. Press \key {Shift+Tab} to decrease the indentation. You
can disable automatic indentation.
You can specify indentation either globally for all files or separately
for:
You can specify indentation for:
\list
\li Text files
\li C++ files
\li QML files
\li Other text files
\endlist
You can also specify indentation separately for each project. You can
specify several sets of code style settings and easily switch between them.
In addition, you can import and export code style settings.
\section1 Indenting Text Files
To specify global indentation settings for the text editor, select
\gui {Tools > Options > Text Editor > Behavior}. You can also use these
settings globally for all editors and files.
\image qtcreator-indentation.png "Text Editor Behavior options"
To specify settings for a particular project, select \gui {Projects >
Editor Settings}.
You can specify how to interpret the \key Tab and \key Backspace key
presses and how to align continuation lines.
\section1 Indenting C++ Files
To specify indentation settings for the C++ editor:
......@@ -1082,12 +1067,12 @@
You can use the live preview to see how the options change the indentation.
To specify the settings for a particular project, select \gui {Projects >
To specify different settings for a particular project, select \gui {Projects >
Code Style Settings}.
\section1 Indenting QML Files
To specify global settings for the Qt Quick editor:
To specify settings for the Qt Quick editor:
\list 1
......@@ -1109,26 +1094,39 @@
You can specify how to interpret the \key Tab key presses and how to align
continuation lines.
To specify the settings for a particular project, select \gui {Projects >
To specify different settings for a particular project, select \gui {Projects >
Code Style Settings}.
\section1 Indenting Other Text Files
To specify indentation settings for text files that do not contain C++ or QML code (such
as Python code files), select \gui {Tools > Options > Text Editor > Behavior}.
\image qtcreator-indentation.png "Text Editor Behavior options"
To specify different settings for a particular project, select \gui {Projects >
Editor Settings}.
You can specify how to interpret the \key Tab and \key Backspace key
presses and how to align continuation lines.
\section1 Specifying Tab Settings
You can specify tab settings at the following levels:
\list
\li Global settings for all files
\li For all C++ files
\li Global C++ settings for C++ files
\li For all QML files
\li Global Qt Quick settings for QML files
\li For all other text files
\li Project specific settings for all editors of files in the project
\li For C++ files in a project
\li Project specific settings for C++ files in the project
\li For QML files in a project
\li Project specific settings for QML files in the project
\li For other text files in a project
\endlist
......@@ -1150,8 +1148,8 @@
\section2 Speficying Typing Options
When you type code, it is indented automatically according to the selected
text editor and code style options. Specify typing options in the
When you type text or code, it is indented automatically according to the selected
text editor or code style options. Specify typing options in the
\gui Typing group. To disable automatic indentation, deselect the
\gui {Enable automatic indentation} check box.
......
......@@ -160,6 +160,9 @@
a list of all projects open in the current session. The files for each
project are grouped according to their file type.
If the project is under version control, information from the version control system
might be displayed in brackets after the project name. This is currently implemented for
Git (the branch name or a tag is displayed) and ClearCase (the view name is displayed).
You can use the project tree in the following ways:
......
......@@ -70,6 +70,6 @@
\endlist
For more information about the settings, see \l{Indenting Code}.
For more information about the settings, see \l{Indenting Text or Code}.
*/
......@@ -59,7 +59,7 @@
\list
\li \l{Indenting Code}
\li \l{Indenting Text or Code}
\li \l{File Encoding}
......
......@@ -209,7 +209,7 @@
\li \l{Semantic Highlighting}
\li \l{Checking Code Syntax}
\li \l{Completing Code}
\li \l{Indenting Code}
\li \l{Indenting Text or Code}
\li \l{Using Qt Quick Toolbars}
\li \l{Pasting and Fetching Code Snippets}
\li \l{Using Text Editing Macros}
......
......@@ -21,7 +21,7 @@ OTHER_FILES += dist/copyright_template.txt \
qbs/pluginspec/pluginspec.qbs
qmake_cache = $$targetPath($$IDE_BUILD_TREE/.qmake.cache)
equals(QMAKE_DIR_SEP, /): {
!equals(QMAKE_HOST.os, Windows) {
maybe_quote = "\""
maybe_backslash = "\\"
}
......
......@@ -1948,6 +1948,8 @@ class PlainDumper:
lister = getattr(printer, "children", None)
children = [] if lister is None else list(lister())
d.putType(self.printer.name)
val = printer.to_string().encode("hex")
d.putValue(val, Hex2EncodedLatin1)
d.putValue(printer.to_string())
d.putNumChild(len(children))
if d.isExpanded():
......
......@@ -17,8 +17,9 @@
<env var="QML2_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<arg>-style</arg>
<arg>qnxlight</arg>
<arg>-platform</arg>
<arg>qnx</arg>
<action system="true">run_native</action>
......
......@@ -702,6 +702,7 @@ QByteArray Preprocessor::run(const QString &fileName,
m_scratchBuffer.clear();
QByteArray preprocessed, includeGuardMacroName;
preprocessed.reserve(source.size() * 2); // multiply by 2 because we insert #gen lines.
preprocess(fileName, source, &preprocessed, &includeGuardMacroName, noLines,
markGeneratedTokens, false);
if (!includeGuardMacroName.isEmpty())
......
......@@ -334,7 +334,6 @@ public:
delete connection;
return kDNSServiceErr_Unknown;
}
typedef void (*AvahiSimplePollSetFuncPtr)(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata);
m_simplePollSetFunc(connection->simple_poll, &cAvahiPollFunction, mainConnection);
/* Allocate a new client */
int error;
......
......@@ -143,7 +143,11 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
m_runner, SLOT(start()));
connect(m_runControl, SIGNAL(finished()),
m_runner, SLOT(stop()));
connect(m_runControl->engine(), SIGNAL(aboutToNotifyInferiorSetupOk()),
m_runner, SLOT(handleGdbRunning()));
connect(m_runner, SIGNAL(remoteServerRunning(QByteArray,int)),
SLOT(handleRemoteServerRunning(QByteArray,int)));
connect(m_runner, SIGNAL(remoteProcessStarted(int,int)),
SLOT(handleRemoteProcessStarted(int,int)));
connect(m_runner, SIGNAL(remoteProcessFinished(QString)),
......@@ -155,6 +159,11 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
SLOT(handleRemoteOutput(QByteArray)));
}
void AndroidDebugSupport::handleRemoteServerRunning(const QByteArray &serverChannel, int pid)
{
m_runControl->engine()->notifyEngineRemoteServerRunning(serverChannel, pid);
}
void AndroidDebugSupport::handleRemoteProcessStarted(int gdbServerPort, int qmlPort)
{
disconnect(m_runner, SIGNAL(remoteProcessStarted(int,int)),
......
......@@ -53,7 +53,8 @@ public:
Debugger::DebuggerRunControl *runControl);
private slots:
void handleRemoteProcessStarted(int gdbServerPort = -1, int qmlPort = -1);
void handleRemoteServerRunning(const QByteArray &serverChannel, int pid);
void handleRemoteProcessStarted(int gdbServerPort, int qmlPort);
void handleRemoteProcessFinished(const QString &errorMsg);
void handleRemoteOutput(const QByteArray &output);
......
......@@ -69,7 +69,7 @@ IDeviceWidget *AndroidDevice::createWidget()
QList<Core::Id> AndroidDevice::actionIds() const
{
return QList<Core::Id>()<<Core::Id(Constants::ANDROID_DEVICE_ID);
return QList<Core::Id>();
}
QString AndroidDevice::displayNameForActionId(Core::Id actionId) const
......
......@@ -440,6 +440,8 @@ bool AndroidPackageCreationStep::createPackage()
QFile::remove(m_gdbServerDestination.toString());
if (m_debugBuild || !m_certificateAlias.length()) {
build << QLatin1String("debug");
QDir dir;
dir.mkpath(m_gdbServerDestination.toFileInfo().absolutePath());
if (!QFile::copy(m_gdbServerSource.toString(), m_gdbServerDestination.toString())) {
raiseError(tr("Can't copy gdbserver from '%1' to '%2'").arg(m_gdbServerSource.toUserOutput())
.arg(m_gdbServerDestination.toUserOutput()));
......
......@@ -37,21 +37,29 @@
#include <debugger/debuggerrunconfigurationaspect.h>
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <QTime>
#include <QtConcurrentRun>
#include <QTemporaryFile>
namespace Android {
namespace Internal {
typedef QLatin1String _;
AndroidRunner::AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig, bool debuggingMode)
: QThread(parent)
{
m_wasStarted = false;
Debugger::DebuggerRunConfigurationAspect *aspect
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
m_useCppDebugger = debuggingMode && aspect->useCppDebugger();
m_useQmlDebugger = debuggingMode && aspect->useQmlDebugger();
m_remoteGdbChannel = runConfig->remoteChannel();
QString channel = runConfig->remoteChannel();
QTC_CHECK(channel.startsWith(QLatin1Char(':')));
m_localGdbServerPort = channel.mid(1).toUShort();
QTC_CHECK(m_localGdbServerPort);
m_qmlPort = aspect->qmlDebugServerPort();
ProjectExplorer::Target *target = runConfig->target();
AndroidDeployStep *ds = runConfig->deployStep();
......@@ -64,204 +72,258 @@ AndroidRunner::AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig
m_packageName = m_intentName.left(m_intentName.indexOf(QLatin1Char('/')));
m_deviceSerialNumber = ds->deviceSerialNumber();
m_processPID = -1;
m_gdbserverPID = -1;
connect(&m_checkPIDTimer, SIGNAL(timeout()), SLOT(checkPID()));
m_adb = AndroidConfigurations::instance().adbToolPath().toString();
m_selector = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
QString packageDir = _("/data/data/") + m_packageName;
m_pingFile = packageDir + _("/debug-ping");
m_pongFile = _("/data/local/tmp/qt/debug-pong-") + m_packageName;
m_gdbserverSocket = packageDir + _("/debug-socket");
m_gdbserverPath = packageDir + _("/lib/gdbserver");
m_gdbserverCommand = m_gdbserverPath + _(" --multi +") + m_gdbserverSocket;
// Detect busybox, as we need to pass -w to ps to get wide output.
QProcess psProc;
psProc.start(m_adb, selector() << _("shell") << _("readlink") << _("$(which ps)"));
psProc.waitForFinished();
QByteArray which = psProc.readAll();
m_isBusyBox = which.startsWith("busybox");
connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardOutput()), SLOT(logcatReadStandardOutput()));
connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardError()) , SLOT(logcatReadStandardError()));
connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardError()), SLOT(logcatReadStandardError()));
connect(&m_checkPIDTimer, SIGNAL(timeout()), SLOT(checkPID()));
}
AndroidRunner::~AndroidRunner()
{
stop();
//stop();
}
void AndroidRunner::checkPID()
static int extractPidFromChunk(const QByteArray &chunk, int from)
{
int pos1 = chunk.indexOf(' ', from);
if (pos1 == -1)
return -1;
while (chunk[pos1] == ' ')
++pos1;
int pos3 = chunk.indexOf(' ', pos1);
int pid = chunk.mid(pos1, pos3 - pos1).toInt();
return pid;
}
static int extractPid(const QString &exeName, const QByteArray &psOutput)
{
const QByteArray needle = exeName.toUtf8() + '\r';
const int to = psOutput.indexOf(needle);
if (to == -1)
return -1;
const int from = psOutput.lastIndexOf('\n', to);
if (from == -1)
return -1;
return extractPidFromChunk(psOutput, from);
}
QByteArray AndroidRunner::runPs()
{
QProcess psProc;
QLatin1String psCmd = QLatin1String("ps");
QLatin1String psPidRx = QLatin1String("\\d+\\s+(\\d+)");
// Detect busybox, as we need to pass -w to it to get wide output.
psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
<< QLatin1String("shell") << QLatin1String("readlink") << QLatin1String("$(which ps)"));
if (!psProc.waitForFinished(-1)) {
psProc.kill();
return;
}
QByteArray which = psProc.readAll();
if (which.startsWith("busybox")) {
psCmd = QLatin1String("ps -w");
psPidRx = QLatin1String("(\\d+)");
}
QStringList args = m_selector;
args << _("shell") << _("ps");
if (m_isBusyBox)
args << _("-w");
psProc.start(m_adb, args);
psProc.waitForFinished();
return psProc.readAll();
}
psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
<< QLatin1String("shell") << psCmd);
if (!psProc.waitForFinished(-1)) {
psProc.kill();
void AndroidRunner::checkPID()
{
if (!m_wasStarted)
return;
}
QRegExp rx(psPidRx);
qint64 pid = -1;
QList<QByteArray> procs = psProc.readAll().split('\n');
foreach (const QByteArray &proc, procs) {
if (proc.trimmed().endsWith(m_packageName.toLatin1())) {
if (rx.indexIn(QLatin1String(proc)) > -1) {
pid = rx.cap(1).toLongLong();
break;
}
}
}
if (-1 != m_processPID && pid == -1) {
m_processPID = -1;
QByteArray psOut = runPs();
m_processPID = extractPid(m_packageName, psOut);
if (m_processPID == -1)
emit remoteProcessFinished(tr("\n\n'%1' died.").arg(m_packageName));
return;
}
m_processPID = pid;
}
if (!m_useCppDebugger)
return;
m_gdbserverPID = -1;
foreach (const QByteArray &proc, procs) {
if (proc.trimmed().endsWith("gdbserver")) {
if (rx.indexIn(QLatin1String(proc)) > -1) {
m_gdbserverPID = rx.cap(1).toLongLong();
break;
}
}
}
void AndroidRunner::forceStop()
{
QProcess proc;
proc.start(m_adb, selector() << _("shell") << _("am") << _("force-stop"));
proc.waitForFinished();
}
void AndroidRunner::killPID()
{
checkPID(); //updates m_processPID and m_gdbserverPID
for (int tries = 0; tries < 10 && (m_processPID != -1 || m_gdbserverPID != -1); ++tries) {
if (m_processPID != -1) {
adbKill(m_processPID, m_deviceSerialNumber, 2000);
adbKill(m_processPID, m_deviceSerialNumber, 2000, m_packageName);
}
if (m_gdbserverPID != -1) {
adbKill(m_gdbserverPID, m_deviceSerialNumber, 2000);
adbKill(m_gdbserverPID, m_deviceSerialNumber, 2000, m_packageName);
const QByteArray out = runPs();
int from = 0;
while (1) {
const int to = out.indexOf('\n', from);
if (to == -1)
break;
QString line = QString::fromUtf8(out.data() + from, to - from - 1);
if (line.endsWith(m_packageName) || line.endsWith(m_gdbserverPath)) {
int pid = extractPidFromChunk(out, from);
adbKill(pid);
}
checkPID();
from = to + 1;
}
}
void AndroidRunner::start()
{
QtConcurrent::run(this,&AndroidRunner::asyncStart);
m_adbLogcatProcess.start(m_adb, selector() << _("logcat"));
m_wasStarted = false;
m_checkPIDTimer.start(1000); // check if the application is alive every 1 seconds
QtConcurrent::run(this, &AndroidRunner::asyncStart);
}
void AndroidRunner::asyncStart()
{
QMutexLocker locker(&m_mutex);
m_processPID = -1;
killPID(); // kill any process with this name
QString extraParams;
QProcess adbStarProc;
forceStop();
killPID();
if (m_useCppDebugger) {
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
arguments << QLatin1String("forward") << QString::fromLatin1("tcp%1").arg(m_remoteGdbChannel)
<< QString::fromLatin1("localfilesystem:/data/data/%1/debug-socket").arg(m_packageName);
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!adbStarProc.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adbStarProc.errorString()));
// Remove pong file.
QProcess adb;
adb.start(m_adb, selector() << _("shell") << _("rm") << m_pongFile);
adb.waitForFinished();
}
QStringList args = selector();
args << _("shell") << _("am") << _("start") << _("-n") << m_intentName;
if (m_useCppDebugger) {
QProcess adb;
adb.start(m_adb, selector() << _("forward")
<< QString::fromLatin1("tcp:%1").arg(m_localGdbServerPort)
<< _("localfilesystem:") + m_gdbserverSocket);
if (!adb.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adb.errorString()));
return;
}
if (!adbStarProc.waitForFinished(-1)) {
if (!adb.waitForFinished(-1)) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports."));
return;
}
extraParams = QLatin1String("-e native_debug true -e gdbserver_socket +debug-socket");
args << _("-e") << _("debug_ping") << _("true");
args << _("-e") << _("ping_file") << m_pingFile;
args << _("-e") << _("pong_file") << m_pongFile;
args << _("-e") << _("gdbserver_command") << m_gdbserverCommand;
args << _("-e") << _("gdbserver_socket") << m_gdbserverSocket;
}
if (m_useQmlDebugger) {
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
// currently forward to same port on device and host
QString port = QString::fromLatin1("tcp:%1").arg(m_qmlPort);
arguments << QLatin1String("forward") << port << port; // currently forward to same port on device and host
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!adbStarProc.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.").arg(adbStarProc.errorString()));
QProcess adb;
adb.start(m_adb, selector() << _("forward") << port << port);
if (!adb.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.").arg(adb.errorString()));
return;
}