diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-05-26 15:12:42 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-05-26 15:12:42 +0200 |
commit | 3858c33d741cc0bfb120d528b0f3465e665c4bd5 (patch) | |
tree | c5fd6289f486a14e698940a40511fa4344a911da /src | |
parent | 03b92050e03bbc51f1d49d7dbce8116f23a0c66e (diff) | |
parent | b8038191e693f5649686d56b2192169ea1f53a25 (diff) |
Merge remote-tracking branch 'origin/3.4'
Change-Id: I35ba4cc7f7052699c3006545514c866be3cb5fdd
Diffstat (limited to 'src')
30 files changed, 220 insertions, 74 deletions
diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp index 4f44d61465..7c330ce330 100644 --- a/src/libs/3rdparty/cplusplus/Parser.cpp +++ b/src/libs/3rdparty/cplusplus/Parser.cpp @@ -42,6 +42,7 @@ #define CPLUSPLUS_NO_DEBUG_RULE #define MAX_EXPRESSION_DEPTH 100 #define MAX_STATEMENT_DEPTH 100 +#define MAX_INITIALIZER_CLAUSE_DEPTH 2000 using namespace CPlusPlus; @@ -2785,6 +2786,8 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node) ExpressionListAST **expression_list_ptr = &node; ExpressionAST *expression = 0; + _initializerClauseDepth.push(1); + if (parseInitializerClause0x(expression)) { *expression_list_ptr = new (_pool) ExpressionListAST; (*expression_list_ptr)->value = expression; @@ -2793,7 +2796,11 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node) if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COMMA || LA(2) == T_RBRACE || LA(2) == T_RPAREN)) consumeToken(); // ### create an argument pack - while (LA() == T_COMMA && LA(2) != T_RBRACE) { + for (++_initializerClauseDepth.top(); + LA() == T_COMMA + && LA(2) != T_RBRACE + && _initializerClauseDepth.top() <= MAX_INITIALIZER_CLAUSE_DEPTH; + ++_initializerClauseDepth.top()) { consumeToken(); // consume T_COMMA if (parseInitializerClause0x(expression)) { @@ -2808,7 +2815,11 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node) } } - return true; + const bool result = _initializerClauseDepth.top() <= MAX_INITIALIZER_CLAUSE_DEPTH; + _initializerClauseDepth.pop(); + if (!result) + warning(cursor(), "Reached parse limit for initializer clause"); + return result; } bool Parser::parseBracedInitList0x(ExpressionAST *&node) diff --git a/src/libs/3rdparty/cplusplus/Parser.h b/src/libs/3rdparty/cplusplus/Parser.h index 4a2a6dfb7e..7f7f2d28c0 100644 --- a/src/libs/3rdparty/cplusplus/Parser.h +++ b/src/libs/3rdparty/cplusplus/Parser.h @@ -27,6 +27,7 @@ #include "TranslationUnit.h" #include "MemoryPool.h" #include <map> +#include <stack> namespace CPlusPlus { @@ -321,6 +322,7 @@ private: bool _inExpressionStatement: 1; int _expressionDepth; int _statementDepth; + std::stack<int> _initializerClauseDepth; MemoryPool _expressionStatementTempPool; std::map<unsigned, TemplateArgumentListEntry> _templateArgumentList; diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index ed707cd163..f1add81b30 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -985,7 +985,7 @@ public: const ASTObjectValue *asAstObjectValue() const Q_DECL_OVERRIDE; - bool getSourceLocation(QString *fileName, int *line, int *column) const; + bool getSourceLocation(QString *fileName, int *line, int *column) const Q_DECL_OVERRIDE; void processMembers(MemberProcessor *processor) const Q_DECL_OVERRIDE; QString defaultPropertyName() const; @@ -1059,7 +1059,7 @@ public: virtual const Value *lookupMember(const QString &name, const Context *context, const ObjectValue **foundInObject = 0, - bool examinePrototypes = true) const; + bool examinePrototypes = true) const Q_DECL_OVERRIDE; void processMembers(MemberProcessor *processor) const Q_DECL_OVERRIDE; const TypeScope *asTypeScope() const Q_DECL_OVERRIDE; private: @@ -1073,7 +1073,7 @@ public: virtual const Value *lookupMember(const QString &name, const Context *context, const ObjectValue **foundInObject = 0, - bool examinePrototypes = true) const; + bool examinePrototypes = true) const Q_DECL_OVERRIDE; void processMembers(MemberProcessor *processor) const Q_DECL_OVERRIDE; const JSImportScope *asJSImportScope() const Q_DECL_OVERRIDE; private: diff --git a/src/libs/timeline/qml/timelineitems.vert b/src/libs/timeline/qml/timelineitems.vert index cea5b49cd4..f8cfb40adb 100644 --- a/src/libs/timeline/qml/timelineitems.vert +++ b/src/libs/timeline/qml/timelineitems.vert @@ -48,7 +48,7 @@ void main() // Make very narrow events somewhat wider so that they don't collapse into 0 pixels float scaledWidth = scale.x * rectSize.x; - float shift = sign(scaledWidth) * max(0.0, 3.0 - abs(scaledWidth)) * 0.0005; + float shift = sign(rectSize.x) * max(0.0, 3.0 - abs(scaledWidth)) * 0.0005; gl_Position.x += shift; // Ditto for events with very small height diff --git a/src/libs/timeline/timelineitemsrenderpass.cpp b/src/libs/timeline/timelineitemsrenderpass.cpp index 13668ebeb3..2165502b8d 100644 --- a/src/libs/timeline/timelineitemsrenderpass.cpp +++ b/src/libs/timeline/timelineitemsrenderpass.cpp @@ -216,7 +216,7 @@ static void updateNodes(int from, int to, const TimelineModel *model, for (int i = from; i < to; ++i) { qint64 start = qMax(parentState->start(), model->startTime(i)); qint64 end = qMin(parentState->end(), model->startTime(i) + model->duration(i)); - if (start >= end) + if (start > end) continue; float itemTop = (1.0 - model->relativeHeight(i)) * defaultRowHeight; @@ -244,7 +244,7 @@ static void updateNodes(int from, int to, const TimelineModel *model, for (int i = from; i < to; ++i) { qint64 start = qMax(parentState->start(), model->startTime(i)); qint64 end = qMin(parentState->end(), model->startTime(i) + model->duration(i)); - if (start >= end) + if (start > end) continue; QColor color = model->color(i); @@ -252,7 +252,8 @@ static void updateNodes(int from, int to, const TimelineModel *model, uchar green = color.green(); uchar blue = color.blue(); - float itemWidth = (end - start) * parentState->scale(); + float itemWidth = end > start ? (end - start) * parentState->scale() : + std::numeric_limits<float>::min(); float itemLeft = (start - parentState->start()) * parentState->scale(); // This has to be the exact same expression as above, to guarantee determinism. diff --git a/src/libs/timeline/timelinemodel.cpp b/src/libs/timeline/timelinemodel.cpp index 5498077bfd..0ebf16ddc2 100644 --- a/src/libs/timeline/timelinemodel.cpp +++ b/src/libs/timeline/timelinemodel.cpp @@ -586,8 +586,10 @@ void TimelineModel::clear() d->endTimes.clear(); if (hadRowHeights) emit expandedRowHeightChanged(-1, -1); - if (!wasEmpty) + if (!wasEmpty) { emit emptyChanged(); + emit heightChanged(); + } } int TimelineModel::nextItemBySelectionId(int selectionId, qint64 time, int currentItem) const diff --git a/src/libs/timeline/timelinerenderer.cpp b/src/libs/timeline/timelinerenderer.cpp index 4ddeee2019..538da57611 100644 --- a/src/libs/timeline/timelinerenderer.cpp +++ b/src/libs/timeline/timelinerenderer.cpp @@ -209,17 +209,11 @@ void TimelineRenderer::TimelineRendererPrivate::manageClicked() { Q_Q(TimelineRenderer); if (currentSelection.eventIndex != -1) { - if (currentSelection.eventIndex == selectedItem) - q->setSelectionLocked(!selectionLocked); - else - q->setSelectionLocked(true); - // itemPressed() will trigger an update of the events and JavaScript views. Make sure the // correct event is already selected when that happens, to prevent confusion. q->setSelectedItem(currentSelection.eventIndex); emit q->itemPressed(currentSelection.eventIndex); } else { - q->setSelectionLocked(false); q->setSelectedItem(-1); emit q->itemPressed(-1); } diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index 097771a2c2..9477f173bb 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -85,7 +85,6 @@ public: private: QPoint m_startPos; - QWidget *m_inner; TitleBarWidget *m_titleBar; QTimer m_timer; }; @@ -245,7 +244,7 @@ public: }; DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent) - : QDockWidget(parent), q(parent), m_inner(inner) + : QDockWidget(parent), q(parent) { setWidget(inner); setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable); @@ -288,7 +287,7 @@ bool DockWidget::eventFilter(QObject *, QEvent *event) int y = me->pos().y(); int x = me->pos().x(); int h = m_titleBar->m_floatButton->height(); - if (!isFloating() && 0 <= x && x < m_inner->width() && 0 <= y && y <= h) { + if (!isFloating() && widget() && 0 <= x && x < widget()->width() && 0 <= y && y <= h) { m_timer.start(); m_startPos = mapToGlobal(me->pos()); } diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp index 67bafd1a13..c533aa59bd 100644 --- a/src/plugins/beautifier/beautifierplugin.cpp +++ b/src/plugins/beautifier/beautifierplugin.cpp @@ -93,7 +93,7 @@ bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorSt m_tools << new Uncrustify::Uncrustify(this); Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID); - menu->menu()->setTitle(QLatin1String("Beautifier")); + menu->menu()->setTitle(QCoreApplication::translate("Beautifier", Constants::OPTION_TR_CATEGORY)); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); for (int i = 0, total = m_tools.count(); i < total; ++i) { diff --git a/src/plugins/clangcodemodel/clangcodemodel.qbs b/src/plugins/clangcodemodel/clangcodemodel.qbs index c0466e972b..e9a6c71fb2 100644 --- a/src/plugins/clangcodemodel/clangcodemodel.qbs +++ b/src/plugins/clangcodemodel/clangcodemodel.qbs @@ -53,7 +53,7 @@ QtcPlugin { property string llvmIncludeDir: QtcProcessOutputReader.readOutput(llvmConfig, ["--includedir"]) property string llvmLibDir: QtcProcessOutputReader.readOutput(llvmConfig, ["--libdir"]) property string llvmVersion: QtcProcessOutputReader.readOutput(llvmConfig, ["--version"]) - .replace(/(\d+\.\d+).*/, "$1") + .replace(/(\d+\.\d+\.\d+).*/, "$1") cpp.includePaths: base.concat(llvmIncludeDir) cpp.libraryPaths: base.concat(llvmLibDir) diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 447c337ff9..2178644e24 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -135,7 +135,13 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) : m_container->addWidget(empty); m_widgetEditorMap.insert(empty, 0); - auto dropSupport = new FileDropSupport(this, [this](QDropEvent *event) { + auto dropSupport = new FileDropSupport(this, [this](QDropEvent *event) -> bool { + // do not accept move events except from other editor views (i.e. their tool bars) + // otherwise e.g. item views that support moving items within themselves would + // also "move" the item into the editor view, i.e. the item would be removed from the + // item view + if (!qobject_cast<EditorToolBar*>(event->source())) + event->setDropAction(Qt::CopyAction); return event->source() != m_toolBar; // do not accept drops on ourselves }); connect(dropSupport, &FileDropSupport::filesDropped, diff --git a/src/plugins/coreplugin/find/searchresulttreemodel.cpp b/src/plugins/coreplugin/find/searchresulttreemodel.cpp index d7809160a2..b5f9c6741a 100644 --- a/src/plugins/coreplugin/find/searchresulttreemodel.cpp +++ b/src/plugins/coreplugin/find/searchresulttreemodel.cpp @@ -57,9 +57,21 @@ SearchResultTreeModel::~SearchResultTreeModel() void SearchResultTreeModel::setShowReplaceUI(bool show) { - beginResetModel(); m_showReplaceUI = show; - endResetModel(); + // We cannot send dataChanged for the whole hierarchy in one go, + // because all items in a dataChanged must have the same parent. + // Send dataChanged for each parent of children individually... + QList<QModelIndex> changeQueue; + changeQueue.append(QModelIndex()); + while (!changeQueue.isEmpty()) { + const QModelIndex current = changeQueue.takeFirst(); + int childCount = rowCount(current); + if (childCount > 0) { + emit dataChanged(index(0, 0, current), index(childCount - 1, 0, current)); + for (int r = 0; r < childCount; ++r) + changeQueue.append(index(r, 0, current)); + } + } } void SearchResultTreeModel::setTextEditorFont(const QFont &font, const SearchResultColor &color) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index de312975cb..7d7953cd17 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -670,7 +670,8 @@ void MainWindow::registerDefaultActions() // Show Sidebar Action m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)), - tr(Constants::TR_SHOW_SIDEBAR), this); + QCoreApplication::translate("Core", Constants::TR_SHOW_SIDEBAR), + this); m_toggleSideBarAction->setCheckable(true); cmd = ActionManager::registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR); cmd->setAttribute(Command::CA_UpdateText); diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 790657dbd8..d262591c56 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -40,6 +40,7 @@ #include "id.h" #include "imode.h" +#include <QCoreApplication> #include <QDebug> #include <QSettings> @@ -222,9 +223,9 @@ void NavigationWidget::updateToggleText() d->m_toggleSideBarAction->setEnabled(haveData && NavigationWidgetPlaceHolder::m_current); if (isShown()) - d->m_toggleSideBarAction->setToolTip(tr(Constants::TR_HIDE_SIDEBAR)); + d->m_toggleSideBarAction->setToolTip(QCoreApplication::translate("Core", Constants::TR_HIDE_SIDEBAR)); else - d->m_toggleSideBarAction->setToolTip(tr(Constants::TR_SHOW_SIDEBAR)); + d->m_toggleSideBarAction->setToolTip(QCoreApplication::translate("Core", Constants::TR_SHOW_SIDEBAR)); } void NavigationWidget::placeHolderChanged(NavigationWidgetPlaceHolder *holder) diff --git a/src/plugins/cppeditor/CppEditor.mimetypes.xml b/src/plugins/cppeditor/CppEditor.mimetypes.xml index 77d80cc81a..6cfde7a735 100644 --- a/src/plugins/cppeditor/CppEditor.mimetypes.xml +++ b/src/plugins/cppeditor/CppEditor.mimetypes.xml @@ -1,5 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> + <mime-type type="text/x-csrc"> + <comment>C source code</comment> + <sub-class-of type="text/plain"/> + <alias type="text/x-c"/> + <glob pattern="*.c" case-sensitive="true"/> + </mime-type> + <mime-type type="text/vnd.nvidia.cuda.csrc"> <sub-class-of type="text/x-csrc"/> <comment>NVIDIA CUDA C source code</comment> diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 7370b88ef0..ea738e756b 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -114,7 +114,7 @@ void CppHighlighter::highlightBlock(const QString &text) const unsigned firstNonSpace = tokens.first().utf16charsBegin(); Parentheses parentheses; - parentheses.reserve(20); // assume wizard level ;-) + parentheses.reserve(5); bool expectPreprocessorKeyword = false; bool onlyHighlightComments = false; diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 9fd0a82909..fbf5760df7 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -42,6 +42,7 @@ #include "cppsourceprocessor.h" #include "cpptoolsconstants.h" #include "cpptoolsplugin.h" +#include "cpptoolsreuse.h" #include "editordocumenthandle.h" #include <coreplugin/documentmanager.h> @@ -585,15 +586,38 @@ QByteArray CppModelManager::codeModelConfiguration() const return QByteArray::fromRawData(pp_configuration, qstrlen(pp_configuration)); } +static QSet<QString> tooBigFilesRemoved(const QSet<QString> &files, int fileSizeLimit) +{ + if (fileSizeLimit == 0) + return files; + + QSet<QString> result; + QFileInfo fileInfo; + + QSetIterator<QString> i(files); + while (i.hasNext()) { + const QString filePath = i.next(); + fileInfo.setFile(filePath); + if (skipFileDueToSizeLimit(fileInfo), fileSizeLimit) + continue; + + result << filePath; + } + + return result; +} + QFuture<void> CppModelManager::updateSourceFiles(const QSet<QString> &sourceFiles, ProgressNotificationMode mode) { if (sourceFiles.isEmpty() || !d->m_indexerEnabled) return QFuture<void>(); + const auto filteredFiles = tooBigFilesRemoved(sourceFiles, fileSizeLimit()); + if (d->m_indexingSupporter) - d->m_indexingSupporter->refreshSourceFiles(sourceFiles, mode); - return d->m_internalIndexingSupport->refreshSourceFiles(sourceFiles, mode); + d->m_indexingSupporter->refreshSourceFiles(filteredFiles, mode); + return d->m_internalIndexingSupport->refreshSourceFiles(filteredFiles, mode); } QList<ProjectInfo> CppModelManager::projectInfos() const diff --git a/src/plugins/cpptools/cppsourceprocessor.cpp b/src/plugins/cpptools/cppsourceprocessor.cpp index 4f292c0a34..036435d692 100644 --- a/src/plugins/cpptools/cppsourceprocessor.cpp +++ b/src/plugins/cpptools/cppsourceprocessor.cpp @@ -31,6 +31,7 @@ #include "cppsourceprocessor.h" #include "cppmodelmanager.h" +#include "cpptoolsreuse.h" #include <coreplugin/editormanager/editormanager.h> @@ -454,6 +455,10 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In return; } + const QFileInfo info(absoluteFileName); + if (skipFileDueToSizeLimit(info)) + return; // TODO: Add diagnostic message + // Otherwise get file contents unsigned editorRevision = 0; QByteArray contents; @@ -473,7 +478,6 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In Document::Include inc(include, include, 0, IncludeLocal); document->addIncludeFile(inc); } - const QFileInfo info(absoluteFileName); if (info.exists()) document->setLastModified(info.lastModified()); diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp index 44fa431931..05e5f86830 100644 --- a/src/plugins/cpptools/cpptoolsreuse.cpp +++ b/src/plugins/cpptools/cpptoolsreuse.cpp @@ -38,6 +38,7 @@ #include <cplusplus/LookupContext.h> #include <utils/qtcassert.h> +#include <QDebug> #include <QSet> #include <QStringRef> #include <QTextCursor> @@ -250,4 +251,33 @@ TextEditor::TextEditorWidget::Link linkToSymbol(Symbol *symbol) return Link(filename, line, column); } +int fileSizeLimit() +{ + static const QByteArray fileSizeLimitAsByteArray = qgetenv("QTC_CPP_FILE_SIZE_LIMIT_MB"); + static int fileSizeLimitAsInt = -1; + + if (fileSizeLimitAsInt == -1) { + bool ok; + const int limit = fileSizeLimitAsByteArray.toInt(&ok); + fileSizeLimitAsInt = ok && limit >= 0 ? limit : 0; + } + + return fileSizeLimitAsInt; +} + +bool skipFileDueToSizeLimit(const QFileInfo &fileInfo, int limitInMB) +{ + if (limitInMB == 0) // unlimited + return false; + + const int fileSizeInMB = fileInfo.size() * 1000 * 1000; + if (fileSizeInMB > limitInMB) { + qWarning() << "Files to process limited by QTC_CPP_FILE_SIZE_LIMIT_MB, skipping" + << fileInfo.absoluteFilePath(); + return true; + } + + return false; +} + } // CppTools diff --git a/src/plugins/cpptools/cpptoolsreuse.h b/src/plugins/cpptools/cpptoolsreuse.h index 8881c6198a..f8954111c0 100644 --- a/src/plugins/cpptools/cpptoolsreuse.h +++ b/src/plugins/cpptools/cpptoolsreuse.h @@ -39,6 +39,7 @@ QT_BEGIN_NAMESPACE class QChar; +class QFileInfo; class QStringRef; class QTextCursor; QT_END_NAMESPACE @@ -74,6 +75,9 @@ const CPlusPlus::Macro CPPTOOLS_EXPORT *findCanonicalMacro(const QTextCursor &cu QString CPPTOOLS_EXPORT correspondingHeaderOrSource(const QString &fileName, bool *wasHeader = 0); void CPPTOOLS_EXPORT switchHeaderSource(); +int fileSizeLimit(); +bool skipFileDueToSizeLimit(const QFileInfo &fileInfo, int limitInMB = fileSizeLimit()); + } // CppTools #endif // CPPTOOLSREUSE_H diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 93ee101b89..7c9d7b1d62 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -1185,11 +1185,14 @@ void Breakpoint::gotoLocation() const if (b->m_params.type == BreakpointByAddress) { engine->gotoLocation(b->m_params.address); } else { - // Don't use gotoLocation as this ends up in disassembly - // if OperateByInstruction is on. + // Don't use gotoLocation unconditionally as this ends up in + // disassembly if OperateByInstruction is on. But fallback + // to disassembly if we can't open the file. const QString file = QDir::cleanPath(b->markerFileName()); - IEditor *editor = EditorManager::openEditor(file); - editor->gotoLine(b->markerLineNumber(), 0); + if (IEditor *editor = EditorManager::openEditor(file)) + editor->gotoLine(b->markerLineNumber(), 0); + else + engine->openDisassemblerView(Location(b->m_response.address)); } } } @@ -1329,11 +1332,12 @@ BreakpointItem::~BreakpointItem() void BreakpointItem::destroyMarker() { - BreakpointMarker *m = m_marker; - QTC_ASSERT(m, return); - m->m_bp = 0; - m_marker = 0; - delete m; + if (m_marker) { + BreakpointMarker *m = m_marker; + m->m_bp = 0; + m_marker = 0; + delete m; + } } QString BreakpointItem::markerFileName() const diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 3c29346452..6512bf4df5 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1241,15 +1241,15 @@ void WatchHandler::insertItem(WatchItem *item) void WatchModel::insertItem(WatchItem *item) { - WatchItem *existing = findItem(item->iname); - if (existing) + WatchItem *parent = findItem(parentName(item->iname)); + QTC_ASSERT(parent, return); + + if (WatchItem *existing = parent->findItem(item->iname)) takeItem(existing); //item->walkTree([item](TreeItem *sub) { sub->sortChildren(&watchItemSorter); }); item->sortChildren(&watchItemSorter); - WatchItem *parent = findItem(parentName(item->iname)); - QTC_ASSERT(parent, return); const int row = findInsertPosition(parent->children(), item); parent->insertChild(row, item); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 626f49debd..2fb9705df2 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -231,7 +231,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) connect(remoteHelpFilter, SIGNAL(linkActivated(QUrl)), this, SLOT(showLinkInHelpMode(QUrl))); - QDesktopServices::setUrlHandler(QLatin1String("qthelp"), this, "handleHelpRequest"); + QDesktopServices::setUrlHandler(QLatin1String("qthelp"), HelpManager::instance(), "handleHelpRequest"); connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)), this, SLOT(modeChanged(Core::IMode*,Core::IMode*))); @@ -367,24 +367,37 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom) factories.insert(QLatin1String("textbrowser"), []() { return new TextBrowserHelpViewer(); }); ViewerFactory factory; + // TODO: Visual Studio < 2013 has a bug in std::function's operator bool, which in this case + // leads to succeeding boolean checks on factory which should not succeed. + // So we may not check against "if (!factory)" + bool factoryFound = false; + // check requested backend const QString backend = QLatin1String(qgetenv("QTC_HELPVIEWER_BACKEND")); if (!backend.isEmpty()) { - factory = factories.value(backend); - if (!factory) + if (!factories.contains(backend)) { qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend)); + } else { + factory = factories.value(backend); + factoryFound = true; + } } // default setting #ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT - if (!factory) + if (!factoryFound && factories.contains(QLatin1String("native"))) { factory = factories.value(QLatin1String("native")); + factoryFound = true; + } #endif - if (!factory) + if (!factoryFound && factories.contains(QLatin1String("qtwebkit"))) { factory = factories.value(QLatin1String("qtwebkit")); - if (!factory) + factoryFound = true; + } + if (!factoryFound && factories.contains(QLatin1String("textbrowser"))) { factory = factories.value(QLatin1String("textbrowser")); - - QTC_ASSERT(factory, return 0); + factoryFound = true; + } + QTC_ASSERT(factoryFound, return 0); HelpViewer *viewer = factory(); // initialize font diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp index ced702260f..552736b291 100644 --- a/src/plugins/help/helpwidget.cpp +++ b/src/plugins/help/helpwidget.cpp @@ -53,6 +53,7 @@ #include <utils/qtcassert.h> #include <utils/styledbar.h> +#include <QCoreApplication> #include <QHBoxLayout> #include <QHelpEngine> #include <QHelpSearchEngine> @@ -131,15 +132,18 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget } if (style != SideBarWidget) { m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)), - tr(Core::Constants::TR_SHOW_SIDEBAR), toolBar); + QCoreApplication::translate("Core", Core::Constants::TR_SHOW_SIDEBAR), + toolBar); m_toggleSideBarAction->setCheckable(true); m_toggleSideBarAction->setChecked(false); cmd = Core::ActionManager::registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, context); connect(m_toggleSideBarAction, &QAction::toggled, m_toggleSideBarAction, [this](bool checked) { - m_toggleSideBarAction->setText(checked ? tr(Core::Constants::TR_HIDE_SIDEBAR) - : tr(Core::Constants::TR_SHOW_SIDEBAR)); + m_toggleSideBarAction->setText( + QCoreApplication::translate("Core", + checked ? Core::Constants::TR_HIDE_SIDEBAR + : Core::Constants::TR_SHOW_SIDEBAR)); }); addSideBar(); m_toggleSideBarAction->setChecked(m_sideBar->isVisibleTo(this)); diff --git a/src/plugins/help/qtwebkithelpviewer.cpp b/src/plugins/help/qtwebkithelpviewer.cpp index fe2c0d5647..b4d1d33724 100644 --- a/src/plugins/help/qtwebkithelpviewer.cpp +++ b/src/plugins/help/qtwebkithelpviewer.cpp @@ -294,11 +294,6 @@ void QtWebKitHelpWidget::scaleDown() setZoomFactor(qMax(qreal(0.0), zoomFactor() - qreal(0.1))); } -void QtWebKitHelpWidget::setOpenInNewPageActionVisible(bool visible) -{ - m_openInNewPageActionVisible = visible; -} - // -- public slots void QtWebKitHelpWidget::copy() @@ -567,7 +562,7 @@ void QtWebKitHelpViewer::addForwardHistoryItems(QMenu *forwardMenu) void QtWebKitHelpViewer::setOpenInNewPageActionVisible(bool visible) { - m_webView->setOpenInNewPageActionVisible(visible); + m_webView->pageAction(QWebPage::OpenLinkInNewWindow)->setVisible(visible); } bool QtWebKitHelpViewer::findText(const QString &text, FindFlags flags, diff --git a/src/plugins/help/qtwebkithelpviewer.h b/src/plugins/help/qtwebkithelpviewer.h index 669455fcb9..18759e38c1 100644 --- a/src/plugins/help/qtwebkithelpviewer.h +++ b/src/plugins/help/qtwebkithelpviewer.h @@ -110,8 +110,6 @@ public: void scaleUp(); void scaleDown(); - void setOpenInNewPageActionVisible(bool visible); - public slots: void copy(); @@ -134,7 +132,6 @@ private: bool eventFilter(QObject *obj, QEvent *event); QtWebKitHelpViewer *m_parent; - bool m_openInNewPageActionVisible; }; class HelpPage : public QWebPage diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp index 1c5037650b..1a6ccf2cd2 100644 --- a/src/plugins/projectexplorer/msvcparser.cpp +++ b/src/plugins/projectexplorer/msvcparser.cpp @@ -35,7 +35,8 @@ #include <utils/qtcassert.h> #include <utils/fileutils.h> -static const char FILE_POS_PATTERN[] = "(cl|LINK|.+) : "; +// As of MSVC 2015: "foo.cpp(42) :" -> "foo.cpp(42):" +static const char FILE_POS_PATTERN[] = "(cl|LINK|.+[^ ]) ?: "; static const char ERROR_PATTERN[] = "[A-Z]+\\d\\d\\d\\d ?:"; static QPair<Utils::FileName, int> parseFileName(const QString &input) @@ -232,6 +233,16 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data() Constants::TASK_CATEGORY_COMPILE)) << QString(); + QTest::newRow("labeled error-2015") + << QString::fromLatin1("qmlstandalone\\main.cpp(54): error C4716: 'findUnresolvedModule' : must return a value") << OutputParserTester::STDOUT + << QString() << QString() + << (QList<Task>() + << Task(Task::Error, + QLatin1String("C4716: 'findUnresolvedModule' : must return a value"), + Utils::FileName::fromUserInput(QLatin1String("qmlstandalone\\main.cpp")), 54, + Constants::TASK_CATEGORY_COMPILE)) + << QString(); + QTest::newRow("labeled warning") << QString::fromLatin1("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp(69) : warning C4100: 'something' : unreferenced formal parameter") << OutputParserTester::STDOUT << QString() << QString() diff --git a/src/plugins/projectexplorer/outputparser_test.cpp b/src/plugins/projectexplorer/outputparser_test.cpp index f39a67f75d..0ac1b3182d 100644 --- a/src/plugins/projectexplorer/outputparser_test.cpp +++ b/src/plugins/projectexplorer/outputparser_test.cpp @@ -37,6 +37,13 @@ namespace ProjectExplorer { +static inline QByteArray msgFileComparisonFail(const Utils::FileName &f1, const Utils::FileName &f2) +{ + const QString result = QLatin1Char('"') + f1.toUserOutput() + + QLatin1String("\" != \"") + f2.toUserOutput() + QLatin1Char('"'); + return result.toLocal8Bit(); +} + OutputParserTester::OutputParserTester() : m_debug(false) { } @@ -83,7 +90,8 @@ void OutputParserTester::testParsing(const QString &lines, for (int i = 0; i < tasks.size(); ++i) { QCOMPARE(m_receivedTasks.at(i).category, tasks.at(i).category); QCOMPARE(m_receivedTasks.at(i).description, tasks.at(i).description); - QCOMPARE(m_receivedTasks.at(i).file, tasks.at(i).file); + QVERIFY2(m_receivedTasks.at(i).file == tasks.at(i).file, + msgFileComparisonFail(m_receivedTasks.at(i).file, tasks.at(i).file)); QCOMPARE(m_receivedTasks.at(i).line, tasks.at(i).line); QCOMPARE(static_cast<int>(m_receivedTasks.at(i).type), static_cast<int>(tasks.at(i).type)); } @@ -103,7 +111,8 @@ void OutputParserTester::testTaskMangling(const Task &input, if (m_receivedTasks.size() == 1) { QCOMPARE(m_receivedTasks.at(0).category, output.category); QCOMPARE(m_receivedTasks.at(0).description, output.description); - QCOMPARE(m_receivedTasks.at(0).file, output.file); + QVERIFY2(m_receivedTasks.at(0).file == output.file, + msgFileComparisonFail(m_receivedTasks.at(0).file, output.file)); QCOMPARE(m_receivedTasks.at(0).line, output.line); QCOMPARE(m_receivedTasks.at(0).type, output.type); } diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index d92bb738d6..1aa9ec6b87 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -306,7 +306,9 @@ void QmlProfilerFileReader::loadEventData(QXmlStreamReader &stream) if (elementName == _("bindingType") || elementName == _("cacheEventType") || elementName == _("sgEventType") || - elementName == _("memoryEventType")) { + elementName == _("memoryEventType") || + elementName == _("mouseEvent") || + elementName == _("keyEvent")) { event.detailType = readData.toInt(); break; } @@ -540,16 +542,29 @@ void QmlProfilerFileWriter::save(QIODevice *device) if (!event.data.isEmpty()) stream.writeTextElement(_("details"), event.data); - if (event.rangeType == Binding) + if (event.rangeType == Binding) { stream.writeTextElement(_("bindingType"), QString::number(event.detailType)); - if (event.message == Event && event.detailType == AnimationFrame) - stream.writeTextElement(_("animationFrame"), QString::number(event.detailType)); - if (event.message == PixmapCacheEvent) + } else if (event.message == Event) { + switch (event.detailType) { + case AnimationFrame: + stream.writeTextElement(_("animationFrame"), QString::number(event.detailType)); + break; + case Key: + stream.writeTextElement(_("keyEvent"), QString::number(event.detailType)); + break; + case Mouse: + stream.writeTextElement(_("mouseEvent"), QString::number(event.detailType)); + break; + default: + break; + } + } else if (event.message == PixmapCacheEvent) { stream.writeTextElement(_("cacheEventType"), QString::number(event.detailType)); - if (event.message == SceneGraphFrame) + } else if (event.message == SceneGraphFrame) { stream.writeTextElement(_("sgEventType"), QString::number(event.detailType)); - if (event.message == MemoryAllocation) + } else if (event.message == MemoryAllocation) { stream.writeTextElement(_("memoryEventType"), QString::number(event.detailType)); + } stream.writeEndElement(); incrementProgress(); } diff --git a/src/shared/qbs b/src/shared/qbs -Subproject 198ca15c5df6c0514cbe43f43d8d05640ac888b +Subproject 760dc4ef7571e780489adcd51ddb80beb000bd2 |