Merge remote-tracking branch 'origin/4.6'

Conflicts:
	qtcreator.pri

Change-Id: I7dcd8e067b7597144eb3b27d917cb7fe0279aad4
This commit is contained in:
Eike Ziller
2018-01-19 12:05:11 +01:00
47 changed files with 236 additions and 136 deletions

View File

@@ -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
<https://code.qt.io/cgit/qt/qt5.git> (we recommend the latest released version).
<https://code.qt.io/cgit/qt/qt5.git> (we recommend the highest released version).
6. Check out Qt Creator (master branch or latest version, see
<https://code.qt.io/cgit/qt-creator/qt-creator.git>).

View File

@@ -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 qtcreator_copyright_string: "(C) " + qtcreator_copyright_year + " The Qt Company Ltd"
property string ide_display_name: 'Qt Creator'

View File

@@ -5,7 +5,7 @@ QTCREATOR_VERSION = 4.6.82
QTCREATOR_COMPAT_VERSION = 4.6.82
VERSION = $$QTCREATOR_VERSION
QTCREATOR_DISPLAY_VERSION = 4.7.0-beta1
QTCREATOR_COPYRIGHT_YEAR = 2017
QTCREATOR_COPYRIGHT_YEAR = 2018
BINARY_ARTIFACTS_BRANCH = master
isEmpty(IDE_DISPLAY_NAME): IDE_DISPLAY_NAME = Qt Creator

View File

@@ -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 = 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
@@ -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

76
scripts/createDistPackage.py Executable file
View File

@@ -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, 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',
arguments.target_archive, zip_source])
finally:
shutil.rmtree(tempdir_base)
if __name__ == "__main__":
main()

View File

@@ -77,7 +77,7 @@ using IdCache = StringCache<Utils::SmallString,
template <typename FileSystemWatcher,
typename Timer>
class CLANGSUPPORT_EXPORT ClangPathWatcher : public ClangPathWatcherInterface
class CLANGSUPPORT_GCCEXPORT ClangPathWatcher : public ClangPathWatcherInterface
{
public:
ClangPathWatcher(FilePathCachingInterface &pathCache,

View File

@@ -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

View File

@@ -36,7 +36,7 @@
namespace ClangBackEnd {
template <typename FilePathStorage>
class CLANGSUPPORT_EXPORT FilePathCache
class CLANGSUPPORT_GCCEXPORT FilePathCache
{
using DirectoryPathCache = StringCache<Utils::PathString,
int,

View File

@@ -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();

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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);
}
//

View File

@@ -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;
};

View File

@@ -33,6 +33,8 @@
#include <QPointer>
#include <QWidget>
#include <functional>
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<void(const QString &id)>;
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; }

View File

@@ -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

View File

@@ -37,7 +37,7 @@ public:
QWidget *widget,
QObject *parent = nullptr);
QString contextHelpId() const override;
void contextHelpId(const HelpIdCallback &callback) const override;
};
} // namespace Internal

View File

@@ -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,

View File

@@ -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);

View File

@@ -618,8 +618,6 @@ static inline QString _(const char *string) { return QString::fromLatin1(string)
void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
{
QTest::addColumn<ChunkData>("sourceChunk");
QTest::addColumn<QString>("leftFileName");
QTest::addColumn<QString>("rightFileName");
QTest::addColumn<bool>("lastChunk");
QTest::addColumn<QString>("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);

View File

@@ -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;

View File

@@ -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");
@@ -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()
@@ -570,14 +573,19 @@ static QUrl findBestLink(const QMap<QString, QUrl> &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();

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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)

View File

@@ -26,6 +26,8 @@
#include <documentwarningwidget.h>
#include <coreplugin/icontext.h>
#include <QWidget>
#include <QPointer>
@@ -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;

View File

@@ -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

View File

@@ -31,6 +31,8 @@
#include <componenttextmodifier.h>
#include <subcomponentmanager.h>
#include <coreplugin/icontext.h>
#include <QObject>
#include <QString>
@@ -75,7 +77,7 @@ public:
Model *currentModel() const;
Model *documentModel() const;
QString contextHelpId() const;
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
QList<DocumentMessage> qmlParseWarnings() const;
bool hasQmlParseWarnings() const;
QList<DocumentMessage> qmlParseErrors() const;

View File

@@ -130,12 +130,12 @@ QList<QToolButton *> 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

View File

@@ -25,6 +25,8 @@
#pragma once
#include <coreplugin/icontext.h>
#include <QFrame>
#include <QPointer>
@@ -46,7 +48,7 @@ public:
void setTreeModel(QAbstractItemModel *model);
QTreeView *treeView() const;
QList<QToolButton *> createToolBarWidgets();
QString contextHelpId() const;
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
signals:
void leftButtonClicked();

View File

@@ -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*/)

View File

@@ -24,6 +24,8 @@
****************************************************************************/
#pragma once
#include <coreplugin/icontext.h>
#include <abstractview.h>
#include <memory>
@@ -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();

View File

@@ -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()

View File

@@ -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);

View File

@@ -34,6 +34,8 @@
#include <rewritertransaction.h>
#include <commondefines.h>
#include <coreplugin/icontext.h>
#include <QObject>
#include <QPointer>
@@ -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();

View File

@@ -95,7 +95,7 @@ public:
void toggleStatesViewExpanded();
QString qmlJSEditorHelpId() const;
void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const;
DesignDocument *currentDesignDocument() const;
private: // functions

View File

@@ -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)

View File

@@ -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

View File

@@ -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<DesignModeWidget *>(m_widget)->contextHelpId();
qobject_cast<DesignModeWidget *>(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<FormEditorWidget *>(m_widget)->contextHelpId();
qobject_cast<FormEditorWidget *>(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<NavigatorWidget *>(m_widget)->contextHelpId();
qobject_cast<NavigatorWidget *>(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<TextEditorWidget *>(m_widget)->contextHelpId();
qobject_cast<TextEditorWidget *>(m_widget)->contextHelpId(callback);
}
}

View File

@@ -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;
};
}

View File

@@ -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()

View File

@@ -62,7 +62,7 @@ public:
explicit DesignModeWidget(QWidget *parent = 0);
~DesignModeWidget();
QString contextHelpId() const;
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
void initialize();

View File

@@ -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);

View File

@@ -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());

View File

@@ -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)

View File

@@ -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();

View File

@@ -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 {

View File

@@ -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);