Commit abafbb7a authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Merge branch 'master' of ../mainline into dui-editor

parents 35e9c70d c1dc4394
IDE_BUILD_TREE = $$OUT_PWD/..
include(../qtcreator.pri)
TEMPLATE = app
......
doc/images/qtcreator-debug-view.png

140 KB | W: | H:

doc/images/qtcreator-debug-view.png

117 KB | W: | H:

doc/images/qtcreator-debug-view.png
doc/images/qtcreator-debug-view.png
doc/images/qtcreator-debug-view.png
doc/images/qtcreator-debug-view.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -37,9 +37,9 @@
files and classes using minimal keystrokes.
\o \bold{Support for qmake's .pro file format}: The project's \c{.pro}
file is used as a project description file.
\o \bold{Debugging Interface to GDB}: Applications can be debugged
\o \bold{Debugging Interface}: Applications can be debugged
within Qt Creator using a graphical frontend to the GNU symbolic
debugger.
debugger (GDB) and the Microsoft Console Debugger (CDB).
\endlist
\endtable
......@@ -57,6 +57,7 @@
\o \l{Debugging with Qt Creator}
\o \l{CMake Support in Qt Creator}
\o \l{Support for Generic Projects in Qt Creator}
\o \l{Handling External Libraries}
\o \l{Tips and Tricks}
\o \l{Keyboard Shortcuts}
\o \l{Glossary}
......@@ -694,7 +695,6 @@
*/
/*!
\contentspage index.html
\previouspage creator-writing-program.html
......@@ -1072,7 +1072,7 @@
Here, you can lock or unlock the location of your views as well as display
or hide them. Among the views you can display are \gui Breakpoints,
\gui Disassembler, \gui Modules, \gui Registers, \gui Gdb, \gui Stack, and
\gui Disassembler, \gui Modules, \gui Registers, \gui Debugger, \gui Stack, and
\gui Thread. The position of your dock widgets will be saved for future
sessions.
......@@ -1358,7 +1358,7 @@
\contentspage index.html
\previouspage creator-debugging.html
\page creator-cmake-support.html
\nextpage creator-tips.html
\nextpage creator-generic-projects.html
\title CMake Support in Qt Creator
......@@ -1412,7 +1412,7 @@
\contentspage index.html
\previouspage creator-cmake-support.html
\page creator-generic-projects.html
\nextpage creator-tips.html
\nextpage creator-external-library-handling.html
\title Support for Generic Projects in Qt Creator
......@@ -1428,10 +1428,65 @@
*/
/*!
\contentspage index.html
\previouspage creator-generic-projects.html
\page creator-external-library-handling.html
\nextpage creator-tips.html
\title Handling External Libraries
Knowing external libraries is not only important for the
underlying build system, but also for Qt Creator itself.
This way, it can support code completion and syntax highlighting
for external libraries as if they were part of the current
project or the Qt library.
The way to add a library to the project depends on the
project type, which influcences the build system used.
The following sections describe the the procedure required
for each project type.
\section1 QMake Projects (the default)
Open your your (ending in \c{.pro}) file from the
\gui{Projects} pane, which will now show up in the editor.
Follow the description in the
\l{http://doc.qtsoftware.com/latest/make-project-files.html#declaring-other-libraries}
{Declaring other Libraries} section of the Qt documentation.
If your project does sucessfully build and link against
the external library, syntax completion and highlighting
should also work.
\section1 CMake Projects
In CMake, libaries are usually detected using the \c{FIND_PACKAGE()} macro.
A couple of them are already being shipped with CMake, they can be found in
the \c{Modules} directory of your CMake installation. If you provide
libraries on your own, you will need to provide your own \c{FindFoo.cmake}
file. Refer to the \l{http://vtk.org/Wiki/CMake_FAQ#Writing_FindXXX.cmake_files}
{CMake FAQ} for details.
As with qmake project, syntax completion and highlighting should work if
you can sucessfully build and link against the external library.
\section1 Generic Projects
If you import a project using the \e{Generic Projects} function, Qt Creator will
create a file called \c{<projectname>.includes} in your project root directory. It will
contain all project subdirectories it that was able to find relevant header files in.
Simply add your include pathes there.
Note that in Generic Project mode, Qt Creator will refrain from touching any
project settings, so the above is merely a hint for the code completion and
the syntax highlighter.
*/
/*!
\contentspage index.html
\previouspage creator-debugging.html
\previouspage creator-external-library-handling.html
\page creator-tips.html
\nextpage creator-keyboard-shortcuts.html
......@@ -1526,6 +1581,9 @@
\row
\o Go to a line
\o Ctrl + L
\row
\o Navigate between pages
\o Alt + Left, Alt + Right
\row
\o Start debugging
\o F5
......@@ -1734,4 +1792,3 @@
QtCreator/src/shared/cplusplus
\endlist
*/
IDE_SOURCE_TREE = $$PWD
defineReplace(cleanPath) {
win32:1 ~= s|\\\\|/|g
contains(1, ^/.*):pfx = /
......@@ -18,6 +16,19 @@ defineReplace(targetPath) {
return($$1)
}
# For use in custom compilers which just copy files
win32:i_flag = i
defineReplace(stripSrcDir) {
win32 {
!contains(1, ^.:.*):1 = $$OUT_PWD/$$1
} else {
!contains(1, ^/.*):1 = $$OUT_PWD/$$1
}
out = $$cleanPath($$1)
out ~= s|^$$re_escape($$PWD/)||$$i_flag
return($$out)
}
isEmpty(TEST):CONFIG(debug, debug|release) {
!debug_and_release|build_pass {
TEST = 1
......@@ -35,18 +46,23 @@ equals(TEST, 1) {
DEFINES += WITH_TESTS
}
isEmpty(IDE_BUILD_TREE) {
error("qtcreator.pri: including file must define IDE_BUILD_TREE (probably a relative path)")
}
IDE_BUILD_TREE = $$cleanPath($$IDE_BUILD_TREE)
IDE_SOURCE_TREE = $$PWD
sub_dir = $$_PRO_FILE_PWD_
sub_dir ~= s,^$$re_escape($$PWD),,
IDE_BUILD_TREE = $$cleanPath($$OUT_PWD)
IDE_BUILD_TREE ~= s,$$re_escape($$sub_dir)$,,
IDE_APP_PATH = $$IDE_BUILD_TREE/bin
macx {
IDE_APP_TARGET = QtCreator
IDE_LIBRARY_PATH = $$IDE_BUILD_TREE/bin/$${IDE_APP_TARGET}.app/Contents/PlugIns
IDE_LIBRARY_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/PlugIns
IDE_PLUGIN_PATH = $$IDE_LIBRARY_PATH
IDE_DATA_PATH = $$IDE_BUILD_TREE/bin/$${IDE_APP_TARGET}.app/Contents/Resources
IDE_LIBEXEC_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
IDE_DATA_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
contains(QT_CONFIG, ppc):CONFIG += ppc x86
copydata = 1
} else {
win32 {
contains(TEMPLATE, vc.*)|contains(TEMPLATE_PREFIX, vc):vcproj = 1
IDE_APP_TARGET = qtcreator
} else {
IDE_APP_WRAPPER = qtcreator
......@@ -54,9 +70,10 @@ macx {
}
IDE_LIBRARY_PATH = $$IDE_BUILD_TREE/$$IDE_LIBRARY_BASENAME/qtcreator
IDE_PLUGIN_PATH = $$IDE_LIBRARY_PATH/plugins
IDE_LIBEXEC_PATH = $$IDE_APP_PATH # FIXME
IDE_DATA_PATH = $$IDE_BUILD_TREE/share/qtcreator
!isEqual(IDE_SOURCE_TREE, $$IDE_BUILD_TREE):copydata = 1
}
IDE_APP_PATH = $$IDE_BUILD_TREE/bin
INCLUDEPATH += \
$$IDE_SOURCE_TREE/src/libs \
......
#version check qt
TOO_OLD_LIST=$$find(QT_VERSION, ^4\.[0-4])
count(TOO_OLD_LIST, 1) {
message("Cannot build the Qt Creator with a Qt version that old:" $$QT_VERSION)
contains(QT_VERSION, ^4\.[0-4]\..*) {
message("Cannot build Qt Creator with Qt version $$QT_VERSION.")
error("Use at least Qt 4.5.")
}
include(qtcreator.pri)
include(doc/doc.pri)
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = src share
unix:!macx:!equals(_PRO_FILE_PWD_, $$OUT_PWD):SUBDIRS += bin
unix:!macx:!isEmpty(copydata):SUBDIRS += bin
IDE_BUILD_TREE = $$OUT_PWD/../..
include(../../qtcreator.pri)
win32:i_flag = i
defineReplace(stripSrcDir) {
win32 {
!contains(1, ^.:.*):1 = $$OUT_PWD/$$1
} else {
!contains(1, ^/.*):1 = $$OUT_PWD/$$1
}
out = $$cleanPath($$1)
out ~= s|^$$re_escape($$PWD/)||$$i_flag
return($$out)
}
contains(TEMPLATE, vc.*)|contains(TEMPLATE_PREFIX, vc):vcproj = 1
TEMPLATE = app
TARGET = phony_target
......@@ -39,7 +23,7 @@ DATA_DIRS = \
schemes \
gdbmacros
macx|!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
!isEmpty(copydata) {
for(data_dir, DATA_DIRS) {
files = $$files($$PWD/$$data_dir/*.*, true)
......
IDE_BUILD_TREE = $$OUT_PWD/../../..
include(../../../qtcreator.pri)
TRANSLATIONS = de ja
......
IDE_BUILD_TREE = $$OUT_PWD/../..
include(../../qtcreator.pri)
include(../shared/qtsingleapplication/qtsingleapplication.pri)
TEMPLATE = app
TARGET = $$IDE_APP_TARGET
DESTDIR = ../../bin
DESTDIR = $$IDE_APP_PATH
SOURCES += main.cpp
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "consoleprocess.h"
namespace Core {
namespace Utils {
QString ConsoleProcess::modeOption(Mode m)
{
switch (m) {
case Debug:
return QLatin1String("debug");
case Suspend:
return QLatin1String("suspend");
case Run:
break;
}
return QLatin1String("run");
}
QString ConsoleProcess::msgCommChannelFailed(const QString &error)
{
return tr("Cannot set up communication channel: %1").arg(error);
}
QString ConsoleProcess::msgPromptToClose()
{
//! Showed in a terminal which might have
//! a different character set on Windows.
return tr("Press <RETURN> to close this window...");
}
QString ConsoleProcess::msgCannotCreateTempFile(const QString &why)
{
return tr("Cannot create temporary file: %1").arg(why);
}
QString ConsoleProcess::msgCannotCreateTempDir(const QString & dir, const QString &why)
{
return tr("Cannot create temporary directory '%1': %2").arg(dir, why);
}
QString ConsoleProcess::msgUnexpectedOutput()
{
return tr("Unexpected output from helper program.");
}
QString ConsoleProcess::msgCannotChangeToWorkDir(const QString & dir, const QString &why)
{
return tr("Cannot change to working directory '%1': %2").arg(dir, why);
}
QString ConsoleProcess::msgCannotExecute(const QString & p, const QString &why)
{
return tr("Cannot execute '%1': %2").arg(p, why);
}
}
}
......@@ -59,14 +59,15 @@ class QWORKBENCH_UTILS_EXPORT ConsoleProcess : public QObject, public AbstractPr
Q_OBJECT
public:
enum Mode { Run, Debug, Suspend };
ConsoleProcess(QObject *parent = 0);
~ConsoleProcess();
bool start(const QString &program, const QStringList &args);
void stop();
void setDebug(bool on) { m_debug = on; }
bool isDebug() const { return m_debug; }
void setMode(Mode m) { m_mode = m; }
Mode mode() const { return m_mode; }
bool isRunning() const; // This reflects the state of the console+stub
qint64 applicationPID() const { return m_appPid; }
......@@ -99,6 +100,15 @@ private slots:
#endif
private:
static QString modeOption(Mode m);
static QString msgCommChannelFailed(const QString &error);
static QString msgPromptToClose();
static QString msgCannotCreateTempFile(const QString &why);
static QString msgCannotCreateTempDir(const QString & dir, const QString &why);
static QString msgUnexpectedOutput();
static QString msgCannotChangeToWorkDir(const QString & dir, const QString &why);
static QString msgCannotExecute(const QString & p, const QString &why);
QString stubServerListen();
void stubServerShutdown();
#ifdef Q_OS_WIN
......@@ -106,7 +116,7 @@ private:
void cleanupInferior();
#endif
bool m_debug;
Mode m_mode;
qint64 m_appPid;
int m_appCode;
QString m_executable;
......
......@@ -44,14 +44,13 @@
using namespace Core::Utils;
ConsoleProcess::ConsoleProcess(QObject *parent)
: QObject(parent)
ConsoleProcess::ConsoleProcess(QObject *parent) :
QObject(parent),
m_mode(Run),
m_appPid(0),
m_stubSocket(0),
m_settings(0)
{
m_debug = false;
m_appPid = 0;
m_stubSocket = 0;
m_settings = 0;
connect(&m_stubServer, SIGNAL(newConnection()), SLOT(stubConnectionAvailable()));
m_process.setProcessChannelMode(QProcess::ForwardedChannels);
......@@ -69,9 +68,9 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
if (isRunning())
return false;
QString err = stubServerListen();
const QString err = stubServerListen();
if (!err.isEmpty()) {
emit processError(tr("Cannot set up communication channel: %1").arg(err));
emit processError(msgCommChannelFailed(err));
return false;
}
......@@ -79,7 +78,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) {
stubServerShutdown();
emit processError(tr("Cannot create temporary file: %1").arg(m_tempFile->errorString()));
emit processError(msgCannotCreateTempFile(m_tempFile->errorString()));
delete m_tempFile;
m_tempFile = 0;
return false;
......@@ -94,13 +93,13 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
QStringList xtermArgs = terminalEmulator(m_settings).split(QLatin1Char(' ')); // FIXME: quoting
xtermArgs
#ifdef Q_OS_MAC
<< (QCoreApplication::applicationDirPath() + "/../Resources/qtcreator_process_stub")
<< (QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/qtcreator_process_stub"))
#else
<< (QCoreApplication::applicationDirPath() + "/qtcreator_process_stub")
<< (QCoreApplication::applicationDirPath() + QLatin1String("/qtcreator_process_stub"))
#endif
<< (m_debug ? "debug" : "exec")
<< modeOption(m_mode)
<< m_stubServer.fullServerName()
<< tr("Press <RETURN> to close this window...")
<< msgPromptToClose()
<< workingDirectory()
<< (m_tempFile ? m_tempFile->fileName() : 0)
<< program << args;
......@@ -145,7 +144,7 @@ QString ConsoleProcess::stubServerListen()
{
QTemporaryFile tf;
if (!tf.open())
return tr("Cannot create temporary file: %1").arg(tf.errorString());
return msgCannotCreateTempFile(tf.errorString());
stubFifoDir = QFile::encodeName(tf.fileName());
}
// By now the temp file was deleted again
......@@ -153,9 +152,9 @@ QString ConsoleProcess::stubServerListen()
if (!::mkdir(m_stubServerDir.constData(), 0700))
break;
if (errno != EEXIST)
return tr("Cannot create temporary directory '%1': %2").arg(stubFifoDir, strerror(errno));
return msgCannotCreateTempDir(stubFifoDir, QString::fromLocal8Bit(strerror(errno)));
}
QString stubServer = stubFifoDir + "/stub-socket";
const QString stubServer = stubFifoDir + "/stub-socket";
if (!m_stubServer.listen(stubServer)) {
::rmdir(m_stubServerDir.constData());
return tr("Cannot create socket '%1': %2").arg(stubServer, m_stubServer.errorString());
......@@ -190,11 +189,9 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine();
out.chop(1); // \n
if (out.startsWith("err:chdir ")) {
emit processError(tr("Cannot change to working directory '%1': %2")
.arg(workingDirectory(), errorMsg(out.mid(10).toInt())));
emit processError(msgCannotChangeToWorkDir(workingDirectory(), errorMsg(out.mid(10).toInt())));
} else if (out.startsWith("err:exec ")) {
emit processError(tr("Cannot execute '%1': %2")
.arg(m_executable, errorMsg(out.mid(9).toInt())));
emit processError(msgCannotExecute(m_executable, errorMsg(out.mid(9).toInt())));
} else if (out.startsWith("pid ")) {
// Will not need it any more
delete m_tempFile;
......@@ -213,7 +210,7 @@ void ConsoleProcess::readStubOutput()
m_appPid = 0;
emit processStopped();
} else {
emit processError(tr("Unexpected output from helper program."));
emit processError(msgUnexpectedOutput());
m_process.terminate();
break;
}
......@@ -250,7 +247,7 @@ QString ConsoleProcess::defaultTerminalEmulator()
QString ConsoleProcess::terminalEmulator(const QSettings *settings)
{
QString dflt = defaultTerminalEmulator() + QLatin1String(" -e");
const QString dflt = defaultTerminalEmulator() + QLatin1String(" -e");
if (!settings)
return dflt;
return settings->value(QLatin1String("General/TerminalEmulator"), dflt).toString();
......
......@@ -42,18 +42,17 @@
using namespace Core::Utils;
ConsoleProcess::ConsoleProcess(QObject *parent)
: QObject(parent)
ConsoleProcess::ConsoleProcess(QObject *parent) :
QObject(parent),
m_mode(Run),
m_appPid(0),
m_pid(0),
m_hInferior(NULL),
m_tempFile(0),
m_stubSocket(0),
processFinishedNotifier(0),
inferiorFinishedNotifier(0)
{
m_debug = false;
m_appPid = 0;
m_pid = 0;
m_hInferior = NULL;
m_tempFile = 0;
m_stubSocket = 0;
processFinishedNotifier = 0;
inferiorFinishedNotifier = 0;
connect(&m_stubServer, SIGNAL(newConnection()), SLOT(stubConnectionAvailable()));
}
......@@ -67,9 +66,9 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
if (isRunning())
return false;
QString err = stubServerListen();
const QString err = stubServerListen();
if (!err.isEmpty()) {
emit processError(tr("Cannot set up communication channel: %1").arg(err));
emit processError(msgCommChannelFailed(err));
return false;
}
......@@ -77,7 +76,7 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile = new QTemporaryFile();
if (!m_tempFile->open()) {
stubServerShutdown();
emit processError(tr("Cannot create temporary file: %1").arg(m_tempFile->errorString()));
emit processError(msgCannotCreateTempFile(m_tempFile->errorString()));
delete m_tempFile;
m_tempFile = 0;
return false;
......@@ -102,15 +101,15 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
workDir.append('\\');
QStringList stubArgs;
stubArgs << (m_debug ? "debug" : "exec")
stubArgs << modeOption(m_mode)
<< m_stubServer.fullServerName()
<< workDir
<< (m_tempFile ? m_tempFile->fileName() : 0)
<< createWinCommandline(program, args)
<< tr("Press <RETURN> to close this window...");
<< msgPromptToClose();
QString cmdLine = createWinCommandline(
QCoreApplication::applicationDirPath() + "/qtcreator_process_stub.exe", stubArgs);
const QString cmdLine = createWinCommandline(
QCoreApplication::applicationDirPath() + QLatin1String("/qtcreator_process_stub.exe"), stubArgs);
bool success = CreateProcessW(0, (WCHAR*)cmdLine.utf16(),
0, 0, FALSE, CREATE_NEW_CONSOLE,
......@@ -180,13 +179,11 @@ void ConsoleProcess::readStubOutput()
QByteArray out = m_stubSocket->readLine();
out.chop(2); // \r\n
if (out.startsWith("err:chdir ")) {
emit processError(tr("Cannot change to working directory '%1': %2")
.arg(workingDirectory(), winErrorMessage(out.mid(10).toInt())));
emit processError(msgCannotChangeToWorkDir(workingDirectory(), winErrorMessage(out.mid(10).toInt())));
} else if (out.startsWith("err:exec ")) {
emit processError(tr("Cannot execute '%1': %2")
.arg(m_executable, winErrorMessage(out.mid(9).toInt())));
emit processError(msgCannotExecute(m_executable, winErrorMessage(out.mid(9).toInt())));
} else if (out.startsWith("pid ")) {
// Will not need it any more
// Wil not need it any more
delete m_tempFile;
m_tempFile = 0;
......@@ -204,7 +201,7 @@ void ConsoleProcess::readStubOutput()
connect(inferiorFinishedNotifier, SIGNAL(activated(HANDLE)), SLOT(inferiorExited()));
emit processStarted();
} else {
emit processError(tr("Unexpected output from helper program."));
emit processError(msgUnexpectedOutput());
TerminateProcess(m_pid->hProcess, (unsigned)-1);
break;
}
......
IDE_BUILD_TREE = $$OUT_PWD/../../..
include(../../../qtcreator.pri)
TEMPLATE = app
TARGET = qtcreator_process_stub
macx {
DESTDIR = $$IDE_BUILD_TREE/bin/$${IDE_APP_TARGET}.app/Contents/Resources