From fd54a377fed0e925678c6572b786ae371cd64aef Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 14 Dec 2017 15:29:03 +0100 Subject: [PATCH 01/17] Add make target for creating packages with debug info Add a script that creates either a release binary package, or a package with debug info, from a Qt Creator build with CONFIG+=force_debug_info CONFIG+=separate_debug_info Run "make bindist_installer" for the release package and "make bindist_debug" for the package with only debug info. First step for QTCREATORBUG-13002 Change-Id: I9d45db7f41f4af956221f6feb7c4e8ca7154892e Reviewed-by: Iikka Eklund Reviewed-by: Orgad Shaneh --- qtcreator.pro | 15 +++---- scripts/createDistPackage.py | 76 ++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 7 deletions(-) create mode 100755 scripts/createDistPackage.py diff --git a/qtcreator.pro b/qtcreator.pro index b5f48709cd0..3fa3ac2ed71 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -110,7 +110,6 @@ linux { macx { APPBUNDLE = "$$OUT_PWD/bin/Qt Creator.app" BINDIST_SOURCE = "$$OUT_PWD/bin/Qt Creator.app" - BINDIST_INSTALLER_SOURCE = $$BINDIST_SOURCE deployqt.commands = $$PWD/scripts/deployqtHelper_mac.sh \"$${APPBUNDLE}\" \"$$[QT_INSTALL_BINS]\" \"$$[QT_INSTALL_TRANSLATIONS]\" \"$$[QT_INSTALL_PLUGINS]\" \"$$[QT_INSTALL_IMPORTS]\" \"$$[QT_INSTALL_QML]\" codesign.commands = codesign --deep -s \"$(SIGNING_IDENTITY)\" $(SIGNING_FLAGS) \"$${APPBUNDLE}\" dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin $${BASENAME}.dmg @@ -118,7 +117,7 @@ macx { QMAKE_EXTRA_TARGETS += codesign dmg } else { BINDIST_SOURCE = "$(INSTALL_ROOT)$$QTC_PREFIX" - BINDIST_INSTALLER_SOURCE = "$$BINDIST_SOURCE/*" + BINDIST_EXCLUDE_ARG = "--exclude-toplevel" deployqt.commands = python -u $$PWD/scripts/deployqt.py -i \"$(INSTALL_ROOT)$$QTC_PREFIX\" \"$(QMAKE)\" deployqt.depends = install win32 { @@ -138,10 +137,12 @@ isEmpty(INSTALLER_ARCHIVE_FROM_ENV) { INSTALLER_ARCHIVE = $$OUT_PWD/$$(INSTALLER_ARCHIVE) } -#bindist.depends = deployqt -bindist.commands = 7z a -mx9 $$OUT_PWD/$${BASENAME}.7z \"$$BINDIST_SOURCE\" -#bindist_installer.depends = deployqt -bindist_installer.commands = 7z a -mx9 $${INSTALLER_ARCHIVE} \"$$BINDIST_INSTALLER_SOURCE\" +INSTALLER_ARCHIVE_DEBUG = $$INSTALLER_ARCHIVE +INSTALLER_ARCHIVE_DEBUG ~= s/(.*)[.]7z/\1-debug.7z + +bindist.commands = $$PWD/scripts/createDistPackage.py $$OUT_PWD/$${BASENAME}.7z \"$$BINDIST_SOURCE\" +bindist_installer.commands = $$PWD/scripts/createDistPackage.py $$BINDIST_EXCLUDE_ARG $${INSTALLER_ARCHIVE} \"$$BINDIST_SOURCE\" +bindist_debug.commands = $$PWD/scripts/createDistPackage.py --debug $$BINDIST_EXCLUDE_ARG $${INSTALLER_ARCHIVE_DEBUG} \"$$BINDIST_SOURCE\" win32 { deployqt.commands ~= s,/,\\\\,g @@ -149,4 +150,4 @@ win32 { bindist_installer.commands ~= s,/,\\\\,g } -QMAKE_EXTRA_TARGETS += deployqt bindist bindist_installer +QMAKE_EXTRA_TARGETS += deployqt bindist bindist_installer bindist_debug diff --git a/scripts/createDistPackage.py b/scripts/createDistPackage.py new file mode 100755 index 00000000000..0e68cfd6a0a --- /dev/null +++ b/scripts/createDistPackage.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +############################################################################ +# +# Copyright (C) 2018 The Qt Company Ltd. +# Contact: https://www.qt.io/licensing/ +# +# 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 The Qt Company. For licensing terms +# and conditions see https://www.qt.io/terms-conditions. For further +# information use the contact form at https://www.qt.io/contact-us. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 3 as published by the Free Software +# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-3.0.html. +# +############################################################################ + +import argparse +import os +import shutil +import subprocess +import tempfile + +import common + +def parse_arguments(): + parser = argparse.ArgumentParser(description="Create Qt Creator package, filtering out debug information files.") + parser.add_argument('--7z', help='path to 7z binary', + default='7z.exe' if common.is_windows_platform() else '7z', + metavar='<7z_binary>', dest='sevenzip') + parser.add_argument('--debug', help='package only the files with debug information', + dest='debug', action='store_true', default=False) + parser.add_argument('--exclude-toplevel', help='do not include the toplevel source directory itself in the resulting archive, only its contents', + dest='exclude_toplevel', action='store_true', default=False) + parser.add_argument('target_archive', help='output 7z file to create') + parser.add_argument('source_directory', help='source directory with the Qt Creator installation') + return parser.parse_args() + +def is_debug_file(filepath): + if common.is_mac_platform(): + return filepath.endswith('.dSYM') or '.dSYM/' in filepath + elif common.is_linux_platform(): + return filepath.endswith('.debug') + else: + return filepath.endswith('.pdb') + +def is_debug(path, filenames): + return [fn for fn in filenames if is_debug_file(os.path.join(path, fn))] + +def is_not_debug(path, filenames): + files = [fn for fn in filenames if os.path.isfile(os.path.join(path, fn))] + return [fn for fn in files if not is_debug_file(os.path.join(path, fn))] + +def main(): + arguments = parse_arguments() + tempdir_base = tempfile.mkdtemp() + tempdir = os.path.join(tempdir_base, os.path.basename(arguments.source_directory)) + try: + common.copytree(arguments.source_directory, tempdir, + ignore=(is_not_debug if arguments.debug else is_debug)) + zip_source = os.path.join(tempdir, '*') if arguments.exclude_toplevel else tempdir + subprocess.check_call([arguments.sevenzip, 'a', '-mx9', + arguments.target_archive, zip_source]) + finally: + shutil.rmtree(tempdir_base) +if __name__ == "__main__": + main() From b8ee51fef170e221d8370c211760db45c23773a6 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 16 Jan 2018 22:45:10 +0200 Subject: [PATCH 02/17] DiffEditor: Simplify makePatch tests a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I205bda692dbb5f759ca84dd5cf4b73da9601a7b5 Reviewed-by: André Hartmann Reviewed-by: Tobias Hunger --- src/plugins/diffeditor/diffeditorplugin.cpp | 39 +++------------------ 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index 6d6aa0715c5..c3bfbdb0948 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -618,8 +618,6 @@ static inline QString _(const char *string) { return QString::fromLatin1(string) void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() { QTest::addColumn("sourceChunk"); - QTest::addColumn("leftFileName"); - QTest::addColumn("rightFileName"); QTest::addColumn("lastChunk"); QTest::addColumn("patchText"); @@ -635,8 +633,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "-ABCD\n" " EFGH\n"; QTest::newRow("Simple not a last chunk") << chunk - << fileName - << fileName << false << patchText; @@ -649,8 +645,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("Simple last chunk") << chunk - << fileName - << fileName << true << patchText; @@ -666,8 +660,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("EOL in last line removed") << chunk - << fileName - << fileName << true << patchText; @@ -679,8 +671,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "-\n"; QTest::newRow("Last empty line removed") << chunk - << fileName - << fileName << false << patchText; @@ -698,8 +688,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("Two last EOLs removed") << chunk - << fileName - << fileName << true << patchText; @@ -715,8 +703,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+ABCD\n"; QTest::newRow("EOL to last line added") << chunk - << fileName - << fileName << true << patchText; @@ -728,8 +714,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+\n"; QTest::newRow("Last empty line added") << chunk - << fileName - << fileName << false << patchText; @@ -743,8 +727,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+EFGH\n"; QTest::newRow("Last line with a newline modified") << chunk - << fileName - << fileName << false << patchText; @@ -759,8 +741,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+EFGH\n" " \n"; QTest::newRow("Not a last line with a newline modified") << chunk - << fileName - << fileName << false << patchText; @@ -776,8 +756,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("Last line without a newline modified") << chunk - << fileName - << fileName << true << patchText; @@ -788,8 +766,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "-ABCD\n" "+EFGH\n"; QTest::newRow("Not a last line without a newline modified") << chunk - << fileName - << fileName << false << patchText; @@ -807,8 +783,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() QTest::newRow("Last but one line modified, last line without a newline") << chunk - << fileName - << fileName << true << patchText; @@ -822,8 +796,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() QTest::newRow("Last but one line modified, last line with a newline") << chunk - << fileName - << fileName << false << patchText; @@ -842,8 +814,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() QTest::newRow("Blank line followed by No newline") << chunk - << fileName - << fileName << true << patchText; } @@ -851,12 +821,11 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() void DiffEditor::Internal::DiffEditorPlugin::testMakePatch() { QFETCH(ChunkData, sourceChunk); - QFETCH(QString, leftFileName); - QFETCH(QString, rightFileName); QFETCH(bool, lastChunk); QFETCH(QString, patchText); - const QString result = DiffUtils::makePatch(sourceChunk, leftFileName, rightFileName, lastChunk); + const QString fileName = "a.txt"; + const QString result = DiffUtils::makePatch(sourceChunk, fileName, fileName, lastChunk); QCOMPARE(result, patchText); @@ -867,8 +836,8 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch() QCOMPARE(resultList.count(), 1); for (int i = 0; i < resultList.count(); i++) { const FileData &resultFileData = resultList.at(i); - QCOMPARE(resultFileData.leftFileInfo.fileName, leftFileName); - QCOMPARE(resultFileData.rightFileInfo.fileName, rightFileName); + QCOMPARE(resultFileData.leftFileInfo.fileName, fileName); + QCOMPARE(resultFileData.rightFileInfo.fileName, fileName); QCOMPARE(resultFileData.chunks.count(), 1); for (int j = 0; j < resultFileData.chunks.count(); j++) { const ChunkData &resultChunkData = resultFileData.chunks.at(j); From 6bc12ff4464d4921029d45770541d5ad20c54630 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Tue, 16 Jan 2018 22:20:07 +0200 Subject: [PATCH 03/17] DiffEditor: Replace bool arguments with flags enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I70262476d015ba5b73069b149093dac66f7c6008 Reviewed-by: André Hartmann Reviewed-by: Tobias Hunger --- src/plugins/diffeditor/diffeditorcontroller.cpp | 5 +++-- src/plugins/diffeditor/diffeditorcontroller.h | 8 +++++++- src/plugins/git/gitclient.cpp | 7 +++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/plugins/diffeditor/diffeditorcontroller.cpp b/src/plugins/diffeditor/diffeditorcontroller.cpp index f75f4620054..c64da4562d7 100644 --- a/src/plugins/diffeditor/diffeditorcontroller.cpp +++ b/src/plugins/diffeditor/diffeditorcontroller.cpp @@ -71,9 +71,10 @@ QString DiffEditorController::revisionFromDescription() const return m_document->description().mid(7, 12); } -QString DiffEditorController::makePatch(bool revert, bool addPrefix) const +QString DiffEditorController::makePatch(PatchOptions options) const { - return m_document->makePatch(m_diffFileIndex, m_chunkIndex, revert, addPrefix); + return m_document->makePatch(m_diffFileIndex, m_chunkIndex, + options & Revert, options & AddPrefix); } Core::IDocument *DiffEditorController::findOrCreateDocument(const QString &vcsId, diff --git a/src/plugins/diffeditor/diffeditorcontroller.h b/src/plugins/diffeditor/diffeditorcontroller.h index b6c8fd77a6f..ebe1151ce1e 100644 --- a/src/plugins/diffeditor/diffeditorcontroller.h +++ b/src/plugins/diffeditor/diffeditorcontroller.h @@ -53,7 +53,13 @@ public: QString revisionFromDescription() const; - QString makePatch(bool revert, bool addPrefix = false) const; + enum PatchOption { + NoOption = 0, + Revert = 1, + AddPrefix = 2 + }; + Q_DECLARE_FLAGS(PatchOptions, PatchOption) + QString makePatch(PatchOptions options) const; static Core::IDocument *findOrCreateDocument(const QString &vcsId, const QString &displayName); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index a5111435af5..5e7ee1e2262 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -617,7 +617,8 @@ void GitClient::slotStageChunk() if (m_contextController.isNull()) return; - const QString patch = m_contextController->makePatch(false, true); + DiffEditorController::PatchOptions options = DiffEditorController::AddPrefix; + const QString patch = m_contextController->makePatch(options); if (patch.isEmpty()) return; @@ -629,7 +630,9 @@ void GitClient::slotUnstageChunk() if (m_contextController.isNull()) return; - const QString patch = m_contextController->makePatch(true, true); + DiffEditorController::PatchOptions options = DiffEditorController::AddPrefix; + options |= DiffEditorController::Revert; + const QString patch = m_contextController->makePatch(options); if (patch.isEmpty()) return; From 6fe933b63aeaec0fe84ca1fbef142e6fd4811310 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 17 Jan 2018 09:18:36 +0100 Subject: [PATCH 04/17] Bookmark: Store line text trimmed Change-Id: I6f96210db20a8d18b5ceb5f6a3b529ea8d2bc0c5 Reviewed-by: Nikolai Kosjar --- src/plugins/bookmarks/bookmark.cpp | 5 +++-- src/plugins/bookmarks/bookmarkmanager.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/bookmarks/bookmark.cpp b/src/plugins/bookmarks/bookmark.cpp index dd8f71fb03e..e35b702b8f9 100644 --- a/src/plugins/bookmarks/bookmark.cpp +++ b/src/plugins/bookmarks/bookmark.cpp @@ -79,8 +79,9 @@ void Bookmark::move(int line) void Bookmark::updateBlock(const QTextBlock &block) { - if (m_lineText != block.text()) { - m_lineText = block.text(); + const QString &lineText = block.text().trimmed(); + if (m_lineText != lineText) { + m_lineText = lineText; m_manager->updateBookmark(this); } } diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 3ced12e1791..0977134fbd2 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -198,7 +198,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti QString lineText = index.data(BookmarkManager::Note).toString().trimmed(); if (lineText.isEmpty()) - lineText = index.data(BookmarkManager::LineText).toString().trimmed(); + lineText = index.data(BookmarkManager::LineText).toString(); painter->drawText(6, opt.rect.top() + fm.ascent() + fm.height() + 6, lineText); From f9a3ac7f08b183044a04251fdda2cef1a344cc67 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 15 Jan 2018 10:35:17 +0100 Subject: [PATCH 05/17] QmlProfiler: Also handle RunControl::finished() signal If you force-stop an application by closing the output tab, we don't get a stopped() signal. In order to properly reset the UI we need to handle the finished() signal then. Change-Id: Ibab5faf86542a59c3eb3aa139bb3dc66afe89ce2 Reviewed-by: hjk Reviewed-by: Christian Kandeler --- src/plugins/qmlprofiler/qmlprofilertool.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 9cfc21d6a76..c27303b433a 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -373,10 +373,16 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker) } } - connect(runControl, &RunControl::stopped, this, [this, runControl] { + auto handleStop = [this, runControl]() { d->m_toolBusy = false; updateRunActions(); disconnect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop); + }; + + connect(runControl, &RunControl::stopped, this, handleStop); + connect(runControl, &RunControl::finished, this, [this, runControl, handleStop] { + if (d->m_toolBusy) + handleStop(); }); connect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop); From 45f1547ffe1cf9633003cbd1d1c4f000130679c1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 17 Jan 2018 12:06:15 +0100 Subject: [PATCH 06/17] Do not run python scripts directly, but through python executable There are some (Windows) setups that do not support this. Change-Id: I85ba6bf7eebe0d900b9befd3c42ba8de5b64973d Reviewed-by: Orgad Shaneh --- qtcreator.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qtcreator.pro b/qtcreator.pro index 3fa3ac2ed71..d8a95fc2223 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -140,9 +140,9 @@ isEmpty(INSTALLER_ARCHIVE_FROM_ENV) { INSTALLER_ARCHIVE_DEBUG = $$INSTALLER_ARCHIVE INSTALLER_ARCHIVE_DEBUG ~= s/(.*)[.]7z/\1-debug.7z -bindist.commands = $$PWD/scripts/createDistPackage.py $$OUT_PWD/$${BASENAME}.7z \"$$BINDIST_SOURCE\" -bindist_installer.commands = $$PWD/scripts/createDistPackage.py $$BINDIST_EXCLUDE_ARG $${INSTALLER_ARCHIVE} \"$$BINDIST_SOURCE\" -bindist_debug.commands = $$PWD/scripts/createDistPackage.py --debug $$BINDIST_EXCLUDE_ARG $${INSTALLER_ARCHIVE_DEBUG} \"$$BINDIST_SOURCE\" +bindist.commands = python -u $$PWD/scripts/createDistPackage.py $$OUT_PWD/$${BASENAME}.7z \"$$BINDIST_SOURCE\" +bindist_installer.commands = python -u $$PWD/scripts/createDistPackage.py $$BINDIST_EXCLUDE_ARG $${INSTALLER_ARCHIVE} \"$$BINDIST_SOURCE\" +bindist_debug.commands = python -u $$PWD/scripts/createDistPackage.py --debug $$BINDIST_EXCLUDE_ARG $${INSTALLER_ARCHIVE_DEBUG} \"$$BINDIST_SOURCE\" win32 { deployqt.commands ~= s,/,\\\\,g From 205387ad0695eece1102d7e06e9308f2fc510f3d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 17 Jan 2018 13:45:36 +0100 Subject: [PATCH 07/17] Bump displayed copyright year Change-Id: I5cb95e9b4736279b547208f303a5453f5a4f9dc5 Reviewed-by: Christian Kandeler --- qbs/modules/qtc/qtc.qbs | 2 +- qtcreator.pri | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index c5fe151c0cd..54578cc0f7e 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -17,7 +17,7 @@ Module { property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release - property string qtcreator_copyright_year: '2017' + property string qtcreator_copyright_year: '2018' property string libDirName: "lib" property string ide_app_path: qbs.targetOS.contains("macos") ? "" : "bin" diff --git a/qtcreator.pri b/qtcreator.pri index a2a34565af5..318dd489d20 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -5,7 +5,7 @@ QTCREATOR_VERSION = 4.5.1 QTCREATOR_COMPAT_VERSION = 4.5.0 VERSION = $$QTCREATOR_VERSION QTCREATOR_DISPLAY_VERSION = 4.5.1 -QTCREATOR_COPYRIGHT_YEAR = 2017 +QTCREATOR_COPYRIGHT_YEAR = 2018 BINARY_ARTIFACTS_BRANCH = master CONFIG += c++14 From 9cf8ab3b3d44ac50a1f8d4893d8f70b8aedb18b0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 17 Jan 2018 14:15:50 +0100 Subject: [PATCH 08/17] Fix mime type detection for Qt 5.11 Add an #ifdef for the changed path to the QtCore resource following qtbase/7a5644d6481a3c1a7416772998ca4e60c977bfbd. Task-number: QTCREATORBUG-19600 Change-Id: I8fa8bbf9a7ec91ca569f65671eaab1798b129981 Reviewed-by: Eike Ziller --- src/libs/utils/mimetypes/mimeprovider.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/mimetypes/mimeprovider.cpp b/src/libs/utils/mimetypes/mimeprovider.cpp index 68f69a2ed22..151da054586 100644 --- a/src/libs/utils/mimetypes/mimeprovider.cpp +++ b/src/libs/utils/mimetypes/mimeprovider.cpp @@ -802,7 +802,12 @@ void MimeXMLProvider::ensureLoaded() // if (!fdoXmlFound) { // // We could instead install the file as part of installing Qt? - allFiles.prepend(QLatin1String(":/qt-project.org/qmime/freedesktop.org.xml")); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) + const char freedesktopOrgXml[] = ":/qt-project.org/qmime/packages/freedesktop.org.xml"; +#else + const char freedesktopOrgXml[] = ":/qt-project.org/qmime/freedesktop.org.xml"; +#endif + allFiles.prepend(QLatin1String(freedesktopOrgXml)); // } m_nameMimeTypeMap.clear(); From cfd54505eb54e234094258a08b327c0293c0a3e8 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 16 Jan 2018 18:38:13 +0100 Subject: [PATCH 09/17] QmlProfiler: Improve robustness of QmlProfilerTool test The QmlProfilerClientManager will only report connectionClosed() if the connection was open before it dropped. If the connection never opens, that is the hello message never arrives, it will retry a few times, triggering the QTRY_VERIFY timeout. We don't want the retries to succeed, so close the server after the first connection. Furthermore we want the hello message to be transferred before dropping the connection, so check for isConnected(). Change-Id: Ie96c48b2aaf2748d082c4bef3efe85c261ca4812 Reviewed-by: Christian Kandeler --- src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp index f596169cf10..891344cb568 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp @@ -50,6 +50,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() connect(&server, &QTcpServer::newConnection, this, [&]() { connection.reset(server.nextPendingConnection()); fakeDebugServer(connection.data()); + server.close(); }); QTimer timer; @@ -68,6 +69,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() QTRY_VERIFY(connection); QTRY_VERIFY(runControl->isRunning()); + QTRY_VERIFY(profilerTool->clientManager()->isConnected()); connection.reset(); QTRY_VERIFY(runControl->isStopped()); From fdc88939d6f4e19c5bb4613bf5f84d6629e5398d Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 17 Jan 2018 14:56:40 +0100 Subject: [PATCH 10/17] Clang: Fix ToolTipInfo.IncludeDirective test on Windows Change-Id: I8a6d7c6d46474db4455cb9e2bc90e2e7e527e474 Reviewed-by: Ivan Donchevskii --- tests/unit/unittest/clangtooltipinfo-test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/unittest/clangtooltipinfo-test.cpp b/tests/unit/unittest/clangtooltipinfo-test.cpp index 4f6c9806496..acaa3e18d73 100644 --- a/tests/unit/unittest/clangtooltipinfo-test.cpp +++ b/tests/unit/unittest/clangtooltipinfo-test.cpp @@ -289,7 +289,8 @@ TEST_F(ToolTipInfo, TemplateTypeFromNonParameter) TEST_F(ToolTipInfo, IncludeDirective) { - ::ToolTipInfo expected(Utf8StringLiteral(TESTDATA_DIR"/tooltipinfo.h")); + ::ToolTipInfo expected( + QDir::toNativeSeparators(Utf8StringLiteral(TESTDATA_DIR "/tooltipinfo.h"))); expected.setQdocIdCandidates({Utf8StringLiteral("tooltipinfo.h")}); expected.setQdocMark(Utf8StringLiteral("tooltipinfo.h")); expected.setQdocCategory(::ToolTipInfo::Brief); From e8f0c99f12e805de8231819fab91bd2e0c7d7288 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 17 Jan 2018 15:30:33 +0100 Subject: [PATCH 11/17] Fix copying of symlinks when creating package Another fixup of fd54a377fed0e925678c6572b786ae371cd64aef Change-Id: Ica9635f37a98eba7277517c70ae59409ca71f176 Reviewed-by: Orgad Shaneh --- scripts/createDistPackage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/createDistPackage.py b/scripts/createDistPackage.py index 0e68cfd6a0a..fc6e7b7aaae 100755 --- a/scripts/createDistPackage.py +++ b/scripts/createDistPackage.py @@ -65,7 +65,7 @@ def main(): tempdir_base = tempfile.mkdtemp() tempdir = os.path.join(tempdir_base, os.path.basename(arguments.source_directory)) try: - common.copytree(arguments.source_directory, tempdir, + common.copytree(arguments.source_directory, tempdir, symlinks=True, ignore=(is_not_debug if arguments.debug else is_debug)) zip_source = os.path.join(tempdir, '*') if arguments.exclude_toplevel else tempdir subprocess.check_call([arguments.sevenzip, 'a', '-mx9', From b23dab3ba29586a321b99d18ec3eec46a64eddc7 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 17 Jan 2018 16:15:12 +0100 Subject: [PATCH 12/17] Avoid double deletion of HelpWidget when quitting application via Dock HelpWidgets that are created to be shown in an external window, had two different places where they were deleted: 1) When the widget was closed (due to Qt::WA_DeleteOnClose) 2) In HelpPlugin::aboutToShutdown via manual delete call In certain circumstances (when the WebEngine backend was used) this caused a double delete. Specifically, after opening an external help window, and closing the MainWindow, the application did not quit due to QTBUG-62596. Now if the help window were left open, and the application was quit via the macOS Dock, this caused a crash. When the application quits, it calls the HelpPlugin::aboutToShutdown, which deletes the HelpWidget. This in turn destroys the WebEngine view, which destroys the underlying QQuickWidget, which destroys a QQuickRenderControl, which calls QQuickRenderControlPrivate::windowDestroyed, which handles all posted QEvent::DeferredDelete events, which in turn triggers the deletion of the same HelpWidget due to the Qt::WA_DeleteOnClose attribute. The solution is to remove the Qt::WA_DeleteOnClose attribute, and only delete the external HelpWidget on shutdown, and not on CloseEvent. Task-number: QTBUG-63945 Task-number: QTCREATORBUG-19582 Change-Id: I5b73ff7fe52e7e1259a8aa98c97c9dbedd5e3c20 Reviewed-by: Eike Ziller --- src/plugins/help/helpplugin.cpp | 3 +++ src/plugins/help/helpwidget.cpp | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 20570594835..4595ff3151b 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -349,6 +349,7 @@ HelpViewer *HelpPlugin::externalHelpViewer() if (m_externalWindow) return m_externalWindow->currentViewer(); doSetupIfNeeded(); + // Deletion for this widget is taken care of in HelpPlugin::aboutToShutdown(). m_externalWindow = createHelpWidget(Context(Constants::C_HELP_EXTERNAL), HelpWidget::ExternalWindow); if (m_externalWindowState.isNull()) { @@ -535,6 +536,8 @@ void HelpPlugin::showInHelpViewer(const QUrl &url, HelpViewer *viewer) viewer->stop(); viewer->setSource(url); ICore::raiseWindow(viewer); + // Show the parent top-level-widget in case it was closed previously. + viewer->window()->show(); } HelpViewer *HelpPlugin::viewerForContextHelp() diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp index feb6c3ffa43..79336520f03 100644 --- a/src/plugins/help/helpwidget.cpp +++ b/src/plugins/help/helpwidget.cpp @@ -127,7 +127,6 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget static int windowId = 0; Core::ICore::registerWindow(this, Core::Context(Core::Id("Help.Window.").withSuffix(++windowId))); - setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing } if (style != SideBarWidget) { From d3096f0f73f5585b64e57ba95f5a9210086fe5fa Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 17 Jan 2018 21:41:09 +0200 Subject: [PATCH 13/17] QmlProfiler: Fix build Resolves a build conflict between e1ad7a1784501f034de48e26796100eeb5240429 and cfd54505eb54e234094258a08b327c0293c0a3e8. Change-Id: I70baec1ca2f388bc699866a134c9cb6f64203fdb Reviewed-by: Orgad Shaneh --- src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp index 891344cb568..d2680450667 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp @@ -69,7 +69,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() QTRY_VERIFY(connection); QTRY_VERIFY(runControl->isRunning()); - QTRY_VERIFY(profilerTool->clientManager()->isConnected()); + QTRY_VERIFY(profilerTool.clientManager()->isConnected()); connection.reset(); QTRY_VERIFY(runControl->isStopped()); From 956e6f3a97217acc8f4630e3e681fde1d0cccc51 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 17 Jan 2018 17:06:13 +0200 Subject: [PATCH 14/17] Clang: Fix MSVC build Link error: clangpchmanagerbackendmain.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl ClangBackEnd::ClangPathWatcher::ClangPathWatcher( class ClangBackEnd::FilePathCachingInterface &,class ClangBackEnd::ClangPathWatcherNotifier *)" (__imp_??0?$ClangPathWatcher@VQFileSystemWatcher@@VQTimer@@@ClangBackEnd@@QEAA@AEAVFilePathCachingInterface@1@PEAVClangPathWatcherNotifier@1@@Z) referenced in function main Looks like MSVC looks for import even for inline template functions. Another alternative is to revert 351f355b69632038f996d2d7039903d10f82c003 and either ignore or suppress the GCC warning. Change-Id: I040d4e3924af7f4d1f4424276329c6095e6ff6bd Reviewed-by: Ivan Donchevskii --- src/libs/clangsupport/clangpathwatcher.h | 2 +- src/libs/clangsupport/clangsupport_global.h | 6 ++++++ src/libs/clangsupport/filepathcache.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/clangsupport/clangpathwatcher.h b/src/libs/clangsupport/clangpathwatcher.h index 610e42cccf2..9339c56d51d 100644 --- a/src/libs/clangsupport/clangpathwatcher.h +++ b/src/libs/clangsupport/clangpathwatcher.h @@ -77,7 +77,7 @@ using IdCache = StringCache -class CLANGSUPPORT_EXPORT ClangPathWatcher : public ClangPathWatcherInterface +class CLANGSUPPORT_GCCEXPORT ClangPathWatcher : public ClangPathWatcherInterface { public: ClangPathWatcher(FilePathCachingInterface &pathCache, diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h index 34f65cdcad0..67830143f6c 100644 --- a/src/libs/clangsupport/clangsupport_global.h +++ b/src/libs/clangsupport/clangsupport_global.h @@ -39,6 +39,12 @@ # define CLANGSUPPORT_EXPORT Q_DECL_IMPORT #endif +#ifdef Q_CC_GNU +# define CLANGSUPPORT_GCCEXPORT __attribute__((visibility("default"))) +#else +# define CLANGSUPPORT_GCCEXPORT +#endif + #ifndef CLANGBACKENDPROCESSPATH # define CLANGBACKENDPROCESSPATH "" #endif diff --git a/src/libs/clangsupport/filepathcache.h b/src/libs/clangsupport/filepathcache.h index 81bc3f40cc8..ebdd2a8aacb 100644 --- a/src/libs/clangsupport/filepathcache.h +++ b/src/libs/clangsupport/filepathcache.h @@ -36,7 +36,7 @@ namespace ClangBackEnd { template -class CLANGSUPPORT_EXPORT FilePathCache +class CLANGSUPPORT_GCCEXPORT FilePathCache { using DirectoryPathCache = StringCache Date: Thu, 18 Jan 2018 10:27:58 +0100 Subject: [PATCH 15/17] Clang: Fix left-over qWarnings() Change-Id: Ife685ca7e9e567b832434ba492607b3819d14d48 Reviewed-by: Friedemann Kleint --- src/tools/clangbackend/source/clangcodemodelserver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/clangbackend/source/clangcodemodelserver.cpp b/src/tools/clangbackend/source/clangcodemodelserver.cpp index 609ac1da85c..d3e873d7323 100644 --- a/src/tools/clangbackend/source/clangcodemodelserver.cpp +++ b/src/tools/clangbackend/source/clangcodemodelserver.cpp @@ -201,7 +201,7 @@ void ClangCodeModelServer::registerUnsavedFilesForEditor(const RegisterUnsavedFi void ClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) { - qWarning() << "##### registerUnsavedFilesForEditor"; + qCDebug(serverLog) << "########## registerUnsavedFilesForEditor"; TIME_SCOPE_DURATION("ClangCodeModelServer::unregisterUnsavedFilesForEditor"); try { @@ -214,7 +214,7 @@ void ClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsav void ClangCodeModelServer::completeCode(const ClangBackEnd::CompleteCodeMessage &message) { - qWarning() << "##### completeCode"; + qCDebug(serverLog) << "########## completeCode"; TIME_SCOPE_DURATION("ClangCodeModelServer::completeCode"); try { From 9990fff2c8d3518ca2124201a15797a45a7b9a06 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 18 Jan 2018 12:21:13 +0100 Subject: [PATCH 16/17] State recommended Qt version more precisely Change-Id: I4a8ad19c8fc1f9eacceb41ddebb097fe9a9ec469 Reviewed-by: Friedemann Kleint Reviewed-by: Eike Ziller --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fdfe487fe5..d4ee720a07c 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ For detailed information on the supported compilers, see an outdated version 5.8 which cannot be used for Qt. 5. In the working directory, check out the respective branch of Qt from - (we recommend the latest released version). + (we recommend the highest released version). 6. Check out Qt Creator (master branch or latest version, see ). From dd06a4188d375f990d7ef391b5b626d169a1d196 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 17 Jan 2018 16:06:13 +0100 Subject: [PATCH 17/17] Core: Return context help id by callback ...to support asynchronous providers. Change-Id: I483489c74e7886d5bc2bf00b65540c3d2c7afee0 Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/cmakeeditor.cpp | 16 ++++++++++------ src/plugins/cmakeprojectmanager/cmakeeditor.h | 2 +- src/plugins/coreplugin/icontext.h | 5 ++++- src/plugins/designer/designercontext.cpp | 4 ++-- src/plugins/designer/designercontext.h | 2 +- src/plugins/help/helpplugin.cpp | 11 ++++++++--- src/plugins/help/helpplugin.h | 3 ++- .../components/formeditor/formeditorwidget.cpp | 8 ++++---- .../components/formeditor/formeditorwidget.h | 4 +++- .../components/integration/designdocument.cpp | 8 ++++---- .../components/integration/designdocument.h | 4 +++- .../components/navigator/navigatorwidget.cpp | 8 ++++---- .../components/navigator/navigatorwidget.h | 4 +++- .../components/texteditor/texteditorview.cpp | 16 +++++++--------- .../components/texteditor/texteditorview.h | 6 ++++-- .../components/texteditor/texteditorwidget.cpp | 4 ++-- .../components/texteditor/texteditorwidget.h | 2 +- .../designercore/include/abstractview.h | 4 +++- .../designercore/include/viewmanager.h | 2 +- .../designercore/model/abstractview.cpp | 9 ++++----- .../designercore/model/viewmanager.cpp | 4 ++-- src/plugins/qmldesigner/designmodecontext.cpp | 16 ++++++++-------- src/plugins/qmldesigner/designmodecontext.h | 8 ++++---- src/plugins/qmldesigner/designmodewidget.cpp | 7 ++++--- src/plugins/qmldesigner/designmodewidget.h | 2 +- src/plugins/texteditor/texteditor.cpp | 8 ++++---- src/plugins/texteditor/texteditor.h | 4 ++-- 27 files changed, 96 insertions(+), 75 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index afb8a62d531..a1973454190 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -61,7 +61,7 @@ namespace Internal { // CMakeEditor // -QString CMakeEditor::contextHelpId() const +void CMakeEditor::contextHelpId(const HelpIdCallback &callback) const { int pos = position(); @@ -71,8 +71,10 @@ QString CMakeEditor::contextHelpId() const if (pos < 0) break; chr = characterAt(pos); - if (chr == QLatin1Char('(')) - return QString(); + if (chr == QLatin1Char('(')) { + callback(QString()); + return; + } } while (chr.unicode() != QChar::ParagraphSeparator); ++pos; @@ -95,11 +97,13 @@ QString CMakeEditor::contextHelpId() const } // Not a command - if (chr != QLatin1Char('(')) - return QString(); + if (chr != QLatin1Char('(')) { + callback(QString()); + return; + } QString command = textAt(begin, end - begin).toLower(); - return QLatin1String("command/") + command; + callback(QLatin1String("command/") + command); } // diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h index 93151db5471..364fb48c026 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.h +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h @@ -38,7 +38,7 @@ class CMakeEditor : public TextEditor::BaseTextEditor Q_OBJECT public: - QString contextHelpId() const override; + void contextHelpId(const HelpIdCallback &callback) const override; friend class CMakeEditorWidget; }; diff --git a/src/plugins/coreplugin/icontext.h b/src/plugins/coreplugin/icontext.h index 0baf9eee23f..486223c664a 100644 --- a/src/plugins/coreplugin/icontext.h +++ b/src/plugins/coreplugin/icontext.h @@ -33,6 +33,8 @@ #include #include +#include + namespace Core { class CORE_EXPORT Context @@ -71,7 +73,8 @@ public: virtual Context context() const { return m_context; } virtual QWidget *widget() const { return m_widget; } - virtual QString contextHelpId() const { return m_contextHelpId; } + using HelpIdCallback = std::function; + virtual void contextHelpId(const HelpIdCallback &callback) const { callback(m_contextHelpId); } virtual void setContext(const Context &context) { m_context = context; } virtual void setWidget(QWidget *widget) { m_widget = widget; } diff --git a/src/plugins/designer/designercontext.cpp b/src/plugins/designer/designercontext.cpp index f9407149d3a..bff77559b15 100644 --- a/src/plugins/designer/designercontext.cpp +++ b/src/plugins/designer/designercontext.cpp @@ -45,10 +45,10 @@ DesignerContext::DesignerContext(const Core::Context &context, setWidget(widget); } -QString DesignerContext::contextHelpId() const +void DesignerContext::contextHelpId(const HelpIdCallback &callback) const { const QDesignerFormEditorInterface *core = FormEditorW::designerEditor(); - return core->integration()->contextHelpId(); + callback(core->integration()->contextHelpId()); } } // namespace Internal diff --git a/src/plugins/designer/designercontext.h b/src/plugins/designer/designercontext.h index 5802d2cf3be..3259951e7d3 100644 --- a/src/plugins/designer/designercontext.h +++ b/src/plugins/designer/designercontext.h @@ -37,7 +37,7 @@ public: QWidget *widget, QObject *parent = nullptr); - QString contextHelpId() const override; + void contextHelpId(const HelpIdCallback &callback) const override; }; } // namespace Internal diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 4595ff3151b..de85ae9968a 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -194,7 +194,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) Context(kToolTipHelpContext, Core::Constants::C_GLOBAL)); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1)); - connect(action, &QAction::triggered, this, &HelpPlugin::showContextHelp); + connect(action, &QAction::triggered, this, &HelpPlugin::requestContextHelp); action = new QAction(tr("Technical Support"), this); cmd = ActionManager::registerAction(action, "Help.TechSupport"); @@ -573,14 +573,19 @@ static QUrl findBestLink(const QMap &links, QString *highlightId) return source; } -void HelpPlugin::showContextHelp() +void HelpPlugin::requestContextHelp() { // Find out what to show QString contextHelpId = Utils::ToolTip::contextHelpId(); IContext *context = ICore::currentContextObject(); if (contextHelpId.isEmpty() && context) - contextHelpId = context->contextHelpId(); + context->contextHelpId([this](const QString &id) { showContextHelp(id); }); + else + showContextHelp(contextHelpId); +} +void HelpPlugin::showContextHelp(const QString &contextHelpId) +{ // get the viewer after getting the help id, // because a new window might be opened and therefore focus be moved HelpViewer *viewer = viewerForContextHelp(); diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index 52eb5a73701..5fdcfa87153 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -76,7 +76,8 @@ public: private: void modeChanged(Core::Id mode, Core::Id old); - void showContextHelp(); + void requestContextHelp(); + void showContextHelp(const QString &contextHelpId); void activateIndex(); void activateContents(); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index 012f1162ad5..059261c3a28 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -334,12 +334,12 @@ double FormEditorWidget::containerPadding() const } -QString FormEditorWidget::contextHelpId() const +void FormEditorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { if (m_formEditorView) - return m_formEditorView->contextHelpId(); - - return QString(); + m_formEditorView->contextHelpId(callback); + else + callback(QString()); } void FormEditorWidget::setRootItemRect(const QRectF &rect) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h index 261816ddffa..96d354afbb5 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h @@ -26,6 +26,8 @@ #include +#include + #include #include @@ -62,7 +64,7 @@ public: double spacing() const; double containerPadding() const; - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; void setRootItemRect(const QRectF &rect); QRectF rootItemRect() const; diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 2235e984a1d..068915d13cd 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -651,12 +651,12 @@ void DesignDocument::updateCurrentProject() viewManager().setNodeInstanceViewProject(currentProject); } -QString DesignDocument::contextHelpId() const +void DesignDocument::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { if (view()) - return view()->contextHelpId(); - - return QString(); + view()->contextHelpId(callback); + else + callback(QString()); } } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index e4048dae26f..a7f657ff30a 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -31,6 +31,8 @@ #include #include +#include + #include #include @@ -75,7 +77,7 @@ public: Model *currentModel() const; Model *documentModel() const; - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; QList qmlParseWarnings() const; bool hasQmlParseWarnings() const; QList qmlParseErrors() const; diff --git a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp index 6f7995a185f..6926f7a9b3f 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp @@ -130,12 +130,12 @@ QList NavigatorWidget::createToolBarWidgets() return buttons; } -QString NavigatorWidget::contextHelpId() const +void NavigatorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { if (navigatorView()) - return navigatorView()->contextHelpId(); - - return QString(); + navigatorView()->contextHelpId(callback); + else + callback(QString()); } NavigatorView *NavigatorWidget::navigatorView() const diff --git a/src/plugins/qmldesigner/components/navigator/navigatorwidget.h b/src/plugins/qmldesigner/components/navigator/navigatorwidget.h index 45e8b19c9b5..95f1643b840 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorwidget.h +++ b/src/plugins/qmldesigner/components/navigator/navigatorwidget.h @@ -25,6 +25,8 @@ #pragma once +#include + #include #include @@ -46,7 +48,7 @@ public: void setTreeModel(QAbstractItemModel *model); QTreeView *treeView() const; QList createToolBarWidgets(); - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; signals: void leftButtonClicked(); diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp index 31fb93a03d8..495f6762ca3 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp @@ -150,19 +150,17 @@ WidgetInfo TextEditorView::widgetInfo() return createWidgetInfo(m_widget.get(), 0, "TextEditor", WidgetInfo::CentralPane, 0, tr("Text Editor"), DesignerWidgetFlags::IgnoreErrors); } -QString TextEditorView::contextHelpId() const +void TextEditorView::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { - return AbstractView::contextHelpId(); + AbstractView::contextHelpId(callback); } -QString TextEditorView::qmlJSEditorHelpId() const +void TextEditorView::qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const { - if (m_widget->textEditor()) { - QString contextHelpId = m_widget->textEditor()->contextHelpId(); - if (!contextHelpId.isEmpty()) - return m_widget->textEditor()->contextHelpId(); - } - return QString(); + if (m_widget->textEditor()) + m_widget->textEditor()->contextHelpId(callback); + else + callback(QString()); } void TextEditorView::nodeIdChanged(const ModelNode& /*node*/, const QString &/*newId*/, const QString &/*oldId*/) diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorview.h b/src/plugins/qmldesigner/components/texteditor/texteditorview.h index 01ac15f2191..ea7766115a1 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorview.h +++ b/src/plugins/qmldesigner/components/texteditor/texteditorview.h @@ -24,6 +24,8 @@ ****************************************************************************/ #pragma once +#include + #include #include @@ -67,9 +69,9 @@ public: // TextEditorView WidgetInfo widgetInfo() override; - QString contextHelpId() const override; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const override; - QString qmlJSEditorHelpId() const; + void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const; TextEditor::BaseTextEditor *textEditor(); diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp index f46df03687c..8c0e715ba99 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp @@ -94,9 +94,9 @@ void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor) oldEditor->deleteLater(); } -QString TextEditorWidget::contextHelpId() const +void TextEditorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { - return m_textEditorView->contextHelpId(); + m_textEditorView->contextHelpId(callback); } void TextEditorWidget::updateSelectionByCursorPosition() diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.h b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.h index 7ab245adbbf..5dceef8c029 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.h +++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.h @@ -50,7 +50,7 @@ public: return m_textEditor.get(); } - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; void jumpTextCursorToSelectedModelNode(); void gotoCursorPosition(int line, int column); diff --git a/src/plugins/qmldesigner/designercore/include/abstractview.h b/src/plugins/qmldesigner/designercore/include/abstractview.h index 8b085f91371..a55d874a520 100644 --- a/src/plugins/qmldesigner/designercore/include/abstractview.h +++ b/src/plugins/qmldesigner/designercore/include/abstractview.h @@ -34,6 +34,8 @@ #include #include +#include + #include #include @@ -255,7 +257,7 @@ public: virtual bool hasWidget() const; virtual WidgetInfo widgetInfo(); - virtual QString contextHelpId() const; + virtual void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; void activateTimelineRecording(const ModelNode &mutator); void deactivateTimelineRecording(); diff --git a/src/plugins/qmldesigner/designercore/include/viewmanager.h b/src/plugins/qmldesigner/designercore/include/viewmanager.h index b1a8077202e..d6123d73d5d 100644 --- a/src/plugins/qmldesigner/designercore/include/viewmanager.h +++ b/src/plugins/qmldesigner/designercore/include/viewmanager.h @@ -95,7 +95,7 @@ public: void toggleStatesViewExpanded(); - QString qmlJSEditorHelpId() const; + void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const; DesignDocument *currentDesignDocument() const; private: // functions diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp index 36875422e0f..1649a17a4a3 100644 --- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp +++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp @@ -561,14 +561,13 @@ WidgetInfo AbstractView::widgetInfo() return createWidgetInfo(); } -QString AbstractView::contextHelpId() const +void AbstractView::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { - QString helpId; - #ifndef QMLDESIGNER_TEST - helpId = QmlDesignerPlugin::instance()->viewManager().qmlJSEditorHelpId(); + QmlDesignerPlugin::instance()->viewManager().qmlJSEditorHelpId(callback); +#else + callback(QString()); #endif - return helpId; } void AbstractView::activateTimelineRecording(const ModelNode &mutator) diff --git a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp index 32e1398bd3c..16078ecb739 100644 --- a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp +++ b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp @@ -411,9 +411,9 @@ void ViewManager::toggleStatesViewExpanded() d->statesEditorView.toggleStatesViewExpanded(); } -QString ViewManager::qmlJSEditorHelpId() const +void ViewManager::qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const { - return d->textEditorView.qmlJSEditorHelpId(); + d->textEditorView.qmlJSEditorHelpId(callback); } Model *ViewManager::currentModel() const diff --git a/src/plugins/qmldesigner/designmodecontext.cpp b/src/plugins/qmldesigner/designmodecontext.cpp index 82b583e8278..42d0f04bf66 100644 --- a/src/plugins/qmldesigner/designmodecontext.cpp +++ b/src/plugins/qmldesigner/designmodecontext.cpp @@ -40,9 +40,9 @@ DesignModeContext::DesignModeContext(QWidget *widget) setContext(Core::Context(Constants::C_QMLDESIGNER, Constants::C_QT_QUICK_TOOLS_MENU)); } -QString DesignModeContext::contextHelpId() const +void DesignModeContext::contextHelpId(const HelpIdCallback &callback) const { - return qobject_cast(m_widget)->contextHelpId(); + qobject_cast(m_widget)->contextHelpId(callback); } FormEditorContext::FormEditorContext(QWidget *widget) @@ -52,9 +52,9 @@ FormEditorContext::FormEditorContext(QWidget *widget) setContext(Core::Context(Constants::C_QMLFORMEDITOR, Constants::C_QT_QUICK_TOOLS_MENU)); } -QString FormEditorContext::contextHelpId() const +void FormEditorContext::contextHelpId(const HelpIdCallback &callback) const { - return qobject_cast(m_widget)->contextHelpId(); + qobject_cast(m_widget)->contextHelpId(callback); } NavigatorContext::NavigatorContext(QWidget *widget) @@ -64,9 +64,9 @@ NavigatorContext::NavigatorContext(QWidget *widget) setContext(Core::Context(Constants::C_QMLNAVIGATOR, Constants::C_QT_QUICK_TOOLS_MENU)); } -QString NavigatorContext::contextHelpId() const +void NavigatorContext::contextHelpId(const HelpIdCallback &callback) const { - return qobject_cast(m_widget)->contextHelpId(); + qobject_cast(m_widget)->contextHelpId(callback); } TextEditorContext::TextEditorContext(QWidget *widget) @@ -76,9 +76,9 @@ TextEditorContext::TextEditorContext(QWidget *widget) setContext(Core::Context(Constants::C_QMLTEXTEDITOR, Constants::C_QT_QUICK_TOOLS_MENU)); } -QString TextEditorContext::contextHelpId() const +void TextEditorContext::contextHelpId(const HelpIdCallback &callback) const { - return qobject_cast(m_widget)->contextHelpId(); + qobject_cast(m_widget)->contextHelpId(callback); } } diff --git a/src/plugins/qmldesigner/designmodecontext.h b/src/plugins/qmldesigner/designmodecontext.h index 0f7e1ee7946..aa3fc142d8d 100644 --- a/src/plugins/qmldesigner/designmodecontext.h +++ b/src/plugins/qmldesigner/designmodecontext.h @@ -39,7 +39,7 @@ class DesignModeContext : public Core::IContext public: DesignModeContext(QWidget *widget); - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; }; class FormEditorContext : public Core::IContext @@ -48,7 +48,7 @@ class FormEditorContext : public Core::IContext public: FormEditorContext(QWidget *widget); - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; }; class NavigatorContext : public Core::IContext @@ -57,7 +57,7 @@ class NavigatorContext : public Core::IContext public: NavigatorContext(QWidget *widget); - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; }; class TextEditorContext : public Core::IContext @@ -66,7 +66,7 @@ class TextEditorContext : public Core::IContext public: TextEditorContext(QWidget *widget); - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; }; } diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 216ad00074b..cbe845240ca 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -531,11 +531,12 @@ void DesignModeWidget::showInternalTextEditor() m_centralTabWidget->switchTo(viewManager().widget("TextEditor")); } -QString DesignModeWidget::contextHelpId() const +void DesignModeWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { if (currentDesignDocument()) - return currentDesignDocument()->contextHelpId(); - return QString(); + currentDesignDocument()->contextHelpId(callback); + else + callback(QString()); } void DesignModeWidget::initialize() diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h index 50a8fd64611..ce585a381b2 100644 --- a/src/plugins/qmldesigner/designmodewidget.h +++ b/src/plugins/qmldesigner/designmodewidget.h @@ -62,7 +62,7 @@ public: explicit DesignModeWidget(QWidget *parent = 0); ~DesignModeWidget(); - QString contextHelpId() const; + void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; void initialize(); diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 2c6403df22c..505c4325aec 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7913,9 +7913,9 @@ void TextEditorWidgetPrivate::updateCursorPosition() q->ensureCursorVisible(); } -QString BaseTextEditor::contextHelpId() const +void BaseTextEditor::contextHelpId(const HelpIdCallback &callback) const { - return editorWidget()->contextHelpId(); + editorWidget()->contextHelpId(callback); } void BaseTextEditor::setContextHelpId(const QString &id) @@ -7924,11 +7924,11 @@ void BaseTextEditor::setContextHelpId(const QString &id) editorWidget()->setContextHelpId(id); } -QString TextEditorWidget::contextHelpId() +void TextEditorWidget::contextHelpId(const IContext::HelpIdCallback &callback) { if (d->m_contextHelpId.isEmpty() && !d->m_hoverHandlers.isEmpty()) d->m_contextHelpId = d->m_hoverHandlers.first()->contextHelpId(this, textCursor().position()); - return d->m_contextHelpId; + callback(d->m_contextHelpId); } void TextEditorWidget::setContextHelpId(const QString &id) diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index c98a84df005..ff7193b0257 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -129,7 +129,7 @@ public: bool restoreState(const QByteArray &state) override; QWidget *toolBar() override; - QString contextHelpId() const override; // from IContext + void contextHelpId(const HelpIdCallback &callback) const override; // from IContext void setContextHelpId(const QString &id) override; int currentLine() const override; @@ -533,7 +533,7 @@ public: QChar characterAt(int pos) const; QString textAt(int from, int to) const; - QString contextHelpId(); + void contextHelpId(const Core::IContext::HelpIdCallback &callback); void setContextHelpId(const QString &id); static TextEditorWidget *currentTextEditorWidget();