diff options
author | Eike Ziller <eike.ziller@digia.com> | 2014-05-02 10:00:20 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2014-05-02 10:00:20 +0200 |
commit | 0fb641c90e64054a28a39e3f48d96f953399805a (patch) | |
tree | 504f097db01334a87316f8e825f1db0cba6bfba1 | |
parent | f4520bafaccb0832266f8d88f254e910ed7a23f4 (diff) | |
parent | 4b2cc015f867941a7ae35a38d81ec9daa5616711 (diff) |
Merge remote-tracking branch 'origin/3.1'
Conflicts:
qtcreator.pri
qtcreator.qbs
src/libs/qmljs/qmljsmodelmanagerinterface.cpp
src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
Change-Id: Ie216b715d6f87a6d72d3b8fe3d4e777e561579f9
64 files changed, 443 insertions, 246 deletions
diff --git a/doc/examples/accelbubble/main.qml b/doc/examples/accelbubble/main.qml index 80c961f78b..0f3d198941 100644 --- a/doc/examples/accelbubble/main.qml +++ b/doc/examples/accelbubble/main.qml @@ -79,6 +79,9 @@ ApplicationWindow { var newX = (bubble.x + calcRoll(accel.reading.x, accel.reading.y, accel.reading.z) * 0.1) var newY = (bubble.y - calcPitch(accel.reading.x, accel.reading.y, accel.reading.z) * 0.1) + if (isNaN(newX) || isNaN(newY)) + return; + if (newX < 0) newX = 0 diff --git a/doc/src/debugger/creator-debugger.qdoc b/doc/src/debugger/creator-debugger.qdoc index 1a78a06006..86a77f9808 100644 --- a/doc/src/debugger/creator-debugger.qdoc +++ b/doc/src/debugger/creator-debugger.qdoc @@ -614,6 +614,12 @@ view, making it seem like the program was interrupted before entering the function. + To find out which QML file is causing a Qt Quick 2 application to crash, + select \gui {Load QML Stack} in the context menu in the \gui{Stack} view. + The debugger tries to retrieve the JavaScript stack from the stopped + executable and prepends the frames to the C++ frames, should it find any. + You can click a frame in the QML stack to open the QML file in the editor. + \section1 Locals and Expressions Whenever a program stops under the control of the debugger, it retrieves diff --git a/doc/src/editors/creator-coding-edit-mode.qdoc b/doc/src/editors/creator-coding-edit-mode.qdoc index 4d7458abcd..15c4ac71d0 100644 --- a/doc/src/editors/creator-coding-edit-mode.qdoc +++ b/doc/src/editors/creator-coding-edit-mode.qdoc @@ -176,4 +176,18 @@ reparsed automatically. For all other files, you can use \gui{Tools} > \gui{C++} > \gui{Reparse Externally Changed Files} to update the code model. + + \section1 Inspecting the Code Model + + When you report a bug that is related to the C++ code model, the \QC + developers might ask you to write information about the internal state of + the code model into a log file and to deliver the file to them for + inspection. + + To view information about the C++ code model in the + \gui {C++ Code Model Inspector} dialog and write it to a log file, select + \gui Tools > \gui C++ > \gui {Inspect C++ Code Model} or press + \key {Ctrl+Shift+F12}. + + \QC generates the code model inspection log file in a temporary folder. */ diff --git a/doc/src/qtquick/creator-mobile-app-tutorial.qdoc b/doc/src/qtquick/creator-mobile-app-tutorial.qdoc index 483f9cd665..09713b4d83 100644 --- a/doc/src/qtquick/creator-mobile-app-tutorial.qdoc +++ b/doc/src/qtquick/creator-mobile-app-tutorial.qdoc @@ -196,6 +196,9 @@ \skipto onReadingChanged \printuntil } + We want to ensure that the position of the bubble is always within + the bounds of the screen. If the Accelerometer returns not a number + (NaN), the value is ignored and the bubble position is not updated. \li Add SmoothedAnimation behavior on the \a x and \a y properties of the bubble to make its movement look smoother. diff --git a/qbs/imports/QtcLibrary.qbs b/qbs/imports/QtcLibrary.qbs index 9de9cbb934..ec10919caa 100644 --- a/qbs/imports/QtcLibrary.qbs +++ b/qbs/imports/QtcLibrary.qbs @@ -27,7 +27,7 @@ DynamicLibrary { : ["$ORIGIN", "$ORIGIN/.."] property string libIncludeBase: ".." // #include <lib/header.h> cpp.includePaths: [libIncludeBase] - cpp.minimumWindowsVersion: "5.1" + cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2" Export { Depends { name: "cpp" } diff --git a/qbs/imports/QtcPlugin.qbs b/qbs/imports/QtcPlugin.qbs index a27c2fb270..3fb2b2c2ec 100644 --- a/qbs/imports/QtcPlugin.qbs +++ b/qbs/imports/QtcPlugin.qbs @@ -39,7 +39,7 @@ Product { property string pluginIncludeBase: ".." // #include <plugin/header.h> cpp.includePaths: [pluginIncludeBase] - cpp.minimumWindowsVersion: "5.1" + cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2" Group { name: "PluginSpec" diff --git a/qbs/imports/QtcTool.qbs b/qbs/imports/QtcTool.qbs index a08032fe39..0c1433df8d 100644 --- a/qbs/imports/QtcTool.qbs +++ b/qbs/imports/QtcTool.qbs @@ -18,7 +18,7 @@ Application { cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/../" + project.ide_library_path] : ["$ORIGIN/../" + project.ide_library_path] - cpp.minimumWindowsVersion: "5.1" + cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2" Group { fileTagsFilter: product.type diff --git a/qtcreator.qbs b/qtcreator.qbs index 6374b3f6a8..7cd9ca116b 100644 --- a/qtcreator.qbs +++ b/qtcreator.qbs @@ -45,7 +45,7 @@ Project { property string ide_bin_path: qbs.targetOS.contains("osx") ? ide_app_target + ".app/Contents/MacOS" : ide_app_path - property bool testsEnabled: qbs.getenv("TEST") || qbs.buildVariant === "debug" + property bool testsEnabled: qbs.getEnv("TEST") || qbs.buildVariant === "debug" property stringList generalDefines: [ "QT_CREATOR", 'IDE_LIBRARY_BASENAME="' + libDirName + '"', diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml index c73f9e9e4d..5e93a58819 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml @@ -156,8 +156,6 @@ ButtonRow { onClicked: { if (checked) { - anchorBackend.leftAnchored = false; - anchorBackend.rightAnchored = false; anchorBackend.topAnchored = false; anchorBackend.bottomAnchored = false; anchorBackend.verticalCentered = true; diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml index 5fe40b880d..78575d9f43 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml @@ -30,6 +30,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 as Controls import QtQuick.Layouts 1.0 +import QtQuick.Controls.Private 1.0 Item { id: buttonRowButton @@ -41,6 +42,8 @@ Item { signal clicked() + property string tooltip: "" + width: 24 + leftPadding height: 24 @@ -94,6 +97,7 @@ Item { } MouseArea { + id: mouseArea anchors.fill: parent anchors.leftMargin: leftPadding onClicked: { @@ -104,5 +108,16 @@ Item { } buttonRowButton.clicked() } + + onExited: Tooltip.hideText() + onCanceled: Tooltip.hideText() + + hoverEnabled: true + + Timer { + interval: 1000 + running: mouseArea.containsMouse && tooltip.length + onTriggered: Tooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), tooltip) + } } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml index 01b61e6147..63a21f6138 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml @@ -142,7 +142,7 @@ Column { } ColorCheckButton { id: checkButton - color: colorButton.color + color: backendendValue.value } ButtonRow { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml index d8dfdbe26d..0c1fd68bd4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml @@ -158,6 +158,15 @@ Rectangle { anchors.right: parent.right frameVisible: false + id: tabView + height: Math.max(layoutSectionHeight, specficsHeight) + + property int layoutSectionHeight + property int specficsOneHeight: 0 + property int specficsTwoHeight: 0 + + property int specficsHeight: Math.max(specficsOneHeight, specficsTwoHeight) + Tab { title: backendValues.className.value @@ -178,6 +187,10 @@ Rectangle { active = false active = true } + + onLoaded: { + tabView.specficsTwoHeight = specificsTwo.item.height + 40 + } } Loader { @@ -186,6 +199,10 @@ Rectangle { id: specificsOne; source: specificsUrl; + + onLoaded: { + tabView.specficsOneHeight = specificsOne.item.height + 40 + } } } } @@ -197,6 +214,10 @@ Rectangle { anchors.right: parent.right LayoutSection { + + Component.onCompleted: { + tabView.layoutSectionHeight = childrenRect.height + } } } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml index bd9c40aade..1437b56a56 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextEditSpecifics.qml @@ -84,6 +84,5 @@ Column { } TextInputSection { - showEchoMode: false } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml index 57f34ed665..b32d6d1bd5 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml @@ -37,7 +37,7 @@ Section { anchors.right: parent.right caption: qsTr("Text Input") - property bool showEchoMode: false + property bool isTextInput: false id: textInputSection SectionLayout { @@ -46,21 +46,23 @@ Section { Label { + visible: textInputSection.isTextInput text: qsTr("Input mask") } LineEdit { + visible: textInputSection.isTextInput backendValue: backendValues.inputMask Layout.fillWidth: true } Label { - visible: textInputSection.showEchoMode + visible: textInputSection.isTextInput text: qsTr("Echo mode") } ComboBox { - visible: textInputSection.showEchoMode + visible: textInputSection.isTextInput Layout.fillWidth: true backendValue: backendValues.echoMode scope: "TextInput" @@ -68,11 +70,13 @@ Section { } Label { + visible: textInputSection.isTextInput text: qsTr("Pass. char") toolTip: qsTr("Character displayed when users enter passwords.") } LineEdit { + visible: textInputSection.isTextInput backendValue: backendValues.passwordCharacter Layout.fillWidth: true } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml index 79ec6e5908..5270bc9618 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml @@ -70,7 +70,6 @@ Column { } TextInputSection { - showEchoMode: true - + isTextInput: true } } diff --git a/share/qtcreator/translations/qtcreator_ja.ts b/share/qtcreator/translations/qtcreator_ja.ts index 760d939501..cc043ece8e 100644 --- a/share/qtcreator/translations/qtcreator_ja.ts +++ b/share/qtcreator/translations/qtcreator_ja.ts @@ -14902,7 +14902,7 @@ Would you like to overwrite them?</source> </message> <message> <source>Find in This Directory...</source> - <translation>このディレクトを検索...</translation> + <translation>このディレクトリを検索...</translation> </message> <message> <source>Show in Explorer</source> diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 079116239a..5cb7b0a163 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -963,6 +963,41 @@ QmlLanguageBundles ModelManagerInterface::extendedBundles() const return m_extendedBundles; } +void ModelManagerInterface::maybeScan(const QStringList &importPaths, + Language::Enum defaultLanguage) +{ + QStringList pathToScan; + { + QMutexLocker l(&m_mutex); + foreach (QString importPath, importPaths) + if (!m_scannedPaths.contains(importPath)) { + pathToScan.append(importPath); + } + } + + if (pathToScan.count() > 1) { + QFuture<void> result = QtConcurrent::run(&ModelManagerInterface::importScan, + workingCopyInternal(), pathToScan, + this, defaultLanguage, + true); + + if (m_synchronizer.futures().size() > 10) { + QList<QFuture<void> > futures = m_synchronizer.futures(); + + m_synchronizer.clearFutures(); + + foreach (const QFuture<void> &future, futures) { + if (! (future.isFinished() || future.isCanceled())) + m_synchronizer.addFuture(future); + } + } + + m_synchronizer.addFuture(result); + + addTaskInternal(result, tr("Scanning QML Imports"), Constants::TASK_IMPORT_SCAN); + } +} + void ModelManagerInterface::updateImportPaths() { QStringList allImportPaths; @@ -1026,36 +1061,7 @@ void ModelManagerInterface::updateImportPaths() if (!m_shouldScanImports) return; - QStringList pathToScan; - { - QMutexLocker l(&m_mutex); - foreach (QString importPath, allImportPaths) - if (!m_scannedPaths.contains(importPath)) { - pathToScan.append(importPath); - } - } - - if (pathToScan.count() > 1) { - QFuture<void> result = QtConcurrent::run(&ModelManagerInterface::importScan, - workingCopyInternal(), pathToScan, - this, Language::Qml, - true); - - if (m_synchronizer.futures().size() > 10) { - QList<QFuture<void> > futures = m_synchronizer.futures(); - - m_synchronizer.clearFutures(); - - foreach (const QFuture<void> &future, futures) { - if (! (future.isFinished() || future.isCanceled())) - m_synchronizer.addFuture(future); - } - } - - m_synchronizer.addFuture(result); - - addTaskInternal(result, tr("Scanning QML Imports"), Constants::TASK_IMPORT_SCAN); - } + maybeScan(allImportPaths, Language::Qml); } ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfo() const diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index 7b018ab9ff..0dc2cb7142 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -244,6 +244,7 @@ protected: CPlusPlus::Snapshot snapshot, QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents); + void maybeScan(const QStringList &importPaths, Language::Enum defaultLanguage); void updateImportPaths(); void loadQmlTypeDescriptionsInternal(const QString &path); diff --git a/src/libs/ssh/ssh.qbs b/src/libs/ssh/ssh.qbs index e044ba16b6..6c22cabfec 100644 --- a/src/libs/ssh/ssh.qbs +++ b/src/libs/ssh/ssh.qbs @@ -44,7 +44,7 @@ QtcLibrary { "sshsendfacility.cpp", "sshsendfacility_p.h", ].concat(botanFiles) - property var useSystemBotan: qbs.getenv("USE_SYSTEM_BOTAN") === "1" + property var useSystemBotan: qbs.getEnv("USE_SYSTEM_BOTAN") === "1" property var botanIncludes: { var result = ["../3rdparty"]; if (useSystemBotan) diff --git a/src/plugins/clangcodemodel/clangcodemodel.qbs b/src/plugins/clangcodemodel/clangcodemodel.qbs index 170b720c4b..c2c8ed7034 100644 --- a/src/plugins/clangcodemodel/clangcodemodel.qbs +++ b/src/plugins/clangcodemodel/clangcodemodel.qbs @@ -11,7 +11,7 @@ QtcPlugin { Depends { name: "TextEditor" } Depends { name: "Utils" } - property string llvmInstallDir: qbs.getenv("LLVM_INSTALL_DIR") + property string llvmInstallDir: qbs.getEnv("LLVM_INSTALL_DIR") condition: llvmInstallDir && !llvmInstallDir.isEmpty property bool clangCompletion: true @@ -33,7 +33,7 @@ QtcPlugin { } // Find llvm-config* in PATH - var pathListString = qbs.getenv("PATH"); + var pathListString = qbs.getEnv("PATH"); var separator = qbs.hostOS.contains("windows") ? ";" : ":"; var pathList = pathListString.split(separator); for (var i = 0; i < llvmConfigVariants.length; ++i) { diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index 01d05e143c..1f18b1db31 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -224,17 +224,12 @@ bool CppEditorSupport::initialized() SemanticInfo CppEditorSupport::recalculateSemanticInfo() { m_futureSemanticInfo.cancel(); - - SemanticInfo::Source source = currentSource(false); - recalculateSemanticInfoNow(source, /*emitSignalWhenFinished=*/ false); - return m_lastSemanticInfo; + return recalculateSemanticInfoNow(currentSource(false), /*emitSignalWhenFinished=*/ false); } Document::Ptr CppEditorSupport::lastSemanticInfoDocument() const { - QMutexLocker locker(&m_lastSemanticInfoLock); - - return m_lastSemanticInfo.doc; + return semanticInfo().doc; } void CppEditorSupport::recalculateSemanticInfoDetached(ForceReason forceReason) @@ -348,17 +343,13 @@ void CppEditorSupport::onDocumentUpdated(Document::Ptr doc) setExtraDiagnostics(key, doc->diagnosticMessages()); } - // update semantic info in a future - if (!m_initialized || - (m_textEditor->widget()->isVisible() - && (m_lastSemanticInfo.doc.isNull() - || m_lastSemanticInfo.doc->translationUnit()->ast() == 0 - || m_lastSemanticInfo.doc->fileName() != fileName()))) { + // Update semantic info if necessary + if (!m_initialized || (m_textEditor->widget()->isVisible() && !isSemanticInfoValid())) { m_initialized = true; - recalculateSemanticInfoDetached(ForceDueToMissingSemanticInfo); + recalculateSemanticInfoDetached(ForceDueToInvalidSemanticInfo); } - // notify the editor that the document is updated + // Notify the editor that the document is updated emit documentUpdated(); } @@ -368,34 +359,18 @@ void CppEditorSupport::startHighlighting(ForceReason forceReason) return; if (m_highlightingSupport->requiresSemanticInfo()) { - Snapshot snapshot; - Document::Ptr doc; - unsigned revision; - bool forced; - bool complete; - - { - QMutexLocker locker(&m_lastSemanticInfoLock); - snapshot = m_lastSemanticInfo.snapshot; - doc = m_lastSemanticInfo.doc; - revision = m_lastSemanticInfo.revision; - forced = m_lastSemanticInfo.forced; - complete = m_lastSemanticInfo.complete; - } - - if (doc.isNull()) + const SemanticInfo info = semanticInfo(); + if (info.doc.isNull()) return; - if (!m_lastHighlightOnCompleteSemanticInfo) - forced = true; - - if (!forced && m_lastHighlightRevision == revision) + const bool forced = info.forced || !m_lastHighlightOnCompleteSemanticInfo; + if (!forced && m_lastHighlightRevision == info.revision) return; m_highlighter.cancel(); - m_highlighter = m_highlightingSupport->highlightingFuture(doc, snapshot); - m_lastHighlightRevision = revision; - m_lastHighlightOnCompleteSemanticInfo = complete; + m_highlighter = m_highlightingSupport->highlightingFuture(info.doc, info.snapshot); + m_lastHighlightRevision = info.revision; + m_lastHighlightOnCompleteSemanticInfo = info.complete; emit highlighterStarted(&m_highlighter, m_lastHighlightRevision); } else { const unsigned revision = editorRevision(); @@ -496,8 +471,7 @@ void CppEditorSupport::onCurrentEditorChanged() m_editorVisible = editorVisible; if (editorVisible) { m_editorGCTimer->stop(); - QMutexLocker locker(&m_lastSemanticInfoLock); - if (!m_lastSemanticInfo.doc) + if (!lastSemanticInfoDocument()) updateDocumentNow(); } else { m_editorGCTimer->start(EditorHiddenGCTimeout); @@ -510,8 +484,7 @@ void CppEditorSupport::releaseResources() m_highlighter.cancel(); m_highlighter = QFuture<TextEditor::HighlightingResult>(); snapshotUpdater()->releaseSnapshot(); - QMutexLocker semanticLocker(&m_lastSemanticInfoLock); - m_lastSemanticInfo = SemanticInfo(); + setSemanticInfo(SemanticInfo(), /*emitSignal=*/ false); m_lastHighlightOnCompleteSemanticInfo = true; } @@ -524,66 +497,54 @@ SemanticInfo::Source CppEditorSupport::currentSource(bool force) force); } -void CppEditorSupport::recalculateSemanticInfoNow(const SemanticInfo::Source &source, - bool emitSignalWhenFinished, - FuturizedTopLevelDeclarationProcessor *processor) +SemanticInfo CppEditorSupport::recalculateSemanticInfoNow(const SemanticInfo::Source &source, + bool emitSignalWhenFinished, + FuturizedTopLevelDeclarationProcessor *processor) { - SemanticInfo semanticInfo; + const SemanticInfo lastSemanticInfo = semanticInfo(); + SemanticInfo newSemanticInfo; - { - QMutexLocker locker(&m_lastSemanticInfoLock); - semanticInfo.revision = m_lastSemanticInfo.revision; - semanticInfo.forced = source.force; - - if (!source.force - && m_lastSemanticInfo.complete - && m_lastSemanticInfo.revision == source.revision - && m_lastSemanticInfo.doc - && m_lastSemanticInfo.doc->translationUnit()->ast() - && m_lastSemanticInfo.doc->fileName() == source.fileName) { - semanticInfo.snapshot = m_lastSemanticInfo.snapshot; // ### TODO: use the new snapshot. - semanticInfo.doc = m_lastSemanticInfo.doc; - } - } + newSemanticInfo.forced = source.force; + newSemanticInfo.revision = source.revision; + + // Try to reuse as much as possible from the last semantic info + if (!source.force + && lastSemanticInfo.complete + && lastSemanticInfo.revision == source.revision + && lastSemanticInfo.doc + && lastSemanticInfo.doc->translationUnit()->ast() + && lastSemanticInfo.doc->fileName() == source.fileName) { + newSemanticInfo.snapshot = lastSemanticInfo.snapshot; // ### TODO: use the new snapshot. + newSemanticInfo.doc = lastSemanticInfo.doc; - if (semanticInfo.doc.isNull()) { + // Otherwise reprocess document + } else { const QSharedPointer<SnapshotUpdater> snapshotUpdater = snapshotUpdater_internal(); - QTC_ASSERT(snapshotUpdater, return); - semanticInfo.snapshot = snapshotUpdater->snapshot(); - - if (semanticInfo.snapshot.contains(source.fileName)) { - Document::Ptr doc = semanticInfo.snapshot.preprocessedDocument(source.code, - source.fileName); - if (processor) - doc->control()->setTopLevelDeclarationProcessor(processor); - doc->check(); - if (processor && processor->isCanceled()) - semanticInfo.complete = false; - semanticInfo.doc = doc; - } else { - return; - } + QTC_ASSERT(snapshotUpdater, return newSemanticInfo); + newSemanticInfo.snapshot = snapshotUpdater->snapshot(); + QTC_ASSERT(newSemanticInfo.snapshot.contains(source.fileName), return newSemanticInfo); + Document::Ptr doc = newSemanticInfo.snapshot.preprocessedDocument(source.code, + source.fileName); + if (processor) + doc->control()->setTopLevelDeclarationProcessor(processor); + doc->check(); + if (processor && processor->isCanceled()) + newSemanticInfo.complete = false; + newSemanticInfo.doc = doc; } - if (semanticInfo.doc) { - TranslationUnit *translationUnit = semanticInfo.doc->translationUnit(); - AST * ast = translationUnit->ast(); - - FunctionDefinitionUnderCursor functionDefinitionUnderCursor(semanticInfo.doc->translationUnit()); - DeclarationAST *currentFunctionDefinition = functionDefinitionUnderCursor(ast, source.line, source.column); + // Update local uses for the document + TranslationUnit *translationUnit = newSemanticInfo.doc->translationUnit(); + AST *ast = translationUnit->ast(); + FunctionDefinitionUnderCursor functionDefinitionUnderCursor(newSemanticInfo.doc->translationUnit()); + const LocalSymbols useTable(newSemanticInfo.doc, + functionDefinitionUnderCursor(ast, source.line, source.column)); + newSemanticInfo.localUses = useTable.uses; - const LocalSymbols useTable(semanticInfo.doc, currentFunctionDefinition); - semanticInfo.revision = source.revision; - semanticInfo.localUses = useTable.uses; - } + // Update semantic info + setSemanticInfo(newSemanticInfo, emitSignalWhenFinished); - { - QMutexLocker locker(&m_lastSemanticInfoLock); - m_lastSemanticInfo = semanticInfo; - } - - if (emitSignalWhenFinished) - emit semanticInfoUpdated(semanticInfo); + return newSemanticInfo; } void CppEditorSupport::recalculateSemanticInfoDetached_helper(QFutureInterface<void> &future, SemanticInfo::Source source) @@ -592,6 +553,30 @@ void CppEditorSupport::recalculateSemanticInfoDetached_helper(QFutureInterface<v recalculateSemanticInfoNow(source, true, &processor); } +bool CppEditorSupport::isSemanticInfoValid() const +{ + const Document::Ptr document = lastSemanticInfoDocument(); + return document + && document->translationUnit()->ast() + && document->fileName() == fileName(); +} + +SemanticInfo CppEditorSupport::semanticInfo() const +{ + QMutexLocker locker(&m_lastSemanticInfoLock); + return m_lastSemanticInfo; +} + +void CppEditorSupport::setSemanticInfo(const SemanticInfo &semanticInfo, bool emitSignal) +{ + { + QMutexLocker locker(&m_lastSemanticInfoLock); + m_lastSemanticInfo = semanticInfo; + } + if (emitSignal) + emit semanticInfoUpdated(semanticInfo); +} + QSharedPointer<SnapshotUpdater> CppEditorSupport::snapshotUpdater_internal() const { QMutexLocker locker(&m_snapshotUpdaterLock); diff --git a/src/plugins/cpptools/cpptoolseditorsupport.h b/src/plugins/cpptools/cpptoolseditorsupport.h index f452304bfb..e0b6f9dddc 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.h +++ b/src/plugins/cpptools/cpptoolseditorsupport.h @@ -121,7 +121,7 @@ public: enum ForceReason { NoForce, - ForceDueToMissingSemanticInfo, + ForceDueToInvalidSemanticInfo, ForceDueEditorRequest }; @@ -192,11 +192,16 @@ private: }; SemanticInfo::Source currentSource(bool force); - void recalculateSemanticInfoNow(const SemanticInfo::Source &source, bool emitSignalWhenFinished, - FuturizedTopLevelDeclarationProcessor *processor = 0); + SemanticInfo recalculateSemanticInfoNow(const SemanticInfo::Source &source, + bool emitSignalWhenFinished, + FuturizedTopLevelDeclarationProcessor *processor = 0); void recalculateSemanticInfoDetached_helper(QFutureInterface<void> &future, SemanticInfo::Source source); + bool isSemanticInfoValid() const; + SemanticInfo semanticInfo() const; + void setSemanticInfo(const SemanticInfo &semanticInfo, bool emitSignal = true); + QSharedPointer<SnapshotUpdater> snapshotUpdater_internal() const; void setSnapshotUpdater_internal(const QSharedPointer<SnapshotUpdater> &updater); diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index c1f2cc74b5..9fa40c2fa0 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -249,7 +249,7 @@ void DebuggerItemManager::autoDetectGdbOrLldbDebuggers() } foreach (const QFileInfo &fi, suspects) { - if (fi.exists() && fi.isExecutable()) { + if (fi.exists() && fi.isExecutable() && !fi.isDir()) { FileName command = FileName::fromString(fi.absoluteFilePath()); if (findByCommand(command)) continue; diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp index 7e4e8ddf34..9f0c7e8604 100644 --- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp +++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp @@ -287,6 +287,9 @@ void MultiHighlighter::highlightBlock(const QString &text) QTextBlock documentBlock = currentDocument->findBlockByNumber( block.blockNumber() - m_editor->blockNumberForFileIndex(fileIndex)); + if (!documentBlock.isValid()) + return; + QList<QTextLayout::FormatRange> formats = documentBlock.layout()->additionalFormats(); setExtraAdditionalFormats(block, formats); } @@ -960,6 +963,8 @@ void SideBySideDiffEditorWidget::showDiff() blockNumber++; } } + leftText.replace(QLatin1Char('\r'), QLatin1Char(' ')); + rightText.replace(QLatin1Char('\r'), QLatin1Char(' ')); leftTexts += leftText; rightTexts += rightText; leftDocs.append(qMakePair(contextFileData.leftFileInfo, leftText)); diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 8a042d77dd..aebf366fe1 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -6179,7 +6179,7 @@ bool FakeVimHandler::Private::handleExPluginCommand(const ExCommand &cmd) commitCursor(); emit q->handleExCommandRequested(&handled, cmd); //qDebug() << "HANDLER REQUEST: " << cmd.cmd << handled; - if (handled) { + if (handled && (m_textedit || m_plaintextedit)) { pullCursor(); if (m_cursor.position() != pos) recordJump(pos); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 402b132b09..1f7864b544 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2401,8 +2401,7 @@ SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) if (cachedSubmoduleData.contains(workingDirectory)) return cachedSubmoduleData.value(workingDirectory); - QStringList allConfigs = - commandOutputFromLocal8Bit(readConfig(workingDirectory, QLatin1String("-l"))) + QStringList allConfigs = readConfigValue(workingDirectory, QLatin1String("-l")) .split(QLatin1Char('\n')); const QString submoduleLineStart = QLatin1String("submodule."); foreach (const QString &configLine, allConfigs) { @@ -3015,7 +3014,7 @@ QString GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArray &configVar) const { - QByteArray codecName = readConfig(workingDirectory, QLatin1String(configVar)).trimmed(); + QByteArray codecName = readConfigBytes(workingDirectory, QLatin1String(configVar)).trimmed(); // Set default commit encoding to 'UTF-8', when it's not set, // to solve displaying error of commit log with non-latin characters. if (codecName.isEmpty()) @@ -3023,6 +3022,15 @@ QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArra return QTextCodec::codecForName(codecName); } +// returns first line from log and removes it +static QByteArray shiftLogLine(QByteArray &logText) +{ + const int index = logText.indexOf('\n'); + const QByteArray res = logText.left(index); + logText.remove(0, index + 1); + return res; +} + bool GitClient::getCommitData(const QString &workingDirectory, QString *commitTemplate, CommitData &commitData, @@ -3109,19 +3117,20 @@ bool GitClient::getCommitData(const QString &workingDirectory, case AmendCommit: { // Amend: get last commit data as "SHA1<tab>author<tab>email<tab>message". QStringList args(QLatin1String("log")); - args << QLatin1String("--max-count=1") << QLatin1String("--pretty=format:%h\t%an\t%ae\t%B"); - const Utils::SynchronousProcessResponse sp = synchronousGit(repoDirectory, args, 0, - commitData.commitEncoding); - if (sp.result != Utils::SynchronousProcessResponse::Finished) { + args << QLatin1String("--max-count=1") << QLatin1String("--pretty=format:%h\n%an\n%ae\n%B"); + QByteArray outputText; + if (!fullySynchronousGit(repoDirectory, args, &outputText, 0, + VcsBasePlugin::SuppressCommandLogging)) { *errorMessage = tr("Cannot retrieve last commit data of repository \"%1\".").arg(repoDirectory); return false; } - QStringList values = sp.stdOut.split(QLatin1Char('\t')); - QTC_ASSERT(values.size() >= 4, return false); - commitData.amendSHA1 = values.takeFirst(); - commitData.panelData.author = values.takeFirst(); - commitData.panelData.email = values.takeFirst(); - *commitTemplate = values.join(QLatin1String("\t")); + QTextCodec *authorCodec = Utils::HostOsInfo::isWindowsHost() + ? QTextCodec::codecForName("UTF-8") + : commitData.commitEncoding; + commitData.amendSHA1 = QString::fromLatin1(shiftLogLine(outputText)); + commitData.panelData.author = authorCodec->toUnicode(shiftLogLine(outputText)); + commitData.panelData.email = authorCodec->toUnicode(shiftLogLine(outputText)); + *commitTemplate = commitData.commitEncoding->toUnicode(outputText); break; } case SimpleCommit: { @@ -3739,7 +3748,7 @@ bool GitClient::synchronousStashList(const QString &workingDirectory, return true; } -QByteArray GitClient::readConfig(const QString &workingDirectory, const QString &configVar) const +QByteArray GitClient::readConfigBytes(const QString &workingDirectory, const QString &configVar) const { QStringList arguments; arguments << QLatin1String("config") << configVar; @@ -3757,7 +3766,13 @@ QByteArray GitClient::readConfig(const QString &workingDirectory, const QString // Read a single-line config value, return trimmed QString GitClient::readConfigValue(const QString &workingDirectory, const QString &configVar) const { - return commandOutputFromLocal8Bit(readConfig(workingDirectory, configVar).trimmed()); + // msysGit always uses UTF-8 for configuration: + // https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Unicode-Support#convert-config-files + static QTextCodec *codec = Utils::HostOsInfo::isWindowsHost() + ? QTextCodec::codecForName("UTF-8") + : QTextCodec::codecForLocale(); + const QByteArray value = readConfigBytes(workingDirectory, configVar).trimmed(); + return Utils::SynchronousProcess::normalizeNewlines(codec->toUnicode(value)); } bool GitClient::cloneRepository(const QString &directory,const QByteArray &url) diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index ac964380f0..c95e7fef18 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -281,8 +281,6 @@ public: const QString &messge, QString *name, QString *errorMessage = 0); - QByteArray readConfig(const QString &workingDirectory, const QString &configVar) const; - QString readConfigValue(const QString &workingDirectory, const QString &configVar) const; QTextCodec *encoding(const QString &workingDirectory, const QByteArray &configVar) const; @@ -345,6 +343,7 @@ private slots: void fetchFinished(const QVariant &cookie); private: + QByteArray readConfigBytes(const QString &workingDirectory, const QString &configVar) const; QTextCodec *getSourceCodec(const QString &file) const; VcsBase::VcsBaseEditorWidget *findExistingVCSEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const; diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index 5c8a67cf47..75fb54eb34 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -362,7 +362,6 @@ int TaskFilterModel::rowCount(const QModelIndex &parent) const if (parent.isValid()) return 0; - updateMapping(); return m_mapping.count(); } @@ -455,7 +454,6 @@ void TaskFilterModel::handleReset() 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(); @@ -464,7 +462,6 @@ QModelIndex TaskFilterModel::mapFromSource(const QModelIndex &idx) const QModelIndex TaskFilterModel::mapToSource(const QModelIndex &index) const { - updateMapping(); int row = index.row(); if (row >= m_mapping.count()) return QModelIndex(); diff --git a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp index 28b0ad3158..735ce897f7 100644 --- a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp +++ b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp @@ -42,6 +42,18 @@ namespace QbsProjectManager { using namespace Constants; +static QString extractToolchainPrefix(QString *compilerName) +{ + QString prefix; + if (compilerName->endsWith(QLatin1String("-g++")) + || compilerName->endsWith(QLatin1String("-clang++"))) { + const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1; + prefix = compilerName->left(idx); + compilerName->remove(0, idx); + } + return prefix; +} + QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const { QTC_ASSERT(k, return defaultData); @@ -116,8 +128,18 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c } } Utils::FileName cxx = tc->compilerCommand(); - data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxx.toFileInfo().absolutePath()); - data.insert(QLatin1String(CPP_COMPILERNAME), cxx.toFileInfo().fileName()); + const QFileInfo cxxFileInfo = cxx.toFileInfo(); + QString compilerName = cxxFileInfo.fileName(); + const QString toolchainPrefix = extractToolchainPrefix(&compilerName); + if (!toolchainPrefix.isEmpty()) + data.insert(QLatin1String(CPP_TOOLCHAINPREFIX), toolchainPrefix); + data.insert(QLatin1String(CPP_COMPILERNAME), compilerName); + data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxxFileInfo.absolutePath()); + if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2013Flavor) { + const QLatin1String flags("/FS"); + data.insert(QLatin1String(CPP_PLATFORMCFLAGS), flags); + data.insert(QLatin1String(CPP_PLATFORMCXXFLAGS), flags); + } } return data; } diff --git a/src/plugins/qbsprojectmanager/qbsconstants.h b/src/plugins/qbsprojectmanager/qbsconstants.h index 40f8f4767d..82d070abd5 100644 --- a/src/plugins/qbsprojectmanager/qbsconstants.h +++ b/src/plugins/qbsprojectmanager/qbsconstants.h @@ -40,7 +40,10 @@ const char QBS_ARCHITECTURE[] = "qbs.architecture"; const char QBS_ENDIANNESS[] = "qbs.endianness"; const char QBS_TOOLCHAIN[] = "qbs.toolchain"; const char CPP_TOOLCHAINPATH[] = "cpp.toolchainInstallPath"; +const char CPP_TOOLCHAINPREFIX[] = "cpp.toolchainPrefix"; const char CPP_COMPILERNAME[] = "cpp.compilerName"; +const char CPP_PLATFORMCFLAGS[] = "cpp.platformCFlags"; +const char CPP_PLATFORMCXXFLAGS[] = "cpp.platformCxxFlags"; } // namespace Constants } // namespace QbsProjectManager diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp index 9d768db741..abeed42ccc 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp @@ -150,6 +150,12 @@ void QbsManager::addQtProfileFromKit(const QString &profileName, const ProjectEx return; qbs::QtEnvironment qtEnv; + const QList<ProjectExplorer::Abi> abi = qt->qtAbis(); + if (!abi.empty()) { + qtEnv.architecture = ProjectExplorer::Abi::toString(abi.first().architecture()); + if (abi.first().wordWidth() == 64) + qtEnv.architecture.append(QLatin1String("_64")); + } qtEnv.binaryPath = qt->binPath().toString(); if (qt->hasDebugBuild()) qtEnv.buildVariant << QLatin1String("debug"); diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 9152e85250..606c474450 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -1990,13 +1990,46 @@ void QmakeProFileNode::applyEvaluate(EvalResult evalResult, bool async) m_validParse = (evalResult == EvalOk); if (m_validParse) { + // create build_pass reader + QtSupport::ProFileReader *readerBuildPass = 0; + QStringList builds = m_readerExact->values(QLatin1String("BUILDS")); + if (builds.isEmpty()) { + readerBuildPass = m_readerExact; + } else { + QString build = builds.first(); + QHash<QString, QStringList> basevars; + QStringList basecfgs = m_readerExact->values(build + QLatin1String(".CONFIG")); + basecfgs += build; + basecfgs += QLatin1String("build_pass"); + basevars[QLatin1String("BUILD_PASS")] = QStringList(build); + QStringList buildname = m_readerExact->values(build + QLatin1String(".name")); + basevars[QLatin1String("BUILD_NAME")] = (buildname.isEmpty() ? QStringList(build) : buildname); + + readerBuildPass = m_project->createProFileReader(this); + readerBuildPass->setExtraVars(basevars); + readerBuildPass->setExtraConfigs(basecfgs); + + EvalResult evalResult = EvalOk; + if (ProFile *pro = readerBuildPass->parsedProFile(m_projectFilePath)) { + if (!readerBuildPass->accept(pro, QMakeEvaluator::LoadAll)) + evalResult = EvalPartial; + pro->deref(); + } else { + evalResult = EvalFail; + } + + if (evalResult != EvalOk) { + m_project->destroyProFileReader(readerBuildPass); + readerBuildPass = 0; + } + } // update TargetInformation - m_qmakeTargetInformation = targetInformation(m_readerExact); + m_qmakeTargetInformation = targetInformation(m_readerExact, readerBuildPass); m_resolvedMkspecPath = m_readerExact->resolvedMkSpec(); m_subProjectsNotToDeploy = subProjectsNotToDeploy; - setupInstallsList(m_readerExact); + setupInstallsList(readerBuildPass); QString buildDirectory = buildDir(); // update other variables @@ -2056,6 +2089,9 @@ void QmakeProFileNode::applyEvaluate(EvalResult evalResult, bool async) } } + if (readerBuildPass && readerBuildPass != m_readerExact) + m_project->destroyProFileReader(readerBuildPass); + if (m_varValues != newVarValues) { QmakeVariablesHash oldValues = m_varValues; m_varValues = newVarValues; @@ -2200,61 +2236,31 @@ QStringList QmakeProFileNode::subDirsPaths(QtSupport::ProFileReader *reader, QSt return subProjectPaths; } -TargetInformation QmakeProFileNode::targetInformation(QtSupport::ProFileReader *reader) const +TargetInformation QmakeProFileNode::targetInformation(QtSupport::ProFileReader *reader, QtSupport::ProFileReader *readerBuildPass) const { TargetInformation result; - if (!reader) + if (!reader || !readerBuildPass) return result; - QtSupport::ProFileReader *readerBP = 0; QStringList builds = reader->values(QLatin1String("BUILDS")); if (!builds.isEmpty()) { QString build = builds.first(); result.buildTarget = reader->value(build + QLatin1String(".target")); - - QHash<QString, QStringList> basevars; - QStringList basecfgs = reader->values(build + QLatin1String(".CONFIG")); - basecfgs += build; - basecfgs += QLatin1String("build_pass"); - basevars[QLatin1String("BUILD_PASS")] = QStringList(build); - QStringList buildname = reader->values(build + QLatin1String(".name")); - basevars[QLatin1String("BUILD_NAME")] = (buildname.isEmpty() ? QStringList(build) : buildname); - - readerBP = m_project->createProFileReader(this); - readerBP->setExtraVars(basevars); - readerBP->setExtraConfigs(basecfgs); - - EvalResult evalResult = EvalOk; - if (ProFile *pro = readerBP->parsedProFile(m_projectFilePath)) { - if (!readerBP->accept(pro, QMakeEvaluator::LoadAll)) - evalResult = EvalPartial; - pro->deref(); - } else { - evalResult = EvalFail; - } - - if (evalResult != EvalOk) - return result; - - reader = readerBP; } // BUILD DIR result.buildDir = buildDir(); - if (reader->contains(QLatin1String("DESTDIR"))) - result.destDir = reader->value(QLatin1String("DESTDIR")); + if (readerBuildPass->contains(QLatin1String("DESTDIR"))) + result.destDir = readerBuildPass->value(QLatin1String("DESTDIR")); // Target - result.target = reader->value(QLatin1String("TARGET")); + result.target = readerBuildPass->value(QLatin1String("TARGET")); if (result.target.isEmpty()) result.target = QFileInfo(m_projectFilePath).baseName(); result.valid = true; - if (readerBP) - m_project->destroyProFileReader(readerBP); - return result; } diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h index 7e5c3aa6dd..d179b001f3 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.h +++ b/src/plugins/qmakeprojectmanager/qmakenodes.h @@ -442,7 +442,7 @@ private: QStringList libDirectories(QtSupport::ProFileReader *reader) const; QStringList subDirsPaths(QtSupport::ProFileReader *reader, QStringList *subProjectsNotToDeploy, bool silent) const; - TargetInformation targetInformation(QtSupport::ProFileReader *reader) const; + TargetInformation targetInformation(QtSupport::ProFileReader *reader, QtSupport::ProFileReader *readerBuildPass) const; void setupInstallsList(const QtSupport::ProFileReader *reader); bool m_isDeployable; diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index ece9ad259a..2b1723f164 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -395,7 +395,6 @@ void SubComponentManager::registerQmlFile(const QFileInfo &fileInfo, const QStri itemLibraryEntry.setName(baseComponentName); itemLibraryEntry.setCategory("QML Components"); if (!qualifier.isEmpty()) { - itemLibraryEntry.setForceImport(true); itemLibraryEntry.setRequiredImport(fixedQualifier); } diff --git a/src/plugins/qmldesigner/qtquickplugin/source/listview.qml b/src/plugins/qmldesigner/qtquickplugin/source/listview.qml index 6c70227a7d..b270c047ab 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/listview.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/listview.qml @@ -52,6 +52,7 @@ ListView { } delegate: Item { + width: 80 height: 40 x: 5 Row { diff --git a/src/plugins/qmldesigner/qtquickplugin/source/listviewv2.qml b/src/plugins/qmldesigner/qtquickplugin/source/listviewv2.qml index b3e8c93d2d..013bfa6983 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/listviewv2.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/listviewv2.qml @@ -52,6 +52,7 @@ ListView { } delegate: Item { + width: 80 height: 40 x: 5 Row { diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp index db305eaea3..6f3318b1a6 100644 --- a/src/plugins/valgrind/memcheckerrorview.cpp +++ b/src/plugins/valgrind/memcheckerrorview.cpp @@ -198,6 +198,8 @@ static QString relativeToPath() static QString errorLocation(const QModelIndex &index, const Error &error, bool link = false, const QString &linkAttr = QString()) { + if (!index.isValid()) + return QString(); const ErrorListModel *model = 0; const QAbstractProxyModel *proxy = qobject_cast<const QAbstractProxyModel *>(index.model()); while (!model && proxy) { diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 292157a129..e1173a6b99 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -48,6 +48,7 @@ #include <extensionsystem/iplugin.h> #include <extensionsystem/pluginmanager.h> +#include <projectexplorer/deploymentdata.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/project.h> #include <projectexplorer/runconfiguration.h> @@ -144,6 +145,11 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel foreach (Project *project, SessionManager::projects()) { validFolders << project->projectDirectory(); foreach (Target *target, project->targets()) { + foreach (const ProjectExplorer::DeployableFile &file, + target->deploymentData().allFiles()) { + if (file.isExecutable()) + validFolders << file.remoteDirectory(); + } foreach (BuildConfiguration *config, target->buildConfigurations()) validFolders << config->buildDirectory().toString(); } diff --git a/src/plugins/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrindprocess.cpp index de74632441..a5d62a64de 100644 --- a/src/plugins/valgrind/valgrindprocess.cpp +++ b/src/plugins/valgrind/valgrindprocess.cpp @@ -142,7 +142,7 @@ void ValgrindProcess::run(const QString &valgrindExecutable, const QStringList & if (m_remote.m_connection->state() != QSsh::SshConnection::Connected) { connect(m_remote.m_connection, SIGNAL(connected()), this, SLOT(connected())); connect(m_remote.m_connection, SIGNAL(error(QSsh::SshError)), - this, SLOT(handelError(QSsh::SshError))); + this, SLOT(handleError(QSsh::SshError))); if (m_remote.m_connection->state() == QSsh::SshConnection::Unconnected) m_remote.m_connection->connectToHost(); } else { diff --git a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp index 280b2aec49..f5ac682c78 100644 --- a/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp +++ b/src/plugins/valgrind/xmlprotocol/errorlistmodel.cpp @@ -239,7 +239,7 @@ int ErrorListModel::rowCount(const QModelIndex &parent) const { if (parent.isValid()) return 0; - return qMax(1, d->errors.count()); + return d->errors.count(); } int ErrorListModel::columnCount(const QModelIndex &parent) const diff --git a/src/src.qbs b/src/src.qbs index d5dc32d041..f91f90212e 100644 --- a/src/src.qbs +++ b/src/src.qbs @@ -12,7 +12,7 @@ Project { ] property bool qbsSubModuleExists: File.exists(qbsProject.qbsBaseDir + "/qbs.qbs") - property path qbs_install_dir: qbs.getenv("QBS_INSTALL_DIR") + property path qbs_install_dir: qbs.getEnv("QBS_INSTALL_DIR") property bool useExternalQbs: qbs_install_dir property bool buildQbsProjectManager: useExternalQbs || qbsSubModuleExists Project { diff --git a/tests/system/objects.map b/tests/system/objects.map index 05e82c4f07..4dc2c30b09 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -35,6 +35,7 @@ :Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'} :Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'} :Breakpoints_Debugger::Internal::BreakTreeView {container=':DebugModeWidget.Breakpoints_QDockWidget' type='Debugger::Internal::BreakTreeView' unnamed='1' visible='1'} +:Build and Run.Save all files before build_QCheckBox {name='saveAllFilesCheckBox' type='QCheckBox' visible='1'} :BuildAndRun_QTreeView {container=':qt_tabwidget_stackedwidget_QWidget' type='QTreeView' unnamed='1' visible='1'} :CMake Wizard.Cancel_QPushButton {text='Cancel' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} :CMake Wizard.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'} @@ -148,7 +149,6 @@ :Qt Creator_Core::Internal::CommandComboBox {type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'} :Qt Creator_Core::Internal::NavComboBox {type='Core::Internal::NavComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:Qt Creator_Core::Internal::OutputPaneManageButton {type='Core::Internal::OutputPaneManageButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::Internal::ProgressBar {type='Core::Internal::ProgressBar' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} @@ -173,7 +173,6 @@ :Qt Creator_TextEditor::PlainTextEditorWidget {type='TextEditor::PlainTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit {container=':Qt Creator_Utils::NavigationTreeView' type='QExpandingLineEdit' unnamed='1' visible='1'} -:Qt Creator_VersionControl_Core::Internal::OutputPaneToggleButton {occurrence='6' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Gui Application.Form file:_QLabel {name='formLabel' text='Form file:' type='QLabel' visible='1' window=':Qt Gui Application_QmakeProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Header file:_QLabel {name='headerLabel' text='Header file:' type='QLabel' visible='1' window=':Qt Gui Application_QmakeProjectManager::Internal::GuiAppWizardDialog'} :Qt Gui Application.Source file:_QLabel {name='sourceLabel' text='Source file:' type='QLabel' visible='1' window=':Qt Gui Application_QmakeProjectManager::Internal::GuiAppWizardDialog'} @@ -189,6 +188,9 @@ :Revert to Saved_QMessageBox {text?='You will lose your current changes if you proceed reverting*' type='QMessageBox' unnamed='1' visible='1'} :RunSettingsEnvironmentDetails_Utils::DetailsButton {leftWidget=':RunSettingsUseBuildEnvironment_QLabel' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :RunSettingsUseBuildEnvironment_QLabel {text~='Us(e|ing) <b>Build Environment</b>' type='QLabel' unnamed='1' visible='1'} +:Save Changes.Always save files before build_QCheckBox {name='saveBeforeBuildCheckBox' text='Always save files before build' type='QCheckBox' visible='1' window=':Save Changes_Core::Internal::SaveItemsDialog'} +:Save Changes.Save All_QPushButton {text='Save All' type='QPushButton' unnamed='1' visible='1' window=':Save Changes_Core::Internal::SaveItemsDialog'} +:Save Changes_Core::Internal::SaveItemsDialog {name='Core__Internal__SaveItemsDialog' type='Core::Internal::SaveItemsDialog' visible='1' windowTitle='Save Changes'} :Select signal.signalList_QTreeWidget {container=':Go to slot.Select signal_QGroupBox' name='signalList' type='QTreeWidget' visible='1'} :Send to Codepaster.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Send to Codepaster_CodePaster::PasteView'} :Send to Codepaster.Description:_QLabel {name='descriptionLabel' text='Description:' type='QLabel' visible='1' window=':Send to Codepaster_CodePaster::PasteView'} diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index b9bdd11630..03efc084cb 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -81,7 +81,7 @@ def ensureChecked(objectName, shouldBeChecked = True, timeout=20000): # param expectedState is the expected enable state of the object def verifyEnabled(objectSpec, expectedState = True): if isinstance(objectSpec, (str, unicode)): - waitFor("object.exists('" + objectSpec + "')", 20000) + waitFor("object.exists('" + str(objectSpec).replace("'", "\\'") + "')", 20000) foundObject = findObject(objectSpec) else: foundObject = objectSpec @@ -633,13 +633,17 @@ def verifyItemOrder(items, text): lastIndex = index def openVcsLog(): - if not object.exists(":Qt Creator_VersionControl_Core::Internal::OutputPaneToggleButton"): - clickButton(waitForObject(":Qt Creator_Core::Internal::OutputPaneManageButton")) - if platform.system() == 'Darwin': - waitFor('macHackActivateContextMenuItem("Version Control")', 6000) - else: - activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1'}", "Version Control")) - ensureChecked(waitForObject(":Qt Creator_VersionControl_Core::Internal::OutputPaneToggleButton")) + try: + foundObj = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", 2000) + if className(foundObj) != 'QPlainTextEdit': + raise Exception("Found derived class, but not a pure QPlainTextEdit.") + except: + invokeMenuItem("Window", "Output Panes", "Version Control") + +def openGeneralMessages(): + if not object.exists(":Qt Creator_Core::OutputWindow"): + invokeMenuItem("Window", "Output Panes", "General Messages") # function that retrieves a specific child object by its class # this is sometimes the best way to avoid using waitForObject() on objects that diff --git a/tests/system/suite_APTW/tst_APTW01/test.py b/tests/system/suite_APTW/tst_APTW01/test.py index f626f44274..4eca2b2983 100644 --- a/tests/system/suite_APTW/tst_APTW01/test.py +++ b/tests/system/suite_APTW/tst_APTW01/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") # test New Qt Gui Application build and run for release and debug option def main(): diff --git a/tests/system/suite_APTW/tst_APTW02/test.py b/tests/system/suite_APTW/tst_APTW02/test.py index b1ced390a2..7569e64551 100644 --- a/tests/system/suite_APTW/tst_APTW02/test.py +++ b/tests/system/suite_APTW/tst_APTW02/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") # test New Qt Quick Application build and run for release and debug option def main(): diff --git a/tests/system/suite_CCOM/tst_CCOM01/test.py b/tests/system/suite_CCOM/tst_CCOM01/test.py index afdedb6524..e0b9016fef 100755 --- a/tests/system/suite_CCOM/tst_CCOM01/test.py +++ b/tests/system/suite_CCOM/tst_CCOM01/test.py @@ -27,7 +27,6 @@ ## ############################################################################# -source("../../shared/suites_qtta.py") source("../../shared/qtcreator.py") # entry of test diff --git a/tests/system/suite_CSUP/tst_CSUP02/test.py b/tests/system/suite_CSUP/tst_CSUP02/test.py index ee31b844cd..075eb15631 100644 --- a/tests/system/suite_CSUP/tst_CSUP02/test.py +++ b/tests/system/suite_CSUP/tst_CSUP02/test.py @@ -27,7 +27,6 @@ ## ############################################################################# -source("../../shared/suites_qtta.py") source("../../shared/qtcreator.py") # entry of test diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py index 10a7a07bba..16217a5297 100644 --- a/tests/system/suite_CSUP/tst_CSUP04/test.py +++ b/tests/system/suite_CSUP/tst_CSUP04/test.py @@ -27,7 +27,6 @@ ## ############################################################################# -source("../../shared/suites_qtta.py") source("../../shared/qtcreator.py") # entry of test diff --git a/tests/system/suite_CSUP/tst_CSUP05/test.py b/tests/system/suite_CSUP/tst_CSUP05/test.py index ccedda6d46..c853e37e52 100644 --- a/tests/system/suite_CSUP/tst_CSUP05/test.py +++ b/tests/system/suite_CSUP/tst_CSUP05/test.py @@ -27,7 +27,6 @@ ## ############################################################################# -source("../../shared/suites_qtta.py") source("../../shared/qtcreator.py") # entry of test diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index fa3ce0f0f4..951a32557c 100755 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") # test Qt Creator version information from file and dialog def getQtCreatorVersionFromDialog(): diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index caebc12b5a..69e8e0e956 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") import re # test search in help mode and advanced search diff --git a/tests/system/suite_HELP/tst_HELP05/test.py b/tests/system/suite_HELP/tst_HELP05/test.py index 611742733b..1b5d43bed7 100755 --- a/tests/system/suite_HELP/tst_HELP05/test.py +++ b/tests/system/suite_HELP/tst_HELP05/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") # test context sensitive help in edit mode # place cursor to <lineText> keyword, in <editorArea>, and verify help to contain <helpText> diff --git a/tests/system/suite_HELP/tst_HELP06/test.py b/tests/system/suite_HELP/tst_HELP06/test.py index cda0c7e33a..a42c0fe995 100755 --- a/tests/system/suite_HELP/tst_HELP06/test.py +++ b/tests/system/suite_HELP/tst_HELP06/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") # test bookmark functionality def renameBookmarkFolder(view, item, newName): diff --git a/tests/system/suite_QMLS/shared/qmls.py b/tests/system/suite_QMLS/shared/qmls.py index f4842f457d..e5a5140406 100644 --- a/tests/system/suite_QMLS/shared/qmls.py +++ b/tests/system/suite_QMLS/shared/qmls.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") def startQtCreatorWithNewAppAtQMLEditor(projectDir, projectName, line = None): startApplication("qtcreator" + SettingsPath) diff --git a/tests/system/suite_QMLS/tst_QMLS01/test.py b/tests/system/suite_QMLS/tst_QMLS01/test.py index ba01e09fa8..3e1c8d26b9 100644 --- a/tests/system/suite_QMLS/tst_QMLS01/test.py +++ b/tests/system/suite_QMLS/tst_QMLS01/test.py @@ -28,6 +28,7 @@ ############################################################################# source("../shared/qmls.py") +source("../../shared/suites_qtta.py") # go to proper line, make backup, type needed text def __beginTestSuggestions__(editorArea, lineText, textToType): diff --git a/tests/system/suite_QMLS/tst_QMLS02/test.py b/tests/system/suite_QMLS/tst_QMLS02/test.py index b0d2780275..21abe1edfa 100644 --- a/tests/system/suite_QMLS/tst_QMLS02/test.py +++ b/tests/system/suite_QMLS/tst_QMLS02/test.py @@ -28,6 +28,7 @@ ############################################################################# source("../shared/qmls.py") +source("../../shared/suites_qtta.py") def main(): editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "Text {") diff --git a/tests/system/suite_QMLS/tst_QMLS03/test.py b/tests/system/suite_QMLS/tst_QMLS03/test.py index a46a13999c..65fb9c6ede 100644 --- a/tests/system/suite_QMLS/tst_QMLS03/test.py +++ b/tests/system/suite_QMLS/tst_QMLS03/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") class ExpectedResult: def __init__(self, file, lineNumber, lineContent): diff --git a/tests/system/suite_SCOM/tst_SCOM01/test.py b/tests/system/suite_SCOM/tst_SCOM01/test.py index caf82c42e4..f5f359d988 100644 --- a/tests/system/suite_SCOM/tst_SCOM01/test.py +++ b/tests/system/suite_SCOM/tst_SCOM01/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") # entry of test def main(): diff --git a/tests/system/suite_SCOM/tst_SCOM05/test.py b/tests/system/suite_SCOM/tst_SCOM05/test.py index 4161697a7a..8431404aed 100644 --- a/tests/system/suite_SCOM/tst_SCOM05/test.py +++ b/tests/system/suite_SCOM/tst_SCOM05/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") def verifyChangeProject(projectName): projItem = invokeContextMenuOnProject(projectName, 'Set "%s" as Active Project' % projectName) diff --git a/tests/system/suite_editors/tst_delete_externally/test.py b/tests/system/suite_editors/tst_delete_externally/test.py index 9b08012ba8..5e9393ee9d 100644 --- a/tests/system/suite_editors/tst_delete_externally/test.py +++ b/tests/system/suite_editors/tst_delete_externally/test.py @@ -28,7 +28,6 @@ ############################################################################# source("../../shared/qtcreator.py") -source("../../shared/suites_qtta.py") global templateDir diff --git a/tests/system/suite_general/suite.conf b/tests/system/suite_general/suite.conf index 412a7bcdde..e5e8f93c06 100644 --- a/tests/system/suite_general/suite.conf +++ b/tests/system/suite_general/suite.conf @@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python OBJECTMAP=../objects.map -TEST_CASES=tst_build_speedcrunch tst_cmake_speedcrunch tst_create_proj_wizard tst_default_settings tst_installed_languages tst_openqt_creator tst_rename_file tst_session_handling +TEST_CASES=tst_build_speedcrunch tst_cmake_speedcrunch tst_create_proj_wizard tst_default_settings tst_installed_languages tst_openqt_creator tst_rename_file tst_save_before_build tst_session_handling VERSION=2 WRAPPERS=Qt diff --git a/tests/system/suite_general/tst_save_before_build/test.py b/tests/system/suite_general/tst_save_before_build/test.py new file mode 100644 index 0000000000..71c7839017 --- /dev/null +++ b/tests/system/suite_general/tst_save_before_build/test.py @@ -0,0 +1,73 @@ +############################################################################# +## +## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +## Contact: http://www.qt-project.org/legal +## +## This file is part of Qt Creator. +## +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. For licensing terms and +## conditions see http://qt.digia.com/licensing. For further information +## use the contact form at http://qt.digia.com/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 2.1 requirements +## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## In addition, as a special exception, Digia gives you certain additional +## rights. These rights are described in the Digia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +############################################################################# + +source("../../shared/qtcreator.py") + +def ensureSaveBeforeBuildChecked(shouldBeChecked): + invokeMenuItem("Tools", "Options...") + waitForObjectItem(":Options_QListView", "Build & Run") + clickItem(":Options_QListView", "Build & Run", 14, 15, 0, Qt.LeftButton) + clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "General") + if test.compare(waitForObject(":Build and Run.Save all files before build_QCheckBox").checked, + shouldBeChecked, "'Save all files before build' should be %s" % str(shouldBeChecked)): + clickButton(waitForObject(":Options.Cancel_QPushButton")) + else: + ensureChecked(":Build and Run.Save all files before build_QCheckBox", shouldBeChecked) + clickButton(waitForObject(":Options.OK_QPushButton")) + +def main(): + startApplication("qtcreator" + SettingsPath) + if not startedWithoutPluginError(): + return + ensureSaveBeforeBuildChecked(False) + # create qt quick application + createNewQtQuickApplication(tempDir(), "SampleApp", qtQuickVersion="2.2") + for expectDialog in [True, False]: + files = ["SampleApp.SampleApp\\.pro", + "SampleApp.deployment.deployment\\.pri", + "SampleApp.Sources.main\\.cpp", + "SampleApp.Resources.qml\.qrc./.main\\.qml"] + for i, file in enumerate(files): + if not openDocument(file): + test.fatal("Could not open file '%s'" % simpleFileName(file)) + continue + test.log("Changing file '%s'" % simpleFileName(file)) + typeLines(getEditorForFileSuffix(file), "") + # try to compile + clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton")) + try: + ensureChecked(":Save Changes.Always save files before build_QCheckBox", + i == len(files) - 1, 5000) # At the last iteration, check the box + clickButton(waitForObject(":Save Changes.Save All_QPushButton")) + test.verify(expectDialog, "The 'Save Changes' dialog was shown.") + except: + test.verify(not expectDialog, "The 'Save Changes' dialog was not shown.") + waitForCompile() + ensureSaveBeforeBuildChecked(True) + invokeMenuItem("File", "Exit") diff --git a/tests/system/suite_tools/tst_external_sort/test.py b/tests/system/suite_tools/tst_external_sort/test.py index d858ab7f36..b9506398ea 100644 --- a/tests/system/suite_tools/tst_external_sort/test.py +++ b/tests/system/suite_tools/tst_external_sort/test.py @@ -37,10 +37,11 @@ def main(): unsortedFile = os.path.join(os.getcwd(), "testdata", "unsorted.txt") sorted = getOutputFromCmdline("sort %s" % unsortedFile).replace("\r", "") selectFromFileDialog(unsortedFile) - invokeMenuItem("Edit", "Select All") - invokeMenuItem("Tools", "External", "Text", "Sort Selection") editor = waitForObject("{type='TextEditor::PlainTextEditorWidget' unnamed='1' " "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 3000) + placeCursorToLine(editor, "bbb") + invokeMenuItem("Edit", "Select All") + invokeMenuItem("Tools", "External", "Text", "Sort Selection") test.verify(waitFor("str(editor.plainText) == sorted", 2000), "Verify that sorted text\n%s\nmatches the expected text\n%s" % (editor.plainText, sorted)) invokeMenuItem('File', 'Revert "unsorted.txt" to Saved') diff --git a/tests/system/suite_tools/tst_git_clone/test.py b/tests/system/suite_tools/tst_git_clone/test.py index 0783165e7b..f526714b6a 100644 --- a/tests/system/suite_tools/tst_git_clone/test.py +++ b/tests/system/suite_tools/tst_git_clone/test.py @@ -33,14 +33,14 @@ cloneUrl = "https://codereview.qt-project.org/p/qt-labs/jom" cloneDir = "myCloneOfJom" def verifyCloneLog(targetDir, canceled): - finish = findObject(":Git Repository Clone.Finish_QPushButton") - waitFor("canceled or finish.enabled", 30000) if canceled: summary = "Failed." else: + finish = findObject(":Git Repository Clone.Finish_QPushButton") + waitFor("finish.enabled", 30000) cloneLog = str(waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit").plainText) - if "fatal: The remote end hung up unexpectedly" in cloneLog: - test.warning("Remote end hung up unexpectedly.") + if "fatal: " in cloneLog: + test.warning("Cloning failed outside Creator.") return False # test for QTCREATORBUG-10112 test.compare(cloneLog.count("remote: Counting objects:"), 1) @@ -52,9 +52,17 @@ def verifyCloneLog(targetDir, canceled): test.verify(("'" + cloneDir + "'..." in cloneLog), "Searching for clone directory in clone log") summary = "Succeeded." - resultLabel = findObject(":Git Repository Clone.Result._QLabel") - test.verify(waitFor('str(resultLabel.text) == summary', 3000), - "Verifying expected result (%s)" % summary) + try: + resultLabel = findObject(":Git Repository Clone.Result._QLabel") + test.verify(waitFor('str(resultLabel.text) == summary', 3000), + "Verifying expected result (%s)" % summary) + except: + if canceled: + test.warning("Could not find resultLabel", + "Cloning might have failed before clicking 'Cancel'") + return object.exists(":Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog") + else: + test.fail("Could not find resultLabel") return True def verifyVersionControlView(targetDir, canceled): @@ -101,7 +109,8 @@ def main(): # wait for cloning to have started waitFor('len(str(cloneLog.plainText)) > 20 + len(cloneDir)') clickButton(":Git Repository Clone.Cancel_QPushButton") - verifyCloneLog(targetDir, True) + if not verifyCloneLog(targetDir, True): + continue clickButton(":Git Repository Clone.Cancel_QPushButton") else: if not verifyCloneLog(targetDir, False): |