Merge remote-tracking branch 'origin/2.5'

This commit is contained in:
Eike Ziller
2012-03-02 09:38:28 +01:00
37 changed files with 513 additions and 143 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -49,12 +49,12 @@
If you have not used \QC before, and want to become familiar If you have not used \QC before, and want to become familiar
with the parts of the user interface, go to \l{User Interface}. with the parts of the user interface, go to \l{User Interface}.
\o \bold {\l{Building and Running an Example Application}} \o \bold {\l{Building and Running an Example}}
To check that \l{glossary-development-target}{targets} were To check that \l{glossary-development-target}{targets} were
successfully installed as part of the \QSDK installation, open successfully installed as part of the \QSDK installation, open
an example application and run it. If you have not done so an example application and run it. If you have not done so
before, go to \l{Building and Running an Example Application}. before, go to \l{Building and Running an Example}.
\o \bold {\l{Tutorials}} \o \bold {\l{Tutorials}}
Now you are ready to start developing your own applications. Now you are ready to start developing your own applications.

View File

@@ -39,7 +39,9 @@
\nextpage creator-project-generic.html \nextpage creator-project-generic.html
\title Setting Up an Autotools Project \title Setting Up an Autotools Project
The AutotoolsProjectManager is a plugin for autotools support. The AutotoolsProjectManager is a plugin for autotools support. It is disabled by default.
To enable the plugin, select \gui{Help > About Plugins > Build Systems > AutotoolsProjectManager}.
To use the plugin, restart \QC.
\image qtcreator-autotools-buildrun.png \image qtcreator-autotools-buildrun.png

View File

@@ -31,43 +31,48 @@
\page creator-build-example-application.html \page creator-build-example-application.html
\nextpage creator-tutorials.html \nextpage creator-tutorials.html
\title Building and Running an Example Application \title Building and Running an Example
You can test that your installation is successful by opening an existing You can test that your installation is successful by opening an existing
example application project. example application project.
\list 1 \list 1
\o On the \gui Welcome page, select \gui {Demos and Examples}, \o On the \gui Welcome page, select \gui Examples (1).
and then search for \gui {Toys: Clocks Example} in the
list of examples.
\image qtcreator-gs-build-example-open.png "Selecting an example" \image qtcreator-gs-build-example-open.png "Selecting an example"
\o Select \l{glossary-development-target}{targets} for the project. \o Search for \gui {Toys: Clocks Example} (2) in the list of examples
Select at least \QS and select it (3).
and one of the mobile targets, Symbian Device, Maemo 5, or
MeeGo Harmattan, depending on the device you develop for.
\image qtcreator-gs-build-example-targets.png "Selecting targets"
\note If you have only one target installed, this dialog is
skipped. You can add installed targets later in the \gui Projects
mode.
\note The project opens in the \gui Edit mode, and the documentation \note The project opens in the \gui Edit mode, and the documentation
for the example hides these instructions. To return to these for the example hides these instructions. To return to these
instructions, select \gui {Previous Page} on the toolbar or instructions, select \gui {Previous Page} on the toolbar or
press \key {Alt+Left}. press \key {Alt+Left}.
\o Select \gui Projects to configure the project:
\image qtcreator-gs-build-example-targets.png "Selecting targets"
\list 1
\o Select at least \QS and one of the mobile
\l{glossary-development-target}{targets} (1), Symbian
Device, Maemo 5, or MeeGo Harmattan, depending on the device
you develop for.
\o Select \gui {Configure Project} (2).
\endlist
\o To test the application in \QS, click the \gui {Target \o To test the application in \QS, click the \gui {Target
Selector} and select \gui {\QS}. Selector} and select \gui {\QS}.
\image {qtcreator-gs-build-example-select-qs.png} "Selecting Qt Simulator as target" \image qtcreator-gs-build-example-select-qs.png "Selecting Qt Simulator as target"
\o Click \o Click
\inlineimage{qtcreator-run.png} \inlineimage qtcreator-run.png
to build the application and run it in \QS. (\gui Run) to build the application and run it in \QS.
\o To see the compilation progress, press \key{Alt+4} to open the \o To see the compilation progress, press \key{Alt+4} to open the
\gui {Compile Output} pane. \gui {Compile Output} pane.
@@ -76,7 +81,7 @@
project is successfully built. The application opens in project is successfully built. The application opens in
\QS. \QS.
\image {qt-simulator.png} "Qt Simulator" \image qt-simulator.png "Qt Simulator"
\o Change the settings in the \gui Model view. For example, rotate the \o Change the settings in the \gui Model view. For example, rotate the
device by clicking the \gui {Orientation} buttons or choose from the device by clicking the \gui {Orientation} buttons or choose from the

View File

@@ -48,7 +48,7 @@
\list \list
\o \l{IDE Overview} \o \l{IDE Overview}
\o \l{User Interface} \o \l{User Interface}
\o \l{Building and Running an Example Application} \o \l{Building and Running an Example}
\o \l{Tutorials} \o \l{Tutorials}
\endlist \endlist
\o \bold {\l{Managing Projects}} \o \bold {\l{Managing Projects}}
@@ -132,7 +132,7 @@
\list \list
\o \l{IDE Overview} \o \l{IDE Overview}
\o \l{User Interface} \o \l{User Interface}
\o \l{Building and Running an Example Application} \o \l{Building and Running an Example}
\o \l{Tutorials} \o \l{Tutorials}
\list \list
\o \l{Creating a Qt Quick Application} \o \l{Creating a Qt Quick Application}

View File

@@ -46,7 +46,7 @@ Bookmark::Bookmark(const QString& fileName, int lineNumber, BookmarkManager *man
m_onlyFile(m_fileInfo.fileName()), m_onlyFile(m_fileInfo.fileName()),
m_path(m_fileInfo.path()) m_path(m_fileInfo.path())
{ {
setPriority(TextEditor::ITextMark::LowPriority); setPriority(TextEditor::ITextMark::NormalPriority);
setIcon(m_manager->bookmarkIcon()); setIcon(m_manager->bookmarkIcon());
} }

View File

@@ -821,7 +821,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeTarget *target)
setLayout(fl); setLayout(fl);
// TODO add action to Build menu? // TODO add action to Build menu?
QPushButton *runCmakeButton = new QPushButton("Run cmake"); QPushButton *runCmakeButton = new QPushButton(tr("Run cmake"));
connect(runCmakeButton, SIGNAL(clicked()), connect(runCmakeButton, SIGNAL(clicked()),
this, SLOT(runCMake())); this, SLOT(runCMake()));
fl->addRow(tr("Reconfigure project:"), runCmakeButton); fl->addRow(tr("Reconfigure project:"), runCmakeButton);
@@ -837,7 +837,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeTarget *target)
connect(m_changeButton, SIGNAL(clicked()), this, SLOT(openChangeBuildDirectoryDialog())); connect(m_changeButton, SIGNAL(clicked()), this, SLOT(openChangeBuildDirectoryDialog()));
hbox->addWidget(m_changeButton); hbox->addWidget(m_changeButton);
fl->addRow("Build directory:", hbox); fl->addRow(tr("Build directory:"), hbox);
} }
QString CMakeBuildSettingsWidget::displayName() const QString CMakeBuildSettingsWidget::displayName() const

View File

@@ -74,9 +74,15 @@ Qt::DropActions ExternalToolModel::supportedDropActions() const
return Qt::MoveAction; return Qt::MoveAction;
} }
QString ExternalToolModel::uncategorizedDisplayName() const
{
static QString uncategorized = tr("Uncategorized");
return uncategorized;
}
int ExternalToolModel::columnCount(const QModelIndex &parent) const int ExternalToolModel::columnCount(const QModelIndex &parent) const
{ {
if (!parent.isValid() || toolForIndex(parent) || !categoryForIndex(parent).isNull()) if (!parent.isValid() || toolForIndex(parent) || !categoryForIndex(parent).isEmpty())
return 1; return 1;
return 0; return 0;
} }
@@ -86,9 +92,8 @@ QVariant ExternalToolModel::data(const QModelIndex &index, int role) const
if (ExternalTool *tool = toolForIndex(index)) if (ExternalTool *tool = toolForIndex(index))
return data(tool, role); return data(tool, role);
QString category = categoryForIndex(index); QString category = categoryForIndex(index);
if (!category.isNull()) QTC_ASSERT(!category.isEmpty(), return QVariant());
return data(category, role); return data(category, role);
return QVariant();
} }
QVariant ExternalToolModel::data(ExternalTool *tool, int role) const QVariant ExternalToolModel::data(ExternalTool *tool, int role) const
@@ -108,9 +113,10 @@ QVariant ExternalToolModel::data(const QString &category, int role) const
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
case Qt::EditRole: case Qt::EditRole:
return category.isEmpty() ? tr("Uncategorized") : category; return category;
case Qt::ToolTipRole: case Qt::ToolTipRole:
return category.isEmpty() ? tr("Tools that will appear directly under the External Tools menu.") : QVariant(); return category == uncategorizedDisplayName()
? tr("Tools that will appear directly under the External Tools menu.") : QVariant();
default: default:
break; break;
} }
@@ -125,7 +131,7 @@ QMimeData *ExternalToolModel::mimeData(const QModelIndexList &indexes) const
ExternalTool *tool = toolForIndex(modelIndex); ExternalTool *tool = toolForIndex(modelIndex);
QTC_ASSERT(tool, return 0); QTC_ASSERT(tool, return 0);
QString category = categoryForIndex(modelIndex.parent()); QString category = categoryForIndex(modelIndex.parent());
QTC_ASSERT(!category.isNull(), return 0); QTC_ASSERT(!category.isEmpty(), return 0);
QMimeData *md = new QMimeData(); QMimeData *md = new QMimeData();
QByteArray ba; QByteArray ba;
QDataStream stream(&ba, QIODevice::WriteOnly); QDataStream stream(&ba, QIODevice::WriteOnly);
@@ -144,7 +150,7 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data,
if (action != Qt::MoveAction || !data) if (action != Qt::MoveAction || !data)
return false; return false;
QString toCategory = categoryForIndex(parent); QString toCategory = categoryForIndex(parent);
QTC_ASSERT(!toCategory.isNull(), return false); QTC_ASSERT(!toCategory.isEmpty(), return false);
QByteArray ba = data->data(QLatin1String("application/qtcreator-externaltool-config")); QByteArray ba = data->data(QLatin1String("application/qtcreator-externaltool-config"));
if (ba.isEmpty()) if (ba.isEmpty())
return false; return false;
@@ -153,15 +159,15 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data,
int pos = -1; int pos = -1;
stream >> category; stream >> category;
stream >> pos; stream >> pos;
QTC_ASSERT(!category.isNull(), return false); QTC_ASSERT(!category.isEmpty(), return false);
QList<ExternalTool *> &items = m_tools[category]; QList<ExternalTool *> &items = m_tools[category];
QTC_ASSERT(pos >= 0 && pos < items.count(), return false); QTC_ASSERT(pos >= 0 && pos < items.count(), return false);
beginRemoveRows(index(m_tools.keys().indexOf(category), 0), pos, pos); beginRemoveRows(index(rowForCategory(category), 0), pos, pos);
ExternalTool *tool = items.takeAt(pos); ExternalTool *tool = items.takeAt(pos);
endRemoveRows(); endRemoveRows();
if (row < 0) if (row < 0)
row = m_tools.value(toCategory).count(); row = m_tools.value(toCategory).count();
beginInsertRows(index(m_tools.keys().indexOf(toCategory), 0), row, row); beginInsertRows(index(rowForCategory(toCategory), 0), row, row);
m_tools[toCategory].insert(row, tool); m_tools[toCategory].insert(row, tool);
endInsertRows(); endInsertRows();
return true; return true;
@@ -176,7 +182,7 @@ QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &par
{ {
if (column == 0 && parent.isValid()) { if (column == 0 && parent.isValid()) {
QString category = categoryForIndex(parent); QString category = categoryForIndex(parent);
if (!category.isNull()) { if (!category.isEmpty()) {
QList<ExternalTool *> items = m_tools.value(category); QList<ExternalTool *> items = m_tools.value(category);
if (row < items.count()) { if (row < items.count()) {
return createIndex(row, 0, items.at(row)); return createIndex(row, 0, items.at(row));
@@ -191,13 +197,11 @@ QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &par
QModelIndex ExternalToolModel::parent(const QModelIndex &child) const QModelIndex ExternalToolModel::parent(const QModelIndex &child) const
{ {
if (ExternalTool *tool = toolForIndex(child)) { if (ExternalTool *tool = toolForIndex(child)) {
int categoryIndex = 0;
QMapIterator<QString, QList<ExternalTool *> > it(m_tools); QMapIterator<QString, QList<ExternalTool *> > it(m_tools);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
if (it.value().contains(tool)) if (it.value().contains(tool))
return index(categoryIndex, 0); return index(rowForCategory(it.key()), 0);
++categoryIndex;
} }
} }
return QModelIndex(); return QModelIndex();
@@ -211,7 +215,7 @@ int ExternalToolModel::rowCount(const QModelIndex &parent) const
return 0; return 0;
} }
QString category = categoryForIndex(parent); QString category = categoryForIndex(parent);
if (!category.isNull()) { if (!category.isEmpty()) {
return m_tools.value(category).count(); return m_tools.value(category).count();
} }
@@ -223,8 +227,8 @@ Qt::ItemFlags ExternalToolModel::flags(const QModelIndex &index) const
if (toolForIndex(index)) if (toolForIndex(index))
return TOOL_ITEM_FLAGS; return TOOL_ITEM_FLAGS;
QString category = categoryForIndex(index); QString category = categoryForIndex(index);
if (!category.isNull()) { if (!category.isEmpty()) {
if (category.isEmpty()) if (category == uncategorizedDisplayName())
return TOOLSMENU_ITEM_FLAGS; return TOOLSMENU_ITEM_FLAGS;
return CATEGORY_ITEM_FLAGS; return CATEGORY_ITEM_FLAGS;
} }
@@ -245,15 +249,17 @@ bool ExternalToolModel::setData(const QModelIndex &modelIndex, const QVariant &v
return true; return true;
} else { } else {
QString category = categoryForIndex(modelIndex); QString category = categoryForIndex(modelIndex);
if (!category.isNull()) { if (!category.isEmpty()) {
if (string.isEmpty() || m_tools.contains(string)) if (string.isEmpty() || m_tools.contains(string))
return false; return false;
// rename category // rename category
QList<QString> categories = m_tools.keys(); QList<QString> categories = m_tools.keys();
int previousIndex = categories.indexOf(category); int previousIndex = rowForCategory(category);
categories.removeAll(uncategorizedDisplayName()); // prepended again after sorting new list
categories.removeAt(previousIndex); categories.removeAt(previousIndex);
categories.append(string); categories.append(string);
qSort(categories); qSort(categories);
categories.prepend(uncategorizedDisplayName()); // prepend, so order is like in view
int newIndex = categories.indexOf(string); int newIndex = categories.indexOf(string);
if (newIndex != previousIndex) { if (newIndex != previousIndex) {
// we have same parent so we have to do special stuff for beginMoveRows... // we have same parent so we have to do special stuff for beginMoveRows...
@@ -291,12 +297,30 @@ QString ExternalToolModel::categoryForIndex(const QModelIndex &index) const
{ {
if (index.isValid() && !index.parent().isValid() && index.column() == 0 && index.row() >= 0) { if (index.isValid() && !index.parent().isValid() && index.column() == 0 && index.row() >= 0) {
const QList<QString> &keys = m_tools.keys(); const QList<QString> &keys = m_tools.keys();
if (index.row() < keys.count()) if (index.row() == 0)
return uncategorizedDisplayName();
if (index.row() < keys.count()) {
int uncategorizedIndex = keys.indexOf(uncategorizedDisplayName());
if (index.row() <= uncategorizedIndex)
return keys.at(index.row() - 1);
return keys.at(index.row()); return keys.at(index.row());
}
} }
return QString(); return QString();
} }
int ExternalToolModel::rowForCategory(const QString &category) const
{
if (category == uncategorizedDisplayName())
return 0;
const QList<QString> &keys = m_tools.keys();
int uncategorizedIndex = keys.indexOf(uncategorizedDisplayName());
int index = keys.indexOf(category);
if (index < uncategorizedIndex)
return index + 1;
return index;
}
void ExternalToolModel::revertTool(const QModelIndex &modelIndex) void ExternalToolModel::revertTool(const QModelIndex &modelIndex)
{ {
ExternalTool *tool = toolForIndex(modelIndex); ExternalTool *tool = toolForIndex(modelIndex);
@@ -319,8 +343,10 @@ QModelIndex ExternalToolModel::addCategory()
category = categoryBase + QString::number(count); category = categoryBase + QString::number(count);
} }
QList<QString> categories = m_tools.keys(); QList<QString> categories = m_tools.keys();
categories.removeAll(uncategorizedDisplayName()); // prepended again after sorting new list
categories.append(category); categories.append(category);
qSort(categories); qSort(categories);
categories.prepend(uncategorizedDisplayName()); // prepend, so order is like in view
int pos = categories.indexOf(category); int pos = categories.indexOf(category);
beginInsertRows(QModelIndex(), pos, pos); beginInsertRows(QModelIndex(), pos, pos);
@@ -332,7 +358,7 @@ QModelIndex ExternalToolModel::addCategory()
QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex) QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
{ {
QString category = categoryForIndex(atIndex); QString category = categoryForIndex(atIndex);
if (category.isNull()) if (category.isEmpty())
category = categoryForIndex(atIndex.parent()); category = categoryForIndex(atIndex.parent());
ExternalTool *tool = new ExternalTool; ExternalTool *tool = new ExternalTool;
@@ -465,8 +491,8 @@ void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &t
itemCopy.append(new ExternalTool(tool)); itemCopy.append(new ExternalTool(tool));
toolsCopy.insert(it.key(), itemCopy); toolsCopy.insert(it.key(), itemCopy);
} }
if (!toolsCopy.contains(QString())) if (!toolsCopy.contains(m_model->uncategorizedDisplayName()))
toolsCopy.insert(QString(), QList<ExternalTool *>()); toolsCopy.insert(m_model->uncategorizedDisplayName(), QList<ExternalTool *>());
m_model->setTools(toolsCopy); m_model->setTools(toolsCopy);
ui->toolTree->expandAll(); ui->toolTree->expandAll();
} }

View File

@@ -74,11 +74,13 @@ public:
ExternalTool *toolForIndex(const QModelIndex &modelIndex) const; ExternalTool *toolForIndex(const QModelIndex &modelIndex) const;
QString categoryForIndex(const QModelIndex &modelIndex) const; QString categoryForIndex(const QModelIndex &modelIndex) const;
int rowForCategory(const QString &category) const;
void revertTool(const QModelIndex &modelIndex); void revertTool(const QModelIndex &modelIndex);
QModelIndex addCategory(); QModelIndex addCategory();
QModelIndex addTool(const QModelIndex &atIndex); QModelIndex addTool(const QModelIndex &atIndex);
void removeTool(const QModelIndex &modelIndex); void removeTool(const QModelIndex &modelIndex);
Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDropActions() const;
QString uncategorizedDisplayName() const;
private: private:
QVariant data(ExternalTool *tool, int role = Qt::DisplayRole) const; QVariant data(ExternalTool *tool, int role = Qt::DisplayRole) const;
QVariant data(const QString &category, int role = Qt::DisplayRole) const; QVariant data(const QString &category, int role = Qt::DisplayRole) const;

View File

@@ -2280,7 +2280,7 @@ void GdbEngine::handleExecuteReturn(const GdbResponse &response)
void GdbEngine::setTokenBarrier() void GdbEngine::setTokenBarrier()
{ {
QTC_ASSERT(m_nonDiscardableCount == 0, /**/); //QTC_ASSERT(m_nonDiscardableCount == 0, /**/);
bool good = true; bool good = true;
QHashIterator<int, GdbCommand> it(m_cookieForToken); QHashIterator<int, GdbCommand> it(m_cookieForToken);
while (it.hasNext()) { while (it.hasNext()) {

View File

@@ -69,7 +69,8 @@ public:
virtual void activateFrame(int index) = 0; virtual void activateFrame(int index) = 0;
virtual bool acceptsBreakpoint(const BreakpointModelId &id); virtual bool acceptsBreakpoint(const BreakpointModelId &id);
virtual void insertBreakpoint(const BreakpointModelId &id) = 0; virtual void insertBreakpoint(const BreakpointModelId &id, int adjustedLine,
int adjustedColumn = -1) = 0;
virtual void removeBreakpoint(const BreakpointModelId &id) = 0; virtual void removeBreakpoint(const BreakpointModelId &id) = 0;
virtual void changeBreakpoint(const BreakpointModelId &id) = 0; virtual void changeBreakpoint(const BreakpointModelId &id) = 0;
virtual void synchronizeBreakpoints() = 0; virtual void synchronizeBreakpoints() = 0;

View File

@@ -58,6 +58,8 @@
#include <projectexplorer/applicationlauncher.h> #include <projectexplorer/applicationlauncher.h>
#include <qmljsdebugclient/qdeclarativeoutputparser.h> #include <qmljsdebugclient/qdeclarativeoutputparser.h>
#include <qmljseditor/qmljseditorconstants.h> #include <qmljseditor/qmljseditorconstants.h>
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -95,6 +97,8 @@
# define XSDEBUG(s) qDebug() << s # define XSDEBUG(s) qDebug() << s
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QmlJS;
using namespace AST;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -114,6 +118,7 @@ private:
QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors; QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors;
InteractiveInterpreter m_interpreter; InteractiveInterpreter m_interpreter;
bool m_validContext; bool m_validContext;
QHash<QString,BreakpointModelId> pendingBreakpoints;
}; };
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q) QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q)
@@ -121,6 +126,163 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q)
m_validContext(false) m_validContext(false)
{} {}
class ASTWalker: public Visitor
{
public:
void operator()(Node *ast, quint32 *l, quint32 *c)
{
done = false;
line = l;
column = c;
Node::accept(ast, this);
}
bool preVisit(Node *ast)
{
return ast->lastSourceLocation().startLine >= *line && !done;
}
//Case 1: Breakpoint is between sourceStart(exclusive) and
// sourceEnd(inclusive) --> End tree walk.
//Case 2: Breakpoint is on sourceStart --> Check for the start
// of the first executable code. Set the line number and
// column number. End tree walk.
//Case 3: Breakpoint is on "unbreakable" code --> Find the next "breakable"
// code and check for Case 2. End tree walk.
//Add more types when suitable.
bool visit(UiScriptBinding *ast)
{
quint32 sourceStartLine = ast->firstSourceLocation().startLine;
quint32 statementStartLine;
quint32 statementColumn;
if (ast->statement->kind == Node::Kind_ExpressionStatement) {
statementStartLine = ast->statement->firstSourceLocation().
startLine;
statementColumn = ast->statement->firstSourceLocation().startColumn;
} else if (ast->statement->kind == Node::Kind_Block) {
Block *block = static_cast<Block *>(ast->statement);
statementStartLine = block->statements->firstSourceLocation().
startLine;
statementColumn = block->statements->firstSourceLocation().
startColumn;
} else {
return true;
}
//Case 1
//Check for possible relocation within the binding statement
//Rewritten to (function <token>() { { }})
//The offset 16 is position of inner lbrace without token length.
const int offset = 16;
//Case 2
if (statementStartLine == *line) {
if (sourceStartLine == *line)
*column = offset + ast->qualifiedId->identifierToken.length;
done = true;
}
//Case 3
if (statementStartLine > *line) {
*line = statementStartLine;
if (sourceStartLine == *line)
*column = offset + ast->qualifiedId->identifierToken.length;
else
*column = statementColumn;
done = true;
}
return true;
}
bool visit(FunctionDeclaration *ast) {
quint32 sourceStartLine = ast->firstSourceLocation().startLine;
quint32 sourceStartColumn = ast->firstSourceLocation().startColumn;
quint32 statementStartLine = ast->body->firstSourceLocation().startLine;
quint32 statementColumn = ast->body->firstSourceLocation().startColumn;
//Case 1
//Check for possible relocation within the function declaration
//Case 2
if (statementStartLine == *line) {
if (sourceStartLine == *line)
*column = statementColumn - sourceStartColumn + 1;
done = true;
}
//Case 3
if (statementStartLine > *line) {
*line = statementStartLine;
if (sourceStartLine == *line)
*column = statementColumn - sourceStartColumn + 1;
else
*column = statementColumn;
done = true;
}
return true;
}
bool visit(EmptyStatement *ast)
{
*line = ast->lastSourceLocation().startLine + 1;
return true;
}
bool visit(VariableStatement *ast) { test(ast); return true; }
bool visit(VariableDeclarationList *ast) { test(ast); return true; }
bool visit(VariableDeclaration *ast) { test(ast); return true; }
bool visit(ExpressionStatement *ast) { test(ast); return true; }
bool visit(IfStatement *ast) { test(ast); return true; }
bool visit(DoWhileStatement *ast) { test(ast); return true; }
bool visit(WhileStatement *ast) { test(ast); return true; }
bool visit(ForStatement *ast) { test(ast); return true; }
bool visit(LocalForStatement *ast) { test(ast); return true; }
bool visit(ForEachStatement *ast) { test(ast); return true; }
bool visit(LocalForEachStatement *ast) { test(ast); return true; }
bool visit(ContinueStatement *ast) { test(ast); return true; }
bool visit(BreakStatement *ast) { test(ast); return true; }
bool visit(ReturnStatement *ast) { test(ast); return true; }
bool visit(WithStatement *ast) { test(ast); return true; }
bool visit(SwitchStatement *ast) { test(ast); return true; }
bool visit(CaseBlock *ast) { test(ast); return true; }
bool visit(CaseClauses *ast) { test(ast); return true; }
bool visit(CaseClause *ast) { test(ast); return true; }
bool visit(DefaultClause *ast) { test(ast); return true; }
bool visit(LabelledStatement *ast) { test(ast); return true; }
bool visit(ThrowStatement *ast) { test(ast); return true; }
bool visit(TryStatement *ast) { test(ast); return true; }
bool visit(Catch *ast) { test(ast); return true; }
bool visit(Finally *ast) { test(ast); return true; }
bool visit(FunctionExpression *ast) { test(ast); return true; }
bool visit(DebuggerStatement *ast) { test(ast); return true; }
void test(Node *ast)
{
quint32 statementStartLine = ast->firstSourceLocation().startLine;
//Case 1/2
if (statementStartLine <= *line &&
*line <= ast->lastSourceLocation().startLine)
done = true;
//Case 3
if (statementStartLine > *line) {
*line = statementStartLine;
*column = ast->firstSourceLocation().startColumn;
done = true;
}
}
bool done;
quint32 *line;
quint32 *column;
};
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
@@ -188,6 +350,11 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
connect(&d->m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(beginConnection())); connect(&d->m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(beginConnection()));
qtMessageLogHandler()->setHasEditableRow(true); qtMessageLogHandler()->setHasEditableRow(true);
connect(ModelManagerInterface::instance(),
SIGNAL(documentUpdated(QmlJS::Document::Ptr)),
this,
SLOT(documentUpdated(QmlJS::Document::Ptr)));
} }
QmlEngine::~QmlEngine() QmlEngine::~QmlEngine()
@@ -560,8 +727,14 @@ void QmlEngine::executeRunToLine(const ContextData &data)
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
showStatusMessage(tr("Run to line %1 (%2) requested...").arg(data.lineNumber).arg(data.fileName), 5000); showStatusMessage(tr("Run to line %1 (%2) requested...").arg(data.lineNumber).arg(data.fileName), 5000);
resetLocation(); resetLocation();
ContextData modifiedData = data;
quint32 line = data.lineNumber;
quint32 column;
bool valid;
if (adjustBreakpointLineAndColumn(data.fileName, &line, &column, &valid))
modifiedData.lineNumber = line;
if (d->m_adapter.activeDebuggerClient()) if (d->m_adapter.activeDebuggerClient())
d->m_adapter.activeDebuggerClient()->executeRunToLine(data); d->m_adapter.activeDebuggerClient()->executeRunToLine(modifiedData);
notifyInferiorRunRequested(); notifyInferiorRunRequested();
notifyInferiorRunOk(); notifyInferiorRunOk();
} }
@@ -601,11 +774,25 @@ void QmlEngine::insertBreakpoint(BreakpointModelId id)
QTC_ASSERT(state == BreakpointInsertRequested, qDebug() << id << this << state); QTC_ASSERT(state == BreakpointInsertRequested, qDebug() << id << this << state);
handler->notifyBreakpointInsertProceeding(id); handler->notifyBreakpointInsertProceeding(id);
const BreakpointParameters &params = handler->breakpointData(id);
quint32 line = params.lineNumber;
quint32 column = 0;
if (params.type == BreakpointByFileAndLine) {
bool valid = false;
if (!adjustBreakpointLineAndColumn(params.fileName, &line, &column,
&valid)) {
d->pendingBreakpoints.insertMulti(params.fileName, id);
return;
}
if (!valid)
return;
}
if (d->m_adapter.activeDebuggerClient()) { if (d->m_adapter.activeDebuggerClient()) {
d->m_adapter.activeDebuggerClient()->insertBreakpoint(id); d->m_adapter.activeDebuggerClient()->insertBreakpoint(id, line, column);
} else { } else {
foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) { foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
client->insertBreakpoint(id); client->insertBreakpoint(id, line, column);
} }
} }
} }
@@ -613,6 +800,21 @@ void QmlEngine::insertBreakpoint(BreakpointModelId id)
void QmlEngine::removeBreakpoint(BreakpointModelId id) void QmlEngine::removeBreakpoint(BreakpointModelId id)
{ {
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
const BreakpointParameters &params = handler->breakpointData(id);
if (params.type == BreakpointByFileAndLine &&
d->pendingBreakpoints.contains(params.fileName)) {
QHash<QString, BreakpointModelId>::iterator i =
d->pendingBreakpoints.find(params.fileName);
while (i != d->pendingBreakpoints.end() && i.key() == params.fileName) {
if (i.value() == id) {
d->pendingBreakpoints.erase(i);
return;
}
++i;
}
}
BreakpointState state = handler->state(id); BreakpointState state = handler->state(id);
QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << id << this << state); QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << id << this << state);
handler->notifyBreakpointRemoveProceeding(id); handler->notifyBreakpointRemoveProceeding(id);
@@ -852,6 +1054,17 @@ void QmlEngine::disconnected()
notifyInferiorExited(); notifyInferiorExited();
} }
void QmlEngine::documentUpdated(QmlJS::Document::Ptr doc)
{
QString fileName = doc->fileName();
if (d->pendingBreakpoints.contains(fileName)) {
QList<BreakpointModelId> ids = d->pendingBreakpoints.values(fileName);
d->pendingBreakpoints.remove(fileName);
foreach (const BreakpointModelId &id, ids)
insertBreakpoint(id);
}
}
void QmlEngine::updateCurrentContext() void QmlEngine::updateCurrentContext()
{ {
const QString context = state() == InferiorStopOk ? const QString context = state() == InferiorStopOk ?
@@ -1085,6 +1298,27 @@ QtMessageLogItem *QmlEngine::constructLogItemTree(
return item; return item;
} }
bool QmlEngine::adjustBreakpointLineAndColumn(
const QString &filePath, quint32 *line, quint32 *column, bool *valid)
{
bool success = true;
//check if file is in the latest snapshot
//ignoring documentChangedOnDisk
//TODO:: update breakpoints if document is changed.
Document::Ptr doc = ModelManagerInterface::instance()->newestSnapshot().
document(filePath);
if (doc.isNull()) {
ModelManagerInterface::instance()->updateSourceFiles(
QStringList() << filePath, false);
success = false;
} else {
ASTWalker walker;
walker(doc->ast(), line, column);
*valid = walker.done;
}
return success;
}
QmlAdapter *QmlEngine::adapter() const QmlAdapter *QmlEngine::adapter() const
{ {
return &d->m_adapter; return &d->m_adapter;

View File

@@ -37,6 +37,7 @@
#include <qmljsdebugclient/qdeclarativeenginedebug.h> #include <qmljsdebugclient/qdeclarativeenginedebug.h>
#include <qmljsdebugclient/qdebugmessageclient.h> #include <qmljsdebugclient/qdebugmessageclient.h>
#include <utils/outputformat.h> #include <utils/outputformat.h>
#include <qmljs/qmljsdocument.h>
#include <QAbstractSocket> #include <QAbstractSocket>
@@ -92,6 +93,7 @@ public:
public slots: public slots:
void disconnected(); void disconnected();
void documentUpdated(QmlJS::Document::Ptr doc);
private slots: private slots:
void errorMessageBoxFinished(int result); void errorMessageBoxFinished(int result);
@@ -184,6 +186,8 @@ private:
bool canEvaluateScript(const QString &script); bool canEvaluateScript(const QString &script);
QtMessageLogItem *constructLogItemTree(const QVariant &result, QtMessageLogItem *constructLogItemTree(const QVariant &result,
const QString &key = QString()); const QString &key = QString());
bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line,
quint32 *column, bool *valid);
private: private:
friend class QmlCppEngine; friend class QmlCppEngine;

View File

@@ -105,8 +105,8 @@ public:
bool includeSource = false, const QVariant filter = QVariant()); bool includeSource = false, const QVariant filter = QVariant());
void source(int frame = -1, int fromLine = -1, int toLine = -1); void source(int frame = -1, int fromLine = -1, int toLine = -1);
void setBreakpoint(const QString type, const QString target, int line = -1, void setBreakpoint(const QString type, const QString target,
int column = -1, bool enabled = true, bool enabled = true,int line = 0, int column = 0,
const QString condition = QString(), int ignoreCount = -1); const QString condition = QString(), int ignoreCount = -1);
void changeBreakpoint(int breakpoint, bool enabled = true, void changeBreakpoint(int breakpoint, bool enabled = true,
const QString condition = QString(), int ignoreCount = -1); const QString condition = QString(), int ignoreCount = -1);
@@ -513,7 +513,7 @@ void QmlV8DebuggerClientPrivate::source(int frame, int fromLine, int toLine)
} }
void QmlV8DebuggerClientPrivate::setBreakpoint(const QString type, const QString target, void QmlV8DebuggerClientPrivate::setBreakpoint(const QString type, const QString target,
int line, int column, bool enabled, bool enabled, int line, int column,
const QString condition, int ignoreCount) const QString condition, int ignoreCount)
{ {
// { "seq" : <number>, // { "seq" : <number>,
@@ -542,13 +542,17 @@ void QmlV8DebuggerClientPrivate::setBreakpoint(const QString type, const QString
QScriptValue args = parser.call(QScriptValue(), QScriptValueList() << QScriptValue(_(OBJECT))); QScriptValue args = parser.call(QScriptValue(), QScriptValueList() << QScriptValue(_(OBJECT)));
args.setProperty(_(TYPE), QScriptValue(type)); args.setProperty(_(TYPE), QScriptValue(type));
args.setProperty(_(TARGET), QScriptValue(target)); if (type == _(SCRIPTREGEXP))
args.setProperty(_(TARGET),
QScriptValue(QFileInfo(target).fileName()));
else
args.setProperty(_(TARGET), QScriptValue(target));
if (line != -1) if (line)
args.setProperty(_(LINE), QScriptValue(line)); args.setProperty(_(LINE), QScriptValue(line - 1));
if (column != -1) if (column)
args.setProperty(_(COLUMN), QScriptValue(column)); args.setProperty(_(COLUMN), QScriptValue(column - 1));
args.setProperty(_(ENABLED), QScriptValue(enabled)); args.setProperty(_(ENABLED), QScriptValue(enabled));
@@ -959,7 +963,7 @@ void QmlV8DebuggerClientPrivate::reformatRequest(QByteArray &request)
bool enabled; bool enabled;
rs >> signalHandler >> enabled; rs >> signalHandler >> enabled;
setBreakpoint(_(EVENT), QString::fromUtf8(signalHandler), -1, -1, enabled); setBreakpoint(_(EVENT), QString::fromUtf8(signalHandler), enabled);
} }
} }
} }
@@ -1050,8 +1054,8 @@ void QmlV8DebuggerClient::executeStepI()
void QmlV8DebuggerClient::executeRunToLine(const ContextData &data) void QmlV8DebuggerClient::executeRunToLine(const ContextData &data)
{ {
d->setBreakpoint(QString(_(SCRIPTREGEXP)), QFileInfo(data.fileName).fileName(), d->setBreakpoint(QString(_(SCRIPTREGEXP)), data.fileName,
data.lineNumber - 1); true, data.lineNumber);
clearExceptionSelection(); clearExceptionSelection();
d->continueDebugging(Continue); d->continueDebugging(Continue);
} }
@@ -1082,7 +1086,9 @@ bool QmlV8DebuggerClient::acceptsBreakpoint(const BreakpointModelId &id)
|| type == BreakpointAtJavaScriptThrow); || type == BreakpointAtJavaScriptThrow);
} }
void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id) void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id,
int adjustedLine,
int adjustedColumn)
{ {
BreakHandler *handler = d->engine->breakHandler(); BreakHandler *handler = d->engine->breakHandler();
const BreakpointParameters &params = handler->breakpointData(id); const BreakpointParameters &params = handler->breakpointData(id);
@@ -1092,14 +1098,12 @@ void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id)
d->setExceptionBreak(AllExceptions, params.enabled); d->setExceptionBreak(AllExceptions, params.enabled);
} else if (params.type == BreakpointByFileAndLine) { } else if (params.type == BreakpointByFileAndLine) {
d->setBreakpoint(QString(_(SCRIPTREGEXP)), d->setBreakpoint(QString(_(SCRIPTREGEXP)), params.fileName,
QFileInfo(params.fileName).fileName(), params.enabled, adjustedLine, adjustedColumn,
params.lineNumber - 1, -1, params.enabled,
QLatin1String(params.condition), params.ignoreCount); QLatin1String(params.condition), params.ignoreCount);
} else if (params.type == BreakpointOnQmlSignalHandler) { } else if (params.type == BreakpointOnQmlSignalHandler) {
d->setBreakpoint(QString(_(EVENT)), params.functionName, d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled);
-1, -1, params.enabled);
d->engine->breakHandler()->notifyBreakpointInsertOk(id); d->engine->breakHandler()->notifyBreakpointInsertOk(id);
} }
@@ -1109,20 +1113,17 @@ void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id)
void QmlV8DebuggerClient::removeBreakpoint(const BreakpointModelId &id) void QmlV8DebuggerClient::removeBreakpoint(const BreakpointModelId &id)
{ {
BreakHandler *handler = d->engine->breakHandler(); BreakHandler *handler = d->engine->breakHandler();
const BreakpointParameters &params = handler->breakpointData(id);
int breakpoint = d->breakpoints.value(id); int breakpoint = d->breakpoints.value(id);
d->breakpoints.remove(id); d->breakpoints.remove(id);
if (handler->breakpointData(id).type == BreakpointAtJavaScriptThrow) { if (params.type == BreakpointAtJavaScriptThrow)
d->setExceptionBreak(AllExceptions); d->setExceptionBreak(AllExceptions);
else if (params.type == BreakpointOnQmlSignalHandler)
} else if (handler->breakpointData(id).type == BreakpointOnQmlSignalHandler) { d->setBreakpoint(QString(_(EVENT)), params.functionName, false);
d->setBreakpoint(QString(_(EVENT)), handler->breakpointData(id).functionName, else
-1, -1, false);
} else {
d->clearBreakpoint(breakpoint); d->clearBreakpoint(breakpoint);
}
} }
void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id) void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id)
@@ -1133,9 +1134,8 @@ void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id)
if (params.type == BreakpointAtJavaScriptThrow) { if (params.type == BreakpointAtJavaScriptThrow) {
d->setExceptionBreak(AllExceptions, params.enabled); d->setExceptionBreak(AllExceptions, params.enabled);
} else if (handler->breakpointData(id).type == BreakpointOnQmlSignalHandler) { } else if (params.type == BreakpointOnQmlSignalHandler) {
d->setBreakpoint(QString(_(EVENT)), params.functionName, d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled);
-1, -1, params.enabled);
} else { } else {
int breakpoint = d->breakpoints.value(id); int breakpoint = d->breakpoints.value(id);
@@ -1311,8 +1311,15 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
BreakpointModelId id = d->breakpointsSync.take(seq); BreakpointModelId id = d->breakpointsSync.take(seq);
d->breakpoints.insert(id, index); d->breakpoints.insert(id, index);
if (d->engine->breakHandler()->state(id) != BreakpointInserted) BreakHandler *handler = d->engine->breakHandler();
d->engine->breakHandler()->notifyBreakpointInsertOk(id); if (handler->state(id) != BreakpointInserted) {
BreakpointResponse br = handler->response(id);
br.lineNumber = breakpointData.value(_("line")
).toInt() + 1;
handler->setResponse(id, br);
handler->notifyBreakpointInsertOk(id);
}
} else { } else {
d->breakpointsTemp.append(index); d->breakpointsTemp.append(index);
@@ -1450,14 +1457,13 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
const BreakpointParameters &params = handler->breakpointData(internalId); const BreakpointParameters &params = handler->breakpointData(internalId);
d->clearBreakpoint(v8Id); d->clearBreakpoint(v8Id);
d->setBreakpoint( d->setBreakpoint(QString(_(SCRIPTREGEXP)),
QString(_(SCRIPTREGEXP)), params.fileName,
QFileInfo(params.fileName).fileName(), params.enabled,
params.lineNumber - 1, params.lineNumber,
newColumn, newColumn,
params.enabled, QString(params.condition),
QString(params.condition), params.ignoreCount);
params.ignoreCount);
d->breakpointsSync.insert(d->sequence, internalId); d->breakpointsSync.insert(d->sequence, internalId);
} }
} }

View File

@@ -81,7 +81,8 @@ public:
void activateFrame(int index); void activateFrame(int index);
bool acceptsBreakpoint(const BreakpointModelId &id); bool acceptsBreakpoint(const BreakpointModelId &id);
void insertBreakpoint(const BreakpointModelId &id); void insertBreakpoint(const BreakpointModelId &id, int adjustedLine,
int adjustedColumn = -1);
void removeBreakpoint(const BreakpointModelId &id); void removeBreakpoint(const BreakpointModelId &id);
void changeBreakpoint(const BreakpointModelId &id); void changeBreakpoint(const BreakpointModelId &id);
void synchronizeBreakpoints(); void synchronizeBreakpoints();

View File

@@ -119,12 +119,13 @@ class QScriptDebuggerClientPrivate
{ {
public: public:
explicit QScriptDebuggerClientPrivate(QScriptDebuggerClient *) : explicit QScriptDebuggerClientPrivate(QScriptDebuggerClient *) :
ping(0), engine(0) ping(0), sessionStarted(false), engine(0)
{ {
} }
int ping; int ping;
bool sessionStarted;
QmlEngine *engine; QmlEngine *engine;
JSAgentBreakpoints breakpoints; JSAgentBreakpoints breakpoints;
@@ -225,10 +226,12 @@ void QScriptDebuggerClient::startSession()
QTC_CHECK(handler->state(id) == BreakpointInsertProceeding); QTC_CHECK(handler->state(id) == BreakpointInsertProceeding);
handler->notifyBreakpointInsertOk(id); handler->notifyBreakpointInsertOk(id);
} }
d->sessionStarted = true;
} }
void QScriptDebuggerClient::endSession() void QScriptDebuggerClient::endSession()
{ {
d->sessionStarted = false;
} }
void QScriptDebuggerClient::activateFrame(int index) void QScriptDebuggerClient::activateFrame(int index)
@@ -242,14 +245,22 @@ void QScriptDebuggerClient::activateFrame(int index)
sendMessage(reply); sendMessage(reply);
} }
void QScriptDebuggerClient::insertBreakpoint(const BreakpointModelId &id) void QScriptDebuggerClient::insertBreakpoint(const BreakpointModelId &id,
int adjustedLine,
int /*adjustedColumn*/)
{ {
BreakHandler *handler = d->engine->breakHandler(); BreakHandler *handler = d->engine->breakHandler();
JSAgentBreakpointData bp; JSAgentBreakpointData bp;
bp.fileUrl = QUrl::fromLocalFile(handler->fileName(id)).toString().toUtf8(); bp.fileUrl = QUrl::fromLocalFile(handler->fileName(id)).toString().toUtf8();
bp.lineNumber = handler->lineNumber(id); bp.lineNumber = adjustedLine;
bp.functionName = handler->functionName(id).toUtf8(); bp.functionName = handler->functionName(id).toUtf8();
d->breakpoints.insert(bp); d->breakpoints.insert(bp);
BreakpointResponse br = handler->response(id);
br.lineNumber = adjustedLine;
handler->setResponse(id, br);
if (d->sessionStarted && handler->state(id) == BreakpointInsertProceeding)
handler->notifyBreakpointInsertOk(id);
} }
void QScriptDebuggerClient::removeBreakpoint(const BreakpointModelId &id) void QScriptDebuggerClient::removeBreakpoint(const BreakpointModelId &id)
@@ -266,7 +277,8 @@ void QScriptDebuggerClient::changeBreakpoint(const BreakpointModelId &id)
{ {
BreakHandler *handler = d->engine->breakHandler(); BreakHandler *handler = d->engine->breakHandler();
if (handler->isEnabled(id)) { if (handler->isEnabled(id)) {
insertBreakpoint(id); BreakpointResponse br = handler->response(id);
insertBreakpoint(id, br.lineNumber);
} else { } else {
removeBreakpoint(id); removeBreakpoint(id);
} }
@@ -461,33 +473,12 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
.arg(QLatin1String(stackFrames.value(0).fileUrl), Qt::escape(error)); .arg(QLatin1String(stackFrames.value(0).fileUrl), Qt::escape(error));
showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg); showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg);
} else { } else {
//
// Make breakpoint non-pending
//
QString file; QString file;
QString function;
int line = -1; int line = -1;
if (!ideStackFrames.isEmpty()) { if (!ideStackFrames.isEmpty()) {
file = ideStackFrames.at(0).file; file = ideStackFrames.at(0).file;
line = ideStackFrames.at(0).line; line = ideStackFrames.at(0).line;
function = ideStackFrames.at(0).function;
}
BreakHandler *handler = d->engine->breakHandler();
foreach (BreakpointModelId id, handler->engineBreakpointIds(d->engine)) {
QString processedFilename = handler->fileName(id);
if (processedFilename == file && handler->lineNumber(id) == line) {
if (handler->state(id) == BreakpointInsertProceeding)
handler->notifyBreakpointInsertOk(id);
QTC_CHECK(handler->state(id) == BreakpointInserted);
BreakpointResponse br = handler->response(id);
br.fileName = file;
br.lineNumber = line;
br.functionName = function;
handler->setResponse(id, br);
}
} }
QList<JSAgentBreakpointData> breakpoints(d->breakpoints.toList()); QList<JSAgentBreakpointData> breakpoints(d->breakpoints.toList());

View File

@@ -66,7 +66,8 @@ public:
void activateFrame(int index); void activateFrame(int index);
void insertBreakpoint(const BreakpointModelId &id); void insertBreakpoint(const BreakpointModelId &id, int adjustedLine,
int adjustedColumn = -1);
void removeBreakpoint(const BreakpointModelId &id); void removeBreakpoint(const BreakpointModelId &id);
void changeBreakpoint(const BreakpointModelId &id); void changeBreakpoint(const BreakpointModelId &id);
void synchronizeBreakpoints(); void synchronizeBreakpoints();

View File

@@ -45,6 +45,9 @@ public:
: BaseTextMark(fileName, lineNumber), m_id(id), m_visible(visible) : BaseTextMark(fileName, lineNumber), m_id(id), m_visible(visible)
{} {}
bool clickable() const;
void clicked();
void updateLineNumber(int lineNumber); void updateLineNumber(int lineNumber);
void removedFromEditor(); void removedFromEditor();
bool visible() const; bool visible() const;
@@ -69,6 +72,16 @@ bool TaskMark::visible() const
return m_visible; return m_visible;
} }
bool TaskMark::clickable() const
{
return true;
}
void TaskMark::clicked()
{
ProjectExplorerPlugin::instance()->taskHub()->taskMarkClicked(m_id);
}
TaskHub::TaskHub() TaskHub::TaskHub()
: m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")), : m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png")) m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png"))
@@ -93,7 +106,7 @@ void TaskHub::addTask(Task task)
bool visible = (task.type == Task::Warning || task.type == Task::Error); bool visible = (task.type == Task::Warning || task.type == Task::Error);
TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible); TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible);
mark->setIcon(taskTypeIcon(task.type)); mark->setIcon(taskTypeIcon(task.type));
mark->setPriority(TextEditor::ITextMark::HighPriority); mark->setPriority(TextEditor::ITextMark::LowPriority);
task.addMark(mark); task.addMark(mark);
} }
emit taskAdded(task); emit taskAdded(task);
@@ -114,6 +127,11 @@ void TaskHub::updateTaskLineNumber(unsigned int id, int line)
emit taskLineNumberUpdated(id, line); emit taskLineNumberUpdated(id, line);
} }
void TaskHub::taskMarkClicked(unsigned int id)
{
emit showTask(id);
}
void TaskHub::setCategoryVisibility(const Core::Id &categoryId, bool visible) void TaskHub::setCategoryVisibility(const Core::Id &categoryId, bool visible)
{ {
emit categoryVisibilityChanged(categoryId, visible); emit categoryVisibilityChanged(categoryId, visible);

View File

@@ -53,6 +53,7 @@ public:
void clearTasks(const Core::Id &categoryId = Core::Id()); void clearTasks(const Core::Id &categoryId = Core::Id());
void removeTask(const Task &task); void removeTask(const Task &task);
void updateTaskLineNumber(unsigned int id, int line); void updateTaskLineNumber(unsigned int id, int line);
void taskMarkClicked(unsigned int id);
void setCategoryVisibility(const Core::Id &categoryId, bool visible); void setCategoryVisibility(const Core::Id &categoryId, bool visible);
void popup(bool withFocus); void popup(bool withFocus);
@@ -67,6 +68,7 @@ signals:
void taskLineNumberUpdated(unsigned int id, int line); void taskLineNumberUpdated(unsigned int id, int line);
void categoryVisibilityChanged(const Core::Id &categoryId, bool visible); void categoryVisibilityChanged(const Core::Id &categoryId, bool visible);
void popupRequested(bool withFocus); void popupRequested(bool withFocus);
void showTask(unsigned int id);
private: private:
const QIcon m_errorIcon; const QIcon m_errorIcon;
const QIcon m_warningIcon; const QIcon m_warningIcon;

View File

@@ -148,11 +148,18 @@ void TaskModel::removeTask(const Task &task)
} }
} }
int TaskModel::rowForId(unsigned int id)
{
QList<Task>::const_iterator it = qLowerBound(m_tasks.constBegin(), m_tasks.constEnd(), id, sortById);
if (it == m_tasks.constEnd())
return -1;
return it - m_tasks.constBegin();
}
void TaskModel::updateTaskLineNumber(unsigned int id, int line) void TaskModel::updateTaskLineNumber(unsigned int id, int line)
{ {
QList<Task>::iterator it = qLowerBound(m_tasks.begin(), m_tasks.end(), id, sortById); int i = rowForId(id);
QTC_ASSERT(it != m_tasks.end(), return) QTC_ASSERT(i != -1, return)
int i = it - m_tasks.begin();
if (m_tasks.at(i).taskId == id) { if (m_tasks.at(i).taskId == id) {
m_tasks[i].movedLine = line; m_tasks[i].movedLine = line;
emit dataChanged(index(i, 0), index(i, 0)); emit dataChanged(index(i, 0), index(i, 0));
@@ -444,6 +451,15 @@ void TaskFilterModel::handleReset()
invalidateFilter(); invalidateFilter();
} }
QModelIndex TaskFilterModel::mapFromSource(const QModelIndex &idx) const
{
updateMapping();
QList<int>::const_iterator it = qBinaryFind(m_mapping.constBegin(), m_mapping.constEnd(), idx.row());
if (it == m_mapping.constEnd())
return QModelIndex();
return index(it - m_mapping.constBegin(), 0);
}
QModelIndex TaskFilterModel::mapToSource(const QModelIndex &index) const QModelIndex TaskFilterModel::mapToSource(const QModelIndex &index) const
{ {
updateMapping(); updateMapping();

View File

@@ -78,6 +78,7 @@ public:
bool hasFile(const QModelIndex &index) const; bool hasFile(const QModelIndex &index) const;
int rowForId(unsigned int id);
private: private:
class CategoryData class CategoryData
@@ -161,6 +162,7 @@ public:
bool hasFile(const QModelIndex &index) const bool hasFile(const QModelIndex &index) const
{ return m_sourceModel->hasFile(mapToSource(index)); } { return m_sourceModel->hasFile(mapToSource(index)); }
QModelIndex mapFromSource(const QModelIndex &idx) const;
private slots: private slots:
void handleNewRows(const QModelIndex &index, int first, int last); void handleNewRows(const QModelIndex &index, int first, int last);
void handleRemovedRows(const QModelIndex &index, int first, int last); void handleRemovedRows(const QModelIndex &index, int first, int last);

View File

@@ -304,6 +304,8 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
this, SLOT(setCategoryVisibility(Core::Id,bool))); this, SLOT(setCategoryVisibility(Core::Id,bool)));
connect(d->m_taskHub, SIGNAL(popupRequested(bool)), connect(d->m_taskHub, SIGNAL(popupRequested(bool)),
this, SLOT(popup(bool))); this, SLOT(popup(bool)));
connect(d->m_taskHub, SIGNAL(showTask(uint)),
this, SLOT(showTask(uint)));
} }
TaskWindow::~TaskWindow() TaskWindow::~TaskWindow()
@@ -388,6 +390,14 @@ void TaskWindow::updatedTaskLineNumber(unsigned int id, int line)
emit tasksChanged(); emit tasksChanged();
} }
void TaskWindow::showTask(unsigned int id)
{
int sourceRow = d->m_model->rowForId(id);
QModelIndex sourceIdx = d->m_model->index(sourceRow, 0);
QModelIndex filterIdx = d->m_filter->mapFromSource(sourceIdx);
d->m_listview->setCurrentIndex(filterIdx);
}
void TaskWindow::triggerDefaultHandler(const QModelIndex &index) void TaskWindow::triggerDefaultHandler(const QModelIndex &index)
{ {
if (!index.isValid()) if (!index.isValid())

View File

@@ -90,6 +90,7 @@ private slots:
void addTask(const ProjectExplorer::Task &task); void addTask(const ProjectExplorer::Task &task);
void removeTask(const ProjectExplorer::Task &task); void removeTask(const ProjectExplorer::Task &task);
void updatedTaskLineNumber(unsigned int id, int line); void updatedTaskLineNumber(unsigned int id, int line);
void showTask(unsigned int id);
void clearTasks(const Core::Id &categoryId); void clearTasks(const Core::Id &categoryId);
void setCategoryVisibility(const Core::Id &categoryId, bool visible); void setCategoryVisibility(const Core::Id &categoryId, bool visible);

View File

@@ -6,6 +6,8 @@
<comment>QML file</comment> <comment>QML file</comment>
<glob pattern="*.qml"/> <glob pattern="*.qml"/>
<glob pattern="*.qmlproject"/> <glob pattern="*.qmlproject"/>
<glob pattern="*.qbs"/>
<glob pattern="*.qbp"/>
</mime-type> </mime-type>
<mime-type type="application/javascript"> <mime-type type="application/javascript">
<alias type="application/x-javascript"/> <alias type="application/x-javascript"/>

View File

@@ -197,7 +197,7 @@ void S60DeployStep::reportError(const QString &error)
error, error,
Utils::FileName(), -1, Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
emit finished(false); emit s60DeploymentFinished(false);
} }
bool S60DeployStep::processPackageName(QString &errorMessage) bool S60DeployStep::processPackageName(QString &errorMessage)
@@ -273,7 +273,7 @@ void S60DeployStep::stop()
SymbianDeviceManager::instance()->releaseCodaDevice(m_codaDevice); SymbianDeviceManager::instance()->releaseCodaDevice(m_codaDevice);
} }
setState(StateUninit); setState(StateUninit);
emit finished(false); emit s60DeploymentFinished(false);
} }
void S60DeployStep::setupConnections() void S60DeployStep::setupConnections()
@@ -331,10 +331,10 @@ void S60DeployStep::run(QFutureInterface<bool> &fi)
m_futureInterface->setProgressRange(0, 100*m_signedPackages.count()); m_futureInterface->setProgressRange(0, 100*m_signedPackages.count());
connect(this, SIGNAL(finished(bool)), this, SLOT(deploymentFinished(bool))); connect(this, SIGNAL(s60DeploymentFinished(bool)), this, SLOT(deploymentFinished(bool)));
connect(this, SIGNAL(finishNow(bool)), this, SLOT(deploymentFinished(bool)), Qt::DirectConnection); connect(this, SIGNAL(finishNow(bool)), this, SLOT(deploymentFinished(bool)), Qt::DirectConnection);
connect(this, SIGNAL(allFilesSent()), this, SLOT(startInstalling()), Qt::DirectConnection); connect(this, SIGNAL(allFilesSent()), this, SLOT(startInstalling()), Qt::DirectConnection);
connect(this, SIGNAL(allFilesInstalled()), this, SIGNAL(finished()), Qt::DirectConnection); connect(this, SIGNAL(allFilesInstalled()), this, SIGNAL(s60DeploymentFinished()), Qt::DirectConnection);
connect(this, SIGNAL(copyProgressChanged(int)), this, SLOT(updateProgress(int))); connect(this, SIGNAL(copyProgressChanged(int)), this, SLOT(updateProgress(int)));
start(); start();
@@ -577,7 +577,7 @@ void S60DeployStep::checkForTimeout()
return; return;
QMessageBox *mb = CodaRunControl::createCodaWaitingMessageBox(Core::ICore::mainWindow()); QMessageBox *mb = CodaRunControl::createCodaWaitingMessageBox(Core::ICore::mainWindow());
connect(this, SIGNAL(codaConnected()), mb, SLOT(close())); connect(this, SIGNAL(codaConnected()), mb, SLOT(close()));
connect(this, SIGNAL(finished()), mb, SLOT(close())); connect(this, SIGNAL(s60DeploymentFinished()), mb, SLOT(close()));
connect(this, SIGNAL(finishNow()), mb, SLOT(close())); connect(this, SIGNAL(finishNow()), mb, SLOT(close()));
connect(mb, SIGNAL(finished(int)), this, SLOT(slotWaitingForCodaClosed(int))); connect(mb, SIGNAL(finished(int)), this, SLOT(slotWaitingForCodaClosed(int)));
mb->open(); mb->open();
@@ -590,7 +590,7 @@ void S60DeployStep::showManualInstallationInfo()
QMessageBox *mb = new QMessageBox(QMessageBox::Information, title, text, QMessageBox *mb = new QMessageBox(QMessageBox::Information, title, text,
QMessageBox::Ok, Core::ICore::mainWindow()); QMessageBox::Ok, Core::ICore::mainWindow());
connect(this, SIGNAL(allFilesInstalled()), mb, SLOT(close())); connect(this, SIGNAL(allFilesInstalled()), mb, SLOT(close()));
connect(this, SIGNAL(finished()), mb, SLOT(close())); connect(this, SIGNAL(s60DeploymentFinished()), mb, SLOT(close()));
connect(this, SIGNAL(finishNow()), mb, SLOT(close())); connect(this, SIGNAL(finishNow()), mb, SLOT(close()));
mb->open(); mb->open();
} }

View File

@@ -128,7 +128,7 @@ private slots:
void updateProgress(int progress); void updateProgress(int progress);
signals: signals:
void finished(bool success = true); void s60DeploymentFinished(bool success = true);
void finishNow(bool success = true); void finishNow(bool success = true);
void allFilesSent(); void allFilesSent();

View File

@@ -506,8 +506,7 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
m_showImport(importEnabled), m_showImport(importEnabled),
m_buildConfigurationTemplateUnchanged(true), m_buildConfigurationTemplateUnchanged(true),
m_shadowBuildCheckBoxVisible(false), m_shadowBuildCheckBoxVisible(false),
m_selected(0), m_selected(0)
m_qtVersionId(-1)
{ {
QSettings *s = Core::ICore::settings(); QSettings *s = Core::ICore::settings();
QString sourceDir = QFileInfo(m_proFilePath).absolutePath(); QString sourceDir = QFileInfo(m_proFilePath).absolutePath();

View File

@@ -201,7 +201,6 @@ private:
bool m_buildConfigurationTemplateUnchanged; bool m_buildConfigurationTemplateUnchanged;
bool m_shadowBuildCheckBoxVisible; bool m_shadowBuildCheckBoxVisible;
int m_selected; // Number of selected buildconfiguartions int m_selected; // Number of selected buildconfiguartions
int m_qtVersionId; // version id for "One Qt" entry
}; };
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -3682,7 +3682,7 @@ int BaseTextEditorWidget::extraAreaWidth(int *markWidthPtr) const
int markWidth = 0; int markWidth = 0;
if (d->m_marksVisible) { if (d->m_marksVisible) {
markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing(); markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing() + 2;
// if (documentLayout->doubleMarkCount) // if (documentLayout->doubleMarkCount)
// markWidth += fm.lineSpacing() / 3; // markWidth += fm.lineSpacing() / 3;
@@ -3797,7 +3797,23 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e)
if (TextBlockUserData *userData = static_cast<TextBlockUserData*>(block.userData())) { if (TextBlockUserData *userData = static_cast<TextBlockUserData*>(block.userData())) {
if (d->m_marksVisible) { if (d->m_marksVisible) {
int xoffset = 0; int xoffset = 0;
foreach (ITextMark *mark, userData->marks()) { TextMarks marks = userData->marks();
TextMarks::const_iterator it = marks.constBegin();
if (marks.size() > 3) {
// We want the 3 with the highest priority so iterate from the back
int count = 0;
it = marks.constEnd() - 1;
while (it != marks.constBegin()) {
if ((*it)->visible())
++count;
if (count == 3)
break;
--it;
}
}
TextMarks::const_iterator end = marks.constEnd();
for ( ; it != end; ++it) {
ITextMark *mark = *it;
if (!mark->visible()) if (!mark->visible())
continue; continue;
const int height = fmLineSpacing - 1; const int height = fmLineSpacing - 1;
@@ -4273,11 +4289,13 @@ void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
void BaseTextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e) void BaseTextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)
{ {
QTextCursor cursor = textCursor(); if (e->button() == Qt::LeftButton) {
const int position = cursor.position(); QTextCursor cursor = textCursor();
if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false, true)) { const int position = cursor.position();
if (position - cursor.position() == 1 && selectBlockUp()) if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false, true)) {
return; if (position - cursor.position() == 1 && selectBlockUp())
return;
}
} }
QPlainTextEdit::mouseDoubleClickEvent(e); QPlainTextEdit::mouseDoubleClickEvent(e);
@@ -4427,12 +4445,22 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
int n = d->extraAreaToggleMarkBlockNumber; int n = d->extraAreaToggleMarkBlockNumber;
d->extraAreaToggleMarkBlockNumber = -1; d->extraAreaToggleMarkBlockNumber = -1;
if (cursor.blockNumber() == n) { if (cursor.blockNumber() == n) {
if (TextBlockUserData *data = static_cast<TextBlockUserData *>(cursor.block().userData())) {
foreach (ITextMark *mark, data->marks()) {
if (mark->clickable()) {
mark->clicked();
return;
}
}
}
int line = n + 1; int line = n + 1;
ITextEditor::MarkRequestKind kind; ITextEditor::MarkRequestKind kind;
if (QApplication::keyboardModifiers() & Qt::ShiftModifier) if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
kind = ITextEditor::BookmarkRequest; kind = ITextEditor::BookmarkRequest;
else else
kind = ITextEditor::BreakpointRequest; kind = ITextEditor::BreakpointRequest;
emit editor()->markRequested(editor(), line, kind); emit editor()->markRequested(editor(), line, kind);
} }
} }

View File

@@ -110,7 +110,8 @@ public:
enum MarkRequestKind { enum MarkRequestKind {
BreakpointRequest, BreakpointRequest,
BookmarkRequest BookmarkRequest,
TaskMarkRequest
}; };
signals: signals:

View File

@@ -84,3 +84,11 @@ double ITextMark::widthFactor() const
{ {
return 1.0; return 1.0;
} }
bool ITextMark::clickable() const
{
return false;
}
void ITextMark::clicked()
{}

View File

@@ -75,6 +75,8 @@ public:
void setPriority(Priority prioriy); void setPriority(Priority prioriy);
virtual bool visible() const; virtual bool visible() const;
virtual double widthFactor() const; virtual double widthFactor() const;
virtual bool clickable() const;
virtual void clicked();
private: private:
int m_lineNumber; int m_lineNumber;

View File

@@ -162,7 +162,7 @@ WelcomeMode::WelcomeMode() :
layout->addWidget(scrollArea); layout->addWidget(scrollArea);
scrollArea->setWidget(m_welcomePage); scrollArea->setWidget(m_welcomePage);
scrollArea->setWidgetResizable(true); scrollArea->setWidgetResizable(true);
m_welcomePage->setMinimumWidth(960); m_welcomePage->setMinimumWidth(860);
PluginManager *pluginManager = PluginManager::instance(); PluginManager *pluginManager = PluginManager::instance();
connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*))); connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*)));

View File

@@ -3,6 +3,15 @@ CONFIG -= qt app_bundle
include(../../../qtcreator.pri) include(../../../qtcreator.pri)
# Switch to statically linked CRT. Note: There will be only one
# global state of the CRT, reconsider if other DLLs are required!
# TODO: No effect, currently?
QMAKE_CXXFLAGS_RELEASE -= -MD
QMAKE_CXXFLAGS_DEBUG -= -MDd
QMAKE_CXXFLAGS_RELEASE += -MT
QMAKE_CXXFLAGS_DEBUG += -MT
SOURCES = win64interrupt.c SOURCES = win64interrupt.c
TEMPLATE = app TEMPLATE = app