Merge remote-tracking branch 'origin/7.0'

Change-Id: I967615c66a11bb4823a6b403ca59e63dd1971032
This commit is contained in:
Eike Ziller
2022-02-07 16:34:41 +01:00
171 changed files with 1933 additions and 610 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2022 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.
@@ -31,17 +31,31 @@
\title CMake Build Configuration \title CMake Build Configuration
Configuring medium-sized to large CMake projects in \QC can be a Configuring medium-sized to large CMake projects in \QC can be a
challenge due to the number of options that you need to pass to challenge due to the number of variables that you need to pass to
CMake to configure the project correctly. To make this easier, CMake to configure the project correctly. To make this easier,
\QC creates an initial configuration for you based on the kit \QC creates an initial configuration for you based on the kit
settings and displays it in the \uicontrol {Initial CMake parameters} settings and displays it in \uicontrol {Initial Configuration} in
field and in a table that lists the parameter names and values. the \l{Specifying Build Settings}{Build Settings} of the project.
\image qtcreator-cmake-build-settings-initial.png "CMake build settings" \image qtcreator-cmake-build-settings-initial.png "CMake build settings"
Parameter names are listed in the \uicontrol Key column. Names with a You can view and edit the actual values of the variables that are passed
common prefix (up to the first underscore character) are grouped under to CMake. Variable names are listed in the \uicontrol Key column and their
the prefix. current values in the \uicontrol Value column. For more information
about the available variables, see \l{CMake: cmake-variables(7)}.
For more information about Qt-specific variables, see
\l{CMake Variable Reference}.
You can specify additional CMake options, such as \c {--find-debug},
\c {--preset}, \c {--trace-expand}, or \c {--warn-uninitialized}, in
\uicontrol {Additional CMake options}. For more information about
the available options, see \l{CMake: cmake(1)}.
After successfully running CMake, you can view and modify the current
configuration in \uicontrol {Current Configuration}.
Select \uicontrol {Kit Configuration} to edit the CMake settings for the
build and run kit selected for the project.
\section1 Multi-Config Support \section1 Multi-Config Support
@@ -59,35 +73,36 @@
When developing with Qt 6 for iOS, only the Xcode generator is supported. When developing with Qt 6 for iOS, only the Xcode generator is supported.
\section1 Modifying Initial Parameters \section1 Modifying Variable Values
In the \uicontrol Value column, you can view and edit the actual values You can view and edit the actual values of the variables that
of the parameters that are passed to CMake. are passed to CMake in \uicontrol {Initial Configuration} or
\uicontrol {Current Configuration}.
\image qtcreator-cmake-build-settings.png "CMake parameters" \image qtcreator-cmake-build-settings.png "CMake variables"
To view all parameters, select the \uicontrol Advanced check box. To view all variables, select the \uicontrol Advanced check box.
To add parameters, select \uicontrol Add, and then select the type of To add variables, select \uicontrol Add, and then select the type of
the parameter that you are adding: \uicontrol Boolean, \uicontrol String, the variable that you are adding: \uicontrol Boolean, \uicontrol String,
\uicontrol Directory, or \uicontrol File. \uicontrol Directory, or \uicontrol File.
To change the type of the selected parameter, right-click the To change the type of the selected variable, right-click the
parameter name in the \uicontrol Key column, and then select variable name in the \uicontrol Key column, and then select
\uicontrol {Force to bool}, \uicontrol {Force to file}, \uicontrol {Force to bool}, \uicontrol {Force to file},
\uicontrol {Force to directory}, or \uicontrol {Force to string} \uicontrol {Force to directory}, or \uicontrol {Force to string}
in the context menu. in the context menu.
To copy the name or value of the selected parameter to the clipboard, To copy the name or value of the selected variable to the clipboard,
select \uicontrol Copy in the context menu. select \uicontrol Copy in the context menu.
To modify the value of a parameter, double-click it, or select it, To modify the value of a variable, double-click it, or select it,
and then select \uicontrol Edit. and then select \uicontrol Edit.
You can apply actions to multiple parameters at a time. To clear You can apply actions to multiple variables at a time. To clear
the selection, select \uicontrol {Clear Selection}. the selection, select \uicontrol {Clear Selection}.
To remove the selected parameters, select \uicontrol Unset. To undo To remove the selected variables, select \uicontrol Unset. To undo
the removal, select \uicontrol Set. the removal, select \uicontrol Set.
To reset all the changes that you made, select \uicontrol Reset. To reset all the changes that you made, select \uicontrol Reset.
@@ -95,23 +110,27 @@
To modify the environment variable values for the CMake build environment, To modify the environment variable values for the CMake build environment,
select \uicontrol {Batch Edit}. For more information, see \l{Batch Editing}. select \uicontrol {Batch Edit}. For more information, see \l{Batch Editing}.
To save the changes, select \uicontrol {Apply Configuration Changes}. To build using the current configuration, select \uicontrol {Run CMake}.
Keep in mind that a configuration change might trigger a follow-up While building, the button text changes to \uicontrol {Stop CMake}. Select
configuration change. the button to cancel the current build.
The parameter values that you change are passed via \c -D<option>=<value> The variable values that you change are passed via \c -D<option>=<value>
to CMake, which stores the options in the CMakeCache.txt file. This means to CMake, which stores the options in the CMakeCache.txt file. This means
that if you remove the build directory, all the custom parameters that are that if you remove the build directory, all the custom variables that are
not part of the initial CMake parameters are also removed. not part of the initial CMake configuration are also removed.
To reconfigure a project using the modified parameters, To reconfigure a project using the modified variable values,
select \uicontrol Build > \uicontrol {Clear CMake Configuration}, which select \uicontrol Build > \uicontrol {Clear CMake Configuration}, which
removes the CMakeCache.txt file. This enables you to do a full rebuild. removes the CMakeCache.txt file. This enables you to do a full rebuild.
\section1 Re-configuring with Initial Parameters \section1 Re-configuring with Initial Variables
To reset CMake parameters to the initial ones, select To reset CMake variables to the initial ones, select
\uicontrol {Re-configure with Initial Parameters}. \uicontrol {Re-configure with Initial Variables} in
\uicontrol {Initial Configuration}. \QC deletes the current CMake
configuration and runs CMake. The initial configuration values are
stored in the CMakeLists.txt.user file, so deleting a build directory
does not delete the initial configuration.
To be asked before \QC resets the changes, select \uicontrol Tools > To be asked before \QC resets the changes, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol CMake > \uicontrol Options > \uicontrol {Build & Run} > \uicontrol CMake >
@@ -167,14 +186,16 @@
\li Install Ninja. \li Install Ninja.
\li Add the path to the Ninja executable to the value of the PATH system \li Add the path to the Ninja executable to the value of the PATH system
variable. variable.
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Kits, and \li In \uicontrol Projects > \uicontrol {Build & Run} > \uicontrol Build
then select the build and run kit for the project. > \uicontrol {Build Settings}, select \uicontrol {Kit Configuration}.
\image qtcreator-cmake-kit-configuration.png "Kit CMake Configuration dialog"
\li Select \uicontrol Change next to the \uicontrol {CMake generator} \li Select \uicontrol Change next to the \uicontrol {CMake generator}
field to open the \uicontrol {CMake Generator} dialog. field to open the \uicontrol {CMake Generator} dialog.
\image qtcreator-build-steps-cmake-ninja.png \image qtcreator-cmake-generator.png "CMake Generator dialog"
\li In the \uicontrol Generator field, select \uicontrol Ninja. \li In \uicontrol Generator, select \uicontrol Ninja.
\li Select \uicontrol OK to return to the \uicontrol Kits tab. \li Select \uicontrol OK to save your changes and close the dialog.
\li Select \uicontrol OK or \uicontrol Apply to save your changes. \li Close the \uicontrol {Kit CMake Configuration} dialog to return to
\uicontrol {Build Settings}.
\endlist \endlist
\note To make sure that old build artifacts don't get in the way \note To make sure that old build artifacts don't get in the way

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2022 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.
@@ -37,7 +37,9 @@
\li Press \key {Ctrl+F} or select \uicontrol Edit > \li Press \key {Ctrl+F} or select \uicontrol Edit >
\uicontrol {Find/Replace} > \uicontrol {Find/Replace}. \uicontrol {Find/Replace} > \uicontrol {Find/Replace}.
\li Enter the text you are looking for. \li In \uicontrol Find, enter the text you are looking for.
\image qtcreator-find-incremental.png
If the text is found, all occurrences are highlighted as you type. If the text is found, all occurrences are highlighted as you type.
@@ -46,10 +48,14 @@
occurrence click \inlineimage icons/prev.png occurrence click \inlineimage icons/prev.png
(\uicontrol {Find Previous}), or press \key {Shift+F3}. (\uicontrol {Find Previous}), or press \key {Shift+F3}.
\li To select all found occurrences in a file, select
\uicontrol {Select All}.
\endlist \endlist
You can restrict the search in the \uicontrol Find field by selecting one You can restrict the search in the \uicontrol Find field by selecting
or several search criteria: \inlineimage icons/qtcreator-new-search-icon.png
. Select one or several search criteria:
\list \list
@@ -114,6 +120,8 @@
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} > \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
\uicontrol Display > \uicontrol {Highlight search results on the scrollbar}. \uicontrol Display > \uicontrol {Highlight search results on the scrollbar}.
To search using more advanced options, select \uicontrol Advanced.
\section1 Advanced Search \section1 Advanced Search
To search through projects, files on a file system, files in all project To search through projects, files on a file system, files in all project

View File

@@ -113,6 +113,14 @@
\externalpage https://doc.qt.io/QtApplicationManager/ \externalpage https://doc.qt.io/QtApplicationManager/
\title Qt Application Manager \title Qt Application Manager
*/ */
/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake.1.html
\title CMake: cmake(1)
*/
/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html
\title CMake: cmake-variables(7)
*/
/*! /*!
\externalpage https://cmake.org/cmake/help/latest/command/install.html \externalpage https://cmake.org/cmake/help/latest/command/install.html
\title CMake: install command \title CMake: install command

View File

@@ -0,0 +1,97 @@
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\page creator-logging-viewer.html
\if defined(qtdesignstudio)
\previouspage creator-quick-ui-forms.html
\else
\previouspage creator-task-lists.html
\endif
\nextpage creator-telemetry.html
\title Inspecting Internal Logs
You can inspect internal log messages of \QC at runtime without having to
restart it or configure the logging rules. Log messages are helpful when
you develop \QC, need to investigate some problem you are facing, or want
to take a look behind the scenes.
To open the log viewer and start collecting log information, select
\uicontrol Tools > \uicontrol {Debug \QC} > \uicontrol {Show Logs}.
\image qtcreator-logging-category-viewer.png
The viewer displays log messages from the selected logging categories.
If you have logging rules defined, they might be listed on startup.
Otherwise, the list of categories is extended while you are using \QC.
\note Messages are not cached, so the viewer displays only messages that
are recorded after you enabled a category.
\section1 Viewing Logs
To enable logging categories, select them in \uicontrol Category.
\uicontrol Type specifies the minimum level of messages to display from
the respective category. To change the minimum level, double-click the
type and select another value.
If you enable more than one category, you can specify different colors for
the messages in each category. Double-click the value of \uicontrol Color to
pick colors for the categories.
To store information about the currently enabled categories, select
\uicontrol {Save Enabled as Preset} in the context-menu. To load the
saved information, select \uicontrol {Update from Preset}.
To save the content of the displayed messages, select
\inlineimage icons/savefile.png
(\uicontrol {Save Log}). To copy all or selected messages, select
\uicontrol {Copy All} or \uicontrol {Copy Selected Logs} in the
context menu.
To clean the content of displayed messages select
\inlineimage icons/clean_pane_small.png
(\uicontrol Clear).
To temporarily stop logging, select \inlineimage icons/stop_small.png
(\uicontrol {Stop Logging}). To continue logging, select
\inlineimage icons/run_small.png
(\uicontrol {Start Logging}).
By default, logging categories and messages coming directly from Qt are
disabled. To display them, select \inlineimage icons/qtlogo-16.png
(\uicontrol {Toggle logging of Qt internal loggings.})
New messages automatically scroll the message display to the bottom.
To stop automatic scrolling, toggle \inlineimage icons/arrowdown.png
(\uicontrol {Auto Scroll}).
By default, messages are listed with a timestamp, without message
type. To hide and show this information, toggle
\inlineimage icons/stopwatch.png
(\uicontrol Timestamps) and \inlineimage icons/message.png
(\uicontrol {Message Types}).
*/

View File

@@ -32,7 +32,7 @@
/*! /*!
\previouspage creator-editor-external.html \previouspage creator-editor-external.html
\page creator-task-lists.html \page creator-task-lists.html
\nextpage creator-telemetry.html \nextpage creator-logging-viewer.html
\title Showing Task List Files in Issues Pane \title Showing Task List Files in Issues Pane

View File

@@ -28,7 +28,7 @@
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
\previouspage creator-quick-ui-forms.html \previouspage creator-quick-ui-forms.html
\else \else
\previouspage creator-task-lists.html \previouspage creator-logging-viewer.html
\endif \endif
\nextpage collecting-usage-statistics.html \nextpage collecting-usage-statistics.html

View File

@@ -57,7 +57,7 @@
The process to add files to deploy depends on the build system you use. The process to add files to deploy depends on the build system you use.
\section2 CMake \section2 CMake Builds
When using CMake as the build system, use the \l{CMake: install command} When using CMake as the build system, use the \l{CMake: install command}
{install} command in the CMakeLists.txt file to add the missing files. {install} command in the CMakeLists.txt file to add the missing files.
@@ -75,7 +75,7 @@
) )
\endcode \endcode
\section2 qmake \section2 qmake Builds
When using qmake, edit the \l{Variables#installs}{INSTALLS variable} in When using qmake, edit the \l{Variables#installs}{INSTALLS variable} in
the project \c .pro file. the project \c .pro file.

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2022 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.
@@ -95,6 +95,11 @@
corresponding source code by clicking the error message or by using corresponding source code by clicking the error message or by using
keyboard shortcuts. keyboard shortcuts.
\li \l{Inspecting Internal Logs}
You can inspect internal log messages of \QC. They may be
helpful when developing \QC or investigating problems.
\li \l{Managing Data Collection} \li \l{Managing Data Collection}
If you agreed to pseudonymous data collection during \QC If you agreed to pseudonymous data collection during \QC

View File

@@ -113,6 +113,16 @@
git ls-files "*.cpp" "*.h" > MyProject.files git ls-files "*.cpp" "*.h" > MyProject.files
\endcode \endcode
\section2 Precompiled Headers
To use precompiled headers in a generic project, add the \c pch tag after
a file path in the \c .files file, separated by the pipe character (|).
For example:
\badcode
src/pch.h|pch
\endcode
\section1 Specifying Include Paths and Framework Paths \section1 Specifying Include Paths and Framework Paths
The include paths are specified in the \tt{.includes} file, one include The include paths are specified in the \tt{.includes} file, one include

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2022 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.
@@ -57,9 +57,11 @@
\section1 Managing Build Configurations \section1 Managing Build Configurations
Specify build settings in \uicontrol Projects > \uicontrol {Build & Run}
> \uicontrol Build > \uicontrol {Build Settings}.
\image qtcreator-build-configurations.png "Build Settings" \image qtcreator-build-configurations.png "Build Settings"
You specify build settings in the \uicontrol Projects mode.
To add a new build configuration, click \uicontrol Add and select the type of To add a new build configuration, click \uicontrol Add and select the type of
configuration you would like to add. The options you have depend on the configuration you would like to add. The options you have depend on the
build system that you selected for the project. You can add as many build build system that you selected for the project. You can add as many build

View File

@@ -228,6 +228,7 @@
\li \l{Keyboard Shortcuts} \li \l{Keyboard Shortcuts}
\li \l{Using External Tools} \li \l{Using External Tools}
\li \l{Showing Task List Files in Issues Pane} \li \l{Showing Task List Files in Issues Pane}
\li \l{Inspecting Internal Logs}
\li \l{Managing Data Collection} \li \l{Managing Data Collection}
\list \list
\li \l {Collecting Usage Statistics} \li \l {Collecting Usage Statistics}

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2022 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.
@@ -107,8 +107,11 @@
algorithm for calculating the differences, select \uicontrol Patience. algorithm for calculating the differences, select \uicontrol Patience.
To only show text changes, select \uicontrol {Ignore Whitespace}. To only show text changes, select \uicontrol {Ignore Whitespace}.
To filter log entries by the text in the commit message or by strings that To filter log entries by the text in the commit message, by strings that
were added or removed, select \uicontrol Filter. were added or removed, or by author, select \uicontrol Filter. Enter a
search sting in the \uicontrol {Filter by message},
\uicontrol {Filter by content}, or \uicontrol {Filter by author} field.
Select \uicontrol {Case Sensitive} to make filtering consider case.
To follow only the first parent on merge commits, select To follow only the first parent on merge commits, select
\uicontrol {First Parent}. \uicontrol {First Parent}.
@@ -116,6 +119,9 @@
To toggle between textual and visual representation of the log, select To toggle between textual and visual representation of the log, select
\uicontrol Graph. \uicontrol Graph.
To toggle color coding of different parts of the log entries, select
\uicontrol Color.
To show log also for previous names of the file, select \uicontrol Follow. To show log also for previous names of the file, select \uicontrol Follow.
Select \inlineimage icons/reload_gray.png Select \inlineimage icons/reload_gray.png

View File

@@ -0,0 +1,21 @@
import qbs
import qbs.FileInfo
QtcProduct {
type: ["application"]
Depends { name: "Qt.testlib" }
Depends { name: "copyable_resource" }
targetName: "tst_" + name.split(' ').join("")
cpp.rpaths: [
project.buildDirectory + '/' + qtc.ide_library_path,
project.buildDirectory + '/' + qtc.ide_plugin_path
]
cpp.defines: {
var defines = base.filter(function(d) { return d !== "QT_RESTRICTED_CAST_FROM_ASCII"; });
return defines;
}
install: false
}

View File

@@ -4,7 +4,7 @@ import qbs.FileInfo
Project { Project {
name: "Qt Creator" name: "Qt Creator"
minimumQbsVersion: "1.8.0" minimumQbsVersion: "1.19.0"
property string minimumMacosVersion: "10.12" property string minimumMacosVersion: "10.12"
property bool withAutotests: qbs.buildVariant === "debug" property bool withAutotests: qbs.buildVariant === "debug"
property path ide_source_tree: path property path ide_source_tree: path

View File

@@ -181,6 +181,15 @@ def diffContext(ctx, old, new):
return report return report
def stringify(obj):
stringTypes = (str, unicode) if sys.version_info.major == 2 else (str)
if isinstance(obj, stringTypes):
return obj
if isinstance(obj, bytes):
tmp = obj.decode('cp1252') if platform.system() in ('Microsoft','Windows') else obj.decode()
return tmp
# --- The main program # --- The main program
oldGenerator = Generator() oldGenerator = Generator()
@@ -203,21 +212,21 @@ newContextSet = set(newTree.keys())
for c in sorted(oldContextSet.difference(newContextSet)): for c in sorted(oldContextSet.difference(newContextSet)):
report = diffContext(c, oldTree[c], {}) report = diffContext(c, oldTree[c], {})
if report: if report:
print(report.encode('utf-8')) print(stringify(report.encode('utf-8')))
else: else:
unchangedContexts += 1 unchangedContexts += 1
for c in sorted(newContextSet.difference(oldContextSet)): for c in sorted(newContextSet.difference(oldContextSet)):
report = diffContext(c, {}, newTree[c]) report = diffContext(c, {}, newTree[c])
if report: if report:
print(report.encode('utf-8')) print(stringify(report.encode('utf-8')))
else: else:
unchangedContexts += 1 unchangedContexts += 1
for c in sorted(newContextSet.intersection(oldContextSet)): for c in sorted(newContextSet.intersection(oldContextSet)):
report = diffContext(c, oldTree[c], newTree[c]) report = diffContext(c, oldTree[c], newTree[c])
if report: if report:
print(report.encode('utf-8')) print(stringify(report.encode('utf-8')))
else: else:
unchangedContexts += 1 unchangedContexts += 1

View File

@@ -11,7 +11,10 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Widgets REQUIRED) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED)
set_property(SOURCE clazy_example.cpp icontest.cpp PROPERTY SKIP_AUTOMOC ON)
add_executable(examples add_executable(examples
clazy_example.cpp clazy_example.cpp
@@ -20,4 +23,4 @@ add_executable(examples
tidy_example.h tidy_example.h
) )
target_link_libraries(examples PRIVATE Qt5::Widgets) target_link_libraries(examples PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -113,9 +113,6 @@ TestObject::TestObject()
for (auto obj : list) { for (auto obj : list) {
} }
// -Wclazy-qdatetime-utc
QDateTime::currentDateTime().toTime_t();
// -Wclazy-qfileinfo-exists // -Wclazy-qfileinfo-exists
// -Wclazy-qstring-allocations // -Wclazy-qstring-allocations
QFileInfo("filename").exists(); QFileInfo("filename").exists();
@@ -134,8 +131,5 @@ TestObject::TestObject()
str.mid(5).toInt(&ok); str.mid(5).toInt(&ok);
// -Wclazy-qstring-arg // -Wclazy-qstring-arg
QString("%1 %2").arg("1").arg("2"); (void) QString("%1 %2").arg("1").arg("2");
} }
// Note: A fatal error like an unresolved include will make clazy stop emitting any diagnostics.
// #include "clazy_example.moc"

View File

@@ -27,12 +27,13 @@
#define Macro #define Macro
class Class { class Class : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Q_PROPERTY(bool property READ readProperty CONSTANT); Q_PROPERTY(int property READ publicStaticFunction CONSTANT)
void publicFunction(); int publicFunction() { return 0; }
void static publicStaticFunction(); int static publicStaticFunction() { return 0; }
template<int> void publicTemplateFunction(); template<int> void publicTemplateFunction();
template<int> void static publicStaticTemplateFunction(); template<int> void static publicStaticTemplateFunction();
@@ -43,8 +44,8 @@ signals:
void signal(); void signal();
public slots: public slots:
void publicSlot(); void publicSlot() {}
template<int> void publicTemplateSlot(); // template<int> void publicTemplateSlot() {}
protected: protected:
void protectedFunction(); void protectedFunction();
@@ -56,8 +57,8 @@ protected:
int static protectedStaticVariable; int static protectedStaticVariable;
protected slots: protected slots:
void protectedSlot(); void protectedSlot() {}
template<int> void protectedTemplateSlot(); // template<int> void protectedTemplateSlot() {}
private: private:
void privateFunction(); void privateFunction();
@@ -67,9 +68,10 @@ private:
template<int> void static privateStaticTemplateFunction(); template<int> void static privateStaticTemplateFunction();
private slots: private slots:
void privateSlot(); void privateSlot() {}
template<int> void privateTemplateSlot(); // template<int> void privateTemplateSlot() {}
private:
int privateVariable; int privateVariable;
int static privateStaticVariable; int static privateStaticVariable;
}; };

View File

@@ -71,7 +71,7 @@ public:
// misc-noexcept-move-constructor // misc-noexcept-move-constructor
// misc-unconventional-assign-operator // misc-unconventional-assign-operator
// misc-unused-parameters // misc-unused-parameters
Base operator=(Base &&param) {} Base operator=(Base &&param) { return {}; }
virtual int function() virtual int function()
{ {
// modernize-use-nullptr // modernize-use-nullptr
@@ -116,7 +116,7 @@ void afterMove(Base &&base)
Base moved(std::move(base)); Base moved(std::move(base));
// misc-use-after-move // misc-use-after-move
base.value; (void) base.value;
} }
// google-runtime-references // google-runtime-references
@@ -144,7 +144,7 @@ public:
auto b = {0.5f, 0.5f, 0.5f, 0.5f}; auto b = {0.5f, 0.5f, 0.5f, 0.5f};
// misc-fold-init-type // misc-fold-init-type
std::accumulate(std::begin(b), std::end(b), 0); (void) std::accumulate(std::begin(b), std::end(b), 0);
// google-readability-casting, misc-incorrect-roundings // google-readability-casting, misc-incorrect-roundings
auto c = (int)(getDouble() + 0.5); auto c = (int)(getDouble() + 0.5);
@@ -197,6 +197,7 @@ public:
std::system("echo "); std::system("echo ");
// cert-err52-cpp // cert-err52-cpp
setjmp(nullptr); setjmp(nullptr);
return 0;
} }
// google-default-arguments // google-default-arguments
@@ -251,7 +252,7 @@ int main()
// modernize-loop-convert // modernize-loop-convert
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
// cppcoreguidelines-pro-bounds-constant-array-index // cppcoreguidelines-pro-bounds-constant-array-index
arr[i]; (void) arr[i];
} }
std::vector<std::pair<int, int>> w; std::vector<std::pair<int, int>> w;

View File

@@ -556,7 +556,12 @@ bool isSubclassOf(QObject *object, const QByteArray &superTypeName)
void getPropertyCache(QObject *object, QQmlEngine *engine) void getPropertyCache(QObject *object, QQmlEngine *engine)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
QQuickDesignerSupportProperties::getPropertyCache(object, engine); QQuickDesignerSupportProperties::getPropertyCache(object, engine);
#else
Q_UNUSED(engine);
QQuickDesignerSupportProperties::getPropertyCache(object);
#endif
} }
void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &)) void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &))

View File

@@ -90,6 +90,103 @@ Item {
selectedAssetsChanged() selectedAssetsChanged()
} }
RegExpValidator {
id: folderNameValidator
regExp: /^(\w[^*/><?\\|:]*)$/
}
Dialog {
id: renameFolderDialog
title: qsTr("Rename folder")
anchors.centerIn: parent
closePolicy: Popup.CloseOnEscape
implicitWidth: 280
modal: true
property bool renameError: false
contentItem: Column {
spacing: 2
StudioControls.TextField {
id: folderRename
actionIndicator.visible: false
translationIndicator.visible: false
width: renameFolderDialog.width - 12
validator: folderNameValidator
onEditChanged: renameFolderDialog.renameError = false
Keys.onEnterPressed: btnRename.onClicked()
Keys.onReturnPressed: btnRename.onClicked()
}
Text {
text: qsTr("Folder Name cannot be empty.")
color: "#ff0000"
visible: folderRename.text === "" && !renameFolderDialog.renameError
}
Text {
text: qsTr("Could not rename directory. Make sure no folder with the same name exists.")
wrapMode: Text.WordWrap
width: renameFolderDialog.width
color: "#ff0000"
visible: renameFolderDialog.renameError
}
Item { // spacer
width: 1
height: 10
}
Text {
text: qsTr("If the folder has assets in use, renaming it might cause the project to not work correctly.")
color: StudioTheme.Values.themeTextColor
wrapMode: Text.WordWrap
width: renameFolderDialog.width
leftPadding: 10
rightPadding: 10
}
Item { // spacer
width: 1
height: 20
}
Row {
anchors.right: parent.right
Button {
id: btnRename
text: qsTr("Rename")
enabled: folderRename.text !== ""
onClicked: {
var success = assetsModel.renameFolder(contextDir.dirPath, folderRename.text)
if (success)
renameFolderDialog.accept()
renameFolderDialog.renameError = !success
}
}
Button {
text: qsTr("Cancel")
onClicked: renameFolderDialog.reject()
}
}
}
onOpened: {
folderRename.text = contextDir.dirName
folderRename.selectAll()
folderRename.forceActiveFocus()
renameFolderDialog.renameError = false
}
}
Dialog { Dialog {
id: newFolderDialog id: newFolderDialog
@@ -113,6 +210,7 @@ Item {
actionIndicator.visible: false actionIndicator.visible: false
translationIndicator.visible: false translationIndicator.visible: false
validator: folderNameValidator
Keys.onEnterPressed: btnCreate.onClicked() Keys.onEnterPressed: btnCreate.onClicked()
Keys.onReturnPressed: btnCreate.onClicked() Keys.onReturnPressed: btnCreate.onClicked()
@@ -261,6 +359,13 @@ Item {
height: visible ? StudioTheme.Values.border : 0 height: visible ? StudioTheme.Values.border : 0
} }
StudioControls.MenuItem {
text: qsTr("Rename Folder")
visible: isDirContextMenu
height: visible ? implicitHeight : 0
onTriggered: renameFolderDialog.open()
}
StudioControls.MenuItem { StudioControls.MenuItem {
text: qsTr("New Folder") text: qsTr("New Folder")
onTriggered: newFolderDialog.open() onTriggered: newFolderDialog.open()

View File

@@ -0,0 +1,225 @@
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Templates 2.15 as T
import StudioTheme 1.0 as StudioTheme
T.Switch {
id: root
property alias actionIndicator: actionIndicator
// This property is used to indicate the global hover state
property bool hover: root.hovered && root.enabled
property bool edit: false
property alias actionIndicatorVisible: actionIndicator.visible
property real __actionIndicatorWidth: StudioTheme.Values.actionIndicatorWidth
property real __actionIndicatorHeight: StudioTheme.Values.actionIndicatorHeight
property alias labelVisible: switchLabel.visible
property alias labelColor: switchLabel.color
property alias fontFamily: switchLabel.font.family
property alias fontPixelSize: switchLabel.font.pixelSize
font.pixelSize: StudioTheme.Values.myFontSize
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
spacing: StudioTheme.Values.switchSpacing
hoverEnabled: true
activeFocusOnTab: false
ActionIndicator {
id: actionIndicator
myControl: root
width: actionIndicator.visible ? root.__actionIndicatorWidth : 0
height: actionIndicator.visible ? root.__actionIndicatorHeight : 0
}
indicator: Rectangle {
id: switchBackground
x: actionIndicator.width
y: 0
z: 5
implicitWidth: StudioTheme.Values.height * 2
implicitHeight: StudioTheme.Values.height
radius: StudioTheme.Values.height * 0.5
color: StudioTheme.Values.themeControlBackground
border.width: StudioTheme.Values.border
border.color: StudioTheme.Values.themeControlOutline
Rectangle {
id: switchIndicator
readonly property real gap: 5
property real size: switchBackground.implicitHeight - switchIndicator.gap * 2
x: root.checked ? parent.width - width - switchIndicator.gap
: switchIndicator.gap
y: switchIndicator.gap
width: switchIndicator.size
height: switchIndicator.size
radius: switchIndicator.size * 0.5
color: StudioTheme.Values.themeTextColor
border.width: 0
}
}
contentItem: T.Label {
id: switchLabel
leftPadding: switchBackground.x + switchBackground.width + root.spacing
rightPadding: 0
verticalAlignment: Text.AlignVCenter
text: root.text
font: root.font
color: StudioTheme.Values.themeTextColor
visible: text !== ""
}
property bool __default: root.enabled && !root.hover && !actionIndicator.hover && !root.pressed
property bool __globalHover: root.enabled && actionIndicator.hover && !root.pressed
property bool __hover: root.hover && !actionIndicator.hover && !root.pressed
property bool __press: root.hover && root.pressed
states: [
State {
name: "default"
when: root.__default && !root.checked
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeControlBackground
border.color: StudioTheme.Values.themeControlOutline
}
PropertyChanges {
target: switchIndicator
color: StudioTheme.Values.themeTextColor
}
},
State {
name: "globalHover"
when: root.__globalHover && !root.checked
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeControlBackgroundGlobalHover
border.color: StudioTheme.Values.themeControlOutline
}
PropertyChanges {
target: switchIndicator
color: StudioTheme.Values.themeTextColor
}
},
State {
name: "hover"
when: root.__hover && !root.checked
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeControlBackgroundHover
border.color: StudioTheme.Values.themeControlOutline
}
PropertyChanges {
target: switchIndicator
color: StudioTheme.Values.themeTextColor
}
},
State {
name: "press"
when: root.__press && !root.checked
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeControlBackgroundInteraction
border.color: StudioTheme.Values.themeControlOutlineInteraction
}
PropertyChanges {
target: switchIndicator
color: StudioTheme.Values.themeInteraction
}
},
State {
name: "disable"
when: !root.enabled && !root.checked
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeControlBackgroundDisabled
border.color: StudioTheme.Values.themeControlOutlineDisabled
}
PropertyChanges {
target: switchIndicator
color: StudioTheme.Values.themeTextColorDisabled
}
PropertyChanges {
target: switchLabel
color: StudioTheme.Values.themeTextColorDisabled
}
},
State {
name: "defaultChecked"
when: root.__default && root.checked
extend: "default"
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeInteraction
border.color: StudioTheme.Values.themeInteraction
}
},
State {
name: "globalHoverChecked"
when: root.__globalHover && root.checked
extend: "globalHover"
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeInteractionHover
border.color: StudioTheme.Values.themeInteractionHover
}
},
State {
name: "hoverChecked"
when: root.__hover && root.checked
extend: "hover"
PropertyChanges {
target: switchBackground
color: StudioTheme.Values.themeInteractionHover
border.color: StudioTheme.Values.themeInteractionHover
}
},
State {
name: "pressChecked"
when: root.__press && root.checked
extend: "press"
},
State {
name: "disableChecked"
when: !root.enabled && root.checked
extend: "disable"
}
]
}

View File

@@ -72,6 +72,8 @@ QtObject {
property real radioButtonIndicatorWidth: 14 property real radioButtonIndicatorWidth: 14
property real radioButtonIndicatorHeight: 14 property real radioButtonIndicatorHeight: 14
property real switchSpacing: values.checkBoxSpacing
property real columnWidth: 225 + (175 * (values.scaleFactor * 2)) property real columnWidth: 225 + (175 * (values.scaleFactor * 2))
property real marginTopBottom: 4 property real marginTopBottom: 4
@@ -214,6 +216,8 @@ QtObject {
property string themeWarning: Theme.color(Theme.DSwarningColor) property string themeWarning: Theme.color(Theme.DSwarningColor)
property string themeDisabled: Theme.color(Theme.DSdisabledColor) property string themeDisabled: Theme.color(Theme.DSdisabledColor)
property string themeInteractionHover: Theme.color(Theme.DSinteractionHover)
property string themeAliasIconChecked: Theme.color(Theme.DSnavigatorAliasIconChecked) property string themeAliasIconChecked: Theme.color(Theme.DSnavigatorAliasIconChecked)
// Control colors // Control colors

View File

@@ -65,7 +65,7 @@
})" })"
}, },
{ {
"trKey": "2560 x 1440 (QHD)", "trKey": "2560 x 1440",
"value": "value":
"({ "({
'ScreenWidth': '2560', 'ScreenWidth': '2560',
@@ -73,7 +73,7 @@
})" })"
}, },
{ {
"trKey": "1920 x 1080 (FullHD)", "trKey": "1920 x 1080",
"value": "value":
"({ "({
'ScreenWidth': '1920', 'ScreenWidth': '1920',
@@ -97,7 +97,7 @@
})" })"
}, },
{ {
"trKey": "1280 x 720 (HD)", "trKey": "1280 x 720",
"value": "value":
"({ "({
'ScreenWidth': '1280', 'ScreenWidth': '1280',

View File

@@ -70,7 +70,7 @@
})" })"
}, },
{ {
"trKey": "720 x 1280 (HD)", "trKey": "720 x 1280",
"value": "value":
"({ "({
'ScreenWidth': '720', 'ScreenWidth': '720',
@@ -78,7 +78,7 @@
})" })"
}, },
{ {
"trKey": "1280 x 720 (HD)", "trKey": "1280 x 720",
"value": "value":
"({ "({
'ScreenWidth': '1280', 'ScreenWidth': '1280',

View File

@@ -67,7 +67,7 @@
})" })"
}, },
{ {
"trKey": "2560 x 1440 (QHD)", "trKey": "2560 x 1440",
"value": "value":
"({ "({
'ScreenWidth': '2560', 'ScreenWidth': '2560',
@@ -75,7 +75,7 @@
})" })"
}, },
{ {
"trKey": "1920 x 1080 (FullHD)", "trKey": "1920 x 1080",
"value": "value":
"({ "({
'ScreenWidth': '1920', 'ScreenWidth': '1920',
@@ -99,7 +99,7 @@
})" })"
}, },
{ {
"trKey": "1280 x 720 (HD)", "trKey": "1280 x 720",
"value": "value":
"({ "({
'ScreenWidth': '1280', 'ScreenWidth': '1280',

View File

@@ -9,15 +9,23 @@ Project {
/* Include .qml, .js, and image files from current directory and subdirectories */ /* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles { QmlFiles {
directory: "." directory: "content"
}
QmlFiles {
directory: "imports"
} }
JavaScriptFiles { JavaScriptFiles {
directory: "." directory: "content"
}
JavaScriptFiles {
directory: "imports"
} }
ImageFiles { ImageFiles {
directory: "." directory: "content"
} }
Files { Files {
@@ -34,6 +42,18 @@ Project {
filter: "*.ttf;*.otf" filter: "*.ttf;*.otf"
} }
Files {
filter: "*.wav;*.mp3"
}
Files {
filter: "*.mp4"
}
Files {
filter: "*.glsl;*.glslv;*.glslf;*.vsh;*.fsh;*.vert;*.frag"
}
Files { Files {
filter: "*.mesh" filter: "*.mesh"
directory: "asset_imports" directory: "asset_imports"
@@ -61,13 +81,20 @@ Project {
@endif @endif
/* List of plugin directories passed to QML runtime */ /* List of plugin directories passed to QML runtime */
importPaths: [ ".", "imports", "asset_imports" ] importPaths: [ "imports", "asset_imports" ]
/* Required for deployment */ /* Required for deployment */
targetDirectory: "/opt/%{ProjectName}" targetDirectory: "/opt/%{ProjectName}"
qdsVersion: "3.0"
@if %{IsQt6Project} @if %{IsQt6Project}
/* If any modules the project imports require widgets (e.g. QtCharts), widgetApp must be true */ /* If any modules the project imports require widgets (e.g. QtCharts), widgetApp must be true */
widgetApp: true widgetApp: true
@endif @endif
multilanguageSupport: true
supportedLanguages: ["en"]
primaryLanguage: "en"
} }

View File

@@ -55,7 +55,7 @@
"items": "items":
[ [
{ {
"trKey": "2960 x 1440 (QHD)", "trKey": "2960 x 1440",
"value": "value":
"({ "({
'ScreenWidth': '2960', 'ScreenWidth': '2960',
@@ -71,7 +71,7 @@
})" })"
}, },
{ {
"trKey": "1920 x 1080 (FullHD)", "trKey": "1920 x 1080",
"value": "value":
"({ "({
'ScreenWidth': '1920', 'ScreenWidth': '1920',
@@ -95,7 +95,7 @@
})" })"
}, },
{ {
"trKey": "1280 x 720 (HD)", "trKey": "1280 x 720",
"value": "value":
"({ "({
'ScreenWidth': '1280', 'ScreenWidth': '1280',

View File

@@ -55,7 +55,7 @@
"items": "items":
[ [
{ {
"trKey": "1080 x 1920 (FullHD)", "trKey": "1080 x 1920",
"value": "value":
"({ "({
'ScreenWidth': '1080', 'ScreenWidth': '1080',
@@ -79,7 +79,7 @@
})" })"
}, },
{ {
"trKey": "720 x 1280 (HD)", "trKey": "720 x 1280",
"value": "value":
"({ "({
'ScreenWidth': '720', 'ScreenWidth': '720',

View File

@@ -53,7 +53,7 @@
"items": "items":
[ [
{ {
"trKey": "1080 x 1920 (FullHD)", "trKey": "1080 x 1920",
"value": "value":
"({ "({
'ScreenWidth': '1080', 'ScreenWidth': '1080',
@@ -77,7 +77,7 @@
})" })"
}, },
{ {
"trKey": "720 x 1280 (HD)", "trKey": "720 x 1280",
"value": "value":
"({ "({
'ScreenWidth': '720', 'ScreenWidth': '720',

View File

@@ -53,7 +53,7 @@
"items": "items":
[ [
{ {
"trKey": "1080 x 1920 (FullHD)", "trKey": "1080 x 1920",
"value": "value":
"({ "({
'ScreenWidth': '1080', 'ScreenWidth': '1080',
@@ -77,7 +77,7 @@
})" })"
}, },
{ {
"trKey": "720 x 1280 (HD)", "trKey": "720 x 1280",
"value": "value":
"({ "({
'ScreenWidth': '720', 'ScreenWidth': '720',

View File

@@ -1,8 +1,6 @@
import qbs import qbs
QtApplication { QtApplication {
cpp.cxxLanguageVersion: "c++11"
cpp.defines: [ cpp.defines: [
// You can make your code fail to compile if it uses deprecated APIs. // You can make your code fail to compile if it uses deprecated APIs.
// In order to do so, uncomment the following line. // In order to do so, uncomment the following line.
@@ -10,6 +8,7 @@ QtApplication {
] ]
consoleApplication: true consoleApplication: true
install: true
files: [ files: [
"%{CppFileName}", "%{CppFileName}",
@if %{HasTranslation} @if %{HasTranslation}
@@ -24,10 +23,4 @@ QtApplication {
fileTags: "qt.core.resource_data" fileTags: "qt.core.resource_data"
} }
@endif @endif
Group { // Properties for the produced executable
fileTagsFilter: "application"
qbs.install: true
qbs.installDir: "bin"
}
} }

View File

@@ -2,11 +2,6 @@ import qbs
CppApplication { CppApplication {
consoleApplication: true consoleApplication: true
install: true
files: "%{CFileName}" files: "%{CFileName}"
Group { // Properties for the produced executable
fileTagsFilter: "application"
qbs.install: true
qbs.installDir: "bin"
}
} }

View File

@@ -2,11 +2,6 @@ import qbs
CppApplication { CppApplication {
consoleApplication: true consoleApplication: true
install: true
files: "%{CppFileName}" files: "%{CppFileName}"
Group { // Properties for the produced executable
fileTagsFilter: "application"
qbs.install: true
qbs.installDir: "bin"
}
} }

View File

@@ -7,6 +7,8 @@ CppApplication {
Depends { name: "Qt.quick" } Depends { name: "Qt.quick" }
@endif @endif
install: true
// Additional import path used to resolve QML modules in Qt Creator's code model // Additional import path used to resolve QML modules in Qt Creator's code model
property pathList qmlImportPaths: [] property pathList qmlImportPaths: []
@if !%{IsQt6} @if !%{IsQt6}
@@ -43,9 +45,4 @@ CppApplication {
fileTags: ["qt.qml.qml", "qt.core.resource_data"] fileTags: ["qt.qml.qml", "qt.core.resource_data"]
} }
@endif @endif
Group { // Properties for the produced executable
fileTagsFilter: "application"
qbs.install: true
qbs.installDir: "bin"
}
} }

View File

@@ -35,6 +35,8 @@ DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning
DSdisabledColor=ff707070 DSdisabledColor=ff707070
DSinteractionHover=ff74cbfc
DScontrolBackground=ff2e2f30 DScontrolBackground=ff2e2f30
DScontrolBackgroundInteraction=ff3d3d3d DScontrolBackgroundInteraction=ff3d3d3d
DScontrolBackgroundDisabled=ff2e2f30 DScontrolBackgroundDisabled=ff2e2f30
@@ -263,7 +265,6 @@ ProgressBarBackgroundColor=normalBackground
SplitterColor=splitterColor SplitterColor=splitterColor
TextColorDisabled=textDisabled TextColorDisabled=textDisabled
TextColorError=ffff4040 TextColorError=ffff4040
TextColorHighlight=ffff0000
TextColorHighlightBackground=7a6f1c TextColorHighlightBackground=7a6f1c
TextColorLink=textColorLink TextColorLink=textColorLink
TextColorLinkVisited=textColorLinkVisited TextColorLinkVisited=textColorLinkVisited

View File

@@ -26,6 +26,8 @@ DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning
DSdisabledColor=ff8e8e8e DSdisabledColor=ff8e8e8e
DSinteractionHover=ff74cbfc
DScontrolBackground=ffeaeaea DScontrolBackground=ffeaeaea
DScontrolBackgroundInteraction=ffc9c9c9 DScontrolBackgroundInteraction=ffc9c9c9
DScontrolBackgroundDisabled=ffeaeaea DScontrolBackgroundDisabled=ffeaeaea
@@ -254,7 +256,6 @@ ProgressBarBackgroundColor=18ffffff
SplitterColor=splitterColor SplitterColor=splitterColor
TextColorDisabled=55000000 TextColorDisabled=55000000
TextColorError=ffff0000 TextColorError=ffff0000
TextColorHighlight=ffa0a0a4
TextColorHighlightBackground=ffef0b TextColorHighlightBackground=ffef0b
TextColorLink=ff0057ae TextColorLink=ff0057ae
TextColorLinkVisited=ff644a9b TextColorLinkVisited=ff644a9b

View File

@@ -40,6 +40,8 @@ DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning
DSdisabledColor=ff8e8e8e DSdisabledColor=ff8e8e8e
DSinteractionHover=ff74cbfc
DScontrolBackground=ffeaeaea DScontrolBackground=ffeaeaea
DScontrolBackgroundInteraction=ffc9c9c9 DScontrolBackgroundInteraction=ffc9c9c9
DScontrolBackgroundDisabled=ffeaeaea DScontrolBackgroundDisabled=ffeaeaea
@@ -268,7 +270,6 @@ ProgressBarBackgroundColor=28000000
SplitterColor=splitter SplitterColor=splitter
TextColorDisabled=textDisabled TextColorDisabled=textDisabled
TextColorError=ffff4040 TextColorError=ffff4040
TextColorHighlight=ffff0000
TextColorHighlightBackground=ffef0b TextColorHighlightBackground=ffef0b
TextColorLink=ff007af4 TextColorLink=ff007af4
TextColorLinkVisited=ffa57aff TextColorLinkVisited=ffa57aff

View File

@@ -37,6 +37,8 @@ DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning
DSdisabledColor=ff707070 DSdisabledColor=ff707070
DSinteractionHover=ff74cbfc
DScontrolBackground=ff2e2f30 DScontrolBackground=ff2e2f30
DScontrolBackgroundInteraction=ff3d3d3d DScontrolBackgroundInteraction=ff3d3d3d
DScontrolBackgroundDisabled=ff2e2f30 DScontrolBackgroundDisabled=ff2e2f30
@@ -265,7 +267,6 @@ ProgressBarBackgroundColor=a0606060
SplitterColor=splitter SplitterColor=splitter
TextColorDisabled=textDisabled TextColorDisabled=textDisabled
TextColorError=ffff4040 TextColorError=ffff4040
TextColorHighlight=ffff0000
TextColorHighlightBackground=8a7f2c TextColorHighlightBackground=8a7f2c
TextColorLink=textColorLink TextColorLink=textColorLink
TextColorLinkVisited=textColorLinkVisited TextColorLinkVisited=textColorLinkVisited

View File

@@ -39,6 +39,8 @@ DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning
DSdisabledColor=ff707070 DSdisabledColor=ff707070
DSinteractionHover=ff74cbfc
DScontrolBackground=ff2e2f30 DScontrolBackground=ff2e2f30
DScontrolBackgroundInteraction=ff3d3d3d DScontrolBackgroundInteraction=ff3d3d3d
DScontrolBackgroundDisabled=ff2e2f30 DScontrolBackgroundDisabled=ff2e2f30
@@ -267,7 +269,6 @@ ProgressBarBackgroundColor=a0606060
SplitterColor=splitter SplitterColor=splitter
TextColorDisabled=textDisabled TextColorDisabled=textDisabled
TextColorError=ffff4040 TextColorError=ffff4040
TextColorHighlight=ffff0000
TextColorHighlightBackground=7a6f1c TextColorHighlightBackground=7a6f1c
TextColorLink=textColorLink TextColorLink=textColorLink
TextColorLinkVisited=textColorLinkVisited TextColorLinkVisited=textColorLinkVisited

View File

@@ -35,6 +35,8 @@ DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning
DSdisabledColor=ff8e8e8e DSdisabledColor=ff8e8e8e
DSinteractionHover=ff74cbfc
DScontrolBackground=ffeaeaea DScontrolBackground=ffeaeaea
DScontrolBackgroundInteraction=ffc9c9c9 DScontrolBackgroundInteraction=ffc9c9c9
DScontrolBackgroundDisabled=ffeaeaea DScontrolBackgroundDisabled=ffeaeaea
@@ -263,7 +265,6 @@ ProgressBarBackgroundColor=28000000
SplitterColor=splitter SplitterColor=splitter
TextColorDisabled=textDisabled TextColorDisabled=textDisabled
TextColorError=ffff4040 TextColorError=ffff4040
TextColorHighlight=ffff0000
TextColorHighlightBackground=ffef0b TextColorHighlightBackground=ffef0b
TextColorLink=ff007af4 TextColorLink=ff007af4
TextColorLinkVisited=ffa57aff TextColorLinkVisited=ffa57aff

View File

@@ -33,6 +33,8 @@ DSerrorColor=ffdf3a3a
DSwarningColor=warning DSwarningColor=warning
DSdisabledColor=ff707070 DSdisabledColor=ff707070
DSinteractionHover=ff74cbfc
DScontrolBackground=ff2e2f30 DScontrolBackground=ff2e2f30
DScontrolBackgroundInteraction=ff3d3d3d DScontrolBackgroundInteraction=ff3d3d3d
DScontrolBackgroundDisabled=ff2e2f30 DScontrolBackgroundDisabled=ff2e2f30
@@ -261,7 +263,6 @@ ProgressBarBackgroundColor=a0606060
SplitterColor=splitter SplitterColor=splitter
TextColorDisabled=textDisabled TextColorDisabled=textDisabled
TextColorError=ffff4040 TextColorError=ffff4040
TextColorHighlight=ffff0000
TextColorHighlightBackground=ffef0b TextColorHighlightBackground=ffef0b
TextColorLink=ff007af4 TextColorLink=ff007af4
TextColorLinkVisited=ffa57aff TextColorLinkVisited=ffa57aff

View File

@@ -25,18 +25,6 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ArchSuffix 64) set(ArchSuffix 64)
endif() endif()
# statically link MSVC runtime
# see https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#how-can-i-build-my-msvc-application-with-a-static-runtime
# TODO change to MSVC_RUNTIME_LIBRARY when CMake 3.15 is required
# set_property(TARGET qtcreatorcdbext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
add_qtc_library(qtcreatorcdbext add_qtc_library(qtcreatorcdbext
COMPONENT qtcreatorcdbext COMPONENT qtcreatorcdbext
DEPENDS ${DbgEngLib} DEPENDS ${DbgEngLib}
@@ -60,6 +48,9 @@ add_qtc_library(qtcreatorcdbext
qtc_library_enabled(_library_enabled qtcreatorcdbext) qtc_library_enabled(_library_enabled qtcreatorcdbext)
if (_library_enabled) if (_library_enabled)
# statically link MSVC runtime
set_property(TARGET qtcreatorcdbext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
find_package(Python3 3.8 COMPONENTS Development) find_package(Python3 3.8 COMPONENTS Development)
if (NOT ${Python3_Development_FOUND}) if (NOT ${Python3_Development_FOUND})

View File

@@ -61,6 +61,7 @@ public:
QString host() const { return url.host(); } QString host() const { return url.host(); }
quint16 port() const { return url.port(); } quint16 port() const { return url.port(); }
QString userName() const { return url.userName(); } QString userName() const { return url.userName(); }
QString userAtHost() const { return userName().isEmpty() ? host() : userName() + '@' + host(); }
void setHost(const QString &host) { url.setHost(host); } void setHost(const QString &host) { url.setHost(host); }
void setPort(int port) { url.setPort(port); } void setPort(int port) { url.setPort(port); }
void setUserName(const QString &name) { url.setUserName(name); } void setUserName(const QString &name) { url.setUserName(name); }

View File

@@ -215,7 +215,11 @@ void BaseAspect::setupLabel()
if (d->m_labelText.isEmpty() && d->m_labelPixmap.isNull()) if (d->m_labelText.isEmpty() && d->m_labelPixmap.isNull())
return; return;
d->m_label = new QLabel(d->m_labelText); d->m_label = new QLabel(d->m_labelText);
d->m_label->setTextInteractionFlags(Qt::TextSelectableByMouse); d->m_label->setTextInteractionFlags(d->m_label->textInteractionFlags()
| Qt::TextSelectableByMouse);
connect(d->m_label, &QLabel::linkActivated, this, [this](const QString &link) {
emit labelLinkActivated(link);
});
if (!d->m_labelPixmap.isNull()) if (!d->m_labelPixmap.isNull())
d->m_label->setPixmap(d->m_labelPixmap); d->m_label->setPixmap(d->m_labelPixmap);
registerSubWidget(d->m_label); registerSubWidget(d->m_label);

View File

@@ -142,6 +142,7 @@ public:
signals: signals:
void changed(); void changed();
void labelLinkActivated(const QString &link);
protected: protected:
QLabel *label() const; QLabel *label() const;

View File

@@ -738,6 +738,8 @@ MimeType Utils::mimeTypeForFile(const QFileInfo &fileInfo, MimeMatchMode mode)
MimeType Utils::mimeTypeForFile(const FilePath &filePath, MimeMatchMode mode) MimeType Utils::mimeTypeForFile(const FilePath &filePath, MimeMatchMode mode)
{ {
MimeDatabase mdb; MimeDatabase mdb;
if (filePath.needsDevice())
return mdb.mimeTypeForUrl(filePath.toUrl());
return mdb.mimeTypeForFile(filePath.toString(), MimeDatabase::MatchMode(mode)); return mdb.mimeTypeForFile(filePath.toString(), MimeDatabase::MatchMode(mode));
} }

View File

@@ -263,9 +263,6 @@ public:
void setAbortOnMetaChars(bool abort) { m_abortOnMetaChars = abort; } void setAbortOnMetaChars(bool abort) { m_abortOnMetaChars = abort; }
bool isAbortOnMetaChars() const { return m_abortOnMetaChars; } bool isAbortOnMetaChars() const { return m_abortOnMetaChars; }
void setRunAsRoot(bool on) { m_runAsRoot = on; }
bool runAsRoot() const { return m_runAsRoot; }
void setBelowNormalPriority() { m_belowNormalPriority = true; } void setBelowNormalPriority() { m_belowNormalPriority = true; }
bool isBelowNormalPriority() const { return m_belowNormalPriority; } bool isBelowNormalPriority() const { return m_belowNormalPriority; }
void setNativeArguments(const QString &arguments) { m_nativeArguments = arguments; } void setNativeArguments(const QString &arguments) { m_nativeArguments = arguments; }
@@ -287,7 +284,6 @@ private:
bool m_lowPriority = false; bool m_lowPriority = false;
bool m_unixTerminalDisabled = false; bool m_unixTerminalDisabled = false;
bool m_abortOnMetaChars = true; bool m_abortOnMetaChars = true;
bool m_runAsRoot = false;
}; };
class TerminalImpl : public ProcessInterface class TerminalImpl : public ProcessInterface
@@ -319,7 +315,6 @@ public:
void customStart(const CommandLine &command, const FilePath &workingDirectory, void customStart(const CommandLine &command, const FilePath &workingDirectory,
const Environment &environment) override const Environment &environment) override
{ {
m_terminal.setRunAsRoot(runAsRoot());
m_terminal.setAbortOnMetaChars(isAbortOnMetaChars()); m_terminal.setAbortOnMetaChars(isAbortOnMetaChars());
m_terminal.setCommand(command); m_terminal.setCommand(command);
m_terminal.setWorkingDirectory(workingDirectory); m_terminal.setWorkingDirectory(workingDirectory);
@@ -568,6 +563,7 @@ public:
, q(parent) , q(parent)
, m_process(newProcessInstance(parent, processImpl, processMode, terminalMode)) , m_process(newProcessInstance(parent, processImpl, processMode, terminalMode))
, m_processMode(processMode) , m_processMode(processMode)
, m_terminalMode(terminalMode)
{ {
connect(m_process, &ProcessInterface::started, connect(m_process, &ProcessInterface::started,
q, &QtcProcess::started); q, &QtcProcess::started);
@@ -606,45 +602,29 @@ public:
return filePath.searchInPath(); return filePath.searchInPath();
} }
void defaultStart() void defaultStart(const CommandLine &commandLine, const FilePath &workingDirectory,
const Environment &environment)
{ {
clearForRun();
if (m_commandLine.executable().needsDevice()) {
QTC_ASSERT(s_deviceHooks.startProcessHook, return);
s_deviceHooks.startProcessHook(*q);
return;
}
if (processLog().isDebugEnabled()) { if (processLog().isDebugEnabled()) {
static int n = 0; static int n = 0;
qCDebug(processLog) << "STARTING PROCESS: " << ++n << " " << m_commandLine.toUserOutput(); qCDebug(processLog) << "STARTING PROCESS: " << ++n << " " << commandLine.toUserOutput();
} }
Environment env; m_process->setProcessEnvironment(environment.toProcessEnvironment());
if (m_haveEnv) { m_process->setWorkingDirectory(workingDirectory.path());
if (m_environment.size() == 0)
qWarning("QtcProcess::start: Empty environment set when running '%s'.",
qPrintable(m_commandLine.executable().toString()));
env = m_environment;
} else {
env = Environment::systemEnvironment();
}
m_process->setProcessEnvironment(env.toProcessEnvironment());
m_process->setWorkingDirectory(m_workingDirectory.path());
QString command; QString commandString;
ProcessArgs arguments; ProcessArgs arguments;
const bool success = ProcessArgs::prepareCommand(m_commandLine, &command, &arguments, &env, const bool success = ProcessArgs::prepareCommand(commandLine, &commandString, &arguments,
&m_workingDirectory); &environment, &workingDirectory);
if (m_commandLine.executable().osType() == OsTypeWindows) { if (commandLine.executable().osType() == OsTypeWindows) {
QString args; QString args;
if (m_useCtrlCStub) { if (m_useCtrlCStub) {
if (m_process->isLowPriority()) if (m_process->isLowPriority())
ProcessArgs::addArg(&args, "-nice"); ProcessArgs::addArg(&args, "-nice");
ProcessArgs::addArg(&args, QDir::toNativeSeparators(command)); ProcessArgs::addArg(&args, QDir::toNativeSeparators(commandString));
command = QCoreApplication::applicationDirPath() commandString = QCoreApplication::applicationDirPath()
+ QLatin1String("/qtcreator_ctrlc_stub.exe"); + QLatin1String("/qtcreator_ctrlc_stub.exe");
} else if (m_process->isLowPriority()) { } else if (m_process->isLowPriority()) {
m_process->setBelowNormalPriority(); m_process->setBelowNormalPriority();
@@ -655,7 +635,7 @@ public:
#endif #endif
// Note: Arguments set with setNativeArgs will be appended to the ones // Note: Arguments set with setNativeArgs will be appended to the ones
// passed with start() below. // passed with start() below.
start(command, QStringList(), m_writeData); start(commandString, QStringList(), workingDirectory, m_writeData);
} else { } else {
if (!success) { if (!success) {
q->setErrorString(tr("Error in command line.")); q->setErrorString(tr("Error in command line."));
@@ -664,13 +644,14 @@ public:
emit q->errorOccurred(QProcess::UnknownError); emit q->errorOccurred(QProcess::UnknownError);
return; return;
} }
start(command, arguments.toUnixArgs(), m_writeData); start(commandString, arguments.toUnixArgs(), workingDirectory, m_writeData);
} }
} }
void start(const QString &program, const QStringList &arguments, const QByteArray &writeData) void start(const QString &program, const QStringList &arguments,
const FilePath &workingDirectory, const QByteArray &writeData)
{ {
const FilePath programFilePath = resolve(m_workingDirectory, FilePath::fromString(program)); const FilePath programFilePath = resolve(workingDirectory, FilePath::fromString(program));
if (programFilePath.exists() && programFilePath.isExecutableFile()) { if (programFilePath.exists() && programFilePath.isExecutableFile()) {
s_start.measureAndRun(&ProcessInterface::start, m_process, program, arguments, writeData); s_start.measureAndRun(&ProcessInterface::start, m_process, program, arguments, writeData);
} else { } else {
@@ -680,13 +661,42 @@ public:
} }
} }
CommandLine fullCommandLine() const
{
if (!m_runAsRoot || HostOsInfo::isWindowsHost())
return m_commandLine;
CommandLine rootCommand("sudo", {"-A"});
rootCommand.addCommandLineAsArgs(m_commandLine);
return rootCommand;
}
Environment fullEnvironment() const
{
Environment env;
if (m_haveEnv) {
if (m_environment.size() == 0)
qWarning("QtcProcess::start: Empty environment set when running '%s'.",
qPrintable(m_commandLine.executable().toString()));
env = m_environment;
} else {
env = Environment::systemEnvironment();
}
// TODO: needs SshSettings
// if (m_runAsRoot)
// RunControl::provideAskPassEntry(env);
return env;
}
QtcProcess *q; QtcProcess *q;
ProcessInterface *m_process; ProcessInterface *m_process;
const ProcessMode m_processMode; const ProcessMode m_processMode;
const QtcProcess::TerminalMode m_terminalMode;
CommandLine m_commandLine; CommandLine m_commandLine;
FilePath m_workingDirectory; FilePath m_workingDirectory;
Environment m_environment; Environment m_environment;
QByteArray m_writeData; QByteArray m_writeData;
bool m_runAsRoot = false;
bool m_haveEnv = false; bool m_haveEnv = false;
bool m_useCtrlCStub = false; bool m_useCtrlCStub = false;
@@ -774,6 +784,11 @@ ProcessMode QtcProcess::processMode() const
return d->m_processMode; return d->m_processMode;
} }
QtcProcess::TerminalMode QtcProcess::terminalMode() const
{
return d->m_terminalMode;
}
void QtcProcess::setEnvironment(const Environment &env) void QtcProcess::setEnvironment(const Environment &env)
{ {
d->m_environment = env; d->m_environment = env;
@@ -791,6 +806,11 @@ const Environment &QtcProcess::environment() const
return d->m_environment; return d->m_environment;
} }
bool QtcProcess::hasEnvironment() const
{
return d->m_haveEnv;
}
void QtcProcess::setCommand(const CommandLine &cmdLine) void QtcProcess::setCommand(const CommandLine &cmdLine)
{ {
if (d->m_workingDirectory.needsDevice() && cmdLine.executable().needsDevice()) { if (d->m_workingDirectory.needsDevice() && cmdLine.executable().needsDevice()) {
@@ -831,10 +851,18 @@ void QtcProcess::setUseCtrlCStub(bool enabled)
void QtcProcess::start() void QtcProcess::start()
{ {
if (d->m_commandLine.executable().needsDevice()) {
QTC_ASSERT(s_deviceHooks.startProcessHook, return);
s_deviceHooks.startProcessHook(*this);
return;
}
d->clearForRun();
const CommandLine cmd = d->fullCommandLine();
const Environment env = d->fullEnvironment();
if (d->m_process->isCustomStart()) if (d->m_process->isCustomStart())
d->m_process->customStart(d->m_commandLine, d->m_workingDirectory, d->m_environment); d->m_process->customStart(cmd, d->m_workingDirectory, env);
else else
d->defaultStart(); d->defaultStart(cmd, d->m_workingDirectory, env);
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@@ -905,7 +933,12 @@ void QtcProcess::setAbortOnMetaChars(bool abort)
void QtcProcess::setRunAsRoot(bool on) void QtcProcess::setRunAsRoot(bool on)
{ {
d->m_process->setRunAsRoot(on); d->m_runAsRoot = on;
}
bool QtcProcess::isRunAsRoot() const
{
return d->m_runAsRoot;
} }
void QtcProcess::setStandardInputFile(const QString &inputFile) void QtcProcess::setStandardInputFile(const QString &inputFile)

View File

@@ -90,6 +90,7 @@ public:
~QtcProcess(); ~QtcProcess();
ProcessMode processMode() const; ProcessMode processMode() const;
TerminalMode terminalMode() const;
enum Result { enum Result {
// Finished successfully. Unless an ExitCodeInterpreter is set // Finished successfully. Unless an ExitCodeInterpreter is set
@@ -111,6 +112,7 @@ public:
void setEnvironment(const Environment &env); void setEnvironment(const Environment &env);
void unsetEnvironment(); void unsetEnvironment();
const Environment &environment() const; const Environment &environment() const;
bool hasEnvironment() const;
void setCommand(const CommandLine &cmdLine); void setCommand(const CommandLine &cmdLine);
const CommandLine &commandLine() const; const CommandLine &commandLine() const;
@@ -122,6 +124,7 @@ public:
void setLowPriority(); void setLowPriority();
void setDisableUnixTerminal(); void setDisableUnixTerminal();
void setRunAsRoot(bool on); void setRunAsRoot(bool on);
bool isRunAsRoot() const;
void setAbortOnMetaChars(bool abort); void setAbortOnMetaChars(bool abort);

View File

@@ -142,7 +142,6 @@ public:
QProcess::ProcessError m_error = QProcess::UnknownError; QProcess::ProcessError m_error = QProcess::UnknownError;
QString m_errorString; QString m_errorString;
bool m_abortOnMetaChars = true; bool m_abortOnMetaChars = true;
bool m_runAsRoot = false;
// Used on Unix only // Used on Unix only
QtcProcess m_process; QtcProcess m_process;
@@ -431,8 +430,6 @@ void TerminalProcess::start()
+ QLatin1String("/" RELATIVE_LIBEXEC_PATH "/qtcreator_process_stub"); + QLatin1String("/" RELATIVE_LIBEXEC_PATH "/qtcreator_process_stub");
QStringList allArgs = terminalArgs.toUnixArgs(); QStringList allArgs = terminalArgs.toUnixArgs();
if (d->m_runAsRoot)
allArgs << "sudo" << "-A";
allArgs << stubPath allArgs << stubPath
<< modeOption(d->m_terminalMode) << modeOption(d->m_terminalMode)
@@ -797,11 +794,6 @@ const Environment &TerminalProcess::environment() const
return d->m_environment; return d->m_environment;
} }
void TerminalProcess::setRunAsRoot(bool on)
{
d->m_runAsRoot = on;
}
QProcess::ProcessError TerminalProcess::error() const QProcess::ProcessError TerminalProcess::error() const
{ {
return d->m_error; return d->m_error;

View File

@@ -52,8 +52,6 @@ public:
void setEnvironment(const Environment &env); void setEnvironment(const Environment &env);
const Environment &environment() const; const Environment &environment() const;
void setRunAsRoot(bool on);
QProcess::ProcessError error() const; QProcess::ProcessError error() const;
QString errorString() const; QString errorString() const;

View File

@@ -109,7 +109,6 @@ public:
SplitterColor, SplitterColor,
TextColorDisabled, TextColorDisabled,
TextColorError, TextColorError,
TextColorHighlight,
TextColorHighlightBackground, TextColorHighlightBackground,
TextColorLink, TextColorLink,
TextColorLinkVisited, TextColorLinkVisited,

View File

@@ -473,28 +473,6 @@ QString AndroidConfig::apiLevelNameFor(const SdkPlatform *platform)
QString("android-%1").arg(platform->apiLevel()) : ""; QString("android-%1").arg(platform->apiLevel()) : "";
} }
int AndroidConfig::platformNameToApiLevel(const QString &platformName)
{
int apiLevel = -1;
static const QRegularExpression re("(android-)(?<apiLevel>[0-9A-Z]{1,})",
QRegularExpression::CaseInsensitiveOption);
QRegularExpressionMatch match = re.match(platformName);
if (match.hasMatch()) {
QString apiLevelStr = match.captured("apiLevel");
bool isUInt;
apiLevel = apiLevelStr.toUInt(&isUInt);
if (!isUInt) {
if (apiLevelStr == 'Q')
apiLevel = 29;
else if (apiLevelStr == 'R')
apiLevel = 30;
else if (apiLevelStr == 'S')
apiLevel = 31;
}
}
return apiLevel;
}
bool AndroidConfig::isCmdlineSdkToolsInstalled() const bool AndroidConfig::isCmdlineSdkToolsInstalled() const
{ {
QString toolPath("cmdline-tools/latest/bin/sdkmanager"); QString toolPath("cmdline-tools/latest/bin/sdkmanager");

View File

@@ -91,7 +91,6 @@ public:
static QStringList apiLevelNamesFor(const SdkPlatformList &platforms); static QStringList apiLevelNamesFor(const SdkPlatformList &platforms);
static QString apiLevelNameFor(const SdkPlatform *platform); static QString apiLevelNameFor(const SdkPlatform *platform);
static int platformNameToApiLevel(const QString &platformName);
Utils::FilePath sdkLocation() const; Utils::FilePath sdkLocation() const;
void setSdkLocation(const Utils::FilePath &sdkLocation); void setSdkLocation(const Utils::FilePath &sdkLocation);

View File

@@ -673,7 +673,7 @@ AndroidDeviceFactory::AndroidDeviceFactory()
":/android/images/androiddevice.png"); ":/android/images/androiddevice.png");
setConstructionFunction(&AndroidDevice::create); setConstructionFunction(&AndroidDevice::create);
setCanCreate(m_androidConfig.sdkToolsOk()); if (m_androidConfig.sdkToolsOk()) {
setCreator([this] { setCreator([this] {
AvdDialog dialog = AvdDialog(m_androidConfig, Core::ICore::dialogParent()); AvdDialog dialog = AvdDialog(m_androidConfig, Core::ICore::dialogParent());
if (dialog.exec() != QDialog::Accepted) if (dialog.exec() != QDialog::Accepted)
@@ -690,6 +690,7 @@ AndroidDeviceFactory::AndroidDeviceFactory()
return IDevice::Ptr(dev); return IDevice::Ptr(dev);
}); });
}
} }
} // namespace Internal } // namespace Internal

View File

@@ -28,6 +28,7 @@
#include "androidconfigurations.h" #include "androidconfigurations.h"
#include "androidconstants.h" #include "androidconstants.h"
#include "androidmanager.h" #include "androidmanager.h"
#include "avdmanageroutputparser.h"
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -691,7 +692,7 @@ AndroidSdkPackage *SdkManagerOutputParser::parsePlatform(const QStringList &data
SdkPlatform *platform = nullptr; SdkPlatform *platform = nullptr;
GenericPackageData packageData; GenericPackageData packageData;
if (parseAbstractData(packageData, data, 2, "Platform")) { if (parseAbstractData(packageData, data, 2, "Platform")) {
const int apiLevel = AndroidConfig::platformNameToApiLevel(packageData.headerParts.at(1)); const int apiLevel = platformNameToApiLevel(packageData.headerParts.at(1));
if (apiLevel == -1) { if (apiLevel == -1) {
qCDebug(sdkManagerLog) << "Platform: Cannot parse api level:"<< data; qCDebug(sdkManagerLog) << "Platform: Cannot parse api level:"<< data;
return nullptr; return nullptr;
@@ -711,7 +712,7 @@ QPair<SystemImage *, int> SdkManagerOutputParser::parseSystemImage(const QString
QPair <SystemImage *, int> result(nullptr, -1); QPair <SystemImage *, int> result(nullptr, -1);
GenericPackageData packageData; GenericPackageData packageData;
if (parseAbstractData(packageData, data, 4, "System-image")) { if (parseAbstractData(packageData, data, 4, "System-image")) {
const int apiLevel = AndroidConfig::platformNameToApiLevel(packageData.headerParts.at(1)); const int apiLevel = platformNameToApiLevel(packageData.headerParts.at(1));
if (apiLevel == -1) { if (apiLevel == -1) {
qCDebug(sdkManagerLog) << "System-image: Cannot parse api level:"<< data; qCDebug(sdkManagerLog) << "System-image: Cannot parse api level:"<< data;
return result; return result;

View File

@@ -24,7 +24,6 @@
****************************************************************************/ ****************************************************************************/
#include "avdmanageroutputparser.h" #include "avdmanageroutputparser.h"
#include "androidconfigurations.h"
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
@@ -34,6 +33,7 @@
#include <utils/variant.h> #include <utils/variant.h>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QRegularExpression>
#include <QSettings> #include <QSettings>
namespace { namespace {
@@ -98,7 +98,7 @@ static Utils::optional<AndroidDeviceInfo> parseAvd(const QStringList &deviceInfo
QSettings avdInfo(avdInfoFile.toString(), QSettings::IniFormat); QSettings avdInfo(avdInfoFile.toString(), QSettings::IniFormat);
value = avdInfo.value(avdInfoTargetKey).toString(); value = avdInfo.value(avdInfoTargetKey).toString();
if (!value.isEmpty()) if (!value.isEmpty())
avd.sdk = AndroidConfig::platformNameToApiLevel(value); avd.sdk = platformNameToApiLevel(value);
else else
qCDebug(avdOutputParserLog) qCDebug(avdOutputParserLog)
<< "Avd Parsing: Cannot find sdk API:" << avdInfoFile.toString(); << "Avd Parsing: Cannot find sdk API:" << avdInfoFile.toString();
@@ -164,5 +164,27 @@ AndroidDeviceInfoList parseAvdList(const QString &output, QStringList *avdErrorP
return avdList; return avdList;
} }
int platformNameToApiLevel(const QString &platformName)
{
int apiLevel = -1;
static const QRegularExpression re("(android-)(?<apiLevel>[0-9A-Z]{1,})",
QRegularExpression::CaseInsensitiveOption);
QRegularExpressionMatch match = re.match(platformName);
if (match.hasMatch()) {
QString apiLevelStr = match.captured("apiLevel");
bool isUInt;
apiLevel = apiLevelStr.toUInt(&isUInt);
if (!isUInt) {
if (apiLevelStr == 'Q')
apiLevel = 29;
else if (apiLevelStr == 'R')
apiLevel = 30;
else if (apiLevelStr == 'S')
apiLevel = 31;
}
}
return apiLevel;
}
} // namespace Internal } // namespace Internal
} // namespace Android } // namespace Android

View File

@@ -31,6 +31,7 @@ namespace Internal {
const char avdManufacturerError[] = "no longer exists as a device"; const char avdManufacturerError[] = "no longer exists as a device";
AndroidDeviceInfoList parseAvdList(const QString &output, QStringList *avdErrorPaths); AndroidDeviceInfoList parseAvdList(const QString &output, QStringList *avdErrorPaths);
int platformNameToApiLevel(const QString &platformName);
} // namespace Internal } // namespace Internal
} // namespace Android } // namespace Android

View File

@@ -126,7 +126,6 @@ BareMetalDeviceFactory::BareMetalDeviceFactory()
setCombinedIcon(":/baremetal/images/baremetaldevicesmall.png", setCombinedIcon(":/baremetal/images/baremetaldevicesmall.png",
":/baremetal/images/baremetaldevice.png"); ":/baremetal/images/baremetaldevice.png");
setConstructionFunction(&BareMetalDevice::create); setConstructionFunction(&BareMetalDevice::create);
setCanCreate(true);
setCreator([] { setCreator([] {
BareMetalDeviceConfigurationWizard wizard; BareMetalDeviceConfigurationWizard wizard;
if (wizard.exec() != QDialog::Accepted) if (wizard.exec() != QDialog::Accepted)

View File

@@ -96,6 +96,7 @@ CommandLine StLinkUtilGdbServerProvider::command() const
if (!m_resetBoard) if (!m_resetBoard)
cmd.addArg("--no-reset"); cmd.addArg("--no-reset");
if (m_transport != UnspecifiedTransport)
cmd.addArg("--stlink_version=" + QString::number(m_transport)); cmd.addArg("--stlink_version=" + QString::number(m_transport));
cmd.addArg("--listen_port=" + QString::number(channel().port())); cmd.addArg("--listen_port=" + QString::number(channel().port()));
cmd.addArg("--verbose=" + QString::number(m_verboseLevel)); cmd.addArg("--verbose=" + QString::number(m_verboseLevel));
@@ -301,6 +302,9 @@ void StLinkUtilGdbServerProviderConfigWidget::populateTransportLayers()
m_transportLayerComboBox->insertItem( m_transportLayerComboBox->insertItem(
m_transportLayerComboBox->count(), tr("ST-LINK/V2"), m_transportLayerComboBox->count(), tr("ST-LINK/V2"),
StLinkUtilGdbServerProvider::RawUsb); StLinkUtilGdbServerProvider::RawUsb);
m_transportLayerComboBox->insertItem(
m_transportLayerComboBox->count(), tr("Keep unspecified"),
StLinkUtilGdbServerProvider::UnspecifiedTransport);
} }
void StLinkUtilGdbServerProviderConfigWidget::setFromProvider() void StLinkUtilGdbServerProviderConfigWidget::setFromProvider()

View File

@@ -42,7 +42,7 @@ namespace Internal {
class StLinkUtilGdbServerProvider final : public GdbServerProvider class StLinkUtilGdbServerProvider final : public GdbServerProvider
{ {
public: public:
enum TransportLayer { ScsiOverUsb = 1, RawUsb = 2 }; enum TransportLayer { ScsiOverUsb = 1, RawUsb = 2, UnspecifiedTransport };
QVariantMap toMap() const final; QVariantMap toMap() const final;
bool fromMap(const QVariantMap &data) final; bool fromMap(const QVariantMap &data) final;

View File

@@ -287,7 +287,6 @@ QdbLinuxDeviceFactory::QdbLinuxDeviceFactory()
setDisplayName(QdbDevice::tr("Boot2Qt Device")); setDisplayName(QdbDevice::tr("Boot2Qt Device"));
setCombinedIcon(":/qdb/images/qdbdevicesmall.png", ":/qdb/images/qdbdevice.png"); setCombinedIcon(":/qdb/images/qdbdevicesmall.png", ":/qdb/images/qdbdevice.png");
setConstructionFunction(&QdbDevice::create); setConstructionFunction(&QdbDevice::create);
setCanCreate(true);
setCreator([] { setCreator([] {
QdbDeviceWizard wizard(Core::ICore::dialogParent()); QdbDeviceWizard wizard(Core::ICore::dialogParent());
if (wizard.exec() != QDialog::Accepted) if (wizard.exec() != QDialog::Accepted)

View File

@@ -415,7 +415,7 @@ ClangdTextMark::ClangdTextMark(const FilePath &filePath,
QVector<QAction *> actions; QVector<QAction *> actions;
QAction *action = new QAction(); QAction *action = new QAction();
action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon())); action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
action->setToolTip(tr("Clang Code Model Marks", "Copy to Clipboard")); action->setToolTip(tr("Copy to Clipboard", "Clang Code Model Marks"));
QObject::connect(action, &QAction::triggered, [diag = m_diagnostic]() { QObject::connect(action, &QAction::triggered, [diag = m_diagnostic]() {
const QString text = ClangDiagnosticWidget::createText({diag}, const QString text = ClangDiagnosticWidget::createText({diag},
ClangDiagnosticWidget::InfoBar); ClangDiagnosticWidget::InfoBar);

View File

@@ -654,6 +654,10 @@ void ClangdTestTooltips::test()
timer.stop(); timer.stop();
QEXPECT_FAIL("TypeName_ResolveTemplateTypeAlias", "typedef already resolved in AST", Abort); QEXPECT_FAIL("TypeName_ResolveTemplateTypeAlias", "typedef already resolved in AST", Abort);
if (client()->versionNumber() >= QVersionNumber(14)) {
QEXPECT_FAIL("TypeNameIntroducedByUsingDeclarationQualified",
"https://github.com/clangd/clangd/issues/989", Abort);
}
QCOMPARE(int(helpItem.category()), expectedCategory); QCOMPARE(int(helpItem.category()), expectedCategory);
QEXPECT_FAIL("TemplateClassQualified", "Additional look-up needed?", Abort); QEXPECT_FAIL("TemplateClassQualified", "Additional look-up needed?", Abort);
QCOMPARE(helpItem.helpIds(), expectedIds); QCOMPARE(helpItem.helpIds(), expectedIds);

View File

@@ -135,6 +135,7 @@ private:
void batchEditConfiguration(); void batchEditConfiguration();
void reconfigureWithInitialParameters(CMakeBuildConfiguration *bc); void reconfigureWithInitialParameters(CMakeBuildConfiguration *bc);
void updateInitialCMakeArguments(); void updateInitialCMakeArguments();
void kitCMakeConfiguration();
CMakeBuildConfiguration *m_buildConfiguration; CMakeBuildConfiguration *m_buildConfiguration;
QTreeView *m_configView; QTreeView *m_configView;
@@ -155,6 +156,7 @@ private:
InfoLabel *m_warningMessageLabel; InfoLabel *m_warningMessageLabel;
QPushButton *m_batchEditButton = nullptr; QPushButton *m_batchEditButton = nullptr;
QPushButton *m_kitConfiguration = nullptr;
}; };
static QModelIndex mapToSource(const QAbstractItemView *view, const QModelIndex &idx) static QModelIndex mapToSource(const QAbstractItemView *view, const QModelIndex &idx)
@@ -220,6 +222,11 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
updateConfigurationStateIndex(index); updateConfigurationStateIndex(index);
}); });
m_kitConfiguration = new QPushButton(tr("Kit Configuration"));
m_kitConfiguration->setToolTip(tr("Edit the current kit's CMake configuration."));
m_kitConfiguration->setFixedWidth(m_kitConfiguration->sizeHint().width());
connect(m_kitConfiguration, &QPushButton::clicked, this, [this]() { kitCMakeConfiguration(); });
m_filterEdit = new FancyLineEdit; m_filterEdit = new FancyLineEdit;
m_filterEdit->setPlaceholderText(tr("Filter")); m_filterEdit->setPlaceholderText(tr("Filter"));
m_filterEdit->setFiltering(true); m_filterEdit->setFiltering(true);
@@ -253,6 +260,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
auto stretcher = new HeaderViewStretcher(m_configView->header(), 0); auto stretcher = new HeaderViewStretcher(m_configView->header(), 0);
m_configView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_configView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_configView->setSelectionBehavior(QAbstractItemView::SelectItems); m_configView->setSelectionBehavior(QAbstractItemView::SelectItems);
m_configView->setAlternatingRowColors(true);
m_configView->setFrameShape(QFrame::NoFrame); m_configView->setFrameShape(QFrame::NoFrame);
m_configView->setItemDelegate(new ConfigModelItemDelegate(m_buildConfiguration->project()->projectDirectory(), m_configView->setItemDelegate(new ConfigModelItemDelegate(m_buildConfiguration->project()->projectDirectory(),
m_configView)); m_configView));
@@ -332,12 +340,12 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
}, },
m_warningMessageLabel, m_warningMessageLabel,
Space(10), Space(10),
m_configurationStates, Row{m_kitConfiguration, m_configurationStates},
Group { Group {
cmakeConfiguration, cmakeConfiguration,
Row { Row {
bc->aspect<InitialCMakeArgumentsAspect>(), bc->aspect<InitialCMakeArgumentsAspect>(),
bc->aspect<AdditionalCMakeArgumentsAspect>() bc->aspect<AdditionalCMakeOptionsAspect>()
}, },
m_reconfigureButton, m_reconfigureButton,
} }
@@ -484,6 +492,23 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
updateInitialCMakeArguments(); updateInitialCMakeArguments();
}); });
connect(bc->aspect<InitialCMakeArgumentsAspect>(),
&Utils::BaseAspect::labelLinkActivated,
this,
[this](const QString &link) {
const CMakeTool *tool = CMakeKitAspect::cmakeTool(
m_buildConfiguration->target()->kit());
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
});
connect(bc->aspect<AdditionalCMakeOptionsAspect>(),
&Utils::BaseAspect::labelLinkActivated,
this,
[this](const QString &link) {
const CMakeTool *tool = CMakeKitAspect::cmakeTool(
m_buildConfiguration->target()->kit());
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
});
updateSelection(); updateSelection();
updateConfigurationStateSelection(); updateConfigurationStateSelection();
} }
@@ -498,10 +523,14 @@ void CMakeBuildSettingsWidget::batchEditConfiguration()
auto editor = new QPlainTextEdit(dialog); auto editor = new QPlainTextEdit(dialog);
auto label = new QLabel(dialog); auto label = new QLabel(dialog);
label->setText(tr("Enter one CMake variable per line.\n" label->setText(tr("Enter one CMake <a href=\"variable\">variable</a> per line.<br/>"
"To set or change a variable, use -D<variable>:<type>=<value>.\n" "To set or change a variable, use -D&lt;variable&gt;:&lt;type&gt;=&lt;value&gt;.<br/>"
"<type> can have one of the following values: FILEPATH, PATH, BOOL, INTERNAL, or STRING.\n" "&lt;type&gt; can have one of the following values: FILEPATH, PATH, BOOL, INTERNAL, or STRING.<br/>"
"To unset a variable, use -U<variable>.\n")); "To unset a variable, use -U&lt;variable&gt;.<br/>"));
connect(label, &QLabel::linkActivated, this, [this](const QString &link) {
const CMakeTool *tool = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit());
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-variables.7.html");
});
editor->setMinimumSize(800, 200); editor->setMinimumSize(800, 200);
auto chooser = new Utils::VariableChooser(dialog); auto chooser = new Utils::VariableChooser(dialog);
@@ -525,9 +554,9 @@ void CMakeBuildSettingsWidget::batchEditConfiguration()
return expander->expand(s); return expander->expand(s);
}); });
const bool isInitial = isInitialConfiguration(); const bool isInitial = isInitialConfiguration();
QStringList unknownArguments; QStringList unknownOptions;
CMakeConfig config = CMakeConfig::fromArguments(isInitial ? lines : expandedLines, CMakeConfig config = CMakeConfig::fromArguments(isInitial ? lines : expandedLines,
unknownArguments); unknownOptions);
for (auto &ci : config) for (auto &ci : config)
ci.isInitial = isInitial; ci.isInitial = isInitial;
@@ -602,6 +631,38 @@ void CMakeBuildSettingsWidget::updateInitialCMakeArguments()
m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->value())); m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->value()));
} }
void CMakeBuildSettingsWidget::kitCMakeConfiguration()
{
m_buildConfiguration->kit()->blockNotification();
auto dialog = new QDialog(this);
dialog->setWindowTitle(tr("Kit CMake Configuration"));
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
connect(dialog, &QDialog::finished, this, [=]{
m_buildConfiguration->kit()->unblockNotification();
});
CMakeKitAspect kitAspect;
CMakeGeneratorKitAspect generatorAspect;
CMakeConfigurationKitAspect configurationKitAspect;
auto layout = new QGridLayout(dialog);
kitAspect.createConfigWidget(m_buildConfiguration->kit())
->addToLayoutWithLabel(layout->parentWidget());
generatorAspect.createConfigWidget(m_buildConfiguration->kit())
->addToLayoutWithLabel(layout->parentWidget());
configurationKitAspect.createConfigWidget(m_buildConfiguration->kit())
->addToLayoutWithLabel(layout->parentWidget());
layout->setColumnStretch(1, 1);
dialog->setMinimumWidth(400);
dialog->resize(800, 1);
dialog->show();
}
void CMakeBuildSettingsWidget::setError(const QString &message) void CMakeBuildSettingsWidget::setError(const QString &message)
{ {
m_buildConfiguration->buildDirectoryAspect()->setProblem(message); m_buildConfiguration->buildDirectoryAspect()->setProblem(message);
@@ -658,10 +719,10 @@ void CMakeBuildSettingsWidget::updateButtonState()
m_resetButton->setEnabled(m_configModel->hasChanges(isInitial) && !isParsing); m_resetButton->setEnabled(m_configModel->hasChanges(isInitial) && !isParsing);
m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->setVisible(isInitialConfiguration()); m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->setVisible(isInitialConfiguration());
m_buildConfiguration->aspect<AdditionalCMakeArgumentsAspect>()->setVisible(!isInitialConfiguration()); m_buildConfiguration->aspect<AdditionalCMakeOptionsAspect>()->setVisible(!isInitialConfiguration());
m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->setEnabled(!isParsing); m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->setEnabled(!isParsing);
m_buildConfiguration->aspect<AdditionalCMakeArgumentsAspect>()->setEnabled(!isParsing); m_buildConfiguration->aspect<AdditionalCMakeOptionsAspect>()->setEnabled(!isParsing);
// Update label and text boldness of the reconfigure button // Update label and text boldness of the reconfigure button
QFont reconfigureButtonFont = m_reconfigureButton->font(); QFont reconfigureButtonFont = m_reconfigureButton->font();
@@ -704,12 +765,27 @@ void CMakeBuildSettingsWidget::updateFromKit()
const Kit *k = m_buildConfiguration->kit(); const Kit *k = m_buildConfiguration->kit();
const CMakeConfig config = CMakeConfigurationKitAspect::configuration(k); const CMakeConfig config = CMakeConfigurationKitAspect::configuration(k);
// First the key value parameters
ConfigModel::KitConfiguration configHash; ConfigModel::KitConfiguration configHash;
for (const CMakeConfigItem &i : config) for (const CMakeConfigItem &i : config)
configHash.insert(QString::fromUtf8(i.key), configHash.insert(QString::fromUtf8(i.key), i);
qMakePair(QString::fromUtf8(i.value), i.expandedValue(k)));
m_configModel->setConfigurationFromKit(configHash); m_configModel->setConfigurationFromKit(configHash);
// Then the additional parameters
const QStringList additionalKitCMake = ProcessArgs::splitArgs(
CMakeConfigurationKitAspect::additionalConfiguration(k));
const QStringList additionalInitialCMake = ProcessArgs::splitArgs(
m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->value());
QStringList mergedArgumentList;
std::set_union(additionalInitialCMake.begin(),
additionalInitialCMake.end(),
additionalKitCMake.begin(),
additionalKitCMake.end(),
std::back_inserter(mergedArgumentList));
m_buildConfiguration->aspect<InitialCMakeArgumentsAspect>()->setValue(
ProcessArgs::joinArgs(mergedArgumentList));
} }
void CMakeBuildSettingsWidget::updateConfigurationStateIndex(int index) void CMakeBuildSettingsWidget::updateConfigurationStateIndex(int index)
@@ -885,6 +961,18 @@ bool CMakeBuildSettingsWidget::eventFilter(QObject *target, QEvent *event)
auto menu = new QMenu(this); auto menu = new QMenu(this);
connect(menu, &QMenu::triggered, menu, &QMenu::deleteLater); connect(menu, &QMenu::triggered, menu, &QMenu::deleteLater);
auto help = new QAction(tr("Help"), this);
menu->addAction(help);
connect(help, &QAction::triggered, this, [=] {
const CMakeConfigItem item = ConfigModel::dataItemFromIndex(idx).toCMakeConfigItem();
const CMakeTool *tool = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit());
const QString linkUrl = "%1/variable/" + QString::fromUtf8(item.key) + ".html";
CMakeTool::openCMakeHelpUrl(tool, linkUrl);
});
menu->addSeparator();
QAction *action = nullptr; QAction *action = nullptr;
if ((action = createForceAction(ConfigModel::DataItem::BOOLEAN, idx))) if ((action = createForceAction(ConfigModel::DataItem::BOOLEAN, idx)))
menu->addAction(action); menu->addAction(action);
@@ -1052,7 +1140,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
auto initialCMakeArgumentsAspect = addAspect<InitialCMakeArgumentsAspect>(); auto initialCMakeArgumentsAspect = addAspect<InitialCMakeArgumentsAspect>();
initialCMakeArgumentsAspect->setMacroExpanderProvider([this] { return macroExpander(); }); initialCMakeArgumentsAspect->setMacroExpanderProvider([this] { return macroExpander(); });
auto additionalCMakeArgumentsAspect = addAspect<AdditionalCMakeArgumentsAspect>(); auto additionalCMakeArgumentsAspect = addAspect<AdditionalCMakeOptionsAspect>();
additionalCMakeArgumentsAspect->setMacroExpanderProvider([this] { return macroExpander(); }); additionalCMakeArgumentsAspect->setMacroExpanderProvider([this] { return macroExpander(); });
macroExpander()->registerVariable(DEVELOPMENT_TEAM_FLAG, macroExpander()->registerVariable(DEVELOPMENT_TEAM_FLAG,
@@ -1352,7 +1440,7 @@ void CMakeBuildConfiguration::setInitialCMakeArguments(const QStringList &args)
QStringList CMakeBuildConfiguration::additionalCMakeArguments() const QStringList CMakeBuildConfiguration::additionalCMakeArguments() const
{ {
return ProcessArgs::splitArgs(aspect<AdditionalCMakeArgumentsAspect>()->value()); return ProcessArgs::splitArgs(aspect<AdditionalCMakeOptionsAspect>()->value());
} }
void CMakeBuildConfiguration::setAdditionalCMakeArguments(const QStringList &args) void CMakeBuildConfiguration::setAdditionalCMakeArguments(const QStringList &args)
@@ -1364,7 +1452,7 @@ void CMakeBuildConfiguration::setAdditionalCMakeArguments(const QStringList &arg
[](const QString &s) { [](const QString &s) {
return !s.isEmpty(); return !s.isEmpty();
}); });
aspect<AdditionalCMakeArgumentsAspect>()->setValue( aspect<AdditionalCMakeOptionsAspect>()->setValue(
ProcessArgs::joinArgs(nonEmptyAdditionalArguments)); ProcessArgs::joinArgs(nonEmptyAdditionalArguments));
} }
@@ -1373,13 +1461,13 @@ void CMakeBuildConfiguration::filterConfigArgumentsFromAdditionalCMakeArguments(
// On iOS the %{Ios:DevelopmentTeam:Flag} evalues to something like // On iOS the %{Ios:DevelopmentTeam:Flag} evalues to something like
// -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM:STRING=MAGICSTRING // -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM:STRING=MAGICSTRING
// which is already part of the CMake variables and should not be also // which is already part of the CMake variables and should not be also
// in the addtional CMake parameters // in the addtional CMake options
const QStringList arguments = ProcessArgs::splitArgs( const QStringList arguments = ProcessArgs::splitArgs(
aspect<AdditionalCMakeArgumentsAspect>()->value()); aspect<AdditionalCMakeOptionsAspect>()->value());
QStringList unknownArguments; QStringList unknownOptions;
const CMakeConfig config = CMakeConfig::fromArguments(arguments, unknownArguments); const CMakeConfig config = CMakeConfig::fromArguments(arguments, unknownOptions);
aspect<AdditionalCMakeArgumentsAspect>()->setValue(ProcessArgs::joinArgs(unknownArguments)); aspect<AdditionalCMakeOptionsAspect>()->setValue(ProcessArgs::joinArgs(unknownOptions));
} }
void CMakeBuildConfiguration::setError(const QString &message) void CMakeBuildConfiguration::setError(const QString &message)
@@ -1635,7 +1723,7 @@ const QStringList InitialCMakeArgumentsAspect::allValues() const
return initialCMakeArguments; return initialCMakeArguments;
} }
void InitialCMakeArgumentsAspect::setAllValues(const QString &values, QStringList &additionalArguments) void InitialCMakeArgumentsAspect::setAllValues(const QString &values, QStringList &additionalOptions)
{ {
QStringList arguments = values.split('\n', Qt::SkipEmptyParts); QStringList arguments = values.split('\n', Qt::SkipEmptyParts);
for (QString &arg: arguments) { for (QString &arg: arguments) {
@@ -1646,13 +1734,13 @@ void InitialCMakeArgumentsAspect::setAllValues(const QString &values, QStringLis
if (arg.startsWith("-T")) if (arg.startsWith("-T"))
arg.replace("-T", "-DCMAKE_GENERATOR_TOOLSET:STRING="); arg.replace("-T", "-DCMAKE_GENERATOR_TOOLSET:STRING=");
} }
m_cmakeConfiguration = CMakeConfig::fromArguments(arguments, additionalArguments); m_cmakeConfiguration = CMakeConfig::fromArguments(arguments, additionalOptions);
for (CMakeConfigItem &ci : m_cmakeConfiguration) for (CMakeConfigItem &ci : m_cmakeConfiguration)
ci.isInitial = true; ci.isInitial = true;
// Display the unknown arguments in "Additional CMake parameters" // Display the unknown arguments in "Additional CMake Options"
const QString additionalArgumentsValue = ProcessArgs::joinArgs(additionalArguments); const QString additionalOptionsValue = ProcessArgs::joinArgs(additionalOptions);
BaseAspect::setValueQuietly(additionalArgumentsValue); BaseAspect::setValueQuietly(additionalOptionsValue);
} }
void InitialCMakeArgumentsAspect::setCMakeConfiguration(const CMakeConfig &config) void InitialCMakeArgumentsAspect::setCMakeConfiguration(const CMakeConfig &config)
@@ -1677,18 +1765,18 @@ void InitialCMakeArgumentsAspect::toMap(QVariantMap &map) const
InitialCMakeArgumentsAspect::InitialCMakeArgumentsAspect() InitialCMakeArgumentsAspect::InitialCMakeArgumentsAspect()
{ {
setSettingsKey("CMake.Initial.Parameters"); setSettingsKey("CMake.Initial.Parameters");
setLabelText(tr("Additional CMake parameters:")); setLabelText(tr("Additional CMake <a href=\"options\">options</a>:"));
setDisplayStyle(LineEditDisplay); setDisplayStyle(LineEditDisplay);
} }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// - AdditionalCMakeParametersAspect: // - AdditionalCMakeOptionsAspect:
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
AdditionalCMakeArgumentsAspect::AdditionalCMakeArgumentsAspect() AdditionalCMakeOptionsAspect::AdditionalCMakeOptionsAspect()
{ {
setSettingsKey("CMake.Additional.Parameters"); setSettingsKey("CMake.Additional.Options");
setLabelText(tr("Additional CMake parameters:")); setLabelText(tr("Additional CMake <a href=\"options\">options</a>:"));
setDisplayStyle(LineEditDisplay); setDisplayStyle(LineEditDisplay);
} }

View File

@@ -164,12 +164,12 @@ public:
void toMap(QVariantMap &map) const final; void toMap(QVariantMap &map) const final;
}; };
class AdditionalCMakeArgumentsAspect final : public Utils::StringAspect class AdditionalCMakeOptionsAspect final : public Utils::StringAspect
{ {
Q_OBJECT Q_OBJECT
public: public:
AdditionalCMakeArgumentsAspect(); AdditionalCMakeOptionsAspect();
}; };
class SourceDirectoryAspect final : public Utils::StringAspect class SourceDirectoryAspect final : public Utils::StringAspect

View File

@@ -310,7 +310,7 @@ static CMakeConfigItem unsetItemFromString(const QString &input)
return item; return item;
} }
CMakeConfig CMakeConfig::fromArguments(const QStringList &list, QStringList &unknownArguments) CMakeConfig CMakeConfig::fromArguments(const QStringList &list, QStringList &unknownOptions)
{ {
CMakeConfig result; CMakeConfig result;
bool inSet = false; bool inSet = false;
@@ -343,7 +343,7 @@ CMakeConfig CMakeConfig::fromArguments(const QStringList &list, QStringList &unk
continue; continue;
} }
unknownArguments.append(i); unknownOptions.append(i);
} }
return result; return result;
} }

View File

@@ -91,7 +91,7 @@ public:
const QList<CMakeConfigItem> &toList() const { return *this; } const QList<CMakeConfigItem> &toList() const { return *this; }
static CMakeConfig fromArguments(const QStringList &list, QStringList &unknownArguments); static CMakeConfig fromArguments(const QStringList &list, QStringList &unknownOptions);
static CMakeConfig fromFile(const Utils::FilePath &input, QString *errorMessage); static CMakeConfig fromFile(const Utils::FilePath &input, QString *errorMessage);
QByteArray valueOf(const QByteArray &key) const; QByteArray valueOf(const QByteArray &key) const;

View File

@@ -352,6 +352,11 @@ public:
m_label(createSubWidget<ElidingLabel>()), m_label(createSubWidget<ElidingLabel>()),
m_changeButton(createSubWidget<QPushButton>()) m_changeButton(createSubWidget<QPushButton>())
{ {
const CMakeTool *tool = CMakeKitAspect::cmakeTool(kit);
connect(this, &KitAspectWidget::labelLinkActivated, this, [=](const QString &link) {
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-generators.7.html");
});
m_label->setToolTip(ki->description()); m_label->setToolTip(ki->description());
m_changeButton->setText(tr("Change...")); m_changeButton->setText(tr("Change..."));
refresh(); refresh();
@@ -391,12 +396,18 @@ private:
const QString platform = CMakeGeneratorKitAspect::platform(kit()); const QString platform = CMakeGeneratorKitAspect::platform(kit());
const QString toolset = CMakeGeneratorKitAspect::toolset(kit()); const QString toolset = CMakeGeneratorKitAspect::toolset(kit());
const QString message = tr("%1 - %2, Platform: %3, Toolset: %4") QStringList messageLabel;
.arg(extraGenerator.isEmpty() ? tr("<none>") : extraGenerator) if (!extraGenerator.isEmpty())
.arg(generator.isEmpty() ? tr("<none>") : generator) messageLabel << extraGenerator << " - ";
.arg(platform.isEmpty() ? tr("<none>") : platform)
.arg(toolset.isEmpty() ? tr("<none>") : toolset); messageLabel << generator;
m_label->setText(message);
if (!platform.isEmpty())
messageLabel << ", " << tr("Platform") << ": " << platform;
if (!toolset.isEmpty())
messageLabel << ", " << tr("Toolset") << ": " << toolset;
m_label->setText(messageLabel.join(""));
} }
void changeGenerator() void changeGenerator()
@@ -490,6 +501,8 @@ private:
extraGeneratorCombo->currentData().toString(), extraGeneratorCombo->currentData().toString(),
platformEdit->isEnabled() ? platformEdit->text() : QString(), platformEdit->isEnabled() ? platformEdit->text() : QString(),
toolsetEdit->isEnabled() ? toolsetEdit->text() : QString()); toolsetEdit->isEnabled() ? toolsetEdit->text() : QString());
refresh();
} }
} }
@@ -561,7 +574,7 @@ CMakeGeneratorKitAspect::CMakeGeneratorKitAspect()
{ {
setObjectName(QLatin1String("CMakeGeneratorKitAspect")); setObjectName(QLatin1String("CMakeGeneratorKitAspect"));
setId(GENERATOR_ID); setId(GENERATOR_ID);
setDisplayName(tr("CMake generator")); setDisplayName(tr("CMake <a href=\"generator\">generator</a>"));
setDescription(tr("CMake generator defines how a project is built when using CMake.<br>" setDescription(tr("CMake generator defines how a project is built when using CMake.<br>"
"This setting is ignored when using other build systems.")); "This setting is ignored when using other build systems."));
setPriority(19000); setPriority(19000);
@@ -925,15 +938,20 @@ private:
QTC_ASSERT(!m_editor, return); QTC_ASSERT(!m_editor, return);
const CMakeTool *tool = CMakeKitAspect::cmakeTool(kit());
m_dialog = new QDialog(m_summaryLabel->window()); m_dialog = new QDialog(m_summaryLabel->window());
m_dialog->setWindowTitle(tr("Edit CMake Configuration")); m_dialog->setWindowTitle(tr("Edit CMake Configuration"));
auto layout = new QVBoxLayout(m_dialog); auto layout = new QVBoxLayout(m_dialog);
m_editor = new QPlainTextEdit; m_editor = new QPlainTextEdit;
auto editorLabel = new QLabel(m_dialog); auto editorLabel = new QLabel(m_dialog);
editorLabel->setText(tr("Enter one CMake variable per line.\n" editorLabel->setText(tr("Enter one CMake <a href=\"variable\">variable</a> per line.<br/>"
"To set a variable, use -D<variable>:<type>=<value>.\n" "To set a variable, use -D&lt;variable&gt;:&lt;type&gt;=&lt;value&gt;.<br/>"
"<type> can have one of the following values: FILEPATH, PATH, " "&lt;type&gt; can have one of the following values: FILEPATH, PATH, "
"BOOL, INTERNAL, or STRING.")); "BOOL, INTERNAL, or STRING."));
connect(editorLabel, &QLabel::linkActivated, this, [=](const QString &link) {
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake-variables.7.html");
});
m_editor->setMinimumSize(800, 200); m_editor->setMinimumSize(800, 200);
auto chooser = new VariableChooser(m_dialog); auto chooser = new VariableChooser(m_dialog);
@@ -942,7 +960,10 @@ private:
m_additionalEditor = new QLineEdit; m_additionalEditor = new QLineEdit;
auto additionalLabel = new QLabel(m_dialog); auto additionalLabel = new QLabel(m_dialog);
additionalLabel->setText(tr("Additional CMake parameters: ")); additionalLabel->setText(tr("Additional CMake <a href=\"options\">options</a>:"));
connect(additionalLabel, &QLabel::linkActivated, this, [=](const QString &link) {
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
});
auto additionalChooser = new VariableChooser(m_dialog); auto additionalChooser = new VariableChooser(m_dialog);
additionalChooser->addSupportedWidget(m_additionalEditor); additionalChooser->addSupportedWidget(m_additionalEditor);
@@ -984,16 +1005,16 @@ private:
QTC_ASSERT(m_editor, return); QTC_ASSERT(m_editor, return);
KitGuard guard(kit()); KitGuard guard(kit());
QStringList unknownArguments; QStringList unknownOptions;
const CMakeConfig config = CMakeConfig::fromArguments(m_editor->toPlainText().split('\n'), const CMakeConfig config = CMakeConfig::fromArguments(m_editor->toPlainText().split('\n'),
unknownArguments); unknownOptions);
CMakeConfigurationKitAspect::setConfiguration(kit(), config); CMakeConfigurationKitAspect::setConfiguration(kit(), config);
QString additionalConfiguration = m_additionalEditor->text(); QString additionalConfiguration = m_additionalEditor->text();
if (!unknownArguments.isEmpty()) { if (!unknownOptions.isEmpty()) {
if (!additionalConfiguration.isEmpty()) if (!additionalConfiguration.isEmpty())
additionalConfiguration += " "; additionalConfiguration += " ";
additionalConfiguration += ProcessArgs::joinArgs(unknownArguments); additionalConfiguration += ProcessArgs::joinArgs(unknownOptions);
} }
CMakeConfigurationKitAspect::setAdditionalConfiguration(kit(), additionalConfiguration); CMakeConfigurationKitAspect::setAdditionalConfiguration(kit(), additionalConfiguration);
} }

View File

@@ -27,6 +27,8 @@
#include "cmaketoolmanager.h" #include "cmaketoolmanager.h"
#include <coreplugin/helpmanager.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -380,6 +382,34 @@ FilePath CMakeTool::searchQchFile(const FilePath &executable)
return {}; return {};
} }
QString CMakeTool::documentationUrl(const Version &version, bool online)
{
if (online) {
QString helpVersion = "latest";
if (!(version.major == 0 && version.minor == 0))
helpVersion = QString("v%1.%2").arg(version.major).arg(version.minor);
return QString("https://cmake.org/cmake/help/%1").arg(helpVersion);
}
return QString("qthelp://org.cmake.%1.%2.%3/doc")
.arg(version.major)
.arg(version.minor)
.arg(version.patch);
}
void CMakeTool::openCMakeHelpUrl(const CMakeTool *tool, const QString &linkUrl)
{
bool online = true;
Version version;
if (tool && tool->isValid()) {
online = tool->qchFilePath().isEmpty();
version = tool->version();
}
Core::HelpManager::showHelpUrl(linkUrl.arg(documentationUrl(version, online)));
}
void CMakeTool::readInformation() const void CMakeTool::readInformation() const
{ {
QTC_ASSERT(m_introspection, return ); QTC_ASSERT(m_introspection, return );

View File

@@ -112,6 +112,9 @@ public:
QString detectionSource() const { return m_detectionSource; } QString detectionSource() const { return m_detectionSource; }
void setDetectionSource(const QString &source) { m_detectionSource = source; } void setDetectionSource(const QString &source) { m_detectionSource = source; }
static QString documentationUrl(const Version &version, bool online);
static void openCMakeHelpUrl(const CMakeTool *tool, const QString &linkUrl);
private: private:
void readInformation() const; void readInformation() const;

View File

@@ -64,6 +64,18 @@ QVariant ConfigModel::data(const QModelIndex &idx, int role) const
return Utils::TreeModel<>::data(idx, role); return Utils::TreeModel<>::data(idx, role);
} }
bool ConfigModel::setData(const QModelIndex &idx, const QVariant &data, int role)
{
Utils::TreeItem *item = itemForIndex(idx);
bool res = item ? item->setData(idx.column(), data, role) : false;
if (res) {
const QModelIndex keyIdx = idx.sibling(idx.row(), 0);
const QModelIndex valueIdx = idx.sibling(idx.row(), 1);
emit dataChanged(keyIdx, valueIdx);
}
return res;
}
ConfigModel::~ConfigModel() = default; ConfigModel::~ConfigModel() = default;
void ConfigModel::appendConfiguration(const QString &key, void ConfigModel::appendConfiguration(const QString &key,
@@ -84,9 +96,9 @@ void ConfigModel::appendConfiguration(const QString &key,
internalItem.isUserNew = true; internalItem.isUserNew = true;
if (m_kitConfiguration.contains(key)) if (m_kitConfiguration.contains(key))
internalItem.kitValue = isInitial ? m_kitConfiguration.value(key).first internalItem.kitValue = QString::fromUtf8(
: m_kitConfiguration.value(key).second; isInitial ? m_kitConfiguration.value(key).value
: m_macroExpander->expand(m_kitConfiguration.value(key).value));
m_configuration.append(internalItem); m_configuration.append(internalItem);
setConfiguration(m_configuration); setConfiguration(m_configuration);
} }
@@ -99,12 +111,38 @@ void ConfigModel::setConfiguration(const QList<DataItem> &config)
void ConfigModel::setConfigurationFromKit(const KitConfiguration &kitConfig) void ConfigModel::setConfigurationFromKit(const KitConfiguration &kitConfig)
{ {
m_kitConfiguration = kitConfig; m_kitConfiguration = kitConfig;
QHash<QString, InternalDataItem> initialConfig;
// Update the kit values for initial configuration keys
for (InternalDataItem &i : m_configuration) { for (InternalDataItem &i : m_configuration) {
if (!i.isInitial)
continue;
if (m_kitConfiguration.contains(i.key)) if (m_kitConfiguration.contains(i.key))
i.kitValue = i.isInitial ? m_kitConfiguration.value(i.key).first i.kitValue = QString::fromUtf8(m_kitConfiguration.value(i.key).value);
: m_kitConfiguration.value(i.key).second; initialConfig.insert(i.key, i);
} }
// Add new initial configuration kit keys
for (const auto &ki : kitConfig) {
if (!initialConfig.contains(QString::fromUtf8(ki.key))) {
InternalDataItem i((DataItem(ki)));
i.isUserNew = true;
i.isInitial = true;
i.newValue = i.value;
i.kitValue = i.value;
m_configuration.append(i);
}
}
// Remove kit values when the kit's keys are removed
for (const auto &i : initialConfig) {
if (!kitConfig.contains(i.key)) {
auto existing = std::find(m_configuration.begin(), m_configuration.end(), i);
if (existing != m_configuration.end())
existing->kitValue.clear();
}
}
setConfiguration(m_configuration); setConfiguration(m_configuration);
} }
@@ -276,11 +314,15 @@ void ConfigModel::setBatchEditConfiguration(const CMakeConfig &config)
auto existing = std::find(m_configuration.begin(), m_configuration.end(), di); auto existing = std::find(m_configuration.begin(), m_configuration.end(), di);
if (existing != m_configuration.end()) { if (existing != m_configuration.end()) {
existing->isUnset = c.isUnset; existing->isUnset = c.isUnset;
if (!c.isUnset) { const QString newValue = QString::fromUtf8(c.value);
existing->isUserChanged = true; // Allow a different value when the user didn't change anything (don't mark the same value as new)
// But allow the same value (going back) when the user did a change
const bool canSetValue = (existing->value != newValue && !existing->isUserChanged)
|| existing->isUserChanged;
if (!c.isUnset && canSetValue) {
existing->isUserChanged = existing->value != newValue;
existing->setType(c.type); existing->setType(c.type);
existing->value = QString::fromUtf8(c.value); existing->newValue = newValue;
existing->newValue = existing->value;
} }
} else if (!c.isUnset) { } else if (!c.isUnset) {
InternalDataItem i(di); InternalDataItem i(di);
@@ -439,59 +481,53 @@ QVariant ConfigModelTreeItem::data(int column, int role) const
return dataItem->isInitial ? "1" : "0"; return dataItem->isInitial ? "1" : "0";
} }
switch (column) { auto fontRole = [this]() -> QFont {
case 0:
switch (role) {
case Qt::DisplayRole:
return dataItem->key.isEmpty() ? QCoreApplication::translate("CMakeProjectManager::ConfigModel", "<UNSET>") : dataItem->key;
case Qt::EditRole:
return dataItem->key;
case Qt::ToolTipRole:
return toolTip();
case Qt::FontRole: {
QFont font; QFont font;
font.setBold(dataItem->isUserNew); font.setBold((dataItem->isUserChanged || dataItem->isUserNew) && !dataItem->isUnset);
font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset); font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset);
font.setItalic((dataItem->isInitial && !dataItem->kitValue.isEmpty())
|| (!dataItem->isInitial && !dataItem->initialValue.isEmpty()));
return font; return font;
} };
default:
return QVariant(); auto foregroundRole = [this](const QString &value) -> QColor {
} bool mismatch = false;
case 1: { if (dataItem->isInitial)
mismatch = !dataItem->kitValue.isEmpty() && dataItem->kitValue != value;
else
mismatch = !dataItem->initialValue.isEmpty() && dataItem->initialValue != value;
return Utils::creatorTheme()->color(mismatch ? Utils::Theme::TextColorError
: Utils::Theme::TextColorNormal);
};
const QString value = currentValue(); const QString value = currentValue();
const auto boolValue = CMakeConfigItem::toBool(value); const auto boolValue = CMakeConfigItem::toBool(value);
const bool isTrue = boolValue.has_value() && boolValue.value(); const bool isTrue = boolValue.has_value() && boolValue.value();
switch (role) { switch (role) {
case Qt::CheckStateRole: case Qt::CheckStateRole:
if (column == 0)
return QVariant();
return (dataItem->type == ConfigModel::DataItem::BOOLEAN) return (dataItem->type == ConfigModel::DataItem::BOOLEAN)
? QVariant(isTrue ? Qt::Checked : Qt::Unchecked) : QVariant(); ? QVariant(isTrue ? Qt::Checked : Qt::Unchecked)
: QVariant();
case Qt::DisplayRole: case Qt::DisplayRole:
if (column == 0)
return dataItem->key.isEmpty()
? QCoreApplication::translate("CMakeProjectManager::ConfigModel", "<UNSET>")
: dataItem->key;
return value; return value;
case Qt::EditRole: case Qt::EditRole:
return (dataItem->type == ConfigModel::DataItem::BOOLEAN) ? QVariant(isTrue) : QVariant(value); if (column == 0)
case Qt::FontRole: { return dataItem->key;
QFont font; return (dataItem->type == ConfigModel::DataItem::BOOLEAN) ? QVariant(isTrue)
font.setBold((dataItem->isUserChanged || dataItem->isUserNew) && !dataItem->isUnset); : QVariant(value);
font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset); case Qt::FontRole:
return font; return fontRole();
} case Qt::ForegroundRole:
case Qt::ForegroundRole: { return foregroundRole(value);
bool mismatch = false; case Qt::ToolTipRole:
if (dataItem->isInitial)
mismatch = !dataItem->kitValue.isEmpty() && dataItem->kitValue != value;
else
mismatch = !dataItem->initialValue.isEmpty() && dataItem->initialValue != value;
return Utils::creatorTheme()->color(mismatch ? Utils::Theme::TextColorHighlight
: Utils::Theme::TextColorNormal);
}
case Qt::ToolTipRole: {
return toolTip(); return toolTip();
}
default:
return QVariant();
}
}
default: default:
return QVariant(); return QVariant();
} }

View File

@@ -133,6 +133,7 @@ public:
~ConfigModel() override; ~ConfigModel() override;
QVariant data(const QModelIndex &idx, int role) const final; QVariant data(const QModelIndex &idx, int role) const final;
bool setData(const QModelIndex &idx, const QVariant &data, int role) final;
void appendConfiguration(const QString &key, void appendConfiguration(const QString &key,
const QString &value = QString(), const QString &value = QString(),
@@ -145,7 +146,7 @@ public:
void setInitialParametersConfiguration(const CMakeConfig &config); void setInitialParametersConfiguration(const CMakeConfig &config);
void setConfiguration(const QList<DataItem> &config); void setConfiguration(const QList<DataItem> &config);
using KitConfiguration = QHash<QString, QPair<QString,QString>>; using KitConfiguration = QHash<QString, CMakeConfigItem>;
void setConfigurationFromKit(const KitConfiguration &kitConfig); void setConfigurationFromKit(const KitConfiguration &kitConfig);
void flush(); void flush();

View File

@@ -325,10 +325,10 @@ void FileApiReader::writeConfigurationIntoBuildDirectory(const QStringList &conf
QTC_CHECK(buildDir.ensureWritableDir()); QTC_CHECK(buildDir.ensureWritableDir());
QByteArray contents; QByteArray contents;
QStringList unknownArguments; QStringList unknownOptions;
contents.append("# This file is managed by Qt Creator, do not edit!\n\n"); contents.append("# This file is managed by Qt Creator, do not edit!\n\n");
contents.append( contents.append(
transform(CMakeConfig::fromArguments(configurationArguments, unknownArguments).toList(), transform(CMakeConfig::fromArguments(configurationArguments, unknownOptions).toList(),
[](const CMakeConfigItem &item) { return item.toCMakeSetLine(nullptr); }) [](const CMakeConfigItem &item) { return item.toCMakeSetLine(nullptr); })
.join('\n') .join('\n')
.toUtf8()); .toUtf8());

View File

@@ -1,7 +1,7 @@
if (NOT IS_ABSOLUTE ${IDE_LOGO_PATH}) if (NOT IS_ABSOLUTE ${IDE_LOGO_PATH})
set(IDE_LOGO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${IDE_LOGO_PATH}") set(IDE_LOGO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${IDE_LOGO_PATH}")
endif() endif()
configure_file(core.qrc.cmakein core_cmake.qrc) configure_file(core_logo.qrc.cmakein core_logo_cmake.qrc)
add_qtc_plugin(Core add_qtc_plugin(Core
DEPENDS Qt5::PrintSupport Qt5::Qml Qt5::Sql Qt5::Gui Qt5::GuiPrivate DEPENDS Qt5::PrintSupport Qt5::Qml Qt5::Sql Qt5::Gui Qt5::GuiPrivate
@@ -15,7 +15,8 @@ add_qtc_plugin(Core
actionmanager/commandsfile.cpp actionmanager/commandsfile.h actionmanager/commandsfile.cpp actionmanager/commandsfile.h
basefilewizard.cpp basefilewizard.h basefilewizard.cpp basefilewizard.h
basefilewizardfactory.cpp basefilewizardfactory.h basefilewizardfactory.cpp basefilewizardfactory.h
${CMAKE_CURRENT_BINARY_DIR}/core_cmake.qrc ${CMAKE_CURRENT_BINARY_DIR}/core_logo_cmake.qrc
core.qrc
core_global.h core_global.h
coreconstants.h coreconstants.h
coreicons.cpp coreicons.h coreicons.cpp coreicons.h

View File

@@ -1,12 +1,10 @@
<RCC> <RCC>
<qresource prefix="/core"> <qresource prefix="/core">
<file alias="images/qtcreatorlogo-big.png">images/logo/128/QtProject-qtcreator.png</file>
<file alias="images/qtcreatorlogo-big@2x.png">images/logo/256/QtProject-qtcreator.png</file>
<file>images/settingscategory_core.png</file> <file>images/settingscategory_core.png</file>
<file>images/settingscategory_core@2x.png</file> <file>images/settingscategory_core@2x.png</file>
<file>images/settingscategory_design.png</file> <file>images/settingscategory_design.png</file>
<file>images/settingscategory_design@2x.png</file> <file>images/settingscategory_design@2x.png</file>
<file alias="images/qtlogo.png">images/logo/16/Qt_logo_green.png</file> <file>images/qtlogo.png</file>
<file alias="images/qtlogo@2x.png">images/logo/32/Qt_logo_green.png</file> <file>images/qtlogo@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -1,10 +0,0 @@
<RCC>
<qresource prefix="/core">
<file alias="images/qtcreatorlogo-big.png">${IDE_LOGO_PATH}/images/logo/128/QtProject-qtcreator.png</file>
<file alias="images/qtcreatorlogo-big@2x.png">${IDE_LOGO_PATH}/images/logo/256/QtProject-qtcreator.png</file>
<file alias="images/settingscategory_core.png">${CMAKE_CURRENT_SOURCE_DIR}/images/settingscategory_core.png</file>
<file alias="images/settingscategory_core@2x.png">${CMAKE_CURRENT_SOURCE_DIR}/images/settingscategory_core@2x.png</file>
<file alias="images/settingscategory_design.png">${CMAKE_CURRENT_SOURCE_DIR}/images/settingscategory_design.png</file>
<file alias="images/settingscategory_design@2x.png">${CMAKE_CURRENT_SOURCE_DIR}/images/settingscategory_design@2x.png</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/core">
<file alias="images/qtcreatorlogo-big.png">images/logo/128/QtProject-qtcreator.png</file>
<file alias="images/qtcreatorlogo-big@2x.png">images/logo/256/QtProject-qtcreator.png</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/core">
<file alias="images/qtcreatorlogo-big.png">${IDE_LOGO_PATH}/images/logo/128/QtProject-qtcreator.png</file>
<file alias="images/qtcreatorlogo-big@2x.png">${IDE_LOGO_PATH}/images/logo/256/QtProject-qtcreator.png</file>
</qresource>
</RCC>

View File

@@ -37,6 +37,7 @@ Project {
"basefilewizardfactory.h", "basefilewizardfactory.h",
"core.qrc", "core.qrc",
"core_global.h", "core_global.h",
"core_logo.qrc",
"coreconstants.h", "coreconstants.h",
"coreicons.cpp", "coreicons.cpp",
"coreicons.h", "coreicons.h",

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

View File

Before

Width:  |  Height:  |  Size: 681 B

After

Width:  |  Height:  |  Size: 681 B

View File

@@ -66,6 +66,9 @@ IWelcomePage::~IWelcomePage()
QPalette WelcomePageFrame::buttonPalette(bool isActive, bool isCursorInside, bool forText) QPalette WelcomePageFrame::buttonPalette(bool isActive, bool isCursorInside, bool forText)
{ {
QPalette pal; QPalette pal;
pal.setBrush(QPalette::Window, {});
pal.setBrush(QPalette::WindowText, {});
Theme *theme = Utils::creatorTheme(); Theme *theme = Utils::creatorTheme();
if (isActive) { if (isActive) {
if (forText) { if (forText) {

View File

@@ -81,7 +81,8 @@ QWidget *panelBar(QWidget *parent)
auto frame = new QWidget(parent); auto frame = new QWidget(parent);
frame->setAutoFillBackground(true); frame->setAutoFillBackground(true);
frame->setMinimumWidth(WelcomePageHelpers::HSpacing); frame->setMinimumWidth(WelcomePageHelpers::HSpacing);
QPalette pal = frame->palette(); QPalette pal;
pal.setBrush(QPalette::Window, {});
pal.setColor(QPalette::Window, themeColor(Theme::Welcome_BackgroundPrimaryColor)); pal.setColor(QPalette::Window, themeColor(Theme::Welcome_BackgroundPrimaryColor));
frame->setPalette(pal); frame->setPalette(pal);
return frame; return frame;

View File

@@ -251,7 +251,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
const QString curTestName = QLatin1String(QTest::currentTestFunction()); const QString curTestName = QLatin1String(QTest::currentTestFunction());
const QString tag = QLatin1String(QTest::currentDataTag()); const QString tag = QLatin1String(QTest::currentDataTag());
const bool useClangd = ClangdSettings::instance().useClangd(); const bool useClangd = m_testKit;
if (useClangd) { if (useClangd) {
if (curTestName == "testFollowSymbolQObjectConnect" if (curTestName == "testFollowSymbolQObjectConnect"
|| curTestName == "testFollowSymbolQObjectOldStyleConnect") { || curTestName == "testFollowSymbolQObjectOldStyleConnect") {
@@ -442,7 +442,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
// qDebug() << "Expected line:" << expectedLine; // qDebug() << "Expected line:" << expectedLine;
// qDebug() << "Expected column:" << expectedColumn; // qDebug() << "Expected column:" << expectedColumn;
if (!ClangdSettings::instance().useClangd()) { if (!useClangd) {
QEXPECT_FAIL("globalVarFromEnum", "Contributor works on a fix.", Abort); QEXPECT_FAIL("globalVarFromEnum", "Contributor works on a fix.", Abort);
QEXPECT_FAIL("matchFunctionSignature_Follow_5", "foo(int) resolved as CallAST", Abort); QEXPECT_FAIL("matchFunctionSignature_Follow_5", "foo(int) resolved as CallAST", Abort);
} }

Some files were not shown because too many files have changed in this diff Show More