Merge "Merge remote-tracking branch 'origin/5.0'"

This commit is contained in:
The Qt Project
2021-06-28 09:41:13 +00:00
72 changed files with 634 additions and 224 deletions

View File

@@ -602,7 +602,7 @@ function(extend_qtc_test target_name)
endfunction()
function(add_qtc_executable name)
cmake_parse_arguments(_arg "SKIP_INSTALL;SKIP_TRANSLATION;ALLOW_ASCII_CASTS;SKIP_PCH"
cmake_parse_arguments(_arg "SKIP_INSTALL;SKIP_TRANSLATION;ALLOW_ASCII_CASTS;SKIP_PCH;QTC_RUNNABLE"
"DESTINATION;COMPONENT;BUILD_DEFAULT"
"CONDITION;DEPENDS;DEFINES;INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PROPERTIES" ${ARGN})
@@ -707,6 +707,11 @@ function(add_qtc_executable name)
enable_pch(${name})
endif()
if (_arg_QTC_RUNNABLE)
# Used by QtCreator to select the default target in the project
set_target_properties(${name} PROPERTIES FOLDER "qtc_runnable")
endif()
if (NOT _arg_SKIP_INSTALL)
unset(COMPONENT_OPTION)
if (_arg_COMPONENT)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -92,11 +92,6 @@
to automatically run CMake every time when you save changes to
\c {CMakeLists.txt} files.
\li Select the \uicontrol {Auto-create build directories} check box to
initially configure the project in a temporary directory. When you
build the project \QC starts from scratch and configures the
project again using the build directory.
\li Select \uicontrol Apply to save your changes.
\endlist

View File

@@ -201,9 +201,22 @@
\image qtcreator-togglebookmark.png
To add a note to a bookmark, right-click the bookmark and select
\uicontrol {Edit Bookmark}. To view the note, move the mouse pointer over
the bookmark.
\section2 Adding Notes to Bookmarks
To add a note to a bookmark:
\list
\li Select \uicontrol Tools > \uicontrol Bookmarks >
\uicontrol {Edit Bookmark}.
\li Press \key {Ctrl+Shift+M}.
\li Right-click a bookmark and select \uicontrol {Edit Bookmark}
in the context menu.
\endlist
To view the note, move the mouse pointer over the bookmark or open the
\uicontrol Bookmarks view in the \l{Working with Sidebars}{sidebar}.
\section2 Navigating Bookmarks
To go to the previous bookmark in the current session, select
\uicontrol Tools > \uicontrol Bookmarks > \uicontrol {Previous Bookmark}
@@ -221,6 +234,8 @@
\image qtcreator-locator-bookmark-filtering.png "Filtering bookmarks in locator"
\section2 Viewing Bookmarks
Bookmarks are listed in the \uicontrol Bookmarks view in the sidebar. To
move between bookmarks, select the \uicontrol {Previous Bookmark} or
\uicontrol {Next Bookmark} button or use the keyboard shortcuts.

View File

@@ -114,7 +114,11 @@
\uicontrol Library > \uicontrol {Assets} displays the images and other files
that you add to the project folder by selecting \inlineimage plus.png
.
. To add assets to your UI, drag-and-drop them to \l Navigator or
\l {Form Editor}.
To add multiple assets to your UI simultaneously, multiselect them first by
holding \key Ctrl and clicking the asset files you wish to select.
\image qtquick-assets-tab.png "Library view Assets tab"

View File

@@ -136,8 +136,6 @@ if [ $LLVM_INSTALL_DIR ]; then
install_name_tool -add_rpath "@executable_path/../lib" "$libexec_path/clang/bin/clazy-standalone" || exit 1
fi
clangbackendArgument="-executable=$libexec_path/clangbackend"
clangpchmanagerArgument="-executable=$libexec_path/clangpchmanagerbackend"
clangrefactoringArgument="-executable=$libexec_path/clangrefactoringbackend"
fi
#### macdeployqt
@@ -173,6 +171,6 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
"-executable=$libexec_path/cpaster" \
"${qbsArguments[@]}" \
"$qml2puppetArgument" \
"$clangbackendArgument" "$clangpchmanagerArgument" "$clangrefactoringArgument" || exit 1
"$clangbackendArgument" || exit 1
fi

View File

@@ -1358,6 +1358,7 @@ class Dumper(DumperBase):
def report(self, stuff):
with self.outputLock:
sys.stdout.write("@\n" + stuff + "@\n")
sys.stdout.flush()
def reportState(self, state):
self.report('state="%s"' % state)
@@ -1588,6 +1589,7 @@ class Dumper(DumperBase):
'output = d.hexencode(sys.stdout.getvalue())',
'sys.stdout = origout',
'd.report("output={channel=\"stderr\",data=\" + output + \"}")',
'sys.stdout.flush()',
'if result is False:',
' d.reportState("continueafternextstop")',
'return True'

View File

@@ -91,7 +91,14 @@ Section {
StudioControls.InfinityLoopIndicator {
id: infinityLoopIndicator
infinite: backendValues.loops.value === -1 ? true : false
property var valueFromBackend: backendValues.loops.value
onValueFromBackendChanged: {
if (valueFromBackend === -1)
infinityLoopIndicator.infinite = true
else
infinityLoopIndicator.infinite = false
}
onInfiniteChanged: {
if (infinityLoopIndicator.infinite === true)

View File

@@ -81,7 +81,7 @@ Column {
}
PropertyLabel {
text: qsTr("Current")
text: qsTr("Current index")
tooltip: qsTr("The index of the current item.")
}
@@ -90,8 +90,8 @@ Column {
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
maximumValue: 9999999
minimumValue: -9999999
maximumValue: 9999999
decimals: 0
backendValue: backendValues.currentIndex
}

View File

@@ -49,7 +49,7 @@ Section {
SectionLayout {
PropertyLabel {
text: qsTr("Highlighted")
text: qsTr("Highlight")
tooltip: qsTr("Whether the delegate is highlighted.")
}

View File

@@ -0,0 +1,109 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** 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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme
Column {
width: parent.width
Section {
width: parent.width
caption: qsTr("PageIndicator")
SectionLayout {
PropertyLabel {
text: qsTr("Count")
tooltip: qsTr("The number of pages.")
}
SecondColumnLayout {
SpinBox {
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
minimumValue: -9999999
maximumValue: 9999999
decimals: 0
backendValue: backendValues.count
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Current")
tooltip: qsTr("The index of the current page.")
}
SecondColumnLayout {
SpinBox {
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
minimumValue: -9999999
maximumValue: 9999999
decimals: 0
backendValue: backendValues.currentIndex
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Interactive")
tooltip: qsTr("Whether the control is interactive.")
}
SecondColumnLayout {
CheckBox {
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
text: backendValues.interactive.valueToString
backendValue: backendValues.interactive
}
ExpandingSpacer {}
}
}
}
ControlSection {}
PaddingSection {}
}

View File

@@ -38,7 +38,7 @@ Column {
caption: qsTr("Rectangle")
SectionLayout {
PropertyLabel { text: qsTr("Color") }
PropertyLabel { text: qsTr("Fill color") }
ColorEditor {
backendValue: backendValues.color
@@ -57,7 +57,7 @@ Column {
}
PropertyLabel {
text: qsTr("Border")
text: qsTr("Border width")
disabledState: !backendValues.border_width.isAvailable
}

View File

@@ -47,7 +47,5 @@ Column {
showStyle: false
}
PaddingSection {
visible: minorQtQuickVersion > 5
}
PaddingSection {}
}

View File

@@ -48,7 +48,5 @@ Column {
showStyle: false
}
PaddingSection {
visible: minorQtQuickVersion > 5
}
PaddingSection {}
}

View File

@@ -49,7 +49,5 @@ Column {
showStyle: true
}
PaddingSection {
visible: minorQtQuickVersion > 5
}
PaddingSection {}
}

View File

@@ -80,8 +80,8 @@ T.AbstractButton {
when: myButton.hovered && myButton.pressed
PropertyChanges {
target: buttonBackground
color: StudioTheme.Values.themeControlBackgroundPressed
border.color: StudioTheme.Values.themeInteraction
color: StudioTheme.Values.themeControlBackgroundInteraction
border.color: StudioTheme.Values.themeControlOutlineInteraction
}
},
State {

View File

@@ -296,7 +296,7 @@ Section {
}
PropertyLabel {
text: qsTr("Letter space")
text: qsTr("Letter spacing")
tooltip: qsTr("Letter spacing for the font.")
}
@@ -316,7 +316,7 @@ Section {
}
PropertyLabel {
text: qsTr("Word space")
text: qsTr("Word spacing")
tooltip: qsTr("Word spacing for the font.")
}

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.15
import StudioControls 1.0 as StudioControls
StudioControls.CheckBox {
@@ -43,6 +43,7 @@ StudioControls.CheckBox {
actionIndicator.forceVisible: extFuncLogic.menuVisible
labelColor: colorLogic.textColor
ColorLogic {
id: colorLogic
backendValue: checkBox.backendValue

View File

@@ -25,7 +25,6 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15 as Effects
import QtQuick.Shapes 1.15
import QtQuick.Templates 2.15 as T
import QtQuickDesignerTheme 1.0
@@ -88,7 +87,7 @@ SecondColumnLayout {
gradientString += "}"
var gradientObject = Qt.createQmlObject(gradientString, gradientThumbnail, "test")
var gradientObject = Qt.createQmlObject(gradientString, gradientThumbnail, "dynamicGradient")
for (i = 0; i < gradientLine.model.count; i++) {
gradientObject.stops[i].color = gradientLine.model.getColor(i)
@@ -123,7 +122,7 @@ SecondColumnLayout {
gradientStr += "}"
var gradientObj = Qt.createQmlObject(gradientStr, shapeGradientThumbnail, "test1")
var gradientObj = Qt.createQmlObject(gradientStr, shapeGradientThumbnail, "dynamicShapeGradient")
for (j = 0; j < gradientLine.model.count; j++) {
gradientObj.stops[j].color = gradientLine.model.getColor(j)
@@ -235,7 +234,7 @@ SecondColumnLayout {
border.color: StudioTheme.Values.themeControlOutline
border.width: StudioTheme.Values.border
Effects.LinearGradient {
Rectangle {
id: gradientThumbnail
anchors.fill: parent
anchors.margins: StudioTheme.Values.border

View File

@@ -123,12 +123,10 @@ Section {
tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " +
"improve performance when creating or changing the text, at the expense of some cosmetic features.")
disabledState: !getBackendValue("kerning").isAvailable
visible: minorQtQuickVersion > 9
}
SecondColumnLayout {
CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
@@ -145,12 +143,10 @@ Section {
"In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " +
"Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.")
disabledState: !getBackendValue("preferShaping").isAvailable
visible: minorQtQuickVersion > 9
}
SecondColumnLayout {
CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth

View File

@@ -275,7 +275,7 @@ Section {
}
PropertyLabel {
text: qsTr("Letter space")
text: qsTr("Letter spacing")
tooltip: qsTr("Letter spacing for the font.")
}
@@ -295,7 +295,7 @@ Section {
}
PropertyLabel {
text: qsTr("Word space")
text: qsTr("Word spacing")
tooltip: qsTr("Word spacing for the font.")
}
@@ -319,12 +319,10 @@ Section {
tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " +
"improve performance when creating or changing the text, at the expense of some cosmetic features.")
disabledState: !getBackendValue("kerning").isAvailable
visible: minorQtQuickVersion > 9
}
SecondColumnLayout {
CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
@@ -341,12 +339,10 @@ Section {
"In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " +
"Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.")
disabledState: !getBackendValue("preferShaping").isAvailable
visible: minorQtQuickVersion > 9
}
SecondColumnLayout {
CheckBox {
visible: minorQtQuickVersion > 9
text: backendValue.valueToString
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth

View File

@@ -145,7 +145,7 @@ Rectangle {
target: backgroundCard
color:StudioTheme.Values.themeInteraction
border.width: StudioTheme.Values.border
border.color: StudioTheme.Values.themeControlBackgroundPressed
border.color: StudioTheme.Values.themeControlOutlineInteraction
}
}
]

View File

@@ -52,7 +52,7 @@ Row {
if (enumString === "")
enumString = root.backendValue.value
root.origin = enumString
root.origin = enumString === undefined ? "Center" : enumString
}
}

View File

@@ -48,7 +48,7 @@ Rectangle {
states: [
State {
name: "default"
when: !mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== value
when: !mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== root.value
PropertyChanges {
target: root
color: StudioTheme.Values.themeTextColorDisabled // TODO
@@ -56,7 +56,7 @@ Rectangle {
},
State {
name: "hover"
when: mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== value
when: mouseArea.containsMouse && !mouseArea.pressed && myControl.origin !== root.value
PropertyChanges {
target: root
color: StudioTheme.Values.themeControlBackgroundInteraction // TODO
@@ -64,7 +64,7 @@ Rectangle {
},
State {
name: "press"
when: mouseArea.containsPress && myControl.origin !== enumValue
when: mouseArea.containsPress && myControl.origin !== root.value
PropertyChanges {
target: root
color: StudioTheme.Values.themeControlBackgroundInteraction // TODO
@@ -73,7 +73,7 @@ Rectangle {
},
State {
name: "active"
when: myControl.origin === value
when: myControl.origin === root.value
PropertyChanges {
target: root
color: StudioTheme.Values.themeInteraction

View File

@@ -46,18 +46,18 @@ Item {
implicitHeight: spinBox.height
onFocusChanged: {
restoreCursor();
transaction.end();
restoreCursor()
transaction.end()
}
Component.onCompleted: {
spinBox.enabled = !isBlocked(backendValue.name);
spinBox.enabled = backendValue === undefined ? false : !isBlocked(backendValue.name)
}
Connections {
target: modelNodeBackend
function onSelectionChanged() {
spinBox.enabled = !isBlocked(backendValue.name);
spinBox.enabled = backendValue === undefined ? false : !isBlocked(backendValue.name)
}
}
@@ -65,25 +65,25 @@ Item {
id: spinBox
onDragStarted: {
hideCursor();
transaction.start();
hideCursor()
transaction.start()
}
onDragEnded: {
restoreCursor();
transaction.end();
restoreCursor()
transaction.end()
}
onDragging: holdCursorInPlace();
onDragging: holdCursorInPlace()
onRealValueModified: {
if (transaction.active())
commitValue();
commitValue()
}
function commitValue() {
if (spinBox.backendValue.value !== spinBox.realValue)
spinBox.backendValue.value = spinBox.realValue;
spinBox.backendValue.value = spinBox.realValue
}
property variant backendValue

View File

@@ -58,9 +58,7 @@ Rectangle {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onPressed: {
infinityLoopIndicator.infinite = !infinityLoopIndicator.infinite
}
onClicked: infinityLoopIndicator.infinite = !infinityLoopIndicator.infinite
}
states: [

View File

@@ -17,6 +17,7 @@ add_qtc_executable(qtcreator
MACOSX_BUNDLE ON
OUTPUT_NAME "${IDE_APP_TARGET}"
DESTINATION "${IDE_APP_PATH}"
QTC_RUNNABLE
)
if (NOT TARGET qtcreator)

View File

@@ -213,7 +213,7 @@ public:
std::enable_if_t<!std::is_function_v<ResultType>, ResultType> value(const QueryTypes &...queryValues)
{
Resetter resetter{this};
ResultType resultValue;
ResultType resultValue{};
bindValues(queryValues...);

View File

@@ -1,5 +1,3 @@
find_package(QT NAMES Qt5 Qt6)
if (WITH_TESTS)
set(TEST_SOURCES
runscenegraphtest.cpp runscenegraphtest.h
@@ -40,7 +38,7 @@ add_qtc_library(Tracing
${TEST_SOURCES}
)
if(${QT_VERSION} VERSION_LESS "6.2.0")
if(${Qt5_VERSION} VERSION_LESS "6.2.0")
extend_qtc_library(Tracing
SOURCES
${TRACING_CPP_SOURCES}

View File

@@ -94,7 +94,7 @@ public:
AutotestPluginPrivate();
~AutotestPluginPrivate() override;
TestNavigationWidgetFactory *m_navigationWidgetFactory = nullptr;
TestNavigationWidgetFactory m_navigationWidgetFactory;
TestResultsPane *m_resultsPane = nullptr;
QMap<QString, ChoicePair> m_runconfigCache;
@@ -149,7 +149,6 @@ AutotestPluginPrivate::AutotestPluginPrivate()
m_frameworkManager.registerTestTool(new CTestTool);
m_frameworkManager.synchronizeSettings(ICore::settings());
m_navigationWidgetFactory = new TestNavigationWidgetFactory;
m_resultsPane = TestResultsPane::instance();
auto panelFactory = new ProjectExplorer::ProjectPanelFactory();
@@ -186,7 +185,6 @@ AutotestPluginPrivate::~AutotestPluginPrivate()
s_projectSettings.clear();
}
delete m_navigationWidgetFactory;
delete m_resultsPane;
}
@@ -279,9 +277,9 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
dd = new AutotestPluginPrivate;
#ifdef WITH_TESTS
ExtensionSystem::PluginManager::registerScenario("TestStringTable",
[this]() { return dd->m_loadProjectScenario(); });
[] { return dd->m_loadProjectScenario(); });
ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface",
[this]() { return dd->m_loadProjectScenario(); });
[] { return dd->m_loadProjectScenario(); });
#endif
return true;
}

View File

@@ -852,12 +852,14 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
return newDir;
if (QDir(oldDir).exists("CMakeCache.txt") && !QDir(newDir).exists("CMakeCache.txt")) {
if (QMessageBox::information(Core::ICore::dialogParent(),
tr("Changing Build Directory"),
tr("Change the build directory and start with a "
"basic CMake configuration?"),
QMessageBox::Ok,
QMessageBox::Cancel)
if (QMessageBox::information(
Core::ICore::dialogParent(),
tr("Changing Build Directory"),
tr("Change the build directory to \"%1\" and start with a "
"basic CMake configuration?")
.arg(newDir),
QMessageBox::Ok,
QMessageBox::Cancel)
== QMessageBox::Ok) {
return newDir;
}

View File

@@ -1009,6 +1009,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
bti.workingDirectory = ct.workingDirectory;
bti.buildKey = buildKey;
bti.usesTerminal = !ct.linksToQtGui;
bti.isQtcRunnable = ct.qtcRunnable;
// Workaround for QTCREATORBUG-19354:
bti.runEnvModifier = [this, buildKey](Environment &env, bool enabled) {
@@ -1027,7 +1028,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
QStringList CMakeBuildSystem::buildTargetTitles() const
{
auto nonAutogenTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){
auto nonAutogenTargets = filtered(m_buildTargets, [](const CMakeBuildTarget &target){
return !CMakeBuildSystem::filteredOutTarget(target);
});
return transform(nonAutogenTargets, &CMakeBuildTarget::title);

View File

@@ -54,6 +54,7 @@ public:
Utils::FilePath executable; // TODO: rename to output?
TargetType targetType = UtilityType;
bool linksToQtGui = false;
bool qtcRunnable = true;
Utils::FilePath workingDirectory;
Utils::FilePath sourceDirectory;
Utils::FilePath makeCommand;

View File

@@ -272,8 +272,19 @@ Tasks CMakeKitAspect::validate(const Kit *k) const
void CMakeKitAspect::setup(Kit *k)
{
CMakeTool *tool = CMakeKitAspect::cmakeTool(k);
if (!tool)
setCMakeTool(k, defaultCMakeToolId());
if (tool)
return;
// Look for a suitable auto-detected one:
const QString id = k->autoDetectionSource();
for (CMakeTool *tool : CMakeToolManager::cmakeTools()) {
if (tool->detectionSource() == id) {
setCMakeTool(k, tool->id());
return;
}
}
setCMakeTool(k, defaultCMakeToolId());
}
void CMakeKitAspect::fix(Kit *k)

View File

@@ -130,26 +130,28 @@ CMakeManager::CMakeManager()
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_buildFileAction, &QAction::triggered, this, [this] { buildFile(); });
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &CMakeManager::updateCmakeActions);
connect(BuildManager::instance(), &BuildManager::buildStateChanged,
this, &CMakeManager::updateCmakeActions);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged, this, [this] {
updateCmakeActions(ProjectTree::currentNode());
});
connect(BuildManager::instance(), &BuildManager::buildStateChanged, this, [this] {
updateCmakeActions(ProjectTree::currentNode());
});
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
this, &CMakeManager::updateBuildFileAction);
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged,
this, &CMakeManager::updateCmakeActions);
updateCmakeActions();
updateCmakeActions(ProjectTree::currentNode());
}
void CMakeManager::updateCmakeActions()
void CMakeManager::updateCmakeActions(Node *node)
{
auto project = qobject_cast<CMakeProject *>(SessionManager::startupProject());
const bool visible = project && !BuildManager::isBuilding(project);
m_runCMakeAction->setVisible(visible);
m_clearCMakeCacheAction->setVisible(visible);
m_rescanProjectAction->setVisible(visible);
enableBuildFileMenus(ProjectTree::currentNode());
enableBuildFileMenus(node);
}
void CMakeManager::clearCMakeCache(BuildSystem *buildSystem)

View File

@@ -44,7 +44,7 @@ public:
CMakeManager();
private:
void updateCmakeActions();
void updateCmakeActions(ProjectExplorer::Node *node);
void clearCMakeCache(ProjectExplorer::BuildSystem *buildSystem);
void runCMake(ProjectExplorer::BuildSystem *buildSystem);
void rescanProject(ProjectExplorer::BuildSystem *buildSystem);

View File

@@ -142,9 +142,9 @@ void CMakeProjectPlugin::extensionsInitialized()
CMakeToolManager::restoreCMakeTools();
}
void CMakeProjectPlugin::updateContextActions()
void CMakeProjectPlugin::updateContextActions(Node *node)
{
auto targetNode = dynamic_cast<const CMakeTargetNode *>(ProjectTree::currentNode());
auto targetNode = dynamic_cast<const CMakeTargetNode *>(node);
const QString targetDisplayName = targetNode ? targetNode->displayName() : QString();
// Build Target:

View File

@@ -27,6 +27,8 @@
#include <extensionsystem/iplugin.h>
namespace ProjectExplorer { class Node; }
namespace CMakeProjectManager {
namespace Internal {
@@ -60,7 +62,7 @@ private:
bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final;
void updateContextActions();
void updateContextActions(ProjectExplorer::Node *node);
class CMakeProjectPluginPrivate *d = nullptr;
};

View File

@@ -109,10 +109,10 @@ public:
, m_name(item->displayName())
, m_executable(item->filePath())
, m_qchFile(item->qchFilePath())
, m_versionDisplay(item->versionDisplay())
, m_isAutoRun(item->isAutoRun())
, m_autodetected(item->isAutoDetected())
, m_isSupported(item->hasFileApi())
, m_versionDisplay(item->versionDisplay())
, m_changed(changed)
{
updateErrorFlags();

View File

@@ -109,6 +109,9 @@ public:
static Utils::FilePath searchQchFile(const Utils::FilePath &executable);
QString detectionSource() const { return m_detectionSource; }
void setDetectionSource(const QString &source) { m_detectionSource = source; }
private:
void readInformation() const;
@@ -126,6 +129,7 @@ private:
bool m_isAutoRun = true;
bool m_isAutoDetected = false;
QString m_detectionSource;
bool m_autoCreateBuildDirectory = false;
Utils::optional<ReaderType> m_readerType;

View File

@@ -177,7 +177,7 @@ void CMakeToolManager::updateDocumentation()
Core::HelpManager::registerDocumentation(docs);
}
void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath)
void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath, const QString &detectionSource)
{
const Id id = Id::fromString(cmakePath.toUserOutput());
@@ -188,6 +188,7 @@ void CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath)
auto newTool = std::make_unique<CMakeTool>(CMakeTool::ManualDetection, id);
newTool->setFilePath(cmakePath);
newTool->setDisplayName(cmakePath.toUserOutput());
newTool->setDetectionSource(detectionSource);
registerCMakeTool(std::move(newTool));
}

View File

@@ -63,7 +63,7 @@ public:
static void updateDocumentation();
public slots:
void registerCMakeByPath(const Utils::FilePath &cmakePath);
void registerCMakeByPath(const Utils::FilePath &cmakePath, const QString &detectionSource);
signals:
void cmakeAdded (const Utils::Id &id);

View File

@@ -256,6 +256,8 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|| f.fragment.contains("Qt6Gui"));
});
ct.qtcRunnable = t.folderTargetProperty == "qtc_runnable";
// Extract library directories for executables:
for (const FragmentInfo &f : t.link.value().fragments) {
if (f.role == "flags") // ignore all flags fragments

View File

@@ -3583,8 +3583,10 @@ protected:
if (i.type()->isNamedType()) { // check if we have to search recursively
const Name *newName = i.type()->asNamedType()->name();
Scope *newScope = i.declaration()->enclosingScope();
if (newName == name && newScope == scope)
if (Matcher::match(newName, name)
&& Matcher::match(newScope->name(), scope->name())) {
continue; // we have found the start location of the search
}
return isValueType(newName, newScope, isValueType);
}
return false;

View File

@@ -308,10 +308,10 @@ void GdbMi::parseList(DebuggerOutputParser &parser)
}
GdbMi child;
child.parseResultOrValue(parser);
if (child.isValid()) {
m_children.push_back(child);
parser.skipCommas();
}
if (!child.isValid())
break;
m_children.push_back(child);
parser.skipCommas();
}
}

View File

@@ -491,7 +491,8 @@ void DockerDevicePrivate::autoDetectCMake(QTextBrowser *log)
log->append(tr("Found CMake binary: %1").arg(cmake.toUserOutput()));
const bool res = QMetaObject::invokeMethod(cmakeManager,
"registerCMakeByPath",
Q_ARG(Utils::FilePath, cmake));
Q_ARG(Utils::FilePath, cmake),
Q_ARG(QString, m_data.id()));
QTC_CHECK(res);
}
}
@@ -1139,7 +1140,7 @@ public:
QTC_ASSERT(item, return {});
auto device = DockerDevice::create(*item);
device->setupId(IDevice::ManuallyAdded, Utils::Id());
device->setupId(IDevice::ManuallyAdded, Id::fromString(item->id()));
device->setType(Constants::DOCKER_DEVICE_TYPE);
device->setMachineType(IDevice::Hardware);

View File

@@ -136,7 +136,7 @@ void McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade()
static McuSupportOptions::UpgradeOption selectedOption;
const QStringList options = { tr("Create new kits"), tr("Replace existing kits") };
selectedOption = McuSupportOptions::UpgradeOption::Keep;
info.setComboInfo(options, [upgradeMcuSupportKits, options](const QString &selected) {
info.setComboInfo(options, [options](const QString &selected) {
selectedOption = options.indexOf(selected) == 0 ?
McuSupportOptions::UpgradeOption::Keep :
McuSupportOptions::UpgradeOption::Replace;

View File

@@ -403,7 +403,7 @@ class ProjectExplorerPluginPrivate : public QObject
public:
ProjectExplorerPluginPrivate();
void updateContextMenuActions();
void updateContextMenuActions(Node *currentNode);
void updateLocationSubMenus();
void executeRunConfiguration(RunConfiguration *, Utils::Id mode);
QPair<bool, QString> buildSettingsEnabledForSession();
@@ -767,10 +767,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
});
ProjectTree *tree = &dd->m_projectTree;
connect(tree, &ProjectTree::currentProjectChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
connect(tree, &ProjectTree::nodeActionsChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
connect(tree, &ProjectTree::currentProjectChanged, dd, [] {
dd->updateContextMenuActions(ProjectTree::currentNode());
});
connect(tree, &ProjectTree::nodeActionsChanged, dd, [] {
dd->updateContextMenuActions(ProjectTree::currentNode());
});
connect(tree, &ProjectTree::currentNodeChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
connect(tree, &ProjectTree::currentProjectChanged,
@@ -1763,8 +1765,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(this, &ProjectExplorerPlugin::settingsChanged,
dd, &ProjectExplorerPluginPrivate::updateRunWithoutDeployMenu);
connect(ICore::instance(), &ICore::newItemDialogStateChanged,
dd, &ProjectExplorerPluginPrivate::updateContextMenuActions);
connect(ICore::instance(), &ICore::newItemDialogStateChanged, dd, [] {
dd->updateContextMenuActions(ProjectTree::currentNode());
});
dd->updateWelcomePage();
@@ -3257,7 +3260,7 @@ void ProjectExplorerPluginPrivate::invalidateProject(Project *project)
updateActions();
}
void ProjectExplorerPluginPrivate::updateContextMenuActions()
void ProjectExplorerPluginPrivate::updateContextMenuActions(Node *currentNode)
{
m_addExistingFilesAction->setEnabled(false);
m_addExistingDirectoryAction->setEnabled(false);
@@ -3294,8 +3297,6 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
runMenu->menu()->clear();
runMenu->menu()->menuAction()->setVisible(false);
const Node *currentNode = ProjectTree::currentNode();
if (currentNode && currentNode->managingProject()) {
ProjectNode *pn;
if (const ContainerNode *cn = currentNode->asContainerNode())

View File

@@ -227,7 +227,7 @@ void ProjectTree::setCurrent(Node *node, Project *project)
if (node != m_currentNode) {
m_currentNode = node;
emit currentNodeChanged();
emit currentNodeChanged(node);
}
if (changedProject) {

View File

@@ -104,7 +104,7 @@ public:
signals:
void currentProjectChanged(ProjectExplorer::Project *project);
void currentNodeChanged();
void currentNodeChanged(Node *node);
void nodeActionsChanged();
// Emitted whenever the model needs to send a update signal.

View File

@@ -154,11 +154,6 @@ QString QbsProfileManager::ensureProfileForKit(const ProjectExplorer::Kit *k)
return profileNameForKit(k);
}
void QbsProfileManager::setProfileForKit(const QString &name, const ProjectExplorer::Kit *k)
{
runQbsConfig(QbsConfigOp::Set, kitNameKeyInQbsSettings(k), name);
}
void QbsProfileManager::updateProfileIfNecessary(const ProjectExplorer::Kit *kit)
{
// kit in list <=> profile update is necessary
@@ -173,29 +168,11 @@ void QbsProfileManager::updateAllProfiles()
addProfileFromKit(kit);
}
void QbsProfileManager::addProfile(const QString &name, const QVariantMap &data)
{
const QString keyPrefix = "profiles." + name + ".";
for (auto it = data.begin(); it != data.end(); ++it)
runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value());
emit qbsProfilesUpdated();
}
void QbsProfileManager::addQtProfileFromKit(const QString &profileName, const ProjectExplorer::Kit *k)
{
if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k)) {
runQbsConfig(QbsConfigOp::Set,
"profiles." + profileName + ".moduleProviders.Qt.qmakeFilePaths",
qt->qmakeCommand().toString());
}
}
void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{
const QString name = profileNameForKit(k);
runQbsConfig(QbsConfigOp::Unset, "profiles." + name);
setProfileForKit(name, k);
addQtProfileFromKit(name, k);
runQbsConfig(QbsConfigOp::Set, kitNameKeyInQbsSettings(k), name);
// set up properties:
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
@@ -203,8 +180,17 @@ void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k)
if (provider->canHandle(k))
data = provider->properties(k, data);
}
if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k))
data.insert("moduleProviders.Qt.qmakeFilePaths", qt->qmakeCommand().toString());
addProfile(name, data);
if (QbsSettings::qbsVersion() < QVersionNumber({1, 20})) {
const QString keyPrefix = "profiles." + name + ".";
for (auto it = data.begin(); it != data.end(); ++it)
runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value());
} else {
runQbsConfig(QbsConfigOp::AddProfile, name, data);
}
emit qbsProfilesUpdated();
}
void QbsProfileManager::handleKitUpdate(ProjectExplorer::Kit *kit)
@@ -246,6 +232,13 @@ QString QbsProfileManager::runQbsConfig(QbsConfigOp op, const QString &key, cons
case QbsConfigOp::Unset:
args << "--unset" << key;
break;
case QbsConfigOp::AddProfile: {
args << "--add-profile" << key;
const QVariantMap props = value.toMap();
for (auto it = props.begin(); it != props.end(); ++it)
args << it.key() << toJSLiteral(it.value());
break;
}
}
const Utils::FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
if (qbsExe.isEmpty() || !qbsExe.exists())

View File

@@ -52,15 +52,13 @@ public:
static QString ensureProfileForKit(const ProjectExplorer::Kit *k);
static QString profileNameForKit(const ProjectExplorer::Kit *kit);
static void updateProfileIfNecessary(const ProjectExplorer::Kit *kit);
enum class QbsConfigOp { Get, Set, Unset }; static QString runQbsConfig(QbsConfigOp op, const QString &key, const QVariant &value = {});
enum class QbsConfigOp { Get, Set, Unset, AddProfile };
static QString runQbsConfig(QbsConfigOp op, const QString &key, const QVariant &value = {});
signals:
void qbsProfilesUpdated();
private:
void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k);
void addProfile(const QString &name, const QVariantMap &data);
void addQtProfileFromKit(const QString &profileName, const ProjectExplorer::Kit *k);
void addProfileFromKit(const ProjectExplorer::Kit *k);
void updateAllProfiles();

View File

@@ -262,7 +262,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
});
// Run initial setup routines
updateContextActions();
updateContextActions(ProjectTree::currentNode());
updateReparseQbsAction();
updateBuildActions();
@@ -280,10 +280,9 @@ void QbsProjectManagerPlugin::targetWasAdded(Target *target)
this, &QbsProjectManagerPlugin::projectChanged);
}
void QbsProjectManagerPlugin::updateContextActions()
void QbsProjectManagerPlugin::updateContextActions(Node *node)
{
auto project = qobject_cast<Internal::QbsProject *>(ProjectTree::currentProject());
const Node *node = ProjectTree::currentNode();
bool isEnabled = !BuildManager::isBuilding(project)
&& project && project->activeTarget()
&& !project->activeTarget()->buildSystem()->isParsing()
@@ -369,7 +368,7 @@ void QbsProjectManagerPlugin::projectChanged()
updateReparseQbsAction();
if (!project || project == ProjectTree::currentProject())
updateContextActions();
updateContextActions(ProjectTree::currentNode());
if (!project || project == currentEditorProject())
updateBuildActions();

View File

@@ -29,7 +29,10 @@
#include <utils/id.h>
#include <utils/parameteraction.h>
namespace ProjectExplorer { class Target; }
namespace ProjectExplorer {
class Target;
class Node;
} // namespace ProjectExplorer
namespace QbsProjectManager {
namespace Internal {
@@ -72,7 +75,7 @@ private:
void reparseCurrentProject();
void reparseProject(QbsProject *project);
void updateContextActions();
void updateContextActions(ProjectExplorer::Node *node);
void updateReparseQbsAction();
void updateBuildActions();

View File

@@ -49,6 +49,19 @@ const char QBS_EXE_KEY[] = "QbsProjectManager/QbsExecutable";
const char QBS_DEFAULT_INSTALL_DIR_KEY[] = "QbsProjectManager/DefaultInstallDir";
const char USE_CREATOR_SETTINGS_KEY[] = "QbsProjectManager/useCreatorDir";
static QString getQbsVersion(const FilePath &qbsExe)
{
if (qbsExe.isEmpty() || !qbsExe.exists())
return {};
QProcess qbsProc;
qbsProc.start(qbsExe.toString(), {"--version"});
if (!qbsProc.waitForStarted(3000) || !qbsProc.waitForFinished(5000)
|| qbsProc.exitCode() != 0) {
return {};
}
return QString::fromLocal8Bit(qbsProc.readAllStandardOutput()).trimmed();
}
static bool operator==(const QbsSettingsData &s1, const QbsSettingsData &s2)
{
return s1.qbsExecutableFilePath == s2.qbsExecutableFilePath
@@ -88,6 +101,14 @@ QString QbsSettings::qbsSettingsBaseDir()
return useCreatorSettingsDirForQbs() ? Core::ICore::userResourcePath().toString() : QString();
}
QVersionNumber QbsSettings::qbsVersion()
{
if (instance().m_settings.qbsVersion.isNull())
instance().m_settings.qbsVersion = QVersionNumber::fromString(
getQbsVersion(qbsExecutableFilePath()));
return instance().m_settings.qbsVersion;
}
QbsSettings &QbsSettings::instance()
{
static QbsSettings theSettings;
@@ -140,7 +161,7 @@ public:
m_qbsExePathChooser.setExpectedKind(PathChooser::ExistingCommand);
m_qbsExePathChooser.setFilePath(QbsSettings::qbsExecutableFilePath());
m_defaultInstallDirLineEdit.setText(QbsSettings::defaultInstallDirTemplate());
m_versionLabel.setText(getQbsVersion());
m_versionLabel.setText(getQbsVersionString());
m_settingsDirCheckBox.setText(tr("Use %1 settings directory for Qbs")
.arg(Core::Constants::IDE_DISPLAY_NAME));
m_settingsDirCheckBox.setChecked(QbsSettings::useCreatorSettingsDirForQbs());
@@ -150,6 +171,10 @@ public:
layout->addRow(tr("Path to qbs executable:"), &m_qbsExePathChooser);
layout->addRow(tr("Default installation directory:"), &m_defaultInstallDirLineEdit);
layout->addRow(tr("Qbs version:"), &m_versionLabel);
connect(&m_qbsExePathChooser, &PathChooser::pathChanged, [this] {
m_versionLabel.setText(getQbsVersionString());
});
}
void apply()
@@ -159,22 +184,15 @@ public:
settings.qbsExecutableFilePath = m_qbsExePathChooser.filePath();
settings.defaultInstallDirTemplate = m_defaultInstallDirLineEdit.text();
settings.useCreatorSettings = m_settingsDirCheckBox.isChecked();
settings.qbsVersion = {};
QbsSettings::setSettingsData(settings);
}
private:
static QString getQbsVersion()
QString getQbsVersionString()
{
const FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
if (qbsExe.isEmpty() || !qbsExe.exists())
return tr("Failed to retrieve version.");
QProcess qbsProc;
qbsProc.start(qbsExe.toString(), {"--version"});
if (!qbsProc.waitForStarted(3000) || !qbsProc.waitForFinished(5000)
|| qbsProc.exitCode() != 0) {
return tr("Failed to retrieve version.");
}
return QString::fromLocal8Bit(qbsProc.readAllStandardOutput()).trimmed();
const QString version = getQbsVersion(m_qbsExePathChooser.filePath());
return version.isEmpty() ? tr("Failed to retrieve version.") : version;
}
PathChooser m_qbsExePathChooser;

View File

@@ -30,6 +30,7 @@
#include <QObject>
#include <QPointer>
#include <QVersionNumber>
namespace QbsProjectManager {
namespace Internal {
@@ -38,6 +39,7 @@ class QbsSettingsData {
public:
Utils::FilePath qbsExecutableFilePath;
QString defaultInstallDirTemplate;
QVersionNumber qbsVersion; // Ephemeral
bool useCreatorSettings = true;
};
@@ -52,6 +54,7 @@ public:
static QString defaultInstallDirTemplate();
static bool useCreatorSettingsDirForQbs();
static QString qbsSettingsBaseDir();
static QVersionNumber qbsVersion();
static void setSettingsData(const QbsSettingsData &settings);
static QbsSettingsData rawSettingsData();

View File

@@ -86,7 +86,7 @@ public:
void activeTargetChanged();
void updateActions();
void updateRunQMakeAction();
void updateContextActions();
void updateContextActions(Node *node);
void buildStateChanged(Project *pro);
void updateBuildFileAction();
void disableBuildFileMenus();
@@ -496,7 +496,7 @@ void QmakeProjectManagerPluginPrivate::activeTargetChanged()
void QmakeProjectManagerPluginPrivate::updateActions()
{
updateRunQMakeAction();
updateContextActions();
updateContextActions(ProjectTree::currentNode());
}
void QmakeProjectManagerPluginPrivate::updateRunQMakeAction()
@@ -515,9 +515,8 @@ void QmakeProjectManagerPluginPrivate::updateRunQMakeAction()
m_runQMakeAction->setEnabled(enable);
}
void QmakeProjectManagerPluginPrivate::updateContextActions()
void QmakeProjectManagerPluginPrivate::updateContextActions(Node *node)
{
const Node *node = ProjectTree::currentNode();
Project *project = ProjectTree::currentProject();
const ContainerNode *containerNode = node ? node->asContainerNode() : nullptr;
@@ -578,7 +577,7 @@ void QmakeProjectManagerPluginPrivate::buildStateChanged(Project *pro)
{
if (pro == ProjectTree::currentProject()) {
updateRunQMakeAction();
updateContextActions();
updateContextActions(ProjectTree::currentNode());
updateBuildFileAction();
}
}

View File

@@ -43,10 +43,9 @@ AnnotationEditorDialog::AnnotationEditorDialog(QWidget *parent,
const QString &targetId,
const QString &customId)
: QDialog(parent)
, m_defaults(std::make_unique<DefaultAnnotationsModel>())
, m_customId(customId)
, ui(std::make_unique<Ui::AnnotationEditorDialog>())
, m_statusIsActive(false)
, m_customId(customId)
, m_defaults(std::make_unique<DefaultAnnotationsModel>())
{
ui->setupUi(this);
setGlobal(m_isGlobal);

View File

@@ -515,6 +515,7 @@ void DebugView::currentStateChanged(const ModelNode &/*node*/)
void DebugView::nodeOrderChanged(const NodeListProperty &listProperty)
{
Q_UNUSED(listProperty)
if (isDebugViewEnabled()) {
QTextStream message;
QString string;

View File

@@ -60,7 +60,6 @@ const int startItemOffset = 96;
const qreal labelFontSize = 10;
const qreal labelShowThreshold = 0.25; // Everything lower than that will hide all labels
const qreal defaultDpi = 96.0;
void drawIcon(QPainter *painter,
int x,

View File

@@ -420,6 +420,8 @@ void TimelineView::customNotification(const AbstractView * /*view*/,
const QList<ModelNode> &nodeList,
const QList<QVariant> &data)
{
Q_UNUSED(nodeList)
Q_UNUSED(data)
if (identifier == QStringLiteral("reset QmlPuppet")) {
QmlTimeline timeline = widget()->graphicsScene()->currentTimeline();
if (timeline.isValid())

View File

@@ -63,7 +63,7 @@
namespace QmlDesigner {
QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames)
QTableWidget* GenerateResource::createFilesTable(const QList<ResourceFile> &fileNames)
{
auto table = new QTableWidget(0, 1);
table->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -74,12 +74,19 @@ QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames)
table->verticalHeader()->hide();
table->setShowGrid(false);
for (const QString &filePath : fileNames) {
QFont font;
font.setBold(true);
for (ResourceFile resource : fileNames){
QString filePath = resource.fileName;
auto checkboxItem = new QTableWidgetItem();
checkboxItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
checkboxItem->setCheckState(Qt::Checked);
checkboxItem->setText(filePath);
if (resource.inProject)
checkboxItem->setFont(font);
int row = table->rowCount();
table->insertRow(row);
table->setItem(row, 0, checkboxItem);
@@ -88,7 +95,7 @@ QTableWidget* GenerateResource::createFilesTable(const QStringList &fileNames)
return table;
}
QStringList GenerateResource::getFileList(const QStringList &fileNames)
QStringList GenerateResource::getFileList(const QList<ResourceFile> &fileNames)
{
QStringList result;
QDialog *dialog = new QDialog(Core::ICore::dialogParent());
@@ -107,21 +114,21 @@ QStringList GenerateResource::getFileList(const QStringList &fileNames)
mainLayout->addWidget(buttonBox, 3, 2, 1, 2);
QObject::connect(buttonBox, &QDialogButtonBox::accepted, dialog, [dialog](){
QObject::connect(buttonBox, &QDialogButtonBox::accepted, dialog, [dialog]() {
dialog->accept();
dialog->deleteLater();
});
QObject::connect(buttonBox, &QDialogButtonBox::rejected, dialog, [dialog](){
QObject::connect(buttonBox, &QDialogButtonBox::rejected, dialog, [dialog]() {
dialog->reject();
dialog->deleteLater();
});
QObject::connect(dialog, &QDialog::accepted, [&result, &table](){
QObject::connect(dialog, &QDialog::accepted, [&result, &table]() {
QStringList fileList;
QString file;
for (int i = 0; i < table->rowCount(); ++i){
for (int i = 0; i < table->rowCount(); ++i) {
if (table->item(i,0)->checkState()){
file = table->item(i,0)->text();
fileList.append(file);
@@ -141,19 +148,21 @@ void GenerateResource::generateMenuEntry()
Core::ActionContainer *buildMenu =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
const Core::Context projectContext(QmlProjectManager::Constants::QML_PROJECT_ID);
// ToDo: move this to QtCreator and add tr to the string then
auto action = new QAction(QCoreApplication::translate("QmlDesigner::GenerateResource", "Generate Resource File"));
auto action = new QAction(QCoreApplication::translate("QmlDesigner::GenerateResource",
"Generate QRC Resource File"));
action->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr);
// todo make it more intelligent when it gets enabled
QObject::connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::startupProjectChanged, [action]() {
QObject::connect(ProjectExplorer::SessionManager::instance(),
&ProjectExplorer::SessionManager::startupProjectChanged, [action]() {
action->setEnabled(ProjectExplorer::SessionManager::startupProject());
});
Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateResource");
QObject::connect(action, &QAction::triggered, [] () {
auto currentProject = ProjectExplorer::SessionManager::startupProject();
QTC_ASSERT(currentProject, return);
auto projectPath = currentProject->projectFilePath().parentDir().toString();
static QMap<QString, QString> lastUsedPathes;
@@ -163,21 +172,13 @@ void GenerateResource::generateMenuEntry()
saveLastUsedPath(lastUsedPathes.value(currentProject->displayName(),
currentProject->projectFilePath().parentDir().parentDir().toString()));
auto resourceFileName = Core:: DocumentManager::getSaveFileName(
QCoreApplication::translate("QmlDesigner::GenerateResource", "Save Project as Resource"),
lastUsedPathes.value(currentProject->displayName()) + "/" + currentProject->displayName() + ".qmlrc",
QCoreApplication::translate("QmlDesigner::GenerateResource", "QML Resource File (*.qmlrc)"));
if (resourceFileName.isEmpty())
return;
Core::MessageManager::writeSilently(
QCoreApplication::translate("QmlDesigner::GenerateResource",
"Generate a resource file out of project %1 to %2")
.arg(currentProject->displayName(), QDir::toNativeSeparators(resourceFileName)));
QString projectFileName = currentProject->displayName() + ".qrc";
QTemporaryFile temp(projectPath + "/XXXXXXX.create.resource.qrc");
QFile persistentFile(projectPath + "/" + projectFileName);
if (!temp.open())
return;
temp.close();
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(
@@ -196,7 +197,7 @@ void GenerateResource::generateMenuEntry()
Core::MessageManager::writeDisrupting(
QCoreApplication::translate("QmlDesigner::GenerateResource",
"Unable to generate resource file: %1")
.arg(resourceFileName));
.arg(temp.fileName()));
return;
}
QByteArray stdOut;
@@ -208,10 +209,11 @@ void GenerateResource::generateMenuEntry()
"A timeout occurred running \"%1\"")
.arg(rccBinary + " " + arguments.join(" ")));
return;
}
if (!stdOut.trimmed().isEmpty()) {
if (!stdOut.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut));
}
if (!stdErr.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr));
@@ -229,14 +231,13 @@ void GenerateResource::generateMenuEntry()
.arg(rccProcess.exitCode()));
return;
}
}
if (!temp.open())
return;
QXmlStreamReader reader(&temp);
QStringList fileList = {};
QList<ResourceFile> fileList = {};
QByteArray firstLine = temp.readLine();
while (!reader.atEnd()) {
@@ -247,12 +248,244 @@ void GenerateResource::generateMenuEntry()
if (reader.name() == QLatin1String("file")) {
QString fileName = reader.readElementText().trimmed();
if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX")))
fileList.append(fileName);
if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX"))
&& !fileName.endsWith(".qmlproject") && !fileName.endsWith(".pri")
&& !fileName.endsWith(".pro") && !fileName.endsWith(".user")
&& !fileName.endsWith(".qrc")) {
ResourceFile file;
file.fileName = fileName;
file.inProject = false;
fileList.append(file);
}
}
}
QDir dir;
dir.setCurrent(projectPath);
Utils::FilePaths paths = currentProject->files(ProjectExplorer::Project::AllFiles);
QStringList projectFiles = {};
for (const Utils::FilePath &path : paths) {
QString relativepath = dir.relativeFilePath(path.toString());
if (!relativepath.endsWith(".qmlproject") && !relativepath.endsWith(".pri")
&& !relativepath.endsWith(".pro") && !relativepath.endsWith(".user")
&& !relativepath.endsWith(".qrc")) {
projectFiles.append(relativepath);
bool found = false;
QString compareString = "./" + relativepath.trimmed();
for (int i = 0; i < fileList.count(); ++i)
if (fileList.at(i).fileName == compareString) {
fileList[i].inProject = true;
found = true;
break;
}
if (!found) {
ResourceFile res;
res.fileName = "./" + relativepath.trimmed();
res.inProject = true;
fileList.append(res);
}
}
}
temp.close();
QStringList modifiedList = getFileList(fileList);
if (!persistentFile.open(QIODevice::ReadWrite | QIODevice::Truncate))
return;
QXmlStreamWriter writer(&persistentFile);
writer.setAutoFormatting(true);
writer.setAutoFormattingIndent(0);
persistentFile.write(firstLine.trimmed());
writer.writeStartElement("qresource");
for (QString file : modifiedList)
writer.writeTextElement("file", file.trimmed());
writer.writeEndElement();
persistentFile.write("\n</RCC>\n");
persistentFile.close();
saveLastUsedPath(Utils::FilePath::fromString(projectFileName).parentDir().toString());
});
// ToDo: move this to QtCreator and add tr to the string then
auto rccAction = new QAction(QCoreApplication::translate("QmlDesigner::GenerateResource",
"Generate RCC Resource File"));
rccAction->setEnabled(ProjectExplorer::SessionManager::startupProject() != nullptr);
QObject::connect(ProjectExplorer::SessionManager::instance(),
&ProjectExplorer::SessionManager::startupProjectChanged, [rccAction]() {
rccAction->setEnabled(ProjectExplorer::SessionManager::startupProject());
});
Core::Command *cmd2 = Core::ActionManager::registerAction(rccAction,
"QmlProject.CreateRCCResource");
QObject::connect(rccAction, &QAction::triggered, [] () {
auto currentProject = ProjectExplorer::SessionManager::startupProject();
QTC_ASSERT(currentProject, return);
auto projectPath = currentProject->projectFilePath().parentDir().toString();
static QMap<QString, QString> lastUsedPathes;
auto saveLastUsedPath = [currentProject] (const QString &lastUsedPath) {
lastUsedPathes.insert(currentProject->displayName(), lastUsedPath);
};
saveLastUsedPath(lastUsedPathes.value(currentProject->displayName(),
currentProject->projectFilePath().parentDir().parentDir().toString()));
auto resourceFileName = Core:: DocumentManager::getSaveFileName(
QCoreApplication::translate("QmlDesigner::GenerateResource",
"Save Project as Resource"), lastUsedPathes.value(currentProject->displayName())
+ "/" + currentProject->displayName() + ".qmlrc",
QCoreApplication::translate("QmlDesigner::GenerateResource",
"QML Resource File (*.qmlrc);;Resource File (*.rcc)"));
if (resourceFileName.isEmpty())
return;
Core::MessageManager::writeSilently(
QCoreApplication::translate("QmlDesigner::GenerateResource",
"Generate a resource file out of project %1 to %2")
.arg(currentProject->displayName(), QDir::toNativeSeparators(resourceFileName)));
QString projectFileName = currentProject->displayName() + ".qrc";
QFile persistentFile(projectPath + "/" + projectFileName);
QTemporaryFile temp(projectPath + "/XXXXXXX.create.resource.qrc");
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(
currentProject->activeTarget()->kit());
QString rccBinary = qtVersion->rccCommand();
Utils::QtcProcess rccProcess;
rccProcess.setWorkingDirectory(projectPath);
QXmlStreamReader reader;
QByteArray firstLine;
if (!QFileInfo(persistentFile).exists()) {
if (!temp.open())
return;
temp.close();
const QStringList arguments1 = {"--project", "--output", temp.fileName()};
for (const auto &arguments : {arguments1}) {
rccProcess.setCommand({rccBinary, arguments});
rccProcess.start();
if (!rccProcess.waitForStarted()) {
Core::MessageManager::writeDisrupting(
QCoreApplication::translate("QmlDesigner::GenerateResource",
"Unable to generate resource file: %1")
.arg(resourceFileName));
return;
}
QByteArray stdOut;
QByteArray stdErr;
if (!rccProcess.readDataFromProcess(30, &stdOut, &stdErr, true)) {
rccProcess.stopProcess();
Core::MessageManager::writeDisrupting(
QCoreApplication::translate("QmlDesigner::GenerateResource",
"A timeout occurred running \"%1\"")
.arg(rccBinary + " " + arguments.join(" ")));
return;
}
if (!stdOut.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut));
if (!stdErr.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr));
if (rccProcess.exitStatus() != QProcess::NormalExit) {
Core::MessageManager::writeDisrupting(
QCoreApplication::translate("QmlDesigner::GenerateResource", "\"%1\" crashed.")
.arg(rccBinary + " " + arguments.join(" ")));
return;
}
if (rccProcess.exitCode() != 0) {
Core::MessageManager::writeDisrupting(
QCoreApplication::translate("QmlDesigner::GenerateResource",
"\"%1\" failed (exit code %2).")
.arg(rccBinary + " " + arguments.join(" "))
.arg(rccProcess.exitCode()));
return;
}
}
reader.setDevice(&temp);
if (!temp.open())
return;
firstLine = temp.readLine();
} else {
reader.setDevice(&persistentFile);
if (!persistentFile.open(QIODevice::ReadWrite))
return;
firstLine = persistentFile.readLine();
}
QList<ResourceFile> fileList = {};
while (!reader.atEnd()) {
const auto token = reader.readNext();
if (token != QXmlStreamReader::StartElement)
continue;
if (reader.name() == QLatin1String("file")) {
QString fileName = reader.readElementText().trimmed();
if ((!fileName.startsWith("./.")) && (!fileName.startsWith("./XXXXXXX"))
&& !fileName.endsWith(".qmlproject") && !fileName.endsWith(".pri")
&& !fileName.endsWith(".pro") && !fileName.endsWith(".user")
&& !fileName.endsWith(".qrc")) {
ResourceFile file;
file.fileName = fileName;
file.inProject = false;
fileList.append(file);
}
}
}
QDir dir;
dir.setCurrent(projectPath);
Utils::FilePaths paths = currentProject->files(ProjectExplorer::Project::AllFiles);
QStringList projectFiles = {};
for (const Utils::FilePath &path : paths) {
QString relativepath = dir.relativeFilePath(path.toString());
if (!relativepath.endsWith(".qmlproject") && !relativepath.endsWith(".pri")
&& !relativepath.endsWith(".pro") && !relativepath.endsWith(".user")
&& !relativepath.endsWith(".qrc")) {
projectFiles.append(relativepath);
bool found = false;
QString compareString = "./" + relativepath.trimmed();
for (int i = 0; i < fileList.count(); ++i)
if (fileList.at(i).fileName == compareString) {
fileList[i].inProject = true;
found = true;
}
if (!found) {
ResourceFile res;
res.fileName = "./" + relativepath.trimmed();
res.inProject = true;
fileList.append(res);
}
}
}
temp.close();
persistentFile.close();
QStringList modifiedList = getFileList(fileList);
QTemporaryFile tempFile(projectPath + "/XXXXXXX.create.modifiedresource.qrc");
@@ -266,14 +499,15 @@ void GenerateResource::generateMenuEntry()
tempFile.write(firstLine.trimmed());
writer.writeStartElement("qresource");
for (int i = 0; i < modifiedList.count(); ++i)
writer.writeTextElement("file", modifiedList.at(i).trimmed());
for (QString file : modifiedList)
writer.writeTextElement("file", file.trimmed());
writer.writeEndElement();
tempFile.write("\n</RCC>\n");
tempFile.close();
const QStringList arguments2 = {"--binary", "--output", resourceFileName, tempFile.fileName()};
const QStringList arguments2 = {"--binary", "--output", resourceFileName,
tempFile.fileName()};
for (const auto &arguments : {arguments2}) {
rccProcess.setCommand({rccBinary, arguments});
@@ -293,12 +527,12 @@ void GenerateResource::generateMenuEntry()
QCoreApplication::translate("QmlDesigner::GenerateResource",
"A timeout occurred running \"%1\"")
.arg(rccBinary + " " + arguments.join(" ")));
return ;
return;
}
if (!stdOut.trimmed().isEmpty()) {
if (!stdOut.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdOut));
}
if (!stdErr.trimmed().isEmpty())
Core::MessageManager::writeFlashing(QString::fromLocal8Bit(stdErr));
@@ -322,6 +556,7 @@ void GenerateResource::generateMenuEntry()
saveLastUsedPath(Utils::FilePath::fromString(resourceFileName).parentDir().toString());
});
buildMenu->addAction(cmd, ProjectExplorer::Constants::G_BUILD_RUN);
buildMenu->addAction(cmd2, ProjectExplorer::Constants::G_BUILD_RUN);
}
} // namespace QmlDesigner

View File

@@ -28,8 +28,13 @@
namespace QmlDesigner {
namespace GenerateResource {
struct ResourceFile
{
QString fileName;
bool inProject;
};
void generateMenuEntry();
QStringList getFileList(const QStringList &);
QTableWidget* createFilesTable(const QStringList &);
QStringList getFileList(const QList<ResourceFile> &);
QTableWidget* createFilesTable(const QList<ResourceFile> &);
}
} // namespace QmlDesigner

View File

@@ -236,8 +236,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
Core::ActionManager::registerAction(action, "QmlPreview.PreviewFile", Core::Context(Constants::C_PROJECT_TREE)),
Constants::G_FILE_OTHER);
action->setVisible(false);
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action]() {
const Node *node = ProjectTree::currentNode();
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action](Node *node) {
const FileNode *fileNode = node ? node->asFileNode() : nullptr;
action->setVisible(fileNode ? fileNode->fileType() == FileType::QML : false);
});

View File

@@ -516,9 +516,11 @@ Tasks BaseQtVersion::validateKit(const Kit *k)
return result;
const Id dt = DeviceTypeKitAspect::deviceTypeId(k);
const QSet<Id> tdt = targetDeviceTypes();
if (!tdt.isEmpty() && !tdt.contains(dt))
result << BuildSystemTask(Task::Warning, tr("Device type is not supported by Qt version."));
if (dt != "DockerDeviceType") {
const QSet<Id> tdt = targetDeviceTypes();
if (!tdt.isEmpty() && !tdt.contains(dt))
result << BuildSystemTask(Task::Warning, tr("Device type is not supported by Qt version."));
}
if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(k)) {
Abi targetAbi = tc->targetAbi();

View File

@@ -132,7 +132,7 @@ public:
void copyPathContextMenu();
void copyUrlContextMenu();
void updateContextActions();
void updateContextActions(Node *node);
ResourceEditorW * currentEditor() const;
@@ -368,9 +368,8 @@ void ResourceEditorPluginPrivate::renamePrefixContextMenu()
node->renamePrefix(prefix, dialog.lang());
}
void ResourceEditorPluginPrivate::updateContextActions()
void ResourceEditorPluginPrivate::updateContextActions(Node *node)
{
const Node *node = ProjectTree::currentNode();
const bool isResourceNode = dynamic_cast<const ResourceTopLevelNode *>(node);
m_addPrefix->setEnabled(isResourceNode);
m_addPrefix->setVisible(isResourceNode);

View File

@@ -195,7 +195,7 @@ public:
connect(checkout,
&ExampleCheckout::finishedSucessfully,
this,
[checkout, this, formFile, example]() {
[checkout, formFile, example]() {
const QString projectFile = checkout->extractionFolder() + "/" + example
+ "/" + example + ".qmlproject";

View File

@@ -48,6 +48,18 @@ using namespace QMakeInternal;
IoUtils::FileType IoUtils::fileType(const QString &fileName)
{
// FIXME:
if (fileName.startsWith("docker:/")) {
if (!fileName.startsWith("docker://"))
qWarning("File name not canonical");
int pos = fileName.indexOf('/', 10);
if (pos == 0) {
qWarning("File name not canonical");
return FileNotFound;
}
return fileType(fileName.mid(pos));
}
Q_ASSERT(fileName.isEmpty() || isAbsolutePath(fileName));
#ifdef Q_OS_WIN
DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16());

View File

@@ -1482,7 +1482,6 @@ TEST_F(SqliteStatement, ReadStatementOptionalValueWithTransactions)
TEST_F(SqliteStatement, ReadStatementReadCallbackWithTransactions)
{
using Tuple = std::tuple<Utils::SmallString, Utils::SmallString, long long>;
MockFunction<Sqlite::CallbackControl(Utils::SmallStringView, Utils::SmallStringView, long long)> callbackMock;
ReadStatement<3> statement("SELECT name, number, value FROM test WHERE name=? AND number=?",
database);
@@ -1549,7 +1548,6 @@ TEST_F(SqliteStatement, ReadWriteStatementOptionalValueWithTransactions)
TEST_F(SqliteStatement, ReadWriteStatementReadCallbackWithTransactions)
{
using Tuple = std::tuple<Utils::SmallString, Utils::SmallString, long long>;
MockFunction<Sqlite::CallbackControl(Utils::SmallStringView, Utils::SmallStringView, long long)> callbackMock;
ReadWriteStatement<3> statement(
"SELECT name, number, value FROM test WHERE name=? AND number=?", database);