Merge remote-tracking branch 'origin/4.4'
Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri src/plugins/qbsprojectmanager/qbsproject.h Change-Id: I6b9cdf704be95ade02488c8b19582b6621282fb8
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 68 KiB |
BIN
doc/images/qtcreator-tests-view.png
Normal file
After Width: | Height: | Size: 30 KiB |
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the Qt Creator documentation.
|
** This file is part of the Qt Creator documentation.
|
||||||
@@ -131,6 +131,9 @@
|
|||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\QC creates the test in the specified project directory.
|
\QC creates the test in the specified project directory.
|
||||||
|
For more information about creating Google tests, see the
|
||||||
|
\l{https://github.com/google/googletest/blob/master/googletest/docs/Primer.md}
|
||||||
|
{Google Test Primer}.
|
||||||
|
|
||||||
\section1 Setting Up the Google C++ Testing Framework
|
\section1 Setting Up the Google C++ Testing Framework
|
||||||
|
|
||||||
@@ -175,6 +178,87 @@
|
|||||||
\li \c {LIBS += -lgmock -L<path_to_gmock_lib>}
|
\li \c {LIBS += -lgmock -L<path_to_gmock_lib>}
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
|
\section1 Building and Running Tests
|
||||||
|
|
||||||
|
To build and run tests:
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
|
||||||
|
\li Open a project that contains tests.
|
||||||
|
|
||||||
|
\li In the \uicontrol Tests view, select the tests to run.
|
||||||
|
|
||||||
|
\li In the \uicontrol {Test Results} output pane, select
|
||||||
|
\inlineimage run_small.png
|
||||||
|
(\uicontrol {Run All Tests}) to run all test or
|
||||||
|
\inlineimage qtcreator-run-selected-tests.png
|
||||||
|
(\uicontrol {Run Selected Tests}) to run the selected tests.
|
||||||
|
|
||||||
|
\note By default, \QC builds a project before deploying and running
|
||||||
|
it.
|
||||||
|
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
If a test takes more than a minute to execute, the default timeout might
|
||||||
|
stop the test execution. To increase the timeout, select \uicontrol Tools >
|
||||||
|
\uicontrol Options > \uicontrol {Test Settings} > \uicontrol General.
|
||||||
|
|
||||||
|
\section2 Selecting Tests to Run
|
||||||
|
|
||||||
|
The \uicontrol Tests view shows all the tests found for the currently active
|
||||||
|
test frameworks in the current project. Select the test cases to run.
|
||||||
|
|
||||||
|
\image qtcreator-tests-view.png
|
||||||
|
|
||||||
|
If a Qt Quick test case does not have a name, it is marked
|
||||||
|
\uicontrol Unnamed in the list. Unnamed test cases are executed when you
|
||||||
|
select \uicontrol {Run All Tests}. You cannot select or deselect them.
|
||||||
|
|
||||||
|
\QC scans the project for tests when you open the project and updates the
|
||||||
|
test list for the currently active test frameworks when you edit tests.
|
||||||
|
To refresh the view, select \uicontrol {Rescan Tests} in the context menu.
|
||||||
|
|
||||||
|
You can add filters to specify the directories within the current project
|
||||||
|
to scan for tests. Select \uicontrol Tools > \uicontrol Options >
|
||||||
|
\uicontrol {Test Settings} > \uicontrol General > \uicontrol Add, and
|
||||||
|
specify paths to the directories to scan for tests. Wildcards are not
|
||||||
|
supported in the filter expressions.
|
||||||
|
|
||||||
|
\image qtcreator-autotests-options.png
|
||||||
|
|
||||||
|
To show or hide init and cleanup or data functions in the \uicontrol Tests
|
||||||
|
view, select \inlineimage filtericon.png
|
||||||
|
(\uicontrol {Filter Test Tree}), and then select \uicontrol {Show Init and
|
||||||
|
Cleanup Functions} or \uicontrol {Show Data Functions}. Double-click a
|
||||||
|
function in the list to open its source code in the code editor.
|
||||||
|
|
||||||
|
The test cases are listed in alphabetic order. To list them in the order in
|
||||||
|
which they are defined in the source code, select \inlineimage leafsort.png
|
||||||
|
(\uicontrol {Sort Naturally}).
|
||||||
|
|
||||||
|
\section2 Specifying Settings for Running Qt Tests
|
||||||
|
|
||||||
|
The code inside a benchmark test is measured, and possibly also repeated
|
||||||
|
several times in order to get an accurate measurement. This depends on the
|
||||||
|
measurement back-end that you can select in the
|
||||||
|
\uicontrol {Benchmark Metrics} group in \uicontrol Tools >
|
||||||
|
\uicontrol Options > \uicontrol {Test Settings} > \uicontrol {Qt Test}:
|
||||||
|
walltime, CPU tick counter, event counter, Valgrind Callgrind, and Linux
|
||||||
|
Perf. For more information, see \l{Creating a Benchmark}.
|
||||||
|
|
||||||
|
\image qtcreator-autotests-options-qt.png
|
||||||
|
|
||||||
|
To receive verbose output when running benchmarks, select the
|
||||||
|
\uicontrol {Verbose benchmarks} check box.
|
||||||
|
|
||||||
|
To allow the debugger to interrupt Qt tests on assertions, select the
|
||||||
|
\uicontrol {Disable crash handler while debugging} check box.
|
||||||
|
|
||||||
|
To record information about signals and slots in the test log, select the
|
||||||
|
\uicontrol {Log signals and slots} check box.
|
||||||
|
|
||||||
|
\section2 Specifying Settings for Running Google Tests
|
||||||
|
|
||||||
To specify settings for running Google tests, select \uicontrol Tools >
|
To specify settings for running Google tests, select \uicontrol Tools >
|
||||||
\uicontrol Options > \uicontrol {Test Settings} > \uicontrol {Google Test}.
|
\uicontrol Options > \uicontrol {Test Settings} > \uicontrol {Google Test}.
|
||||||
|
|
||||||
@@ -193,58 +277,23 @@
|
|||||||
failures into C++ exceptions, select the \uicontrol {Throw on failure} check
|
failures into C++ exceptions, select the \uicontrol {Throw on failure} check
|
||||||
box.
|
box.
|
||||||
|
|
||||||
For more information about creating Google tests, see the
|
|
||||||
\l{https://github.com/google/googletest/blob/master/googletest/docs/Primer.md}
|
|
||||||
{Google Test Primer}.
|
|
||||||
|
|
||||||
\section1 Building and Running Tests
|
|
||||||
|
|
||||||
To build and run tests:
|
|
||||||
|
|
||||||
\list 1
|
|
||||||
|
|
||||||
\li Open a project that contains tests.
|
|
||||||
|
|
||||||
\li In the \uicontrol {Test Results} output pane, select
|
|
||||||
\inlineimage run_small.png
|
|
||||||
(\uicontrol {Run All Tests}) to run all test or
|
|
||||||
\inlineimage qtcreator-run-selected-tests.png
|
|
||||||
(\uicontrol {Run Selected Tests}) to run the selected tests.
|
|
||||||
|
|
||||||
You can select the tests to run in the \uicontrol Tests view in the
|
|
||||||
\uicontrol Projects pane. For more information, see
|
|
||||||
\l{Viewing Tests}.
|
|
||||||
|
|
||||||
\note By default, \QC builds a project before deploying and running
|
|
||||||
it.
|
|
||||||
|
|
||||||
\endlist
|
|
||||||
|
|
||||||
If a test takes more than a minute to execute, the default timeout might
|
|
||||||
stop the test execution. To increase the timeout, select \uicontrol Tools >
|
|
||||||
\uicontrol Options > \uicontrol {Test Settings} > \uicontrol General.
|
|
||||||
|
|
||||||
\image qtcreator-autotests-options.png
|
|
||||||
|
|
||||||
\QC scans the project for tests when you open the project and updates the
|
|
||||||
test list for the currently active test frameworks when you edit tests.
|
|
||||||
|
|
||||||
The code inside a benchmark test is measured, and possibly also repeated
|
|
||||||
several times in order to get an accurate measurement. This depends on the
|
|
||||||
measurement back-end that you can select in the
|
|
||||||
\uicontrol {Benchmark Metrics} group in \uicontrol Tools >
|
|
||||||
\uicontrol Options > \uicontrol {Test Settings} > \uicontrol {Qt Test}:
|
|
||||||
walltime, CPU tick counter, event counter, Valgrind Callgrind, and Linux
|
|
||||||
Perf. For more information, see \l{Creating a Benchmark}.
|
|
||||||
|
|
||||||
\image qtcreator-autotests-options-qt.png
|
|
||||||
|
|
||||||
To allow the debugger to interrupt Qt tests on assertions, select the
|
|
||||||
\uicontrol {Disable crash handler while debugging} check box.
|
|
||||||
|
|
||||||
\section1 Viewing Test Output
|
\section1 Viewing Test Output
|
||||||
|
|
||||||
The test results are displayed in the \uicontrol {Test Results} output pane.
|
The test results are displayed in the \uicontrol {Test Results} output pane
|
||||||
|
in XML format. XML can be parsed more easily and reliably than plain text.
|
||||||
|
|
||||||
|
However, if a Qt test crashes, it might not produce complete XML code that
|
||||||
|
can be parsed, which might lead to information loss. The lost information
|
||||||
|
might be retrievable when viewing the results as plain text.
|
||||||
|
To view the results of Qt tests as plain text, select \uicontrol Tools >
|
||||||
|
\uicontrol Options > \uicontrol {Test Settings} > \uicontrol {Qt Test}, and
|
||||||
|
then deselect the \uicontrol {Use XML output} check box. Then select the
|
||||||
|
\inlineimage text.png
|
||||||
|
(\uicontrol {Switch Between Visual and Text Display}) button in the
|
||||||
|
\uicontrol {Test Results} output pane to switch to the text display.
|
||||||
|
|
||||||
|
The following table lists the messages that the \uicontrol {Test Results}
|
||||||
|
output pane displays:
|
||||||
|
|
||||||
\table
|
\table
|
||||||
\header
|
\header
|
||||||
@@ -272,6 +321,13 @@
|
|||||||
\row
|
\row
|
||||||
\li FAIL
|
\li FAIL
|
||||||
\li Test case failed. Double-click the line for more information.
|
\li Test case failed. Double-click the line for more information.
|
||||||
|
\row
|
||||||
|
\li FATAL
|
||||||
|
\li A fatal error occurred that stops the test case from being run,
|
||||||
|
for example.
|
||||||
|
\row
|
||||||
|
\li INFO
|
||||||
|
\li Informative message.
|
||||||
\row
|
\row
|
||||||
\li INTERNAL
|
\li INTERNAL
|
||||||
\li Internal message.
|
\li Internal message.
|
||||||
@@ -281,6 +337,9 @@
|
|||||||
\row
|
\row
|
||||||
\li SKIP
|
\li SKIP
|
||||||
\li Test case was skipped.
|
\li Test case was skipped.
|
||||||
|
\row
|
||||||
|
\li SYSTEM
|
||||||
|
\li An error message received from or influenced by the OS.
|
||||||
\row
|
\row
|
||||||
\li XPASS
|
\li XPASS
|
||||||
\li Test case passed even though it was expected to fail.
|
\li Test case passed even though it was expected to fail.
|
||||||
@@ -294,7 +353,14 @@
|
|||||||
(\uicontrol {Filter Test Results}), and then select the types of messages to
|
(\uicontrol {Filter Test Results}), and then select the types of messages to
|
||||||
show.
|
show.
|
||||||
|
|
||||||
To hide internal messages and run configuration warnings, select
|
By default, test result output is limited to 100,000 characters. The output
|
||||||
\uicontrol Tools > \uicontrol Options > \uicontrol {Test Settings} >
|
pane is automatically scrolled down when new results are added. To display
|
||||||
\uicontrol General.
|
full results, select \uicontrol Tools > \uicontrol Options >
|
||||||
|
\uicontrol {Test Settings} > \uicontrol General, and then deselect the
|
||||||
|
\uicontrol {Limit result output} check box. To disable automatic scrolling,
|
||||||
|
deselect the \uicontrol {Automatically scroll results} check box.
|
||||||
|
|
||||||
|
Internal messages and run configuration warnings for guessed configurations
|
||||||
|
are omitted by default. To view them, deselect the \uicontrol {Omit internal
|
||||||
|
messages} and \uicontrol {Omit run configuration warnings} check boxes.
|
||||||
*/
|
*/
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the Qt Creator documentation.
|
** This file is part of the Qt Creator documentation.
|
||||||
@@ -141,6 +141,7 @@
|
|||||||
hierarchy of a QML file.
|
hierarchy of a QML file.
|
||||||
|
|
||||||
\li \uicontrol Tests lists autotests and Qt Quick tests in the project.
|
\li \uicontrol Tests lists autotests and Qt Quick tests in the project.
|
||||||
|
For more information, see \l {Running Autotests}.
|
||||||
|
|
||||||
\li \uicontrol {Type Hierarchy} shows the base classes of a class.
|
\li \uicontrol {Type Hierarchy} shows the base classes of a class.
|
||||||
|
|
||||||
@@ -303,28 +304,6 @@
|
|||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\section2 Viewing Tests
|
|
||||||
|
|
||||||
The \uicontrol Tests view shows the autotests and Qt Quick tests in the
|
|
||||||
current project. Select the test cases to run. If a Qt
|
|
||||||
Quick test case does not have a name, it is marked \uicontrol Unnamed in the
|
|
||||||
list. Unnamed test cases are always executed when the application that
|
|
||||||
contains them is run, and therefore you cannot select or deselect them.
|
|
||||||
|
|
||||||
To show or hide init and cleanup or data functions, select
|
|
||||||
\uicontrol {Filter Test Tree} > \uicontrol {Show Init and Cleanup Functions}
|
|
||||||
or \uicontrol {Show Data Functions}. Double-click a function in the list
|
|
||||||
to open its source code in the code editor.
|
|
||||||
|
|
||||||
The test cases are listed in alphabetic order. To list them in the order in
|
|
||||||
which they are defined in the source code, select \inlineimage leafsort.png
|
|
||||||
(\uicontrol {Sort Naturally}).
|
|
||||||
|
|
||||||
To run tests, select \uicontrol {Run All Tests} or
|
|
||||||
\uicontrol {Run Selected Tests} in the context menu.
|
|
||||||
|
|
||||||
To refresh the view, select \uicontrol {Rescan Tests} in the context menu.
|
|
||||||
|
|
||||||
\section2 Viewing Type Hierarchy
|
\section2 Viewing Type Hierarchy
|
||||||
|
|
||||||
To view the base classes of a class, right-click the class and select
|
To view the base classes of a class, right-click the class and select
|
||||||
@@ -375,8 +354,7 @@
|
|||||||
To open the \uicontrol{General Messages} and \l{Using Version Control Systems}
|
To open the \uicontrol{General Messages} and \l{Using Version Control Systems}
|
||||||
{Version Control} panes, select
|
{Version Control} panes, select
|
||||||
\uicontrol {Window > Output Panes}. To display the \uicontrol {To-Do Entries} pane,
|
\uicontrol {Window > Output Panes}. To display the \uicontrol {To-Do Entries} pane,
|
||||||
enable the Todo plugin and to display the \l{Running Autotests}
|
enable the Todo plugin.
|
||||||
{Test Results} pane, enable the Auto Tests plugin.
|
|
||||||
|
|
||||||
\section2 Issues
|
\section2 Issues
|
||||||
|
|
||||||
|
@@ -57,17 +57,16 @@ def parse_arguments():
|
|||||||
|
|
||||||
source_include_patterns = [
|
source_include_patterns = [
|
||||||
# directories
|
# directories
|
||||||
r"^scripts/.*$", # everything under scripts/
|
r"^(?!(share|tests)/.*$)(.*/)?$", # look into all directories except under share/ and tests/
|
||||||
r"^doc/.*$", # everything under doc/
|
|
||||||
r"^share/(qtcreator/(qml/(qmlpuppet/(.*/)?)?)?)?$", # for shared headers for qt quick designer plugins
|
r"^share/(qtcreator/(qml/(qmlpuppet/(.*/)?)?)?)?$", # for shared headers for qt quick designer plugins
|
||||||
r"^src/(.*/)?$", # all directories under src/
|
|
||||||
r"^plugins/(.*/)?$", # all directories under plugins/ (if this is run on extra plugin repositories)
|
|
||||||
# files
|
# files
|
||||||
r"^HACKING$",
|
r"^HACKING$",
|
||||||
r"^LICENSE.*$",
|
r"^LICENSE.*$",
|
||||||
r"^README.md$",
|
r"^README.md$",
|
||||||
r"^.*\.pri$",
|
r"^scripts/.*$", # include everything under scripts/
|
||||||
r"^.*\.h$",
|
r"^doc/.*$", # include everything under doc/
|
||||||
|
r"^.*\.pri$", # .pri files in all directories that are looked into
|
||||||
|
r"^.*\.h$", # .h files in all directories that are looked into
|
||||||
]
|
]
|
||||||
|
|
||||||
build_include_patterns = [
|
build_include_patterns = [
|
||||||
|
@@ -20,9 +20,11 @@ win32 {
|
|||||||
# We need the version in two separate formats for the .rc file
|
# We need the version in two separate formats for the .rc file
|
||||||
# RC_VERSION=4,3,82,0 (quadruple)
|
# RC_VERSION=4,3,82,0 (quadruple)
|
||||||
# RC_VERSION_STRING="4.4.0-beta1" (free text)
|
# RC_VERSION_STRING="4.4.0-beta1" (free text)
|
||||||
|
# Also, we need to replace space with \x20 to be able to work with both rc and windres
|
||||||
|
COPYRIGHT = "2008-$${QTCREATOR_COPYRIGHT_YEAR} The Qt Company Ltd"
|
||||||
DEFINES += RC_VERSION=$$replace(QTCREATOR_VERSION, "\\.", ","),0 \
|
DEFINES += RC_VERSION=$$replace(QTCREATOR_VERSION, "\\.", ","),0 \
|
||||||
RC_VERSION_STRING=\\\"$${QTCREATOR_DISPLAY_VERSION}\\\" \
|
RC_VERSION_STRING=\"$${QTCREATOR_DISPLAY_VERSION}\" \
|
||||||
RC_COPYRIGHT='"\\\"2008-$${QTCREATOR_COPYRIGHT_YEAR} The Qt Company Ltd\\\""'
|
RC_COPYRIGHT=\"$$replace(COPYRIGHT, " ", "\\x20")\"
|
||||||
RC_FILE = qtcreator.rc
|
RC_FILE = qtcreator.rc
|
||||||
} else:macx {
|
} else:macx {
|
||||||
LIBS += -framework CoreFoundation
|
LIBS += -framework CoreFoundation
|
||||||
|
@@ -54,9 +54,11 @@ QtcProduct {
|
|||||||
// We need the version in two separate formats for the .rc file
|
// We need the version in two separate formats for the .rc file
|
||||||
// RC_VERSION=4,3,82,0 (quadruple)
|
// RC_VERSION=4,3,82,0 (quadruple)
|
||||||
// RC_VERSION_STRING="4.4.0-beta1" (free text)
|
// RC_VERSION_STRING="4.4.0-beta1" (free text)
|
||||||
|
// Also, we need to replace space with \x20 to be able to work with both rc and windres
|
||||||
cpp.defines: outer.concat(["RC_VERSION=" + qtc.qtcreator_version.replace(/\./g, ",") + ",0",
|
cpp.defines: outer.concat(["RC_VERSION=" + qtc.qtcreator_version.replace(/\./g, ",") + ",0",
|
||||||
"RC_VERSION_STRING=\"" + qtc.qtcreator_display_version + "\"",
|
"RC_VERSION_STRING=" + qtc.qtcreator_display_version,
|
||||||
"RC_COPYRIGHT=\"2008-" + qtc.qtcreator_copyright_year + " The Qt Company Ltd\""])
|
"RC_COPYRIGHT=2008-" + qtc.qtcreator_copyright_year
|
||||||
|
+ " The Qt Company Ltd".replace(/ /g, "\\x20")])
|
||||||
files: "qtcreator.rc"
|
files: "qtcreator.rc"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#define STRINGIFY1(x) #x
|
||||||
|
#define STRINGIFY(x) STRINGIFY1(x)
|
||||||
|
|
||||||
IDI_ICON1 ICON DISCARDABLE "qtcreator.ico"
|
IDI_ICON1 ICON DISCARDABLE "qtcreator.ico"
|
||||||
IDI_ICON2 ICON DISCARDABLE "winicons/c.ico"
|
IDI_ICON2 ICON DISCARDABLE "winicons/c.ico"
|
||||||
IDI_ICON3 ICON DISCARDABLE "winicons/cpp.ico"
|
IDI_ICON3 ICON DISCARDABLE "winicons/cpp.ico"
|
||||||
@@ -19,10 +22,10 @@ VS_VERSION_INFO VERSIONINFO
|
|||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
{
|
{
|
||||||
VALUE "FileDescription", "Qt Creator"
|
VALUE "FileDescription", "Qt Creator"
|
||||||
VALUE "FileVersion", RC_VERSION_STRING
|
VALUE "FileVersion", STRINGIFY(RC_VERSION_STRING)
|
||||||
VALUE "ProductName", "Qt Creator"
|
VALUE "ProductName", "Qt Creator"
|
||||||
VALUE "ProductVersion", RC_VERSION_STRING
|
VALUE "ProductVersion", STRINGIFY(RC_VERSION_STRING)
|
||||||
VALUE "LegalCopyright", RC_COPYRIGHT
|
VALUE "LegalCopyright", STRINGIFY(RC_COPYRIGHT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
#include "ASTPatternBuilder.h"
|
|
@@ -1,3 +1,22 @@
|
|||||||
|
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "Lexer.h"
|
#include "Lexer.h"
|
||||||
#include "Token.h"
|
#include "Token.h"
|
||||||
|
@@ -1,3 +1,22 @@
|
|||||||
|
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "ObjectiveCTypeQualifiers.h"
|
#include "ObjectiveCTypeQualifiers.h"
|
||||||
|
|
||||||
|
@@ -1,9 +1,27 @@
|
|||||||
#ifndef CPLUSPLUS_OBJC_TYPEQUALIFIERS_H
|
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
|
||||||
#define CPLUSPLUS_OBJC_TYPEQUALIFIERS_H
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include "CPlusPlusForwardDeclarations.h"
|
#include "CPlusPlusForwardDeclarations.h"
|
||||||
|
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -27,6 +45,3 @@ enum {
|
|||||||
CPLUSPLUS_EXPORT int classifyObjectiveCContextKeyword(const char *s, int n);
|
CPLUSPLUS_EXPORT int classifyObjectiveCContextKeyword(const char *s, int n);
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
|
|
||||||
#endif // CPLUSPLUS_OBJC_TYPEQUALIFIERS_H
|
|
||||||
|
@@ -1,3 +1,22 @@
|
|||||||
|
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include "QtContextKeywords.h"
|
#include "QtContextKeywords.h"
|
||||||
|
|
||||||
|
19
src/libs/3rdparty/cplusplus/QtContextKeywords.h
vendored
@@ -1,3 +1,22 @@
|
|||||||
|
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
5
src/libs/3rdparty/cplusplus/SafeMatcher.h
vendored
@@ -23,8 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CPLUSPLUS_SAFETYPEMATCHER_H
|
#pragma once
|
||||||
#define CPLUSPLUS_SAFETYPEMATCHER_H
|
|
||||||
|
|
||||||
#include "Matcher.h"
|
#include "Matcher.h"
|
||||||
|
|
||||||
@@ -56,5 +55,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // CPlusPlus namespace
|
} // CPlusPlus namespace
|
||||||
|
|
||||||
#endif // CPLUSPLUS_SAFETYPEMATCHER_H
|
|
||||||
|
1
src/libs/3rdparty/cplusplus/cplusplus.pri
vendored
@@ -40,7 +40,6 @@ SOURCES += \
|
|||||||
$$PWD/ASTMatch0.cpp \
|
$$PWD/ASTMatch0.cpp \
|
||||||
$$PWD/ASTVisitor.cpp \
|
$$PWD/ASTVisitor.cpp \
|
||||||
$$PWD/ASTClone.cpp \
|
$$PWD/ASTClone.cpp \
|
||||||
$$PWD/ASTPatternBuilder.cpp \
|
|
||||||
$$PWD/ASTMatcher.cpp \
|
$$PWD/ASTMatcher.cpp \
|
||||||
$$PWD/Matcher.cpp \
|
$$PWD/Matcher.cpp \
|
||||||
$$PWD/Control.cpp \
|
$$PWD/Control.cpp \
|
||||||
|
@@ -30,7 +30,6 @@ Project {
|
|||||||
"ASTMatch0.cpp",
|
"ASTMatch0.cpp",
|
||||||
"ASTMatcher.cpp",
|
"ASTMatcher.cpp",
|
||||||
"ASTMatcher.h",
|
"ASTMatcher.h",
|
||||||
"ASTPatternBuilder.cpp",
|
|
||||||
"ASTPatternBuilder.h",
|
"ASTPatternBuilder.h",
|
||||||
"ASTVisit.cpp",
|
"ASTVisit.cpp",
|
||||||
"ASTVisitor.cpp",
|
"ASTVisitor.cpp",
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/stringutils.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -631,26 +632,6 @@ static inline QString msgInvalidFormat(const char *key, const QString &content)
|
|||||||
.arg(QLatin1String(key), content);
|
.arg(QLatin1String(key), content);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginSpec::readMultiLineString(const QJsonValue &value, QString *out)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(out, return false);
|
|
||||||
if (value.isString()) {
|
|
||||||
*out = value.toString();
|
|
||||||
} else if (value.isArray()) {
|
|
||||||
QJsonArray array = value.toArray();
|
|
||||||
QStringList lines;
|
|
||||||
foreach (const QJsonValue &v, array) {
|
|
||||||
if (!v.isString())
|
|
||||||
return false;
|
|
||||||
lines.append(v.toString());
|
|
||||||
}
|
|
||||||
*out = lines.join(QLatin1Char('\n'));
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
@@ -735,7 +716,7 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData)
|
|||||||
copyright = value.toString();
|
copyright = value.toString();
|
||||||
|
|
||||||
value = metaData.value(QLatin1String(DESCRIPTION));
|
value = metaData.value(QLatin1String(DESCRIPTION));
|
||||||
if (!value.isUndefined() && !PluginSpec::readMultiLineString(value, &description))
|
if (!value.isUndefined() && !Utils::readMultiLineString(value, &description))
|
||||||
return reportError(msgValueIsNotAString(DESCRIPTION));
|
return reportError(msgValueIsNotAString(DESCRIPTION));
|
||||||
|
|
||||||
value = metaData.value(QLatin1String(URL));
|
value = metaData.value(QLatin1String(URL));
|
||||||
@@ -749,7 +730,7 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData)
|
|||||||
category = value.toString();
|
category = value.toString();
|
||||||
|
|
||||||
value = metaData.value(QLatin1String(LICENSE));
|
value = metaData.value(QLatin1String(LICENSE));
|
||||||
if (!value.isUndefined() && !PluginSpec::readMultiLineString(value, &license))
|
if (!value.isUndefined() && !Utils::readMultiLineString(value, &license))
|
||||||
return reportError(msgValueIsNotAMultilineString(LICENSE));
|
return reportError(msgValueIsNotAMultilineString(LICENSE));
|
||||||
|
|
||||||
value = metaData.value(QLatin1String(PLATFORM));
|
value = metaData.value(QLatin1String(PLATFORM));
|
||||||
@@ -799,7 +780,7 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData)
|
|||||||
} else if (typeValue.toLower() == QLatin1String(DEPENDENCY_TYPE_TEST)) {
|
} else if (typeValue.toLower() == QLatin1String(DEPENDENCY_TYPE_TEST)) {
|
||||||
dep.type = PluginDependency::Test;
|
dep.type = PluginDependency::Test;
|
||||||
} else {
|
} else {
|
||||||
return reportError(tr("Dependency: \"%1\" must be \"%2\" or \"%3\" (is \"%4\")")
|
return reportError(tr("Dependency: \"%1\" must be \"%2\" or \"%3\" (is \"%4\").")
|
||||||
.arg(QLatin1String(DEPENDENCY_TYPE),
|
.arg(QLatin1String(DEPENDENCY_TYPE),
|
||||||
QLatin1String(DEPENDENCY_TYPE_HARD),
|
QLatin1String(DEPENDENCY_TYPE_HARD),
|
||||||
QLatin1String(DEPENDENCY_TYPE_SOFT),
|
QLatin1String(DEPENDENCY_TYPE_SOFT),
|
||||||
|
@@ -131,8 +131,6 @@ public:
|
|||||||
bool hasError() const;
|
bool hasError() const;
|
||||||
QString errorString() const;
|
QString errorString() const;
|
||||||
|
|
||||||
static bool readMultiLineString(const QJsonValue &value, QString *out);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PluginSpec();
|
PluginSpec();
|
||||||
|
|
||||||
|
@@ -758,6 +758,13 @@ void ModelController::moveObject(MPackage *newOwner, MObject *object)
|
|||||||
QMT_ASSERT(object, return);
|
QMT_ASSERT(object, return);
|
||||||
QMT_ASSERT(object != m_rootPackage, return);
|
QMT_ASSERT(object != m_rootPackage, return);
|
||||||
|
|
||||||
|
// verify that newOwner is not a child of object
|
||||||
|
MObject *newOwnerObject = newOwner;
|
||||||
|
while (newOwnerObject && newOwnerObject != object)
|
||||||
|
newOwnerObject = newOwnerObject->owner();
|
||||||
|
if (newOwnerObject == object)
|
||||||
|
return;
|
||||||
|
|
||||||
if (newOwner != object->owner()) {
|
if (newOwner != object->owner()) {
|
||||||
int formerRow = 0;
|
int formerRow = 0;
|
||||||
MObject *formerOwner = object->owner();
|
MObject *formerOwner = object->owner();
|
||||||
|
@@ -2,6 +2,8 @@ import qbs
|
|||||||
import qbs.Environment
|
import qbs.Environment
|
||||||
import qbs.File
|
import qbs.File
|
||||||
import qbs.FileInfo
|
import qbs.FileInfo
|
||||||
|
import qbs.Process
|
||||||
|
import qbs.Utilities
|
||||||
|
|
||||||
QtcLibrary {
|
QtcLibrary {
|
||||||
condition: qbs.toolchain.contains("msvc") && cdbPath
|
condition: qbs.toolchain.contains("msvc") && cdbPath
|
||||||
@@ -45,11 +47,98 @@ QtcLibrary {
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
cpp.includePaths: [FileInfo.joinPaths(cdbPath, "inc")]
|
|
||||||
cpp.dynamicLibraries: [
|
property string pythonInstallDir: Environment.getEnv("PYTHON_INSTALL_DIR")
|
||||||
"user32.lib",
|
|
||||||
FileInfo.joinPaths(cdbLibPath, "dbgeng.lib")
|
Probe {
|
||||||
|
id: pythonDllProbe
|
||||||
|
condition: product.condition
|
||||||
|
property string pythonDir: pythonInstallDir // Input
|
||||||
|
property string buildVariant: qbs.buildVariant // Input
|
||||||
|
property string fileNamePrefix // Output
|
||||||
|
configure: {
|
||||||
|
function printWarning(msg) {
|
||||||
|
console.warn(msg + " The python dumpers for cdb will not be available.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pythonDir) {
|
||||||
|
printWarning("PYTHON_INSTALL_DIR not set.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!File.exists(pythonDir)) {
|
||||||
|
printWarning("The provided python installation directory '" + pythonDir
|
||||||
|
+ "' does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var p = new Process();
|
||||||
|
try {
|
||||||
|
var pythonFilePath = FileInfo.joinPaths(pythonDir, "python.exe");
|
||||||
|
p.exec(pythonFilePath, ["--version"], true);
|
||||||
|
var output = p.readStdOut().trim();
|
||||||
|
var magicPrefix = "Python ";
|
||||||
|
if (!output.startsWith(magicPrefix)) {
|
||||||
|
printWarning("Unexpected python output when checking for version: '"
|
||||||
|
+ output + "'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var versionNumberString = output.slice(magicPrefix.length);
|
||||||
|
var versionNumbers = versionNumberString.split('.');
|
||||||
|
if (versionNumbers.length < 2) {
|
||||||
|
printWarning("Unexpected python output when checking for version: '"
|
||||||
|
+ output + "'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Utilities.versionCompare(versionNumberString, "3.5") < 0) {
|
||||||
|
printWarning("The python installation at '" + pythonDir
|
||||||
|
+ "' has version " + versionNumberString + ", but 3.5 or higher "
|
||||||
|
+ "is required.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
found = true;
|
||||||
|
fileNamePrefix = "python" + versionNumbers[0] + versionNumbers[1];
|
||||||
|
if (buildVariant === "debug")
|
||||||
|
fileNamePrefix += "_d"
|
||||||
|
} finally {
|
||||||
|
p.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Group {
|
||||||
|
name: "pythonDumper"
|
||||||
|
condition: pythonDllProbe.found
|
||||||
|
files: [
|
||||||
|
"pycdbextmodule.cpp",
|
||||||
|
"pycdbextmodule.h",
|
||||||
|
"pyfield.cpp",
|
||||||
|
"pyfield.h",
|
||||||
|
"pystdoutredirect.cpp",
|
||||||
|
"pystdoutredirect.h",
|
||||||
|
"pytype.cpp",
|
||||||
|
"pytype.h",
|
||||||
|
"pyvalue.cpp",
|
||||||
|
"pyvalue.h",
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
Properties {
|
||||||
|
condition: pythonDllProbe.found
|
||||||
|
cpp.defines: ["WITH_PYTHON=1"]
|
||||||
|
}
|
||||||
|
cpp.includePaths: {
|
||||||
|
var paths = [FileInfo.joinPaths(cdbPath, "inc")];
|
||||||
|
if (pythonDllProbe.found)
|
||||||
|
paths.push(FileInfo.joinPaths(pythonInstallDir, "include"));
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
cpp.dynamicLibraries: {
|
||||||
|
var libs = [ "user32.lib", FileInfo.joinPaths(cdbLibPath, "dbgeng.lib") ];
|
||||||
|
if (pythonDllProbe.found)
|
||||||
|
libs.push(FileInfo.joinPaths(pythonInstallDir, "libs",
|
||||||
|
pythonDllProbe.fileNamePrefix + ".lib"));
|
||||||
|
return libs;
|
||||||
|
}
|
||||||
cpp.linkerFlags: ["/DEF:" + FileInfo.toWindowsSeparators(
|
cpp.linkerFlags: ["/DEF:" + FileInfo.toWindowsSeparators(
|
||||||
FileInfo.joinPaths(product.sourceDirectory,
|
FileInfo.joinPaths(product.sourceDirectory,
|
||||||
"qtcreatorcdbext.def"))]
|
"qtcreatorcdbext.def"))]
|
||||||
@@ -61,6 +150,16 @@ QtcLibrary {
|
|||||||
dirName += "32";
|
dirName += "32";
|
||||||
return FileInfo.joinPaths(qtc.libDirName, dirName);
|
return FileInfo.joinPaths(qtc.libDirName, dirName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group {
|
||||||
|
condition: pythonDllProbe.found
|
||||||
|
files: [FileInfo.joinPaths(pythonInstallDir, pythonDllProbe.fileNamePrefix + ".dll")]
|
||||||
|
qbs.install: true
|
||||||
|
qbs.installDir: installDir
|
||||||
|
}
|
||||||
|
|
||||||
|
useNonGuiPchFile: false
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
"common.cpp",
|
"common.cpp",
|
||||||
"common.h",
|
"common.h",
|
||||||
|
305
src/libs/utils/highlightingitemdelegate.cpp
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2017 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.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "highlightingitemdelegate.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QModelIndex>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
const int kMinimumLineNumberDigits = 6;
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
|
||||||
|
HighlightingItemDelegate::HighlightingItemDelegate(int tabWidth, QObject *parent)
|
||||||
|
: QItemDelegate(parent)
|
||||||
|
{
|
||||||
|
setTabWidth(tabWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HighlightingItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
|
const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
static const int iconSize = 16;
|
||||||
|
|
||||||
|
painter->save();
|
||||||
|
|
||||||
|
const QStyleOptionViewItem opt = setOptions(index, option);
|
||||||
|
painter->setFont(opt.font);
|
||||||
|
|
||||||
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
|
|
||||||
|
// ---- do the layout
|
||||||
|
QRect checkRect;
|
||||||
|
QRect pixmapRect;
|
||||||
|
QRect textRect;
|
||||||
|
|
||||||
|
// check mark
|
||||||
|
const bool checkable = (index.model()->flags(index) & Qt::ItemIsUserCheckable);
|
||||||
|
Qt::CheckState checkState = Qt::Unchecked;
|
||||||
|
if (checkable) {
|
||||||
|
QVariant checkStateData = index.data(Qt::CheckStateRole);
|
||||||
|
checkState = static_cast<Qt::CheckState>(checkStateData.toInt());
|
||||||
|
checkRect = doCheck(opt, opt.rect, checkStateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// icon
|
||||||
|
const QIcon icon = index.model()->data(index, Qt::DecorationRole).value<QIcon>();
|
||||||
|
if (!icon.isNull()) {
|
||||||
|
const QSize size = icon.actualSize(QSize(iconSize, iconSize));
|
||||||
|
pixmapRect = QRect(0, 0, size.width(), size.height());
|
||||||
|
}
|
||||||
|
|
||||||
|
// text
|
||||||
|
textRect = opt.rect.adjusted(0, 0, checkRect.width() + pixmapRect.width(), 0);
|
||||||
|
|
||||||
|
// do layout
|
||||||
|
doLayout(opt, &checkRect, &pixmapRect, &textRect, false);
|
||||||
|
// ---- draw the items
|
||||||
|
// icon
|
||||||
|
if (!icon.isNull())
|
||||||
|
icon.paint(painter, pixmapRect, option.decorationAlignment);
|
||||||
|
|
||||||
|
// line numbers
|
||||||
|
const int lineNumberAreaWidth = drawLineNumber(painter, opt, textRect, index);
|
||||||
|
textRect.adjust(lineNumberAreaWidth, 0, 0, 0);
|
||||||
|
|
||||||
|
// text and focus/selection
|
||||||
|
drawText(painter, opt, textRect, index);
|
||||||
|
QItemDelegate::drawFocus(painter, opt, opt.rect);
|
||||||
|
|
||||||
|
// check mark
|
||||||
|
if (checkable)
|
||||||
|
QItemDelegate::drawCheck(painter, opt, checkRect, checkState);
|
||||||
|
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HighlightingItemDelegate::setTabWidth(int width)
|
||||||
|
{
|
||||||
|
m_tabString = QString(width, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns the width of the line number area
|
||||||
|
int HighlightingItemDelegate::drawLineNumber(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
|
const QRect &rect,
|
||||||
|
const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
static const int lineNumberAreaHorizontalPadding = 4;
|
||||||
|
const int lineNumber = index.model()->data(index, int(HighlightingItemRole::LineNumber)).toInt();
|
||||||
|
if (lineNumber < 1)
|
||||||
|
return 0;
|
||||||
|
const bool isSelected = option.state & QStyle::State_Selected;
|
||||||
|
const QString lineText = QString::number(lineNumber);
|
||||||
|
const int minimumLineNumberDigits = qMax(kMinimumLineNumberDigits, lineText.count());
|
||||||
|
const int fontWidth = painter->fontMetrics().width(QString(minimumLineNumberDigits, '0'));
|
||||||
|
const int lineNumberAreaWidth = lineNumberAreaHorizontalPadding + fontWidth
|
||||||
|
+ lineNumberAreaHorizontalPadding;
|
||||||
|
QRect lineNumberAreaRect(rect);
|
||||||
|
lineNumberAreaRect.setWidth(lineNumberAreaWidth);
|
||||||
|
|
||||||
|
QPalette::ColorGroup cg = QPalette::Normal;
|
||||||
|
if (!(option.state & QStyle::State_Active))
|
||||||
|
cg = QPalette::Inactive;
|
||||||
|
else if (!(option.state & QStyle::State_Enabled))
|
||||||
|
cg = QPalette::Disabled;
|
||||||
|
|
||||||
|
painter->fillRect(lineNumberAreaRect, QBrush(isSelected ?
|
||||||
|
option.palette.brush(cg, QPalette::Highlight) :
|
||||||
|
option.palette.color(cg, QPalette::Base).darker(111)));
|
||||||
|
|
||||||
|
QStyleOptionViewItem opt = option;
|
||||||
|
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
|
||||||
|
opt.palette.setColor(cg, QPalette::Text, Qt::darkGray);
|
||||||
|
|
||||||
|
const QStyle *style = QApplication::style();
|
||||||
|
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
|
||||||
|
|
||||||
|
const QRect rowRect
|
||||||
|
= lineNumberAreaRect.adjusted(-textMargin, 0,
|
||||||
|
textMargin - lineNumberAreaHorizontalPadding, 0);
|
||||||
|
QItemDelegate::drawDisplay(painter, opt, rowRect, lineText);
|
||||||
|
|
||||||
|
return lineNumberAreaWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HighlightingItemDelegate::drawText(QPainter *painter,
|
||||||
|
const QStyleOptionViewItem &option,
|
||||||
|
const QRect &rect,
|
||||||
|
const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QString text = index.model()->data(index, Qt::DisplayRole).toString();
|
||||||
|
// show number of subresults in displayString
|
||||||
|
if (index.model()->hasChildren(index))
|
||||||
|
text += " (" + QString::number(index.model()->rowCount(index)) + ')';
|
||||||
|
|
||||||
|
int searchTermStart = index.model()->data(index, int(HighlightingItemRole::StartColumn)).toInt();
|
||||||
|
int searchTermLength = index.model()->data(index, int(HighlightingItemRole::Length)).toInt();
|
||||||
|
if (searchTermStart < 0 || searchTermStart >= text.length() || searchTermLength < 1) {
|
||||||
|
drawDisplay(painter, option, rect, text.replace('\t', m_tabString), {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace tabs with searchTerm bookkeeping
|
||||||
|
int searchTermEnd = searchTermStart + searchTermLength;
|
||||||
|
const int tabDiff = m_tabString.size() - 1;
|
||||||
|
for (int i = 0; i < text.length(); i++) {
|
||||||
|
if (text.at(i) == '\t') {
|
||||||
|
text.replace(i, 1, m_tabString);
|
||||||
|
if (i < searchTermStart) {
|
||||||
|
searchTermStart += tabDiff;
|
||||||
|
searchTermEnd += tabDiff;
|
||||||
|
} else if (i < searchTermEnd) {
|
||||||
|
searchTermEnd += tabDiff;
|
||||||
|
searchTermLength += tabDiff;
|
||||||
|
}
|
||||||
|
i += tabDiff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const QColor highlightForeground =
|
||||||
|
index.model()->data(index, int(HighlightingItemRole::Foreground)).value<QColor>();
|
||||||
|
const QColor highlightBackground =
|
||||||
|
index.model()->data(index, int(HighlightingItemRole::Background)).value<QColor>();
|
||||||
|
QTextCharFormat highlightFormat;
|
||||||
|
highlightFormat.setForeground(highlightForeground);
|
||||||
|
highlightFormat.setBackground(highlightBackground);
|
||||||
|
|
||||||
|
drawDisplay(painter, option, rect, text, {{searchTermStart, searchTermLength, highlightFormat}});
|
||||||
|
}
|
||||||
|
|
||||||
|
// copied from QItemDelegate for drawDisplay
|
||||||
|
static QString replaceNewLine(QString text)
|
||||||
|
{
|
||||||
|
static const QChar nl = '\n';
|
||||||
|
for (int i = 0; i < text.count(); ++i)
|
||||||
|
if (text.at(i) == nl)
|
||||||
|
text[i] = QChar::LineSeparator;
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copied from QItemDelegate for drawDisplay
|
||||||
|
QSizeF doTextLayout(QTextLayout *textLayout, int lineWidth)
|
||||||
|
{
|
||||||
|
qreal height = 0;
|
||||||
|
qreal widthUsed = 0;
|
||||||
|
textLayout->beginLayout();
|
||||||
|
while (true) {
|
||||||
|
QTextLine line = textLayout->createLine();
|
||||||
|
if (!line.isValid())
|
||||||
|
break;
|
||||||
|
line.setLineWidth(lineWidth);
|
||||||
|
line.setPosition(QPointF(0, height));
|
||||||
|
height += line.height();
|
||||||
|
widthUsed = qMax(widthUsed, line.naturalTextWidth());
|
||||||
|
}
|
||||||
|
textLayout->endLayout();
|
||||||
|
return QSizeF(widthUsed, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// copied from QItemDelegate to be able to add the 'format' parameter
|
||||||
|
void HighlightingItemDelegate::drawDisplay(QPainter *painter,
|
||||||
|
const QStyleOptionViewItem &option,
|
||||||
|
const QRect &rect, const QString &text,
|
||||||
|
const QVector<QTextLayout::FormatRange> &format) const
|
||||||
|
{
|
||||||
|
QPalette::ColorGroup cg = option.state & QStyle::State_Enabled
|
||||||
|
? QPalette::Normal : QPalette::Disabled;
|
||||||
|
if (cg == QPalette::Normal && !(option.state & QStyle::State_Active))
|
||||||
|
cg = QPalette::Inactive;
|
||||||
|
if (option.state & QStyle::State_Selected) {
|
||||||
|
painter->fillRect(rect, option.palette.brush(cg, QPalette::Highlight));
|
||||||
|
painter->setPen(option.palette.color(cg, QPalette::HighlightedText));
|
||||||
|
} else {
|
||||||
|
painter->setPen(option.palette.color(cg, QPalette::Text));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (option.state & QStyle::State_Editing) {
|
||||||
|
painter->save();
|
||||||
|
painter->setPen(option.palette.color(cg, QPalette::Text));
|
||||||
|
painter->drawRect(rect.adjusted(0, 0, -1, -1));
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
const QStyleOptionViewItem opt = option;
|
||||||
|
|
||||||
|
const QWidget *widget = option.widget;
|
||||||
|
QStyle *style = widget ? widget->style() : QApplication::style();
|
||||||
|
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1;
|
||||||
|
QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding
|
||||||
|
const bool wrapText = opt.features & QStyleOptionViewItem::WrapText;
|
||||||
|
QTextOption textOption;
|
||||||
|
textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap);
|
||||||
|
textOption.setTextDirection(option.direction);
|
||||||
|
textOption.setAlignment(QStyle::visualAlignment(option.direction, option.displayAlignment));
|
||||||
|
QTextLayout textLayout;
|
||||||
|
textLayout.setTextOption(textOption);
|
||||||
|
textLayout.setFont(option.font);
|
||||||
|
textLayout.setText(replaceNewLine(text));
|
||||||
|
|
||||||
|
QSizeF textLayoutSize = doTextLayout(&textLayout, textRect.width());
|
||||||
|
|
||||||
|
if (textRect.width() < textLayoutSize.width()
|
||||||
|
|| textRect.height() < textLayoutSize.height()) {
|
||||||
|
QString elided;
|
||||||
|
int start = 0;
|
||||||
|
int end = text.indexOf(QChar::LineSeparator, start);
|
||||||
|
if (end == -1) {
|
||||||
|
elided += option.fontMetrics.elidedText(text, option.textElideMode, textRect.width());
|
||||||
|
} else {
|
||||||
|
while (end != -1) {
|
||||||
|
elided += option.fontMetrics.elidedText(text.mid(start, end - start),
|
||||||
|
option.textElideMode, textRect.width());
|
||||||
|
elided += QChar::LineSeparator;
|
||||||
|
start = end + 1;
|
||||||
|
end = text.indexOf(QChar::LineSeparator, start);
|
||||||
|
}
|
||||||
|
// let's add the last line (after the last QChar::LineSeparator)
|
||||||
|
elided += option.fontMetrics.elidedText(text.mid(start),
|
||||||
|
option.textElideMode, textRect.width());
|
||||||
|
}
|
||||||
|
textLayout.setText(elided);
|
||||||
|
textLayoutSize = doTextLayout(&textLayout, textRect.width());
|
||||||
|
}
|
||||||
|
|
||||||
|
const QSize layoutSize(textRect.width(), int(textLayoutSize.height()));
|
||||||
|
const QRect layoutRect = QStyle::alignedRect(option.direction, option.displayAlignment,
|
||||||
|
layoutSize, textRect);
|
||||||
|
// if we still overflow even after eliding the text, enable clipping
|
||||||
|
if (!hasClipping() && (textRect.width() < textLayoutSize.width()
|
||||||
|
|| textRect.height() < textLayoutSize.height())) {
|
||||||
|
painter->save();
|
||||||
|
painter->setClipRect(layoutRect);
|
||||||
|
textLayout.draw(painter, layoutRect.topLeft(), format, layoutRect);
|
||||||
|
painter->restore();
|
||||||
|
} else {
|
||||||
|
textLayout.draw(painter, layoutRect.topLeft(), format, layoutRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Utils
|
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of Qt Creator.
|
** This file is part of Qt Creator.
|
||||||
@@ -25,28 +25,37 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <texteditor/codeassist/completionassistprovider.h>
|
#include "utils_global.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QItemDelegate>
|
||||||
|
#include <QTextLayout>
|
||||||
|
|
||||||
namespace Android {
|
namespace Utils {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class JavaCompletionAssistProvider : public TextEditor::CompletionAssistProvider
|
enum class HighlightingItemRole {
|
||||||
{
|
LineNumber = Qt::UserRole,
|
||||||
Q_OBJECT
|
StartColumn,
|
||||||
|
Length,
|
||||||
public:
|
Foreground,
|
||||||
JavaCompletionAssistProvider();
|
Background,
|
||||||
~JavaCompletionAssistProvider();
|
User
|
||||||
|
|
||||||
void init() const;
|
|
||||||
|
|
||||||
TextEditor::IAssistProcessor *createProcessor() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
mutable QStringList m_keywords;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
class QTCREATOR_UTILS_EXPORT HighlightingItemDelegate : public QItemDelegate
|
||||||
} // namespace Android
|
{
|
||||||
|
public:
|
||||||
|
HighlightingItemDelegate(int tabWidth, QObject *parent = 0);
|
||||||
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
void setTabWidth(int width);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int drawLineNumber(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QModelIndex &index) const;
|
||||||
|
void drawText(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
|
const QRect &rect, const QModelIndex &index) const;
|
||||||
|
using QItemDelegate::drawDisplay;
|
||||||
|
void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect,
|
||||||
|
const QString &text, const QVector<QTextLayout::FormatRange> &format) const;
|
||||||
|
QString m_tabString;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Utils
|
@@ -36,6 +36,7 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
@@ -67,7 +68,12 @@ static MasksAndColors masksAndColors(const Icon &icon, int dpr)
|
|||||||
const QColor color = creatorTheme()->color(i.second);
|
const QColor color = creatorTheme()->color(i.second);
|
||||||
const QString dprFileName = StyleHelper::availableImageResolutions(i.first).contains(dpr) ?
|
const QString dprFileName = StyleHelper::availableImageResolutions(i.first).contains(dpr) ?
|
||||||
StyleHelper::imageFileWithResolution(fileName, dpr) : fileName;
|
StyleHelper::imageFileWithResolution(fileName, dpr) : fileName;
|
||||||
result.append(qMakePair(QPixmap(dprFileName), color));
|
QPixmap pixmap;
|
||||||
|
if (!pixmap.load(dprFileName)) {
|
||||||
|
pixmap = QPixmap(1, 1);
|
||||||
|
qWarning() << "Could not load image: " << dprFileName;
|
||||||
|
}
|
||||||
|
result.append({pixmap, color});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -28,8 +28,11 @@
|
|||||||
#include "hostosinfo.h"
|
#include "hostosinfo.h"
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonValue>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
@@ -246,4 +249,24 @@ QTCREATOR_UTILS_EXPORT QString stripAccelerator(const QString &text)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT bool readMultiLineString(const QJsonValue &value, QString *out)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(out, return false);
|
||||||
|
if (value.isString()) {
|
||||||
|
*out = value.toString();
|
||||||
|
} else if (value.isArray()) {
|
||||||
|
QJsonArray array = value.toArray();
|
||||||
|
QStringList lines;
|
||||||
|
foreach (const QJsonValue &v, array) {
|
||||||
|
if (!v.isString())
|
||||||
|
return false;
|
||||||
|
lines.append(v.toString());
|
||||||
|
}
|
||||||
|
*out = lines.join(QLatin1Char('\n'));
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QJsonValue;
|
||||||
class QStringList;
|
class QStringList;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@@ -53,6 +54,8 @@ QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path);
|
|||||||
// Removes first unescaped ampersand in text
|
// Removes first unescaped ampersand in text
|
||||||
QTCREATOR_UTILS_EXPORT QString stripAccelerator(const QString &text);
|
QTCREATOR_UTILS_EXPORT QString stripAccelerator(const QString &text);
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT bool readMultiLineString(const QJsonValue &value, QString *out);
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT AbstractMacroExpander
|
class QTCREATOR_UTILS_EXPORT AbstractMacroExpander
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -113,7 +113,8 @@ SOURCES += $$PWD/environment.cpp \
|
|||||||
$$PWD/port.cpp \
|
$$PWD/port.cpp \
|
||||||
$$PWD/runextensions.cpp \
|
$$PWD/runextensions.cpp \
|
||||||
$$PWD/utilsicons.cpp \
|
$$PWD/utilsicons.cpp \
|
||||||
$$PWD/guard.cpp
|
$$PWD/guard.cpp \
|
||||||
|
$$PWD/highlightingitemdelegate.cpp
|
||||||
|
|
||||||
win32:SOURCES += $$PWD/consoleprocess_win.cpp
|
win32:SOURCES += $$PWD/consoleprocess_win.cpp
|
||||||
else:SOURCES += $$PWD/consoleprocess_unix.cpp
|
else:SOURCES += $$PWD/consoleprocess_unix.cpp
|
||||||
@@ -239,8 +240,9 @@ HEADERS += \
|
|||||||
$$PWD/asconst.h \
|
$$PWD/asconst.h \
|
||||||
$$PWD/smallstringfwd.h \
|
$$PWD/smallstringfwd.h \
|
||||||
$$PWD/optional.h \
|
$$PWD/optional.h \
|
||||||
|
$$PWD/../3rdparty/optional/optional.hpp \
|
||||||
$$PWD/qtcfallthrough.h \
|
$$PWD/qtcfallthrough.h \
|
||||||
$$PWD/../3rdparty/optional/optional.hpp
|
$$PWD/highlightingitemdelegate.cpp
|
||||||
|
|
||||||
FORMS += $$PWD/filewizardpage.ui \
|
FORMS += $$PWD/filewizardpage.ui \
|
||||||
$$PWD/projectintropage.ui \
|
$$PWD/projectintropage.ui \
|
||||||
|
@@ -117,6 +117,8 @@ Project {
|
|||||||
"functiontraits.h",
|
"functiontraits.h",
|
||||||
"guard.cpp",
|
"guard.cpp",
|
||||||
"guard.h",
|
"guard.h",
|
||||||
|
"highlightingitemdelegate.cpp",
|
||||||
|
"highlightingitemdelegate.h",
|
||||||
"historycompleter.cpp",
|
"historycompleter.cpp",
|
||||||
"historycompleter.h",
|
"historycompleter.h",
|
||||||
"hostosinfo.h",
|
"hostosinfo.h",
|
||||||
|
@@ -41,7 +41,6 @@ HEADERS += \
|
|||||||
androidsignaloperation.h \
|
androidsignaloperation.h \
|
||||||
javaeditor.h \
|
javaeditor.h \
|
||||||
javaindenter.h \
|
javaindenter.h \
|
||||||
javacompletionassistprovider.h \
|
|
||||||
avddialog.h \
|
avddialog.h \
|
||||||
android_global.h \
|
android_global.h \
|
||||||
androidbuildapkstep.h \
|
androidbuildapkstep.h \
|
||||||
@@ -86,7 +85,6 @@ SOURCES += \
|
|||||||
androidsignaloperation.cpp \
|
androidsignaloperation.cpp \
|
||||||
javaeditor.cpp \
|
javaeditor.cpp \
|
||||||
javaindenter.cpp \
|
javaindenter.cpp \
|
||||||
javacompletionassistprovider.cpp \
|
|
||||||
avddialog.cpp \
|
avddialog.cpp \
|
||||||
androidbuildapkstep.cpp \
|
androidbuildapkstep.cpp \
|
||||||
androidbuildapkwidget.cpp \
|
androidbuildapkwidget.cpp \
|
||||||
|
@@ -107,8 +107,6 @@ Project {
|
|||||||
"avddialog.h",
|
"avddialog.h",
|
||||||
"certificatesmodel.cpp",
|
"certificatesmodel.cpp",
|
||||||
"certificatesmodel.h",
|
"certificatesmodel.h",
|
||||||
"javacompletionassistprovider.cpp",
|
|
||||||
"javacompletionassistprovider.h",
|
|
||||||
"javaeditor.cpp",
|
"javaeditor.cpp",
|
||||||
"javaeditor.h",
|
"javaeditor.h",
|
||||||
"javaindenter.cpp",
|
"javaindenter.cpp",
|
||||||
|
@@ -42,7 +42,6 @@
|
|||||||
#include "androidruncontrol.h"
|
#include "androidruncontrol.h"
|
||||||
#include "androidsettingspage.h"
|
#include "androidsettingspage.h"
|
||||||
#include "androidtoolchain.h"
|
#include "androidtoolchain.h"
|
||||||
#include "javacompletionassistprovider.h"
|
|
||||||
#include "javaeditor.h"
|
#include "javaeditor.h"
|
||||||
|
|
||||||
#ifdef HAVE_QBS
|
#ifdef HAVE_QBS
|
||||||
|
@@ -78,7 +78,7 @@
|
|||||||
<item row="2" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Conflicting "am start" options might result in the app startup failure.</string>
|
<string>If the "am start" options conflict, the application might not start.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@@ -1,113 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "javacompletionassistprovider.h"
|
|
||||||
#include "androidconstants.h"
|
|
||||||
|
|
||||||
#include <texteditor/codeassist/assistinterface.h>
|
|
||||||
#include <texteditor/codeassist/keywordscompletionassist.h>
|
|
||||||
#include <coreplugin/id.h>
|
|
||||||
|
|
||||||
using namespace Android;
|
|
||||||
using namespace Android::Internal;
|
|
||||||
|
|
||||||
static const char *const keywords[] = {
|
|
||||||
"abstract",
|
|
||||||
"continue",
|
|
||||||
"for",
|
|
||||||
"new",
|
|
||||||
"switch",
|
|
||||||
"assert",
|
|
||||||
"default",
|
|
||||||
"goto",
|
|
||||||
"package",
|
|
||||||
"synchronized",
|
|
||||||
"boolean",
|
|
||||||
"do",
|
|
||||||
"if",
|
|
||||||
"private",
|
|
||||||
"this",
|
|
||||||
"break",
|
|
||||||
"double",
|
|
||||||
"implements",
|
|
||||||
"protected",
|
|
||||||
"throw",
|
|
||||||
"byte",
|
|
||||||
"else",
|
|
||||||
"import",
|
|
||||||
"public",
|
|
||||||
"throws",
|
|
||||||
"case",
|
|
||||||
"enum",
|
|
||||||
"instanceof",
|
|
||||||
"return",
|
|
||||||
"transient",
|
|
||||||
"catch",
|
|
||||||
"extends",
|
|
||||||
"int",
|
|
||||||
"short",
|
|
||||||
"try",
|
|
||||||
"char",
|
|
||||||
"final",
|
|
||||||
"interface",
|
|
||||||
"static",
|
|
||||||
"void",
|
|
||||||
"class",
|
|
||||||
"finally",
|
|
||||||
"long",
|
|
||||||
"strictfp",
|
|
||||||
"volatile",
|
|
||||||
"const",
|
|
||||||
"float",
|
|
||||||
"native",
|
|
||||||
"super",
|
|
||||||
"while",
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
JavaCompletionAssistProvider::JavaCompletionAssistProvider()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
JavaCompletionAssistProvider::~JavaCompletionAssistProvider()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void JavaCompletionAssistProvider::init() const
|
|
||||||
{
|
|
||||||
for (uint i = 0; i < sizeof keywords / sizeof keywords[0] - 1; i++)
|
|
||||||
m_keywords.append(QLatin1String(keywords[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
TextEditor::IAssistProcessor *JavaCompletionAssistProvider::createProcessor() const
|
|
||||||
{
|
|
||||||
if (m_keywords.isEmpty())
|
|
||||||
init();
|
|
||||||
TextEditor::Keywords keywords = TextEditor::Keywords(m_keywords,
|
|
||||||
QStringList(),
|
|
||||||
QMap<QString, QStringList>());
|
|
||||||
return new TextEditor::KeywordsCompletionAssistProcessor(keywords);
|
|
||||||
}
|
|
@@ -26,8 +26,8 @@
|
|||||||
#include "javaeditor.h"
|
#include "javaeditor.h"
|
||||||
#include "javaindenter.h"
|
#include "javaindenter.h"
|
||||||
#include "androidconstants.h"
|
#include "androidconstants.h"
|
||||||
#include "javacompletionassistprovider.h"
|
|
||||||
|
|
||||||
|
#include <texteditor/codeassist/keywordscompletionassist.h>
|
||||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||||
#include <texteditor/normalindenter.h>
|
#include <texteditor/normalindenter.h>
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
@@ -59,6 +59,14 @@ static TextEditor::TextDocument *createJavaDocument()
|
|||||||
|
|
||||||
JavaEditorFactory::JavaEditorFactory()
|
JavaEditorFactory::JavaEditorFactory()
|
||||||
{
|
{
|
||||||
|
static QStringList keywords = {
|
||||||
|
"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const",
|
||||||
|
"continue", "default", "do", "double", "else", "enum", "extends", "final", "finally",
|
||||||
|
"float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface",
|
||||||
|
"long", "native", "new", "package", "private", "protected", "public", "return", "short",
|
||||||
|
"static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws",
|
||||||
|
"transient", "try", "void", "volatile", "while"
|
||||||
|
};
|
||||||
setId(Constants::JAVA_EDITOR_ID);
|
setId(Constants::JAVA_EDITOR_ID);
|
||||||
setDisplayName(tr("Java Editor"));
|
setDisplayName(tr("Java Editor"));
|
||||||
addMimeType(Constants::JAVA_MIMETYPE);
|
addMimeType(Constants::JAVA_MIMETYPE);
|
||||||
@@ -67,8 +75,8 @@ JavaEditorFactory::JavaEditorFactory()
|
|||||||
setUseGenericHighlighter(true);
|
setUseGenericHighlighter(true);
|
||||||
setCommentDefinition(Utils::CommentDefinition::CppStyle);
|
setCommentDefinition(Utils::CommentDefinition::CppStyle);
|
||||||
setEditorActionHandlers(TextEditor::TextEditorActionHandler::UnCommentSelection);
|
setEditorActionHandlers(TextEditor::TextEditorActionHandler::UnCommentSelection);
|
||||||
setCompletionAssistProvider(new JavaCompletionAssistProvider);
|
|
||||||
setMarksVisible(true);
|
setMarksVisible(true);
|
||||||
|
setCompletionAssistProvider(new TextEditor::KeywordsCompletionAssistProvider(keywords));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -47,6 +47,7 @@
|
|||||||
#include <cpptools/editordocumenthandle.h>
|
#include <cpptools/editordocumenthandle.h>
|
||||||
|
|
||||||
#include <texteditor/convenience.h>
|
#include <texteditor/convenience.h>
|
||||||
|
#include <texteditor/displaysettings.h>
|
||||||
#include <texteditor/fontsettings.h>
|
#include <texteditor/fontsettings.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
@@ -274,6 +275,9 @@ void ClangEditorDocumentProcessor::addDiagnosticToolTipToLayout(uint line,
|
|||||||
= m_diagnosticManager.diagnosticsAt(line, column);
|
= m_diagnosticManager.diagnosticsAt(line, column);
|
||||||
|
|
||||||
target->addWidget(ClangDiagnosticWidget::create(diagnostics, ClangDiagnosticWidget::ToolTip));
|
target->addWidget(ClangDiagnosticWidget::create(diagnostics, ClangDiagnosticWidget::ToolTip));
|
||||||
|
auto link = TextEditor::DisplaySettings::createAnnotationSettingsLink();
|
||||||
|
target->addWidget(link);
|
||||||
|
target->setAlignment(link, Qt::AlignRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangEditorDocumentProcessor::editorDocumentTimerRestarted()
|
void ClangEditorDocumentProcessor::editorDocumentTimerRestarted()
|
||||||
|
@@ -39,7 +39,7 @@ VersionSelector::VersionSelector(const QString &fileName, const QString &message
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->headerLabel->setText(ui->headerLabel->text().arg(fileName));
|
ui->headerLabel->setText(ui->headerLabel->text().arg(fileName));
|
||||||
ui->loadedText->setHtml(tr("<html><head/><body><p><b>NOTE: You will not be able to check in "
|
ui->loadedText->setHtml(tr("<html><head/><body><p><b>Note: You will not be able to check in "
|
||||||
"this file without merging the changes (not supported by the "
|
"this file without merging the changes (not supported by the "
|
||||||
"plugin)</b></p></body></html>"));
|
"plugin)</b></p></body></html>"));
|
||||||
m_stream = new QTextStream(message.toLocal8Bit(), QIODevice::ReadOnly | QIODevice::Text);
|
m_stream = new QTextStream(message.toLocal8Bit(), QIODevice::ReadOnly | QIODevice::Text);
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="headerLabel">
|
<widget class="QLabel" name="headerLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>There are multiple versions of '%1' which can be considered for checkout. Please select version to checkout:</string>
|
<string>Multiple versions of "%1" can be checked out. Select the version to check out:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QRadioButton" name="loadedRadioButton">
|
<widget class="QRadioButton" name="loadedRadioButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Loaded Version</string>
|
<string>&Loaded version</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@@ -132,7 +132,7 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
const QJsonObject metaData = plugin->metaData();
|
const QJsonObject metaData = plugin->metaData();
|
||||||
const QJsonValue mimetypes = metaData.value("Mimetypes");
|
const QJsonValue mimetypes = metaData.value("Mimetypes");
|
||||||
QString mimetypeString;
|
QString mimetypeString;
|
||||||
if (ExtensionSystem::PluginSpec::readMultiLineString(mimetypes, &mimetypeString))
|
if (Utils::readMultiLineString(mimetypes, &mimetypeString))
|
||||||
Utils::addMimeTypes(plugin->name() + ".mimetypes", mimetypeString.trimmed().toUtf8());
|
Utils::addMimeTypes(plugin->name() + ".mimetypes", mimetypeString.trimmed().toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,12 +79,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent)
|
||||||
m_count(0),
|
|
||||||
m_preserveCaseSupported(true),
|
|
||||||
m_isShowingReplaceUI(false),
|
|
||||||
m_searchAgainSupported(false),
|
|
||||||
m_replaceSupported(false)
|
|
||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
@@ -295,8 +290,6 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int SearchResultWidget::count() const
|
int SearchResultWidget::count() const
|
||||||
{
|
{
|
||||||
return m_count;
|
return m_count;
|
||||||
@@ -309,7 +302,6 @@ void SearchResultWidget::setSupportsReplace(bool replaceSupported, const QString
|
|||||||
m_dontAskAgainGroup = group;
|
m_dontAskAgainGroup = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SearchResultWidget::setTextToReplace(const QString &textToReplace)
|
void SearchResultWidget::setTextToReplace(const QString &textToReplace)
|
||||||
{
|
{
|
||||||
m_replaceTextEdit->setText(textToReplace);
|
m_replaceTextEdit->setText(textToReplace);
|
||||||
|
@@ -119,28 +119,28 @@ private:
|
|||||||
QList<SearchResultItem> checkedItems() const;
|
QList<SearchResultItem> checkedItems() const;
|
||||||
void updateMatchesFoundLabel();
|
void updateMatchesFoundLabel();
|
||||||
|
|
||||||
SearchResultTreeView *m_searchResultTreeView;
|
SearchResultTreeView *m_searchResultTreeView = nullptr;
|
||||||
int m_count;
|
int m_count = 0;
|
||||||
QString m_dontAskAgainGroup;
|
QString m_dontAskAgainGroup;
|
||||||
QFrame *m_messageWidget;
|
QFrame *m_messageWidget = nullptr;
|
||||||
InfoBar m_infoBar;
|
InfoBar m_infoBar;
|
||||||
InfoBarDisplay m_infoBarDisplay;
|
InfoBarDisplay m_infoBarDisplay;
|
||||||
QWidget *m_topReplaceWidget;
|
QWidget *m_topReplaceWidget = nullptr;
|
||||||
QLabel *m_replaceLabel;
|
QLabel *m_replaceLabel = nullptr;
|
||||||
QLineEdit *m_replaceTextEdit;
|
QLineEdit *m_replaceTextEdit = nullptr;
|
||||||
QToolButton *m_replaceButton;
|
QToolButton *m_replaceButton = nullptr;
|
||||||
QToolButton *m_searchAgainButton;
|
QToolButton *m_searchAgainButton = nullptr;
|
||||||
QCheckBox *m_preserveCaseCheck;
|
QCheckBox *m_preserveCaseCheck = nullptr;
|
||||||
QCheckBox *m_renameFilesCheckBox = nullptr;
|
QCheckBox *m_renameFilesCheckBox = nullptr;
|
||||||
QWidget *m_descriptionContainer;
|
QWidget *m_descriptionContainer = nullptr;
|
||||||
QLabel *m_label;
|
QLabel *m_label = nullptr;
|
||||||
QLabel *m_searchTerm;
|
QLabel *m_searchTerm = nullptr;
|
||||||
QToolButton *m_cancelButton;
|
QToolButton *m_cancelButton = nullptr;
|
||||||
QLabel *m_matchesFoundLabel;
|
QLabel *m_matchesFoundLabel = nullptr;
|
||||||
bool m_preserveCaseSupported;
|
bool m_preserveCaseSupported = true;
|
||||||
bool m_isShowingReplaceUI;
|
bool m_isShowingReplaceUI = false;
|
||||||
bool m_searchAgainSupported;
|
bool m_searchAgainSupported = false;
|
||||||
bool m_replaceSupported;
|
bool m_replaceSupported = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
@@ -33,14 +33,13 @@
|
|||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <coreplugin/find/searchresulttreeitemdelegate.h>
|
|
||||||
#include <coreplugin/find/searchresulttreeitemroles.h>
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <coreplugin/mainwindow.h>
|
#include <coreplugin/mainwindow.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/appmainwindow.h>
|
#include <utils/appmainwindow.h>
|
||||||
#include <utils/asconst.h>
|
#include <utils/asconst.h>
|
||||||
#include <utils/fancylineedit.h>
|
#include <utils/fancylineedit.h>
|
||||||
|
#include <utils/highlightingitemdelegate.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/itemviews.h>
|
#include <utils/itemviews.h>
|
||||||
#include <utils/progressindicator.h>
|
#include <utils/progressindicator.h>
|
||||||
@@ -67,6 +66,10 @@
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(Core::LocatorFilterEntry)
|
Q_DECLARE_METATYPE(Core::LocatorFilterEntry)
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
|
const int LocatorEntryRole = int(HighlightingItemRole::User);
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -99,7 +102,7 @@ private:
|
|||||||
QColor mBackgroundColor;
|
QColor mBackgroundColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CompletionDelegate : public SearchResultTreeItemDelegate
|
class CompletionDelegate : public HighlightingItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompletionDelegate(QObject *parent);
|
CompletionDelegate(QObject *parent);
|
||||||
@@ -193,7 +196,6 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const
|
|||||||
+ QLatin1String("\n\n") + mEntries.at(index.row()).extraInfo);
|
+ QLatin1String("\n\n") + mEntries.at(index.row()).extraInfo);
|
||||||
break;
|
break;
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
case ItemDataRoles::ResultIconRole:
|
|
||||||
if (index.column() == DisplayNameColumn) {
|
if (index.column() == DisplayNameColumn) {
|
||||||
LocatorFilterEntry &entry = mEntries[index.row()];
|
LocatorFilterEntry &entry = mEntries[index.row()];
|
||||||
if (!entry.displayIcon && !entry.fileName.isEmpty())
|
if (!entry.displayIcon && !entry.fileName.isEmpty())
|
||||||
@@ -205,21 +207,21 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const
|
|||||||
if (index.column() == ExtraInfoColumn)
|
if (index.column() == ExtraInfoColumn)
|
||||||
return QColor(Qt::darkGray);
|
return QColor(Qt::darkGray);
|
||||||
break;
|
break;
|
||||||
case ItemDataRoles::ResultItemRole:
|
case LocatorEntryRole:
|
||||||
return qVariantFromValue(mEntries.at(index.row()));
|
return qVariantFromValue(mEntries.at(index.row()));
|
||||||
case ItemDataRoles::ResultBeginColumnNumberRole:
|
case int(HighlightingItemRole::StartColumn):
|
||||||
case ItemDataRoles::SearchTermLengthRole: {
|
case int(HighlightingItemRole::Length): {
|
||||||
LocatorFilterEntry &entry = mEntries[index.row()];
|
LocatorFilterEntry &entry = mEntries[index.row()];
|
||||||
const int highlightColumn = entry.highlightInfo.dataType == LocatorFilterEntry::HighlightInfo::DisplayName
|
const int highlightColumn = entry.highlightInfo.dataType == LocatorFilterEntry::HighlightInfo::DisplayName
|
||||||
? DisplayNameColumn
|
? DisplayNameColumn
|
||||||
: ExtraInfoColumn;
|
: ExtraInfoColumn;
|
||||||
if (highlightColumn == index.column()) {
|
if (highlightColumn == index.column()) {
|
||||||
const bool startIndexRole = role == ItemDataRoles::ResultBeginColumnNumberRole;
|
const bool startIndexRole = role == int(HighlightingItemRole::StartColumn);
|
||||||
return startIndexRole ? entry.highlightInfo.startIndex : entry.highlightInfo.length;
|
return startIndexRole ? entry.highlightInfo.startIndex : entry.highlightInfo.length;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ItemDataRoles::ResultHighlightBackgroundColor:
|
case int(HighlightingItemRole::Background):
|
||||||
return mBackgroundColor;
|
return mBackgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,7 +845,7 @@ void LocatorWidget::acceptEntry(int row)
|
|||||||
const QModelIndex index = m_locatorModel->index(row, 0);
|
const QModelIndex index = m_locatorModel->index(row, 0);
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
const LocatorFilterEntry entry = m_locatorModel->data(index, ItemDataRoles::ResultItemRole).value<LocatorFilterEntry>();
|
const LocatorFilterEntry entry = m_locatorModel->data(index, LocatorEntryRole).value<LocatorFilterEntry>();
|
||||||
Q_ASSERT(entry.filter != nullptr);
|
Q_ASSERT(entry.filter != nullptr);
|
||||||
QString newText;
|
QString newText;
|
||||||
int selectionStart = -1;
|
int selectionStart = -1;
|
||||||
@@ -926,13 +928,13 @@ LocatorPopup *createLocatorPopup(Locator *locator, QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompletionDelegate::CompletionDelegate(QObject *parent)
|
CompletionDelegate::CompletionDelegate(QObject *parent)
|
||||||
: SearchResultTreeItemDelegate(0, parent)
|
: HighlightingItemDelegate(0, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize CompletionDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QSize CompletionDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
return SearchResultTreeItemDelegate::sizeHint(option, index) + QSize(0, 2);
|
return HighlightingItemDelegate::sizeHint(option, index) + QSize(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -312,6 +312,15 @@ void NavigationWidget::resizeEvent(QResizeEvent *re)
|
|||||||
MiniSplitter::resizeEvent(re);
|
MiniSplitter::resizeEvent(re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QIcon closeIconForSide(Side side, int itemCount)
|
||||||
|
{
|
||||||
|
if (itemCount > 1)
|
||||||
|
return Utils::Icons::CLOSE_SPLIT_TOP.icon();
|
||||||
|
return side == Side::Left
|
||||||
|
? Utils::Icons::CLOSE_SPLIT_LEFT.icon()
|
||||||
|
: Utils::Icons::CLOSE_SPLIT_RIGHT.icon();
|
||||||
|
}
|
||||||
|
|
||||||
Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int factoryIndex)
|
Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int factoryIndex)
|
||||||
{
|
{
|
||||||
for (int pos = position + 1; pos < d->m_subWidgets.size(); ++pos) {
|
for (int pos = position + 1; pos < d->m_subWidgets.size(); ++pos) {
|
||||||
@@ -331,9 +340,7 @@ Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position, int
|
|||||||
insertWidget(position, nsw);
|
insertWidget(position, nsw);
|
||||||
|
|
||||||
d->m_subWidgets.insert(position, nsw);
|
d->m_subWidgets.insert(position, nsw);
|
||||||
d->m_subWidgets.at(0)->setCloseIcon(d->m_subWidgets.size() == 1
|
d->m_subWidgets.at(0)->setCloseIcon(closeIconForSide(d->m_side, d->m_subWidgets.size()));
|
||||||
? Utils::Icons::CLOSE_SPLIT_LEFT.icon()
|
|
||||||
: Utils::Icons::CLOSE_SPLIT_TOP.icon());
|
|
||||||
NavigationWidgetPrivate::updateActivationsMap(nsw->factory()->id(), {d->m_side, position});
|
NavigationWidgetPrivate::updateActivationsMap(nsw->factory()->id(), {d->m_side, position});
|
||||||
return nsw;
|
return nsw;
|
||||||
}
|
}
|
||||||
@@ -386,10 +393,8 @@ void NavigationWidget::closeSubWidget()
|
|||||||
subWidget->hide();
|
subWidget->hide();
|
||||||
subWidget->deleteLater();
|
subWidget->deleteLater();
|
||||||
// update close button of top item
|
// update close button of top item
|
||||||
if (d->m_subWidgets.size() == 1)
|
if (!d->m_subWidgets.isEmpty())
|
||||||
d->m_subWidgets.at(0)->setCloseIcon(d->m_subWidgets.size() == 1
|
d->m_subWidgets.at(0)->setCloseIcon(closeIconForSide(d->m_side, d->m_subWidgets.size()));
|
||||||
? Utils::Icons::CLOSE_SPLIT_LEFT.icon()
|
|
||||||
: Utils::Icons::CLOSE_SPLIT_TOP.icon());
|
|
||||||
} else {
|
} else {
|
||||||
setShown(false);
|
setShown(false);
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "cppfindreferences.h"
|
#include "cppfindreferences.h"
|
||||||
|
|
||||||
|
#include "cppfilesettingspage.h"
|
||||||
#include "cpptoolsconstants.h"
|
#include "cpptoolsconstants.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
#include "cppworkingcopy.h"
|
#include "cppworkingcopy.h"
|
||||||
@@ -384,6 +385,11 @@ void CppFindReferences::findAll_helper(SearchResult *search, Symbol *symbol,
|
|||||||
connect(progress, &FutureProgress::clicked, search, &SearchResult::popup);
|
connect(progress, &FutureProgress::clicked, search, &SearchResult::popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isAllLowerCase(const QString &text)
|
||||||
|
{
|
||||||
|
return text.toLower() == text;
|
||||||
|
}
|
||||||
|
|
||||||
void CppFindReferences::onReplaceButtonClicked(const QString &text,
|
void CppFindReferences::onReplaceButtonClicked(const QString &text,
|
||||||
const QList<SearchResultItem> &items,
|
const QList<SearchResultItem> &items,
|
||||||
bool preserveCase)
|
bool preserveCase)
|
||||||
@@ -405,21 +411,40 @@ void CppFindReferences::onReplaceButtonClicked(const QString &text,
|
|||||||
if (!renameFilesCheckBox || !renameFilesCheckBox->isChecked())
|
if (!renameFilesCheckBox || !renameFilesCheckBox->isChecked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CppFileSettings settings;
|
||||||
|
settings.fromSettings(Core::ICore::settings());
|
||||||
|
|
||||||
const QStringList newPaths =
|
const QStringList newPaths =
|
||||||
Utils::transform<QList>(parameters.filesToRename,
|
Utils::transform<QList>(parameters.filesToRename,
|
||||||
[¶meters, text](const Node *node) -> QString {
|
[¶meters, text, &settings](const Node *node) -> QString {
|
||||||
const QFileInfo fi = node->filePath().toFileInfo();
|
const QFileInfo fi = node->filePath().toFileInfo();
|
||||||
const QString fileName = fi.fileName();
|
const QString oldSymbolName = parameters.prettySymbolName;
|
||||||
QString newName = fileName;
|
const QString oldBaseName = fi.baseName();
|
||||||
newName.replace(parameters.prettySymbolName, text, Qt::CaseInsensitive);
|
const QString newSymbolName = text;
|
||||||
|
QString newBaseName = newSymbolName;
|
||||||
|
|
||||||
if (newName != fileName) {
|
// 1) new symbol lowercase: new base name lowercase
|
||||||
newName = Utils::matchCaseReplacement(fileName, newName);
|
if (isAllLowerCase(newSymbolName)) {
|
||||||
|
newBaseName = newSymbolName;
|
||||||
|
|
||||||
return fi.absolutePath() + "/" + newName;
|
// 2) old base name mixed case: new base name is verbatim symbol name
|
||||||
|
} else if (!isAllLowerCase(oldBaseName)) {
|
||||||
|
newBaseName = newSymbolName;
|
||||||
|
|
||||||
|
// 3) old base name lowercase, old symbol mixed case: new base name lowercase
|
||||||
|
} else if (!isAllLowerCase(oldSymbolName)) {
|
||||||
|
newBaseName = newSymbolName.toLower();
|
||||||
|
|
||||||
|
// 4) old base name lowercase, old symbol lowercase, new symbol mixed case:
|
||||||
|
// use the preferences setting for new base name case
|
||||||
|
} else if (settings.lowerCaseFiles) {
|
||||||
|
newBaseName = newSymbolName.toLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newBaseName == oldBaseName)
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
|
return fi.absolutePath() + "/" + newBaseName + '.' + fi.completeSuffix();
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 0; i < parameters.filesToRename.size(); ++i) {
|
for (int i = 0; i < parameters.filesToRename.size(); ++i) {
|
||||||
|
@@ -2030,7 +2030,11 @@ void DebuggerEngine::checkState(DebuggerState state, const char *file, int line)
|
|||||||
|
|
||||||
bool DebuggerEngine::isNativeMixedEnabled() const
|
bool DebuggerEngine::isNativeMixedEnabled() const
|
||||||
{
|
{
|
||||||
return runParameters().nativeMixedEnabled && (runParameters().languages & QmlLanguage);
|
if (DebuggerRunTool *rt = runTool()) {
|
||||||
|
const DebuggerRunParameters &runParams = rt->runParameters();
|
||||||
|
return runParams.nativeMixedEnabled && (runParams.languages & QmlLanguage);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerEngine::isNativeMixedActive() const
|
bool DebuggerEngine::isNativeMixedActive() const
|
||||||
|
@@ -4034,7 +4034,10 @@ void GdbEngine::reloadDebuggingHelpers()
|
|||||||
|
|
||||||
void GdbEngine::handleGdbError(QProcess::ProcessError error)
|
void GdbEngine::handleGdbError(QProcess::ProcessError error)
|
||||||
{
|
{
|
||||||
QString program = runParameters().debugger.executable;
|
QString program;
|
||||||
|
// avoid accessing invalid memory if the process crashed
|
||||||
|
if (runTool())
|
||||||
|
program = runParameters().debugger.executable;
|
||||||
QString msg = RunWorker::userMessageForProcessError(error, program);
|
QString msg = RunWorker::userMessageForProcessError(error, program);
|
||||||
QString errorString = m_gdbProc.errorString();
|
QString errorString = m_gdbProc.errorString();
|
||||||
if (!errorString.isEmpty())
|
if (!errorString.isEmpty())
|
||||||
|
@@ -1065,7 +1065,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
|||||||
if (files.isEmpty()) {
|
if (files.isEmpty()) {
|
||||||
msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
|
msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
|
||||||
} else {
|
} else {
|
||||||
msgCannotRun(tr("Cannot reset %n file(s) in \"%1\": %2", 0, files.size())
|
msgCannotRun(tr("Cannot reset %n files in \"%1\": %2", 0, files.size())
|
||||||
.arg(QDir::toNativeSeparators(workingDirectory), resp.stdErr()),
|
.arg(QDir::toNativeSeparators(workingDirectory), resp.stdErr()),
|
||||||
errorMessage);
|
errorMessage);
|
||||||
}
|
}
|
||||||
@@ -2468,9 +2468,9 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
|||||||
static inline QString msgCommitted(const QString &amendSHA1, int fileCount)
|
static inline QString msgCommitted(const QString &amendSHA1, int fileCount)
|
||||||
{
|
{
|
||||||
if (amendSHA1.isEmpty())
|
if (amendSHA1.isEmpty())
|
||||||
return GitClient::tr("Committed %n file(s).", 0, fileCount) + '\n';
|
return GitClient::tr("Committed %n files.", 0, fileCount) + '\n';
|
||||||
if (fileCount)
|
if (fileCount)
|
||||||
return GitClient::tr("Amended \"%1\" (%n file(s)).", 0, fileCount).arg(amendSHA1) + '\n';
|
return GitClient::tr("Amended \"%1\" (%n files).", 0, fileCount).arg(amendSHA1) + '\n';
|
||||||
return GitClient::tr("Amended \"%1\".").arg(amendSHA1);
|
return GitClient::tr("Amended \"%1\".").arg(amendSHA1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2561,7 +2561,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
|||||||
VcsOutputWindow::appendError(stdErr);
|
VcsOutputWindow::appendError(stdErr);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
VcsOutputWindow::appendError(tr("Cannot commit %n file(s): %1\n", 0, commitCount).arg(stdErr));
|
VcsOutputWindow::appendError(tr("Cannot commit %n files: %1\n", 0, commitCount).arg(stdErr));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -716,9 +716,11 @@ void GitPlugin::blameFile()
|
|||||||
cursor.setPosition(selectionStart);
|
cursor.setPosition(selectionStart);
|
||||||
const int startBlock = cursor.blockNumber();
|
const int startBlock = cursor.blockNumber();
|
||||||
cursor.setPosition(selectionEnd);
|
cursor.setPosition(selectionEnd);
|
||||||
const int endBlock = cursor.blockNumber();
|
int endBlock = cursor.blockNumber();
|
||||||
if (startBlock != endBlock) {
|
if (startBlock != endBlock) {
|
||||||
firstLine = startBlock + 1;
|
firstLine = startBlock + 1;
|
||||||
|
if (cursor.atBlockStart())
|
||||||
|
--endBlock;
|
||||||
if (auto widget = qobject_cast<VcsBaseEditorWidget *>(textEditor->widget())) {
|
if (auto widget = qobject_cast<VcsBaseEditorWidget *>(textEditor->widget())) {
|
||||||
const int previousFirstLine = widget->firstLineNumber();
|
const int previousFirstLine = widget->firstLineNumber();
|
||||||
if (previousFirstLine > 0)
|
if (previousFirstLine > 0)
|
||||||
|
@@ -145,10 +145,6 @@ void HelpIndexFilter::accept(LocatorFilterEntry selection,
|
|||||||
Q_UNUSED(selectionLength)
|
Q_UNUSED(selectionLength)
|
||||||
const QString &key = selection.displayName;
|
const QString &key = selection.displayName;
|
||||||
const QMap<QString, QUrl> &links = HelpManager::linksForKeyword(key);
|
const QMap<QString, QUrl> &links = HelpManager::linksForKeyword(key);
|
||||||
|
|
||||||
if (links.size() == 1)
|
|
||||||
emit linkActivated(links.begin().value());
|
|
||||||
else
|
|
||||||
emit linksActivated(links, key);
|
emit linksActivated(links, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,7 +52,6 @@ public:
|
|||||||
Q_INVOKABLE QSet<QString> searchMatches(const QString &databaseFilePath,
|
Q_INVOKABLE QSet<QString> searchMatches(const QString &databaseFilePath,
|
||||||
const QString &term, int limit);
|
const QString &term, int limit);
|
||||||
signals:
|
signals:
|
||||||
void linkActivated(const QUrl &link) const;
|
|
||||||
void linksActivated(const QMap<QString, QUrl> &links, const QString &key) const;
|
void linksActivated(const QMap<QString, QUrl> &links, const QString &key) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -236,10 +236,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
|
|
||||||
auto helpIndexFilter = new HelpIndexFilter();
|
auto helpIndexFilter = new HelpIndexFilter();
|
||||||
addAutoReleasedObject(helpIndexFilter);
|
addAutoReleasedObject(helpIndexFilter);
|
||||||
connect(helpIndexFilter, &HelpIndexFilter::linkActivated,
|
|
||||||
this, &HelpPlugin::showLinkInHelpMode);
|
|
||||||
connect(helpIndexFilter, &HelpIndexFilter::linksActivated,
|
connect(helpIndexFilter, &HelpIndexFilter::linksActivated,
|
||||||
this, &HelpPlugin::showLinksInHelpMode);
|
this, &HelpPlugin::showLinksInCurrentViewer);
|
||||||
|
|
||||||
RemoteHelpFilter *remoteHelpFilter = new RemoteHelpFilter();
|
RemoteHelpFilter *remoteHelpFilter = new RemoteHelpFilter();
|
||||||
addAutoReleasedObject(remoteHelpFilter);
|
addAutoReleasedObject(remoteHelpFilter);
|
||||||
@@ -430,11 +428,12 @@ void HelpPlugin::showLinkInHelpMode(const QUrl &source)
|
|||||||
showInHelpViewer(source, helpModeHelpViewer());
|
showInHelpViewer(source, helpModeHelpViewer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::showLinksInHelpMode(const QMap<QString, QUrl> &links, const QString &key)
|
void HelpPlugin::showLinksInCurrentViewer(const QMap<QString, QUrl> &links, const QString &key)
|
||||||
{
|
{
|
||||||
activateHelpMode();
|
if (links.size() < 1)
|
||||||
ICore::raiseWindow(m_mode->widget());
|
return;
|
||||||
m_centralWidget->showTopicChooser(links, key);
|
HelpWidget *widget = helpWidgetForWindow(QApplication::activeWindow());
|
||||||
|
widget->showLinks(links, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::slotHideRightPane()
|
void HelpPlugin::slotHideRightPane()
|
||||||
@@ -499,6 +498,14 @@ HelpViewer *HelpPlugin::helpModeHelpViewer()
|
|||||||
return viewer;
|
return viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HelpWidget *HelpPlugin::helpWidgetForWindow(QWidget *window)
|
||||||
|
{
|
||||||
|
if (m_externalWindow && m_externalWindow->window() == window->window())
|
||||||
|
return m_externalWindow;
|
||||||
|
activateHelpMode();
|
||||||
|
return m_centralWidget;
|
||||||
|
}
|
||||||
|
|
||||||
HelpViewer *HelpPlugin::viewerForHelpViewerLocation(HelpManager::HelpViewerLocation location)
|
HelpViewer *HelpPlugin::viewerForHelpViewerLocation(HelpManager::HelpViewerLocation location)
|
||||||
{
|
{
|
||||||
HelpManager::HelpViewerLocation actualLocation = location;
|
HelpManager::HelpViewerLocation actualLocation = location;
|
||||||
|
@@ -89,7 +89,7 @@ private:
|
|||||||
|
|
||||||
void saveExternalWindowSettings();
|
void saveExternalWindowSettings();
|
||||||
void showLinkInHelpMode(const QUrl &source);
|
void showLinkInHelpMode(const QUrl &source);
|
||||||
void showLinksInHelpMode(const QMap<QString, QUrl> &links, const QString &key);
|
void showLinksInCurrentViewer(const QMap<QString, QUrl> &links, const QString &key);
|
||||||
void slotHideRightPane();
|
void slotHideRightPane();
|
||||||
|
|
||||||
void updateSideBarSource(const QUrl &newUrl);
|
void updateSideBarSource(const QUrl &newUrl);
|
||||||
@@ -109,6 +109,7 @@ private:
|
|||||||
void createRightPaneContextViewer();
|
void createRightPaneContextViewer();
|
||||||
HelpViewer *externalHelpViewer();
|
HelpViewer *externalHelpViewer();
|
||||||
HelpViewer *helpModeHelpViewer();
|
HelpViewer *helpModeHelpViewer();
|
||||||
|
HelpWidget *helpWidgetForWindow(QWidget *window);
|
||||||
|
|
||||||
void doSetupIfNeeded();
|
void doSetupIfNeeded();
|
||||||
|
|
||||||
|
@@ -354,10 +354,8 @@ void HelpWidget::addSideBar()
|
|||||||
auto indexItem = new Core::SideBarItem(indexWindow, Constants::HELP_INDEX);
|
auto indexItem = new Core::SideBarItem(indexWindow, Constants::HELP_INDEX);
|
||||||
indexWindow->setOpenInNewPageActionVisible(supportsNewPages);
|
indexWindow->setOpenInNewPageActionVisible(supportsNewPages);
|
||||||
indexWindow->setWindowTitle(HelpPlugin::tr(Constants::SB_INDEX));
|
indexWindow->setWindowTitle(HelpPlugin::tr(Constants::SB_INDEX));
|
||||||
connect(indexWindow, &IndexWindow::linkActivated,
|
|
||||||
this, &HelpWidget::open);
|
|
||||||
connect(indexWindow, &IndexWindow::linksActivated,
|
connect(indexWindow, &IndexWindow::linksActivated,
|
||||||
this, &HelpWidget::showTopicChooser);
|
this, &HelpWidget::showLinks);
|
||||||
m_indexAction = new QAction(HelpPlugin::tr(Constants::SB_INDEX), this);
|
m_indexAction = new QAction(HelpPlugin::tr(Constants::SB_INDEX), this);
|
||||||
cmd = Core::ActionManager::registerAction(m_indexAction, Constants::HELP_INDEX, m_context->context());
|
cmd = Core::ActionManager::registerAction(m_indexAction, Constants::HELP_INDEX, m_context->context());
|
||||||
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I")
|
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+I")
|
||||||
@@ -535,13 +533,19 @@ void HelpWidget::open(const QUrl &url, bool newPage)
|
|||||||
setSource(url);
|
setSource(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpWidget::showTopicChooser(const QMap<QString, QUrl> &links,
|
void HelpWidget::showLinks(const QMap<QString, QUrl> &links,
|
||||||
const QString &keyword, bool newPage)
|
const QString &keyword, bool newPage)
|
||||||
{
|
{
|
||||||
|
if (links.size() < 1)
|
||||||
|
return;
|
||||||
|
if (links.size() == 1) {
|
||||||
|
open(links.first(), newPage);
|
||||||
|
} else {
|
||||||
TopicChooser tc(this, keyword, links);
|
TopicChooser tc(this, keyword, links);
|
||||||
if (tc.exec() == QDialog::Accepted)
|
if (tc.exec() == QDialog::Accepted)
|
||||||
open(tc.link(), newPage);
|
open(tc.link(), newPage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HelpWidget::activateSideBarItem(const QString &id)
|
void HelpWidget::activateSideBarItem(const QString &id)
|
||||||
{
|
{
|
||||||
|
@@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
void open(const QUrl &url, bool newPage = false);
|
void open(const QUrl &url, bool newPage = false);
|
||||||
void openFromSearch(const QUrl &url, const QStringList &searchTerms, bool newPage = false);
|
void openFromSearch(const QUrl &url, const QStringList &searchTerms, bool newPage = false);
|
||||||
void showTopicChooser(const QMap<QString, QUrl> &links, const QString &key,
|
void showLinks(const QMap<QString, QUrl> &links, const QString &key,
|
||||||
bool newPage = false);
|
bool newPage = false);
|
||||||
void activateSideBarItem(const QString &id);
|
void activateSideBarItem(const QString &id);
|
||||||
|
|
||||||
|
@@ -289,7 +289,10 @@ void IosConfigurations::updateAutomaticKitList()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Core::Id pDeviceType = deviceId(sdk.directoryName);
|
Core::Id pDeviceType = deviceId(sdk.directoryName);
|
||||||
QTC_ASSERT(pDeviceType.isValid(), continue);
|
if (!pDeviceType.isValid()) {
|
||||||
|
qCDebug(kitSetupLog) << "Unsupported/Invalid device type" << sdk.directoryName;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (BaseQtVersion *qtVersion : qtVersions) {
|
for (BaseQtVersion *qtVersion : qtVersions) {
|
||||||
qCDebug(kitSetupLog) << " - Qt version:" << qtVersion->displayName();
|
qCDebug(kitSetupLog) << " - Qt version:" << qtVersion->displayName();
|
||||||
|
@@ -218,6 +218,8 @@ void IosSettingsWidget::onRename()
|
|||||||
const SimulatorInfo &simInfo = simulatorInfoList.at(0);
|
const SimulatorInfo &simInfo = simulatorInfoList.at(0);
|
||||||
const QString newName = QInputDialog::getText(this, tr("Rename %1").arg(simInfo.name),
|
const QString newName = QInputDialog::getText(this, tr("Rename %1").arg(simInfo.name),
|
||||||
tr("Enter new name:"));
|
tr("Enter new name:"));
|
||||||
|
if (newName.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
|
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
|
||||||
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
|
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@@ -396,7 +396,7 @@ void IosToolHandlerPrivate::toolExited(int code)
|
|||||||
void IosDeviceToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
|
void IosDeviceToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
|
||||||
{
|
{
|
||||||
if (state != Stopped)
|
if (state != Stopped)
|
||||||
errorMsg(IosToolHandler::tr("iOS tool Error %1").arg(error));
|
errorMsg(IosToolHandler::tr("iOS tool error %1").arg(error));
|
||||||
stop(-1);
|
stop(-1);
|
||||||
if (error == QProcess::FailedToStart) {
|
if (error == QProcess::FailedToStart) {
|
||||||
qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")";
|
qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")";
|
||||||
@@ -837,7 +837,7 @@ void IosSimulatorToolHandlerPrivate::requestTransferApp(const QString &appBundle
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
installAppOnSimulator();
|
installAppOnSimulator();
|
||||||
} else {
|
} else {
|
||||||
errorMsg(IosToolHandler::tr("Application install on Simulator failed. Simulator not running."));
|
errorMsg(IosToolHandler::tr("Application install on simulator failed. Simulator not running."));
|
||||||
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Failure);
|
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Failure);
|
||||||
emit q->finished(q);
|
emit q->finished(q);
|
||||||
}
|
}
|
||||||
@@ -862,7 +862,7 @@ void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &appBundlePath,
|
|||||||
|
|
||||||
Utils::FileName appBundle = Utils::FileName::fromString(m_bundlePath);
|
Utils::FileName appBundle = Utils::FileName::fromString(m_bundlePath);
|
||||||
if (!appBundle.exists()) {
|
if (!appBundle.exists()) {
|
||||||
errorMsg(IosToolHandler::tr("Application launch on Simulator failed. Invalid Bundle path %1")
|
errorMsg(IosToolHandler::tr("Application launch on simulator failed. Invalid bundle path %1")
|
||||||
.arg(m_bundlePath));
|
.arg(m_bundlePath));
|
||||||
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
|
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
|
||||||
return;
|
return;
|
||||||
@@ -874,7 +874,7 @@ void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &appBundlePath,
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
launchAppOnSimulator(extraArgs);
|
launchAppOnSimulator(extraArgs);
|
||||||
} else {
|
} else {
|
||||||
errorMsg(IosToolHandler::tr("Application launch on Simulator failed. Simulator not running."));
|
errorMsg(IosToolHandler::tr("Application launch on simulator failed. Simulator not running."));
|
||||||
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
|
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -926,7 +926,7 @@ void IosSimulatorToolHandlerPrivate::installAppOnSimulator()
|
|||||||
isTransferringApp(m_bundlePath, m_deviceId, 100, 100, "");
|
isTransferringApp(m_bundlePath, m_deviceId, 100, 100, "");
|
||||||
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Success);
|
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Success);
|
||||||
} else {
|
} else {
|
||||||
errorMsg(IosToolHandler::tr("Application install on Simulator failed. %1")
|
errorMsg(IosToolHandler::tr("Application install on simulator failed. %1")
|
||||||
.arg(QString::fromLocal8Bit(response.commandOutput)));
|
.arg(QString::fromLocal8Bit(response.commandOutput)));
|
||||||
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Failure);
|
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Failure);
|
||||||
}
|
}
|
||||||
@@ -990,7 +990,7 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
|
|||||||
stderrFile);
|
stderrFile);
|
||||||
} else {
|
} else {
|
||||||
m_pid = -1;
|
m_pid = -1;
|
||||||
errorMsg(IosToolHandler::tr("Application launch on Simulator failed. %1")
|
errorMsg(IosToolHandler::tr("Application launch on simulator failed. %1")
|
||||||
.arg(QString::fromLocal8Bit(response.commandOutput)));
|
.arg(QString::fromLocal8Bit(response.commandOutput)));
|
||||||
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
|
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
|
||||||
stop(-1);
|
stop(-1);
|
||||||
|
@@ -82,7 +82,7 @@ bool FieldPageFactory::validateData(Core::Id typeId, const QVariant &data, QStri
|
|||||||
QList<QVariant> list = JsonWizardFactory::objectOrList(data, errorMessage);
|
QList<QVariant> list = JsonWizardFactory::objectOrList(data, errorMessage);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
|
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
|
||||||
"When parsing fields of page '%1': %2")
|
"When parsing fields of page \"%1\": %2")
|
||||||
.arg(typeId.toString()).arg(*errorMessage);
|
.arg(typeId.toString()).arg(*errorMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/qtcfallthrough.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
#include <utils/winutils.h>
|
#include <utils/winutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -102,7 +103,7 @@ static bool hostSupportsPlatform(MsvcToolChain::Platform platform)
|
|||||||
if (platform == MsvcToolChain::amd64 || platform == MsvcToolChain::amd64_arm
|
if (platform == MsvcToolChain::amd64 || platform == MsvcToolChain::amd64_arm
|
||||||
|| platform == MsvcToolChain::amd64_x86)
|
|| platform == MsvcToolChain::amd64_x86)
|
||||||
return true;
|
return true;
|
||||||
// fall through (all x86 toolchains are also working on an amd64 host)
|
Q_FALLTHROUGH(); // all x86 toolchains are also working on an amd64 host
|
||||||
case Utils::HostOsInfo::HostArchitectureX86:
|
case Utils::HostOsInfo::HostArchitectureX86:
|
||||||
return platform == MsvcToolChain::x86 || platform == MsvcToolChain::x86_amd64
|
return platform == MsvcToolChain::x86 || platform == MsvcToolChain::x86_amd64
|
||||||
|| platform == MsvcToolChain::x86_ia64 || platform == MsvcToolChain::x86_arm;
|
|| platform == MsvcToolChain::x86_ia64 || platform == MsvcToolChain::x86_arm;
|
||||||
|
@@ -1488,7 +1488,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
});
|
});
|
||||||
|
|
||||||
expander->registerFileVariables("CurrentRun:Executable",
|
expander->registerFileVariables("CurrentRun:Executable",
|
||||||
tr("The currently active run configuration's executable (if applicable)"),
|
tr("The currently active run configuration's executable (if applicable)."),
|
||||||
[this]() -> QString {
|
[this]() -> QString {
|
||||||
if (Target *target = activeTarget()) {
|
if (Target *target = activeTarget()) {
|
||||||
if (RunConfiguration *rc = target->activeRunConfiguration()) {
|
if (RunConfiguration *rc = target->activeRunConfiguration()) {
|
||||||
@@ -1847,7 +1847,7 @@ ProjectExplorerPlugin::OpenProjectResult ProjectExplorerPlugin::openProjects(con
|
|||||||
if (ProjectManager::canOpenProjectForMimeType(mt)) {
|
if (ProjectManager::canOpenProjectForMimeType(mt)) {
|
||||||
if (!QFileInfo(filePath).isFile()) {
|
if (!QFileInfo(filePath).isFile()) {
|
||||||
appendError(errorString,
|
appendError(errorString,
|
||||||
tr("Failed opening project \"%1\": Project is not a file").arg(fileName));
|
tr("Failed opening project \"%1\": Project is not a file.").arg(fileName));
|
||||||
} else if (Project *pro = ProjectManager::openProject(mt, Utils::FileName::fromString(filePath))) {
|
} else if (Project *pro = ProjectManager::openProject(mt, Utils::FileName::fromString(filePath))) {
|
||||||
QObject::connect(pro, &Project::parsingFinished, [pro]() {
|
QObject::connect(pro, &Project::parsingFinished, [pro]() {
|
||||||
emit SessionManager::instance()->projectFinishedParsing(pro);
|
emit SessionManager::instance()->projectFinishedParsing(pro);
|
||||||
|
@@ -936,7 +936,7 @@ void RunControlPrivate::onWorkerStarted(RunWorker *worker)
|
|||||||
continueStart();
|
continueStart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showError(tr("Unexpected run control state %1 when worker %2 started")
|
showError(tr("Unexpected run control state %1 when worker %2 started.")
|
||||||
.arg(stateName(state))
|
.arg(stateName(state))
|
||||||
.arg(worker->d->id));
|
.arg(worker->d->id));
|
||||||
}
|
}
|
||||||
@@ -1467,11 +1467,11 @@ bool RunWorkerPrivate::canStart() const
|
|||||||
void RunWorkerPrivate::timerEvent(QTimerEvent *ev)
|
void RunWorkerPrivate::timerEvent(QTimerEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->timerId() == startWatchdogTimerId) {
|
if (ev->timerId() == startWatchdogTimerId) {
|
||||||
q->reportFailure(tr("Worker start timed out"));
|
q->reportFailure(tr("Worker start timed out."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ev->timerId() == stopWatchdogTimerId) {
|
if (ev->timerId() == stopWatchdogTimerId) {
|
||||||
q->reportFailure(tr("Worker stop timed out"));
|
q->reportFailure(tr("Worker stop timed out."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1610,7 +1610,7 @@ QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, cons
|
|||||||
"permissions to invoke the program.").arg(program);
|
"permissions to invoke the program.").arg(program);
|
||||||
break;
|
break;
|
||||||
case QProcess::Crashed:
|
case QProcess::Crashed:
|
||||||
msg = tr("The process was ended forcefully");
|
msg = tr("The process was ended forcefully.");
|
||||||
break;
|
break;
|
||||||
case QProcess::Timedout:
|
case QProcess::Timedout:
|
||||||
// "The last waitFor...() function timed out. "
|
// "The last waitFor...() function timed out. "
|
||||||
|
@@ -59,18 +59,19 @@ static Core::Id categoryForType(Task::TaskType type)
|
|||||||
class TaskMark : public TextEditor::TextMark
|
class TaskMark : public TextEditor::TextMark
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TaskMark(unsigned int id, const QString &fileName, int lineNumber,
|
TaskMark(const Task &task) :
|
||||||
Task::TaskType type, bool visible) :
|
TextMark(task.file.toString(), task.line, categoryForType(task.type)),
|
||||||
TextMark(fileName, lineNumber, categoryForType(type)),
|
m_id(task.taskId)
|
||||||
m_id(id)
|
|
||||||
{
|
{
|
||||||
setColor(type == Task::Error ? Utils::Theme::ProjectExplorer_TaskError_TextMarkColor
|
setColor(task.type == Task::Error ? Utils::Theme::ProjectExplorer_TaskError_TextMarkColor
|
||||||
: Utils::Theme::ProjectExplorer_TaskWarn_TextMarkColor);
|
: Utils::Theme::ProjectExplorer_TaskWarn_TextMarkColor);
|
||||||
setDefaultToolTip(type == Task::Error ? QApplication::translate("TaskHub", "Error")
|
setDefaultToolTip(task.type == Task::Error ? QApplication::translate("TaskHub", "Error")
|
||||||
: QApplication::translate("TaskHub", "Warning"));
|
: QApplication::translate("TaskHub", "Warning"));
|
||||||
setPriority(type == Task::Error ? TextEditor::TextMark::NormalPriority
|
setPriority(task.type == Task::Error ? TextEditor::TextMark::NormalPriority
|
||||||
: TextEditor::TextMark::LowPriority);
|
: TextEditor::TextMark::LowPriority);
|
||||||
setVisible(visible);
|
setToolTip(task.description);
|
||||||
|
setIcon(task.icon);
|
||||||
|
setVisible(!task.icon.isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isClickable() const;
|
bool isClickable() const;
|
||||||
@@ -151,12 +152,8 @@ void TaskHub::addTask(Task task)
|
|||||||
task.line = -1;
|
task.line = -1;
|
||||||
task.movedLine = task.line;
|
task.movedLine = task.line;
|
||||||
|
|
||||||
if (task.line != -1) {
|
if (task.line != -1)
|
||||||
auto mark = new TaskMark(task.taskId, task.file.toString(), task.line, task.type, !task.icon.isNull());
|
task.setMark(new TaskMark(task));
|
||||||
mark->setToolTip(task.description);
|
|
||||||
mark->setIcon(task.icon);
|
|
||||||
task.setMark(mark);
|
|
||||||
}
|
|
||||||
emit m_instance->taskAdded(task);
|
emit m_instance->taskAdded(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -210,7 +210,7 @@ void QbsBuildStep::cancel()
|
|||||||
QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) const
|
QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) const
|
||||||
{
|
{
|
||||||
QVariantMap config = m_qbsConfiguration;
|
QVariantMap config = m_qbsConfiguration;
|
||||||
config.insert(QLatin1String(Constants::QBS_FORCE_PROBES_KEY), m_forceProbes);
|
config.insert(Constants::QBS_FORCE_PROBES_KEY, m_forceProbes);
|
||||||
if (variableHandling == ExpandVariables) {
|
if (variableHandling == ExpandVariables) {
|
||||||
const Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
const Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
for (auto it = config.begin(), end = config.end(); it != end; ++it) {
|
for (auto it = config.begin(), end = config.end(); it != end; ++it) {
|
||||||
@@ -227,9 +227,9 @@ void QbsBuildStep::setQbsConfiguration(const QVariantMap &config)
|
|||||||
QbsProject *pro = static_cast<QbsProject *>(project());
|
QbsProject *pro = static_cast<QbsProject *>(project());
|
||||||
|
|
||||||
QVariantMap tmp = config;
|
QVariantMap tmp = config;
|
||||||
tmp.insert(QLatin1String(Constants::QBS_CONFIG_PROFILE_KEY), pro->profileForTarget(target()));
|
tmp.insert(Constants::QBS_CONFIG_PROFILE_KEY, pro->profileForTarget(target()));
|
||||||
if (!tmp.contains(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)))
|
if (!tmp.contains(Constants::QBS_CONFIG_VARIANT_KEY))
|
||||||
tmp.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY),
|
tmp.insert(Constants::QBS_CONFIG_VARIANT_KEY,
|
||||||
QString::fromLatin1(Constants::QBS_VARIANT_DEBUG));
|
QString::fromLatin1(Constants::QBS_VARIANT_DEBUG));
|
||||||
|
|
||||||
if (tmp == m_qbsConfiguration)
|
if (tmp == m_qbsConfiguration)
|
||||||
@@ -263,13 +263,13 @@ bool QbsBuildStep::cleanInstallRoot() const
|
|||||||
|
|
||||||
bool QbsBuildStep::hasCustomInstallRoot() const
|
bool QbsBuildStep::hasCustomInstallRoot() const
|
||||||
{
|
{
|
||||||
return m_qbsConfiguration.contains(QLatin1String(Constants::QBS_INSTALL_ROOT_KEY));
|
return m_qbsConfiguration.contains(Constants::QBS_INSTALL_ROOT_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName QbsBuildStep::installRoot() const
|
Utils::FileName QbsBuildStep::installRoot() const
|
||||||
{
|
{
|
||||||
Utils::FileName root = Utils::FileName::fromString(m_qbsConfiguration
|
Utils::FileName root = Utils::FileName::fromString(m_qbsConfiguration
|
||||||
.value(QLatin1String(Constants::QBS_INSTALL_ROOT_KEY)).toString());
|
.value(Constants::QBS_INSTALL_ROOT_KEY).toString());
|
||||||
if (root.isNull()) {
|
if (root.isNull()) {
|
||||||
const QbsBuildConfiguration * const bc
|
const QbsBuildConfiguration * const bc
|
||||||
= static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
= static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
||||||
@@ -293,15 +293,15 @@ bool QbsBuildStep::fromMap(const QVariantMap &map)
|
|||||||
if (!ProjectExplorer::BuildStep::fromMap(map))
|
if (!ProjectExplorer::BuildStep::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setQbsConfiguration(map.value(QLatin1String(QBS_CONFIG)).toMap());
|
setQbsConfiguration(map.value(QBS_CONFIG).toMap());
|
||||||
m_qbsBuildOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN)).toBool());
|
m_qbsBuildOptions.setDryRun(map.value(QBS_DRY_RUN).toBool());
|
||||||
m_qbsBuildOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING)).toBool());
|
m_qbsBuildOptions.setKeepGoing(map.value(QBS_KEEP_GOING).toBool());
|
||||||
m_qbsBuildOptions.setMaxJobCount(map.value(QLatin1String(QBS_MAXJOBCOUNT)).toInt());
|
m_qbsBuildOptions.setMaxJobCount(map.value(QBS_MAXJOBCOUNT).toInt());
|
||||||
const bool showCommandLines = map.value(QLatin1String(QBS_SHOWCOMMANDLINES)).toBool();
|
const bool showCommandLines = map.value(QBS_SHOWCOMMANDLINES).toBool();
|
||||||
m_qbsBuildOptions.setEchoMode(showCommandLines ? qbs::CommandEchoModeCommandLine
|
m_qbsBuildOptions.setEchoMode(showCommandLines ? qbs::CommandEchoModeCommandLine
|
||||||
: qbs::CommandEchoModeSummary);
|
: qbs::CommandEchoModeSummary);
|
||||||
m_qbsBuildOptions.setInstall(map.value(QLatin1String(QBS_INSTALL), true).toBool());
|
m_qbsBuildOptions.setInstall(map.value(QBS_INSTALL, true).toBool());
|
||||||
m_qbsBuildOptions.setRemoveExistingInstallation(map.value(QLatin1String(QBS_CLEAN_INSTALL_ROOT))
|
m_qbsBuildOptions.setRemoveExistingInstallation(map.value(QBS_CLEAN_INSTALL_ROOT)
|
||||||
.toBool());
|
.toBool());
|
||||||
m_forceProbes = map.value(forceProbesKey()).toBool();
|
m_forceProbes = map.value(forceProbesKey()).toBool();
|
||||||
return true;
|
return true;
|
||||||
@@ -310,14 +310,14 @@ bool QbsBuildStep::fromMap(const QVariantMap &map)
|
|||||||
QVariantMap QbsBuildStep::toMap() const
|
QVariantMap QbsBuildStep::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map = ProjectExplorer::BuildStep::toMap();
|
QVariantMap map = ProjectExplorer::BuildStep::toMap();
|
||||||
map.insert(QLatin1String(QBS_CONFIG), m_qbsConfiguration);
|
map.insert(QBS_CONFIG, m_qbsConfiguration);
|
||||||
map.insert(QLatin1String(QBS_DRY_RUN), m_qbsBuildOptions.dryRun());
|
map.insert(QBS_DRY_RUN, m_qbsBuildOptions.dryRun());
|
||||||
map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsBuildOptions.keepGoing());
|
map.insert(QBS_KEEP_GOING, m_qbsBuildOptions.keepGoing());
|
||||||
map.insert(QLatin1String(QBS_MAXJOBCOUNT), m_qbsBuildOptions.maxJobCount());
|
map.insert(QBS_MAXJOBCOUNT, m_qbsBuildOptions.maxJobCount());
|
||||||
map.insert(QLatin1String(QBS_SHOWCOMMANDLINES),
|
map.insert(QBS_SHOWCOMMANDLINES,
|
||||||
m_qbsBuildOptions.echoMode() == qbs::CommandEchoModeCommandLine);
|
m_qbsBuildOptions.echoMode() == qbs::CommandEchoModeCommandLine);
|
||||||
map.insert(QLatin1String(QBS_INSTALL), m_qbsBuildOptions.install());
|
map.insert(QBS_INSTALL, m_qbsBuildOptions.install());
|
||||||
map.insert(QLatin1String(QBS_CLEAN_INSTALL_ROOT),
|
map.insert(QBS_CLEAN_INSTALL_ROOT,
|
||||||
m_qbsBuildOptions.removeExistingInstallation());
|
m_qbsBuildOptions.removeExistingInstallation());
|
||||||
map.insert(forceProbesKey(), m_forceProbes);
|
map.insert(forceProbesKey(), m_forceProbes);
|
||||||
return map;
|
return map;
|
||||||
@@ -389,7 +389,7 @@ void QbsBuildStep::handleProcessResultReport(const qbs::ProcessResult &result)
|
|||||||
|
|
||||||
m_parser->setWorkingDirectory(result.workingDirectory());
|
m_parser->setWorkingDirectory(result.workingDirectory());
|
||||||
|
|
||||||
QString commandline = result.executableFilePath() + QLatin1Char(' ')
|
QString commandline = result.executableFilePath() + ' '
|
||||||
+ Utils::QtcProcess::joinArgs(result.arguments());
|
+ Utils::QtcProcess::joinArgs(result.arguments());
|
||||||
addOutput(commandline, OutputFormat::Stdout);
|
addOutput(commandline, OutputFormat::Stdout);
|
||||||
|
|
||||||
@@ -422,15 +422,15 @@ QString QbsBuildStep::buildVariant() const
|
|||||||
bool QbsBuildStep::isQmlDebuggingEnabled() const
|
bool QbsBuildStep::isQmlDebuggingEnabled() const
|
||||||
{
|
{
|
||||||
QVariantMap data = qbsConfiguration(PreserveVariables);
|
QVariantMap data = qbsConfiguration(PreserveVariables);
|
||||||
return data.value(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY), false).toBool()
|
return data.value(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY, false).toBool()
|
||||||
|| data.value(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY), false).toBool();
|
|| data.value(Constants::QBS_CONFIG_QUICK_DEBUG_KEY, false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsBuildStep::setBuildVariant(const QString &variant)
|
void QbsBuildStep::setBuildVariant(const QString &variant)
|
||||||
{
|
{
|
||||||
if (m_qbsConfiguration.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString() == variant)
|
if (m_qbsConfiguration.value(Constants::QBS_CONFIG_VARIANT_KEY).toString() == variant)
|
||||||
return;
|
return;
|
||||||
m_qbsConfiguration.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY), variant);
|
m_qbsConfiguration.insert(Constants::QBS_CONFIG_VARIANT_KEY, variant);
|
||||||
emit qbsConfigurationChanged();
|
emit qbsConfigurationChanged();
|
||||||
QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
QbsBuildConfiguration *bc = static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
||||||
if (bc)
|
if (bc)
|
||||||
@@ -629,18 +629,17 @@ void QbsBuildStepConfigWidget::updateState()
|
|||||||
updateQmlDebuggingOption();
|
updateQmlDebuggingOption();
|
||||||
|
|
||||||
const QString buildVariant = m_step->buildVariant();
|
const QString buildVariant = m_step->buildVariant();
|
||||||
const int idx = (buildVariant == QLatin1String(Constants::QBS_VARIANT_DEBUG)) ? 0 : 1;
|
const int idx = (buildVariant == Constants::QBS_VARIANT_DEBUG) ? 0 : 1;
|
||||||
m_ui->buildVariantComboBox->setCurrentIndex(idx);
|
m_ui->buildVariantComboBox->setCurrentIndex(idx);
|
||||||
QString command = static_cast<QbsBuildConfiguration *>(m_step->buildConfiguration())
|
QString command = static_cast<QbsBuildConfiguration *>(m_step->buildConfiguration())
|
||||||
->equivalentCommandLine(m_step);
|
->equivalentCommandLine(m_step);
|
||||||
|
|
||||||
for (int i = 0; i < m_propertyCache.count(); ++i) {
|
for (int i = 0; i < m_propertyCache.count(); ++i) {
|
||||||
command += QLatin1Char(' ') + m_propertyCache.at(i).name
|
command += ' ' + m_propertyCache.at(i).name + ':' + m_propertyCache.at(i).effectiveValue;
|
||||||
+ QLatin1Char(':') + m_propertyCache.at(i).effectiveValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_step->isQmlDebuggingEnabled())
|
if (m_step->isQmlDebuggingEnabled())
|
||||||
command += QLatin1String(" Qt.declarative.qmlDebugging:true Qt.quick.qmlDebugging:true");
|
command += " Qt.declarative.qmlDebugging:true Qt.quick.qmlDebugging:true";
|
||||||
m_ui->commandLineTextEdit->setPlainText(command);
|
m_ui->commandLineTextEdit->setPlainText(command);
|
||||||
|
|
||||||
QString summary = tr("<b>Qbs:</b> %1").arg(command);
|
QString summary = tr("<b>Qbs:</b> %1").arg(command);
|
||||||
@@ -670,16 +669,16 @@ void QbsBuildStepConfigWidget::updatePropertyEdit(const QVariantMap &data)
|
|||||||
QVariantMap editable = data;
|
QVariantMap editable = data;
|
||||||
|
|
||||||
// remove data that is edited with special UIs:
|
// remove data that is edited with special UIs:
|
||||||
editable.remove(QLatin1String(Constants::QBS_CONFIG_PROFILE_KEY));
|
editable.remove(Constants::QBS_CONFIG_PROFILE_KEY);
|
||||||
editable.remove(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY));
|
editable.remove(Constants::QBS_CONFIG_VARIANT_KEY);
|
||||||
editable.remove(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY));
|
editable.remove(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY);
|
||||||
editable.remove(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY));
|
editable.remove(Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
|
||||||
editable.remove(QLatin1String(Constants::QBS_FORCE_PROBES_KEY));
|
editable.remove(Constants::QBS_FORCE_PROBES_KEY);
|
||||||
editable.remove(QLatin1String(Constants::QBS_INSTALL_ROOT_KEY));
|
editable.remove(Constants::QBS_INSTALL_ROOT_KEY);
|
||||||
|
|
||||||
QStringList propertyList;
|
QStringList propertyList;
|
||||||
for (QVariantMap::const_iterator i = editable.constBegin(); i != editable.constEnd(); ++i)
|
for (QVariantMap::const_iterator i = editable.constBegin(); i != editable.constEnd(); ++i)
|
||||||
propertyList.append(i.key() + QLatin1Char(':') + i.value().toString());
|
propertyList.append(i.key() + ':' + i.value().toString());
|
||||||
|
|
||||||
m_ui->propertyEdit->setText(Utils::QtcProcess::joinArgs(propertyList));
|
m_ui->propertyEdit->setText(Utils::QtcProcess::joinArgs(propertyList));
|
||||||
}
|
}
|
||||||
@@ -688,9 +687,9 @@ void QbsBuildStepConfigWidget::changeBuildVariant(int idx)
|
|||||||
{
|
{
|
||||||
QString variant;
|
QString variant;
|
||||||
if (idx == 1)
|
if (idx == 1)
|
||||||
variant = QLatin1String(Constants::QBS_VARIANT_RELEASE);
|
variant = Constants::QBS_VARIANT_RELEASE;
|
||||||
else
|
else
|
||||||
variant = QLatin1String(Constants::QBS_VARIANT_DEBUG);
|
variant = Constants::QBS_VARIANT_DEBUG;
|
||||||
m_ignoreChange = true;
|
m_ignoreChange = true;
|
||||||
m_step->setBuildVariant(variant);
|
m_step->setBuildVariant(variant);
|
||||||
m_ignoreChange = false;
|
m_ignoreChange = false;
|
||||||
@@ -768,16 +767,16 @@ void QbsBuildStepConfigWidget::applyCachedProperties()
|
|||||||
const QVariantMap tmp = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
const QVariantMap tmp = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
||||||
|
|
||||||
// Insert values set up with special UIs:
|
// Insert values set up with special UIs:
|
||||||
data.insert(QLatin1String(Constants::QBS_CONFIG_PROFILE_KEY),
|
data.insert(Constants::QBS_CONFIG_PROFILE_KEY,
|
||||||
tmp.value(QLatin1String(Constants::QBS_CONFIG_PROFILE_KEY)));
|
tmp.value(Constants::QBS_CONFIG_PROFILE_KEY));
|
||||||
data.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY),
|
data.insert(Constants::QBS_CONFIG_VARIANT_KEY,
|
||||||
tmp.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)));
|
tmp.value(Constants::QBS_CONFIG_VARIANT_KEY));
|
||||||
if (tmp.contains(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY)))
|
if (tmp.contains(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY))
|
||||||
data.insert(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY),
|
data.insert(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY,
|
||||||
tmp.value(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY)));
|
tmp.value(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY));
|
||||||
if (tmp.contains(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY)))
|
if (tmp.contains(Constants::QBS_CONFIG_QUICK_DEBUG_KEY))
|
||||||
data.insert(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY),
|
data.insert(Constants::QBS_CONFIG_QUICK_DEBUG_KEY,
|
||||||
tmp.value(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY)));
|
tmp.value(Constants::QBS_CONFIG_QUICK_DEBUG_KEY));
|
||||||
|
|
||||||
for (int i = 0; i < m_propertyCache.count(); ++i) {
|
for (int i = 0; i < m_propertyCache.count(); ++i) {
|
||||||
const Property &property = m_propertyCache.at(i);
|
const Property &property = m_propertyCache.at(i);
|
||||||
@@ -793,11 +792,11 @@ void QbsBuildStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
|
|||||||
{
|
{
|
||||||
QVariantMap data = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
QVariantMap data = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
data.insert(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY), checked);
|
data.insert(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY, checked);
|
||||||
data.insert(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY), checked);
|
data.insert(Constants::QBS_CONFIG_QUICK_DEBUG_KEY, checked);
|
||||||
} else {
|
} else {
|
||||||
data.remove(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY));
|
data.remove(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY);
|
||||||
data.remove(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY));
|
data.remove(Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ignoreChange = true;
|
m_ignoreChange = true;
|
||||||
@@ -819,7 +818,7 @@ bool QbsBuildStepConfigWidget::validateProperties(Utils::FancyLineEdit *edit, QS
|
|||||||
QList<Property> properties;
|
QList<Property> properties;
|
||||||
const Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
const Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
foreach (const QString &rawArg, argList) {
|
foreach (const QString &rawArg, argList) {
|
||||||
int pos = rawArg.indexOf(QLatin1Char(':'));
|
int pos = rawArg.indexOf(':');
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
const QString rawValue = rawArg.mid(pos + 1);
|
const QString rawValue = rawArg.mid(pos + 1);
|
||||||
Property property(rawArg.left(pos), rawValue, expander->expand(rawValue));
|
Property property(rawArg.left(pos), rawValue, expander->expand(rawValue));
|
||||||
|
@@ -46,6 +46,7 @@
|
|||||||
#include <cpptools/cppprojectupdater.h>
|
#include <cpptools/cppprojectupdater.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/buildenvironmentwidget.h>
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
|
#include <projectexplorer/buildinfo.h>
|
||||||
#include <projectexplorer/buildmanager.h>
|
#include <projectexplorer/buildmanager.h>
|
||||||
#include <projectexplorer/buildtargetinfo.h>
|
#include <projectexplorer/buildtargetinfo.h>
|
||||||
#include <projectexplorer/deploymentdata.h>
|
#include <projectexplorer/deploymentdata.h>
|
||||||
@@ -688,6 +689,30 @@ QString QbsProject::uniqueProductName(const qbs::ProductData &product)
|
|||||||
return product.name() + QLatin1Char('.') + product.profile();
|
return product.name() + QLatin1Char('.') + product.profile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QbsProject::configureAsExampleProject(const QSet<Id> &platforms)
|
||||||
|
{
|
||||||
|
QList<const BuildInfo *> infoList;
|
||||||
|
QList<Kit *> kits = KitManager::kits();
|
||||||
|
const auto qtVersionMatchesPlatform = [platforms](const QtSupport::BaseQtVersion *version) {
|
||||||
|
return platforms.isEmpty() || platforms.intersects(version->targetDeviceTypes());
|
||||||
|
};
|
||||||
|
foreach (Kit *k, kits) {
|
||||||
|
const QtSupport::BaseQtVersion * const qtVersion
|
||||||
|
= QtSupport::QtKitInformation::qtVersion(k);
|
||||||
|
if (!qtVersion || !qtVersionMatchesPlatform(qtVersion))
|
||||||
|
continue;
|
||||||
|
const IBuildConfigurationFactory * const factory
|
||||||
|
= IBuildConfigurationFactory::find(k, projectFilePath().toString());
|
||||||
|
if (!factory)
|
||||||
|
continue;
|
||||||
|
for (BuildInfo * const info : factory->availableSetups(k, projectFilePath().toString()))
|
||||||
|
infoList << info;
|
||||||
|
}
|
||||||
|
setup(infoList);
|
||||||
|
qDeleteAll(infoList);
|
||||||
|
prepareForParsing();
|
||||||
|
}
|
||||||
|
|
||||||
void QbsProject::parse(const QVariantMap &config, const Environment &env, const QString &dir,
|
void QbsProject::parse(const QVariantMap &config, const Environment &env, const QString &dir,
|
||||||
const QString &configName)
|
const QString &configName)
|
||||||
{
|
{
|
||||||
|
@@ -108,6 +108,8 @@ public:
|
|||||||
const qbs::ProductData &product);
|
const qbs::ProductData &product);
|
||||||
static QString uniqueProductName(const qbs::ProductData &product);
|
static QString uniqueProductName(const qbs::ProductData &product);
|
||||||
|
|
||||||
|
void configureAsExampleProject(const QSet<Core::Id> &platforms) final;
|
||||||
|
|
||||||
void invalidate();
|
void invalidate();
|
||||||
void delayParsing();
|
void delayParsing();
|
||||||
|
|
||||||
|
@@ -60,19 +60,19 @@ const char QBS_CLEANSTEP_ID[] = "Qbs.CleanStep";
|
|||||||
const char QBS_INSTALLSTEP_ID[] = "Qbs.InstallStep";
|
const char QBS_INSTALLSTEP_ID[] = "Qbs.InstallStep";
|
||||||
|
|
||||||
// QBS strings:
|
// QBS strings:
|
||||||
static const char QBS_VARIANT_DEBUG[] = "debug";
|
const char QBS_VARIANT_DEBUG[] = "debug";
|
||||||
static const char QBS_VARIANT_RELEASE[] = "release";
|
const char QBS_VARIANT_RELEASE[] = "release";
|
||||||
|
|
||||||
static const char QBS_CONFIG_VARIANT_KEY[] = "qbs.buildVariant";
|
const char QBS_CONFIG_VARIANT_KEY[] = "qbs.buildVariant";
|
||||||
static const char QBS_CONFIG_PROFILE_KEY[] = "qbs.profile";
|
const char QBS_CONFIG_PROFILE_KEY[] = "qbs.profile";
|
||||||
static const char QBS_INSTALL_ROOT_KEY[] = "qbs.installRoot";
|
const char QBS_INSTALL_ROOT_KEY[] = "qbs.installRoot";
|
||||||
static const char QBS_CONFIG_DECLARATIVE_DEBUG_KEY[] = "Qt.declarative.qmlDebugging";
|
const char QBS_CONFIG_DECLARATIVE_DEBUG_KEY[] = "Qt.declarative.qmlDebugging";
|
||||||
static const char QBS_CONFIG_QUICK_DEBUG_KEY[] = "Qt.quick.qmlDebugging";
|
const char QBS_CONFIG_QUICK_DEBUG_KEY[] = "Qt.quick.qmlDebugging";
|
||||||
const char QBS_FORCE_PROBES_KEY[] = "qbspm.forceProbes";
|
const char QBS_FORCE_PROBES_KEY[] = "qbspm.forceProbes";
|
||||||
|
|
||||||
// Icons:
|
// Icons:
|
||||||
static const char QBS_GROUP_ICON[] = ":/qbsprojectmanager/images/groups.png";
|
const char QBS_GROUP_ICON[] = ":/qbsprojectmanager/images/groups.png";
|
||||||
static const char QBS_PRODUCT_OVERLAY_ICON[] = ":/qbsprojectmanager/images/productgear.png";
|
const char QBS_PRODUCT_OVERLAY_ICON[] = ":/qbsprojectmanager/images/productgear.png";
|
||||||
|
|
||||||
// Toolchain related settings:
|
// Toolchain related settings:
|
||||||
const char QBS_TARGETOS[] = "qbs.targetOS";
|
const char QBS_TARGETOS[] = "qbs.targetOS";
|
||||||
|
@@ -244,7 +244,6 @@ void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments)
|
|||||||
|
|
||||||
static FileName findQMakeBinaryFromMakefile(const QString &makefile)
|
static FileName findQMakeBinaryFromMakefile(const QString &makefile)
|
||||||
{
|
{
|
||||||
bool debugAdding = false;
|
|
||||||
QFile fi(makefile);
|
QFile fi(makefile);
|
||||||
if (fi.exists() && fi.open(QFile::ReadOnly)) {
|
if (fi.exists() && fi.open(QFile::ReadOnly)) {
|
||||||
QTextStream ts(&fi);
|
QTextStream ts(&fi);
|
||||||
@@ -252,8 +251,6 @@ static FileName findQMakeBinaryFromMakefile(const QString &makefile)
|
|||||||
while (!ts.atEnd()) {
|
while (!ts.atEnd()) {
|
||||||
QString line = ts.readLine();
|
QString line = ts.readLine();
|
||||||
if (r1.exactMatch(line)) {
|
if (r1.exactMatch(line)) {
|
||||||
if (debugAdding)
|
|
||||||
qDebug()<<"#~~ QMAKE is:"<<r1.cap(1).trimmed();
|
|
||||||
QFileInfo qmake(r1.cap(1).trimmed());
|
QFileInfo qmake(r1.cap(1).trimmed());
|
||||||
QString qmakePath = qmake.filePath();
|
QString qmakePath = qmake.filePath();
|
||||||
if (!QString::fromLatin1(QTC_HOST_EXE_SUFFIX).isEmpty()
|
if (!QString::fromLatin1(QTC_HOST_EXE_SUFFIX).isEmpty()
|
||||||
|
@@ -24,19 +24,13 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "profilecompletionassist.h"
|
#include "profilecompletionassist.h"
|
||||||
#include "qmakeprojectmanagerconstants.h"
|
|
||||||
|
|
||||||
#include <texteditor/codeassist/assistinterface.h>
|
#include "texteditor/codeassist/keywordscompletionassist.h"
|
||||||
#include <texteditor/codeassist/keywordscompletionassist.h>
|
|
||||||
#include <texteditor/texteditorconstants.h>
|
|
||||||
|
|
||||||
#include <coreplugin/id.h>
|
const TextEditor::Keywords &QmakeProjectManager::Internal::qmakeKeywords()
|
||||||
|
{
|
||||||
using namespace QmakeProjectManager::Internal;
|
static TextEditor::Keywords keywords(
|
||||||
using namespace TextEditor;
|
QStringList{ // variables
|
||||||
|
|
||||||
|
|
||||||
static const char *const variableKeywords[] = {
|
|
||||||
"CCFLAG",
|
"CCFLAG",
|
||||||
"CLEAN_DEPS",
|
"CLEAN_DEPS",
|
||||||
"CONFIG",
|
"CONFIG",
|
||||||
@@ -233,11 +227,8 @@ static const char *const variableKeywords[] = {
|
|||||||
"YACCOBJECTS",
|
"YACCOBJECTS",
|
||||||
"YACCSOURCES",
|
"YACCSOURCES",
|
||||||
"_PRO_FILE_",
|
"_PRO_FILE_",
|
||||||
"_PRO_FILE_PWD_",
|
"_PRO_FILE_PWD_"},
|
||||||
0
|
QStringList{ // functions
|
||||||
};
|
|
||||||
|
|
||||||
static const char *const functionKeywords[] = {
|
|
||||||
"CONFIG",
|
"CONFIG",
|
||||||
"absolute_path",
|
"absolute_path",
|
||||||
"basename",
|
"basename",
|
||||||
@@ -309,45 +300,6 @@ static const char *const functionKeywords[] = {
|
|||||||
"upper",
|
"upper",
|
||||||
"val_escape",
|
"val_escape",
|
||||||
"warning",
|
"warning",
|
||||||
"write_file",
|
"write_file"});
|
||||||
0
|
return keywords;
|
||||||
};
|
|
||||||
|
|
||||||
// -------------------------------
|
|
||||||
// ProFileCompletionAssistProvider
|
|
||||||
// -------------------------------
|
|
||||||
void ProFileCompletionAssistProvider::init()
|
|
||||||
{
|
|
||||||
for (uint i = 0; i < sizeof variableKeywords / sizeof variableKeywords[0] - 1; i++)
|
|
||||||
m_variables.append(QLatin1String(variableKeywords[i]));
|
|
||||||
for (uint i = 0; i < sizeof functionKeywords / sizeof functionKeywords[0] - 1; i++)
|
|
||||||
m_functions.append(QLatin1String(functionKeywords[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
ProFileCompletionAssistProvider::~ProFileCompletionAssistProvider()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IAssistProcessor *ProFileCompletionAssistProvider::createProcessor() const
|
|
||||||
{
|
|
||||||
if (m_variables.isEmpty())
|
|
||||||
const_cast<ProFileCompletionAssistProvider *>(this)->init();
|
|
||||||
TextEditor::Keywords keywords = TextEditor::Keywords(m_variables, m_functions, QMap<QString, QStringList>());
|
|
||||||
auto processor = new KeywordsCompletionAssistProcessor(keywords);
|
|
||||||
processor->setSnippetGroup(TextEditor::Constants::TEXT_SNIPPET_GROUP_ID);
|
|
||||||
return processor;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList ProFileCompletionAssistProvider::variables() const
|
|
||||||
{
|
|
||||||
if (m_variables.isEmpty())
|
|
||||||
const_cast<ProFileCompletionAssistProvider *>(this)->init();
|
|
||||||
return m_variables;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList ProFileCompletionAssistProvider::functions() const
|
|
||||||
{
|
|
||||||
if (m_functions.isEmpty())
|
|
||||||
const_cast<ProFileCompletionAssistProvider *>(this)->init();
|
|
||||||
return m_functions;
|
|
||||||
}
|
}
|
||||||
|
@@ -25,29 +25,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <texteditor/codeassist/completionassistprovider.h>
|
namespace TextEditor { class Keywords; }
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ProFileCompletionAssistProvider : public TextEditor::CompletionAssistProvider
|
const TextEditor::Keywords &qmakeKeywords();
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
void init();
|
|
||||||
~ProFileCompletionAssistProvider();
|
|
||||||
|
|
||||||
TextEditor::IAssistProcessor *createProcessor() const override;
|
|
||||||
QStringList variables() const;
|
|
||||||
QStringList functions() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_variables;
|
|
||||||
QStringList m_functions;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QmakeProjectManager
|
} // namespace QmakeProjectManager
|
||||||
|
@@ -182,16 +182,14 @@ ProFileEditorFactory::ProFileEditorFactory()
|
|||||||
setDocumentCreator(createProFileDocument);
|
setDocumentCreator(createProFileDocument);
|
||||||
setEditorWidgetCreator([]() { return new ProFileEditorWidget; });
|
setEditorWidgetCreator([]() { return new ProFileEditorWidget; });
|
||||||
|
|
||||||
ProFileCompletionAssistProvider *pcap = new ProFileCompletionAssistProvider;
|
setCompletionAssistProvider(new KeywordsCompletionAssistProvider(qmakeKeywords()));
|
||||||
setCompletionAssistProvider(pcap);
|
|
||||||
|
|
||||||
setCommentDefinition(Utils::CommentDefinition::HashStyle);
|
setCommentDefinition(Utils::CommentDefinition::HashStyle);
|
||||||
setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection
|
setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection
|
||||||
| TextEditorActionHandler::JumpToFileUnderCursor);
|
| TextEditorActionHandler::JumpToFileUnderCursor);
|
||||||
|
|
||||||
Keywords keywords(pcap->variables(), pcap->functions(), QMap<QString, QStringList>());
|
addHoverHandler(new ProFileHoverHandler);
|
||||||
addHoverHandler(new ProFileHoverHandler(keywords));
|
setSyntaxHighlighterCreator([]() { return new ProFileHighlighter; });
|
||||||
setSyntaxHighlighterCreator([keywords]() { return new ProFileHighlighter(keywords); });
|
|
||||||
|
|
||||||
const QString defaultOverlay = QLatin1String(ProjectExplorer::Constants::FILEOVERLAY_QT);
|
const QString defaultOverlay = QLatin1String(ProjectExplorer::Constants::FILEOVERLAY_QT);
|
||||||
Core::FileIconProvider::registerIconOverlayForSuffix(
|
Core::FileIconProvider::registerIconOverlayForSuffix(
|
||||||
|
@@ -52,8 +52,8 @@ static TextStyle styleForFormat(int format)
|
|||||||
return C_TEXT;
|
return C_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFileHighlighter::ProFileHighlighter(const Keywords &keywords)
|
ProFileHighlighter::ProFileHighlighter()
|
||||||
: m_keywords(keywords)
|
: m_keywords(qmakeKeywords())
|
||||||
{
|
{
|
||||||
setTextFormatCategories(NumProfileFormats, styleForFormat);
|
setTextFormatCategories(NumProfileFormats, styleForFormat);
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
NumProfileFormats
|
NumProfileFormats
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit ProFileHighlighter(const TextEditor::Keywords &keywords);
|
ProFileHighlighter();
|
||||||
void highlightBlock(const QString &text);
|
void highlightBlock(const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -39,8 +39,8 @@ using namespace Core;
|
|||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ProFileHoverHandler::ProFileHoverHandler(const TextEditor::Keywords &keywords)
|
ProFileHoverHandler::ProFileHoverHandler()
|
||||||
: m_keywords(keywords)
|
: m_keywords(qmakeKeywords())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ namespace Internal {
|
|||||||
class ProFileHoverHandler : public TextEditor::BaseHoverHandler
|
class ProFileHoverHandler : public TextEditor::BaseHoverHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ProFileHoverHandler(const TextEditor::Keywords &keywords);
|
ProFileHoverHandler();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void identifyMatch(TextEditor::TextEditorWidget *editorWidget, int pos) override;
|
void identifyMatch(TextEditor::TextEditorWidget *editorWidget, int pos) override;
|
||||||
|
@@ -140,9 +140,9 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((topSelectedItemIsMovable(itemList) && !view()->hasSingleSelectedModelNode())
|
if ((topSelectedItemIsMovable(itemList) && !view()->hasSingleSelectedModelNode())
|
||||||
|| selectedItemCursorInMovableArea(event->scenePos())
|
|| (selectedItemCursorInMovableArea(event->scenePos())
|
||||||
&& !event->modifiers().testFlag(Qt::ControlModifier)
|
&& !event->modifiers().testFlag(Qt::ControlModifier)
|
||||||
&& !event->modifiers().testFlag(Qt::ShiftModifier)) {
|
&& !event->modifiers().testFlag(Qt::ShiftModifier))) {
|
||||||
view()->changeToMoveTool();
|
view()->changeToMoveTool();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef DesignDocument_h
|
#pragma once
|
||||||
#define DesignDocument_h
|
|
||||||
|
|
||||||
#include <model.h>
|
#include <model.h>
|
||||||
#include <rewriterview.h>
|
#include <rewriterview.h>
|
||||||
@@ -155,6 +154,3 @@ private: // variables
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
|
|
||||||
#endif // DesignDocument_h
|
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef StackedUtilityPanelController_h
|
#pragma once
|
||||||
#define StackedUtilityPanelController_h
|
|
||||||
|
|
||||||
#include "utilitypanelcontroller.h"
|
#include "utilitypanelcontroller.h"
|
||||||
|
|
||||||
@@ -55,5 +54,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
#endif // StackedUtilityPanelController_h
|
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef UtilityPanelController_h
|
#pragma once
|
||||||
#define UtilityPanelController_h
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@@ -47,5 +46,3 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
#endif // UtilityPanelController_h
|
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QmlAnchorBindingProxy_h
|
#pragma once
|
||||||
#define QmlAnchorBindingProxy_h
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <modelnode.h>
|
#include <modelnode.h>
|
||||||
@@ -248,6 +247,3 @@ private:
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
|
|
||||||
#endif //QmlAnchorBindingProxy
|
|
||||||
|
@@ -95,7 +95,7 @@ void MetaInfoReader::elementStart(const QString &name)
|
|||||||
case ParsingHints:
|
case ParsingHints:
|
||||||
case Finished:
|
case Finished:
|
||||||
case Undefined: setParserState(Error);
|
case Undefined: setParserState(Error);
|
||||||
addError(tr("Illegal state while parsing"), currentSourceLocation());
|
addError(tr("Illegal state while parsing."), currentSourceLocation());
|
||||||
case Error:
|
case Error:
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ void MetaInfoReader::elementEnd()
|
|||||||
case ParsingDocument:
|
case ParsingDocument:
|
||||||
case Finished:
|
case Finished:
|
||||||
case Undefined: setParserState(Error);
|
case Undefined: setParserState(Error);
|
||||||
addError(tr("Illegal state while parsing"), currentSourceLocation());
|
addError(tr("Illegal state while parsing."), currentSourceLocation());
|
||||||
case Error:
|
case Error:
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
@@ -126,12 +126,12 @@ void MetaInfoReader::propertyDefinition(const QString &name, const QVariant &val
|
|||||||
case ParsingItemLibrary: readItemLibraryEntryProperty(name, value); break;
|
case ParsingItemLibrary: readItemLibraryEntryProperty(name, value); break;
|
||||||
case ParsingProperty: readPropertyProperty(name, value); break;
|
case ParsingProperty: readPropertyProperty(name, value); break;
|
||||||
case ParsingQmlSource: readQmlSourceProperty(name, value); break;
|
case ParsingQmlSource: readQmlSourceProperty(name, value); break;
|
||||||
case ParsingMetaInfo: addError(tr("No property definition allowed"), currentSourceLocation()); break;
|
case ParsingMetaInfo: addError(tr("No property definition allowed."), currentSourceLocation()); break;
|
||||||
case ParsingDocument:
|
case ParsingDocument:
|
||||||
case ParsingHints: readHint(name, value); break;
|
case ParsingHints: readHint(name, value); break;
|
||||||
case Finished:
|
case Finished:
|
||||||
case Undefined: setParserState(Error);
|
case Undefined: setParserState(Error);
|
||||||
addError(tr("Illegal state while parsing"), currentSourceLocation());
|
addError(tr("Illegal state while parsing."), currentSourceLocation());
|
||||||
case Error:
|
case Error:
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ static IWidgetPlugin *instance(WidgetPluginData &p)
|
|||||||
p.failed = true;
|
p.failed = true;
|
||||||
p.errorMessage = QCoreApplication::translate("WidgetPluginManager",
|
p.errorMessage = QCoreApplication::translate("WidgetPluginManager",
|
||||||
"Failed to create instance of file "
|
"Failed to create instance of file "
|
||||||
"'%1': %2").arg(p.path).arg(p.errorMessage);
|
"\"%1\": %2").arg(p.path).arg(p.errorMessage);
|
||||||
qWarning() << p.errorMessage;
|
qWarning() << p.errorMessage;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ static IWidgetPlugin *instance(WidgetPluginData &p)
|
|||||||
if (!object) {
|
if (!object) {
|
||||||
p.failed = true;
|
p.failed = true;
|
||||||
p.errorMessage = QCoreApplication::translate("WidgetPluginManager",
|
p.errorMessage = QCoreApplication::translate("WidgetPluginManager",
|
||||||
"Failed to create instance of file '%1'."
|
"Failed to create instance of file \"%1\"."
|
||||||
).arg(p.path);
|
).arg(p.path);
|
||||||
qWarning() << p.errorMessage;
|
qWarning() << p.errorMessage;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -83,7 +83,7 @@ static IWidgetPlugin *instance(WidgetPluginData &p)
|
|||||||
if (!iplugin) {
|
if (!iplugin) {
|
||||||
p.failed = true;
|
p.failed = true;
|
||||||
p.errorMessage = QCoreApplication::translate("WidgetPluginManager",
|
p.errorMessage = QCoreApplication::translate("WidgetPluginManager",
|
||||||
"File '%1' is not a QmlDesigner plugin."
|
"File \"%1\" is not a Qt Quick Designer plugin."
|
||||||
).arg(p.path);
|
).arg(p.path);
|
||||||
qWarning() << p.errorMessage;
|
qWarning() << p.errorMessage;
|
||||||
delete object;
|
delete object;
|
||||||
|
@@ -397,6 +397,7 @@ Project {
|
|||||||
"componentcore/selectioncontext.h",
|
"componentcore/selectioncontext.h",
|
||||||
"componentcore/qmldesignericonprovider.cpp",
|
"componentcore/qmldesignericonprovider.cpp",
|
||||||
"componentcore/qmldesignericonprovider.h",
|
"componentcore/qmldesignericonprovider.h",
|
||||||
|
"componentcore/componentcore.qrc",
|
||||||
"texteditor/texteditorstatusbar.cpp",
|
"texteditor/texteditorstatusbar.cpp",
|
||||||
"texteditor/texteditorstatusbar.h",
|
"texteditor/texteditorstatusbar.h",
|
||||||
"componentcore/changestyleaction.cpp",
|
"componentcore/changestyleaction.cpp",
|
||||||
|
@@ -146,7 +146,7 @@ FindInFilesSilverSearcher::FindInFilesSilverSearcher()
|
|||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
auto layout = new QHBoxLayout(m_widget);
|
auto layout = new QHBoxLayout(m_widget);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
QLabel *label = new QLabel(tr("SilverSearcher is not available on system"));
|
QLabel *label = new QLabel(tr("Silver Searcher is not available on the system."));
|
||||||
label->setStyleSheet("QLabel { color : red; }");
|
label->setStyleSheet("QLabel { color : red; }");
|
||||||
layout->addWidget(label);
|
layout->addWidget(label);
|
||||||
}
|
}
|
||||||
|
@@ -589,7 +589,7 @@ CountingLabel::CountingLabel()
|
|||||||
|
|
||||||
void CountingLabel::updateCount(int count)
|
void CountingLabel::updateCount(int count)
|
||||||
{
|
{
|
||||||
setText(BaseFileFind::tr("%n found", nullptr, count));
|
setText(BaseFileFind::tr("%n found.", nullptr, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include <texteditor/codeassist/genericproposalmodel.h>
|
#include <texteditor/codeassist/genericproposalmodel.h>
|
||||||
#include <texteditor/completionsettings.h>
|
#include <texteditor/completionsettings.h>
|
||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
|
#include <texteditor/texteditorconstants.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
@@ -243,4 +244,22 @@ KeywordsCompletionAssistProcessor::generateProposalList(const QStringList &words
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeywordsCompletionAssistProvider::KeywordsCompletionAssistProvider(const Keywords &keyWords,
|
||||||
|
const QString &snippetGroup)
|
||||||
|
: m_keyWords(keyWords)
|
||||||
|
, m_snippetGroup(snippetGroup)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
IAssistProvider::RunType KeywordsCompletionAssistProvider::runType() const
|
||||||
|
{
|
||||||
|
return Synchronous;
|
||||||
|
}
|
||||||
|
|
||||||
|
IAssistProcessor *KeywordsCompletionAssistProvider::createProcessor() const
|
||||||
|
{
|
||||||
|
auto processor = new KeywordsCompletionAssistProcessor(m_keyWords);
|
||||||
|
processor->setSnippetGroup(m_snippetGroup);
|
||||||
|
return processor;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
@@ -28,8 +28,11 @@
|
|||||||
#include "iassistprocessor.h"
|
#include "iassistprocessor.h"
|
||||||
#include "assistproposalitem.h"
|
#include "assistproposalitem.h"
|
||||||
#include "ifunctionhintproposalmodel.h"
|
#include "ifunctionhintproposalmodel.h"
|
||||||
|
#include "completionassistprovider.h"
|
||||||
#include "../snippets/snippetassistcollector.h"
|
#include "../snippets/snippetassistcollector.h"
|
||||||
|
|
||||||
|
#include "texteditor/texteditorconstants.h"
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
class AssistInterface;
|
class AssistInterface;
|
||||||
@@ -38,8 +41,8 @@ class TEXTEDITOR_EXPORT Keywords
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Keywords() = default;
|
Keywords() = default;
|
||||||
Keywords(const QStringList &variables, const QStringList &functions,
|
Keywords(const QStringList &variables, const QStringList &functions = QStringList(),
|
||||||
const QMap<QString, QStringList> &functionArgs);
|
const QMap<QString, QStringList> &functionArgs = QMap<QString, QStringList>());
|
||||||
bool isVariable(const QString &word) const;
|
bool isVariable(const QString &word) const;
|
||||||
bool isFunction(const QString &word) const;
|
bool isFunction(const QString &word) const;
|
||||||
|
|
||||||
@@ -79,6 +82,21 @@ private:
|
|||||||
QStringList m_functionSymbols;
|
QStringList m_functionSymbols;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TEXTEDITOR_EXPORT KeywordsCompletionAssistProvider : public CompletionAssistProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KeywordsCompletionAssistProvider(const Keywords &keyWords = Keywords(),
|
||||||
|
const QString &snippetGroup = QString(Constants::TEXT_SNIPPET_GROUP_ID));
|
||||||
|
|
||||||
|
// IAssistProvider interface
|
||||||
|
RunType runType() const override;
|
||||||
|
IAssistProcessor *createProcessor() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Keywords m_keyWords;
|
||||||
|
QString m_snippetGroup;
|
||||||
|
};
|
||||||
|
|
||||||
class TEXTEDITOR_EXPORT KeywordsCompletionAssistProcessor : public IAssistProcessor
|
class TEXTEDITOR_EXPORT KeywordsCompletionAssistProcessor : public IAssistProcessor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -25,6 +25,12 @@
|
|||||||
|
|
||||||
#include "displaysettings.h"
|
#include "displaysettings.h"
|
||||||
|
|
||||||
|
#include "texteditorconstants.h"
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
#include <utils/tooltip/tooltip.h>
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
@@ -134,4 +140,14 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLabel *DisplaySettings::createAnnotationSettingsLink()
|
||||||
|
{
|
||||||
|
auto *label = new QLabel("<i><a href>Annotation Settings</a></i>", Core::ICore::mainWindow());
|
||||||
|
QObject::connect(label, &QLabel::linkActivated, []() {
|
||||||
|
Utils::ToolTip::hideImmediately();
|
||||||
|
Core::ICore::showOptionsDialog(Constants::TEXT_EDITOR_DISPLAY_SETTINGS);
|
||||||
|
});
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
class QLabel;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
@@ -72,6 +73,8 @@ public:
|
|||||||
int m_minimalAnnotationContent = 15;
|
int m_minimalAnnotationContent = 15;
|
||||||
|
|
||||||
bool equals(const DisplaySettings &ds) const;
|
bool equals(const DisplaySettings &ds) const;
|
||||||
|
|
||||||
|
static QLabel *createAnnotationSettingsLink();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const DisplaySettings &t1, const DisplaySettings &t2) { return t1.equals(t2); }
|
inline bool operator==(const DisplaySettings &t1, const DisplaySettings &t2) { return t1.equals(t2); }
|
||||||
|
@@ -46,6 +46,7 @@
|
|||||||
#include "tabsettings.h"
|
#include "tabsettings.h"
|
||||||
#include "textdocument.h"
|
#include "textdocument.h"
|
||||||
#include "textdocumentlayout.h"
|
#include "textdocumentlayout.h"
|
||||||
|
#include "texteditorconstants.h"
|
||||||
#include "texteditoroverlay.h"
|
#include "texteditoroverlay.h"
|
||||||
#include "refactoroverlay.h"
|
#include "refactoroverlay.h"
|
||||||
#include "texteditorsettings.h"
|
#include "texteditorsettings.h"
|
||||||
@@ -56,6 +57,7 @@
|
|||||||
#include <texteditor/codeassist/assistinterface.h>
|
#include <texteditor/codeassist/assistinterface.h>
|
||||||
#include <texteditor/codeassist/codeassistant.h>
|
#include <texteditor/codeassist/codeassistant.h>
|
||||||
#include <texteditor/codeassist/completionassistprovider.h>
|
#include <texteditor/codeassist/completionassistprovider.h>
|
||||||
|
#include <texteditor/codeassist/keywordscompletionassist.h>
|
||||||
#include <texteditor/generichighlighter/context.h>
|
#include <texteditor/generichighlighter/context.h>
|
||||||
#include <texteditor/generichighlighter/highlightdefinition.h>
|
#include <texteditor/generichighlighter/highlightdefinition.h>
|
||||||
#include <texteditor/generichighlighter/highlighter.h>
|
#include <texteditor/generichighlighter/highlighter.h>
|
||||||
@@ -3291,7 +3293,9 @@ bool TextEditorWidgetPrivate::processAnnotaionTooltipRequest(const QTextBlock &b
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const AnnotationRect &annotationRect : m_annotationRects[block.blockNumber()]) {
|
for (const AnnotationRect &annotationRect : m_annotationRects[block.blockNumber()]) {
|
||||||
if (annotationRect.rect.contains(pos)) {
|
if (!annotationRect.rect.contains(pos))
|
||||||
|
continue;
|
||||||
|
|
||||||
auto layout = new QGridLayout;
|
auto layout = new QGridLayout;
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(2);
|
layout->setSpacing(2);
|
||||||
@@ -3300,9 +3304,8 @@ bool TextEditorWidgetPrivate::processAnnotaionTooltipRequest(const QTextBlock &b
|
|||||||
if (marks.size() > 1) {
|
if (marks.size() > 1) {
|
||||||
QFrame* separator = new QFrame();
|
QFrame* separator = new QFrame();
|
||||||
separator->setFrameShape(QFrame::HLine);
|
separator->setFrameShape(QFrame::HLine);
|
||||||
layout->addWidget(separator, 2, 0, 1, layout->columnCount());
|
layout->addWidget(separator, layout->rowCount(), 0, 1, -1);
|
||||||
layout->addWidget(new QLabel(tr("Other annotations:")), 3, 0, 1,
|
layout->addWidget(new QLabel(tr("Other annotations:")), layout->rowCount(), 0, 1, -1);
|
||||||
layout->columnCount());
|
|
||||||
|
|
||||||
Utils::sort(marks, [](const TextMark* mark1, const TextMark* mark2){
|
Utils::sort(marks, [](const TextMark* mark1, const TextMark* mark2){
|
||||||
return mark1->priority() > mark2->priority();
|
return mark1->priority() > mark2->priority();
|
||||||
@@ -3312,10 +3315,11 @@ bool TextEditorWidgetPrivate::processAnnotaionTooltipRequest(const QTextBlock &b
|
|||||||
mark->addToToolTipLayout(layout);
|
mark->addToToolTipLayout(layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
layout->addWidget(DisplaySettings::createAnnotationSettingsLink(),
|
||||||
|
layout->rowCount(), 0, 1, -1, Qt::AlignRight);
|
||||||
ToolTip::show(q->mapToGlobal(pos), layout, q);
|
ToolTip::show(q->mapToGlobal(pos), layout, q);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8136,13 +8140,7 @@ public:
|
|||||||
TextEditorFactoryPrivate(TextEditorFactory *parent) :
|
TextEditorFactoryPrivate(TextEditorFactory *parent) :
|
||||||
q(parent),
|
q(parent),
|
||||||
m_widgetCreator([]() { return new TextEditorWidget; }),
|
m_widgetCreator([]() { return new TextEditorWidget; }),
|
||||||
m_editorCreator([]() { return new BaseTextEditor; }),
|
m_editorCreator([]() { return new BaseTextEditor; })
|
||||||
m_completionAssistProvider(0),
|
|
||||||
m_useGenericHighlighter(false),
|
|
||||||
m_duplicatedSupported(true),
|
|
||||||
m_codeFoldingSupported(false),
|
|
||||||
m_paranthesesMatchinEnabled(false),
|
|
||||||
m_marksVisible(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
BaseTextEditor *duplicateTextEditor(BaseTextEditor *other)
|
BaseTextEditor *duplicateTextEditor(BaseTextEditor *other)
|
||||||
@@ -8163,12 +8161,12 @@ public:
|
|||||||
TextEditorFactory::SyntaxHighLighterCreator m_syntaxHighlighterCreator;
|
TextEditorFactory::SyntaxHighLighterCreator m_syntaxHighlighterCreator;
|
||||||
CommentDefinition m_commentDefinition;
|
CommentDefinition m_commentDefinition;
|
||||||
QList<BaseHoverHandler *> m_hoverHandlers; // owned
|
QList<BaseHoverHandler *> m_hoverHandlers; // owned
|
||||||
CompletionAssistProvider * m_completionAssistProvider; // owned
|
CompletionAssistProvider * m_completionAssistProvider = nullptr; // owned
|
||||||
bool m_useGenericHighlighter;
|
bool m_useGenericHighlighter = false;
|
||||||
bool m_duplicatedSupported;
|
bool m_duplicatedSupported = true;
|
||||||
bool m_codeFoldingSupported;
|
bool m_codeFoldingSupported = false;
|
||||||
bool m_paranthesesMatchinEnabled;
|
bool m_paranthesesMatchinEnabled = false;
|
||||||
bool m_marksVisible;
|
bool m_marksVisible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /// namespace Internal
|
} /// namespace Internal
|
||||||
@@ -8266,6 +8264,7 @@ void TextEditorFactory::setParenthesesMatchingEnabled(bool on)
|
|||||||
|
|
||||||
IEditor *TextEditorFactory::createEditor()
|
IEditor *TextEditorFactory::createEditor()
|
||||||
{
|
{
|
||||||
|
static KeywordsCompletionAssistProvider basicSnippetProvider;
|
||||||
TextDocumentPtr doc(d->m_documentCreator());
|
TextDocumentPtr doc(d->m_documentCreator());
|
||||||
|
|
||||||
if (d->m_indenterCreator)
|
if (d->m_indenterCreator)
|
||||||
@@ -8274,7 +8273,8 @@ IEditor *TextEditorFactory::createEditor()
|
|||||||
if (d->m_syntaxHighlighterCreator)
|
if (d->m_syntaxHighlighterCreator)
|
||||||
doc->setSyntaxHighlighter(d->m_syntaxHighlighterCreator());
|
doc->setSyntaxHighlighter(d->m_syntaxHighlighterCreator());
|
||||||
|
|
||||||
doc->setCompletionAssistProvider(d->m_completionAssistProvider);
|
doc->setCompletionAssistProvider(d->m_completionAssistProvider ? d->m_completionAssistProvider
|
||||||
|
: &basicSnippetProvider);
|
||||||
|
|
||||||
return d->createEditorHelper(doc);
|
return d->createEditorHelper(doc);
|
||||||
}
|
}
|
||||||
|
36
src/share/3rdparty/generic-highlighter/alert.xml
vendored
@@ -1,36 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE language SYSTEM "language.dtd">
|
<!DOCTYPE language SYSTEM "language.dtd">
|
||||||
<!--
|
<language version="5" kateversion="3.1" name="Alerts" section="Other" extensions="" mimetype="" author="Dominik Haumann (dhaumann@kde.org)" license="MIT" hidden="true">
|
||||||
This file is part of KDE's kate project.
|
|
||||||
|
|
||||||
copyright : (C) 2004 by Dominik Haumann
|
|
||||||
email : dhdev at gmx dot de
|
|
||||||
|
|
||||||
**********************************************************************
|
|
||||||
* This library is free software; you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU Library General Public *
|
|
||||||
* License as published by the Free Software Foundation; either *
|
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This library is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
||||||
* Library General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU Library General Public *
|
|
||||||
* License along with this library; if not, write to the *
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
|
|
||||||
* Boston, MA 02110-1301, USA. *
|
|
||||||
**********************************************************************
|
|
||||||
|
|
||||||
This file is included in every file that highlights the "alerts" keywords.
|
|
||||||
That's why extensions and mimetype are empty.
|
|
||||||
|
|
||||||
Changes by Alex Turbov:
|
|
||||||
Introduce 3 alert levels and sort keywords according importance.
|
|
||||||
Few more keywords has been added.
|
|
||||||
-->
|
|
||||||
<language version="3" kateversion="3.1" name="Alerts" section="Other" extensions="" mimetype="" author="Dominik Haumann (dhdev@gmx.de)" license="LGPLv2+" hidden="true">
|
|
||||||
<highlighting>
|
<highlighting>
|
||||||
<list name="alerts_hi">
|
<list name="alerts_hi">
|
||||||
<item>ALERT</item>
|
<item>ALERT</item>
|
||||||
@@ -61,8 +31,8 @@
|
|||||||
<context attribute="Normal Text" lineEndContext="#pop" name="Normal Text" >
|
<context attribute="Normal Text" lineEndContext="#pop" name="Normal Text" >
|
||||||
<StringDetect attribute="Region Marker" context="#stay" String="{{{" beginRegion="AlertRegion1" />
|
<StringDetect attribute="Region Marker" context="#stay" String="{{{" beginRegion="AlertRegion1" />
|
||||||
<StringDetect attribute="Region Marker" context="#stay" String="}}}" endRegion="AlertRegion1" />
|
<StringDetect attribute="Region Marker" context="#stay" String="}}}" endRegion="AlertRegion1" />
|
||||||
<StringDetect attribute="Region Marker" context="#stay" String="BEGIN" beginRegion="AlertRegion2" />
|
<WordDetect attribute="Region Marker" context="#stay" String="BEGIN" beginRegion="AlertRegion2" />
|
||||||
<StringDetect attribute="Region Marker" context="#stay" String="END" endRegion="AlertRegion2" />
|
<WordDetect attribute="Region Marker" context="#stay" String="END" endRegion="AlertRegion2" />
|
||||||
<keyword attribute="Alert Level 1" context="#stay" String="alerts_hi" />
|
<keyword attribute="Alert Level 1" context="#stay" String="alerts_hi" />
|
||||||
<keyword attribute="Alert Level 2" context="#stay" String="alerts_mid" />
|
<keyword attribute="Alert Level 2" context="#stay" String="alerts_mid" />
|
||||||
<keyword attribute="Alert Level 3" context="#stay" String="alerts_lo" />
|
<keyword attribute="Alert Level 3" context="#stay" String="alerts_lo" />
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<!ENTITY noword "(?![\w$+-])"> <!-- no word, $, + or - following -->
|
<!ENTITY noword "(?![\w$+-])"> <!-- no word, $, + or - following -->
|
||||||
<!ENTITY pathpart "([\w_@.%*?+-]|\\ )"> <!-- valid character in a file name -->
|
<!ENTITY pathpart "([\w_@.%*?+-]|\\ )"> <!-- valid character in a file name -->
|
||||||
]>
|
]>
|
||||||
<language name="Bash" version="3" kateversion="5.0" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
<language name="Bash" version="4" kateversion="5.0" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
||||||
|
|
||||||
<!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl)
|
<!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl)
|
||||||
Changes by Matthew Woehlke (mw_triad@users.sourceforge.net)
|
Changes by Matthew Woehlke (mw_triad@users.sourceforge.net)
|
||||||
@@ -587,7 +587,8 @@
|
|||||||
<RegExpr attribute="Redirection" context="#stay" String="([0-9]*(>{1,2}|<)(&[0-9]+-?)?|&>|>&|[0-9]*<>)" />
|
<RegExpr attribute="Redirection" context="#stay" String="([0-9]*(>{1,2}|<)(&[0-9]+-?)?|&>|>&|[0-9]*<>)" />
|
||||||
<!-- handle &, &&, | and || -->
|
<!-- handle &, &&, | and || -->
|
||||||
<RegExpr attribute="Control" context="#pop" String="([|&;])\1?" />
|
<RegExpr attribute="Control" context="#pop" String="([|&;])\1?" />
|
||||||
<RegExpr attribute="Option" context="#stay" String="-?-[a-z][A-Za-z0-9_-]*" />
|
<RegExpr attribute="Normal Text" context="#stay" String="[a-zA-Z_]+-[A-Za-z0-9_-]*" />
|
||||||
|
<RegExpr attribute="Option" context="#stay" String="-?-[a-zA-Z_][A-Za-z0-9_-]*" />
|
||||||
<keyword attribute="Option" context="#stay" String="keywords" />
|
<keyword attribute="Option" context="#stay" String="keywords" />
|
||||||
<AnyChar String=")}" context="#pop" lookAhead="true"/>
|
<AnyChar String=")}" context="#pop" lookAhead="true"/>
|
||||||
</context>
|
</context>
|
||||||
|
@@ -3,39 +3,14 @@
|
|||||||
[
|
[
|
||||||
<!ENTITY wordsep "([][,?;()]|\.$|\.?\s)"> <!-- things that end a TagWord -->
|
<!ENTITY wordsep "([][,?;()]|\.$|\.?\s)"> <!-- things that end a TagWord -->
|
||||||
]>
|
]>
|
||||||
<!--
|
|
||||||
This file is part of KDE's kate project.
|
|
||||||
|
|
||||||
Copyright 2004 Dominik Haumann (dhdev@gmx.de)
|
|
||||||
Copyright 2007 Matthew Woehlke (mw_triad@users.sourceforge.net)
|
|
||||||
Copyright 2009-2013 Alex Turbov (I.zaufi@gmail.com)
|
|
||||||
|
|
||||||
**********************************************************************
|
|
||||||
* This library is free software; you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU Lesser General Public *
|
|
||||||
* License as published by the Free Software Foundation; either *
|
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This library is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
||||||
* Lesser General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU Lesser General Public *
|
|
||||||
* License along with this library; if not, write to the *
|
|
||||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
|
|
||||||
* Boston, MA 02110-1301, USA. *
|
|
||||||
**********************************************************************
|
|
||||||
-->
|
|
||||||
|
|
||||||
<language name="Doxygen"
|
<language name="Doxygen"
|
||||||
version="3"
|
version="4"
|
||||||
kateversion="5.0"
|
kateversion="5.0"
|
||||||
section="Markup"
|
section="Markup"
|
||||||
extensions="*.dox;*.doxygen"
|
extensions="*.dox;*.doxygen"
|
||||||
mimetype="text/x-doxygen"
|
mimetype="text/x-doxygen"
|
||||||
author="Dominik Haumann (dhdev@gmx.de)"
|
author="Dominik Haumann (dhaumann@kde.org)"
|
||||||
license="LGPLv2+"
|
license="MIT"
|
||||||
priority="9">
|
priority="9">
|
||||||
<highlighting>
|
<highlighting>
|
||||||
<!-- NOTE: all tags may begin with a \ or @ char
|
<!-- NOTE: all tags may begin with a \ or @ char
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
Enhance tr/// and y/// support.
|
Enhance tr/// and y/// support.
|
||||||
-->
|
-->
|
||||||
<language name="Perl" version="3" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
|
<language name="Perl" version="4" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
|
||||||
<highlighting>
|
<highlighting>
|
||||||
<list name="keywords">
|
<list name="keywords">
|
||||||
<item>if</item>
|
<item>if</item>
|
||||||
@@ -744,14 +744,14 @@
|
|||||||
<RegExpr attribute="Keyword" context="here_document_dumb" String="\s*'([^']+)'\s*;?" />
|
<RegExpr attribute="Keyword" context="here_document_dumb" String="\s*'([^']+)'\s*;?" />
|
||||||
</context>
|
</context>
|
||||||
<context name="here_document" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true">
|
<context name="here_document" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true">
|
||||||
<DetectSpaces />
|
<RegExpr attribute="Keyword" context="#pop#pop" String="%1\b" column="0" dynamic="true" endRegion="HereDocument"/>
|
||||||
<RegExpr attribute="Keyword" context="#pop#pop" String="^%1\b" column="0" dynamic="true" endRegion="HereDocument"/>
|
|
||||||
<RegExpr attribute="Keyword" context="here_document" String="\=\s*<<\s*["']?([A-Z0-9_\-]+)["']?" beginRegion="HEREDoc" />
|
<RegExpr attribute="Keyword" context="here_document" String="\=\s*<<\s*["']?([A-Z0-9_\-]+)["']?" beginRegion="HEREDoc" />
|
||||||
<IncludeRules context="ipstring_internal" />
|
<IncludeRules context="ipstring_internal" />
|
||||||
|
<DetectSpaces />
|
||||||
</context>
|
</context>
|
||||||
<context name="here_document_dumb" attribute="Normal Text" lineEndContext="#stay" dynamic="true">
|
<context name="here_document_dumb" attribute="Normal Text" lineEndContext="#stay" dynamic="true">
|
||||||
<DetectSpaces />
|
|
||||||
<RegExpr attribute="Keyword" context="#pop#pop" String="%1" column="0" dynamic="true" endRegion="HereDocument"/>
|
<RegExpr attribute="Keyword" context="#pop#pop" String="%1" column="0" dynamic="true" endRegion="HereDocument"/>
|
||||||
|
<DetectSpaces />
|
||||||
<DetectIdentifier />
|
<DetectIdentifier />
|
||||||
</context>
|
</context>
|
||||||
|
|
||||||
|
16
src/share/3rdparty/generic-highlighter/ruby.xml
vendored
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". -->
|
<!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". -->
|
||||||
<language name="Ruby" section="Scripts"
|
<language name="Ruby" section="Scripts"
|
||||||
version="3" kateversion="3.3"
|
version="4" kateversion="3.3"
|
||||||
extensions="*.rb;*.rjs;*.rxml;*.xml.erb;*.js.erb;*.rake;Rakefile;Gemfile;*.gemspec;Vagrantfile"
|
extensions="*.rb;*.rjs;*.rxml;*.xml.erb;*.js.erb;*.rake;Rakefile;Gemfile;*.gemspec;Vagrantfile"
|
||||||
mimetype="application/x-ruby"
|
mimetype="application/x-ruby"
|
||||||
style="ruby" indenter="ruby"
|
style="ruby" indenter="ruby"
|
||||||
@@ -204,14 +204,14 @@
|
|||||||
<RegExpr attribute="Keyword" String="\;\s*(while|until)\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/>
|
<RegExpr attribute="Keyword" String="\;\s*(while|until)\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" beginRegion="def block" firstNonSpace="true"/>
|
<RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" beginRegion="def block" firstNonSpace="true"/>
|
||||||
<RegExpr attribute="Keyword" String="\;\s*(if|unless)\b" context="#stay" beginRegion="def block"/>
|
<RegExpr attribute="Keyword" String="\;\s*(if|unless)\b" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bclass\b" context="#stay" beginRegion="def block"/>
|
<WordDetect attribute="Keyword" String="class" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bmodule\b" context="#stay" beginRegion="def block"/>
|
<WordDetect attribute="Keyword" String="module" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bbegin\b" context="#stay" beginRegion="def block"/>
|
<WordDetect attribute="Keyword" String="begin" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bfor\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/>
|
<RegExpr attribute="Keyword" String="\bfor\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bcase\b" context="#stay" beginRegion="def block"/>
|
<WordDetect attribute="Keyword" String="case" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bdo\b" context="#stay" beginRegion="def block"/>
|
<WordDetect attribute="Keyword" String="do" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bdef\b" context="#stay" beginRegion="def block"/>
|
<WordDetect attribute="Keyword" String="def" context="#stay" beginRegion="def block"/>
|
||||||
<RegExpr attribute="Keyword" String="\bend\b" context="#stay" endRegion="def block"/>
|
<WordDetect attribute="Keyword" String="end" context="#stay" endRegion="def block"/>
|
||||||
<!-- elsif/else close the current block and start a new one -->
|
<!-- elsif/else close the current block and start a new one -->
|
||||||
<RegExpr attribute="Keyword" String="\b(else|elsif|rescue|ensure)\b" context="#stay" endRegion="def block" beginRegion="def block"/>
|
<RegExpr attribute="Keyword" String="\b(else|elsif|rescue|ensure)\b" context="#stay" endRegion="def block" beginRegion="def block"/>
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<!ENTITY name "(?![0-9])[\w_:][\w.:_-]*">
|
<!ENTITY name "(?![0-9])[\w_:][\w.:_-]*">
|
||||||
<!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
|
<!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
|
||||||
]>
|
]>
|
||||||
<language name="XML" version="5" kateversion="3.4" section="Markup" extensions="*.docbook;*.xml;*.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl;*.scxml" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/xml;application/scxml+xml" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
<language name="XML" version="6" kateversion="3.4" section="Markup" extensions="*.docbook;*.xml;*.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl;*.scxml;*.xbel" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/x-xbel;application/xml;application/scxml+xml" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
||||||
|
|
||||||
<highlighting>
|
<highlighting>
|
||||||
<contexts>
|
<contexts>
|
||||||
|
@@ -198,13 +198,8 @@ void IndexWindow::open(const QModelIndex &index, bool newPage)
|
|||||||
{
|
{
|
||||||
QString keyword = m_filteredIndexModel->data(index, Qt::DisplayRole).toString();
|
QString keyword = m_filteredIndexModel->data(index, Qt::DisplayRole).toString();
|
||||||
QMap<QString, QUrl> links = LocalHelpManager::helpEngine().indexModel()->linksForKeyword(keyword);
|
QMap<QString, QUrl> links = LocalHelpManager::helpEngine().indexModel()->linksForKeyword(keyword);
|
||||||
|
|
||||||
if (links.size() == 1) {
|
|
||||||
emit linkActivated(links.first(), newPage);
|
|
||||||
} else if (links.size() > 1) {
|
|
||||||
emit linksActivated(links, keyword, newPage);
|
emit linksActivated(links, keyword, newPage);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Qt::DropActions IndexFilterModel::supportedDragActions() const
|
Qt::DropActions IndexFilterModel::supportedDragActions() const
|
||||||
{
|
{
|
||||||
|
@@ -88,7 +88,6 @@ public:
|
|||||||
void setOpenInNewPageActionVisible(bool visible);
|
void setOpenInNewPageActionVisible(bool visible);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void linkActivated(const QUrl &link, bool newPage);
|
|
||||||
void linksActivated(const QMap<QString, QUrl> &links,
|
void linksActivated(const QMap<QString, QUrl> &links,
|
||||||
const QString &keyword, bool newPage);
|
const QString &keyword, bool newPage);
|
||||||
|
|
||||||
|
@@ -494,7 +494,7 @@ TEST_F(Cursor, HasOutputValues)
|
|||||||
|
|
||||||
auto outputArgumentLocations = callExpressionCursor.outputArgumentRanges();
|
auto outputArgumentLocations = callExpressionCursor.outputArgumentRanges();
|
||||||
|
|
||||||
ASSERT_THAT(outputArgumentLocations.size(), 2);
|
ASSERT_THAT(outputArgumentLocations.size(), 1);
|
||||||
ASSERT_THAT(outputArgumentLocations[0], outputArgumentExpectedSourceLocation);
|
ASSERT_THAT(outputArgumentLocations[0], outputArgumentExpectedSourceLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,13 +749,13 @@ TEST_F(Cursor, PointerIsNotRefencingConstant)
|
|||||||
ASSERT_FALSE(argument.isReferencingConstant());
|
ASSERT_FALSE(argument.isReferencingConstant());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, PointerIsOutputArgument)
|
TEST_F(Cursor, PointerIsNotOutputArgument)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnit.cursorAt(127, 13);
|
auto callExpressionCursor = translationUnit.cursorAt(127, 13);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
ASSERT_TRUE(argument.isOutputArgument());
|
ASSERT_FALSE(argument.isOutputArgument());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, ConstantReferenceIsNotOutputArgument)
|
TEST_F(Cursor, ConstantReferenceIsNotOutputArgument)
|
||||||
@@ -782,7 +782,7 @@ TEST_F(Cursor, ConstantPointerIsNotOutputArgument)
|
|||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
ASSERT_TRUE(argument.isOutputArgument());
|
ASSERT_FALSE(argument.isOutputArgument());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, ReferenceIsOutputArgument)
|
TEST_F(Cursor, ReferenceIsOutputArgument)
|
||||||
|