forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.6'
Conflicts: qtcreator.pri Change-Id: I7dcd8e067b7597144eb3b27d917cb7fe0279aad4
This commit is contained in:
@@ -74,7 +74,7 @@ For detailed information on the supported compilers, see
|
|||||||
an outdated version 5.8 which cannot be used for Qt.
|
an outdated version 5.8 which cannot be used for Qt.
|
||||||
|
|
||||||
5. In the working directory, check out the respective branch of Qt from
|
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
|
6. Check out Qt Creator (master branch or latest version, see
|
||||||
<https://code.qt.io/cgit/qt-creator/qt-creator.git>).
|
<https://code.qt.io/cgit/qt-creator/qt-creator.git>).
|
||||||
|
@@ -17,7 +17,7 @@ Module {
|
|||||||
property string qtcreator_compat_version: ide_compat_version_major + '.'
|
property string qtcreator_compat_version: ide_compat_version_major + '.'
|
||||||
+ ide_compat_version_minor + '.' + ide_compat_version_release
|
+ 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 qtcreator_copyright_string: "(C) " + qtcreator_copyright_year + " The Qt Company Ltd"
|
||||||
|
|
||||||
property string ide_display_name: 'Qt Creator'
|
property string ide_display_name: 'Qt Creator'
|
||||||
|
@@ -5,7 +5,7 @@ QTCREATOR_VERSION = 4.6.82
|
|||||||
QTCREATOR_COMPAT_VERSION = 4.6.82
|
QTCREATOR_COMPAT_VERSION = 4.6.82
|
||||||
VERSION = $$QTCREATOR_VERSION
|
VERSION = $$QTCREATOR_VERSION
|
||||||
QTCREATOR_DISPLAY_VERSION = 4.7.0-beta1
|
QTCREATOR_DISPLAY_VERSION = 4.7.0-beta1
|
||||||
QTCREATOR_COPYRIGHT_YEAR = 2017
|
QTCREATOR_COPYRIGHT_YEAR = 2018
|
||||||
BINARY_ARTIFACTS_BRANCH = master
|
BINARY_ARTIFACTS_BRANCH = master
|
||||||
|
|
||||||
isEmpty(IDE_DISPLAY_NAME): IDE_DISPLAY_NAME = Qt Creator
|
isEmpty(IDE_DISPLAY_NAME): IDE_DISPLAY_NAME = Qt Creator
|
||||||
|
@@ -110,7 +110,6 @@ linux {
|
|||||||
macx {
|
macx {
|
||||||
APPBUNDLE = "$$OUT_PWD/bin/Qt Creator.app"
|
APPBUNDLE = "$$OUT_PWD/bin/Qt Creator.app"
|
||||||
BINDIST_SOURCE = "$$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]\"
|
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}\"
|
codesign.commands = codesign --deep -s \"$(SIGNING_IDENTITY)\" $(SIGNING_FLAGS) \"$${APPBUNDLE}\"
|
||||||
dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin $${BASENAME}.dmg
|
dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin $${BASENAME}.dmg
|
||||||
@@ -118,7 +117,7 @@ macx {
|
|||||||
QMAKE_EXTRA_TARGETS += codesign dmg
|
QMAKE_EXTRA_TARGETS += codesign dmg
|
||||||
} else {
|
} else {
|
||||||
BINDIST_SOURCE = "$(INSTALL_ROOT)$$QTC_PREFIX"
|
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.commands = python -u $$PWD/scripts/deployqt.py -i \"$(INSTALL_ROOT)$$QTC_PREFIX\" \"$(QMAKE)\"
|
||||||
deployqt.depends = install
|
deployqt.depends = install
|
||||||
win32 {
|
win32 {
|
||||||
@@ -138,10 +137,12 @@ isEmpty(INSTALLER_ARCHIVE_FROM_ENV) {
|
|||||||
INSTALLER_ARCHIVE = $$OUT_PWD/$$(INSTALLER_ARCHIVE)
|
INSTALLER_ARCHIVE = $$OUT_PWD/$$(INSTALLER_ARCHIVE)
|
||||||
}
|
}
|
||||||
|
|
||||||
#bindist.depends = deployqt
|
INSTALLER_ARCHIVE_DEBUG = $$INSTALLER_ARCHIVE
|
||||||
bindist.commands = 7z a -mx9 $$OUT_PWD/$${BASENAME}.7z \"$$BINDIST_SOURCE\"
|
INSTALLER_ARCHIVE_DEBUG ~= s/(.*)[.]7z/\1-debug.7z
|
||||||
#bindist_installer.depends = deployqt
|
|
||||||
bindist_installer.commands = 7z a -mx9 $${INSTALLER_ARCHIVE} \"$$BINDIST_INSTALLER_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 {
|
win32 {
|
||||||
deployqt.commands ~= s,/,\\\\,g
|
deployqt.commands ~= s,/,\\\\,g
|
||||||
@@ -149,4 +150,4 @@ win32 {
|
|||||||
bindist_installer.commands ~= s,/,\\\\,g
|
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
76
scripts/createDistPackage.py
Executable 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()
|
@@ -77,7 +77,7 @@ using IdCache = StringCache<Utils::SmallString,
|
|||||||
|
|
||||||
template <typename FileSystemWatcher,
|
template <typename FileSystemWatcher,
|
||||||
typename Timer>
|
typename Timer>
|
||||||
class CLANGSUPPORT_EXPORT ClangPathWatcher : public ClangPathWatcherInterface
|
class CLANGSUPPORT_GCCEXPORT ClangPathWatcher : public ClangPathWatcherInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClangPathWatcher(FilePathCachingInterface &pathCache,
|
ClangPathWatcher(FilePathCachingInterface &pathCache,
|
||||||
|
@@ -39,6 +39,12 @@
|
|||||||
# define CLANGSUPPORT_EXPORT Q_DECL_IMPORT
|
# define CLANGSUPPORT_EXPORT Q_DECL_IMPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_CC_GNU
|
||||||
|
# define CLANGSUPPORT_GCCEXPORT __attribute__((visibility("default")))
|
||||||
|
#else
|
||||||
|
# define CLANGSUPPORT_GCCEXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CLANGBACKENDPROCESSPATH
|
#ifndef CLANGBACKENDPROCESSPATH
|
||||||
# define CLANGBACKENDPROCESSPATH ""
|
# define CLANGBACKENDPROCESSPATH ""
|
||||||
#endif
|
#endif
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
template <typename FilePathStorage>
|
template <typename FilePathStorage>
|
||||||
class CLANGSUPPORT_EXPORT FilePathCache
|
class CLANGSUPPORT_GCCEXPORT FilePathCache
|
||||||
{
|
{
|
||||||
using DirectoryPathCache = StringCache<Utils::PathString,
|
using DirectoryPathCache = StringCache<Utils::PathString,
|
||||||
int,
|
int,
|
||||||
|
@@ -802,7 +802,12 @@ void MimeXMLProvider::ensureLoaded()
|
|||||||
|
|
||||||
// if (!fdoXmlFound) {
|
// if (!fdoXmlFound) {
|
||||||
// // We could instead install the file as part of installing Qt?
|
// // 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();
|
m_nameMimeTypeMap.clear();
|
||||||
|
@@ -79,8 +79,9 @@ void Bookmark::move(int line)
|
|||||||
|
|
||||||
void Bookmark::updateBlock(const QTextBlock &block)
|
void Bookmark::updateBlock(const QTextBlock &block)
|
||||||
{
|
{
|
||||||
if (m_lineText != block.text()) {
|
const QString &lineText = block.text().trimmed();
|
||||||
m_lineText = block.text();
|
if (m_lineText != lineText) {
|
||||||
|
m_lineText = lineText;
|
||||||
m_manager->updateBookmark(this);
|
m_manager->updateBookmark(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -198,7 +198,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
|||||||
|
|
||||||
QString lineText = index.data(BookmarkManager::Note).toString().trimmed();
|
QString lineText = index.data(BookmarkManager::Note).toString().trimmed();
|
||||||
if (lineText.isEmpty())
|
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);
|
painter->drawText(6, opt.rect.top() + fm.ascent() + fm.height() + 6, lineText);
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ namespace Internal {
|
|||||||
// CMakeEditor
|
// CMakeEditor
|
||||||
//
|
//
|
||||||
|
|
||||||
QString CMakeEditor::contextHelpId() const
|
void CMakeEditor::contextHelpId(const HelpIdCallback &callback) const
|
||||||
{
|
{
|
||||||
int pos = position();
|
int pos = position();
|
||||||
|
|
||||||
@@ -71,8 +71,10 @@ QString CMakeEditor::contextHelpId() const
|
|||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
break;
|
break;
|
||||||
chr = characterAt(pos);
|
chr = characterAt(pos);
|
||||||
if (chr == QLatin1Char('('))
|
if (chr == QLatin1Char('(')) {
|
||||||
return QString();
|
callback(QString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
} while (chr.unicode() != QChar::ParagraphSeparator);
|
} while (chr.unicode() != QChar::ParagraphSeparator);
|
||||||
|
|
||||||
++pos;
|
++pos;
|
||||||
@@ -95,11 +97,13 @@ QString CMakeEditor::contextHelpId() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not a command
|
// Not a command
|
||||||
if (chr != QLatin1Char('('))
|
if (chr != QLatin1Char('(')) {
|
||||||
return QString();
|
callback(QString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString command = textAt(begin, end - begin).toLower();
|
QString command = textAt(begin, end - begin).toLower();
|
||||||
return QLatin1String("command/") + command;
|
callback(QLatin1String("command/") + command);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -38,7 +38,7 @@ class CMakeEditor : public TextEditor::BaseTextEditor
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString contextHelpId() const override;
|
void contextHelpId(const HelpIdCallback &callback) const override;
|
||||||
|
|
||||||
friend class CMakeEditorWidget;
|
friend class CMakeEditorWidget;
|
||||||
};
|
};
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class CORE_EXPORT Context
|
class CORE_EXPORT Context
|
||||||
@@ -71,7 +73,8 @@ public:
|
|||||||
|
|
||||||
virtual Context context() const { return m_context; }
|
virtual Context context() const { return m_context; }
|
||||||
virtual QWidget *widget() const { return m_widget; }
|
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 setContext(const Context &context) { m_context = context; }
|
||||||
virtual void setWidget(QWidget *widget) { m_widget = widget; }
|
virtual void setWidget(QWidget *widget) { m_widget = widget; }
|
||||||
|
@@ -45,10 +45,10 @@ DesignerContext::DesignerContext(const Core::Context &context,
|
|||||||
setWidget(widget);
|
setWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesignerContext::contextHelpId() const
|
void DesignerContext::contextHelpId(const HelpIdCallback &callback) const
|
||||||
{
|
{
|
||||||
const QDesignerFormEditorInterface *core = FormEditorW::designerEditor();
|
const QDesignerFormEditorInterface *core = FormEditorW::designerEditor();
|
||||||
return core->integration()->contextHelpId();
|
callback(core->integration()->contextHelpId());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -37,7 +37,7 @@ public:
|
|||||||
QWidget *widget,
|
QWidget *widget,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
QString contextHelpId() const override;
|
void contextHelpId(const HelpIdCallback &callback) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -71,9 +71,10 @@ QString DiffEditorController::revisionFromDescription() const
|
|||||||
return m_document->description().mid(7, 12);
|
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,
|
Core::IDocument *DiffEditorController::findOrCreateDocument(const QString &vcsId,
|
||||||
|
@@ -53,7 +53,13 @@ public:
|
|||||||
|
|
||||||
QString revisionFromDescription() const;
|
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,
|
static Core::IDocument *findOrCreateDocument(const QString &vcsId,
|
||||||
const QString &displayName);
|
const QString &displayName);
|
||||||
|
@@ -618,8 +618,6 @@ static inline QString _(const char *string) { return QString::fromLatin1(string)
|
|||||||
void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<ChunkData>("sourceChunk");
|
QTest::addColumn<ChunkData>("sourceChunk");
|
||||||
QTest::addColumn<QString>("leftFileName");
|
|
||||||
QTest::addColumn<QString>("rightFileName");
|
|
||||||
QTest::addColumn<bool>("lastChunk");
|
QTest::addColumn<bool>("lastChunk");
|
||||||
QTest::addColumn<QString>("patchText");
|
QTest::addColumn<QString>("patchText");
|
||||||
|
|
||||||
@@ -635,8 +633,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"-ABCD\n"
|
"-ABCD\n"
|
||||||
" EFGH\n";
|
" EFGH\n";
|
||||||
QTest::newRow("Simple not a last chunk") << chunk
|
QTest::newRow("Simple not a last chunk") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< false
|
<< false
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -649,8 +645,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"\\ No newline at end of file\n";
|
"\\ No newline at end of file\n";
|
||||||
|
|
||||||
QTest::newRow("Simple last chunk") << chunk
|
QTest::newRow("Simple last chunk") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< true
|
<< true
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -666,8 +660,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"\\ No newline at end of file\n";
|
"\\ No newline at end of file\n";
|
||||||
|
|
||||||
QTest::newRow("EOL in last line removed") << chunk
|
QTest::newRow("EOL in last line removed") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< true
|
<< true
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -679,8 +671,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"-\n";
|
"-\n";
|
||||||
|
|
||||||
QTest::newRow("Last empty line removed") << chunk
|
QTest::newRow("Last empty line removed") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< false
|
<< false
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -698,8 +688,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"\\ No newline at end of file\n";
|
"\\ No newline at end of file\n";
|
||||||
|
|
||||||
QTest::newRow("Two last EOLs removed") << chunk
|
QTest::newRow("Two last EOLs removed") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< true
|
<< true
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -715,8 +703,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"+ABCD\n";
|
"+ABCD\n";
|
||||||
|
|
||||||
QTest::newRow("EOL to last line added") << chunk
|
QTest::newRow("EOL to last line added") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< true
|
<< true
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -728,8 +714,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"+\n";
|
"+\n";
|
||||||
|
|
||||||
QTest::newRow("Last empty line added") << chunk
|
QTest::newRow("Last empty line added") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< false
|
<< false
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -743,8 +727,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"+EFGH\n";
|
"+EFGH\n";
|
||||||
|
|
||||||
QTest::newRow("Last line with a newline modified") << chunk
|
QTest::newRow("Last line with a newline modified") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< false
|
<< false
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -759,8 +741,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"+EFGH\n"
|
"+EFGH\n"
|
||||||
" \n";
|
" \n";
|
||||||
QTest::newRow("Not a last line with a newline modified") << chunk
|
QTest::newRow("Not a last line with a newline modified") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< false
|
<< false
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -776,8 +756,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"\\ No newline at end of file\n";
|
"\\ No newline at end of file\n";
|
||||||
|
|
||||||
QTest::newRow("Last line without a newline modified") << chunk
|
QTest::newRow("Last line without a newline modified") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< true
|
<< true
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -788,8 +766,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
"-ABCD\n"
|
"-ABCD\n"
|
||||||
"+EFGH\n";
|
"+EFGH\n";
|
||||||
QTest::newRow("Not a last line without a newline modified") << chunk
|
QTest::newRow("Not a last line without a newline modified") << chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< false
|
<< false
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -807,8 +783,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
|
|
||||||
QTest::newRow("Last but one line modified, last line without a newline")
|
QTest::newRow("Last but one line modified, last line without a newline")
|
||||||
<< chunk
|
<< chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< true
|
<< true
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -822,8 +796,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
|
|
||||||
QTest::newRow("Last but one line modified, last line with a newline")
|
QTest::newRow("Last but one line modified, last line with a newline")
|
||||||
<< chunk
|
<< chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< false
|
<< false
|
||||||
<< patchText;
|
<< patchText;
|
||||||
|
|
||||||
@@ -842,8 +814,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
|
|
||||||
QTest::newRow("Blank line followed by No newline")
|
QTest::newRow("Blank line followed by No newline")
|
||||||
<< chunk
|
<< chunk
|
||||||
<< fileName
|
|
||||||
<< fileName
|
|
||||||
<< true
|
<< true
|
||||||
<< patchText;
|
<< patchText;
|
||||||
}
|
}
|
||||||
@@ -851,12 +821,11 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
|||||||
void DiffEditor::Internal::DiffEditorPlugin::testMakePatch()
|
void DiffEditor::Internal::DiffEditorPlugin::testMakePatch()
|
||||||
{
|
{
|
||||||
QFETCH(ChunkData, sourceChunk);
|
QFETCH(ChunkData, sourceChunk);
|
||||||
QFETCH(QString, leftFileName);
|
|
||||||
QFETCH(QString, rightFileName);
|
|
||||||
QFETCH(bool, lastChunk);
|
QFETCH(bool, lastChunk);
|
||||||
QFETCH(QString, patchText);
|
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);
|
QCOMPARE(result, patchText);
|
||||||
|
|
||||||
@@ -867,8 +836,8 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch()
|
|||||||
QCOMPARE(resultList.count(), 1);
|
QCOMPARE(resultList.count(), 1);
|
||||||
for (int i = 0; i < resultList.count(); i++) {
|
for (int i = 0; i < resultList.count(); i++) {
|
||||||
const FileData &resultFileData = resultList.at(i);
|
const FileData &resultFileData = resultList.at(i);
|
||||||
QCOMPARE(resultFileData.leftFileInfo.fileName, leftFileName);
|
QCOMPARE(resultFileData.leftFileInfo.fileName, fileName);
|
||||||
QCOMPARE(resultFileData.rightFileInfo.fileName, rightFileName);
|
QCOMPARE(resultFileData.rightFileInfo.fileName, fileName);
|
||||||
QCOMPARE(resultFileData.chunks.count(), 1);
|
QCOMPARE(resultFileData.chunks.count(), 1);
|
||||||
for (int j = 0; j < resultFileData.chunks.count(); j++) {
|
for (int j = 0; j < resultFileData.chunks.count(); j++) {
|
||||||
const ChunkData &resultChunkData = resultFileData.chunks.at(j);
|
const ChunkData &resultChunkData = resultFileData.chunks.at(j);
|
||||||
|
@@ -617,7 +617,8 @@ void GitClient::slotStageChunk()
|
|||||||
if (m_contextController.isNull())
|
if (m_contextController.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString patch = m_contextController->makePatch(false, true);
|
DiffEditorController::PatchOptions options = DiffEditorController::AddPrefix;
|
||||||
|
const QString patch = m_contextController->makePatch(options);
|
||||||
if (patch.isEmpty())
|
if (patch.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -629,7 +630,9 @@ void GitClient::slotUnstageChunk()
|
|||||||
if (m_contextController.isNull())
|
if (m_contextController.isNull())
|
||||||
return;
|
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())
|
if (patch.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -194,7 +194,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
Context(kToolTipHelpContext, Core::Constants::C_GLOBAL));
|
Context(kToolTipHelpContext, Core::Constants::C_GLOBAL));
|
||||||
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
|
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1));
|
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);
|
action = new QAction(tr("Technical Support"), this);
|
||||||
cmd = ActionManager::registerAction(action, "Help.TechSupport");
|
cmd = ActionManager::registerAction(action, "Help.TechSupport");
|
||||||
@@ -349,6 +349,7 @@ HelpViewer *HelpPlugin::externalHelpViewer()
|
|||||||
if (m_externalWindow)
|
if (m_externalWindow)
|
||||||
return m_externalWindow->currentViewer();
|
return m_externalWindow->currentViewer();
|
||||||
doSetupIfNeeded();
|
doSetupIfNeeded();
|
||||||
|
// Deletion for this widget is taken care of in HelpPlugin::aboutToShutdown().
|
||||||
m_externalWindow = createHelpWidget(Context(Constants::C_HELP_EXTERNAL),
|
m_externalWindow = createHelpWidget(Context(Constants::C_HELP_EXTERNAL),
|
||||||
HelpWidget::ExternalWindow);
|
HelpWidget::ExternalWindow);
|
||||||
if (m_externalWindowState.isNull()) {
|
if (m_externalWindowState.isNull()) {
|
||||||
@@ -535,6 +536,8 @@ void HelpPlugin::showInHelpViewer(const QUrl &url, HelpViewer *viewer)
|
|||||||
viewer->stop();
|
viewer->stop();
|
||||||
viewer->setSource(url);
|
viewer->setSource(url);
|
||||||
ICore::raiseWindow(viewer);
|
ICore::raiseWindow(viewer);
|
||||||
|
// Show the parent top-level-widget in case it was closed previously.
|
||||||
|
viewer->window()->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
HelpViewer *HelpPlugin::viewerForContextHelp()
|
HelpViewer *HelpPlugin::viewerForContextHelp()
|
||||||
@@ -570,14 +573,19 @@ static QUrl findBestLink(const QMap<QString, QUrl> &links, QString *highlightId)
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::showContextHelp()
|
void HelpPlugin::requestContextHelp()
|
||||||
{
|
{
|
||||||
// Find out what to show
|
// Find out what to show
|
||||||
QString contextHelpId = Utils::ToolTip::contextHelpId();
|
QString contextHelpId = Utils::ToolTip::contextHelpId();
|
||||||
IContext *context = ICore::currentContextObject();
|
IContext *context = ICore::currentContextObject();
|
||||||
if (contextHelpId.isEmpty() && context)
|
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,
|
// get the viewer after getting the help id,
|
||||||
// because a new window might be opened and therefore focus be moved
|
// because a new window might be opened and therefore focus be moved
|
||||||
HelpViewer *viewer = viewerForContextHelp();
|
HelpViewer *viewer = viewerForContextHelp();
|
||||||
|
@@ -76,7 +76,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void modeChanged(Core::Id mode, Core::Id old);
|
void modeChanged(Core::Id mode, Core::Id old);
|
||||||
|
|
||||||
void showContextHelp();
|
void requestContextHelp();
|
||||||
|
void showContextHelp(const QString &contextHelpId);
|
||||||
void activateIndex();
|
void activateIndex();
|
||||||
void activateContents();
|
void activateContents();
|
||||||
|
|
||||||
|
@@ -127,7 +127,6 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
|
|||||||
static int windowId = 0;
|
static int windowId = 0;
|
||||||
Core::ICore::registerWindow(this,
|
Core::ICore::registerWindow(this,
|
||||||
Core::Context(Core::Id("Help.Window.").withSuffix(++windowId)));
|
Core::Context(Core::Id("Help.Window.").withSuffix(++windowId)));
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
|
setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
|
||||||
}
|
}
|
||||||
if (style != SideBarWidget) {
|
if (style != SideBarWidget) {
|
||||||
|
@@ -334,12 +334,12 @@ double FormEditorWidget::containerPadding() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString FormEditorWidget::contextHelpId() const
|
void FormEditorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
|
||||||
{
|
{
|
||||||
if (m_formEditorView)
|
if (m_formEditorView)
|
||||||
return m_formEditorView->contextHelpId();
|
m_formEditorView->contextHelpId(callback);
|
||||||
|
else
|
||||||
return QString();
|
callback(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorWidget::setRootItemRect(const QRectF &rect)
|
void FormEditorWidget::setRootItemRect(const QRectF &rect)
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include <documentwarningwidget.h>
|
#include <documentwarningwidget.h>
|
||||||
|
|
||||||
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
@@ -62,7 +64,7 @@ public:
|
|||||||
double spacing() const;
|
double spacing() const;
|
||||||
double containerPadding() const;
|
double containerPadding() const;
|
||||||
|
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
|
|
||||||
void setRootItemRect(const QRectF &rect);
|
void setRootItemRect(const QRectF &rect);
|
||||||
QRectF rootItemRect() const;
|
QRectF rootItemRect() const;
|
||||||
|
@@ -651,12 +651,12 @@ void DesignDocument::updateCurrentProject()
|
|||||||
viewManager().setNodeInstanceViewProject(currentProject);
|
viewManager().setNodeInstanceViewProject(currentProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesignDocument::contextHelpId() const
|
void DesignDocument::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
|
||||||
{
|
{
|
||||||
if (view())
|
if (view())
|
||||||
return view()->contextHelpId();
|
view()->contextHelpId(callback);
|
||||||
|
else
|
||||||
return QString();
|
callback(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
#include <componenttextmodifier.h>
|
#include <componenttextmodifier.h>
|
||||||
#include <subcomponentmanager.h>
|
#include <subcomponentmanager.h>
|
||||||
|
|
||||||
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
@@ -75,7 +77,7 @@ public:
|
|||||||
Model *currentModel() const;
|
Model *currentModel() const;
|
||||||
Model *documentModel() const;
|
Model *documentModel() const;
|
||||||
|
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
QList<DocumentMessage> qmlParseWarnings() const;
|
QList<DocumentMessage> qmlParseWarnings() const;
|
||||||
bool hasQmlParseWarnings() const;
|
bool hasQmlParseWarnings() const;
|
||||||
QList<DocumentMessage> qmlParseErrors() const;
|
QList<DocumentMessage> qmlParseErrors() const;
|
||||||
|
@@ -130,12 +130,12 @@ QList<QToolButton *> NavigatorWidget::createToolBarWidgets()
|
|||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NavigatorWidget::contextHelpId() const
|
void NavigatorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
|
||||||
{
|
{
|
||||||
if (navigatorView())
|
if (navigatorView())
|
||||||
return navigatorView()->contextHelpId();
|
navigatorView()->contextHelpId(callback);
|
||||||
|
else
|
||||||
return QString();
|
callback(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigatorView *NavigatorWidget::navigatorView() const
|
NavigatorView *NavigatorWidget::navigatorView() const
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ public:
|
|||||||
void setTreeModel(QAbstractItemModel *model);
|
void setTreeModel(QAbstractItemModel *model);
|
||||||
QTreeView *treeView() const;
|
QTreeView *treeView() const;
|
||||||
QList<QToolButton *> createToolBarWidgets();
|
QList<QToolButton *> createToolBarWidgets();
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void leftButtonClicked();
|
void leftButtonClicked();
|
||||||
|
@@ -150,19 +150,17 @@ WidgetInfo TextEditorView::widgetInfo()
|
|||||||
return createWidgetInfo(m_widget.get(), 0, "TextEditor", WidgetInfo::CentralPane, 0, tr("Text Editor"), DesignerWidgetFlags::IgnoreErrors);
|
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()) {
|
if (m_widget->textEditor())
|
||||||
QString contextHelpId = m_widget->textEditor()->contextHelpId();
|
m_widget->textEditor()->contextHelpId(callback);
|
||||||
if (!contextHelpId.isEmpty())
|
else
|
||||||
return m_widget->textEditor()->contextHelpId();
|
callback(QString());
|
||||||
}
|
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorView::nodeIdChanged(const ModelNode& /*node*/, const QString &/*newId*/, const QString &/*oldId*/)
|
void TextEditorView::nodeIdChanged(const ModelNode& /*node*/, const QString &/*newId*/, const QString &/*oldId*/)
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
#include <abstractview.h>
|
#include <abstractview.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -67,9 +69,9 @@ public:
|
|||||||
|
|
||||||
// TextEditorView
|
// TextEditorView
|
||||||
WidgetInfo widgetInfo() override;
|
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();
|
TextEditor::BaseTextEditor *textEditor();
|
||||||
|
|
||||||
|
@@ -94,9 +94,9 @@ void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor)
|
|||||||
oldEditor->deleteLater();
|
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()
|
void TextEditorWidget::updateSelectionByCursorPosition()
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
return m_textEditor.get();
|
return m_textEditor.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
void jumpTextCursorToSelectedModelNode();
|
void jumpTextCursorToSelectedModelNode();
|
||||||
void gotoCursorPosition(int line, int column);
|
void gotoCursorPosition(int line, int column);
|
||||||
|
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
#include <rewritertransaction.h>
|
#include <rewritertransaction.h>
|
||||||
#include <commondefines.h>
|
#include <commondefines.h>
|
||||||
|
|
||||||
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
@@ -255,7 +257,7 @@ public:
|
|||||||
virtual bool hasWidget() const;
|
virtual bool hasWidget() const;
|
||||||
virtual WidgetInfo widgetInfo();
|
virtual WidgetInfo widgetInfo();
|
||||||
|
|
||||||
virtual QString contextHelpId() const;
|
virtual void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
|
|
||||||
void activateTimelineRecording(const ModelNode &mutator);
|
void activateTimelineRecording(const ModelNode &mutator);
|
||||||
void deactivateTimelineRecording();
|
void deactivateTimelineRecording();
|
||||||
|
@@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
void toggleStatesViewExpanded();
|
void toggleStatesViewExpanded();
|
||||||
|
|
||||||
QString qmlJSEditorHelpId() const;
|
void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
DesignDocument *currentDesignDocument() const;
|
DesignDocument *currentDesignDocument() const;
|
||||||
|
|
||||||
private: // functions
|
private: // functions
|
||||||
|
@@ -561,14 +561,13 @@ WidgetInfo AbstractView::widgetInfo()
|
|||||||
return createWidgetInfo();
|
return createWidgetInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AbstractView::contextHelpId() const
|
void AbstractView::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
|
||||||
{
|
{
|
||||||
QString helpId;
|
|
||||||
|
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
helpId = QmlDesignerPlugin::instance()->viewManager().qmlJSEditorHelpId();
|
QmlDesignerPlugin::instance()->viewManager().qmlJSEditorHelpId(callback);
|
||||||
|
#else
|
||||||
|
callback(QString());
|
||||||
#endif
|
#endif
|
||||||
return helpId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractView::activateTimelineRecording(const ModelNode &mutator)
|
void AbstractView::activateTimelineRecording(const ModelNode &mutator)
|
||||||
|
@@ -411,9 +411,9 @@ void ViewManager::toggleStatesViewExpanded()
|
|||||||
d->statesEditorView.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
|
Model *ViewManager::currentModel() const
|
||||||
|
@@ -40,9 +40,9 @@ DesignModeContext::DesignModeContext(QWidget *widget)
|
|||||||
setContext(Core::Context(Constants::C_QMLDESIGNER, Constants::C_QT_QUICK_TOOLS_MENU));
|
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)
|
FormEditorContext::FormEditorContext(QWidget *widget)
|
||||||
@@ -52,9 +52,9 @@ FormEditorContext::FormEditorContext(QWidget *widget)
|
|||||||
setContext(Core::Context(Constants::C_QMLFORMEDITOR, Constants::C_QT_QUICK_TOOLS_MENU));
|
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)
|
NavigatorContext::NavigatorContext(QWidget *widget)
|
||||||
@@ -64,9 +64,9 @@ NavigatorContext::NavigatorContext(QWidget *widget)
|
|||||||
setContext(Core::Context(Constants::C_QMLNAVIGATOR, Constants::C_QT_QUICK_TOOLS_MENU));
|
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)
|
TextEditorContext::TextEditorContext(QWidget *widget)
|
||||||
@@ -76,9 +76,9 @@ TextEditorContext::TextEditorContext(QWidget *widget)
|
|||||||
setContext(Core::Context(Constants::C_QMLTEXTEDITOR, Constants::C_QT_QUICK_TOOLS_MENU));
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ class DesignModeContext : public Core::IContext
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DesignModeContext(QWidget *widget);
|
DesignModeContext(QWidget *widget);
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FormEditorContext : public Core::IContext
|
class FormEditorContext : public Core::IContext
|
||||||
@@ -48,7 +48,7 @@ class FormEditorContext : public Core::IContext
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FormEditorContext(QWidget *widget);
|
FormEditorContext(QWidget *widget);
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NavigatorContext : public Core::IContext
|
class NavigatorContext : public Core::IContext
|
||||||
@@ -57,7 +57,7 @@ class NavigatorContext : public Core::IContext
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
NavigatorContext(QWidget *widget);
|
NavigatorContext(QWidget *widget);
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextEditorContext : public Core::IContext
|
class TextEditorContext : public Core::IContext
|
||||||
@@ -66,7 +66,7 @@ class TextEditorContext : public Core::IContext
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TextEditorContext(QWidget *widget);
|
TextEditorContext(QWidget *widget);
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -531,11 +531,12 @@ void DesignModeWidget::showInternalTextEditor()
|
|||||||
m_centralTabWidget->switchTo(viewManager().widget("TextEditor"));
|
m_centralTabWidget->switchTo(viewManager().widget("TextEditor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesignModeWidget::contextHelpId() const
|
void DesignModeWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
|
||||||
{
|
{
|
||||||
if (currentDesignDocument())
|
if (currentDesignDocument())
|
||||||
return currentDesignDocument()->contextHelpId();
|
currentDesignDocument()->contextHelpId(callback);
|
||||||
return QString();
|
else
|
||||||
|
callback(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignModeWidget::initialize()
|
void DesignModeWidget::initialize()
|
||||||
|
@@ -62,7 +62,7 @@ public:
|
|||||||
explicit DesignModeWidget(QWidget *parent = 0);
|
explicit DesignModeWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
~DesignModeWidget();
|
~DesignModeWidget();
|
||||||
QString contextHelpId() const;
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
|
@@ -373,10 +373,16 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(runControl, &RunControl::stopped, this, [this, runControl] {
|
auto handleStop = [this, runControl]() {
|
||||||
d->m_toolBusy = false;
|
d->m_toolBusy = false;
|
||||||
updateRunActions();
|
updateRunActions();
|
||||||
disconnect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop);
|
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);
|
connect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop);
|
||||||
|
@@ -50,6 +50,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
|||||||
connect(&server, &QTcpServer::newConnection, this, [&]() {
|
connect(&server, &QTcpServer::newConnection, this, [&]() {
|
||||||
connection.reset(server.nextPendingConnection());
|
connection.reset(server.nextPendingConnection());
|
||||||
fakeDebugServer(connection.data());
|
fakeDebugServer(connection.data());
|
||||||
|
server.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
@@ -68,6 +69,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
|||||||
|
|
||||||
QTRY_VERIFY(connection);
|
QTRY_VERIFY(connection);
|
||||||
QTRY_VERIFY(runControl->isRunning());
|
QTRY_VERIFY(runControl->isRunning());
|
||||||
|
QTRY_VERIFY(profilerTool.clientManager()->isConnected());
|
||||||
|
|
||||||
connection.reset();
|
connection.reset();
|
||||||
QTRY_VERIFY(runControl->isStopped());
|
QTRY_VERIFY(runControl->isStopped());
|
||||||
|
@@ -7913,9 +7913,9 @@ void TextEditorWidgetPrivate::updateCursorPosition()
|
|||||||
q->ensureCursorVisible();
|
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)
|
void BaseTextEditor::setContextHelpId(const QString &id)
|
||||||
@@ -7924,11 +7924,11 @@ void BaseTextEditor::setContextHelpId(const QString &id)
|
|||||||
editorWidget()->setContextHelpId(id);
|
editorWidget()->setContextHelpId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TextEditorWidget::contextHelpId()
|
void TextEditorWidget::contextHelpId(const IContext::HelpIdCallback &callback)
|
||||||
{
|
{
|
||||||
if (d->m_contextHelpId.isEmpty() && !d->m_hoverHandlers.isEmpty())
|
if (d->m_contextHelpId.isEmpty() && !d->m_hoverHandlers.isEmpty())
|
||||||
d->m_contextHelpId = d->m_hoverHandlers.first()->contextHelpId(this, textCursor().position());
|
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)
|
void TextEditorWidget::setContextHelpId(const QString &id)
|
||||||
|
@@ -129,7 +129,7 @@ public:
|
|||||||
bool restoreState(const QByteArray &state) override;
|
bool restoreState(const QByteArray &state) override;
|
||||||
QWidget *toolBar() 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;
|
void setContextHelpId(const QString &id) override;
|
||||||
|
|
||||||
int currentLine() const override;
|
int currentLine() const override;
|
||||||
@@ -533,7 +533,7 @@ public:
|
|||||||
QChar characterAt(int pos) const;
|
QChar characterAt(int pos) const;
|
||||||
QString textAt(int from, int to) const;
|
QString textAt(int from, int to) const;
|
||||||
|
|
||||||
QString contextHelpId();
|
void contextHelpId(const Core::IContext::HelpIdCallback &callback);
|
||||||
void setContextHelpId(const QString &id);
|
void setContextHelpId(const QString &id);
|
||||||
|
|
||||||
static TextEditorWidget *currentTextEditorWidget();
|
static TextEditorWidget *currentTextEditorWidget();
|
||||||
|
@@ -201,7 +201,7 @@ void ClangCodeModelServer::registerUnsavedFilesForEditor(const RegisterUnsavedFi
|
|||||||
|
|
||||||
void ClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
|
void ClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
|
||||||
{
|
{
|
||||||
qWarning() << "##### registerUnsavedFilesForEditor";
|
qCDebug(serverLog) << "########## registerUnsavedFilesForEditor";
|
||||||
TIME_SCOPE_DURATION("ClangCodeModelServer::unregisterUnsavedFilesForEditor");
|
TIME_SCOPE_DURATION("ClangCodeModelServer::unregisterUnsavedFilesForEditor");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -214,7 +214,7 @@ void ClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsav
|
|||||||
|
|
||||||
void ClangCodeModelServer::completeCode(const ClangBackEnd::CompleteCodeMessage &message)
|
void ClangCodeModelServer::completeCode(const ClangBackEnd::CompleteCodeMessage &message)
|
||||||
{
|
{
|
||||||
qWarning() << "##### completeCode";
|
qCDebug(serverLog) << "########## completeCode";
|
||||||
TIME_SCOPE_DURATION("ClangCodeModelServer::completeCode");
|
TIME_SCOPE_DURATION("ClangCodeModelServer::completeCode");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@@ -289,7 +289,8 @@ TEST_F(ToolTipInfo, TemplateTypeFromNonParameter)
|
|||||||
|
|
||||||
TEST_F(ToolTipInfo, IncludeDirective)
|
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.setQdocIdCandidates({Utf8StringLiteral("tooltipinfo.h")});
|
||||||
expected.setQdocMark(Utf8StringLiteral("tooltipinfo.h"));
|
expected.setQdocMark(Utf8StringLiteral("tooltipinfo.h"));
|
||||||
expected.setQdocCategory(::ToolTipInfo::Brief);
|
expected.setQdocCategory(::ToolTipInfo::Brief);
|
||||||
|
Reference in New Issue
Block a user