diff --git a/doc/images/qt-simulator.png b/doc/images/qt-simulator.png index e59eb9ff3dc..d426598c73b 100644 Binary files a/doc/images/qt-simulator.png and b/doc/images/qt-simulator.png differ diff --git a/doc/images/qtcreator-gs-build-example-open.png b/doc/images/qtcreator-gs-build-example-open.png index 059e7a135ea..30177fe07b3 100644 Binary files a/doc/images/qtcreator-gs-build-example-open.png and b/doc/images/qtcreator-gs-build-example-open.png differ diff --git a/doc/images/qtcreator-gs-build-example-select-qs.png b/doc/images/qtcreator-gs-build-example-select-qs.png index 3d4c51928ab..8f0ec3caf4f 100644 Binary files a/doc/images/qtcreator-gs-build-example-select-qs.png and b/doc/images/qtcreator-gs-build-example-select-qs.png differ diff --git a/doc/images/qtcreator-gs-build-example-targets.png b/doc/images/qtcreator-gs-build-example-targets.png index 65228226378..9047b93d204 100644 Binary files a/doc/images/qtcreator-gs-build-example-targets.png and b/doc/images/qtcreator-gs-build-example-targets.png differ diff --git a/doc/src/overview/creator-getting-started.qdoc b/doc/src/overview/creator-getting-started.qdoc index b8b31406613..ecfce510c59 100644 --- a/doc/src/overview/creator-getting-started.qdoc +++ b/doc/src/overview/creator-getting-started.qdoc @@ -49,12 +49,12 @@ If you have not used \QC before, and want to become familiar 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 successfully installed as part of the \QSDK installation, open 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}} Now you are ready to start developing your own applications. diff --git a/doc/src/projects/creator-projects-autotools.qdoc b/doc/src/projects/creator-projects-autotools.qdoc index 584c5b2d752..b4478f25671 100644 --- a/doc/src/projects/creator-projects-autotools.qdoc +++ b/doc/src/projects/creator-projects-autotools.qdoc @@ -39,7 +39,9 @@ \nextpage creator-project-generic.html \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 diff --git a/doc/src/projects/creator-projects-build-run-tutorial.qdoc b/doc/src/projects/creator-projects-build-run-tutorial.qdoc index 8f01d175115..f5454e49ab3 100644 --- a/doc/src/projects/creator-projects-build-run-tutorial.qdoc +++ b/doc/src/projects/creator-projects-build-run-tutorial.qdoc @@ -31,43 +31,48 @@ \page creator-build-example-application.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 example application project. \list 1 - \o On the \gui Welcome page, select \gui {Demos and Examples}, - and then search for \gui {Toys: Clocks Example} in the - list of examples. + \o On the \gui Welcome page, select \gui Examples (1). \image qtcreator-gs-build-example-open.png "Selecting an example" - \o Select \l{glossary-development-target}{targets} for the project. - Select at least \QS - 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. + \o Search for \gui {Toys: Clocks Example} (2) in the list of examples + and select it (3). \note The project opens in the \gui Edit mode, and the documentation for the example hides these instructions. To return to these instructions, select \gui {Previous Page} on the toolbar or 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 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 - \inlineimage{qtcreator-run.png} - to build the application and run it in \QS. + \inlineimage qtcreator-run.png + (\gui Run) to build the application and run it in \QS. \o To see the compilation progress, press \key{Alt+4} to open the \gui {Compile Output} pane. @@ -76,7 +81,7 @@ project is successfully built. The application opens in \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 device by clicking the \gui {Orientation} buttons or choose from the diff --git a/doc/src/qtcreator.qdoc b/doc/src/qtcreator.qdoc index faf687b7ebe..ccce4c30998 100644 --- a/doc/src/qtcreator.qdoc +++ b/doc/src/qtcreator.qdoc @@ -48,7 +48,7 @@ \list \o \l{IDE Overview} \o \l{User Interface} - \o \l{Building and Running an Example Application} + \o \l{Building and Running an Example} \o \l{Tutorials} \endlist \o \bold {\l{Managing Projects}} @@ -132,7 +132,7 @@ \list \o \l{IDE Overview} \o \l{User Interface} - \o \l{Building and Running an Example Application} + \o \l{Building and Running an Example} \o \l{Tutorials} \list \o \l{Creating a Qt Quick Application} diff --git a/src/plugins/bookmarks/bookmark.cpp b/src/plugins/bookmarks/bookmark.cpp index 8b771db0212..a147a828fa8 100644 --- a/src/plugins/bookmarks/bookmark.cpp +++ b/src/plugins/bookmarks/bookmark.cpp @@ -46,7 +46,7 @@ Bookmark::Bookmark(const QString& fileName, int lineNumber, BookmarkManager *man m_onlyFile(m_fileInfo.fileName()), m_path(m_fileInfo.path()) { - setPriority(TextEditor::ITextMark::LowPriority); + setPriority(TextEditor::ITextMark::NormalPriority); setIcon(m_manager->bookmarkIcon()); } diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index d5aabb45310..ba79dff82c4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -821,7 +821,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeTarget *target) setLayout(fl); // TODO add action to Build menu? - QPushButton *runCmakeButton = new QPushButton("Run cmake"); + QPushButton *runCmakeButton = new QPushButton(tr("Run cmake")); connect(runCmakeButton, SIGNAL(clicked()), this, SLOT(runCMake())); fl->addRow(tr("Reconfigure project:"), runCmakeButton); @@ -837,7 +837,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeTarget *target) connect(m_changeButton, SIGNAL(clicked()), this, SLOT(openChangeBuildDirectoryDialog())); hbox->addWidget(m_changeButton); - fl->addRow("Build directory:", hbox); + fl->addRow(tr("Build directory:"), hbox); } QString CMakeBuildSettingsWidget::displayName() const diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 433af38cb08..7d8ffdc69bb 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -74,9 +74,15 @@ Qt::DropActions ExternalToolModel::supportedDropActions() const return Qt::MoveAction; } +QString ExternalToolModel::uncategorizedDisplayName() const +{ + static QString uncategorized = tr("Uncategorized"); + return uncategorized; +} + 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 0; } @@ -86,9 +92,8 @@ QVariant ExternalToolModel::data(const QModelIndex &index, int role) const if (ExternalTool *tool = toolForIndex(index)) return data(tool, role); QString category = categoryForIndex(index); - if (!category.isNull()) - return data(category, role); - return QVariant(); + QTC_ASSERT(!category.isEmpty(), return QVariant()); + return data(category, role); } QVariant ExternalToolModel::data(ExternalTool *tool, int role) const @@ -108,9 +113,10 @@ QVariant ExternalToolModel::data(const QString &category, int role) const switch (role) { case Qt::DisplayRole: case Qt::EditRole: - return category.isEmpty() ? tr("Uncategorized") : category; + return category; 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: break; } @@ -125,7 +131,7 @@ QMimeData *ExternalToolModel::mimeData(const QModelIndexList &indexes) const ExternalTool *tool = toolForIndex(modelIndex); QTC_ASSERT(tool, return 0); QString category = categoryForIndex(modelIndex.parent()); - QTC_ASSERT(!category.isNull(), return 0); + QTC_ASSERT(!category.isEmpty(), return 0); QMimeData *md = new QMimeData(); QByteArray ba; QDataStream stream(&ba, QIODevice::WriteOnly); @@ -144,7 +150,7 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data, if (action != Qt::MoveAction || !data) return false; 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")); if (ba.isEmpty()) return false; @@ -153,15 +159,15 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data, int pos = -1; stream >> category; stream >> pos; - QTC_ASSERT(!category.isNull(), return false); + QTC_ASSERT(!category.isEmpty(), return false); QList &items = m_tools[category]; 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); endRemoveRows(); if (row < 0) 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); endInsertRows(); return true; @@ -176,7 +182,7 @@ QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &par { if (column == 0 && parent.isValid()) { QString category = categoryForIndex(parent); - if (!category.isNull()) { + if (!category.isEmpty()) { QList items = m_tools.value(category); if (row < items.count()) { 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 { if (ExternalTool *tool = toolForIndex(child)) { - int categoryIndex = 0; QMapIterator > it(m_tools); while (it.hasNext()) { it.next(); if (it.value().contains(tool)) - return index(categoryIndex, 0); - ++categoryIndex; + return index(rowForCategory(it.key()), 0); } } return QModelIndex(); @@ -211,7 +215,7 @@ int ExternalToolModel::rowCount(const QModelIndex &parent) const return 0; } QString category = categoryForIndex(parent); - if (!category.isNull()) { + if (!category.isEmpty()) { return m_tools.value(category).count(); } @@ -223,8 +227,8 @@ Qt::ItemFlags ExternalToolModel::flags(const QModelIndex &index) const if (toolForIndex(index)) return TOOL_ITEM_FLAGS; QString category = categoryForIndex(index); - if (!category.isNull()) { - if (category.isEmpty()) + if (!category.isEmpty()) { + if (category == uncategorizedDisplayName()) return TOOLSMENU_ITEM_FLAGS; return CATEGORY_ITEM_FLAGS; } @@ -245,15 +249,17 @@ bool ExternalToolModel::setData(const QModelIndex &modelIndex, const QVariant &v return true; } else { QString category = categoryForIndex(modelIndex); - if (!category.isNull()) { + if (!category.isEmpty()) { if (string.isEmpty() || m_tools.contains(string)) return false; // rename category QList 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.append(string); qSort(categories); + categories.prepend(uncategorizedDisplayName()); // prepend, so order is like in view int newIndex = categories.indexOf(string); if (newIndex != previousIndex) { // 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) { const QList &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 QString(); } +int ExternalToolModel::rowForCategory(const QString &category) const +{ + if (category == uncategorizedDisplayName()) + return 0; + const QList &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) { ExternalTool *tool = toolForIndex(modelIndex); @@ -319,8 +343,10 @@ QModelIndex ExternalToolModel::addCategory() category = categoryBase + QString::number(count); } QList categories = m_tools.keys(); + categories.removeAll(uncategorizedDisplayName()); // prepended again after sorting new list categories.append(category); qSort(categories); + categories.prepend(uncategorizedDisplayName()); // prepend, so order is like in view int pos = categories.indexOf(category); beginInsertRows(QModelIndex(), pos, pos); @@ -332,7 +358,7 @@ QModelIndex ExternalToolModel::addCategory() QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex) { QString category = categoryForIndex(atIndex); - if (category.isNull()) + if (category.isEmpty()) category = categoryForIndex(atIndex.parent()); ExternalTool *tool = new ExternalTool; @@ -465,8 +491,8 @@ void ExternalToolConfig::setTools(const QMap > &t itemCopy.append(new ExternalTool(tool)); toolsCopy.insert(it.key(), itemCopy); } - if (!toolsCopy.contains(QString())) - toolsCopy.insert(QString(), QList()); + if (!toolsCopy.contains(m_model->uncategorizedDisplayName())) + toolsCopy.insert(m_model->uncategorizedDisplayName(), QList()); m_model->setTools(toolsCopy); ui->toolTree->expandAll(); } diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.h b/src/plugins/coreplugin/dialogs/externaltoolconfig.h index 00afbd63f28..d7c4b09d433 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.h +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.h @@ -74,11 +74,13 @@ public: ExternalTool *toolForIndex(const QModelIndex &modelIndex) const; QString categoryForIndex(const QModelIndex &modelIndex) const; + int rowForCategory(const QString &category) const; void revertTool(const QModelIndex &modelIndex); QModelIndex addCategory(); QModelIndex addTool(const QModelIndex &atIndex); void removeTool(const QModelIndex &modelIndex); Qt::DropActions supportedDropActions() const; + QString uncategorizedDisplayName() const; private: QVariant data(ExternalTool *tool, int role = Qt::DisplayRole) const; QVariant data(const QString &category, int role = Qt::DisplayRole) const; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 5412d042733..195443ad3b7 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2280,7 +2280,7 @@ void GdbEngine::handleExecuteReturn(const GdbResponse &response) void GdbEngine::setTokenBarrier() { - QTC_ASSERT(m_nonDiscardableCount == 0, /**/); + //QTC_ASSERT(m_nonDiscardableCount == 0, /**/); bool good = true; QHashIterator it(m_cookieForToken); while (it.hasNext()) { diff --git a/src/plugins/debugger/qml/qmldebuggerclient.h b/src/plugins/debugger/qml/qmldebuggerclient.h index 0a89e035fd1..fcb7c607d88 100644 --- a/src/plugins/debugger/qml/qmldebuggerclient.h +++ b/src/plugins/debugger/qml/qmldebuggerclient.h @@ -69,7 +69,8 @@ public: virtual void activateFrame(int index) = 0; 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 changeBreakpoint(const BreakpointModelId &id) = 0; virtual void synchronizeBreakpoints() = 0; diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 943c4869528..e00d1ed7ff2 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -58,6 +58,8 @@ #include #include #include +#include +#include #include #include @@ -95,6 +97,8 @@ # define XSDEBUG(s) qDebug() << s using namespace ProjectExplorer; +using namespace QmlJS; +using namespace AST; namespace Debugger { namespace Internal { @@ -114,6 +118,7 @@ private: QHash > m_sourceEditors; InteractiveInterpreter m_interpreter; bool m_validContext; + QHash pendingBreakpoints; }; QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q) @@ -121,6 +126,163 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q) 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(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 () { { }}) + //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())); qtMessageLogHandler()->setHasEditableRow(true); + + connect(ModelManagerInterface::instance(), + SIGNAL(documentUpdated(QmlJS::Document::Ptr)), + this, + SLOT(documentUpdated(QmlJS::Document::Ptr))); } QmlEngine::~QmlEngine() @@ -560,8 +727,14 @@ void QmlEngine::executeRunToLine(const ContextData &data) QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); showStatusMessage(tr("Run to line %1 (%2) requested...").arg(data.lineNumber).arg(data.fileName), 5000); 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()) - d->m_adapter.activeDebuggerClient()->executeRunToLine(data); + d->m_adapter.activeDebuggerClient()->executeRunToLine(modifiedData); notifyInferiorRunRequested(); notifyInferiorRunOk(); } @@ -601,11 +774,25 @@ void QmlEngine::insertBreakpoint(BreakpointModelId id) QTC_ASSERT(state == BreakpointInsertRequested, qDebug() << id << this << state); handler->notifyBreakpointInsertProceeding(id); + const BreakpointParameters ¶ms = 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()) { - d->m_adapter.activeDebuggerClient()->insertBreakpoint(id); + d->m_adapter.activeDebuggerClient()->insertBreakpoint(id, line, column); } else { 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) { BreakHandler *handler = breakHandler(); + + const BreakpointParameters ¶ms = handler->breakpointData(id); + if (params.type == BreakpointByFileAndLine && + d->pendingBreakpoints.contains(params.fileName)) { + QHash::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); QTC_ASSERT(state == BreakpointRemoveRequested, qDebug() << id << this << state); handler->notifyBreakpointRemoveProceeding(id); @@ -852,6 +1054,17 @@ void QmlEngine::disconnected() notifyInferiorExited(); } +void QmlEngine::documentUpdated(QmlJS::Document::Ptr doc) +{ + QString fileName = doc->fileName(); + if (d->pendingBreakpoints.contains(fileName)) { + QList ids = d->pendingBreakpoints.values(fileName); + d->pendingBreakpoints.remove(fileName); + foreach (const BreakpointModelId &id, ids) + insertBreakpoint(id); + } +} + void QmlEngine::updateCurrentContext() { const QString context = state() == InferiorStopOk ? @@ -1085,6 +1298,27 @@ QtMessageLogItem *QmlEngine::constructLogItemTree( 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 { return &d->m_adapter; diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index 72cc70bdea1..b8558c98e6f 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -92,6 +93,7 @@ public: public slots: void disconnected(); + void documentUpdated(QmlJS::Document::Ptr doc); private slots: void errorMessageBoxFinished(int result); @@ -184,6 +186,8 @@ private: bool canEvaluateScript(const QString &script); QtMessageLogItem *constructLogItemTree(const QVariant &result, const QString &key = QString()); + bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line, + quint32 *column, bool *valid); private: friend class QmlCppEngine; diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp index 35e6c7e151c..b7c7b8ba994 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp @@ -105,8 +105,8 @@ public: bool includeSource = false, const QVariant filter = QVariant()); void source(int frame = -1, int fromLine = -1, int toLine = -1); - void setBreakpoint(const QString type, const QString target, int line = -1, - int column = -1, bool enabled = true, + void setBreakpoint(const QString type, const QString target, + bool enabled = true,int line = 0, int column = 0, const QString condition = QString(), int ignoreCount = -1); void changeBreakpoint(int breakpoint, bool enabled = true, 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, - int line, int column, bool enabled, + bool enabled, int line, int column, const QString condition, int ignoreCount) { // { "seq" : , @@ -542,13 +542,17 @@ void QmlV8DebuggerClientPrivate::setBreakpoint(const QString type, const QString QScriptValue args = parser.call(QScriptValue(), QScriptValueList() << QScriptValue(_(OBJECT))); 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) - args.setProperty(_(LINE), QScriptValue(line)); + if (line) + args.setProperty(_(LINE), QScriptValue(line - 1)); - if (column != -1) - args.setProperty(_(COLUMN), QScriptValue(column)); + if (column) + args.setProperty(_(COLUMN), QScriptValue(column - 1)); args.setProperty(_(ENABLED), QScriptValue(enabled)); @@ -959,7 +963,7 @@ void QmlV8DebuggerClientPrivate::reformatRequest(QByteArray &request) bool 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) { - d->setBreakpoint(QString(_(SCRIPTREGEXP)), QFileInfo(data.fileName).fileName(), - data.lineNumber - 1); + d->setBreakpoint(QString(_(SCRIPTREGEXP)), data.fileName, + true, data.lineNumber); clearExceptionSelection(); d->continueDebugging(Continue); } @@ -1082,7 +1086,9 @@ bool QmlV8DebuggerClient::acceptsBreakpoint(const BreakpointModelId &id) || type == BreakpointAtJavaScriptThrow); } -void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id) +void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id, + int adjustedLine, + int adjustedColumn) { BreakHandler *handler = d->engine->breakHandler(); const BreakpointParameters ¶ms = handler->breakpointData(id); @@ -1092,14 +1098,12 @@ void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id) d->setExceptionBreak(AllExceptions, params.enabled); } else if (params.type == BreakpointByFileAndLine) { - d->setBreakpoint(QString(_(SCRIPTREGEXP)), - QFileInfo(params.fileName).fileName(), - params.lineNumber - 1, -1, params.enabled, + d->setBreakpoint(QString(_(SCRIPTREGEXP)), params.fileName, + params.enabled, adjustedLine, adjustedColumn, QLatin1String(params.condition), params.ignoreCount); } else if (params.type == BreakpointOnQmlSignalHandler) { - d->setBreakpoint(QString(_(EVENT)), params.functionName, - -1, -1, params.enabled); + d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled); d->engine->breakHandler()->notifyBreakpointInsertOk(id); } @@ -1109,20 +1113,17 @@ void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id) void QmlV8DebuggerClient::removeBreakpoint(const BreakpointModelId &id) { BreakHandler *handler = d->engine->breakHandler(); + const BreakpointParameters ¶ms = handler->breakpointData(id); int breakpoint = d->breakpoints.value(id); d->breakpoints.remove(id); - if (handler->breakpointData(id).type == BreakpointAtJavaScriptThrow) { + if (params.type == BreakpointAtJavaScriptThrow) d->setExceptionBreak(AllExceptions); - - } else if (handler->breakpointData(id).type == BreakpointOnQmlSignalHandler) { - d->setBreakpoint(QString(_(EVENT)), handler->breakpointData(id).functionName, - -1, -1, false); - - } else { + else if (params.type == BreakpointOnQmlSignalHandler) + d->setBreakpoint(QString(_(EVENT)), params.functionName, false); + else d->clearBreakpoint(breakpoint); - } } void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id) @@ -1133,9 +1134,8 @@ void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id) if (params.type == BreakpointAtJavaScriptThrow) { d->setExceptionBreak(AllExceptions, params.enabled); - } else if (handler->breakpointData(id).type == BreakpointOnQmlSignalHandler) { - d->setBreakpoint(QString(_(EVENT)), params.functionName, - -1, -1, params.enabled); + } else if (params.type == BreakpointOnQmlSignalHandler) { + d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled); } else { int breakpoint = d->breakpoints.value(id); @@ -1311,8 +1311,15 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) BreakpointModelId id = d->breakpointsSync.take(seq); d->breakpoints.insert(id, index); - if (d->engine->breakHandler()->state(id) != BreakpointInserted) - d->engine->breakHandler()->notifyBreakpointInsertOk(id); + BreakHandler *handler = d->engine->breakHandler(); + 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 { d->breakpointsTemp.append(index); @@ -1450,14 +1457,13 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) const BreakpointParameters ¶ms = handler->breakpointData(internalId); d->clearBreakpoint(v8Id); - d->setBreakpoint( - QString(_(SCRIPTREGEXP)), - QFileInfo(params.fileName).fileName(), - params.lineNumber - 1, - newColumn, - params.enabled, - QString(params.condition), - params.ignoreCount); + d->setBreakpoint(QString(_(SCRIPTREGEXP)), + params.fileName, + params.enabled, + params.lineNumber, + newColumn, + QString(params.condition), + params.ignoreCount); d->breakpointsSync.insert(d->sequence, internalId); } } diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.h b/src/plugins/debugger/qml/qmlv8debuggerclient.h index 3f68b0e64ef..c7cb0fbe363 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.h +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.h @@ -81,7 +81,8 @@ public: void activateFrame(int index); 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 changeBreakpoint(const BreakpointModelId &id); void synchronizeBreakpoints(); diff --git a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp index c62c976844d..6af0162e06f 100644 --- a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp +++ b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp @@ -119,12 +119,13 @@ class QScriptDebuggerClientPrivate { public: explicit QScriptDebuggerClientPrivate(QScriptDebuggerClient *) : - ping(0), engine(0) + ping(0), sessionStarted(false), engine(0) { } int ping; + bool sessionStarted; QmlEngine *engine; JSAgentBreakpoints breakpoints; @@ -225,10 +226,12 @@ void QScriptDebuggerClient::startSession() QTC_CHECK(handler->state(id) == BreakpointInsertProceeding); handler->notifyBreakpointInsertOk(id); } + d->sessionStarted = true; } void QScriptDebuggerClient::endSession() { + d->sessionStarted = false; } void QScriptDebuggerClient::activateFrame(int index) @@ -242,14 +245,22 @@ void QScriptDebuggerClient::activateFrame(int index) sendMessage(reply); } -void QScriptDebuggerClient::insertBreakpoint(const BreakpointModelId &id) +void QScriptDebuggerClient::insertBreakpoint(const BreakpointModelId &id, + int adjustedLine, + int /*adjustedColumn*/) { BreakHandler *handler = d->engine->breakHandler(); JSAgentBreakpointData bp; bp.fileUrl = QUrl::fromLocalFile(handler->fileName(id)).toString().toUtf8(); - bp.lineNumber = handler->lineNumber(id); + bp.lineNumber = adjustedLine; bp.functionName = handler->functionName(id).toUtf8(); 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) @@ -266,7 +277,8 @@ void QScriptDebuggerClient::changeBreakpoint(const BreakpointModelId &id) { BreakHandler *handler = d->engine->breakHandler(); if (handler->isEnabled(id)) { - insertBreakpoint(id); + BreakpointResponse br = handler->response(id); + insertBreakpoint(id, br.lineNumber); } else { removeBreakpoint(id); } @@ -461,33 +473,12 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data) .arg(QLatin1String(stackFrames.value(0).fileUrl), Qt::escape(error)); showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg); } else { - // - // Make breakpoint non-pending - // QString file; - QString function; int line = -1; if (!ideStackFrames.isEmpty()) { file = ideStackFrames.at(0).file; 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 breakpoints(d->breakpoints.toList()); diff --git a/src/plugins/debugger/qml/qscriptdebuggerclient.h b/src/plugins/debugger/qml/qscriptdebuggerclient.h index 74716cdddd4..58602723db2 100644 --- a/src/plugins/debugger/qml/qscriptdebuggerclient.h +++ b/src/plugins/debugger/qml/qscriptdebuggerclient.h @@ -66,7 +66,8 @@ public: 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 changeBreakpoint(const BreakpointModelId &id); void synchronizeBreakpoints(); diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp index 6f223945235..a05d9dc1fa1 100644 --- a/src/plugins/projectexplorer/taskhub.cpp +++ b/src/plugins/projectexplorer/taskhub.cpp @@ -45,6 +45,9 @@ public: : BaseTextMark(fileName, lineNumber), m_id(id), m_visible(visible) {} + bool clickable() const; + void clicked(); + void updateLineNumber(int lineNumber); void removedFromEditor(); bool visible() const; @@ -69,6 +72,16 @@ bool TaskMark::visible() const return m_visible; } +bool TaskMark::clickable() const +{ + return true; +} + +void TaskMark::clicked() +{ + ProjectExplorerPlugin::instance()->taskHub()->taskMarkClicked(m_id); +} + TaskHub::TaskHub() : m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.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); TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible); mark->setIcon(taskTypeIcon(task.type)); - mark->setPriority(TextEditor::ITextMark::HighPriority); + mark->setPriority(TextEditor::ITextMark::LowPriority); task.addMark(mark); } emit taskAdded(task); @@ -114,6 +127,11 @@ void TaskHub::updateTaskLineNumber(unsigned int id, int line) emit taskLineNumberUpdated(id, line); } +void TaskHub::taskMarkClicked(unsigned int id) +{ + emit showTask(id); +} + void TaskHub::setCategoryVisibility(const Core::Id &categoryId, bool visible) { emit categoryVisibilityChanged(categoryId, visible); diff --git a/src/plugins/projectexplorer/taskhub.h b/src/plugins/projectexplorer/taskhub.h index 8dd962eafb7..6f92c3dd5ef 100644 --- a/src/plugins/projectexplorer/taskhub.h +++ b/src/plugins/projectexplorer/taskhub.h @@ -53,6 +53,7 @@ public: void clearTasks(const Core::Id &categoryId = Core::Id()); void removeTask(const Task &task); void updateTaskLineNumber(unsigned int id, int line); + void taskMarkClicked(unsigned int id); void setCategoryVisibility(const Core::Id &categoryId, bool visible); void popup(bool withFocus); @@ -67,6 +68,7 @@ signals: void taskLineNumberUpdated(unsigned int id, int line); void categoryVisibilityChanged(const Core::Id &categoryId, bool visible); void popupRequested(bool withFocus); + void showTask(unsigned int id); private: const QIcon m_errorIcon; const QIcon m_warningIcon; diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index 7a7a73360be..1d929e0f4f4 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -148,11 +148,18 @@ void TaskModel::removeTask(const Task &task) } } +int TaskModel::rowForId(unsigned int id) +{ + QList::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) { - QList::iterator it = qLowerBound(m_tasks.begin(), m_tasks.end(), id, sortById); - QTC_ASSERT(it != m_tasks.end(), return) - int i = it - m_tasks.begin(); + int i = rowForId(id); + QTC_ASSERT(i != -1, return) if (m_tasks.at(i).taskId == id) { m_tasks[i].movedLine = line; emit dataChanged(index(i, 0), index(i, 0)); @@ -444,6 +451,15 @@ void TaskFilterModel::handleReset() invalidateFilter(); } +QModelIndex TaskFilterModel::mapFromSource(const QModelIndex &idx) const +{ + updateMapping(); + QList::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 { updateMapping(); diff --git a/src/plugins/projectexplorer/taskmodel.h b/src/plugins/projectexplorer/taskmodel.h index 1dfb6733c93..017e489b6ec 100644 --- a/src/plugins/projectexplorer/taskmodel.h +++ b/src/plugins/projectexplorer/taskmodel.h @@ -78,6 +78,7 @@ public: bool hasFile(const QModelIndex &index) const; + int rowForId(unsigned int id); private: class CategoryData @@ -161,6 +162,7 @@ public: bool hasFile(const QModelIndex &index) const { return m_sourceModel->hasFile(mapToSource(index)); } + QModelIndex mapFromSource(const QModelIndex &idx) const; private slots: void handleNewRows(const QModelIndex &index, int first, int last); void handleRemovedRows(const QModelIndex &index, int first, int last); diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 4f0a93bebf1..efb720d7cef 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -304,6 +304,8 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate) this, SLOT(setCategoryVisibility(Core::Id,bool))); connect(d->m_taskHub, SIGNAL(popupRequested(bool)), this, SLOT(popup(bool))); + connect(d->m_taskHub, SIGNAL(showTask(uint)), + this, SLOT(showTask(uint))); } TaskWindow::~TaskWindow() @@ -388,6 +390,14 @@ void TaskWindow::updatedTaskLineNumber(unsigned int id, int line) 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) { if (!index.isValid()) diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h index 35ca1ea296e..8a41bf9b1f4 100644 --- a/src/plugins/projectexplorer/taskwindow.h +++ b/src/plugins/projectexplorer/taskwindow.h @@ -90,6 +90,7 @@ private slots: void addTask(const ProjectExplorer::Task &task); void removeTask(const ProjectExplorer::Task &task); void updatedTaskLineNumber(unsigned int id, int line); + void showTask(unsigned int id); void clearTasks(const Core::Id &categoryId); void setCategoryVisibility(const Core::Id &categoryId, bool visible); diff --git a/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml b/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml index e0d6850a6cd..a46ab5ed42b 100644 --- a/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml +++ b/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml @@ -6,6 +6,8 @@ QML file + + diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp index 1db4799c86e..b7b196b9dda 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp @@ -197,7 +197,7 @@ void S60DeployStep::reportError(const QString &error) error, Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); - emit finished(false); + emit s60DeploymentFinished(false); } bool S60DeployStep::processPackageName(QString &errorMessage) @@ -273,7 +273,7 @@ void S60DeployStep::stop() SymbianDeviceManager::instance()->releaseCodaDevice(m_codaDevice); } setState(StateUninit); - emit finished(false); + emit s60DeploymentFinished(false); } void S60DeployStep::setupConnections() @@ -331,10 +331,10 @@ void S60DeployStep::run(QFutureInterface &fi) 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(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))); start(); @@ -577,7 +577,7 @@ void S60DeployStep::checkForTimeout() return; QMessageBox *mb = CodaRunControl::createCodaWaitingMessageBox(Core::ICore::mainWindow()); 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(mb, SIGNAL(finished(int)), this, SLOT(slotWaitingForCodaClosed(int))); mb->open(); @@ -590,7 +590,7 @@ void S60DeployStep::showManualInstallationInfo() QMessageBox *mb = new QMessageBox(QMessageBox::Information, title, text, QMessageBox::Ok, Core::ICore::mainWindow()); 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())); mb->open(); } diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h index 1ba08c87629..33e379bc69c 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h @@ -128,7 +128,7 @@ private slots: void updateProgress(int progress); signals: - void finished(bool success = true); + void s60DeploymentFinished(bool success = true); void finishNow(bool success = true); void allFilesSent(); diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index 8c7c7e50199..7aa6b14c24e 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -506,8 +506,7 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f m_showImport(importEnabled), m_buildConfigurationTemplateUnchanged(true), m_shadowBuildCheckBoxVisible(false), - m_selected(0), - m_qtVersionId(-1) + m_selected(0) { QSettings *s = Core::ICore::settings(); QString sourceDir = QFileInfo(m_proFilePath).absolutePath(); diff --git a/src/plugins/qt4projectmanager/qt4target.h b/src/plugins/qt4projectmanager/qt4target.h index 898458679d6..956ceac9d30 100644 --- a/src/plugins/qt4projectmanager/qt4target.h +++ b/src/plugins/qt4projectmanager/qt4target.h @@ -201,7 +201,6 @@ private: bool m_buildConfigurationTemplateUnchanged; bool m_shadowBuildCheckBoxVisible; int m_selected; // Number of selected buildconfiguartions - int m_qtVersionId; // version id for "One Qt" entry }; } // namespace Qt4ProjectManager diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 557bb25cd7e..53788c861c0 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -3682,7 +3682,7 @@ int BaseTextEditorWidget::extraAreaWidth(int *markWidthPtr) const int markWidth = 0; if (d->m_marksVisible) { - markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing(); + markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing() + 2; // if (documentLayout->doubleMarkCount) // markWidth += fm.lineSpacing() / 3; @@ -3797,7 +3797,23 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e) if (TextBlockUserData *userData = static_cast(block.userData())) { if (d->m_marksVisible) { 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()) continue; const int height = fmLineSpacing - 1; @@ -4273,11 +4289,13 @@ void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e) void BaseTextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e) { - QTextCursor cursor = textCursor(); - const int position = cursor.position(); - if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false, true)) { - if (position - cursor.position() == 1 && selectBlockUp()) - return; + if (e->button() == Qt::LeftButton) { + QTextCursor cursor = textCursor(); + const int position = cursor.position(); + if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false, true)) { + if (position - cursor.position() == 1 && selectBlockUp()) + return; + } } QPlainTextEdit::mouseDoubleClickEvent(e); @@ -4427,12 +4445,22 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e) int n = d->extraAreaToggleMarkBlockNumber; d->extraAreaToggleMarkBlockNumber = -1; if (cursor.blockNumber() == n) { + if (TextBlockUserData *data = static_cast(cursor.block().userData())) { + foreach (ITextMark *mark, data->marks()) { + if (mark->clickable()) { + mark->clicked(); + return; + } + } + } + int line = n + 1; ITextEditor::MarkRequestKind kind; if (QApplication::keyboardModifiers() & Qt::ShiftModifier) kind = ITextEditor::BookmarkRequest; else kind = ITextEditor::BreakpointRequest; + emit editor()->markRequested(editor(), line, kind); } } diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h index 7910346d074..deade3e40ae 100644 --- a/src/plugins/texteditor/itexteditor.h +++ b/src/plugins/texteditor/itexteditor.h @@ -110,7 +110,8 @@ public: enum MarkRequestKind { BreakpointRequest, - BookmarkRequest + BookmarkRequest, + TaskMarkRequest }; signals: diff --git a/src/plugins/texteditor/itextmark.cpp b/src/plugins/texteditor/itextmark.cpp index 4aebbad154e..a999b6367e5 100644 --- a/src/plugins/texteditor/itextmark.cpp +++ b/src/plugins/texteditor/itextmark.cpp @@ -84,3 +84,11 @@ double ITextMark::widthFactor() const { return 1.0; } + +bool ITextMark::clickable() const +{ + return false; +} + +void ITextMark::clicked() +{} diff --git a/src/plugins/texteditor/itextmark.h b/src/plugins/texteditor/itextmark.h index 81ea17ceeef..48be8b0992c 100644 --- a/src/plugins/texteditor/itextmark.h +++ b/src/plugins/texteditor/itextmark.h @@ -75,6 +75,8 @@ public: void setPriority(Priority prioriy); virtual bool visible() const; virtual double widthFactor() const; + virtual bool clickable() const; + virtual void clicked(); private: int m_lineNumber; diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 7dd6261076f..b34e36deee9 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -162,7 +162,7 @@ WelcomeMode::WelcomeMode() : layout->addWidget(scrollArea); scrollArea->setWidget(m_welcomePage); scrollArea->setWidgetResizable(true); - m_welcomePage->setMinimumWidth(960); + m_welcomePage->setMinimumWidth(860); PluginManager *pluginManager = PluginManager::instance(); connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*))); diff --git a/src/tools/win64interrupt/win64interrupt.pro b/src/tools/win64interrupt/win64interrupt.pro index 74cd16344d9..0119b69f4ad 100644 --- a/src/tools/win64interrupt/win64interrupt.pro +++ b/src/tools/win64interrupt/win64interrupt.pro @@ -3,6 +3,15 @@ CONFIG -= qt app_bundle 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 TEMPLATE = app