forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.6'
Change-Id: I49e8b8442e2b5edffbea19cb2bba97443ebc3d2a
This commit is contained in:
@@ -93,6 +93,7 @@
|
||||
\li Code completion
|
||||
\li Syntactic and semantic highlighting
|
||||
\li Diagnostics
|
||||
\li Tooltips
|
||||
|
||||
\endlist
|
||||
|
||||
|
||||
@@ -2866,6 +2866,9 @@
|
||||
\li Running text editing macros that you record and save (\c {rm}). For
|
||||
more information, see \l{Using Text Editing Macros}
|
||||
|
||||
\li Executing JavaScript (\c {=}), especially useful for calculations.
|
||||
For more information, see \l{Executing JavaScript}.
|
||||
|
||||
\li Executing shell commands (\c {!})
|
||||
|
||||
\li Executing version control system commands (\c {git}). For more
|
||||
@@ -3048,4 +3051,86 @@
|
||||
|
||||
\endlist
|
||||
|
||||
\section1 Executing JavaScript
|
||||
|
||||
The locator provides access to a JavaScript interpreter, that can be used to
|
||||
perform calculations.
|
||||
|
||||
Beside simple mathematical operations, like ((1 + 2) * 3), the following
|
||||
built-in functions exist:
|
||||
|
||||
\table
|
||||
\header
|
||||
\li Function
|
||||
\li Purpose
|
||||
\row
|
||||
\li abs(x)
|
||||
\li Returns the absolute value of x
|
||||
\row
|
||||
\li acos(x)
|
||||
\li Returns the arccosine of x, in radians
|
||||
\row
|
||||
\li asin(x)
|
||||
\li Returns the arcsine of x, in radians
|
||||
\row
|
||||
\li atan(x)
|
||||
\li Returns the arctangent of x, in radians
|
||||
\row
|
||||
\li atan2(x, y)
|
||||
\li Returns the arctangent of the quotient of its arguments
|
||||
\row
|
||||
\li bin(x)
|
||||
\li Returns the binary representation of x
|
||||
\row
|
||||
\li ceil(x)
|
||||
\li Returns the value of x rounded up to the next integer
|
||||
\row
|
||||
\li cos(x)
|
||||
\li Returns the cosine of x (x is in radians)
|
||||
\row
|
||||
\li exp(x)
|
||||
\li Returns the value of E to the power of x
|
||||
\row
|
||||
\li e()
|
||||
\li Returns Euler's number E (2.71828...)
|
||||
\row
|
||||
\li floor(x)
|
||||
\li Returns the value of x rounded down to the next integer
|
||||
\row
|
||||
\li hex(x)
|
||||
\li Returns the hexadecimal representation of x
|
||||
\row
|
||||
\li log(x)
|
||||
\li Returns the natural logarithm (base E) of x
|
||||
\row
|
||||
\li max(x, y)
|
||||
\li Returns the higher value of x and y
|
||||
\row
|
||||
\li min(x, y)
|
||||
\li Returns the lower value of x and y
|
||||
\row
|
||||
\li oct(x)
|
||||
\li Returns the octal representation of x
|
||||
\row
|
||||
\li pi()
|
||||
\li Returns PI (3.14159...)
|
||||
\row
|
||||
\li pow(x, y)
|
||||
\li Returns the value of x to the power of y
|
||||
\row
|
||||
\li random()
|
||||
\li Returns a random number between 0 and 1
|
||||
\row
|
||||
\li round(x)
|
||||
\li Returns the value of x rounded to the next integer
|
||||
\row
|
||||
\li sin(x)
|
||||
\li Returns the sine of x (x is in radians)
|
||||
\row
|
||||
\li sqrt(x)
|
||||
\li Returns the square root of x
|
||||
\row
|
||||
\li tan(x)
|
||||
\li Returns the tangent of x (x is in radians)
|
||||
\endtable
|
||||
*/
|
||||
|
||||
@@ -174,8 +174,8 @@
|
||||
\li -debug <executable>[,kit=<kit>]
|
||||
\li Debugger plugin: launch and debug the executable with the name
|
||||
\c{executable}.
|
||||
A \c{kit} can be specified to point to non-default debuggers
|
||||
and sysroots.
|
||||
A \c{kit} can be specified by ID or name to point to non-default
|
||||
debuggers and sysroots.
|
||||
|
||||
\row
|
||||
\li -debug [executable,]core=<corefile>[,kit=<kit>]
|
||||
@@ -186,8 +186,8 @@
|
||||
it from the core file itself. This will fail for paths with more
|
||||
than about 80 characters.
|
||||
In such cases the \c{executable} parameter is mandatory.
|
||||
A \c{kit} can be specified to point to non-default debuggers
|
||||
and sysroots.
|
||||
A \c{kit} can be specified by ID or name to point to non-default
|
||||
debuggers and sysroots.
|
||||
|
||||
\row
|
||||
\li -debug <executable>,server=<server:port>[,kit=<kit>]
|
||||
@@ -195,8 +195,8 @@
|
||||
\c{port} on the server \c{server}. The parameter \c{executable}
|
||||
specifies a local copy of the executable the remote debug server
|
||||
is manipulating.
|
||||
A \c{kit} can be specified to point to non-default debuggers and
|
||||
sysroots.
|
||||
A \c{kit} can be specified by ID or name to point to non-default
|
||||
debuggers and sysroots.
|
||||
|
||||
\row
|
||||
\li -wincrashevent <event-handle:pid>
|
||||
|
||||
@@ -22,18 +22,22 @@ Product {
|
||||
Depends { name: product.name + " dev headers"; required: false }
|
||||
Depends { name: "Qt.core"; versionAtLeast: "5.6.2" }
|
||||
|
||||
Properties {
|
||||
condition: Utilities.versionCompare(Qt.core.version, "5.7") < 0
|
||||
// TODO: Should fall back to what came from Qt.core for Qt < 5.7, but we cannot express that
|
||||
// atm. Conditionally pulling in a module that sets the property is also not possible,
|
||||
// because conflicting scalar values would be reported (QBS-1225 would fix that).
|
||||
cpp.minimumMacosVersion: project.minimumMacosVersion
|
||||
}
|
||||
|
||||
Properties {
|
||||
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("clang")
|
||||
cpp.cxxFlags: base.concat(["-Wno-noexcept-type"])
|
||||
}
|
||||
Properties {
|
||||
condition: qbs.toolchain.contains("msvc")
|
||||
cpp.cxxFlags: base.concat(["/w44996"])
|
||||
}
|
||||
cpp.cxxLanguageVersion: "c++14"
|
||||
cpp.defines: qtc.generalDefines
|
||||
cpp.minimumWindowsVersion: qbs.architecture === "x86" ? "5.1" : "5.2"
|
||||
cpp.minimumWindowsVersion: "6.1"
|
||||
cpp.useCxxPrecompiledHeader: useNonGuiPchFile || useGuiPchFile
|
||||
cpp.visibility: "minimal"
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ function isSuitableLLVMConfig(llvmConfigCandidate, qtcFunctions)
|
||||
return false;
|
||||
}
|
||||
|
||||
function llvmConfig(qbs, qtcFunctions)
|
||||
function llvmConfig(hostOS, qtcFunctions)
|
||||
{
|
||||
var llvmInstallDirFromEnv = Environment.getEnv("LLVM_INSTALL_DIR")
|
||||
var llvmConfigVariants = [
|
||||
@@ -37,7 +37,7 @@ function llvmConfig(qbs, qtcFunctions)
|
||||
];
|
||||
|
||||
// Prefer llvm-config* from LLVM_INSTALL_DIR
|
||||
var suffix = qbs.hostOS.contains("windows") ? ".exe" : "";
|
||||
var suffix = hostOS.contains("windows") ? ".exe" : "";
|
||||
if (llvmInstallDirFromEnv) {
|
||||
for (var i = 0; i < llvmConfigVariants.length; ++i) {
|
||||
var variant = llvmInstallDirFromEnv + "/bin/" + llvmConfigVariants[i] + suffix;
|
||||
@@ -48,7 +48,7 @@ function llvmConfig(qbs, qtcFunctions)
|
||||
|
||||
// Find llvm-config* in PATH
|
||||
var pathListString = Environment.getEnv("PATH");
|
||||
var separator = qbs.hostOS.contains("windows") ? ";" : ":";
|
||||
var separator = hostOS.contains("windows") ? ";" : ":";
|
||||
var pathList = pathListString.split(separator);
|
||||
for (var i = 0; i < llvmConfigVariants.length; ++i) {
|
||||
for (var j = 0; j < pathList.length; ++j) {
|
||||
|
||||
@@ -9,6 +9,9 @@ Module {
|
||||
Probe {
|
||||
id: clangProbe
|
||||
|
||||
property stringList hostOS: qbs.hostOS
|
||||
property stringList targetOS: qbs.targetOS
|
||||
|
||||
property string llvmConfig
|
||||
property string llvmVersion
|
||||
property string llvmIncludeDir
|
||||
@@ -21,12 +24,12 @@ Module {
|
||||
property string llvmBuildMode
|
||||
|
||||
configure: {
|
||||
llvmConfig = ClangFunctions.llvmConfig(qbs, QtcFunctions);
|
||||
llvmConfig = ClangFunctions.llvmConfig(hostOS, QtcFunctions);
|
||||
llvmVersion = ClangFunctions.version(llvmConfig);
|
||||
llvmIncludeDir = ClangFunctions.includeDir(llvmConfig);
|
||||
llvmLibDir = ClangFunctions.libDir(llvmConfig);
|
||||
llvmLibs = ClangFunctions.libraries(qbs.targetOS);
|
||||
llvmToolingLibs = ClangFunctions.toolingLibs(llvmConfig, qbs.targetOS);
|
||||
llvmLibs = ClangFunctions.libraries(targetOS);
|
||||
llvmToolingLibs = ClangFunctions.toolingLibs(llvmConfig, targetOS);
|
||||
llvmBuildMode = ClangFunctions.buildMode(llvmConfig);
|
||||
var toolingParams = ClangFunctions.toolingParameters(llvmConfig);
|
||||
llvmToolingDefines = toolingParams.defines;
|
||||
|
||||
@@ -14,7 +14,7 @@ Module {
|
||||
? ["@loader_path/" + FileInfo.relativePath('/' + appInstallDir, '/' + libInstallDir)]
|
||||
: ["$ORIGIN/..", "$ORIGIN/../" + qtc.ide_library_path]
|
||||
property string resourcesInstallDir: qtc.ide_data_path + "/qbs"
|
||||
property string pluginsInstallDir: qtc.ide_plugin_path
|
||||
property string pluginsInstallDir: qtc.ide_plugin_path + "/qbs/plugins"
|
||||
property string appInstallDir: qtc.ide_bin_path
|
||||
property string libexecInstallDir: qtc.ide_libexec_path
|
||||
property bool installHtml: false
|
||||
|
||||
@@ -85,6 +85,7 @@ Module {
|
||||
"QT_USE_FAST_OPERATOR_PLUS",
|
||||
"QT_USE_FAST_CONCATENATION",
|
||||
].concat(testsEnabled ? ["WITH_TESTS"] : [])
|
||||
.concat(qbs.toolchain.contains("msvc") ? ["_CRT_SECURE_NO_WARNINGS"] : [])
|
||||
|
||||
Rule {
|
||||
condition: make_dev_package
|
||||
|
||||
@@ -106,7 +106,7 @@ osx {
|
||||
|
||||
# check if IDE_BUILD_TREE is actually an existing Qt Creator.app,
|
||||
# for building against a binary package
|
||||
exists($$IDE_BUILD_TREE/Contents/MacOS/Qt Creator): IDE_APP_BUNDLE = $$IDE_BUILD_TREE
|
||||
exists($$IDE_BUILD_TREE/Contents/MacOS/$$IDE_APP_TARGET): IDE_APP_BUNDLE = $$IDE_BUILD_TREE
|
||||
else: IDE_APP_BUNDLE = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app
|
||||
|
||||
# set output path if not set manually
|
||||
|
||||
@@ -2,7 +2,7 @@ include(qtcreator.pri)
|
||||
|
||||
#version check qt
|
||||
!minQtVersion(5, 6, 2) {
|
||||
message("Cannot build Qt Creator with Qt version $${QT_VERSION}.")
|
||||
message("Cannot build $$IDE_DISPLAY_NAME with Qt version $${QT_VERSION}.")
|
||||
error("Use at least Qt 5.6.2.")
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ linux {
|
||||
}
|
||||
|
||||
macx {
|
||||
APPBUNDLE = "$$OUT_PWD/bin/Qt Creator.app"
|
||||
BINDIST_SOURCE = "$$OUT_PWD/bin/Qt Creator.app"
|
||||
APPBUNDLE = "$$OUT_PWD/bin/$${IDE_APP_TARGET}.app"
|
||||
BINDIST_SOURCE = "$$OUT_PWD/bin/$${IDE_APP_TARGET}.app"
|
||||
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
|
||||
dmg.commands = python -u \"$$PWD/scripts/makedmg.py\" \"$${BASENAME}.dmg\" \"Qt Creator\" \"$$IDE_SOURCE_TREE\" \"$$OUT_PWD/bin\"
|
||||
#dmg.depends = deployqt
|
||||
QMAKE_EXTRA_TARGETS += codesign dmg
|
||||
} else {
|
||||
|
||||
@@ -163,3 +163,17 @@ def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None):
|
||||
if is_unix_executable(filepath) or is_unix_library(filepath):
|
||||
fix_rpaths_helper(filepath)
|
||||
|
||||
def is_debug_file(filepath):
|
||||
if is_mac_platform():
|
||||
return filepath.endswith('.dSYM') or '.dSYM/' in filepath
|
||||
elif 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))]
|
||||
|
||||
@@ -45,28 +45,13 @@ def parse_arguments():
|
||||
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))
|
||||
ignore=(common.is_not_debug if arguments.debug else common.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])
|
||||
|
||||
60
scripts/makedmg.py
Executable file
60
scripts/makedmg.py
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/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 time
|
||||
|
||||
import common
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser(description='Create Qt Creator disk image, filtering out debug information files.')
|
||||
parser.add_argument('target_diskimage', help='output .dmg file to create')
|
||||
parser.add_argument('dmg_volumename', help='volume name to use for the disk image')
|
||||
parser.add_argument('source_directory', help='directory with the Qt Creator sources')
|
||||
parser.add_argument('binary_directory', help='directory that contains the Qt Creator.app')
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
arguments = parse_arguments()
|
||||
tempdir_base = tempfile.mkdtemp()
|
||||
tempdir = os.path.join(tempdir_base, os.path.basename(arguments.binary_directory))
|
||||
try:
|
||||
common.copytree(arguments.binary_directory, tempdir, symlinks=True, ignore=common.is_debug)
|
||||
os.symlink('/Applications', os.path.join(tempdir, 'Applications'))
|
||||
shutil.copy(os.path.join(arguments.source_directory, 'LICENSE.GPL3-EXCEPT'), tempdir)
|
||||
dmg_cmd = ['hdiutil', 'create', '-srcfolder', tempdir, '-volname', arguments.dmg_volumename,
|
||||
'-format', 'UDBZ', arguments.target_diskimage, '-ov', '-scrub', '-size', '1g', '-verbose']
|
||||
subprocess.check_call(dmg_cmd)
|
||||
# sleep a few seconds to make sure disk image is fully unmounted etc
|
||||
time.sleep(5)
|
||||
finally:
|
||||
shutil.rmtree(tempdir_base)
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (C) 2016 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
[ $# -lt 2 ] && echo "Usage: $(basename $0) <folder> <name.dmg>" && exit 2
|
||||
[ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2;
|
||||
sourceFolder="$1"
|
||||
intermediateFolder=$(mktemp -d "/tmp/packagedir.XXXXX")
|
||||
finalDMGName="$2"
|
||||
title="Qt Creator"
|
||||
|
||||
echo Preparing image artifacts...
|
||||
cp -a "${sourceFolder}/" "${intermediateFolder}"
|
||||
ln -s /Applications "${intermediateFolder}"
|
||||
cp "$(dirname "${BASH_SOURCE[0]}")/../LICENSE.GPL3-EXCEPT" "${intermediateFolder}/LICENSE.GPL3-EXCEPT.txt"
|
||||
echo Creating image...
|
||||
hdiutil create -srcfolder "${intermediateFolder}" -volname "${title}" -format UDBZ "${finalDMGName}" -ov -scrub -size 1g -verbose
|
||||
# make sure that the image is umounted etc
|
||||
sleep 4
|
||||
|
||||
# clean up
|
||||
rm -rf "${intermediateFolder}"
|
||||
@@ -31,6 +31,7 @@ except:
|
||||
import gdb
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
import struct
|
||||
import tempfile
|
||||
@@ -995,15 +996,11 @@ class Dumper(DumperBase):
|
||||
def handleNewObjectFile(self, objfile):
|
||||
name = objfile.filename
|
||||
if self.isWindowsTarget():
|
||||
isQtCoreObjFile = name.find('Qt5Cored.dll') >= 0 or name.find('Qt5Core.dll') >= 0
|
||||
if not isQtCoreObjFile:
|
||||
isQtCoreObjFile = name.find('QtCored.dll') >= 0 or name.find('QtCore.dll') >= 0
|
||||
qtCoreMatch = re.match('.*Qt5?Core[^/.]*d?\.dll', name)
|
||||
else:
|
||||
isQtCoreObjFile = name.find('/libQt5Core') >= 0
|
||||
if not isQtCoreObjFile:
|
||||
isQtCoreObjFile = name.find('/libQtCore') >= 0
|
||||
qtCoreMatch = re.match('.*/libQt5?Core[^/.]\.so', name)
|
||||
|
||||
if isQtCoreObjFile:
|
||||
if qtCoreMatch is not None:
|
||||
self.handleQtCoreLoaded(objfile)
|
||||
|
||||
def handleQtCoreLoaded(self, objfile):
|
||||
|
||||
@@ -54,7 +54,7 @@ Enumeration::Enumeration(const QString &scope, const QString &name)
|
||||
|
||||
QmlDesigner::EnumerationName QmlDesigner::Enumeration::scope() const
|
||||
{
|
||||
return m_enumerationName.split('.').first();
|
||||
return m_enumerationName.split('.').constFirst();
|
||||
}
|
||||
|
||||
EnumerationName Enumeration::name() const
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
},
|
||||
{
|
||||
"name": "UseVirtualKeyboard",
|
||||
"trDisplayName": "Use Qt Virtual Keyboard.",
|
||||
"trDisplayName": "Use Qt Virtual Keyboard",
|
||||
"type": "CheckBox",
|
||||
"data":
|
||||
{
|
||||
|
||||
@@ -10840,7 +10840,7 @@ Dies ist unabhängig vom Wert der Eigenschaft "visible" in QML.</trans
|
||||
<name>TextEditor</name>
|
||||
<message>
|
||||
<source>Text Editor</source>
|
||||
<translation>Text Editor</translation>
|
||||
<translation>Texteditor</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@@ -43079,7 +43079,7 @@ Bitte aktualisieren Sie Ihr Kit oder wählen Sie eine mkspec für qmake, die bes
|
||||
</message>
|
||||
<message>
|
||||
<source>Text Editor</source>
|
||||
<translation>Text Editor</translation>
|
||||
<translation>Texteditor</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
||||
@@ -569,6 +569,8 @@ AST *Parser::parse(int startToken)
|
||||
action = nt_action(_stateStack[_tos], lhs[ruleno] - TERMINAL_COUNT);
|
||||
} else if (action == 0) {
|
||||
++recoveryAttempts;
|
||||
if (recoveryAttempts > 10)
|
||||
break;
|
||||
const int line = _tokens[yyloc].line + 1;
|
||||
QString message = QLatin1String("Syntax error");
|
||||
if (yytoken != -1) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +1,31 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** 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.
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://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.
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
@@ -49,8 +54,7 @@ const char *const GLSLParserTable::spell [] = {
|
||||
"-=", "switch", "~", "type_name", "uint", "uniform", "usampler1D", "usampler1DArray", "usampler2D", "usampler2DArray",
|
||||
"usampler2DMS", "usampler2DMSarray", "usampler2DRect", "usampler3D", "usamplerBuffer", "usamplerCube", "usamplerCubeArray", "uvec2", "uvec3", "uvec4",
|
||||
"varying", "vec2", "vec3", "vec4", "|", "void", "while", "^=", "^^", "true",
|
||||
"false", "preprocessor directive", "comment", "error", "reserved word"
|
||||
};
|
||||
"false", "preprocessor directive", "comment", "error", "reserved word"};
|
||||
|
||||
const short GLSLParserTable::lhs [] = {
|
||||
176, 177, 177, 177, 177, 177, 179, 179, 179, 179,
|
||||
@@ -84,8 +88,7 @@ const short GLSLParserTable::lhs [] = {
|
||||
240, 241, 249, 249, 250, 250, 242, 251, 251, 243,
|
||||
243, 244, 244, 244, 252, 252, 254, 254, 253, 253,
|
||||
245, 245, 245, 245, 245, 255, 256, 256, 257, 257,
|
||||
257, 258, 222, 175, 175, 259
|
||||
};
|
||||
257, 258, 222, 175, 175, 259};
|
||||
|
||||
const short GLSLParserTable::rhs [] = {
|
||||
1, 1, 1, 1, 1, 3, 1, 4, 1, 3,
|
||||
@@ -119,8 +122,7 @@ const short GLSLParserTable::rhs [] = {
|
||||
2, 5, 3, 1, 1, 4, 7, 1, 1, 3,
|
||||
2, 5, 7, 6, 1, 1, 1, 1, 2, 3,
|
||||
2, 2, 2, 3, 2, 1, 1, 2, 1, 1,
|
||||
1, 2, 0, 2, 2, 2
|
||||
};
|
||||
1, 2, 0, 2, 2, 2};
|
||||
|
||||
const short GLSLParserTable::action_default [] = {
|
||||
0, 0, 0, 0, 32, 165, 172, 173, 174, 31,
|
||||
@@ -169,8 +171,7 @@ const short GLSLParserTable::action_default [] = {
|
||||
0, 0, 292, 281, 277, 0, 83, 108, 0, 0,
|
||||
113, 109, 0, 0, 111, 110, 0, 112, 0, 89,
|
||||
0, 0, 0, 0, 85, 0, 86, 0, 0, 87,
|
||||
0, 88, 316
|
||||
};
|
||||
0, 88, 316};
|
||||
|
||||
const short GLSLParserTable::goto_default [] = {
|
||||
3, 135, 126, 362, 124, 263, 112, 117, 113, 116,
|
||||
@@ -181,8 +182,7 @@ const short GLSLParserTable::goto_default [] = {
|
||||
160, 159, 161, 173, 172, 162, 132, 129, 163, 203,
|
||||
192, 361, 369, 359, 368, 363, 367, 371, 358, 365,
|
||||
366, 370, 402, 400, 410, 390, 427, 388, 394, 391,
|
||||
298, 289, 288, 292, 0
|
||||
};
|
||||
298, 289, 288, 292, 0};
|
||||
|
||||
const short GLSLParserTable::action_index [] = {
|
||||
86, 1180, 3189, 58, -175, -175, -175, -175, -175, -175,
|
||||
@@ -279,8 +279,7 @@ const short GLSLParserTable::action_index [] = {
|
||||
-85, 100, -85, -85, -85, -85, -85, -85, 36, 138,
|
||||
-85, -85, -85, 31, -85, -85, 28, -85, -85, -85,
|
||||
97, 105, -85, -85, -85, 98, -85, -85, -85, -85,
|
||||
-85, -85, -85
|
||||
};
|
||||
-85, -85, -85};
|
||||
|
||||
const short GLSLParserTable::action_info [] = {
|
||||
-25, 332, 446, 246, 339, 306, 450, 319, 428, 251,
|
||||
@@ -785,8 +784,7 @@ const short GLSLParserTable::action_info [] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 430, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
const short GLSLParserTable::action_check [] = {
|
||||
79, 77, 45, 6, 18, 52, 76, 114, 111, 168,
|
||||
@@ -1291,7 +1289,6 @@ const short GLSLParserTable::action_check [] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 75, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1
|
||||
};
|
||||
-1, -1, -1, -1, -1, -1, -1, -1};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** 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.
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://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.
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
|
||||
@@ -132,7 +132,7 @@ bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
return false;
|
||||
}
|
||||
} else if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
|
||||
emit addOutput(tr("The minimum Qt version required for Gradle build to work is %2. "
|
||||
emit addOutput(tr("The minimum Qt version required for Gradle build to work is %1. "
|
||||
"It is recommended to install the latest Qt version.")
|
||||
.arg("5.4.0"), OutputFormat::Stderr);
|
||||
return false;
|
||||
|
||||
@@ -151,7 +151,7 @@ void BackendReceiver::reset()
|
||||
qDeleteAll(m_assistProcessorsTable.begin(), m_assistProcessorsTable.end());
|
||||
m_assistProcessorsTable.clear();
|
||||
|
||||
// Clean up futures for references
|
||||
// Clean up futures for references; TODO: Remove duplication
|
||||
for (ReferencesEntry &entry : m_referencesTable) {
|
||||
entry.futureInterface.cancel();
|
||||
entry.futureInterface.reportFinished();
|
||||
@@ -162,6 +162,11 @@ void BackendReceiver::reset()
|
||||
futureInterface.reportFinished();
|
||||
}
|
||||
m_followTable.clear();
|
||||
for (QFutureInterface<CppTools::ToolTipInfo> &futureInterface : m_toolTipsTable) {
|
||||
futureInterface.cancel();
|
||||
futureInterface.reportFinished();
|
||||
}
|
||||
m_toolTipsTable.clear();
|
||||
}
|
||||
|
||||
void BackendReceiver::alive()
|
||||
|
||||
@@ -46,7 +46,7 @@ class ClangCompletionAssistProcessor : public CppTools::CppCompletionAssistProce
|
||||
|
||||
public:
|
||||
ClangCompletionAssistProcessor();
|
||||
~ClangCompletionAssistProcessor();
|
||||
~ClangCompletionAssistProcessor() override;
|
||||
|
||||
TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) override;
|
||||
|
||||
|
||||
@@ -101,10 +101,8 @@ ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor()
|
||||
m_parserWatcher.cancel();
|
||||
m_parserWatcher.waitForFinished();
|
||||
|
||||
if (m_projectPart) {
|
||||
m_communicator.unregisterTranslationUnitsForEditor(
|
||||
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
|
||||
}
|
||||
if (m_projectPart)
|
||||
unregisterTranslationUnitForEditor();
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::runImpl(
|
||||
@@ -384,11 +382,6 @@ QFuture<CppTools::ToolTipInfo> ClangEditorDocumentProcessor::toolTipInfo(const Q
|
||||
static_cast<quint32>(column));
|
||||
}
|
||||
|
||||
ClangBackEnd::FileContainer ClangEditorDocumentProcessor::fileContainerWithArguments() const
|
||||
{
|
||||
return fileContainerWithArguments(m_projectPart.data());
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::clearDiagnosticsWithFixIts()
|
||||
{
|
||||
m_diagnosticManager.clearDiagnosticsWithFixIts();
|
||||
@@ -442,7 +435,6 @@ void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(CppTools::Pr
|
||||
if (m_projectPart) {
|
||||
if (projectPart->id() == m_projectPart->id())
|
||||
return;
|
||||
m_communicator.unregisterTranslationUnitsForEditor({fileContainerWithArguments()});
|
||||
}
|
||||
|
||||
m_communicator.registerTranslationUnitsForEditor(
|
||||
@@ -450,6 +442,13 @@ void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(CppTools::Pr
|
||||
ClangCodeModel::Utils::setLastSentDocumentRevision(filePath(), revision());
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::unregisterTranslationUnitForEditor()
|
||||
{
|
||||
QTC_ASSERT(m_projectPart, return);
|
||||
m_communicator.unregisterTranslationUnitsForEditor(
|
||||
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists()
|
||||
{
|
||||
if (m_projectPart) {
|
||||
@@ -626,17 +625,6 @@ static QStringList fileArguments(const QString &filePath, CppTools::ProjectPart
|
||||
+ precompiledHeaderOptions(filePath, projectPart);
|
||||
}
|
||||
|
||||
ClangBackEnd::FileContainer
|
||||
ClangEditorDocumentProcessor::fileContainerWithArguments(CppTools::ProjectPart *projectPart) const
|
||||
{
|
||||
const auto projectPartId = projectPart
|
||||
? Utf8String::fromString(projectPart->id())
|
||||
: Utf8String();
|
||||
const QStringList theFileArguments = fileArguments(filePath(), projectPart);
|
||||
|
||||
return {filePath(), projectPartId, Utf8StringVector(theFileArguments), revision()};
|
||||
}
|
||||
|
||||
ClangBackEnd::FileContainer
|
||||
ClangEditorDocumentProcessor::fileContainerWithArgumentsAndDocumentContent(
|
||||
CppTools::ProjectPart *projectPart) const
|
||||
|
||||
@@ -52,7 +52,7 @@ class ClangEditorDocumentProcessor : public CppTools::BaseEditorDocumentProcesso
|
||||
public:
|
||||
ClangEditorDocumentProcessor(BackendCommunicator &communicator,
|
||||
TextEditor::TextDocument *document);
|
||||
~ClangEditorDocumentProcessor();
|
||||
~ClangEditorDocumentProcessor() override;
|
||||
|
||||
// BaseEditorDocumentProcessor interface
|
||||
void runImpl(const CppTools::BaseEditorDocumentParser::UpdateParams &updateParams) override;
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
int line,
|
||||
int column) override;
|
||||
|
||||
ClangBackEnd::FileContainer fileContainerWithArguments() const;
|
||||
void unregisterTranslationUnitForEditor();
|
||||
|
||||
void clearDiagnosticsWithFixIts();
|
||||
|
||||
@@ -110,7 +110,6 @@ private:
|
||||
HeaderErrorDiagnosticWidgetCreator creatorForHeaderErrorDiagnosticWidget(
|
||||
const ClangBackEnd::DiagnosticContainer &firstHeaderErrorDiagnostic);
|
||||
ClangBackEnd::FileContainer simpleFileContainer(const QByteArray &codecName = QByteArray()) const;
|
||||
ClangBackEnd::FileContainer fileContainerWithArguments(CppTools::ProjectPart *projectPart) const;
|
||||
ClangBackEnd::FileContainer fileContainerWithArgumentsAndDocumentContent(
|
||||
CppTools::ProjectPart *projectPart) const;
|
||||
ClangBackEnd::FileContainer fileContainerWithDocumentContent(const QString &projectpartId) const;
|
||||
|
||||
@@ -102,15 +102,14 @@ static QFuture<CppTools::ToolTipInfo> editorDocumentHandlesToolTipInfo(
|
||||
|
||||
ClangHoverHandler::ClangHoverHandler()
|
||||
{
|
||||
setIsAsyncHandler(true);
|
||||
}
|
||||
|
||||
ClangHoverHandler::~ClangHoverHandler()
|
||||
{
|
||||
cancelAsyncCheck();
|
||||
abort();
|
||||
}
|
||||
|
||||
void ClangHoverHandler::identifyMatchAsync(TextEditorWidget *editorWidget,
|
||||
void ClangHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
BaseHoverHandler::ReportPriority report)
|
||||
{
|
||||
@@ -143,10 +142,12 @@ void ClangHoverHandler::identifyMatchAsync(TextEditorWidget *editorWidget,
|
||||
report(Priority_None); // Ops, something went wrong.
|
||||
}
|
||||
|
||||
void ClangHoverHandler::cancelAsyncCheck()
|
||||
void ClangHoverHandler::abort()
|
||||
{
|
||||
if (m_futureWatcher)
|
||||
if (m_futureWatcher) {
|
||||
m_futureWatcher->cancel();
|
||||
m_futureWatcher.reset();
|
||||
}
|
||||
}
|
||||
|
||||
#define RETURN_TEXT_FOR_CASE(enumValue) case TextEditor::HelpItem::enumValue: return #enumValue
|
||||
|
||||
@@ -40,14 +40,14 @@ public:
|
||||
ClangHoverHandler();
|
||||
~ClangHoverHandler() override;
|
||||
|
||||
void identifyMatchAsync(TextEditor::TextEditorWidget *editorWidget,
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
ReportPriority report) override;
|
||||
void decorateToolTip() override;
|
||||
void operateTooltip(TextEditor::TextEditorWidget *editorWidget, const QPoint &point) override;
|
||||
|
||||
private:
|
||||
void cancelAsyncCheck() override;
|
||||
void abort() override;
|
||||
void processToolTipInfo(const CppTools::ToolTipInfo &info);
|
||||
|
||||
private:
|
||||
|
||||
@@ -376,7 +376,7 @@ void ModelManagerSupportClang::unregisterTranslationUnitsWithProjectParts(
|
||||
{
|
||||
const auto processors = clangProcessorsWithProjectParts(projectPartIds);
|
||||
foreach (ClangEditorDocumentProcessor *processor, processors) {
|
||||
m_communicator.unregisterTranslationUnitsForEditor({processor->fileContainerWithArguments()});
|
||||
processor->unregisterTranslationUnitForEditor();
|
||||
processor->clearProjectPart();
|
||||
processor->run();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class ModelManagerSupportClang:
|
||||
|
||||
public:
|
||||
ModelManagerSupportClang();
|
||||
~ModelManagerSupportClang();
|
||||
~ModelManagerSupportClang() override;
|
||||
|
||||
CppTools::CppCompletionAssistProvider *completionAssistProvider() override;
|
||||
TextEditor::BaseHoverHandler *createHoverHandler() override;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <dynamicastmatcherdiagnosticmessagecontainer.h>
|
||||
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
|
||||
namespace ClangRefactoring {
|
||||
|
||||
@@ -38,8 +39,12 @@ ClangQueryHoverHandler::ClangQueryHoverHandler(ClangQueryHighlighter *highligher
|
||||
{
|
||||
}
|
||||
|
||||
void ClangQueryHoverHandler::identifyMatch(TextEditor::TextEditorWidget *editorWidget, int position)
|
||||
void ClangQueryHoverHandler::identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
||||
int position,
|
||||
ReportPriority report)
|
||||
{
|
||||
Utils::ExecuteOnDestruction reportPriority([this, report](){ report(priority()); });
|
||||
|
||||
using Messages = ClangBackEnd::DynamicASTMatcherDiagnosticMessageContainers;
|
||||
using Contexts = ClangBackEnd::DynamicASTMatcherDiagnosticContextContainers;
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ public:
|
||||
ClangQueryHoverHandler(ClangQueryHighlighter *highligher);
|
||||
|
||||
protected:
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget, int position) override;
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
||||
int position,
|
||||
ReportPriority report) override;
|
||||
|
||||
private:
|
||||
ClangQueryHighlighter *m_highligher;
|
||||
|
||||
@@ -813,7 +813,7 @@ void ServerModeReader::addTargets(const QHash<Utils::FileName, ProjectExplorer::
|
||||
if (cr->type != CrossReference::TARGET) {
|
||||
if (path == targetPath) {
|
||||
if (bt->line >= 0)
|
||||
dn = tr("%1 in line %3").arg(btName).arg(bt->line);
|
||||
dn = tr("%1 in line %2").arg(btName).arg(bt->line);
|
||||
else
|
||||
dn = tr("%1").arg(btName);
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,11 @@
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
enum JavaScriptAction
|
||||
{
|
||||
ResetEngine = QVariant::UserType + 1
|
||||
};
|
||||
|
||||
JavaScriptFilter::JavaScriptFilter()
|
||||
{
|
||||
setId("JavaScriptFilter");
|
||||
@@ -48,6 +53,7 @@ void JavaScriptFilter::prepareSearch(const QString &entry)
|
||||
{
|
||||
Q_UNUSED(entry);
|
||||
|
||||
if (!m_engine)
|
||||
setupEngine();
|
||||
}
|
||||
|
||||
@@ -56,13 +62,17 @@ QList<LocatorFilterEntry> JavaScriptFilter::matchesFor(
|
||||
{
|
||||
Q_UNUSED(future);
|
||||
|
||||
QList<LocatorFilterEntry> entries;
|
||||
if (entry.trimmed().isEmpty()) {
|
||||
entries.append({this, tr("Reset Engine"), QVariant(ResetEngine, nullptr)});
|
||||
} else {
|
||||
const QString result = m_engine->evaluate(entry).toString();
|
||||
const QString expression = entry + " = " + result;
|
||||
|
||||
QList<LocatorFilterEntry> entries;
|
||||
entries.append({this, expression, QVariant()});
|
||||
entries.append({this, tr("Copy to clipboard: %1").arg(result), result});
|
||||
entries.append({this, tr("Copy to clipboard: %1").arg(expression), expression});
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
@@ -77,6 +87,11 @@ void JavaScriptFilter::accept(Core::LocatorFilterEntry selection, QString *newTe
|
||||
if (selection.internalData.isNull())
|
||||
return;
|
||||
|
||||
if (selection.internalData.userType() == ResetEngine) {
|
||||
m_engine.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
QClipboard *clipboard = QGuiApplication::clipboard();
|
||||
clipboard->setText(selection.internalData.toString());
|
||||
}
|
||||
@@ -89,10 +104,7 @@ void JavaScriptFilter::refresh(QFutureInterface<void> &future)
|
||||
|
||||
void JavaScriptFilter::setupEngine()
|
||||
{
|
||||
if (m_engine)
|
||||
return;
|
||||
|
||||
m_engine = new QJSEngine(this);
|
||||
m_engine.reset(new QJSEngine);
|
||||
m_engine->evaluate(
|
||||
"function abs(x) { return Math.abs(x); }\n"
|
||||
"function acos(x) { return Math.acos(x); }\n"
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <coreplugin/locator/ilocatorfilter.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QJSEngine;
|
||||
QT_END_NAMESPACE
|
||||
@@ -51,7 +53,7 @@ public:
|
||||
private:
|
||||
void setupEngine();
|
||||
|
||||
QJSEngine *m_engine = nullptr;
|
||||
mutable std::unique_ptr<QJSEngine> m_engine;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
|
||||
#include <QPoint>
|
||||
#include <QTextBlock>
|
||||
@@ -164,8 +165,12 @@ static QString findResourceInProject(const QString &resName)
|
||||
return QString();
|
||||
}
|
||||
|
||||
void ResourcePreviewHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos)
|
||||
void ResourcePreviewHoverHandler::identifyMatch(TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
ReportPriority report)
|
||||
{
|
||||
Utils::ExecuteOnDestruction reportPriority([this, report](){ report(priority()); });
|
||||
|
||||
if (editorWidget->extraSelectionTooltip(pos).isEmpty()) {
|
||||
const QTextBlock tb = editorWidget->document()->findBlock(pos);
|
||||
const int tbpos = pos - tb.position();
|
||||
|
||||
@@ -35,7 +35,9 @@ namespace Internal {
|
||||
class ResourcePreviewHoverHandler : public TextEditor::BaseHoverHandler
|
||||
{
|
||||
private:
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget, int pos) override;
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
ReportPriority report) override;
|
||||
void operateTooltip(TextEditor::TextEditorWidget *editorWidget, const QPoint &point) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -101,9 +101,7 @@ static void addBuiltinConfigs(ClangDiagnosticConfigsModel &model)
|
||||
ClangDiagnosticConfigsModel::ClangDiagnosticConfigsModel(const ClangDiagnosticConfigs &customConfigs)
|
||||
{
|
||||
addBuiltinConfigs(*this);
|
||||
|
||||
foreach (const ClangDiagnosticConfig &config, customConfigs)
|
||||
m_diagnosticConfigs.append(config);
|
||||
m_diagnosticConfigs.append(customConfigs);
|
||||
}
|
||||
|
||||
int ClangDiagnosticConfigsModel::size() const
|
||||
|
||||
@@ -183,11 +183,6 @@ void CppCodeModelSettings::setPCHUsage(CppCodeModelSettings::PCHUsage pchUsage)
|
||||
m_pchUsage = pchUsage;
|
||||
}
|
||||
|
||||
void CppCodeModelSettings::emitChanged()
|
||||
{
|
||||
emit changed();
|
||||
}
|
||||
|
||||
bool CppCodeModelSettings::interpretAmbigiousHeadersAsCHeaders() const
|
||||
{
|
||||
return m_interpretAmbigiousHeadersAsCHeaders;
|
||||
|
||||
@@ -78,12 +78,8 @@ public:
|
||||
QString clazyChecks() const;
|
||||
void setClazyChecks(QString checks);
|
||||
|
||||
public: // for tests
|
||||
void emitChanged();
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
void clangDiagnosticConfigIdChanged();
|
||||
|
||||
private:
|
||||
PCHUsage m_pchUsage = PchUse_None;
|
||||
|
||||
@@ -57,6 +57,269 @@ static QStringList stripName(const QString &name)
|
||||
return all;
|
||||
}
|
||||
|
||||
CppElement::CppElement() : helpCategory(TextEditor::HelpItem::Unknown)
|
||||
{}
|
||||
|
||||
CppElement::~CppElement()
|
||||
{}
|
||||
|
||||
class Unknown : public CppElement
|
||||
{
|
||||
public:
|
||||
explicit Unknown(const QString &type) : type(type)
|
||||
{
|
||||
tooltip = type;
|
||||
}
|
||||
|
||||
public:
|
||||
QString type;
|
||||
};
|
||||
|
||||
class CppInclude : public CppElement
|
||||
{
|
||||
public:
|
||||
explicit CppInclude(const Document::Include &includeFile)
|
||||
: path(QDir::toNativeSeparators(includeFile.resolvedFileName()))
|
||||
, fileName(Utils::FileName::fromString(includeFile.resolvedFileName()).fileName())
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Brief;
|
||||
helpIdCandidates = QStringList(fileName);
|
||||
helpMark = fileName;
|
||||
link = Utils::Link(path);
|
||||
tooltip = path;
|
||||
}
|
||||
|
||||
public:
|
||||
QString path;
|
||||
QString fileName;
|
||||
};
|
||||
|
||||
class CppMacro : public CppElement
|
||||
{
|
||||
public:
|
||||
explicit CppMacro(const Macro ¯o)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Macro;
|
||||
const QString macroName = QString::fromUtf8(macro.name(), macro.name().size());
|
||||
helpIdCandidates = QStringList(macroName);
|
||||
helpMark = macroName;
|
||||
link = Utils::Link(macro.fileName(), macro.line());
|
||||
tooltip = macro.toStringWithLineBreaks();
|
||||
}
|
||||
};
|
||||
|
||||
// CppDeclarableElement
|
||||
CppDeclarableElement::CppDeclarableElement(Symbol *declaration)
|
||||
: CppElement()
|
||||
, declaration(declaration)
|
||||
, icon(Icons::iconForSymbol(declaration))
|
||||
{
|
||||
Overview overview;
|
||||
overview.showArgumentNames = true;
|
||||
overview.showReturnTypes = true;
|
||||
name = overview.prettyName(declaration->name());
|
||||
if (declaration->enclosingScope()->isClass() ||
|
||||
declaration->enclosingScope()->isNamespace() ||
|
||||
declaration->enclosingScope()->isEnum()) {
|
||||
qualifiedName = overview.prettyName(LookupContext::fullyQualifiedName(declaration));
|
||||
helpIdCandidates = stripName(qualifiedName);
|
||||
} else {
|
||||
qualifiedName = name;
|
||||
helpIdCandidates.append(name);
|
||||
}
|
||||
|
||||
tooltip = overview.prettyType(declaration->type(), qualifiedName);
|
||||
link = CppTools::linkToSymbol(declaration);
|
||||
helpMark = name;
|
||||
}
|
||||
|
||||
class CppNamespace : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppNamespace(Symbol *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::ClassOrNamespace;
|
||||
tooltip = qualifiedName;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CppClass::CppClass(Symbol *declaration) : CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::ClassOrNamespace;
|
||||
tooltip = qualifiedName;
|
||||
}
|
||||
|
||||
bool CppClass::operator==(const CppClass &other)
|
||||
{
|
||||
return this->declaration == other.declaration;
|
||||
}
|
||||
|
||||
void CppClass::lookupBases(Symbol *declaration, const LookupContext &context)
|
||||
{
|
||||
typedef QPair<ClassOrNamespace *, CppClass *> Data;
|
||||
|
||||
if (ClassOrNamespace *clazz = context.lookupType(declaration)) {
|
||||
QSet<ClassOrNamespace *> visited;
|
||||
|
||||
QQueue<Data> q;
|
||||
q.enqueue(qMakePair(clazz, this));
|
||||
while (!q.isEmpty()) {
|
||||
Data current = q.dequeue();
|
||||
clazz = current.first;
|
||||
visited.insert(clazz);
|
||||
const QList<ClassOrNamespace *> &bases = clazz->usings();
|
||||
foreach (ClassOrNamespace *baseClass, bases) {
|
||||
const QList<Symbol *> &symbols = baseClass->symbols();
|
||||
foreach (Symbol *symbol, symbols) {
|
||||
if (symbol->isClass() && (
|
||||
clazz = context.lookupType(symbol)) &&
|
||||
!visited.contains(clazz)) {
|
||||
CppClass baseCppClass(symbol);
|
||||
CppClass *cppClass = current.second;
|
||||
cppClass->bases.append(baseCppClass);
|
||||
q.enqueue(qMakePair(clazz, &cppClass->bases.last()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CppClass::lookupDerived(Symbol *declaration, const Snapshot &snapshot)
|
||||
{
|
||||
typedef QPair<CppClass *, CppTools::TypeHierarchy> Data;
|
||||
|
||||
CppTools::TypeHierarchyBuilder builder(declaration, snapshot);
|
||||
const CppTools::TypeHierarchy &completeHierarchy = builder.buildDerivedTypeHierarchy();
|
||||
|
||||
QQueue<Data> q;
|
||||
q.enqueue(qMakePair(this, completeHierarchy));
|
||||
while (!q.isEmpty()) {
|
||||
const Data ¤t = q.dequeue();
|
||||
CppClass *clazz = current.first;
|
||||
const CppTools::TypeHierarchy &classHierarchy = current.second;
|
||||
foreach (const CppTools::TypeHierarchy &derivedHierarchy, classHierarchy.hierarchy()) {
|
||||
clazz->derived.append(CppClass(derivedHierarchy.symbol()));
|
||||
q.enqueue(qMakePair(&clazz->derived.last(), derivedHierarchy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CppFunction : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppFunction(Symbol *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Function;
|
||||
|
||||
const FullySpecifiedType &type = declaration->type();
|
||||
|
||||
// Functions marks can be found either by the main overload or signature based
|
||||
// (with no argument names and no return). Help ids have no signature at all.
|
||||
Overview overview;
|
||||
overview.showDefaultArguments = false;
|
||||
helpMark = overview.prettyType(type, name);
|
||||
|
||||
overview.showFunctionSignatures = false;
|
||||
helpIdCandidates.append(overview.prettyName(declaration->name()));
|
||||
}
|
||||
};
|
||||
|
||||
class CppEnum : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppEnum(Enum *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Enum;
|
||||
tooltip = qualifiedName;
|
||||
}
|
||||
};
|
||||
|
||||
class CppTypedef : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppTypedef(Symbol *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Typedef;
|
||||
tooltip = Overview().prettyType(declaration->type(), qualifiedName);
|
||||
}
|
||||
};
|
||||
|
||||
class CppVariable : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppVariable(Symbol *declaration, const LookupContext &context, Scope *scope)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
const FullySpecifiedType &type = declaration->type();
|
||||
|
||||
const Name *typeName = 0;
|
||||
if (type->isNamedType()) {
|
||||
typeName = type->asNamedType()->name();
|
||||
} else if (type->isPointerType() || type->isReferenceType()) {
|
||||
FullySpecifiedType associatedType;
|
||||
if (type->isPointerType())
|
||||
associatedType = type->asPointerType()->elementType();
|
||||
else
|
||||
associatedType = type->asReferenceType()->elementType();
|
||||
if (associatedType->isNamedType())
|
||||
typeName = associatedType->asNamedType()->name();
|
||||
}
|
||||
|
||||
if (typeName) {
|
||||
if (ClassOrNamespace *clazz = context.lookupType(typeName, scope)) {
|
||||
if (!clazz->symbols().isEmpty()) {
|
||||
Overview overview;
|
||||
Symbol *symbol = clazz->symbols().at(0);
|
||||
const QString &name = overview.prettyName(
|
||||
LookupContext::fullyQualifiedName(symbol));
|
||||
if (!name.isEmpty()) {
|
||||
tooltip = name;
|
||||
helpCategory = TextEditor::HelpItem::ClassOrNamespace;
|
||||
const QStringList &allNames = stripName(name);
|
||||
if (!allNames.isEmpty()) {
|
||||
helpMark = allNames.last();
|
||||
helpIdCandidates = allNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CppEnumerator : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppEnumerator(EnumeratorDeclaration *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Enum;
|
||||
|
||||
Overview overview;
|
||||
|
||||
Symbol *enumSymbol = declaration->enclosingScope();
|
||||
const QString enumName = overview.prettyName(LookupContext::fullyQualifiedName(enumSymbol));
|
||||
const QString enumeratorName = overview.prettyName(declaration->name());
|
||||
QString enumeratorValue;
|
||||
if (const StringLiteral *value = declaration->constantValue())
|
||||
enumeratorValue = QString::fromUtf8(value->chars(), value->size());
|
||||
|
||||
helpMark = overview.prettyName(enumSymbol->name());
|
||||
|
||||
tooltip = enumeratorName;
|
||||
if (!enumName.isEmpty())
|
||||
tooltip.prepend(enumName + QLatin1Char(' '));
|
||||
if (!enumeratorValue.isEmpty())
|
||||
tooltip.append(QLatin1String(" = ") + enumeratorValue);
|
||||
}
|
||||
};
|
||||
|
||||
CppElementEvaluator::CppElementEvaluator(TextEditor::TextEditorWidget *editor) :
|
||||
m_editor(editor),
|
||||
m_modelManager(CppTools::CppModelManager::instance()),
|
||||
@@ -240,234 +503,4 @@ void CppElementEvaluator::clear()
|
||||
m_diagnosis.clear();
|
||||
}
|
||||
|
||||
// CppElement
|
||||
CppElement::CppElement() : helpCategory(TextEditor::HelpItem::Unknown)
|
||||
{}
|
||||
|
||||
CppElement::~CppElement()
|
||||
{}
|
||||
|
||||
// Unknown
|
||||
Unknown::Unknown(const QString &type) : type(type)
|
||||
{
|
||||
tooltip = type;
|
||||
}
|
||||
|
||||
|
||||
// CppInclude
|
||||
|
||||
CppInclude::CppInclude(const Document::Include &includeFile) :
|
||||
path(QDir::toNativeSeparators(includeFile.resolvedFileName())),
|
||||
fileName(Utils::FileName::fromString(includeFile.resolvedFileName()).fileName())
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Brief;
|
||||
helpIdCandidates = QStringList(fileName);
|
||||
helpMark = fileName;
|
||||
link = Utils::Link(path);
|
||||
tooltip = path;
|
||||
}
|
||||
|
||||
// CppMacro
|
||||
CppMacro::CppMacro(const Macro ¯o)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Macro;
|
||||
const QString macroName = QString::fromUtf8(macro.name(), macro.name().size());
|
||||
helpIdCandidates = QStringList(macroName);
|
||||
helpMark = macroName;
|
||||
link = Utils::Link(macro.fileName(), macro.line());
|
||||
tooltip = macro.toStringWithLineBreaks();
|
||||
}
|
||||
|
||||
// CppDeclarableElement
|
||||
|
||||
CppDeclarableElement::CppDeclarableElement(Symbol *declaration)
|
||||
: CppElement()
|
||||
, declaration(declaration)
|
||||
, icon(Icons::iconForSymbol(declaration))
|
||||
{
|
||||
Overview overview;
|
||||
overview.showArgumentNames = true;
|
||||
overview.showReturnTypes = true;
|
||||
name = overview.prettyName(declaration->name());
|
||||
if (declaration->enclosingScope()->isClass() ||
|
||||
declaration->enclosingScope()->isNamespace() ||
|
||||
declaration->enclosingScope()->isEnum()) {
|
||||
qualifiedName = overview.prettyName(LookupContext::fullyQualifiedName(declaration));
|
||||
helpIdCandidates = stripName(qualifiedName);
|
||||
} else {
|
||||
qualifiedName = name;
|
||||
helpIdCandidates.append(name);
|
||||
}
|
||||
|
||||
tooltip = overview.prettyType(declaration->type(), qualifiedName);
|
||||
link = CppTools::linkToSymbol(declaration);
|
||||
helpMark = name;
|
||||
}
|
||||
|
||||
// CppNamespace
|
||||
CppNamespace::CppNamespace(Symbol *declaration) : CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::ClassOrNamespace;
|
||||
tooltip = qualifiedName;
|
||||
}
|
||||
|
||||
// CppClass
|
||||
CppClass::CppClass(Symbol *declaration) : CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::ClassOrNamespace;
|
||||
tooltip = qualifiedName;
|
||||
}
|
||||
|
||||
bool CppClass::operator==(const CppClass &other)
|
||||
{
|
||||
return this->declaration == other.declaration;
|
||||
}
|
||||
|
||||
void CppClass::lookupBases(Symbol *declaration, const LookupContext &context)
|
||||
{
|
||||
typedef QPair<ClassOrNamespace *, CppClass *> Data;
|
||||
|
||||
if (ClassOrNamespace *clazz = context.lookupType(declaration)) {
|
||||
QSet<ClassOrNamespace *> visited;
|
||||
|
||||
QQueue<Data> q;
|
||||
q.enqueue(qMakePair(clazz, this));
|
||||
while (!q.isEmpty()) {
|
||||
Data current = q.dequeue();
|
||||
clazz = current.first;
|
||||
visited.insert(clazz);
|
||||
const QList<ClassOrNamespace *> &bases = clazz->usings();
|
||||
foreach (ClassOrNamespace *baseClass, bases) {
|
||||
const QList<Symbol *> &symbols = baseClass->symbols();
|
||||
foreach (Symbol *symbol, symbols) {
|
||||
if (symbol->isClass() && (
|
||||
clazz = context.lookupType(symbol)) &&
|
||||
!visited.contains(clazz)) {
|
||||
CppClass baseCppClass(symbol);
|
||||
CppClass *cppClass = current.second;
|
||||
cppClass->bases.append(baseCppClass);
|
||||
q.enqueue(qMakePair(clazz, &cppClass->bases.last()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CppClass::lookupDerived(Symbol *declaration, const Snapshot &snapshot)
|
||||
{
|
||||
typedef QPair<CppClass *, CppTools::TypeHierarchy> Data;
|
||||
|
||||
CppTools::TypeHierarchyBuilder builder(declaration, snapshot);
|
||||
const CppTools::TypeHierarchy &completeHierarchy = builder.buildDerivedTypeHierarchy();
|
||||
|
||||
QQueue<Data> q;
|
||||
q.enqueue(qMakePair(this, completeHierarchy));
|
||||
while (!q.isEmpty()) {
|
||||
const Data ¤t = q.dequeue();
|
||||
CppClass *clazz = current.first;
|
||||
const CppTools::TypeHierarchy &classHierarchy = current.second;
|
||||
foreach (const CppTools::TypeHierarchy &derivedHierarchy, classHierarchy.hierarchy()) {
|
||||
clazz->derived.append(CppClass(derivedHierarchy.symbol()));
|
||||
q.enqueue(qMakePair(&clazz->derived.last(), derivedHierarchy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CppFunction
|
||||
CppFunction::CppFunction(Symbol *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Function;
|
||||
|
||||
const FullySpecifiedType &type = declaration->type();
|
||||
|
||||
// Functions marks can be found either by the main overload or signature based
|
||||
// (with no argument names and no return). Help ids have no signature at all.
|
||||
Overview overview;
|
||||
overview.showDefaultArguments = false;
|
||||
helpMark = overview.prettyType(type, name);
|
||||
|
||||
overview.showFunctionSignatures = false;
|
||||
helpIdCandidates.append(overview.prettyName(declaration->name()));
|
||||
}
|
||||
|
||||
// CppEnum
|
||||
CppEnum::CppEnum(Enum *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Enum;
|
||||
tooltip = qualifiedName;
|
||||
}
|
||||
|
||||
// CppTypedef
|
||||
CppTypedef::CppTypedef(Symbol *declaration) : CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Typedef;
|
||||
tooltip = Overview().prettyType(declaration->type(), qualifiedName);
|
||||
}
|
||||
|
||||
// CppVariable
|
||||
CppVariable::CppVariable(Symbol *declaration, const LookupContext &context, Scope *scope) :
|
||||
CppDeclarableElement(declaration)
|
||||
{
|
||||
const FullySpecifiedType &type = declaration->type();
|
||||
|
||||
const Name *typeName = 0;
|
||||
if (type->isNamedType()) {
|
||||
typeName = type->asNamedType()->name();
|
||||
} else if (type->isPointerType() || type->isReferenceType()) {
|
||||
FullySpecifiedType associatedType;
|
||||
if (type->isPointerType())
|
||||
associatedType = type->asPointerType()->elementType();
|
||||
else
|
||||
associatedType = type->asReferenceType()->elementType();
|
||||
if (associatedType->isNamedType())
|
||||
typeName = associatedType->asNamedType()->name();
|
||||
}
|
||||
|
||||
if (typeName) {
|
||||
if (ClassOrNamespace *clazz = context.lookupType(typeName, scope)) {
|
||||
if (!clazz->symbols().isEmpty()) {
|
||||
Overview overview;
|
||||
Symbol *symbol = clazz->symbols().at(0);
|
||||
const QString &name =
|
||||
overview.prettyName(LookupContext::fullyQualifiedName(symbol));
|
||||
if (!name.isEmpty()) {
|
||||
tooltip = name;
|
||||
helpCategory = TextEditor::HelpItem::ClassOrNamespace;
|
||||
const QStringList &allNames = stripName(name);
|
||||
if (!allNames.isEmpty()) {
|
||||
helpMark = allNames.last();
|
||||
helpIdCandidates = allNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CppEnumerator::CppEnumerator(EnumeratorDeclaration *declaration)
|
||||
: CppDeclarableElement(declaration)
|
||||
{
|
||||
helpCategory = TextEditor::HelpItem::Enum;
|
||||
|
||||
Overview overview;
|
||||
|
||||
Symbol *enumSymbol = declaration->enclosingScope();
|
||||
const QString enumName = overview.prettyName(LookupContext::fullyQualifiedName(enumSymbol));
|
||||
const QString enumeratorName = overview.prettyName(declaration->name());
|
||||
QString enumeratorValue;
|
||||
if (const StringLiteral *value = declaration->constantValue())
|
||||
enumeratorValue = QString::fromUtf8(value->chars(), value->size());
|
||||
|
||||
helpMark = overview.prettyName(enumSymbol->name());
|
||||
|
||||
tooltip = enumeratorName;
|
||||
if (!enumName.isEmpty())
|
||||
tooltip.prepend(enumName + QLatin1Char(' '));
|
||||
if (!enumeratorValue.isEmpty())
|
||||
tooltip.append(QLatin1String(" = ") + enumeratorValue);
|
||||
}
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -96,31 +96,6 @@ public:
|
||||
QString tooltip;
|
||||
};
|
||||
|
||||
class Unknown : public CppElement
|
||||
{
|
||||
public:
|
||||
explicit Unknown(const QString &type);
|
||||
|
||||
public:
|
||||
QString type;
|
||||
};
|
||||
|
||||
class CppInclude : public CppElement
|
||||
{
|
||||
public:
|
||||
explicit CppInclude(const CPlusPlus::Document::Include &includeFile);
|
||||
|
||||
public:
|
||||
QString path;
|
||||
QString fileName;
|
||||
};
|
||||
|
||||
class CppMacro : public CppElement
|
||||
{
|
||||
public:
|
||||
explicit CppMacro(const CPlusPlus::Macro ¯o);
|
||||
};
|
||||
|
||||
class CppDeclarableElement : public CppElement
|
||||
{
|
||||
public:
|
||||
@@ -134,12 +109,6 @@ public:
|
||||
QIcon icon;
|
||||
};
|
||||
|
||||
class CppNamespace : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppNamespace(CPlusPlus::Symbol *declaration);
|
||||
};
|
||||
|
||||
class CppClass : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
@@ -156,36 +125,4 @@ public:
|
||||
QList<CppClass> derived;
|
||||
};
|
||||
|
||||
class CppFunction : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppFunction(CPlusPlus::Symbol *declaration);
|
||||
};
|
||||
|
||||
class CppEnum : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppEnum(CPlusPlus::Enum *declaration);
|
||||
};
|
||||
|
||||
class CppTypedef : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppTypedef(CPlusPlus::Symbol *declaration);
|
||||
};
|
||||
|
||||
class CppVariable : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
CppVariable(CPlusPlus::Symbol *declaration,
|
||||
const CPlusPlus::LookupContext &context,
|
||||
CPlusPlus::Scope *scope);
|
||||
};
|
||||
|
||||
class CppEnumerator : public CppDeclarableElement
|
||||
{
|
||||
public:
|
||||
explicit CppEnumerator(CPlusPlus::EnumeratorDeclaration *declaration);
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
#include <utils/textutils.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
|
||||
#include <QTextCursor>
|
||||
#include <QUrl>
|
||||
@@ -67,8 +68,10 @@ QString CppHoverHandler::tooltipTextForHelpItem(const HelpItem &helpItem)
|
||||
return QString();
|
||||
}
|
||||
|
||||
void CppHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos)
|
||||
void CppHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, ReportPriority report)
|
||||
{
|
||||
Utils::ExecuteOnDestruction reportPriority([this, report](){ report(priority()); });
|
||||
|
||||
QTextCursor tc(editorWidget->document());
|
||||
tc.setPosition(pos);
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ public:
|
||||
static QString tooltipTextForHelpItem(const TextEditor::HelpItem &help);
|
||||
|
||||
private:
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget, int pos) override;
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
ReportPriority report) override;
|
||||
void decorateToolTip() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -649,13 +649,18 @@ void CdbEngine::runEngine()
|
||||
// else the debugger will slow down considerably.
|
||||
const auto cb = [this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); };
|
||||
if (boolSetting(CdbBreakOnCrtDbgReport)) {
|
||||
const QString module = msvcRunTime(runParameters().toolChainAbi.osFlavor());
|
||||
Abi::OSFlavor flavor = runParameters().toolChainAbi.osFlavor();
|
||||
// CrtDebugReport can not be safely resolved for vc 19
|
||||
if ((flavor > Abi::WindowsMsvc2005Flavor && flavor <= Abi::WindowsMsvc2013Flavor) ||
|
||||
flavor > Abi::WindowsMSysFlavor || flavor <= Abi::WindowsCEFlavor) {
|
||||
const QString module = msvcRunTime(flavor);
|
||||
const QString debugModule = module + 'D';
|
||||
const QString wideFunc = QString::fromLatin1(CdbOptionsPage::crtDbgReport).append('W');
|
||||
runCommand({breakAtFunctionCommand(QLatin1String(CdbOptionsPage::crtDbgReport), module), BuiltinCommand, cb});
|
||||
runCommand({breakAtFunctionCommand(wideFunc, module), BuiltinCommand, cb});
|
||||
runCommand({breakAtFunctionCommand(QLatin1String(CdbOptionsPage::crtDbgReport), debugModule), BuiltinCommand, cb});
|
||||
}
|
||||
}
|
||||
// if (boolSetting(BreakOnWarning)) {
|
||||
// runCommand({"bm /( QtCored4!qWarning", BuiltinCommand}); // 'bm': All overloads.
|
||||
// runCommand({"bm /( Qt5Cored!QMessageLogger::warning", BuiltinCommand});
|
||||
|
||||
@@ -1133,6 +1133,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
||||
}
|
||||
} else if (key == "kit") {
|
||||
kit = KitManager::kit(Id::fromString(val));
|
||||
if (!kit)
|
||||
kit = KitManager::kit(Utils::equal(&Kit::displayName, val));
|
||||
} else if (key == "server") {
|
||||
startMode = AttachToRemoteServer;
|
||||
remoteChannel = remoteChannel;
|
||||
|
||||
@@ -4620,7 +4620,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
|
||||
+ ' ' + tr("This can be caused by a path length limitation "
|
||||
"in the core file.")
|
||||
+ ' ' + tr("Try to specify the binary in "
|
||||
"Debug > Start Debugging > Attach to Core.");
|
||||
"Debug > Start Debugging > Load Core File.");
|
||||
notifyInferiorSetupFailedHelper(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -548,10 +548,13 @@ private:
|
||||
|
||||
ExCommandMap &exCommandMap();
|
||||
ExCommandMap &defaultExCommandMap();
|
||||
ExCommandMap exCommandMapFromWidget();
|
||||
|
||||
FakeVimPluginPrivate *m_q;
|
||||
QGroupBox *m_commandBox;
|
||||
FancyLineEdit *m_commandEdit;
|
||||
|
||||
friend class FakeVimExCommandsPage; // allow the page accessing the ExCommandMaps
|
||||
};
|
||||
|
||||
FakeVimExCommandsWidget::FakeVimExCommandsWidget(FakeVimPluginPrivate *q, QWidget *parent)
|
||||
@@ -601,12 +604,12 @@ public:
|
||||
}
|
||||
|
||||
QWidget *widget() override;
|
||||
void apply() override {}
|
||||
void finish() override;
|
||||
void apply() override;
|
||||
void finish() override {}
|
||||
|
||||
private:
|
||||
FakeVimPluginPrivate *m_q;
|
||||
QPointer<QWidget> m_widget;
|
||||
QPointer<FakeVimExCommandsWidget> m_widget;
|
||||
};
|
||||
|
||||
QWidget *FakeVimExCommandsPage::widget()
|
||||
@@ -616,9 +619,44 @@ QWidget *FakeVimExCommandsPage::widget()
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void FakeVimExCommandsPage::finish()
|
||||
const char exCommandMapGroup[] = "FakeVimExCommand";
|
||||
const char userCommandMapGroup[] = "FakeVimUserCommand";
|
||||
const char reKey[] = "RegEx";
|
||||
const char cmdKey[] = "Cmd";
|
||||
const char idKey[] = "Command";
|
||||
|
||||
void FakeVimExCommandsPage::apply()
|
||||
{
|
||||
delete m_widget;
|
||||
if (!m_widget) // page has not been shown at all
|
||||
return;
|
||||
// now save the mappings if necessary
|
||||
const ExCommandMap &newMapping = m_widget->exCommandMapFromWidget();
|
||||
ExCommandMap &globalCommandMapping = m_widget->exCommandMap();
|
||||
|
||||
if (newMapping != globalCommandMapping) {
|
||||
const ExCommandMap &defaultMap = m_widget->defaultExCommandMap();
|
||||
QSettings *settings = ICore::settings();
|
||||
settings->beginWriteArray(exCommandMapGroup);
|
||||
int count = 0;
|
||||
typedef ExCommandMap::const_iterator Iterator;
|
||||
const Iterator end = newMapping.constEnd();
|
||||
for (Iterator it = newMapping.constBegin(); it != end; ++it) {
|
||||
const QString id = it.key();
|
||||
const QRegExp re = it.value();
|
||||
|
||||
if ((defaultMap.contains(id) && defaultMap[id] != re)
|
||||
|| (!defaultMap.contains(id) && !re.pattern().isEmpty())) {
|
||||
settings->setArrayIndex(count);
|
||||
settings->setValue(idKey, id);
|
||||
settings->setValue(reKey, re.pattern());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
settings->endArray();
|
||||
globalCommandMapping.clear();
|
||||
globalCommandMapping.unite(defaultMap);
|
||||
globalCommandMapping.unite(newMapping);
|
||||
}
|
||||
}
|
||||
|
||||
void FakeVimExCommandsWidget::initialize()
|
||||
@@ -658,7 +696,7 @@ void FakeVimExCommandsWidget::initialize()
|
||||
setModified(item, true);
|
||||
}
|
||||
|
||||
handleCurrentCommandChanged(0);
|
||||
handleCurrentCommandChanged(nullptr);
|
||||
}
|
||||
|
||||
void FakeVimExCommandsWidget::handleCurrentCommandChanged(QTreeWidgetItem *current)
|
||||
@@ -681,10 +719,8 @@ void FakeVimExCommandsWidget::commandChanged()
|
||||
const QString name = current->data(0, CommandRole).toString();
|
||||
const QString regex = m_commandEdit->text();
|
||||
|
||||
if (current->data(0, Qt::UserRole).isValid()) {
|
||||
if (current->data(0, Qt::UserRole).isValid())
|
||||
current->setText(2, regex);
|
||||
exCommandMap()[name] = QRegExp(regex);
|
||||
}
|
||||
|
||||
setModified(current, regex != defaultExCommandMap()[name].pattern());
|
||||
}
|
||||
@@ -734,6 +770,8 @@ public:
|
||||
FakeVimUserCommandsModel(FakeVimPluginPrivate *q) : m_q(q) {}
|
||||
~FakeVimUserCommandsModel() {}
|
||||
|
||||
void initCommandMap(const UserCommandMap &commandMap) { m_commandMap = commandMap; }
|
||||
UserCommandMap commandMap() const { return m_commandMap; }
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
@@ -743,6 +781,7 @@ public:
|
||||
|
||||
private:
|
||||
FakeVimPluginPrivate *m_q;
|
||||
UserCommandMap m_commandMap;
|
||||
};
|
||||
|
||||
int FakeVimUserCommandsModel::rowCount(const QModelIndex &parent) const
|
||||
@@ -814,17 +853,19 @@ public:
|
||||
setCategoryIcon(Utils::Icon(SETTINGS_CATEGORY_FAKEVIM_ICON));
|
||||
}
|
||||
|
||||
void apply();
|
||||
void finish() {}
|
||||
void apply() override;
|
||||
void finish() override {}
|
||||
|
||||
QWidget *widget();
|
||||
void initialize() {}
|
||||
UserCommandMap &userCommandMap();
|
||||
UserCommandMap &defaultUserCommandMap();
|
||||
UserCommandMap currentCommandMap();
|
||||
|
||||
private:
|
||||
FakeVimPluginPrivate *m_q;
|
||||
QPointer<QWidget> m_widget;
|
||||
FakeVimUserCommandsModel *m_model;
|
||||
};
|
||||
|
||||
QWidget *FakeVimUserCommandsPage::widget()
|
||||
@@ -832,10 +873,11 @@ QWidget *FakeVimUserCommandsPage::widget()
|
||||
if (!m_widget) {
|
||||
m_widget = new QWidget;
|
||||
|
||||
auto model = new FakeVimUserCommandsModel(m_q);
|
||||
m_model = new FakeVimUserCommandsModel(m_q);
|
||||
m_model->initCommandMap(userCommandMap());
|
||||
auto widget = new QTreeView;
|
||||
model->setParent(widget);
|
||||
widget->setModel(model);
|
||||
m_model->setParent(widget);
|
||||
widget->setModel(m_model);
|
||||
widget->resizeColumnToContents(0);
|
||||
|
||||
auto delegate = new FakeVimUserCommandsDelegate(widget);
|
||||
@@ -850,8 +892,37 @@ QWidget *FakeVimUserCommandsPage::widget()
|
||||
|
||||
void FakeVimUserCommandsPage::apply()
|
||||
{
|
||||
//m_q->writeSettings();
|
||||
delete m_widget;
|
||||
if (!m_widget) // page has not been shown at all
|
||||
return;
|
||||
|
||||
// now save the mappings if necessary
|
||||
const UserCommandMap ¤t = currentCommandMap();
|
||||
UserCommandMap &userMap = userCommandMap();
|
||||
|
||||
if (current != userMap) {
|
||||
QSettings *settings = ICore::settings();
|
||||
settings->beginWriteArray(userCommandMapGroup);
|
||||
int count = 0;
|
||||
typedef UserCommandMap::const_iterator Iterator;
|
||||
const Iterator end = current.constEnd();
|
||||
for (Iterator it = current.constBegin(); it != end; ++it) {
|
||||
const int key = it.key();
|
||||
const QString cmd = it.value();
|
||||
|
||||
if ((defaultUserCommandMap().contains(key)
|
||||
&& defaultUserCommandMap()[key] != cmd)
|
||||
|| (!defaultUserCommandMap().contains(key) && !cmd.isEmpty())) {
|
||||
settings->setArrayIndex(count);
|
||||
settings->setValue(idKey, key);
|
||||
settings->setValue(cmdKey, cmd);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
settings->endArray();
|
||||
userMap.clear();
|
||||
userMap.unite(defaultUserCommandMap());
|
||||
userMap.unite(current);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1122,7 +1193,7 @@ QVariant FakeVimUserCommandsModel::data(const QModelIndex &index, int role) cons
|
||||
case 0: // Action
|
||||
return Tr::tr("User command #%1").arg(index.row() + 1);
|
||||
case 1: // Command
|
||||
return m_q->userCommandMap().value(index.row() + 1);
|
||||
return m_commandMap.value(index.row() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1134,7 +1205,7 @@ bool FakeVimUserCommandsModel::setData(const QModelIndex &index,
|
||||
{
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
if (index.column() == 1)
|
||||
m_q->userCommandMap()[index.row() + 1] = data.toString();
|
||||
m_commandMap[index.row() + 1] = data.toString();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1284,58 +1355,10 @@ void FakeVimPluginPrivate::createRelativeNumberWidget(IEditor *editor)
|
||||
}
|
||||
}
|
||||
|
||||
const char exCommandMapGroup[] = "FakeVimExCommand";
|
||||
const char userCommandMapGroup[] = "FakeVimUserCommand";
|
||||
const char reKey[] = "RegEx";
|
||||
const char cmdKey[] = "Cmd";
|
||||
const char idKey[] = "Command";
|
||||
|
||||
void FakeVimPluginPrivate::writeSettings()
|
||||
{
|
||||
QSettings *settings = ICore::settings();
|
||||
|
||||
theFakeVimSettings()->writeSettings(settings);
|
||||
|
||||
{ // block
|
||||
settings->beginWriteArray(exCommandMapGroup);
|
||||
int count = 0;
|
||||
typedef ExCommandMap::const_iterator Iterator;
|
||||
const Iterator end = exCommandMap().constEnd();
|
||||
for (Iterator it = exCommandMap().constBegin(); it != end; ++it) {
|
||||
const QString id = it.key();
|
||||
const QRegExp re = it.value();
|
||||
|
||||
if ((defaultExCommandMap().contains(id) && defaultExCommandMap()[id] != re)
|
||||
|| (!defaultExCommandMap().contains(id) && !re.pattern().isEmpty())) {
|
||||
settings->setArrayIndex(count);
|
||||
settings->setValue(idKey, id);
|
||||
settings->setValue(reKey, re.pattern());
|
||||
++count;
|
||||
}
|
||||
}
|
||||
settings->endArray();
|
||||
} // block
|
||||
|
||||
{ // block
|
||||
settings->beginWriteArray(userCommandMapGroup);
|
||||
int count = 0;
|
||||
typedef UserCommandMap::const_iterator Iterator;
|
||||
const Iterator end = userCommandMap().constEnd();
|
||||
for (Iterator it = userCommandMap().constBegin(); it != end; ++it) {
|
||||
const int key = it.key();
|
||||
const QString cmd = it.value();
|
||||
|
||||
if ((defaultUserCommandMap().contains(key)
|
||||
&& defaultUserCommandMap()[key] != cmd)
|
||||
|| (!defaultUserCommandMap().contains(key) && !cmd.isEmpty())) {
|
||||
settings->setArrayIndex(count);
|
||||
settings->setValue(idKey, key);
|
||||
settings->setValue(cmdKey, cmd);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
settings->endArray();
|
||||
} // block
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::readSettings()
|
||||
@@ -2191,6 +2214,26 @@ ExCommandMap &FakeVimExCommandsWidget::defaultExCommandMap()
|
||||
return m_q->defaultExCommandMap();
|
||||
}
|
||||
|
||||
ExCommandMap FakeVimExCommandsWidget::exCommandMapFromWidget()
|
||||
{
|
||||
ExCommandMap map;
|
||||
int n = commandList()->topLevelItemCount();
|
||||
for (int i = 0; i != n; ++i) {
|
||||
QTreeWidgetItem *section = commandList()->topLevelItem(i);
|
||||
int m = section->childCount();
|
||||
for (int j = 0; j != m; ++j) {
|
||||
QTreeWidgetItem *item = section->child(j);
|
||||
const QString name = item->data(0, CommandRole).toString();
|
||||
const QString regex = item->data(2, Qt::DisplayRole).toString();
|
||||
if ((regex.isEmpty() && defaultExCommandMap().value(name).isEmpty())
|
||||
|| (!regex.isEmpty() && defaultExCommandMap().value(name).pattern() == regex))
|
||||
continue;
|
||||
map[name] = QRegExp(regex);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
UserCommandMap &FakeVimUserCommandsPage::userCommandMap()
|
||||
{
|
||||
return m_q->userCommandMap();
|
||||
@@ -2201,6 +2244,11 @@ UserCommandMap &FakeVimUserCommandsPage::defaultUserCommandMap()
|
||||
return m_q->defaultUserCommandMap();
|
||||
}
|
||||
|
||||
UserCommandMap FakeVimUserCommandsPage::currentCommandMap()
|
||||
{
|
||||
return m_model->commandMap();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FakeVimPlugin
|
||||
|
||||
@@ -270,7 +270,7 @@ void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bun
|
||||
if (prerequisiteOk)
|
||||
reportStarted();
|
||||
else
|
||||
reportFailure(tr("Could not get necessary ports the debugger connection."));
|
||||
reportFailure(tr("Could not get necessary ports for the debugger connection."));
|
||||
}
|
||||
|
||||
void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output)
|
||||
|
||||
@@ -119,7 +119,7 @@ void IosSettingsWidget::onStart()
|
||||
|
||||
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
|
||||
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
statusDialog->addMessage(tr("Starting simulator devices...", "", simulatorInfoList.count()),
|
||||
statusDialog->addMessage(tr("Starting %n simulator device(s)...", "", simulatorInfoList.count()),
|
||||
Utils::NormalMessageFormat);
|
||||
|
||||
QList<QFuture<void>> futureList;
|
||||
@@ -185,7 +185,7 @@ void IosSettingsWidget::onReset()
|
||||
|
||||
const int userInput = QMessageBox::question(this, tr("Reset"),
|
||||
tr("Do you really want to reset the contents and settings"
|
||||
" of the selected devices?", "",
|
||||
" of the %n selected device(s)?", "",
|
||||
simulatorInfoList.count()));
|
||||
if (userInput == QMessageBox::No)
|
||||
return;
|
||||
@@ -242,14 +242,14 @@ void IosSettingsWidget::onDelete()
|
||||
return;
|
||||
|
||||
const int userInput = QMessageBox::question(this, tr("Delete Device"),
|
||||
tr("Do you really want to delete the selected "
|
||||
"devices?", "", simulatorInfoList.count()));
|
||||
tr("Do you really want to delete the %n selected "
|
||||
"device(s)?", "", simulatorInfoList.count()));
|
||||
if (userInput == QMessageBox::No)
|
||||
return;
|
||||
|
||||
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
|
||||
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
statusDialog->addMessage(tr("Deleting simulator devices...", "", simulatorInfoList.count()),
|
||||
statusDialog->addMessage(tr("Deleting %n simulator device(s)...", "", simulatorInfoList.count()),
|
||||
Utils::NormalMessageFormat);
|
||||
QList<QFuture<void>> futureList;
|
||||
foreach (const SimulatorInfo &info, simulatorInfoList) {
|
||||
@@ -280,7 +280,7 @@ void IosSettingsWidget::onScreenshot()
|
||||
|
||||
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
|
||||
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
statusDialog->addMessage(tr("Capturing screenshots from devices...", "",
|
||||
statusDialog->addMessage(tr("Capturing screenshots from %n device(s)...", "",
|
||||
simulatorInfoList.count()), Utils::NormalMessageFormat);
|
||||
QList<QFuture<void>> futureList;
|
||||
foreach (const SimulatorInfo &info, simulatorInfoList) {
|
||||
|
||||
@@ -527,29 +527,33 @@ void Project::setRootProjectNode(ProjectNode *root)
|
||||
root = nullptr;
|
||||
}
|
||||
|
||||
if (root) {
|
||||
ProjectTree::applyTreeManager(root);
|
||||
root->setParentFolderNode(d->m_containerNode.get());
|
||||
}
|
||||
|
||||
ProjectNode *oldNode = d->m_rootProjectNode;
|
||||
|
||||
d->m_rootProjectNode = root;
|
||||
if (root) {
|
||||
if (oldNode || root)
|
||||
handleSubTreeChanged(d->m_containerNode.get());
|
||||
|
||||
delete oldNode;
|
||||
}
|
||||
|
||||
void Project::handleSubTreeChanged(FolderNode *node)
|
||||
{
|
||||
QVector<const Node *> nodeList;
|
||||
root->forEachGenericNode([&nodeList](const Node *n) {
|
||||
if (d->m_rootProjectNode) {
|
||||
d->m_rootProjectNode->forEachGenericNode([&nodeList](const Node *n) {
|
||||
nodeList.append(n);
|
||||
});
|
||||
Utils::sort(nodeList, &nodeLessThan);
|
||||
d->m_sortedNodeList = nodeList;
|
||||
root->setParentFolderNode(d->m_containerNode.get());
|
||||
// Only announce non-null root, null is only used when project is destroyed.
|
||||
// In that case SessionManager::projectRemoved() triggers the update.
|
||||
ProjectTree::emitSubtreeChanged(root);
|
||||
emit fileListChanged();
|
||||
} else {
|
||||
d->m_sortedNodeList.clear();
|
||||
if (oldNode != nullptr)
|
||||
emit fileListChanged();
|
||||
}
|
||||
d->m_sortedNodeList = nodeList;
|
||||
|
||||
delete oldNode;
|
||||
ProjectTree::emitSubtreeChanged(node);
|
||||
emit fileListChanged();
|
||||
}
|
||||
|
||||
Target *Project::restoreTarget(const QVariantMap &data)
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace ProjectExplorer {
|
||||
class BuildInfo;
|
||||
class ContainerNode;
|
||||
class EditorConfiguration;
|
||||
class FolderNode;
|
||||
class NamedWidget;
|
||||
class Node;
|
||||
class ProjectConfiguration;
|
||||
@@ -241,10 +242,12 @@ protected:
|
||||
virtual void projectLoaded(); // Called when the project is fully loaded.
|
||||
|
||||
private:
|
||||
void handleSubTreeChanged(FolderNode *node);
|
||||
void setActiveTarget(Target *target);
|
||||
ProjectPrivate *d;
|
||||
|
||||
friend class Session;
|
||||
friend class ContainerNode;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -628,7 +628,7 @@ bool FolderNode::replaceSubtree(Node *oldNode, Node *newNode)
|
||||
}
|
||||
QTimer::singleShot(0, [oldNode]() { delete oldNode; });
|
||||
}
|
||||
ProjectTree::emitSubtreeChanged(this);
|
||||
handleSubTreeChanged(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -879,6 +879,12 @@ bool FolderNode::isEmpty() const
|
||||
return m_nodes.isEmpty();
|
||||
}
|
||||
|
||||
void FolderNode::handleSubTreeChanged(FolderNode *node)
|
||||
{
|
||||
if (FolderNode *parent = parentFolderNode())
|
||||
parent->handleSubTreeChanged(node);
|
||||
}
|
||||
|
||||
ContainerNode::ContainerNode(Project *project)
|
||||
: FolderNode(project->projectDirectory(), NodeType::Project), m_project(project)
|
||||
{}
|
||||
@@ -915,4 +921,9 @@ void ContainerNode::removeAllChildren()
|
||||
m_nodes.clear();
|
||||
}
|
||||
|
||||
void ContainerNode::handleSubTreeChanged(FolderNode *node)
|
||||
{
|
||||
m_project->handleSubTreeChanged(node);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -294,6 +294,8 @@ public:
|
||||
const FolderNode *asFolderNode() const override { return this; }
|
||||
|
||||
protected:
|
||||
virtual void handleSubTreeChanged(FolderNode *node);
|
||||
|
||||
QList<Node *> m_nodes;
|
||||
QList<LocationInfo> m_locations;
|
||||
|
||||
@@ -361,6 +363,8 @@ public:
|
||||
void removeAllChildren();
|
||||
|
||||
private:
|
||||
void handleSubTreeChanged(FolderNode *node) final;
|
||||
|
||||
Project *m_project;
|
||||
};
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ public:
|
||||
QPushButton *closeAnyway = box.addButton(tr("Cancel Build and Disable Kit in This Project"), QMessageBox::AcceptRole);
|
||||
QPushButton *cancelClose = box.addButton(tr("Do Not Remove"), QMessageBox::RejectRole);
|
||||
box.setDefaultButton(cancelClose);
|
||||
box.setWindowTitle(tr("Disable Kit %1 in This Project?").arg(kitName));
|
||||
box.setWindowTitle(tr("Disable Kit \"%1\" in This Project?").arg(kitName));
|
||||
box.setText(tr("The kit <b>%1</b> is currently being built.").arg(kitName));
|
||||
box.setInformativeText(tr("Do you want to cancel the build process and remove the kit anyway?"));
|
||||
box.exec();
|
||||
|
||||
@@ -109,7 +109,7 @@ QbsProfilesSettingsWidget::QbsProfilesSettingsWidget(QWidget *parent)
|
||||
m_ui.settingsDirCheckBox->setText(tr("Store profiles in %1 settings directory")
|
||||
.arg(Core::Constants::IDE_DISPLAY_NAME));
|
||||
m_ui.settingsDirCheckBox->setChecked(QbsProjectManagerSettings::useCreatorSettingsDirForQbs());
|
||||
m_ui.versionValueLabel->setText(qbs::LanguageInfo::qbsVersion());
|
||||
m_ui.versionValueLabel->setText(qbs::LanguageInfo::qbsVersion().toString());
|
||||
connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::kitsChanged,
|
||||
this, &QbsProfilesSettingsWidget::refreshKitsList);
|
||||
connect(m_ui.settingsDirCheckBox, &QCheckBox::stateChanged, [this]() {
|
||||
|
||||
@@ -73,6 +73,8 @@ const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
||||
|
||||
static QString rcNameSeparator() { return QLatin1String("---Qbs.RC.NameSeparator---"); }
|
||||
|
||||
static QString usingLibraryPathsKey() { return "Qbs.RunConfiguration.UsingLibraryPaths"; }
|
||||
|
||||
const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &uniqeName)
|
||||
{
|
||||
foreach (const qbs::ProductData &product, pro.allProducts()) {
|
||||
@@ -124,6 +126,13 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
||||
this, &QbsRunConfiguration::installStepChanged);
|
||||
}
|
||||
|
||||
QVariantMap QbsRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map = RunConfiguration::toMap();
|
||||
map.insert(usingLibraryPathsKey(), usingLibraryPaths());
|
||||
return map;
|
||||
}
|
||||
|
||||
bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
@@ -137,6 +146,7 @@ bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||
}
|
||||
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
m_usingLibraryPaths = map.value(usingLibraryPathsKey(), true).toBool();
|
||||
installStepChanged();
|
||||
|
||||
return true;
|
||||
@@ -229,6 +239,12 @@ bool QbsRunConfiguration::isConsoleApplication() const
|
||||
return product.properties().value(QLatin1String("consoleApplication"), false).toBool();
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::setUsingLibraryPaths(bool useLibPaths)
|
||||
{
|
||||
m_usingLibraryPaths = useLibPaths;
|
||||
extraAspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||
}
|
||||
|
||||
QString QbsRunConfiguration::baseWorkingDirectory() const
|
||||
{
|
||||
const QString exe = executable();
|
||||
@@ -245,8 +261,11 @@ void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
||||
if (product.isValid()) {
|
||||
QProcessEnvironment procEnv = env.toProcessEnvironment();
|
||||
procEnv.insert(QLatin1String("QBS_RUN_FILE_PATH"), executable());
|
||||
QStringList setupRunEnvConfig;
|
||||
if (!m_usingLibraryPaths)
|
||||
setupRunEnvConfig << QLatin1String("ignore-lib-dependencies");
|
||||
qbs::RunEnvironment qbsRunEnv = project->qbsProject().getRunEnvironment(product,
|
||||
qbs::InstallOptions(), procEnv, QbsManager::settings());
|
||||
qbs::InstallOptions(), procEnv, setupRunEnvConfig, QbsManager::settings());
|
||||
qbs::ErrorInfo error;
|
||||
procEnv = qbsRunEnv.runEnvironment(&error);
|
||||
if (error.hasError()) {
|
||||
@@ -260,10 +279,6 @@ void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
||||
if (qtVersion)
|
||||
env.prependOrSetLibrarySearchPath(qtVersion->librarySearchPath().toString());
|
||||
}
|
||||
|
||||
QString QbsRunConfiguration::buildSystemTarget() const
|
||||
@@ -317,6 +332,11 @@ QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc)
|
||||
m_rc->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
|
||||
m_rc->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
|
||||
m_usingLibPathsCheckBox = new QCheckBox(tr("Add library paths to run environment"));
|
||||
m_usingLibPathsCheckBox->setChecked(m_rc->usingLibraryPaths());
|
||||
connect(m_usingLibPathsCheckBox, &QCheckBox::toggled, m_rc,
|
||||
&QbsRunConfiguration::setUsingLibraryPaths);
|
||||
toplayout->addRow(QString(), m_usingLibPathsCheckBox);
|
||||
|
||||
connect(m_rc, &QbsRunConfiguration::targetInformationChanged,
|
||||
this, &QbsRunConfigurationWidget::targetInformationHasChanged, Qt::QueuedConnection);
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
|
||||
#include <projectexplorer/runnables.h>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
|
||||
namespace qbs { class InstallOptions; }
|
||||
@@ -63,12 +64,15 @@ public:
|
||||
QString buildSystemTarget() const final;
|
||||
QString uniqueProductName() const;
|
||||
bool isConsoleApplication() const;
|
||||
bool usingLibraryPaths() const { return m_usingLibraryPaths; }
|
||||
void setUsingLibraryPaths(bool useLibPaths);
|
||||
|
||||
signals:
|
||||
void targetInformationChanged();
|
||||
void usingDyldImageSuffixChanged(bool);
|
||||
|
||||
private:
|
||||
QVariantMap toMap() const final;
|
||||
bool fromMap(const QVariantMap &map) final;
|
||||
QString extraId() const final;
|
||||
|
||||
@@ -83,6 +87,7 @@ private:
|
||||
ProjectExplorer::BuildStepList *m_currentBuildStepList = nullptr; // We do not take ownership!
|
||||
QString m_uniqueProductName;
|
||||
QString m_productDisplayName;
|
||||
bool m_usingLibraryPaths = true;
|
||||
};
|
||||
|
||||
class QbsRunConfigurationWidget : public QWidget
|
||||
@@ -99,6 +104,7 @@ private:
|
||||
|
||||
QbsRunConfiguration *m_rc;
|
||||
QLabel *m_executableLineLabel;
|
||||
QCheckBox *m_usingLibPathsCheckBox;
|
||||
bool m_ignoreChange = false;
|
||||
bool m_isShown = false;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <utils/htmldocextractor.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
|
||||
#include <QTextBlock>
|
||||
#include <QUrl>
|
||||
@@ -44,8 +45,12 @@ ProFileHoverHandler::ProFileHoverHandler()
|
||||
{
|
||||
}
|
||||
|
||||
void ProFileHoverHandler::identifyMatch(TextEditor::TextEditorWidget *editorWidget, int pos)
|
||||
void ProFileHoverHandler::identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
ReportPriority report)
|
||||
{
|
||||
Utils::ExecuteOnDestruction reportPriority([this, report](){ report(priority()); });
|
||||
|
||||
m_docFragment.clear();
|
||||
m_manualKind = UnknownManual;
|
||||
if (!editorWidget->extraSelectionTooltip(pos).isEmpty()) {
|
||||
|
||||
@@ -40,7 +40,9 @@ public:
|
||||
ProFileHoverHandler();
|
||||
|
||||
private:
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget, int pos) override;
|
||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
||||
int pos,
|
||||
ReportPriority report) override;
|
||||
void identifyQMakeKeyword(const QString &text, int pos);
|
||||
|
||||
enum ManualKind {
|
||||
|
||||
@@ -359,7 +359,7 @@ bool selectionHasSameParentAndInBaseState(const SelectionContext &context)
|
||||
bool isNotInLayout(const SelectionContext &context)
|
||||
{
|
||||
if (selectionNotEmpty(context)) {
|
||||
ModelNode selectedModelNode = context.selectedModelNodes().first();
|
||||
const ModelNode &selectedModelNode = context.selectedModelNodes().constFirst();
|
||||
ModelNode parentModelNode;
|
||||
|
||||
if (selectedModelNode.hasParentProperty())
|
||||
|
||||
@@ -130,7 +130,7 @@ protected:
|
||||
if (m_insideObject) {
|
||||
QStringList stringList = textAt(node->qualifiedId->firstSourceLocation(),
|
||||
node->qualifiedId->lastSourceLocation()).split(QLatin1String("."));
|
||||
const QString itemid = stringList.isEmpty() ? QString() : stringList.first();
|
||||
const QString itemid = stringList.isEmpty() ? QString() : stringList.constFirst();
|
||||
|
||||
if (itemid == m_itemId) {
|
||||
m_implemenations.append(node->statement->firstSourceLocation());
|
||||
|
||||
@@ -57,7 +57,7 @@ static int findFirstBigger(const QVector<int> &v, int tolerance)
|
||||
if (v.isEmpty())
|
||||
return 0;
|
||||
|
||||
int last = v.first();
|
||||
int last = v.constFirst();
|
||||
for (int i = 0; i < v.length(); ++i) {
|
||||
if (v.value(i) > last + tolerance)
|
||||
return i;
|
||||
@@ -257,7 +257,7 @@ void LayoutInGridLayout::collectItemNodes()
|
||||
m_qmlItemNodes.append(itemNode);
|
||||
}
|
||||
}
|
||||
m_parentNode = m_qmlItemNodes.first().instanceParentItem();
|
||||
m_parentNode = m_qmlItemNodes.constFirst().instanceParentItem();
|
||||
}
|
||||
|
||||
void LayoutInGridLayout::collectOffsets()
|
||||
@@ -287,10 +287,10 @@ void LayoutInGridLayout::sortOffsets()
|
||||
void LayoutInGridLayout::calculateGridOffsets()
|
||||
{
|
||||
if (!m_xTopOffsets.isEmpty())
|
||||
m_startX = m_xTopOffsets.first();
|
||||
m_startX = m_xTopOffsets.constFirst();
|
||||
|
||||
if (!m_yTopOffsets.isEmpty())
|
||||
m_startY = m_yTopOffsets.first();
|
||||
m_startY = m_yTopOffsets.constFirst();
|
||||
|
||||
const int defaultWidthTolerance = 64;
|
||||
const int defaultHeightTolerance = 64;
|
||||
|
||||
@@ -40,7 +40,7 @@ static inline bool itemsHaveSameParent(const QList<ModelNode> &siblingList)
|
||||
return false;
|
||||
|
||||
|
||||
QmlItemNode item(siblingList.first());
|
||||
const QmlItemNode &item = siblingList.constFirst();
|
||||
if (!item.isValid())
|
||||
return false;
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ void setVisible(const SelectionContext &selectionState)
|
||||
return;
|
||||
|
||||
try {
|
||||
selectionState.selectedModelNodes().first().variantProperty("visible").setValue(selectionState.toggled());
|
||||
selectionState.selectedModelNodes().constFirst().variantProperty("visible").setValue(selectionState.toggled());
|
||||
} catch (const RewritingException &e) { //better save then sorry
|
||||
e.showException();
|
||||
}
|
||||
@@ -657,7 +657,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
|
||||
{
|
||||
ModelNode modelNode;
|
||||
if (selectionState.singleNodeIsSelected())
|
||||
modelNode = selectionState.selectedModelNodes().first();
|
||||
modelNode = selectionState.selectedModelNodes().constFirst();
|
||||
|
||||
bool isModelNodeRoot = true;
|
||||
|
||||
@@ -690,7 +690,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
|
||||
const QString fileName = currentDesignDocument.toString();
|
||||
const QString typeName = currentDesignDocument.toFileInfo().baseName();
|
||||
|
||||
QStringList signalNames = cleanSignalNames(getSortedSignalNameList(selectionState.selectedModelNodes().first()));
|
||||
QStringList signalNames = cleanSignalNames(getSortedSignalNameList(selectionState.selectedModelNodes().constFirst()));
|
||||
|
||||
QList<QmlJSEditor::FindReferences::Usage> usages = QmlJSEditor::FindReferences::findUsageOfType(fileName, typeName);
|
||||
|
||||
@@ -701,12 +701,12 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
|
||||
return;
|
||||
}
|
||||
|
||||
usages = FindImplementation::run(usages.first().path, typeName, itemId);
|
||||
usages = FindImplementation::run(usages.constFirst().path, typeName, itemId);
|
||||
|
||||
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||
|
||||
if (usages.count() > 0 && (addAlwaysNewSlot || usages.count() < 2) && (!isModelNodeRoot || addAlwaysNewSlot)) {
|
||||
Core::EditorManager::openEditorAt(usages.first().path, usages.first().line, usages.first().col);
|
||||
Core::EditorManager::openEditorAt(usages.constFirst().path, usages.constFirst().line, usages.constFirst().col);
|
||||
|
||||
if (!signalNames.isEmpty()) {
|
||||
AddSignalHandlerDialog *dialog = new AddSignalHandlerDialog(Core::ICore::dialogParent());
|
||||
@@ -732,7 +732,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
|
||||
//Move cursor to correct curser position
|
||||
const QString filePath = Core::EditorManager::currentDocument()->filePath().toString();
|
||||
QList<QmlJSEditor::FindReferences::Usage> usages = FindImplementation::run(filePath, typeName, itemId);
|
||||
Core::EditorManager::openEditorAt(filePath, usages.first().line, usages.first().col + 1);
|
||||
Core::EditorManager::openEditorAt(filePath, usages.constFirst().line, usages.constFirst().col + 1);
|
||||
} );
|
||||
dialog->show();
|
||||
|
||||
@@ -740,7 +740,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
|
||||
return;
|
||||
}
|
||||
|
||||
Core::EditorManager::openEditorAt(usages.first().path, usages.first().line, usages.first().col + 1);
|
||||
Core::EditorManager::openEditorAt(usages.constFirst().path, usages.constFirst().line, usages.constFirst().col + 1);
|
||||
}
|
||||
|
||||
void removeLayout(const SelectionContext &selectionContext)
|
||||
@@ -794,7 +794,7 @@ void moveToComponent(const SelectionContext &selectionContext)
|
||||
{
|
||||
ModelNode modelNode;
|
||||
if (selectionContext.singleNodeIsSelected())
|
||||
modelNode = selectionContext.selectedModelNodes().first();
|
||||
modelNode = selectionContext.selectedModelNodes().constFirst();
|
||||
|
||||
if (modelNode.isValid())
|
||||
selectionContext.view()->model()->rewriterView()->moveToComponent(modelNode);
|
||||
|
||||
@@ -396,7 +396,7 @@ void DebugView::instancesChildrenChanged(const QVector<ModelNode> & nodeList)
|
||||
void DebugView::customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
|
||||
{
|
||||
if (identifier == "PuppetStatus" && data.count() == 1) {
|
||||
m_debugViewWidget->setPuppetStatus(data.first().toString());
|
||||
m_debugViewWidget->setPuppetStatus(data.constFirst().toString());
|
||||
|
||||
} else if (isDebugViewEnabled()) {
|
||||
QTextStream message;
|
||||
|
||||
@@ -265,7 +265,7 @@ void AbstractFormEditorTool::mouseReleaseEvent(const QList<QGraphicsItem*> & ite
|
||||
QmlItemNode currentSelectedNode;
|
||||
|
||||
if (view()->selectedModelNodes().count() == 1) {
|
||||
currentSelectedNode = view()->selectedModelNodes().first();
|
||||
currentSelectedNode = view()->selectedModelNodes().constFirst();
|
||||
|
||||
if (!containsItemNode(itemList, currentSelectedNode)) {
|
||||
QmlItemNode selectedNode;
|
||||
|
||||
@@ -89,7 +89,7 @@ void AnchorIndicator::setItems(const QList<FormEditorItem *> &itemList)
|
||||
clear();
|
||||
|
||||
if (itemList.count() == 1) {
|
||||
m_formEditorItem = itemList.first();
|
||||
m_formEditorItem = itemList.constFirst();
|
||||
QmlItemNode sourceQmlItemNode = m_formEditorItem->qmlItemNode();
|
||||
if (!sourceQmlItemNode.modelNode().isRootNode()) {
|
||||
QmlAnchors qmlAnchors = sourceQmlItemNode.anchors();
|
||||
|
||||
@@ -116,7 +116,7 @@ void BindingIndicator::setItems(const QList<FormEditorItem *> &itemList)
|
||||
clear();
|
||||
|
||||
if (itemList.count() == 1) {
|
||||
m_formEditorItem = itemList.first();
|
||||
m_formEditorItem = itemList.constFirst();
|
||||
const QmlItemNode qmlItemNode = m_formEditorItem->qmlItemNode();
|
||||
|
||||
if (qmlItemNode.hasBindingProperty("x")) {
|
||||
|
||||
@@ -200,8 +200,8 @@ void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event)
|
||||
{
|
||||
currentTool()->dropEvent(removeLayerItems(itemsAt(event->scenePos())), event);
|
||||
|
||||
if (views().first())
|
||||
views().first()->setFocus();
|
||||
if (views().constFirst())
|
||||
views().constFirst()->setFocus();
|
||||
}
|
||||
|
||||
void FormEditorScene::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
|
||||
@@ -237,7 +237,7 @@ QList<QGraphicsItem *> FormEditorScene::itemsAt(const QPointF &pos)
|
||||
QTransform transform;
|
||||
|
||||
if (!views().isEmpty())
|
||||
transform = views().first()->transform();
|
||||
transform = views().constFirst()->transform();
|
||||
|
||||
return items(pos,
|
||||
Qt::IntersectsItemShape,
|
||||
|
||||
@@ -397,7 +397,7 @@ void FormEditorView::changeToCustomTool()
|
||||
int handlingRank = 0;
|
||||
AbstractCustomTool *selectedCustomTool = 0;
|
||||
|
||||
ModelNode selectedModelNode = selectedModelNodes().first();
|
||||
const ModelNode &selectedModelNode = selectedModelNodes().constFirst();
|
||||
|
||||
foreach (AbstractCustomTool *customTool, m_customToolList) {
|
||||
if (customTool->wantHandleItem(selectedModelNode) > handlingRank) {
|
||||
|
||||
@@ -75,10 +75,10 @@ void MoveManipulator::setItems(const QList<FormEditorItem*> &itemList)
|
||||
{
|
||||
m_itemList = itemList;
|
||||
if (!m_itemList.isEmpty()) {
|
||||
if (m_itemList.first()->parentItem())
|
||||
m_snapper.setContainerFormEditorItem(m_itemList.first()->parentItem());
|
||||
if (m_itemList.constFirst()->parentItem())
|
||||
m_snapper.setContainerFormEditorItem(m_itemList.constFirst()->parentItem());
|
||||
else
|
||||
m_snapper.setContainerFormEditorItem(m_itemList.first());
|
||||
m_snapper.setContainerFormEditorItem(m_itemList.constFirst());
|
||||
m_snapper.setTransformtionSpaceFormEditorItem(m_snapper.containerFormEditorItem());
|
||||
}
|
||||
}
|
||||
@@ -105,8 +105,8 @@ void MoveManipulator::synchronizeParent(const QList<FormEditorItem*> &itemList,
|
||||
|
||||
void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList)
|
||||
{
|
||||
if (m_view->model() && !m_itemList.isEmpty() && m_itemList.first()->qmlItemNode().hasInstanceParent())
|
||||
synchronizeParent(itemList, m_itemList.first()->qmlItemNode().instanceParent());
|
||||
if (m_view->model() && !m_itemList.isEmpty() && m_itemList.constFirst()->qmlItemNode().hasInstanceParent())
|
||||
synchronizeParent(itemList, m_itemList.constFirst()->qmlItemNode().instanceParent());
|
||||
}
|
||||
|
||||
bool MoveManipulator::itemsCanReparented() const
|
||||
|
||||
@@ -106,10 +106,10 @@ void MoveTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||
|
||||
FormEditorItem *containerItem = containerFormEditorItem(itemList, m_movingItems);
|
||||
if (containerItem && view()->currentState().isBaseState()) {
|
||||
if (containerItem != m_movingItems.first()->parentItem()
|
||||
if (containerItem != m_movingItems.constFirst()->parentItem()
|
||||
&& event->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
|
||||
FormEditorItem *movingItem = m_movingItems.first();
|
||||
const FormEditorItem *movingItem = m_movingItems.constFirst();
|
||||
|
||||
if (m_movingItems.count() > 1
|
||||
|| (movingItem->qmlItemNode().canBereparentedTo(containerItem->qmlItemNode())))
|
||||
@@ -129,7 +129,7 @@ void MoveTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||
return;
|
||||
}
|
||||
|
||||
ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first());
|
||||
ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.constFirst());
|
||||
if (resizeHandle) {
|
||||
view()->changeToResizeTool();
|
||||
return;
|
||||
@@ -289,7 +289,7 @@ bool MoveTool::haveSameParent(const QList<FormEditorItem*> &itemList)
|
||||
if (itemList.isEmpty())
|
||||
return false;
|
||||
|
||||
QGraphicsItem *firstParent = itemList.first()->parentItem();
|
||||
QGraphicsItem *firstParent = itemList.constFirst()->parentItem();
|
||||
foreach (FormEditorItem* item, itemList)
|
||||
{
|
||||
if (firstParent != item->parentItem())
|
||||
|
||||
@@ -53,17 +53,17 @@ double OneDimensionalCluster::mean() const
|
||||
|
||||
if (m_coordinateList.size() == 1)
|
||||
{
|
||||
return m_coordinateList.first();
|
||||
return m_coordinateList.constFirst();
|
||||
}
|
||||
|
||||
return sum(m_coordinateList) / m_coordinateList.size();
|
||||
}
|
||||
|
||||
double OneDimensionalCluster::first() const
|
||||
double OneDimensionalCluster::constFirst() const
|
||||
{
|
||||
Q_ASSERT(!m_coordinateList.isEmpty());
|
||||
|
||||
return m_coordinateList.first();
|
||||
return m_coordinateList.constFirst();
|
||||
}
|
||||
|
||||
QList<OneDimensionalCluster> OneDimensionalCluster::createOneDimensionalClusterList(const QList<double> & oneDimensionalCoordinateList)
|
||||
@@ -136,7 +136,7 @@ QList<double> OneDimensionalCluster::reduceLines(const QList<double> & oneDimens
|
||||
|
||||
QList<double> lineList;
|
||||
foreach (const OneDimensionalCluster &cluster, clusterList)
|
||||
lineList.append(cluster.first());
|
||||
lineList.append(cluster.constFirst());
|
||||
|
||||
return lineList;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
|
||||
OneDimensionalCluster(const QList<double> & coordinateList );
|
||||
double mean() const;
|
||||
double first() const;
|
||||
double constFirst() const;
|
||||
|
||||
static QList<OneDimensionalCluster> createOneDimensionalClusterList(const QList<double> & oneDimensionalCoordinateList);
|
||||
static QList<OneDimensionalCluster> reduceOneDimensionalClusterList(const QList<OneDimensionalCluster> & unreducedClusterList, double maximumDistance);
|
||||
|
||||
@@ -58,7 +58,7 @@ void ResizeTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
|
||||
if (itemList.isEmpty())
|
||||
return;
|
||||
|
||||
ResizeHandleItem *resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first());
|
||||
ResizeHandleItem *resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.constFirst());
|
||||
if (resizeHandle && resizeHandle->resizeController().isValid()) {
|
||||
m_resizeManipulator.setHandle(resizeHandle);
|
||||
m_resizeManipulator.begin(event->scenePos());
|
||||
@@ -85,7 +85,7 @@ void ResizeTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||
return;
|
||||
}
|
||||
|
||||
ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first());
|
||||
ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.constFirst());
|
||||
if (resizeHandle && resizeHandle->resizeController().isValid()) {
|
||||
m_resizeManipulator.setHandle(resizeHandle);
|
||||
} else {
|
||||
|
||||
@@ -82,8 +82,8 @@ static QPolygonF boundingRectInLayerItemSpaceForItem(FormEditorItem *item, QGrap
|
||||
static bool checkSingleSelection(const QList<FormEditorItem*> &itemList)
|
||||
{
|
||||
return !itemList.isEmpty()
|
||||
&& itemList.first()
|
||||
&& itemList.first()->qmlItemNode().view()->singleSelectedModelNode().isValid();
|
||||
&& itemList.constFirst()
|
||||
&& itemList.constFirst()->qmlItemNode().view()->singleSelectedModelNode().isValid();
|
||||
}
|
||||
|
||||
const int labelHeight = 16;
|
||||
@@ -112,7 +112,7 @@ void SelectionIndicator::setItems(const QList<FormEditorItem*> &itemList)
|
||||
}
|
||||
|
||||
if (checkSingleSelection(itemList)) {
|
||||
FormEditorItem *selectedItem = itemList.first();
|
||||
FormEditorItem *selectedItem = itemList.constFirst();
|
||||
m_labelItem.reset(new QGraphicsPolygonItem(m_layerItem.data()));
|
||||
|
||||
QGraphicsWidget *toolbar = DesignerActionManager::instance().createFormEditorToolBar(m_labelItem.get());
|
||||
@@ -161,7 +161,7 @@ void SelectionIndicator::updateItems(const QList<FormEditorItem*> &itemList)
|
||||
|
||||
if (checkSingleSelection(itemList)
|
||||
&& m_labelItem) {
|
||||
FormEditorItem *selectedItem = itemList.first();
|
||||
FormEditorItem *selectedItem = itemList.constFirst();
|
||||
QPolygonF labelPolygon = boundingRectInLayerItemSpaceForItem(selectedItem, m_layerItem.data());
|
||||
QRectF labelRect = labelPolygon.boundingRect();
|
||||
QPointF pos = labelRect.topLeft();
|
||||
|
||||
@@ -126,7 +126,7 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||
{
|
||||
if (!itemList.isEmpty()) {
|
||||
|
||||
ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.first());
|
||||
ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(itemList.constFirst());
|
||||
if (resizeHandle) {
|
||||
view()->changeToResizeTool();
|
||||
return;
|
||||
|
||||
@@ -449,7 +449,7 @@ double Snapper::snappingDistance() const
|
||||
static QLineF mergedHorizontalLine(const QList<QLineF> &lineList)
|
||||
{
|
||||
if (lineList.count() == 1)
|
||||
return lineList.first();
|
||||
return lineList.constFirst();
|
||||
|
||||
double minimumX = std::numeric_limits<double>::max();
|
||||
double maximumX = std::numeric_limits<double>::min();
|
||||
@@ -460,14 +460,14 @@ static QLineF mergedHorizontalLine(const QList<QLineF> &lineList)
|
||||
maximumX = qMax(maximumX, double(line.x2()));
|
||||
}
|
||||
|
||||
double y(lineList.first().y1());
|
||||
double y(lineList.constFirst().y1());
|
||||
return QLineF(minimumX, y, maximumX, y);
|
||||
}
|
||||
|
||||
static QLineF mergedVerticalLine(const QList<QLineF> &lineList)
|
||||
{
|
||||
if (lineList.count() == 1)
|
||||
return lineList.first();
|
||||
return lineList.constFirst();
|
||||
|
||||
double minimumY = std::numeric_limits<double>::max();
|
||||
double maximumY = std::numeric_limits<double>::min();
|
||||
@@ -478,7 +478,7 @@ static QLineF mergedVerticalLine(const QList<QLineF> &lineList)
|
||||
maximumY = qMax(maximumY, double(line.y2()));
|
||||
}
|
||||
|
||||
double x(lineList.first().x1());
|
||||
double x(lineList.constFirst().x1());
|
||||
return QLineF(x, minimumY, x, maximumY);
|
||||
}
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ void DesignDocument::paste()
|
||||
ModelNode targetNode;
|
||||
|
||||
if (!view.selectedModelNodes().isEmpty())
|
||||
targetNode = view.selectedModelNodes().first();
|
||||
targetNode = view.selectedModelNodes().constFirst();
|
||||
|
||||
//In case we copy and paste a selection we paste in the parent item
|
||||
if ((view.selectedModelNodes().count() == selectedNodes.count()) && targetNode.isValid() && targetNode.hasParentProperty())
|
||||
@@ -495,7 +495,7 @@ void DesignDocument::paste()
|
||||
ModelNode targetNode;
|
||||
|
||||
if (!view.selectedModelNodes().isEmpty())
|
||||
targetNode = view.selectedModelNodes().first();
|
||||
targetNode = view.selectedModelNodes().constFirst();
|
||||
|
||||
if (!targetNode.isValid())
|
||||
targetNode = view.rootModelNode();
|
||||
|
||||
@@ -219,7 +219,7 @@ void DesignDocumentView::copyModelNodes(const QList<ModelNode> &nodesToCopy)
|
||||
copyModel->attachView(&view);
|
||||
|
||||
if (selectedNodes.count() == 1) {
|
||||
ModelNode selectedNode(selectedNodes.first());
|
||||
const ModelNode &selectedNode = selectedNodes.constFirst();
|
||||
|
||||
if (!selectedNode.isValid())
|
||||
return;
|
||||
|
||||
@@ -454,7 +454,7 @@ void NavigatorView::updateItemSelection()
|
||||
blockSelectionChangedSignal(blocked);
|
||||
|
||||
if (!selectedModelNodes().isEmpty())
|
||||
treeWidget()->scrollTo(indexForModelNode(selectedModelNodes().first()));
|
||||
treeWidget()->scrollTo(indexForModelNode(selectedModelNodes().constFirst()));
|
||||
|
||||
// make sure selected nodes a visible
|
||||
foreach (const QModelIndex &selectedIndex, itemSelection.indexes()) {
|
||||
|
||||
@@ -145,7 +145,7 @@ void PropertyEditorContextObject::toogleExportAlias()
|
||||
if (rewriterView->selectedModelNodes().isEmpty())
|
||||
return;
|
||||
|
||||
ModelNode selectedNode = rewriterView->selectedModelNodes().first();
|
||||
const ModelNode &selectedNode = rewriterView->selectedModelNodes().constFirst();
|
||||
|
||||
if (QmlObjectNode::isValidQmlObjectNode(selectedNode)) {
|
||||
QmlObjectNode objectNode(selectedNode);
|
||||
@@ -184,7 +184,7 @@ void PropertyEditorContextObject::changeTypeName(const QString &typeName)
|
||||
if (rewriterView->selectedModelNodes().isEmpty())
|
||||
return;
|
||||
|
||||
ModelNode selectedNode = rewriterView->selectedModelNodes().first();
|
||||
ModelNode selectedNode = rewriterView->selectedModelNodes().constFirst();
|
||||
|
||||
try {
|
||||
RewriterTransaction transaction =
|
||||
|
||||
@@ -550,12 +550,12 @@ QString PropertyEditorQmlBackend::locateQmlFile(const NodeMetaInfo &info, const
|
||||
|
||||
//Check for qml files with versions first
|
||||
|
||||
const QString withoutDir = relativePath.split(QStringLiteral("/")).last();
|
||||
const QString withoutDir = relativePath.split(QStringLiteral("/")).constLast();
|
||||
|
||||
if (importDirVersion.exists(withoutDir))
|
||||
return importDirVersion.absoluteFilePath(withoutDir);
|
||||
|
||||
const QString withoutDirWithVersion = relativePathWithVersion.split(QStringLiteral("/")).last();
|
||||
const QString withoutDirWithVersion = relativePathWithVersion.split(QStringLiteral("/")).constLast();
|
||||
|
||||
const QStringList possiblePaths = {
|
||||
importDir.absoluteFilePath(relativePathWithVersion),
|
||||
|
||||
@@ -510,8 +510,8 @@ void PropertyEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNo
|
||||
|
||||
if (selectedNodeList.isEmpty() || selectedNodeList.count() > 1)
|
||||
select(ModelNode());
|
||||
else if (m_selectedNode != selectedNodeList.first())
|
||||
select(selectedNodeList.first());
|
||||
else if (m_selectedNode != selectedNodeList.constFirst())
|
||||
select(selectedNodeList.constFirst());
|
||||
}
|
||||
|
||||
void PropertyEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
|
||||
|
||||
@@ -44,6 +44,7 @@ class CollapseButton;
|
||||
class PropertyEditorWidget;
|
||||
class PropertyEditorView;
|
||||
class PropertyEditorQmlBackend;
|
||||
class ModelNode;
|
||||
|
||||
class PropertyEditorView: public AbstractView
|
||||
{
|
||||
@@ -66,8 +67,6 @@ public:
|
||||
|
||||
void modelAboutToBeDetached(Model *model) override;
|
||||
|
||||
ModelState modelState() const;
|
||||
|
||||
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) override;
|
||||
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) override;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ QImage StatesEditorImageProvider::requestImage(const QString &id, QSize *size, c
|
||||
|
||||
bool nodeInstanceViewIsDetached = m_nodeInstanceView.isNull() || !m_nodeInstanceView->model();
|
||||
if (!nodeInstanceViewIsDetached) {
|
||||
QString imageId = id.split(QLatin1Char('-')).first();
|
||||
QString imageId = id.split(QLatin1Char('-')).constFirst();
|
||||
if (imageId == QLatin1String("baseState")) {
|
||||
image = m_nodeInstanceView->statePreviewImage(m_nodeInstanceView->rootModelNode());
|
||||
} else {
|
||||
|
||||
@@ -35,8 +35,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class Model;
|
||||
class ModelState;
|
||||
class StatesEditorModel;
|
||||
class StatesEditorView;
|
||||
class NodeInstanceView;
|
||||
|
||||
@@ -186,7 +186,7 @@ void TextEditorView::documentMessagesChanged(const QList<DocumentMessage> &error
|
||||
if (errors.isEmpty()) {
|
||||
m_widget->clearStatusBar();
|
||||
} else {
|
||||
const DocumentMessage error = errors.first();
|
||||
const DocumentMessage &error = errors.constFirst();
|
||||
m_widget->setStatusText(QString("%1 (Line: %2)").arg(error.description()).arg(error.line()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ void TextEditorWidget::jumpTextCursorToSelectedModelNode()
|
||||
return;
|
||||
|
||||
if (!m_textEditorView->selectedModelNodes().isEmpty())
|
||||
selectedNode = m_textEditorView->selectedModelNodes().first();
|
||||
selectedNode = m_textEditorView->selectedModelNodes().constFirst();
|
||||
|
||||
if (selectedNode.isValid()) {
|
||||
RewriterView *rewriterView = m_textEditorView->model()->rewriterView();
|
||||
|
||||
@@ -66,7 +66,7 @@ bool QmlRefactoring::reparseDocument()
|
||||
qDebug() << "*** QML text:" << textModifier->text();
|
||||
QString errorMessage = QStringLiteral("Parsing Error");
|
||||
if (!tmpDocument->diagnosticMessages().isEmpty())
|
||||
errorMessage = tmpDocument->diagnosticMessages().first().message;
|
||||
errorMessage = tmpDocument->diagnosticMessages().constFirst().message;
|
||||
|
||||
qDebug() << "*** " << errorMessage;
|
||||
return false;
|
||||
|
||||
@@ -108,6 +108,7 @@ protected:
|
||||
AbstractProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
|
||||
AbstractProperty(const Internal::InternalPropertyPointer &property, Model* model, AbstractView *view);
|
||||
Internal::InternalNodePointer internalNode() const;
|
||||
Internal::ModelPrivate *privateModel() const;
|
||||
|
||||
private:
|
||||
PropertyName m_propertyName;
|
||||
|
||||
@@ -280,7 +280,7 @@ ViewType *ForwardView<ViewType>::firstView() const
|
||||
if (m_targetViewList.isEmpty())
|
||||
return 0;
|
||||
|
||||
return m_targetViewList.first().data();
|
||||
return m_targetViewList.constFirst().data();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,10 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
namespace Internal { class ModelPrivate; }
|
||||
namespace Internal {
|
||||
class ModelPrivate;
|
||||
class WriteLocker;
|
||||
} //Internal
|
||||
|
||||
class AnchorLine;
|
||||
class ModelNode;
|
||||
@@ -61,12 +64,10 @@ typedef QList<QPair<PropertyName, QVariant> > PropertyListType;
|
||||
class QMLDESIGNERCORE_EXPORT Model : public QObject
|
||||
{
|
||||
friend class QmlDesigner::ModelNode;
|
||||
friend class QmlDesigner::NodeState;
|
||||
friend class QmlDesigner::ModelState;
|
||||
friend class QmlDesigner::NodeAnchors;
|
||||
friend class QmlDesigner::AbstractProperty;
|
||||
friend class QmlDesigner::AbstractView;
|
||||
friend class Internal::ModelPrivate;
|
||||
friend class Internal::WriteLocker;
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
@@ -116,7 +117,7 @@ public:
|
||||
protected:
|
||||
Model();
|
||||
|
||||
public:
|
||||
private:
|
||||
Internal::ModelPrivate *d;
|
||||
};
|
||||
|
||||
|
||||
@@ -881,8 +881,8 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
|
||||
|
||||
if (versionString.contains(QStringLiteral("."))) {
|
||||
const QStringList splittedString = versionString.split(QStringLiteral("."));
|
||||
majorVersion = splittedString.first().toInt();
|
||||
minorVersion = splittedString.last().toInt();
|
||||
majorVersion = splittedString.constFirst().toInt();
|
||||
minorVersion = splittedString.constLast().toInt();
|
||||
}
|
||||
|
||||
bool isItem = false;
|
||||
|
||||
@@ -278,9 +278,9 @@ void MetaInfoReader::setVersion(const QString &versionNumber)
|
||||
int val;
|
||||
bool ok;
|
||||
if (versionNumber.contains(QLatin1Char('.'))) {
|
||||
val = versionNumber.split(QLatin1Char('.')).first().toInt(&ok);
|
||||
val = versionNumber.split(QLatin1Char('.')).constFirst().toInt(&ok);
|
||||
major = ok ? val : major;
|
||||
val = versionNumber.split(QLatin1Char('.')).last().toInt(&ok);
|
||||
val = versionNumber.split(QLatin1Char('.')).constLast().toInt(&ok);
|
||||
minor = ok ? val : minor;
|
||||
} else {
|
||||
val = versionNumber.toInt(&ok);
|
||||
|
||||
@@ -96,7 +96,7 @@ QmlDesigner::NodeHints::NodeHints(const ModelNode &node) : m_modelNode(node)
|
||||
modelNode().type(), modelNode().majorVersion(), modelNode().minorVersion());
|
||||
|
||||
if (!itemLibraryEntryList.isEmpty())
|
||||
m_hints = itemLibraryEntryList.first().hints();
|
||||
m_hints = itemLibraryEntryList.constFirst().hints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -709,7 +709,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i
|
||||
} else {
|
||||
m_isFileComponent = true;
|
||||
const Imports *imports = context()->imports(document());
|
||||
ImportInfo importInfo = imports->info(lookupNameComponent().last(), context().data());
|
||||
ImportInfo importInfo = imports->info(lookupNameComponent().constLast(), context().data());
|
||||
if (importInfo.isValid() && importInfo.type() == ImportType::Library) {
|
||||
m_majorVersion = importInfo.version().majorVersion();
|
||||
m_minorVersion = importInfo.version().minorVersion();
|
||||
@@ -729,7 +729,7 @@ const CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() const
|
||||
const QList<TypeName> nameComponents = m_qualfiedTypeName.split('.');
|
||||
if (nameComponents.size() < 2)
|
||||
return 0;
|
||||
const TypeName type = nameComponents.last();
|
||||
const TypeName &type = nameComponents.constLast();
|
||||
|
||||
TypeName module;
|
||||
for (int i = 0; i < nameComponents.size() - 1; ++i) {
|
||||
@@ -821,8 +821,8 @@ bool NodeMetaInfoPrivate::isPropertyWritable(const PropertyName &propertyName) c
|
||||
|
||||
if (propertyName.contains('.')) {
|
||||
const PropertyNameList parts = propertyName.split('.');
|
||||
const PropertyName objectName = parts.first();
|
||||
const PropertyName rawPropertyName = parts.last();
|
||||
const PropertyName &objectName = parts.constFirst();
|
||||
const PropertyName &rawPropertyName = parts.constLast();
|
||||
const TypeName objectType = propertyType(objectName);
|
||||
|
||||
if (isValueType(objectType))
|
||||
@@ -854,8 +854,8 @@ bool NodeMetaInfoPrivate::isPropertyList(const PropertyName &propertyName) const
|
||||
|
||||
if (propertyName.contains('.')) {
|
||||
const PropertyNameList parts = propertyName.split('.');
|
||||
const PropertyName objectName = parts.first();
|
||||
const PropertyName rawPropertyName = parts.last();
|
||||
const PropertyName &objectName = parts.constFirst();
|
||||
const PropertyName &rawPropertyName = parts.constLast();
|
||||
const TypeName objectType = propertyType(objectName);
|
||||
|
||||
if (isValueType(objectType))
|
||||
@@ -883,8 +883,8 @@ bool NodeMetaInfoPrivate::isPropertyPointer(const PropertyName &propertyName) co
|
||||
|
||||
if (propertyName.contains('.')) {
|
||||
const PropertyNameList parts = propertyName.split('.');
|
||||
const PropertyName objectName = parts.first();
|
||||
const PropertyName rawPropertyName = parts.last();
|
||||
const PropertyName &objectName = parts.constFirst();
|
||||
const PropertyName &rawPropertyName = parts.constLast();
|
||||
const TypeName objectType = propertyType(objectName);
|
||||
|
||||
if (isValueType(objectType))
|
||||
@@ -915,8 +915,8 @@ bool NodeMetaInfoPrivate::isPropertyEnum(const PropertyName &propertyName) const
|
||||
|
||||
if (propertyName.contains('.')) {
|
||||
const PropertyNameList parts = propertyName.split('.');
|
||||
const PropertyName objectName = parts.first();
|
||||
const PropertyName rawPropertyName = parts.last();
|
||||
const PropertyName &objectName = parts.constFirst();
|
||||
const PropertyName &rawPropertyName = parts.constLast();
|
||||
const TypeName objectType = propertyType(objectName);
|
||||
|
||||
if (isValueType(objectType))
|
||||
@@ -947,8 +947,8 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const PropertyName &propertyName)
|
||||
|
||||
if (propertyName.contains('.')) {
|
||||
const PropertyNameList parts = propertyName.split('.');
|
||||
const PropertyName objectName = parts.first();
|
||||
const PropertyName rawPropertyName = parts.last();
|
||||
const PropertyName &objectName = parts.constFirst();
|
||||
const PropertyName &rawPropertyName = parts.constLast();
|
||||
const TypeName objectType = propertyType(objectName);
|
||||
|
||||
if (isValueType(objectType))
|
||||
@@ -989,7 +989,7 @@ static QByteArray getUnqualifiedName(const QByteArray &name)
|
||||
const QList<QByteArray> nameComponents = name.split('.');
|
||||
if (nameComponents.size() < 2)
|
||||
return name;
|
||||
return nameComponents.last();
|
||||
return nameComponents.constLast();
|
||||
}
|
||||
|
||||
static QByteArray getPackage(const QByteArray &name)
|
||||
@@ -1138,7 +1138,7 @@ QString NodeMetaInfoPrivate::importDirectoryPath() const
|
||||
|
||||
if (isValid()) {
|
||||
const Imports *imports = context()->imports(document());
|
||||
ImportInfo importInfo = imports->info(lookupNameComponent().last(), context().data());
|
||||
ImportInfo importInfo = imports->info(lookupNameComponent().constLast(), context().data());
|
||||
|
||||
if (importInfo.type() == ImportType::Directory) {
|
||||
return importInfo.path();
|
||||
|
||||
@@ -152,7 +152,7 @@ void SubComponentManager::parseDirectories()
|
||||
parseDirectory(dirInfo.canonicalFilePath(), false);
|
||||
}
|
||||
|
||||
QString fullUrlVersion = path + QLatin1Char('/') + url + QLatin1Char('.') + import.version().split(".").first();
|
||||
QString fullUrlVersion = path + QLatin1Char('/') + url + QLatin1Char('.') + import.version().split(".").constFirst();
|
||||
dirInfo = QFileInfo(fullUrlVersion);
|
||||
|
||||
if (dirInfo.exists() && dirInfo.isDir()) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user