Merge remote-tracking branch 'origin/6.0'
Change-Id: I9d25a7ac39b3619856fc8d8a6be6f91a403b3969
@@ -20,6 +20,7 @@ macro.Q3DS = "Qt 3D Studio"
|
|||||||
macro.QA = "Qt Assistant"
|
macro.QA = "Qt Assistant"
|
||||||
macro.QB = "Qt Bridge"
|
macro.QB = "Qt Bridge"
|
||||||
macro.QBPS = "Qt Bridge for Adobe Photoshop"
|
macro.QBPS = "Qt Bridge for Adobe Photoshop"
|
||||||
|
macro.QBXD = "Qt Bridge for Adobe XD"
|
||||||
macro.QBSK = "Qt Bridge for Sketch"
|
macro.QBSK = "Qt Bridge for Sketch"
|
||||||
macro.QBF = "Qt Bridge for Figma"
|
macro.QBF = "Qt Bridge for Figma"
|
||||||
macro.QC = "$IDE_DISPLAY_NAME"
|
macro.QC = "$IDE_DISPLAY_NAME"
|
||||||
|
BIN
doc/qtdesignstudio/images/qt-bridge-xd-home.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
doc/qtdesignstudio/images/qt-bridge-xd-menu.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
doc/qtdesignstudio/images/qt-bridge-xd-settings.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
doc/qtdesignstudio/images/qt-bridge-xd-warn.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
doc/qtdesignstudio/images/qt-bridge-xd.png
Normal file
After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 50 KiB |
BIN
doc/qtdesignstudio/images/xd-logo.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
@@ -52,11 +52,13 @@
|
|||||||
\row
|
\row
|
||||||
\li \inlineimage ai-logo.png
|
\li \inlineimage ai-logo.png
|
||||||
\li \inlineimage ps-logo.png
|
\li \inlineimage ps-logo.png
|
||||||
|
\li \inlineimage xd-logo.png
|
||||||
\li \inlineimage sketch-logo.png
|
\li \inlineimage sketch-logo.png
|
||||||
\li \inlineimage figma-logo.png
|
\li \inlineimage figma-logo.png
|
||||||
\row
|
\row
|
||||||
\li \l{Exporting Designs from Adobe Illustrator}{Adobe Illustrator}
|
\li \l{Exporting Designs from Adobe Illustrator}{Adobe Illustrator}
|
||||||
\li \l{Exporting Designs from Adobe Photoshop}{Adobe Photoshop}
|
\li \l{Exporting Designs from Adobe Photoshop}{Adobe Photoshop}
|
||||||
|
\li \l{Exporting Designs from Adobe XD}{Adobe XD}
|
||||||
\li \l{Exporting Designs from Sketch}{Sketch}
|
\li \l{Exporting Designs from Sketch}{Sketch}
|
||||||
\li \l{Exporting Designs from Figma}{Figma}
|
\li \l{Exporting Designs from Figma}{Figma}
|
||||||
\endtable
|
\endtable
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\previouspage qtbridge-ps-setup.html
|
\previouspage qtbridge-ps-setup.html
|
||||||
\page qtbridge-ps-using.html
|
\page qtbridge-ps-using.html
|
||||||
\nextpage sketchqtbridge.html
|
\nextpage xdqtbridge.html
|
||||||
|
|
||||||
\title Using \QBPS
|
\title Using \QBPS
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
// Note: The \page value is hard-coded as a link in Qt Bridge for Sketch.
|
// Note: The \page value is hard-coded as a link in Qt Bridge for Sketch.
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\previouspage qtbridge-ps-using.html
|
\previouspage qtbridge-xd-using.html
|
||||||
\page sketchqtbridge.html
|
\page sketchqtbridge.html
|
||||||
\nextpage qtbridge-sketch-setup.html
|
\nextpage qtbridge-sketch-setup.html
|
||||||
|
|
||||||
|
58
doc/qtdesignstudio/src/qtbridge/qtbridge-xd-overview.qdoc
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Design Studio 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.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
// Note: The \page value is hard-coded as a link in Qt Bridge for Adobe XD.
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\previouspage qtbridge-ps-using.html
|
||||||
|
\page xdqtbridge.html
|
||||||
|
\nextpage qtbridge-xd-setup.html
|
||||||
|
|
||||||
|
\title Exporting Designs from Adobe XD
|
||||||
|
|
||||||
|
\note This is a \e {Technical Preview} release of the \QBXD. Some design
|
||||||
|
elements might not be exported and imported into \QDS as expected.
|
||||||
|
|
||||||
|
You can use \QBXD to export designs from Adobe XD to \e {.qtbridge}
|
||||||
|
format that you can \l{Importing 2D Assets}{import} to projects in \QDS.
|
||||||
|
|
||||||
|
\image qt-bridge-xd.png
|
||||||
|
|
||||||
|
The following topics describe setting up and using \QBXD:
|
||||||
|
|
||||||
|
\list
|
||||||
|
|
||||||
|
\li \l{Setting Up Qt Bridge for Adobe XD}
|
||||||
|
|
||||||
|
You must install and set up the \QBXD export plugin before you can use
|
||||||
|
it to export designs.
|
||||||
|
|
||||||
|
\li \l{Using Qt Bridge for Adobe XD}
|
||||||
|
|
||||||
|
To get the best results when you use \QB to export designs from
|
||||||
|
Adobe XD, you should follow the guidelines for working with
|
||||||
|
Adobe XD and organizing your assets.
|
||||||
|
\endlist
|
||||||
|
*/
|
57
doc/qtdesignstudio/src/qtbridge/qtbridge-xd-setup.qdoc
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Bridge 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.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\previouspage xdqtbridge.html
|
||||||
|
\page qtbridge-xd-setup.html
|
||||||
|
\nextpage qtbridge-xd-using.html
|
||||||
|
|
||||||
|
\title Setting Up \QBXD
|
||||||
|
|
||||||
|
You can purchase a \QBXD license from the \l{https://marketplace.qt.io/}
|
||||||
|
{Qt Marketplace}, and then use the Qt Installer to have the \QBXD
|
||||||
|
plugin package copied to the following path in your Qt installation
|
||||||
|
folder:
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li On Windows:
|
||||||
|
\c {Tools\QtDesignStudio\xd_bridge\qtbridge.xdx}
|
||||||
|
\li On \macos:
|
||||||
|
\c {QtDesignStudio/xd_bridge/qtbridge.xdx}.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
\note Install Adobe XD before installing the plugin.
|
||||||
|
|
||||||
|
To install the \QBXD plugin to Adobe XD, double-click \c qtbridge.xdx in the
|
||||||
|
\c xd_bridge folder in the installation directory of \QDS. Adobe XD will
|
||||||
|
automatically install \QBXD.
|
||||||
|
|
||||||
|
\note Since the plugin is not distributed through Adobe's marketplace, during
|
||||||
|
the installation Adobe XD might warn about the third-party developer.
|
||||||
|
|
||||||
|
\image qt-bridge-xd-warn.png
|
||||||
|
|
||||||
|
You can launch the plugin from \uicontrol Plugins > \uicontrol {\QB}.
|
||||||
|
*/
|
219
doc/qtdesignstudio/src/qtbridge/qtbridge-xd-using.qdoc
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Bridge 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.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\previouspage qtbridge-xd-setup.html
|
||||||
|
\page qtbridge-xd-using.html
|
||||||
|
\nextpage sketchqtbridge.html
|
||||||
|
|
||||||
|
\title Using \QBXD
|
||||||
|
|
||||||
|
\section1 Organizing Assets
|
||||||
|
|
||||||
|
To get the best results when you use \QBXD to export designs from Adobe XD
|
||||||
|
to \QDS, follow these guidelines when working with Adobe XD:
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li Arrange your design into \e artboards and organize it into groups and
|
||||||
|
layers that are imported into \QDS as separate files.
|
||||||
|
\li Use descriptive and unique IDs to avoid duplicate asset names and IDs
|
||||||
|
in the generated UI.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
|
||||||
|
To use the fonts that you use in Adobe XD also in \QDS, you need to import
|
||||||
|
them to \QDS as assets. \QDS deploys them to devices when you preview the
|
||||||
|
UI. For more information, see \l{Using Custom Fonts}.
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Supported Design Elements
|
||||||
|
|
||||||
|
You can export the following parts of your design using \QBXD:
|
||||||
|
\list
|
||||||
|
\li Artboard
|
||||||
|
\li Group
|
||||||
|
\li Shapes (Rectangle, Ellipse, Polygon, Line, Pen)
|
||||||
|
\li Text
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
The following design elements might not be exported as expected.
|
||||||
|
\list
|
||||||
|
\li Components
|
||||||
|
\li Prototype
|
||||||
|
\li Repeat Grid
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Using Artboards
|
||||||
|
|
||||||
|
The hierarchical relationships between artboards and layers are preserved
|
||||||
|
when you export designs from Adobe XD and import them into \QDS. The
|
||||||
|
relationships are the basis of how the Items are organized in the generated
|
||||||
|
code in \QDS.
|
||||||
|
|
||||||
|
An artboard can only be exported as a component or skipped. A component will
|
||||||
|
be imported as a separate file that contains the artwork and text on the
|
||||||
|
artboard.
|
||||||
|
|
||||||
|
\section2 Annotate Layers for Export
|
||||||
|
|
||||||
|
With \QBXD, layers can be annotated to hint how each layer or group must be
|
||||||
|
exported. \uicontrol The {Home} panel displays and allows layer annotation for
|
||||||
|
export:
|
||||||
|
|
||||||
|
\image qt-bridge-xd-home.png
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
\li \QBXD automatically proposes identifiers for all groups and layers
|
||||||
|
that you can change in the \uicontrol {ID} field. Use unique and
|
||||||
|
descriptive IDs to avoid duplicate IDs when the layer and the
|
||||||
|
respective artwork is imported into \QDS. Even though the importer
|
||||||
|
in \QDS is capable of fixing duplicate IDs, doing so will generate
|
||||||
|
warnings. It is recommend that you should manually check all the
|
||||||
|
IDs to make them unique and descriptive.
|
||||||
|
|
||||||
|
\li In the \uicontrol {Export As} field, select the export type for the
|
||||||
|
group or layer:
|
||||||
|
\list
|
||||||
|
\li \uicontrol Component exports the layer as a separate UI file
|
||||||
|
that contains all the exportable artwork and text in it. Only
|
||||||
|
Artboards can be exported as components.
|
||||||
|
\li \uicontrol Child exports each asset of the selected group
|
||||||
|
or layer a separate PNG file, with references
|
||||||
|
to the images in the component file.
|
||||||
|
\li \uicontrol Merged merges the rendition of the selected groups
|
||||||
|
and layers into the rendition of parent artboard or group as
|
||||||
|
one item.
|
||||||
|
\li \uicontrol Skipped completely skips the selected layer.
|
||||||
|
\endlist
|
||||||
|
\li In the \uicontrol {Component} field, specify the component or
|
||||||
|
\l {Shapes}{Qt Quick Studio Component} to morph this
|
||||||
|
layer into. The component that is generated during import will be
|
||||||
|
of this type. For example, if you drew a rectangle, you can export
|
||||||
|
it as a \l {basic-rectangle}{Rectangle} component.
|
||||||
|
You can provide the import statement of the module where the
|
||||||
|
component is defined in the \uicontrol {Imports} field.
|
||||||
|
\note The implicit properties except position and size are not
|
||||||
|
applied when the \uicontrol {Component} is defined. For example, all text
|
||||||
|
properties will be ignored if \uicontrol {Component} is defined
|
||||||
|
for a text layer, but explicit properties defined in the \uicontrol
|
||||||
|
{Properties} field will be applied.
|
||||||
|
\li In the \uicontrol {Imports} field, enter additional import statements
|
||||||
|
to have them added to the generated code file. For example, to use
|
||||||
|
Qt Quick Controls 2.3, you need the import statement
|
||||||
|
\c {QtQuick.Controls 2.3} and to use Qt Quick Studio Components 1.0,
|
||||||
|
you need the import statement \c {QtQuick.Studio.Components 1.0}.
|
||||||
|
You can also import a module as an alias.
|
||||||
|
\li In the \uicontrol {Properties} field, specify properties for the
|
||||||
|
component. You can add and modify properties in \QDS.
|
||||||
|
\li Select the \uicontrol Clip check box to enable clipping in the
|
||||||
|
component generated from the layer. The generated component will clip
|
||||||
|
its own painting, as well as the painting of its children, to its
|
||||||
|
bounding rectangle.
|
||||||
|
\li Select the \uicontrol Visible check box to determine the visibility
|
||||||
|
of the layer in the generated UI in \QDS.
|
||||||
|
\li Select \uicontrol Export to export the document into a .qtbridge
|
||||||
|
archive.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Export Defaults
|
||||||
|
|
||||||
|
\QBXD assigns the following defaults to the layers:
|
||||||
|
|
||||||
|
By default:
|
||||||
|
\list
|
||||||
|
\li Artboards are exported as \e components.
|
||||||
|
\li Immediate children of an Artboard and Text layers are exported as
|
||||||
|
\e child.
|
||||||
|
\li Any layer not falling under the aforementioned criteria is exported
|
||||||
|
as \e merged.
|
||||||
|
\li Images are exported as PNGs by default with no Hi-DPI images.
|
||||||
|
\li \uicontrol Visible is set to \c true.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
All the assets and metadata are copied to the directory you specified. This
|
||||||
|
might take a little while depending on the complexity of your project.
|
||||||
|
|
||||||
|
You can now create a project in \QDS and import the assets to it, as
|
||||||
|
described in \l {Creating Projects} and \l{Importing Designs}.
|
||||||
|
|
||||||
|
\section1 \QBXD Settings
|
||||||
|
|
||||||
|
Select \uicontrol Settings to change the export settings.
|
||||||
|
|
||||||
|
\image qt-bridge-xd-menu.png
|
||||||
|
|
||||||
|
\image qt-bridge-xd-settings.png
|
||||||
|
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
\li Select \uicontrol {Reset All} to remove all of the \QB data
|
||||||
|
stored in the document. Use \uicontrol {Edit} > \uicontrol {Undo}
|
||||||
|
to restore the data if you accidentally removed it.
|
||||||
|
\li You can export images into PNG, JPG or SVG format. In the section
|
||||||
|
\uicontrol {Export Formats}, select the image format to
|
||||||
|
export.
|
||||||
|
\li Depending on the image format selected for export, the
|
||||||
|
\uicontrol {Format Options} allows fine tuning the exported
|
||||||
|
image.
|
||||||
|
\list
|
||||||
|
\li Select \uicontrol {Hi-DPI Assets} to generate Hi-DPI
|
||||||
|
images alongside normal scale images. Being a vector format,
|
||||||
|
this option is not available for SVG format.
|
||||||
|
\li Select \uicontrol {SVG Minify} to minify the SVG.
|
||||||
|
\li Select \uicontrol {JPG Quality} to specify the JPG
|
||||||
|
compression quality in the range [1, 100].
|
||||||
|
\endlist
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
\section1 Suggestions and Tips
|
||||||
|
|
||||||
|
You can export assets using the default settings and make all the changes
|
||||||
|
later in \QDS. If you are familiar with the \l{QML Syntax Basics}
|
||||||
|
{QML syntax}, you can modify the settings to tailor the generated code to
|
||||||
|
a certain degree. For example, you can specify the component or
|
||||||
|
\l {Shapes}{Qt Quick Studio Component} to use for a component or
|
||||||
|
layer. If you have drawn an arc that you mean to animate, you can export it
|
||||||
|
as an \l Arc component to avoid having to replace the arc image with an Arc
|
||||||
|
component in \QDS. Or you could export a button as a Qt Quick Controls
|
||||||
|
\l Button component.
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li Name the layers in exactly the same way as your IDs, to be able to
|
||||||
|
find artwork later, especially as the export files can grow very
|
||||||
|
large and complicated as they approach the level of a complete UI
|
||||||
|
project.
|
||||||
|
\li Make sure to skip all artboards that you don't want to be part of
|
||||||
|
the final UI to avoid cluttering the \QDS project. You can select
|
||||||
|
multiple artboards on a page and then select \uicontrol Skip in \QBXD
|
||||||
|
to skip them.
|
||||||
|
\li Store all assets in the scalable vector graphics (SVG) format to be
|
||||||
|
able to easily rescale them for different screen sizes and resolutions.
|
||||||
|
You can export assets into JPG, PNG, or SVG format and select options
|
||||||
|
for optimizing them during the export.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
*/
|
@@ -153,6 +153,11 @@
|
|||||||
\li \l{Setting Up Qt Bridge for Adobe Photoshop}
|
\li \l{Setting Up Qt Bridge for Adobe Photoshop}
|
||||||
\li \l{Using Qt Bridge for Adobe Photoshop}
|
\li \l{Using Qt Bridge for Adobe Photoshop}
|
||||||
\endlist
|
\endlist
|
||||||
|
\li \l{Exporting Designs from Adobe XD}
|
||||||
|
\list
|
||||||
|
\li \l{Setting Up Qt Bridge for Adobe XD}
|
||||||
|
\li \l{Using Qt Bridge for Adobe XD}
|
||||||
|
\endlist
|
||||||
\li \l{Exporting Designs from Sketch}
|
\li \l{Exporting Designs from Sketch}
|
||||||
\list
|
\list
|
||||||
\li \l{Setting Up Qt Bridge for Sketch}
|
\li \l{Setting Up Qt Bridge for Sketch}
|
||||||
|
@@ -40,10 +40,10 @@
|
|||||||
|
|
||||||
\image studio-qtquick-3d-components.png "Qt Quick 3D components in Library"
|
\image studio-qtquick-3d-components.png "Qt Quick 3D components in Library"
|
||||||
|
|
||||||
You can add a camera to your scene by dragging-and-dropping one from
|
Add a camera by dragging-and-dropping one of the camera components from
|
||||||
\l Library > \uicontrol Components > \uicontrol {Qt Quick 3D} > \uicontrol
|
\l Library > \uicontrol Components > \uicontrol {Qt Quick 3D} > \uicontrol
|
||||||
{Qt Quick 3D} to \l {3D Editor} or to a 3D view in \l Navigator.
|
{Qt Quick 3D} to \l {3D Editor} or to a 3D view in \l Navigator.
|
||||||
If the cameras are not displayed in \uicontrol Library, you should add the
|
If the cameras are not displayed in \uicontrol Library, add the
|
||||||
\uicontrol QtQuick3D module to your project, as described in
|
\uicontrol QtQuick3D module to your project, as described in
|
||||||
\l {Adding and Removing Modules}.
|
\l {Adding and Removing Modules}.
|
||||||
|
|
||||||
@@ -51,20 +51,21 @@
|
|||||||
projection:
|
projection:
|
||||||
|
|
||||||
\list
|
\list
|
||||||
\li \l{PerspectiveCamera}{Camera Perspective} - is the standard camera
|
\li \l{PerspectiveCamera}{Camera Perspective} is the standard camera
|
||||||
type, which uses field of view and near and far clip planes to
|
type, which gives a realistic projection of the scene since distant
|
||||||
specify the projection.
|
objects are perceived as smaller. It uses field of view and near and
|
||||||
\li \l{OrthographicCamera}{Camera Orthographic} - renders all contents
|
far clip planes to specify the projection.
|
||||||
with no perspective. It is ideal for rendering 2D elements, because
|
\li \l{OrthographicCamera}{Camera Orthographic} renders all contents
|
||||||
|
with no perspective. It is ideal for rendering 2D elements because
|
||||||
your images are guaranteed to be the right size on the screen, and
|
your images are guaranteed to be the right size on the screen, and
|
||||||
you can use the z position of components to bring them closer to or
|
you can use the z position of components to bring them closer to or
|
||||||
take them farther from the camera (\e z-sorting) with no
|
take them farther from the camera (\e z-sorting) with no
|
||||||
foreshortening artifacts.
|
foreshortening artifacts.
|
||||||
\li \l{FrustumCamera}{Camera Frustum} - enables finer grain control of
|
\li \l{FrustumCamera}{Camera Frustum} enables finer grain control of
|
||||||
how the frustum is defined, by setting the number of degrees between
|
how the frustum is defined, by setting the number of degrees between
|
||||||
the top and bottom or left and right edges of the camera frustum.
|
the top and bottom or left and right edges of the camera frustum.
|
||||||
This is useful when creating asymmetrical frustums.
|
This is useful when creating asymmetrical frustums.
|
||||||
\li \l{CustomCamera}{Camera Custom} - provides full control over how
|
\li \l{CustomCamera}{Camera Custom} provides full control over how
|
||||||
the projection matrix is created.
|
the projection matrix is created.
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
@@ -84,6 +85,10 @@
|
|||||||
|
|
||||||
\section1 Setting Camera Field of View
|
\section1 Setting Camera Field of View
|
||||||
|
|
||||||
|
\note If you select \uicontrol {Qt 5} as the \uicontrol {Target Qt Version}
|
||||||
|
when \l {Creating Projects}{creating your project}, the camera properties
|
||||||
|
will be slightly different.
|
||||||
|
|
||||||
The camera frustum can be obtained by taking a frustum (that is, a
|
The camera frustum can be obtained by taking a frustum (that is, a
|
||||||
truncation with parallel planes) of the cone of vision that a camera or eye
|
truncation with parallel planes) of the cone of vision that a camera or eye
|
||||||
would have to the rectangular viewports typically used in computer graphics.
|
would have to the rectangular viewports typically used in computer graphics.
|
||||||
@@ -108,12 +113,26 @@
|
|||||||
This value is the number of degrees between the top and bottom edges
|
This value is the number of degrees between the top and bottom edges
|
||||||
of the camera frustum.
|
of the camera frustum.
|
||||||
|
|
||||||
The horizontal FOV determines the number of degrees between the left and
|
The \uicontrol {FOV orientation} property specifies either a
|
||||||
right edges of the camera frustum. It is automatically calculated based on
|
\uicontrol Vertical (the default setting) or a \uicontrol Horizontal
|
||||||
the aspect ratio of the scene when the FOV orientation is set to vertical.
|
orientation for the field of view. The horizontal FOV determines the number
|
||||||
You can set the orientation to horizontal to translate FOV values from
|
of degrees between the left and right edges of the camera frustum. It is
|
||||||
graphics tools such as Maya and Blender, which use horizontal FOV by
|
automatically calculated based on the aspect ratio of the scene when the
|
||||||
default.
|
FOV orientation is set to vertical. You can set the orientation to horizontal
|
||||||
|
to translate FOV values from graphics tools such as Maya and Blender, which
|
||||||
|
use horizontal FOV by default.
|
||||||
|
|
||||||
|
The \uicontrol {Horizontal magnification} and \uicontrol {Vertical magnification}
|
||||||
|
properties determine the horizontal and vertical magnification of the camera
|
||||||
|
frustum.
|
||||||
|
\note The \uicontrol {Horizontal magnification} and
|
||||||
|
\uicontrol {Vertical magnification} properties are not available in Qt 5.
|
||||||
|
|
||||||
|
The \uicontrol {Frustum culling enabled} property determines whether the
|
||||||
|
objects outside the camera frustum will be culled, which means they will not
|
||||||
|
be passed to the renderer.
|
||||||
|
\note The \uicontrol {Frustum culling enabled} property is not available in
|
||||||
|
Qt 5.
|
||||||
|
|
||||||
The default values are intended to cause anything within the view
|
The default values are intended to cause anything within the view
|
||||||
of the camera to be rendered. Aside from special clipping effects, you
|
of the camera to be rendered. Aside from special clipping effects, you
|
||||||
|
@@ -25,9 +25,15 @@
|
|||||||
|
|
||||||
#include "qmljssimplereader.h"
|
#include "qmljssimplereader.h"
|
||||||
|
|
||||||
#include "parser/qmljsparser_p.h"
|
#ifdef QT_CREATOR
|
||||||
#include "parser/qmljslexer_p.h"
|
|
||||||
#include "parser/qmljsengine_p.h"
|
#include "parser/qmljsengine_p.h"
|
||||||
|
#include "parser/qmljslexer_p.h"
|
||||||
|
#include "parser/qmljsparser_p.h"
|
||||||
|
#else
|
||||||
|
#include "parser/qqmljsengine_p.h"
|
||||||
|
#include "parser/qqmljslexer_p.h"
|
||||||
|
#include "qqmljsparser_p.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "qmljsutils.h"
|
#include "qmljsutils.h"
|
||||||
|
|
||||||
@@ -37,308 +43,331 @@
|
|||||||
|
|
||||||
static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader", QtWarningMsg)
|
static Q_LOGGING_CATEGORY(simpleReaderLog, "qtc.qmljs.simpleReader", QtWarningMsg)
|
||||||
|
|
||||||
namespace QmlJS{
|
namespace QmlJS
|
||||||
|
|
||||||
QVariant SimpleReaderNode::property(const QString &name) const
|
|
||||||
{
|
{
|
||||||
return m_properties.value(name);
|
#ifdef QT_CREATOR
|
||||||
}
|
using UiQualifiedId = QmlJS::AST::UiQualifiedId;
|
||||||
|
#else
|
||||||
|
using UiQualifiedId = QQmlJS::AST::UiQualifiedId;
|
||||||
|
#endif
|
||||||
|
|
||||||
QStringList SimpleReaderNode::propertyNames() const
|
static SourceLocation toSourceLocation(SourceLocation first, SourceLocation last)
|
||||||
{
|
{
|
||||||
return m_properties.keys();
|
first.length = last.end() - first.begin();
|
||||||
}
|
return first;
|
||||||
|
|
||||||
SimpleReaderNode::PropertyHash SimpleReaderNode::properties() const
|
|
||||||
{
|
|
||||||
return m_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimpleReaderNode::isRoot() const
|
|
||||||
{
|
|
||||||
return m_parentNode.isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimpleReaderNode::isValid() const
|
|
||||||
{
|
|
||||||
return !m_name.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleReaderNode::Ptr SimpleReaderNode::invalidNode()
|
|
||||||
{
|
|
||||||
return Ptr(new SimpleReaderNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleReaderNode::WeakPtr SimpleReaderNode::parent() const
|
|
||||||
{
|
|
||||||
return m_parentNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString SimpleReaderNode::name() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleReaderNode::SimpleReaderNode()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleReaderNode::SimpleReaderNode(const QString &name, WeakPtr parent)
|
|
||||||
: m_name(name), m_parentNode(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleReaderNode::Ptr SimpleReaderNode::create(const QString &name, WeakPtr parent)
|
|
||||||
{
|
|
||||||
Ptr newNode(new SimpleReaderNode(name, parent));
|
|
||||||
newNode->m_weakThis = newNode;
|
|
||||||
if (parent)
|
|
||||||
parent.toStrongRef().data()->m_children.append(newNode);
|
|
||||||
return newNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SimpleReaderNode::List SimpleReaderNode::children() const
|
|
||||||
{
|
|
||||||
return m_children;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimpleReaderNode::setProperty(const QString &name, const QVariant &value)
|
|
||||||
{
|
|
||||||
m_properties.insert(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleAbstractStreamReader::SimpleAbstractStreamReader()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimpleAbstractStreamReader::readFile(const QString &fileName)
|
|
||||||
{
|
|
||||||
QFile file(fileName);
|
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
|
||||||
QByteArray source = file.readAll();
|
|
||||||
file.close();
|
|
||||||
return readFromSource(QString::fromLocal8Bit(source));
|
|
||||||
}
|
}
|
||||||
addError(tr("Cannot find file %1.").arg(fileName));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimpleAbstractStreamReader::readFromSource(const QString &source)
|
static SourceLocation toSourceLocation(UiQualifiedId * qualifiedId)
|
||||||
{
|
{
|
||||||
m_errors.clear();
|
SourceLocation first = qualifiedId->firstSourceLocation();
|
||||||
m_currentSourceLocation = SourceLocation();
|
SourceLocation last;
|
||||||
|
for (UiQualifiedId *iter = qualifiedId; iter; iter = iter->next) {
|
||||||
m_source = source;
|
if (iter->lastSourceLocation().isValid())
|
||||||
|
last = iter->lastSourceLocation();
|
||||||
Engine engine;
|
}
|
||||||
Lexer lexer(&engine);
|
return toSourceLocation(first, last);
|
||||||
Parser parser(&engine);
|
|
||||||
|
|
||||||
lexer.setCode(source, /*line = */ 1, /*qmlMode = */true);
|
|
||||||
|
|
||||||
if (!parser.parse()) {
|
|
||||||
QString errorMessage = QString::fromLatin1("%1:%2: %3").arg(
|
|
||||||
QString::number(parser.errorLineNumber()),
|
|
||||||
QString::number(parser.errorColumnNumber()),
|
|
||||||
parser.errorMessage());
|
|
||||||
addError(errorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return readDocument(parser.ast());
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList SimpleAbstractStreamReader::errors() const
|
SimpleReaderNode::Property SimpleReaderNode::property(const QString &name) const
|
||||||
{
|
{
|
||||||
return m_errors;
|
return m_properties.value(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleAbstractStreamReader::addError(const QString &error, const SourceLocation &sourceLocation)
|
QStringList SimpleReaderNode::propertyNames() const { return m_properties.keys(); }
|
||||||
{
|
|
||||||
m_errors << QString::fromLatin1("%1:%2: %3\n").arg(
|
|
||||||
QString::number(sourceLocation.startLine),
|
|
||||||
QString::number(sourceLocation.startColumn),
|
|
||||||
error);
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceLocation SimpleAbstractStreamReader::currentSourceLocation() const
|
SimpleReaderNode::PropertyHash SimpleReaderNode::properties() const { return m_properties; }
|
||||||
{
|
|
||||||
return m_currentSourceLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimpleAbstractStreamReader::readDocument(AST::UiProgram *ast)
|
bool SimpleReaderNode::isRoot() const { return m_parentNode.isNull(); }
|
||||||
{
|
|
||||||
if (!ast) {
|
bool SimpleReaderNode::isValid() const { return !m_name.isEmpty(); }
|
||||||
addError(tr("Could not parse document."));
|
|
||||||
|
SimpleReaderNode::Ptr SimpleReaderNode::invalidNode() { return Ptr(new SimpleReaderNode); }
|
||||||
|
|
||||||
|
SimpleReaderNode::WeakPtr SimpleReaderNode::parent() const { return m_parentNode; }
|
||||||
|
|
||||||
|
QString SimpleReaderNode::name() const { return m_name; }
|
||||||
|
|
||||||
|
SourceLocation SimpleReaderNode::nameLocation() const { return m_nameLocation; }
|
||||||
|
|
||||||
|
SimpleReaderNode::SimpleReaderNode() {}
|
||||||
|
|
||||||
|
SimpleReaderNode::SimpleReaderNode(const QString &name,
|
||||||
|
const SourceLocation &nameLocation,
|
||||||
|
WeakPtr parent)
|
||||||
|
: m_name(name)
|
||||||
|
, m_nameLocation(nameLocation)
|
||||||
|
, m_parentNode(parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
SimpleReaderNode::Ptr SimpleReaderNode::create(const QString &name,
|
||||||
|
const SourceLocation &nameLocation,
|
||||||
|
WeakPtr parent)
|
||||||
|
{
|
||||||
|
Ptr newNode(new SimpleReaderNode(name, nameLocation, parent));
|
||||||
|
newNode->m_weakThis = newNode;
|
||||||
|
if (parent)
|
||||||
|
parent.toStrongRef().data()->m_children.append(newNode);
|
||||||
|
return newNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SimpleReaderNode::List SimpleReaderNode::children() const { return m_children; }
|
||||||
|
|
||||||
|
void SimpleReaderNode::setProperty(const QString &name,
|
||||||
|
const SourceLocation &nameLocation,
|
||||||
|
const QVariant &value,
|
||||||
|
const SourceLocation &valueLocation)
|
||||||
|
{
|
||||||
|
m_properties.insert(name, {value, nameLocation, valueLocation});
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleAbstractStreamReader::SimpleAbstractStreamReader() {}
|
||||||
|
|
||||||
|
SimpleAbstractStreamReader::~SimpleAbstractStreamReader() {}
|
||||||
|
|
||||||
|
bool SimpleAbstractStreamReader::readFile(const QString &fileName)
|
||||||
|
{
|
||||||
|
QFile file(fileName);
|
||||||
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
|
QByteArray source = file.readAll();
|
||||||
|
file.close();
|
||||||
|
return readFromSource(QString::fromLocal8Bit(source));
|
||||||
|
}
|
||||||
|
addError(tr("Cannot find file %1.").arg(fileName));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AST::UiObjectDefinition *uiObjectDefinition = AST::cast<AST::UiObjectDefinition *>(ast->members->member);
|
bool SimpleAbstractStreamReader::readFromSource(const QString &source)
|
||||||
if (!uiObjectDefinition) {
|
{
|
||||||
addError(tr("Expected document to contain a single object definition."));
|
m_errors.clear();
|
||||||
return false;
|
m_currentSourceLocation = SourceLocation();
|
||||||
}
|
|
||||||
readChild(uiObjectDefinition);
|
|
||||||
|
|
||||||
m_source.clear();
|
m_source = source;
|
||||||
|
|
||||||
return errors().isEmpty();
|
Engine engine;
|
||||||
}
|
Lexer lexer(&engine);
|
||||||
|
Parser parser(&engine);
|
||||||
|
|
||||||
void SimpleAbstractStreamReader::readChildren(AST::UiObjectDefinition *uiObjectDefinition)
|
lexer.setCode(source, /*line = */ 1, /*qmlMode = */ true);
|
||||||
{
|
|
||||||
Q_ASSERT(uiObjectDefinition);
|
|
||||||
|
|
||||||
for (AST::UiObjectMemberList *it = uiObjectDefinition->initializer->members; it; it = it->next) {
|
if (!parser.parse()) {
|
||||||
AST::UiObjectMember *member = it->member;
|
QString errorMessage = QString::fromLatin1("%1:%2: %3")
|
||||||
AST::UiObjectDefinition *uiObjectDefinition = AST::cast<AST::UiObjectDefinition *>(member);
|
.arg(QString::number(parser.errorLineNumber()),
|
||||||
if (uiObjectDefinition)
|
QString::number(parser.errorColumnNumber()),
|
||||||
readChild(uiObjectDefinition);
|
parser.errorMessage());
|
||||||
}
|
addError(errorMessage);
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
void SimpleAbstractStreamReader::readChild(AST::UiObjectDefinition *uiObjectDefinition)
|
return readDocument(parser.ast());
|
||||||
{
|
|
||||||
Q_ASSERT(uiObjectDefinition);
|
|
||||||
|
|
||||||
setSourceLocation(uiObjectDefinition->firstSourceLocation());
|
|
||||||
|
|
||||||
elementStart(toString(uiObjectDefinition->qualifiedTypeNameId));
|
|
||||||
|
|
||||||
readProperties(uiObjectDefinition);
|
|
||||||
readChildren(uiObjectDefinition);
|
|
||||||
|
|
||||||
elementEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimpleAbstractStreamReader::readProperties(AST::UiObjectDefinition *uiObjectDefinition)
|
|
||||||
{
|
|
||||||
Q_ASSERT(uiObjectDefinition);
|
|
||||||
|
|
||||||
for (AST::UiObjectMemberList *it = uiObjectDefinition->initializer->members; it; it = it->next) {
|
|
||||||
AST::UiObjectMember *member = it->member;
|
|
||||||
AST::UiScriptBinding *scriptBinding = AST::cast<AST::UiScriptBinding *>(member);
|
|
||||||
if (scriptBinding)
|
|
||||||
readProperty(scriptBinding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimpleAbstractStreamReader::readProperty(AST::UiScriptBinding *uiScriptBinding)
|
|
||||||
{
|
|
||||||
Q_ASSERT(uiScriptBinding);
|
|
||||||
|
|
||||||
setSourceLocation(uiScriptBinding->firstSourceLocation());
|
|
||||||
|
|
||||||
const QString name = toString(uiScriptBinding->qualifiedId);
|
|
||||||
const QVariant value = parsePropertyScriptBinding(uiScriptBinding);
|
|
||||||
|
|
||||||
propertyDefinition(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant SimpleAbstractStreamReader::parsePropertyScriptBinding(AST::UiScriptBinding *uiScriptBinding)
|
|
||||||
{
|
|
||||||
Q_ASSERT(uiScriptBinding);
|
|
||||||
|
|
||||||
AST::ExpressionStatement *expStmt = AST::cast<AST::ExpressionStatement *>(uiScriptBinding->statement);
|
|
||||||
if (!expStmt) {
|
|
||||||
addError(tr("Expected expression statement after colon."), uiScriptBinding->statement->firstSourceLocation());
|
|
||||||
return QVariant();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsePropertyExpression(expStmt->expression);
|
QStringList SimpleAbstractStreamReader::errors() const { return m_errors; }
|
||||||
}
|
|
||||||
|
|
||||||
QVariant SimpleAbstractStreamReader::parsePropertyExpression(AST::ExpressionNode *expressionNode)
|
void SimpleAbstractStreamReader::addError(const QString &error,
|
||||||
{
|
const SourceLocation &sourceLocation)
|
||||||
Q_ASSERT(expressionNode);
|
{
|
||||||
|
m_errors << QString::fromLatin1("%1:%2: %3\n")
|
||||||
AST::ArrayPattern *arrayLiteral = AST::cast<AST::ArrayPattern *>(expressionNode);
|
.arg(QString::number(sourceLocation.startLine),
|
||||||
|
QString::number(sourceLocation.startColumn),
|
||||||
if (arrayLiteral) {
|
error);
|
||||||
QList<QVariant> variantList;
|
|
||||||
for (AST::PatternElementList *it = arrayLiteral->elements; it; it = it->next)
|
|
||||||
variantList << parsePropertyExpression(it->element->initializer);
|
|
||||||
return variantList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AST::StringLiteral *stringLiteral = AST::cast<AST::StringLiteral *>(expressionNode);
|
SourceLocation SimpleAbstractStreamReader::currentSourceLocation() const
|
||||||
if (stringLiteral)
|
{
|
||||||
return stringLiteral->value.toString();
|
return m_currentSourceLocation;
|
||||||
|
}
|
||||||
|
|
||||||
AST::TrueLiteral *trueLiteral = AST::cast<AST::TrueLiteral *>(expressionNode);
|
bool SimpleAbstractStreamReader::readDocument(AST::UiProgram * ast)
|
||||||
if (trueLiteral)
|
{
|
||||||
return true;
|
if (!ast) {
|
||||||
|
addError(tr("Could not parse document."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AST::FalseLiteral *falseLiteral = AST::cast<AST::FalseLiteral *>(expressionNode);
|
AST::UiObjectDefinition *uiObjectDefinition = AST::cast<AST::UiObjectDefinition *>(
|
||||||
if (falseLiteral)
|
ast->members->member);
|
||||||
return false;
|
if (!uiObjectDefinition) {
|
||||||
|
addError(tr("Expected document to contain a single object definition."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
readChild(uiObjectDefinition);
|
||||||
|
|
||||||
AST::NumericLiteral *numericLiteral = AST::cast<AST::NumericLiteral *>(expressionNode);
|
m_source.clear();
|
||||||
if (numericLiteral)
|
|
||||||
return numericLiteral->value;
|
|
||||||
|
|
||||||
return textAt(expressionNode->firstSourceLocation(), expressionNode->lastSourceLocation());
|
return errors().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleAbstractStreamReader::setSourceLocation(const SourceLocation &sourceLocation)
|
void SimpleAbstractStreamReader::readChildren(AST::UiObjectDefinition * uiObjectDefinition)
|
||||||
{
|
{
|
||||||
m_currentSourceLocation = sourceLocation;
|
Q_ASSERT(uiObjectDefinition);
|
||||||
}
|
|
||||||
|
|
||||||
QString SimpleAbstractStreamReader::textAt(const SourceLocation &from,
|
for (AST::UiObjectMemberList *it = uiObjectDefinition->initializer->members; it;
|
||||||
const SourceLocation &to)
|
it = it->next) {
|
||||||
{
|
AST::UiObjectMember *member = it->member;
|
||||||
return m_source.mid(from.offset, to.end() - from.begin());
|
AST::UiObjectDefinition *uiObjectDefinition = AST::cast<AST::UiObjectDefinition *>(
|
||||||
}
|
member);
|
||||||
|
if (uiObjectDefinition)
|
||||||
|
readChild(uiObjectDefinition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SimpleReader::SimpleReader()
|
void SimpleAbstractStreamReader::readChild(AST::UiObjectDefinition * uiObjectDefinition)
|
||||||
{
|
{
|
||||||
}
|
Q_ASSERT(uiObjectDefinition);
|
||||||
|
|
||||||
SimpleReaderNode::Ptr SimpleReader::readFile(const QString &fileName)
|
setSourceLocation(uiObjectDefinition->firstSourceLocation());
|
||||||
{
|
|
||||||
SimpleAbstractStreamReader::readFile(fileName);
|
|
||||||
return m_rootNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleReaderNode::Ptr SimpleReader::readFromSource(const QString &source)
|
elementStart(toString(uiObjectDefinition->qualifiedTypeNameId),
|
||||||
{
|
toSourceLocation(uiObjectDefinition->qualifiedTypeNameId));
|
||||||
SimpleAbstractStreamReader::readFromSource(source);
|
|
||||||
return m_rootNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimpleReader::elementStart(const QString &name)
|
readProperties(uiObjectDefinition);
|
||||||
{
|
readChildren(uiObjectDefinition);
|
||||||
qCDebug(simpleReaderLog) << "elementStart()" << name;
|
|
||||||
|
|
||||||
SimpleReaderNode::Ptr newNode = SimpleReaderNode::create(name, m_currentNode);
|
elementEnd();
|
||||||
|
}
|
||||||
|
|
||||||
if (newNode->isRoot())
|
void SimpleAbstractStreamReader::readProperties(AST::UiObjectDefinition * uiObjectDefinition)
|
||||||
m_rootNode = newNode;
|
{
|
||||||
|
Q_ASSERT(uiObjectDefinition);
|
||||||
|
|
||||||
Q_ASSERT(newNode->isValid());
|
for (AST::UiObjectMemberList *it = uiObjectDefinition->initializer->members; it;
|
||||||
|
it = it->next) {
|
||||||
|
AST::UiObjectMember *member = it->member;
|
||||||
|
AST::UiScriptBinding *scriptBinding = AST::cast<AST::UiScriptBinding *>(member);
|
||||||
|
if (scriptBinding)
|
||||||
|
readProperty(scriptBinding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_currentNode = newNode;
|
void SimpleAbstractStreamReader::readProperty(AST::UiScriptBinding * uiScriptBinding)
|
||||||
}
|
{
|
||||||
|
Q_ASSERT(uiScriptBinding);
|
||||||
|
|
||||||
void SimpleReader::elementEnd()
|
setSourceLocation(uiScriptBinding->firstSourceLocation());
|
||||||
{
|
|
||||||
Q_ASSERT(m_currentNode);
|
|
||||||
|
|
||||||
qCDebug(simpleReaderLog) << "elementEnd()" << m_currentNode.toStrongRef().data()->name();
|
const QString name = toString(uiScriptBinding->qualifiedId);
|
||||||
|
auto nameLoc = toSourceLocation(uiScriptBinding->qualifiedId);
|
||||||
|
auto value = parsePropertyScriptBinding(uiScriptBinding);
|
||||||
|
|
||||||
m_currentNode = m_currentNode.toStrongRef().data()->parent();
|
propertyDefinition(name, nameLoc, value.first, value.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleReader::propertyDefinition(const QString &name, const QVariant &value)
|
std::pair<QVariant, SourceLocation> SimpleAbstractStreamReader::parsePropertyScriptBinding(
|
||||||
{
|
AST::UiScriptBinding * uiScriptBinding)
|
||||||
Q_ASSERT(m_currentNode);
|
{
|
||||||
|
Q_ASSERT(uiScriptBinding);
|
||||||
|
|
||||||
qCDebug(simpleReaderLog) << "propertyDefinition()" << m_currentNode.toStrongRef().data()->name() << name << value;
|
AST::ExpressionStatement *expStmt = AST::cast<AST::ExpressionStatement *>(
|
||||||
|
uiScriptBinding->statement);
|
||||||
|
if (!expStmt) {
|
||||||
|
addError(tr("Expected expression statement after colon."),
|
||||||
|
uiScriptBinding->statement->firstSourceLocation());
|
||||||
|
return std::make_pair(QVariant(), SourceLocation());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_currentNode.toStrongRef().data()->propertyNames().contains(name))
|
return std::make_pair(parsePropertyExpression(expStmt->expression),
|
||||||
addError(tr("Property is defined twice."), currentSourceLocation());
|
toSourceLocation(expStmt->firstSourceLocation(),
|
||||||
|
expStmt->lastSourceLocation()));
|
||||||
|
}
|
||||||
|
|
||||||
m_currentNode.toStrongRef().data()->setProperty(name, value);
|
QVariant SimpleAbstractStreamReader::parsePropertyExpression(AST::ExpressionNode
|
||||||
}
|
* expressionNode)
|
||||||
|
{
|
||||||
|
Q_ASSERT(expressionNode);
|
||||||
|
|
||||||
|
AST::ArrayPattern *arrayLiteral = AST::cast<AST::ArrayPattern *>(expressionNode);
|
||||||
|
|
||||||
|
if (arrayLiteral) {
|
||||||
|
QList<QVariant> variantList;
|
||||||
|
for (AST::PatternElementList *it = arrayLiteral->elements; it; it = it->next)
|
||||||
|
variantList << parsePropertyExpression(it->element->initializer);
|
||||||
|
return variantList;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST::StringLiteral *stringLiteral = AST::cast<AST::StringLiteral *>(expressionNode);
|
||||||
|
if (stringLiteral)
|
||||||
|
return stringLiteral->value.toString();
|
||||||
|
|
||||||
|
AST::TrueLiteral *trueLiteral = AST::cast<AST::TrueLiteral *>(expressionNode);
|
||||||
|
if (trueLiteral)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
AST::FalseLiteral *falseLiteral = AST::cast<AST::FalseLiteral *>(expressionNode);
|
||||||
|
if (falseLiteral)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
AST::NumericLiteral *numericLiteral = AST::cast<AST::NumericLiteral *>(expressionNode);
|
||||||
|
if (numericLiteral)
|
||||||
|
return numericLiteral->value;
|
||||||
|
|
||||||
|
return textAt(expressionNode->firstSourceLocation(), expressionNode->lastSourceLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleAbstractStreamReader::setSourceLocation(const SourceLocation &sourceLocation)
|
||||||
|
{
|
||||||
|
m_currentSourceLocation = sourceLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SimpleAbstractStreamReader::textAt(const SourceLocation &from, const SourceLocation &to)
|
||||||
|
{
|
||||||
|
return m_source.mid(from.offset, to.end() - from.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleReader::SimpleReader() {}
|
||||||
|
|
||||||
|
SimpleReaderNode::Ptr SimpleReader::readFile(const QString &fileName)
|
||||||
|
{
|
||||||
|
SimpleAbstractStreamReader::readFile(fileName);
|
||||||
|
return m_rootNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleReaderNode::Ptr SimpleReader::readFromSource(const QString &source)
|
||||||
|
{
|
||||||
|
SimpleAbstractStreamReader::readFromSource(source);
|
||||||
|
return m_rootNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleReader::elementStart(const QString &name, const SourceLocation &nameLocation)
|
||||||
|
{
|
||||||
|
qCDebug(simpleReaderLog) << "elementStart()" << name;
|
||||||
|
|
||||||
|
SimpleReaderNode::Ptr newNode = SimpleReaderNode::create(name, nameLocation, m_currentNode);
|
||||||
|
|
||||||
|
if (newNode->isRoot())
|
||||||
|
m_rootNode = newNode;
|
||||||
|
|
||||||
|
Q_ASSERT(newNode->isValid());
|
||||||
|
|
||||||
|
m_currentNode = newNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleReader::elementEnd()
|
||||||
|
{
|
||||||
|
Q_ASSERT(m_currentNode);
|
||||||
|
|
||||||
|
qCDebug(simpleReaderLog) << "elementEnd()" << m_currentNode.toStrongRef().data()->name();
|
||||||
|
|
||||||
|
m_currentNode = m_currentNode.toStrongRef().data()->parent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleReader::propertyDefinition(const QString &name,
|
||||||
|
const SourceLocation &nameLocation,
|
||||||
|
const QVariant &value,
|
||||||
|
const SourceLocation &valueLocation)
|
||||||
|
{
|
||||||
|
Q_ASSERT(m_currentNode);
|
||||||
|
|
||||||
|
qCDebug(simpleReaderLog) << "propertyDefinition()"
|
||||||
|
<< m_currentNode.toStrongRef().data()->name() << name << value;
|
||||||
|
|
||||||
|
if (m_currentNode.toStrongRef().data()->propertyNames().contains(name)) {
|
||||||
|
auto previousSourceLoc = m_currentNode.toStrongRef().data()->property(name).nameLocation;
|
||||||
|
addError(tr("Property is defined twice, previous definition at %1:%2")
|
||||||
|
.arg(QString::number(previousSourceLoc.startLine),
|
||||||
|
QString::number(previousSourceLoc.startColumn)),
|
||||||
|
currentSourceLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_currentNode.toStrongRef().data()->setProperty(name, nameLocation, value, valueLocation);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
|
@@ -26,13 +26,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <qmljs/qmljs_global.h>
|
#include <qmljs/qmljs_global.h>
|
||||||
#include <qmljs/parser/qmljsastfwd_p.h>
|
|
||||||
|
|
||||||
|
#ifdef QT_CREATOR
|
||||||
|
#include <qmljs/parser/qmljsastfwd_p.h>
|
||||||
|
#else
|
||||||
|
#include <parser/qqmljsastfwd_p.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QStringList>
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QVariant>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
|
||||||
// for Q_DECLARE_TR_FUNCTIONS
|
// for Q_DECLARE_TR_FUNCTIONS
|
||||||
@@ -40,15 +45,31 @@
|
|||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
#ifndef QT_CREATOR
|
||||||
|
using SourceLocation = QQmlJS::SourceLocation;
|
||||||
|
#endif
|
||||||
|
|
||||||
class QMLJS_EXPORT SimpleReaderNode
|
class QMLJS_EXPORT SimpleReaderNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
struct Property
|
||||||
|
{
|
||||||
|
QVariant value;
|
||||||
|
SourceLocation nameLocation;
|
||||||
|
SourceLocation valueLocation;
|
||||||
|
|
||||||
|
bool isValid() const { return !value.isNull() && value.isValid(); }
|
||||||
|
bool isDefaultValue() const
|
||||||
|
{
|
||||||
|
return !value.isNull() && !nameLocation.isValid() && !valueLocation.isValid();
|
||||||
|
}
|
||||||
|
};
|
||||||
typedef QSharedPointer<SimpleReaderNode> Ptr;
|
typedef QSharedPointer<SimpleReaderNode> Ptr;
|
||||||
typedef QWeakPointer<SimpleReaderNode> WeakPtr;
|
typedef QWeakPointer<SimpleReaderNode> WeakPtr;
|
||||||
typedef QHash<QString, QVariant> PropertyHash;
|
typedef QHash<QString, Property> PropertyHash;
|
||||||
typedef QList<Ptr> List;
|
typedef QList<Ptr> List;
|
||||||
|
|
||||||
QVariant property(const QString &name) const;
|
Property property(const QString &name) const;
|
||||||
QStringList propertyNames() const;
|
QStringList propertyNames() const;
|
||||||
PropertyHash properties() const;
|
PropertyHash properties() const;
|
||||||
bool isRoot() const;
|
bool isRoot() const;
|
||||||
@@ -56,16 +77,21 @@ public:
|
|||||||
static Ptr invalidNode();
|
static Ptr invalidNode();
|
||||||
WeakPtr parent() const;
|
WeakPtr parent() const;
|
||||||
QString name() const;
|
QString name() const;
|
||||||
|
SourceLocation nameLocation() const;
|
||||||
const List children() const;
|
const List children() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SimpleReaderNode();
|
SimpleReaderNode();
|
||||||
SimpleReaderNode(const QString &name, WeakPtr parent);
|
SimpleReaderNode(const QString &name, const SourceLocation &nameLocation, WeakPtr parent);
|
||||||
static Ptr create(const QString &name, WeakPtr parent);
|
static Ptr create(const QString &name, const SourceLocation &nameLocation, WeakPtr parent);
|
||||||
void setProperty(const QString &name, const QVariant &value);
|
void setProperty(const QString &name,
|
||||||
|
const SourceLocation &nameLocation,
|
||||||
|
const QVariant &value,
|
||||||
|
const SourceLocation &valueLocation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_name;
|
const QString m_name;
|
||||||
|
const SourceLocation m_nameLocation;
|
||||||
PropertyHash m_properties;
|
PropertyHash m_properties;
|
||||||
const WeakPtr m_parentNode;
|
const WeakPtr m_parentNode;
|
||||||
List m_children;
|
List m_children;
|
||||||
@@ -74,12 +100,17 @@ private:
|
|||||||
friend class SimpleReader;
|
friend class SimpleReader;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef QT_CREATOR
|
||||||
|
using namespace QQmlJS;
|
||||||
|
#endif
|
||||||
|
|
||||||
class QMLJS_EXPORT SimpleAbstractStreamReader
|
class QMLJS_EXPORT SimpleAbstractStreamReader
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(QmlJS::SimpleAbstractStreamReader)
|
Q_DECLARE_TR_FUNCTIONS(QmlJS::SimpleAbstractStreamReader)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SimpleAbstractStreamReader();
|
SimpleAbstractStreamReader();
|
||||||
|
virtual ~SimpleAbstractStreamReader();
|
||||||
bool readFile(const QString &fileName);
|
bool readFile(const QString &fileName);
|
||||||
bool readFromSource(const QString &source);
|
bool readFromSource(const QString &source);
|
||||||
QStringList errors() const;
|
QStringList errors() const;
|
||||||
@@ -88,9 +119,13 @@ protected:
|
|||||||
void addError(const QString &error, const SourceLocation &sourceLocation = SourceLocation());
|
void addError(const QString &error, const SourceLocation &sourceLocation = SourceLocation());
|
||||||
SourceLocation currentSourceLocation() const;
|
SourceLocation currentSourceLocation() const;
|
||||||
|
|
||||||
virtual void elementStart(const QString &name) = 0;
|
virtual void elementStart(const QString &name, const SourceLocation &nameLocation) = 0;
|
||||||
virtual void elementEnd() = 0;
|
virtual void elementEnd() = 0;
|
||||||
virtual void propertyDefinition(const QString &name, const QVariant &value) = 0;
|
virtual void propertyDefinition(const QString &name,
|
||||||
|
const SourceLocation &nameLocation,
|
||||||
|
const QVariant &value,
|
||||||
|
const SourceLocation &valueLocation)
|
||||||
|
= 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readDocument(AST::UiProgram *ast);
|
bool readDocument(AST::UiProgram *ast);
|
||||||
@@ -98,7 +133,8 @@ private:
|
|||||||
void readChild(AST::UiObjectDefinition *uiObjectDefinition);
|
void readChild(AST::UiObjectDefinition *uiObjectDefinition);
|
||||||
void readProperties(AST::UiObjectDefinition *ast);
|
void readProperties(AST::UiObjectDefinition *ast);
|
||||||
void readProperty(AST::UiScriptBinding *uiScriptBinding);
|
void readProperty(AST::UiScriptBinding *uiScriptBinding);
|
||||||
QVariant parsePropertyScriptBinding(AST::UiScriptBinding *ExpressionNode);
|
std::pair<QVariant, SourceLocation> parsePropertyScriptBinding(
|
||||||
|
AST::UiScriptBinding *ExpressionNode);
|
||||||
QVariant parsePropertyExpression(AST::ExpressionNode *expressionNode);
|
QVariant parsePropertyExpression(AST::ExpressionNode *expressionNode);
|
||||||
void setSourceLocation(const SourceLocation &sourceLocation);
|
void setSourceLocation(const SourceLocation &sourceLocation);
|
||||||
QString textAt(const SourceLocation &from, const SourceLocation &to);
|
QString textAt(const SourceLocation &from, const SourceLocation &to);
|
||||||
@@ -118,9 +154,12 @@ public:
|
|||||||
SimpleReaderNode::Ptr readFromSource(const QString &source);
|
SimpleReaderNode::Ptr readFromSource(const QString &source);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void elementStart(const QString &name) override;
|
void elementStart(const QString &name, const SourceLocation &nameLocation) override;
|
||||||
void elementEnd() override;
|
void elementEnd() override;
|
||||||
void propertyDefinition(const QString &name, const QVariant &value) override;
|
void propertyDefinition(const QString &name,
|
||||||
|
const SourceLocation &nameLocation,
|
||||||
|
const QVariant &value,
|
||||||
|
const SourceLocation &valueLocation) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SimpleReaderNode::Ptr m_rootNode;
|
SimpleReaderNode::Ptr m_rootNode;
|
||||||
|
@@ -80,6 +80,16 @@ QString FileWizardPage::fileName() const
|
|||||||
return d->m_ui.nameLineEdit->text();
|
return d->m_ui.nameLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath FileWizardPage::filePath() const
|
||||||
|
{
|
||||||
|
return d->m_ui.pathChooser->filePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileWizardPage::setFilePath(const FilePath &filePath)
|
||||||
|
{
|
||||||
|
d->m_ui.pathChooser->setFilePath(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
QString FileWizardPage::path() const
|
QString FileWizardPage::path() const
|
||||||
{
|
{
|
||||||
return d->m_ui.pathChooser->filePath().toString();
|
return d->m_ui.pathChooser->filePath().toString();
|
||||||
@@ -87,7 +97,7 @@ QString FileWizardPage::path() const
|
|||||||
|
|
||||||
void FileWizardPage::setPath(const QString &path)
|
void FileWizardPage::setPath(const QString &path)
|
||||||
{
|
{
|
||||||
d->m_ui.pathChooser->setPath(path);
|
d->m_ui.pathChooser->setFilePath(FilePath::fromString(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileWizardPage::setFileName(const QString &name)
|
void FileWizardPage::setFileName(const QString &name)
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include "filepath.h"
|
||||||
#include "wizardpage.h"
|
#include "wizardpage.h"
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
@@ -44,7 +45,9 @@ public:
|
|||||||
~FileWizardPage() override;
|
~FileWizardPage() override;
|
||||||
|
|
||||||
QString fileName() const;
|
QString fileName() const;
|
||||||
QString path() const;
|
QString path() const; // Deprecated: Use filePath()
|
||||||
|
|
||||||
|
Utils::FilePath filePath() const;
|
||||||
|
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
|
|
||||||
@@ -64,8 +67,9 @@ signals:
|
|||||||
void pathChanged();
|
void pathChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path); // Deprecated: Use setFilePath
|
||||||
void setFileName(const QString &name);
|
void setFileName(const QString &name);
|
||||||
|
void setFilePath(const Utils::FilePath &filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slotValidChanged();
|
void slotValidChanged();
|
||||||
|
@@ -1298,11 +1298,6 @@ void ClangdTestHighlighting::test()
|
|||||||
"check if and how we want to support this", Abort);
|
"check if and how we want to support this", Abort);
|
||||||
QEXPECT_FAIL("old-style signal with complex parameter (signal parameter part 3)",
|
QEXPECT_FAIL("old-style signal with complex parameter (signal parameter part 3)",
|
||||||
"check if and how we want to support this", Abort);
|
"check if and how we want to support this", Abort);
|
||||||
QEXPECT_FAIL("alias template instantiation (type)", "FIXME: clangd doesn't report this", Abort);
|
|
||||||
QEXPECT_FAIL("alias template instantiation (opening angle bracket)",
|
|
||||||
"FIXME: This construct does not appear in the AST", Abort);
|
|
||||||
QEXPECT_FAIL("alias template instantiation (closing angle bracket)",
|
|
||||||
"FIXME: This construct does not appear in the AST", Abort);
|
|
||||||
QEXPECT_FAIL("function template specialization (opening angle bracket 1)",
|
QEXPECT_FAIL("function template specialization (opening angle bracket 1)",
|
||||||
"specialization appears as a normal function in the AST", Abort);
|
"specialization appears as a normal function in the AST", Abort);
|
||||||
QEXPECT_FAIL("function template specialization (closing angle bracket 1)",
|
QEXPECT_FAIL("function template specialization (closing angle bracket 1)",
|
||||||
|
@@ -54,5 +54,6 @@
|
|||||||
<file>completion/preprocessorKeywordsCompletion2.cpp</file>
|
<file>completion/preprocessorKeywordsCompletion2.cpp</file>
|
||||||
<file>completion/preprocessorKeywordsCompletion3.cpp</file>
|
<file>completion/preprocessorKeywordsCompletion3.cpp</file>
|
||||||
<file>completion/privateFuncDefCompletion.cpp</file>
|
<file>completion/privateFuncDefCompletion.cpp</file>
|
||||||
|
<file>highlighting/highlightingmarks.h</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -86,11 +86,11 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const FilePath &path, QWidge
|
|||||||
if (flags().testFlag(ForceCapitalLetterForFileName))
|
if (flags().testFlag(ForceCapitalLetterForFileName))
|
||||||
dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
|
dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
|
||||||
|
|
||||||
Utils::Wizard *wizard = create(parent, WizardDialogParameters(path.toString(),
|
Wizard *wizard = create(parent, WizardDialogParameters(path,
|
||||||
platform,
|
platform,
|
||||||
requiredFeatures(),
|
requiredFeatures(),
|
||||||
dialogParameterFlags,
|
dialogParameterFlags,
|
||||||
extraValues));
|
extraValues));
|
||||||
QTC_CHECK(wizard);
|
QTC_CHECK(wizard);
|
||||||
return wizard;
|
return wizard;
|
||||||
}
|
}
|
||||||
@@ -287,21 +287,17 @@ BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(Ge
|
|||||||
\a baseName already has one.
|
\a baseName already has one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QString BaseFileWizardFactory::buildFileName(const QString &path,
|
FilePath BaseFileWizardFactory::buildFileName(const FilePath &path,
|
||||||
const QString &baseName,
|
const QString &baseName,
|
||||||
const QString &extension)
|
const QString &extension)
|
||||||
{
|
{
|
||||||
QString rc = path;
|
FilePath rc = path.pathAppended(baseName);
|
||||||
const QChar slash = QLatin1Char('/');
|
|
||||||
if (!rc.isEmpty() && !rc.endsWith(slash))
|
|
||||||
rc += slash;
|
|
||||||
rc += baseName;
|
|
||||||
// Add extension unless user specified something else
|
// Add extension unless user specified something else
|
||||||
const QChar dot = QLatin1Char('.');
|
const QChar dot = '.';
|
||||||
if (!extension.isEmpty() && !baseName.contains(dot)) {
|
if (!extension.isEmpty() && !baseName.contains(dot)) {
|
||||||
if (!extension.startsWith(dot))
|
if (!extension.startsWith(dot))
|
||||||
rc += dot;
|
rc = rc.stringAppended(dot);
|
||||||
rc += extension;
|
rc = rc.stringAppended(extension);
|
||||||
}
|
}
|
||||||
if (debugWizard)
|
if (debugWizard)
|
||||||
qDebug() << Q_FUNC_INFO << rc;
|
qDebug() << Q_FUNC_INFO << rc;
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include <coreplugin/iwizardfactory.h>
|
#include <coreplugin/iwizardfactory.h>
|
||||||
|
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@ public:
|
|||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum)
|
Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum)
|
||||||
|
|
||||||
explicit WizardDialogParameters(const QString &defaultPath, Utils::Id platform,
|
explicit WizardDialogParameters(const Utils::FilePath &defaultPath, Utils::Id platform,
|
||||||
const QSet<Utils::Id> &requiredFeatures, DialogParameterFlags flags,
|
const QSet<Utils::Id> &requiredFeatures, DialogParameterFlags flags,
|
||||||
const QVariantMap &extraValues)
|
const QVariantMap &extraValues)
|
||||||
: m_defaultPath(defaultPath),
|
: m_defaultPath(defaultPath),
|
||||||
@@ -64,23 +66,14 @@ public:
|
|||||||
m_extraValues(extraValues)
|
m_extraValues(extraValues)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QString defaultPath() const
|
Utils::FilePath defaultPath() const { return m_defaultPath; }
|
||||||
{ return m_defaultPath; }
|
Utils::Id selectedPlatform() const { return m_selectedPlatform; }
|
||||||
|
QSet<Utils::Id> requiredFeatures() const { return m_requiredFeatures; }
|
||||||
Utils::Id selectedPlatform() const
|
DialogParameterFlags flags() const { return m_parameterFlags; }
|
||||||
{ return m_selectedPlatform; }
|
QVariantMap extraValues() const { return m_extraValues; }
|
||||||
|
|
||||||
QSet<Utils::Id> requiredFeatures() const
|
|
||||||
{ return m_requiredFeatures; }
|
|
||||||
|
|
||||||
DialogParameterFlags flags() const
|
|
||||||
{ return m_parameterFlags; }
|
|
||||||
|
|
||||||
QVariantMap extraValues() const
|
|
||||||
{ return m_extraValues; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_defaultPath;
|
Utils::FilePath m_defaultPath;
|
||||||
Utils::Id m_selectedPlatform;
|
Utils::Id m_selectedPlatform;
|
||||||
QSet<Utils::Id> m_requiredFeatures;
|
QSet<Utils::Id> m_requiredFeatures;
|
||||||
DialogParameterFlags m_parameterFlags;
|
DialogParameterFlags m_parameterFlags;
|
||||||
@@ -94,7 +87,7 @@ class CORE_EXPORT BaseFileWizardFactory : public IWizardFactory
|
|||||||
friend class BaseFileWizard;
|
friend class BaseFileWizard;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);
|
static Utils::FilePath buildFileName(const Utils::FilePath &path, const QString &baseName, const QString &extension);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual BaseFileWizard *create(QWidget *parent, const WizardDialogParameters ¶meters) const = 0;
|
virtual BaseFileWizard *create(QWidget *parent, const WizardDialogParameters ¶meters) const = 0;
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -58,7 +60,7 @@ QString FormClassWizard::formSuffix() const
|
|||||||
Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||||
{
|
{
|
||||||
auto wizardDialog = new FormClassWizardDialog(this, parent);
|
auto wizardDialog = new FormClassWizardDialog(this, parent);
|
||||||
wizardDialog->setPath(parameters.defaultPath());
|
wizardDialog->setFilePath(parameters.defaultPath());
|
||||||
return wizardDialog;
|
return wizardDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +75,9 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// header
|
// header
|
||||||
const QString formFileName = buildFileName(params.path, params.uiFile, formSuffix());
|
const FilePath formFileName = buildFileName(params.path, params.uiFile, formSuffix());
|
||||||
const QString headerFileName = buildFileName(params.path, params.headerFile, headerSuffix());
|
const FilePath headerFileName = buildFileName(params.path, params.headerFile, headerSuffix());
|
||||||
const QString sourceFileName = buildFileName(params.path, params.sourceFile, sourceSuffix());
|
const FilePath sourceFileName = buildFileName(params.path, params.sourceFile, sourceSuffix());
|
||||||
|
|
||||||
Core::GeneratedFile headerFile(headerFileName);
|
Core::GeneratedFile headerFile(headerFileName);
|
||||||
headerFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
headerFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
||||||
@@ -102,5 +104,5 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
|
|||||||
return Core::GeneratedFiles() << headerFile << sourceFile << uiFile;
|
return Core::GeneratedFiles() << headerFile << sourceFile << uiFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // Internal
|
||||||
}
|
} // Designer
|
||||||
|
@@ -26,9 +26,13 @@
|
|||||||
#include "formclasswizarddialog.h"
|
#include "formclasswizarddialog.h"
|
||||||
#include "formclasswizardpage.h"
|
#include "formclasswizardpage.h"
|
||||||
#include "formclasswizardparameters.h"
|
#include "formclasswizardparameters.h"
|
||||||
|
|
||||||
#include <cppeditor/abstracteditorsupport.h>
|
#include <cppeditor/abstracteditorsupport.h>
|
||||||
#include <designer/formtemplatewizardpage.h>
|
#include <designer/formtemplatewizardpage.h>
|
||||||
#include <qtsupport/codegenerator.h>
|
#include <qtsupport/codegenerator.h>
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
enum { FormPageId, ClassPageId };
|
enum { FormPageId, ClassPageId };
|
||||||
|
|
||||||
@@ -52,14 +56,14 @@ FormClassWizardDialog::FormClassWizardDialog(const Core::BaseFileWizardFactory *
|
|||||||
addPage(p);
|
addPage(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FormClassWizardDialog::path() const
|
FilePath FormClassWizardDialog::filePath() const
|
||||||
{
|
{
|
||||||
return m_classPage->path();
|
return m_classPage->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardDialog::setPath(const QString &p)
|
void FormClassWizardDialog::setFilePath(const FilePath &p)
|
||||||
{
|
{
|
||||||
m_classPage->setPath(p);
|
m_classPage->setFilePath(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardDialog::initializePage(int id)
|
void FormClassWizardDialog::initializePage(int id)
|
||||||
|
@@ -45,8 +45,8 @@ public:
|
|||||||
|
|
||||||
explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
||||||
|
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
void setPath(const QString &);
|
void setFilePath(const Utils::FilePath &);
|
||||||
|
|
||||||
Designer::FormClassWizardParameters parameters() const;
|
Designer::FormClassWizardParameters parameters() const;
|
||||||
|
|
||||||
|
@@ -32,9 +32,8 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
#include <utils/mimetypes/mimedatabase.h>
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
@@ -88,20 +87,20 @@ void FormClassWizardPage::setClassName(const QString &suggestedClassName)
|
|||||||
slotValidChanged();
|
slotValidChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FormClassWizardPage::path() const
|
Utils::FilePath FormClassWizardPage::filePath() const
|
||||||
{
|
{
|
||||||
return m_ui->newClassWidget->path();
|
return m_ui->newClassWidget->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardPage::setPath(const QString &p)
|
void FormClassWizardPage::setFilePath(const Utils::FilePath &p)
|
||||||
{
|
{
|
||||||
m_ui->newClassWidget->setPath(p);
|
m_ui->newClassWidget->setFilePath(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardPage::getParameters(FormClassWizardParameters *p) const
|
void FormClassWizardPage::getParameters(FormClassWizardParameters *p) const
|
||||||
{
|
{
|
||||||
p->className = m_ui->newClassWidget->className();
|
p->className = m_ui->newClassWidget->className();
|
||||||
p->path = path();
|
p->path = filePath();
|
||||||
p->sourceFile = m_ui->newClassWidget->sourceFileName();
|
p->sourceFile = m_ui->newClassWidget->sourceFileName();
|
||||||
p->headerFile = m_ui->newClassWidget->headerFileName();
|
p->headerFile = m_ui->newClassWidget->headerFileName();
|
||||||
p->uiFile = m_ui->newClassWidget-> formFileName();
|
p->uiFile = m_ui->newClassWidget-> formFileName();
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <QWizardPage>
|
#include <QWizardPage>
|
||||||
|
|
||||||
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
|
|
||||||
class FormClassWizardParameters;
|
class FormClassWizardParameters;
|
||||||
@@ -49,8 +51,8 @@ public:
|
|||||||
bool validatePage() override;
|
bool validatePage() override;
|
||||||
|
|
||||||
void setClassName(const QString &suggestedClassName);
|
void setClassName(const QString &suggestedClassName);
|
||||||
void setPath(const QString &);
|
void setFilePath(const Utils::FilePath &);
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
|
|
||||||
// Fill out applicable parameters
|
// Fill out applicable parameters
|
||||||
void getParameters(FormClassWizardParameters *) const;
|
void getParameters(FormClassWizardParameters *) const;
|
||||||
|
@@ -25,7 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QString>
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
@@ -39,7 +40,7 @@ class FormClassWizardParameters
|
|||||||
public:
|
public:
|
||||||
QString uiTemplate;
|
QString uiTemplate;
|
||||||
QString className;
|
QString className;
|
||||||
QString path;
|
Utils::FilePath path;
|
||||||
QString sourceFile;
|
QString sourceFile;
|
||||||
QString headerFile;
|
QString headerFile;
|
||||||
QString uiFile;
|
QString uiFile;
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
enum { debugNewClassWidget = 0 };
|
enum { debugNewClassWidget = 0 };
|
||||||
|
|
||||||
/*! \class Utils::NewClassWidget
|
/*! \class Utils::NewClassWidget
|
||||||
@@ -171,14 +173,14 @@ QString NewClassWidget::formFileName() const
|
|||||||
return d->m_ui.formFileLineEdit->text();
|
return d->m_ui.formFileLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NewClassWidget::path() const
|
FilePath NewClassWidget::filePath() const
|
||||||
{
|
{
|
||||||
return d->m_ui.pathChooser->filePath().toString();
|
return d->m_ui.pathChooser->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewClassWidget::setPath(const QString &path)
|
void NewClassWidget::setFilePath(const FilePath &path)
|
||||||
{
|
{
|
||||||
d->m_ui.pathChooser->setPath(path);
|
d->m_ui.pathChooser->setFilePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NewClassWidget::sourceExtension() const
|
QString NewClassWidget::sourceExtension() const
|
||||||
@@ -305,21 +307,21 @@ static QString ensureSuffix(QString f, const QString &extension)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If a non-empty name was passed, expand to directory and suffix
|
// If a non-empty name was passed, expand to directory and suffix
|
||||||
static QString expandFileName(const QDir &dir, const QString &name, const QString &extension)
|
static FilePath expandFileName(const FilePath &dir, const QString &name, const QString &extension)
|
||||||
{
|
{
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
return QString();
|
return {};
|
||||||
return dir.absoluteFilePath(ensureSuffix(name, extension));
|
return dir / ensureSuffix(name, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList NewClassWidget::files() const
|
Utils::FilePaths NewClassWidget::files() const
|
||||||
{
|
{
|
||||||
QStringList rc;
|
const FilePath dir = filePath();
|
||||||
const QDir dir = QDir(path());
|
return {
|
||||||
rc.push_back(expandFileName(dir, headerFileName(), headerExtension()));
|
expandFileName(dir, headerFileName(), headerExtension()),
|
||||||
rc.push_back(expandFileName(dir, sourceFileName(), sourceExtension()));
|
expandFileName(dir, sourceFileName(), sourceExtension()),
|
||||||
rc.push_back(expandFileName(dir, formFileName(), formExtension()));
|
expandFileName(dir, formFileName(), formExtension()),
|
||||||
return rc;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
@@ -52,14 +54,14 @@ public:
|
|||||||
QString sourceFileName() const;
|
QString sourceFileName() const;
|
||||||
QString headerFileName() const;
|
QString headerFileName() const;
|
||||||
QString formFileName() const;
|
QString formFileName() const;
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
QString sourceExtension() const;
|
QString sourceExtension() const;
|
||||||
QString headerExtension() const;
|
QString headerExtension() const;
|
||||||
QString formExtension() const;
|
QString formExtension() const;
|
||||||
|
|
||||||
bool isValid(QString *error = nullptr) const;
|
bool isValid(QString *error = nullptr) const;
|
||||||
|
|
||||||
QStringList files() const;
|
Utils::FilePaths files() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void validChanged();
|
void validChanged();
|
||||||
@@ -72,7 +74,7 @@ public slots:
|
|||||||
* valid class name.
|
* valid class name.
|
||||||
*/
|
*/
|
||||||
void setClassName(const QString &suggestedName);
|
void setClassName(const QString &suggestedName);
|
||||||
void setPath(const QString &path);
|
void setFilePath(const Utils::FilePath &filePath);
|
||||||
void setSourceExtension(const QString &e);
|
void setSourceExtension(const QString &e);
|
||||||
void setHeaderExtension(const QString &e);
|
void setHeaderExtension(const QString &e);
|
||||||
void setLowerCaseFiles(bool v);
|
void setLowerCaseFiles(bool v);
|
||||||
|
@@ -473,6 +473,18 @@ IDeviceWidget *DockerDevice::createWidget()
|
|||||||
return new DockerDeviceWidget(sharedFromThis());
|
return new DockerDeviceWidget(sharedFromThis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tasks DockerDevice::validate() const
|
||||||
|
{
|
||||||
|
Tasks result;
|
||||||
|
if (d->m_data.mounts.isEmpty()) {
|
||||||
|
result << Task(Task::Error,
|
||||||
|
tr("The Docker device has not set up shared directories."
|
||||||
|
"This will not work for building."),
|
||||||
|
{}, -1, {});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// DockerDevice
|
// DockerDevice
|
||||||
|
|
||||||
|
@@ -62,6 +62,7 @@ public:
|
|||||||
static Ptr create(const DockerDeviceData &data) { return Ptr(new DockerDevice(data)); }
|
static Ptr create(const DockerDeviceData &data) { return Ptr(new DockerDevice(data)); }
|
||||||
|
|
||||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||||
|
QVector<ProjectExplorer::Task> validate() const override;
|
||||||
|
|
||||||
bool canCreateProcess() const override { return true; }
|
bool canCreateProcess() const override { return true; }
|
||||||
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const override;
|
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const override;
|
||||||
|
@@ -59,8 +59,7 @@ FilesSelectionWizardPage::FilesSelectionWizardPage(GenericProjectWizardDialog *g
|
|||||||
|
|
||||||
void FilesSelectionWizardPage::initializePage()
|
void FilesSelectionWizardPage::initializePage()
|
||||||
{
|
{
|
||||||
m_filesWidget->resetModel(Utils::FilePath::fromString(m_genericProjectWizardDialog->path()),
|
m_filesWidget->resetModel(m_genericProjectWizardDialog->filePath(), Utils::FilePaths());
|
||||||
Utils::FilePaths());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilesSelectionWizardPage::cleanupPage()
|
void FilesSelectionWizardPage::cleanupPage()
|
||||||
|
@@ -46,13 +46,14 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static const char *const ConfigFileTemplate =
|
const char ConfigFileTemplate[] =
|
||||||
"// Add predefined macros for your project here. For example:\n"
|
"// Add predefined macros for your project here. For example:\n"
|
||||||
"// #define THE_ANSWER 42\n"
|
"// #define THE_ANSWER 42\n";
|
||||||
;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -79,24 +80,24 @@ GenericProjectWizardDialog::GenericProjectWizardDialog(const Core::BaseFileWizar
|
|||||||
addPage(m_secondPage);
|
addPage(m_secondPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericProjectWizardDialog::path() const
|
FilePath GenericProjectWizardDialog::filePath() const
|
||||||
{
|
{
|
||||||
return m_firstPage->path();
|
return m_firstPage->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePaths GenericProjectWizardDialog::selectedPaths() const
|
FilePaths GenericProjectWizardDialog::selectedPaths() const
|
||||||
{
|
{
|
||||||
return m_secondPage->selectedPaths();
|
return m_secondPage->selectedPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePaths GenericProjectWizardDialog::selectedFiles() const
|
FilePaths GenericProjectWizardDialog::selectedFiles() const
|
||||||
{
|
{
|
||||||
return m_secondPage->selectedFiles();
|
return m_secondPage->selectedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericProjectWizardDialog::setPath(const QString &path)
|
void GenericProjectWizardDialog::setFilePath(const FilePath &path)
|
||||||
{
|
{
|
||||||
m_firstPage->setPath(path);
|
m_firstPage->setFilePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericProjectWizardDialog::projectName() const
|
QString GenericProjectWizardDialog::projectName() const
|
||||||
@@ -129,7 +130,7 @@ Core::BaseFileWizard *GenericProjectWizard::create(QWidget *parent,
|
|||||||
{
|
{
|
||||||
auto wizard = new GenericProjectWizardDialog(this, parent);
|
auto wizard = new GenericProjectWizardDialog(this, parent);
|
||||||
|
|
||||||
wizard->setPath(parameters.defaultPath());
|
wizard->setFilePath(parameters.defaultPath());
|
||||||
|
|
||||||
foreach (QWizardPage *p, wizard->extensionPages())
|
foreach (QWizardPage *p, wizard->extensionPages())
|
||||||
wizard->addPage(p);
|
wizard->addPage(p);
|
||||||
@@ -143,15 +144,14 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
|||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
auto wizard = qobject_cast<const GenericProjectWizardDialog *>(w);
|
auto wizard = qobject_cast<const GenericProjectWizardDialog *>(w);
|
||||||
const QString projectPath = wizard->path();
|
const FilePath projectPath = wizard->filePath();
|
||||||
const QDir dir(projectPath);
|
|
||||||
const QString projectName = wizard->projectName();
|
const QString projectName = wizard->projectName();
|
||||||
const QString creatorFileName = QFileInfo(dir, projectName + QLatin1String(".creator")).absoluteFilePath();
|
const FilePath creatorFileName = projectPath.pathAppended(projectName + ".creator");
|
||||||
const QString filesFileName = QFileInfo(dir, projectName + QLatin1String(".files")).absoluteFilePath();
|
const FilePath filesFileName = projectPath.pathAppended(projectName + ".files");
|
||||||
const QString includesFileName = QFileInfo(dir, projectName + QLatin1String(".includes")).absoluteFilePath();
|
const FilePath includesFileName = projectPath.pathAppended(projectName + ".includes");
|
||||||
const QString configFileName = QFileInfo(dir, projectName + QLatin1String(".config")).absoluteFilePath();
|
const FilePath configFileName = projectPath.pathAppended(projectName + ".config");
|
||||||
const QString cxxflagsFileName = QFileInfo(dir, projectName + QLatin1String(".cxxflags")).absoluteFilePath();
|
const FilePath cxxflagsFileName = projectPath.pathAppended(projectName + ".cxxflags");
|
||||||
const QString cflagsFileName = QFileInfo(dir, projectName + QLatin1String(".cflags")).absoluteFilePath();
|
const FilePath cflagsFileName = projectPath.pathAppended(projectName + ".cflags");
|
||||||
const QStringList paths = Utils::transform(wizard->selectedPaths(), &Utils::FilePath::toString);
|
const QStringList paths = Utils::transform(wizard->selectedPaths(), &Utils::FilePath::toString);
|
||||||
|
|
||||||
Utils::MimeType headerTy = Utils::mimeTypeForName(QLatin1String("text/x-chdr"));
|
Utils::MimeType headerTy = Utils::mimeTypeForName(QLatin1String("text/x-chdr"));
|
||||||
@@ -159,6 +159,7 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
|||||||
QStringList nameFilters = headerTy.globPatterns();
|
QStringList nameFilters = headerTy.globPatterns();
|
||||||
|
|
||||||
QStringList includePaths;
|
QStringList includePaths;
|
||||||
|
const QDir dir(projectPath.toString());
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
QFileInfo fileInfo(path);
|
QFileInfo fileInfo(path);
|
||||||
QDir thisDir(fileInfo.absoluteFilePath());
|
QDir thisDir(fileInfo.absoluteFilePath());
|
||||||
|
@@ -44,8 +44,8 @@ class GenericProjectWizardDialog : public Core::BaseFileWizard
|
|||||||
public:
|
public:
|
||||||
explicit GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
explicit GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
||||||
|
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
void setPath(const QString &path);
|
void setFilePath(const Utils::FilePath &path);
|
||||||
Utils::FilePaths selectedFiles() const;
|
Utils::FilePaths selectedFiles() const;
|
||||||
Utils::FilePaths selectedPaths() const;
|
Utils::FilePaths selectedPaths() const;
|
||||||
|
|
||||||
|
@@ -983,7 +983,7 @@ void GitClient::requestReload(const QString &documentId, const QString &source,
|
|||||||
QTC_ASSERT(document, return);
|
QTC_ASSERT(document, return);
|
||||||
GitBaseDiffEditorController *controller = factory(document);
|
GitBaseDiffEditorController *controller = factory(document);
|
||||||
QTC_ASSERT(controller, return);
|
QTC_ASSERT(controller, return);
|
||||||
controller->setVcsBinary(settings().binaryPath.filePath());
|
controller->setVcsBinary(settings().gitExecutable());
|
||||||
controller->setVcsTimeoutS(settings().timeout.value());
|
controller->setVcsTimeoutS(settings().timeout.value());
|
||||||
controller->setProcessEnvironment(processEnvironment());
|
controller->setProcessEnvironment(processEnvironment());
|
||||||
controller->setWorkingDirectory(workingDirectory);
|
controller->setWorkingDirectory(workingDirectory);
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "gitsettings.h"
|
#include "gitsettings.h"
|
||||||
|
|
||||||
|
#include <utils/environment.h>
|
||||||
#include <utils/layoutbuilder.h>
|
#include <utils/layoutbuilder.h>
|
||||||
|
|
||||||
#include <vcsbase/vcsbaseconstants.h>
|
#include <vcsbase/vcsbaseconstants.h>
|
||||||
@@ -140,6 +141,12 @@ FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
|
|||||||
errorMessage->clear();
|
errorMessage->clear();
|
||||||
|
|
||||||
FilePath binPath = binaryPath.filePath();
|
FilePath binPath = binaryPath.filePath();
|
||||||
|
if (!binPath.isAbsolutePath()) {
|
||||||
|
Environment env = Environment::systemEnvironment();
|
||||||
|
if (!path.filePath().isEmpty())
|
||||||
|
env.prependOrSetPath(path.filePath().toString());
|
||||||
|
binPath = env.searchInPath(binPath.toString());
|
||||||
|
}
|
||||||
if (binPath.isEmpty()) {
|
if (binPath.isEmpty()) {
|
||||||
if (ok)
|
if (ok)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace IncrediBuild {
|
namespace IncrediBuild {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -45,11 +46,11 @@ QList<Utils::Id> CMakeCommandBuilder::migratableSteps() const
|
|||||||
return {CMakeProjectManager::Constants::CMAKE_BUILD_STEP_ID};
|
return {CMakeProjectManager::Constants::CMAKE_BUILD_STEP_ID};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeCommandBuilder::defaultCommand() const
|
FilePath CMakeCommandBuilder::defaultCommand() const
|
||||||
{
|
{
|
||||||
const QString defaultCMake = "cmake";
|
const QString defaultCMake = "cmake";
|
||||||
const QString cmake = QStandardPaths::findExecutable(defaultCMake);
|
const QString cmake = QStandardPaths::findExecutable(defaultCMake);
|
||||||
return cmake.isEmpty() ? defaultCMake : cmake;
|
return FilePath::fromString(cmake.isEmpty() ? defaultCMake : cmake);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeCommandBuilder::defaultArguments() const
|
QString CMakeCommandBuilder::defaultArguments() const
|
||||||
|
@@ -41,7 +41,7 @@ private:
|
|||||||
QList<Utils::Id> migratableSteps() const final;
|
QList<Utils::Id> migratableSteps() const final;
|
||||||
QString id() const final { return "CMakeCommandBuilder"; }
|
QString id() const final { return "CMakeCommandBuilder"; }
|
||||||
QString displayName() const final { return tr("CMake"); }
|
QString displayName() const final { return tr("CMake"); }
|
||||||
QString defaultCommand() const final;
|
Utils::FilePath defaultCommand() const final;
|
||||||
QString defaultArguments() const final;
|
QString defaultArguments() const final;
|
||||||
QString setMultiProcessArg(QString args) final;
|
QString setMultiProcessArg(QString args) final;
|
||||||
};
|
};
|
||||||
|
@@ -25,27 +25,27 @@
|
|||||||
|
|
||||||
#include "commandbuilder.h"
|
#include "commandbuilder.h"
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace IncrediBuild {
|
namespace IncrediBuild {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
namespace Constants {
|
const char CUSTOMCOMMANDBUILDER_COMMAND[] = "IncrediBuild.BuildConsole.%1.Command";
|
||||||
const QLatin1String CUSTOMCOMMANDBUILDER_COMMAND("IncrediBuild.BuildConsole.%1.Command");
|
const char CUSTOMCOMMANDBUILDER_ARGS[] = "IncrediBuild.BuildConsole.%1.Arguments";
|
||||||
const QLatin1String CUSTOMCOMMANDBUILDER_ARGS("IncrediBuild.BuildConsole.%1.Arguments");
|
|
||||||
} // namespace Constants
|
|
||||||
|
|
||||||
void CommandBuilder::fromMap(const QVariantMap &map)
|
void CommandBuilder::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
m_command = map.value(QString(Constants::CUSTOMCOMMANDBUILDER_COMMAND).arg(id())).toString();
|
m_command = FilePath::fromVariant(map.value(QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())));
|
||||||
m_args = map.value(QString(Constants::CUSTOMCOMMANDBUILDER_ARGS).arg(id())).toString();
|
m_args = map.value(QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBuilder::toMap(QVariantMap *map) const
|
void CommandBuilder::toMap(QVariantMap *map) const
|
||||||
{
|
{
|
||||||
(*map)[QString(Constants::CUSTOMCOMMANDBUILDER_COMMAND).arg(id())] = QVariant(m_command);
|
(*map)[QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id())] = m_command.toVariant();
|
||||||
(*map)[QString(Constants::CUSTOMCOMMANDBUILDER_ARGS).arg(id())] = QVariant(m_args);
|
(*map)[QString(CUSTOMCOMMANDBUILDER_ARGS).arg(id())] = QVariant(m_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBuilder::setCommand(const QString &command)
|
void CommandBuilder::setCommand(const FilePath &command)
|
||||||
{
|
{
|
||||||
m_command = command;
|
m_command = command;
|
||||||
}
|
}
|
||||||
|
@@ -50,20 +50,20 @@ public:
|
|||||||
virtual void fromMap(const QVariantMap &map);
|
virtual void fromMap(const QVariantMap &map);
|
||||||
virtual void toMap(QVariantMap *map) const;
|
virtual void toMap(QVariantMap *map) const;
|
||||||
|
|
||||||
virtual QString defaultCommand() const { return QString(); }
|
virtual Utils::FilePath defaultCommand() const { return {}; }
|
||||||
virtual QString defaultArguments() const { return QString(); }
|
virtual QString defaultArguments() const { return QString(); }
|
||||||
virtual QString setMultiProcessArg(QString args) { return args; }
|
virtual QString setMultiProcessArg(QString args) { return args; }
|
||||||
|
|
||||||
QString command() const { return m_command; }
|
Utils::FilePath command() const { return m_command; }
|
||||||
void setCommand(const QString &command);
|
void setCommand(const Utils::FilePath &command);
|
||||||
QString effectiveCommand() const { return m_command.isEmpty() ? defaultCommand() : m_command; }
|
Utils::FilePath effectiveCommand() const { return m_command.isEmpty() ? defaultCommand() : m_command; }
|
||||||
|
|
||||||
QString arguments() { return m_args.isEmpty() ? defaultArguments() : m_args; }
|
QString arguments() { return m_args.isEmpty() ? defaultArguments() : m_args; }
|
||||||
void setArguments(const QString &arguments);
|
void setArguments(const QString &arguments);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorer::BuildStep *m_buildStep{};
|
ProjectExplorer::BuildStep *m_buildStep{};
|
||||||
QString m_command;
|
Utils::FilePath m_command;
|
||||||
QString m_args;
|
QString m_args;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ QString CommandBuilderAspect::fullCommandFlag(bool keepJobNum) const
|
|||||||
argsLine = d->m_activeCommandBuilder->setMultiProcessArg(argsLine);
|
argsLine = d->m_activeCommandBuilder->setMultiProcessArg(argsLine);
|
||||||
|
|
||||||
QString fullCommand("\"%1\" %2");
|
QString fullCommand("\"%1\" %2");
|
||||||
fullCommand = fullCommand.arg(d->m_activeCommandBuilder->effectiveCommand(), argsLine);
|
fullCommand = fullCommand.arg(d->m_activeCommandBuilder->effectiveCommand().toUserOutput(), argsLine);
|
||||||
|
|
||||||
return fullCommand;
|
return fullCommand;
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ void CommandBuilderAspect::addToLayout(LayoutBuilder &builder)
|
|||||||
d->makePathChooser->setBaseDirectory(PathChooser::homePath());
|
d->makePathChooser->setBaseDirectory(PathChooser::homePath());
|
||||||
d->makePathChooser->setHistoryCompleter("IncrediBuild.BuildConsole.MakeCommand.History");
|
d->makePathChooser->setHistoryCompleter("IncrediBuild.BuildConsole.MakeCommand.History");
|
||||||
connect(d->makePathChooser, &PathChooser::rawPathChanged, this, [this] {
|
connect(d->makePathChooser, &PathChooser::rawPathChanged, this, [this] {
|
||||||
d->m_activeCommandBuilder->setCommand(d->makePathChooser->rawPath());
|
d->m_activeCommandBuilder->setCommand(d->makePathChooser->rawFilePath());
|
||||||
updateGui();
|
updateGui();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -212,9 +212,9 @@ void CommandBuilderAspect::updateGui()
|
|||||||
|
|
||||||
d->commandBuilder->setCurrentText(d->m_activeCommandBuilder->displayName());
|
d->commandBuilder->setCurrentText(d->m_activeCommandBuilder->displayName());
|
||||||
|
|
||||||
const QString defaultCommand = d->m_activeCommandBuilder->defaultCommand();
|
const FilePath defaultCommand = d->m_activeCommandBuilder->defaultCommand();
|
||||||
d->makePathChooser->setPath(d->m_activeCommandBuilder->command());
|
d->makePathChooser->setFilePath(d->m_activeCommandBuilder->command());
|
||||||
d->makePathChooser->setDefaultValue(defaultCommand);
|
d->makePathChooser->setDefaultValue(defaultCommand.toUserOutput());
|
||||||
|
|
||||||
const QString defaultArgs = d->m_activeCommandBuilder->defaultArguments();
|
const QString defaultArgs = d->m_activeCommandBuilder->defaultArguments();
|
||||||
d->makeArgumentsLineEdit->setPlaceholderText(defaultArgs);
|
d->makeArgumentsLineEdit->setPlaceholderText(defaultArgs);
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace IncrediBuild {
|
namespace IncrediBuild {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -50,35 +51,32 @@ QList<Utils::Id> MakeCommandBuilder::migratableSteps() const
|
|||||||
return {QmakeProjectManager::Constants::MAKESTEP_BS_ID};
|
return {QmakeProjectManager::Constants::MAKESTEP_BS_ID};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MakeCommandBuilder::defaultCommand() const
|
Utils::FilePath MakeCommandBuilder::defaultCommand() const
|
||||||
{
|
{
|
||||||
BuildConfiguration *buildConfig = buildStep()->buildConfiguration();
|
BuildConfiguration *buildConfig = buildStep()->buildConfiguration();
|
||||||
if (buildConfig) {
|
if (buildConfig) {
|
||||||
Target *target = buildStep()->target();
|
if (Target *target = buildStep()->target()) {
|
||||||
if (target) {
|
if (ToolChain *toolChain = ToolChainKitAspect::cxxToolChain(target->kit()))
|
||||||
ToolChain *toolChain = ToolChainKitAspect::toolChain(target->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
return toolChain->makeCommand(buildConfig->environment());
|
||||||
if (toolChain)
|
|
||||||
return toolChain->makeCommand(buildConfig->environment()).toUserOutput();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MakeCommandBuilder::setMultiProcessArg(QString args)
|
QString MakeCommandBuilder::setMultiProcessArg(QString args)
|
||||||
{
|
{
|
||||||
QString cmd = command();
|
const FilePath cmd = command();
|
||||||
QFileInfo fileInfo(cmd);
|
|
||||||
|
|
||||||
// jom -j 200
|
// jom -j 200
|
||||||
if (fileInfo.baseName().compare("jom", Qt::CaseSensitivity::CaseInsensitive) == 0) {
|
if (cmd.baseName().compare("jom", Qt::CaseSensitivity::CaseInsensitive) == 0) {
|
||||||
QRegularExpression regExp("\\s*\\-j\\s+\\d+");
|
QRegularExpression regExp("\\s*\\-j\\s+\\d+");
|
||||||
args.remove(regExp);
|
args.remove(regExp);
|
||||||
args.append(" -j 200");
|
args.append(" -j 200");
|
||||||
}
|
}
|
||||||
// make -j200
|
// make -j200
|
||||||
else if ((fileInfo.baseName().compare("make", Qt::CaseSensitivity::CaseInsensitive) == 0)
|
else if ((cmd.baseName().compare("make", Qt::CaseSensitivity::CaseInsensitive) == 0)
|
||||||
|| (fileInfo.baseName().compare("gmake", Qt::CaseSensitivity::CaseInsensitive) == 0)) {
|
|| (cmd.baseName().compare("gmake", Qt::CaseSensitivity::CaseInsensitive) == 0)) {
|
||||||
QRegularExpression regExp("\\s*\\-j\\d+");
|
QRegularExpression regExp("\\s*\\-j\\d+");
|
||||||
args.remove(regExp);
|
args.remove(regExp);
|
||||||
args.append(" -j200");
|
args.append(" -j200");
|
||||||
|
@@ -41,7 +41,7 @@ private:
|
|||||||
QList<Utils::Id> migratableSteps() const final;
|
QList<Utils::Id> migratableSteps() const final;
|
||||||
QString id() const final { return "MakeCommandBuilder"; }
|
QString id() const final { return "MakeCommandBuilder"; }
|
||||||
QString displayName() const final { return tr("Make"); }
|
QString displayName() const final { return tr("Make"); }
|
||||||
QString defaultCommand() const final;
|
Utils::FilePath defaultCommand() const final;
|
||||||
QString setMultiProcessArg(QString args) final;
|
QString setMultiProcessArg(QString args) final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef MCUSUPPORTVERSIONDETECTION_H
|
#pragma once
|
||||||
#define MCUSUPPORTVERSIONDETECTION_H
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ public:
|
|||||||
McuPackageExecutableVersionDetector(const QString &detectionPath,
|
McuPackageExecutableVersionDetector(const QString &detectionPath,
|
||||||
const QStringList &detectionArgs,
|
const QStringList &detectionArgs,
|
||||||
const QString &detectionRegExp);
|
const QString &detectionRegExp);
|
||||||
virtual QString parseVersion(const QString &packagePath) const;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
private:
|
private:
|
||||||
const QString m_detectionPath;
|
const QString m_detectionPath;
|
||||||
const QStringList m_detectionArgs;
|
const QStringList m_detectionArgs;
|
||||||
@@ -62,7 +61,7 @@ public:
|
|||||||
const QString &elementName,
|
const QString &elementName,
|
||||||
const QString &versionAttribute,
|
const QString &versionAttribute,
|
||||||
const QString &versionRegExp);
|
const QString &versionRegExp);
|
||||||
QString parseVersion(const QString &packagePath) const;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
private:
|
private:
|
||||||
const QString m_filePattern;
|
const QString m_filePattern;
|
||||||
const QString m_versionElement;
|
const QString m_versionElement;
|
||||||
@@ -75,7 +74,7 @@ class McuPackageDirectoryVersionDetector : public McuPackageVersionDetector
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
McuPackageDirectoryVersionDetector(const QString &filePattern, const QString &versionRegExp, const bool isFile);
|
McuPackageDirectoryVersionDetector(const QString &filePattern, const QString &versionRegExp, const bool isFile);
|
||||||
QString parseVersion(const QString &packagePath) const;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
private:
|
private:
|
||||||
const QString m_filePattern;
|
const QString m_filePattern;
|
||||||
const QString m_versionRegExp;
|
const QString m_versionRegExp;
|
||||||
@@ -87,12 +86,10 @@ class McuPackagePathVersionDetector : public McuPackageVersionDetector
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
McuPackagePathVersionDetector(const QString &versionRegExp);
|
McuPackagePathVersionDetector(const QString &versionRegExp);
|
||||||
QString parseVersion(const QString &packagePath) const;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
private:
|
private:
|
||||||
const QString m_versionRegExp;
|
const QString m_versionRegExp;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // McuSupport
|
} // McuSupport
|
||||||
|
|
||||||
#endif // MCUSUPPORTVERSIONDETECTION_H
|
|
||||||
|
@@ -64,7 +64,7 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFacto
|
|||||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||||
d(std::make_unique<BaseProjectWizardDialogPrivate>(new ProjectIntroPage))
|
d(std::make_unique<BaseProjectWizardDialogPrivate>(new ProjectIntroPage))
|
||||||
{
|
{
|
||||||
setFilePath(FilePath::fromString(parameters.defaultPath()));
|
setFilePath(parameters.defaultPath());
|
||||||
setSelectedPlatform(parameters.selectedPlatform());
|
setSelectedPlatform(parameters.selectedPlatform());
|
||||||
setRequiredFeatures(parameters.requiredFeatures());
|
setRequiredFeatures(parameters.requiredFeatures());
|
||||||
init();
|
init();
|
||||||
@@ -77,7 +77,7 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFacto
|
|||||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||||
d(std::make_unique<BaseProjectWizardDialogPrivate>(introPage, introId))
|
d(std::make_unique<BaseProjectWizardDialogPrivate>(introPage, introId))
|
||||||
{
|
{
|
||||||
setFilePath(FilePath::fromString(parameters.defaultPath()));
|
setFilePath(parameters.defaultPath());
|
||||||
setSelectedPlatform(parameters.selectedPlatform());
|
setSelectedPlatform(parameters.selectedPlatform());
|
||||||
setRequiredFeatures(parameters.requiredFeatures());
|
setRequiredFeatures(parameters.requiredFeatures());
|
||||||
init();
|
init();
|
||||||
@@ -157,9 +157,9 @@ ProjectIntroPage *BaseProjectWizardDialog::introPage() const
|
|||||||
return d->introPage;
|
return d->introPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseProjectWizardDialog::uniqueProjectName(const QString &path)
|
QString BaseProjectWizardDialog::uniqueProjectName(const FilePath &path)
|
||||||
{
|
{
|
||||||
const QDir pathDir(path);
|
const QDir pathDir(path.toString());
|
||||||
//: File path suggestion for a new project. If you choose
|
//: File path suggestion for a new project. If you choose
|
||||||
//: to translate it, make sure it is a valid path name without blanks
|
//: to translate it, make sure it is a valid path name without blanks
|
||||||
//: and using only ascii chars.
|
//: and using only ascii chars.
|
||||||
|
@@ -60,7 +60,7 @@ public:
|
|||||||
Utils::FilePath filePath() const;
|
Utils::FilePath filePath() const;
|
||||||
|
|
||||||
// Generate a new project name (untitled<n>) in path.
|
// Generate a new project name (untitled<n>) in path.
|
||||||
static QString uniqueProjectName(const QString &path);
|
static QString uniqueProjectName(const Utils::FilePath &path);
|
||||||
void addExtensionPages(const QList<QWizardPage *> &wizardPageList);
|
void addExtensionPages(const QList<QWizardPage *> &wizardPageList);
|
||||||
|
|
||||||
void setIntroDescription(const QString &d);
|
void setIntroDescription(const QString &d);
|
||||||
|
@@ -166,7 +166,7 @@ BaseFileWizard *CustomWizard::create(QWidget *parent, const WizardDialogParamete
|
|||||||
|
|
||||||
d->m_context->reset();
|
d->m_context->reset();
|
||||||
auto customPage = new CustomWizardPage(d->m_context, parameters());
|
auto customPage = new CustomWizardPage(d->m_context, parameters());
|
||||||
customPage->setPath(p.defaultPath());
|
customPage->setFilePath(p.defaultPath());
|
||||||
if (parameters()->firstPageId >= 0)
|
if (parameters()->firstPageId >= 0)
|
||||||
wizard->setPage(parameters()->firstPageId, customPage);
|
wizard->setPage(parameters()->firstPageId, customPage);
|
||||||
else
|
else
|
||||||
@@ -506,7 +506,7 @@ BaseFileWizard *CustomProjectWizard::create(QWidget *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
||||||
const QString &defaultPath,
|
const FilePath &defaultPath,
|
||||||
const QList<QWizardPage *> &extensionPages) const
|
const QList<QWizardPage *> &extensionPages) const
|
||||||
{
|
{
|
||||||
const CustomWizardParametersPtr pa = parameters();
|
const CustomWizardParametersPtr pa = parameters();
|
||||||
@@ -526,7 +526,7 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
|||||||
}
|
}
|
||||||
for (QWizardPage *ep : extensionPages)
|
for (QWizardPage *ep : extensionPages)
|
||||||
w->addPage(ep);
|
w->addPage(ep);
|
||||||
w->setFilePath(FilePath::fromString(defaultPath));
|
w->setFilePath(defaultPath);
|
||||||
w->setProjectName(BaseProjectWizardDialog::uniqueProjectName(defaultPath));
|
w->setProjectName(BaseProjectWizardDialog::uniqueProjectName(defaultPath));
|
||||||
|
|
||||||
connect(w, &BaseProjectWizardDialog::projectParametersChanged,
|
connect(w, &BaseProjectWizardDialog::projectParametersChanged,
|
||||||
|
@@ -141,7 +141,7 @@ protected:
|
|||||||
|
|
||||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const override;
|
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const override;
|
||||||
|
|
||||||
void initProjectWizardDialog(BaseProjectWizardDialog *w, const QString &defaultPath,
|
void initProjectWizardDialog(BaseProjectWizardDialog *w, const Utils::FilePath &defaultPath,
|
||||||
const QList<QWizardPage *> &extensionPages) const;
|
const QList<QWizardPage *> &extensionPages) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -437,9 +437,9 @@ FilePath CustomWizardPage::filePath() const
|
|||||||
return m_pathChooser->filePath();
|
return m_pathChooser->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomWizardPage::setPath(const QString &path)
|
void CustomWizardPage::setFilePath(const FilePath &path)
|
||||||
{
|
{
|
||||||
m_pathChooser->setPath(path);
|
m_pathChooser->setFilePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomWizardPage::isComplete() const
|
bool CustomWizardPage::isComplete() const
|
||||||
|
@@ -127,7 +127,7 @@ public:
|
|||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
Utils::FilePath filePath() const;
|
Utils::FilePath filePath() const;
|
||||||
void setPath(const QString &path);
|
void setFilePath(const Utils::FilePath &path);
|
||||||
|
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
|
|
||||||
|
@@ -532,6 +532,11 @@ bool IDevice::isCompatibleWith(const Kit *k) const
|
|||||||
return DeviceTypeKitAspect::deviceTypeId(k) == type();
|
return DeviceTypeKitAspect::deviceTypeId(k) == type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<Task> IDevice::validate() const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
void IDevice::addDeviceAction(const DeviceAction &deviceAction)
|
void IDevice::addDeviceAction(const DeviceAction &deviceAction)
|
||||||
{
|
{
|
||||||
d->deviceActions.append(deviceAction);
|
d->deviceActions.append(deviceAction);
|
||||||
|
@@ -65,6 +65,7 @@ class DeviceProcess;
|
|||||||
class DeviceProcessList;
|
class DeviceProcessList;
|
||||||
class Kit;
|
class Kit;
|
||||||
class Runnable;
|
class Runnable;
|
||||||
|
class Task;
|
||||||
|
|
||||||
namespace Internal { class IDevicePrivate; }
|
namespace Internal { class IDevicePrivate; }
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ public:
|
|||||||
Utils::Id id() const;
|
Utils::Id id() const;
|
||||||
|
|
||||||
virtual bool isCompatibleWith(const Kit *k) const;
|
virtual bool isCompatibleWith(const Kit *k) const;
|
||||||
|
virtual QVector<Task> validate() const;
|
||||||
|
|
||||||
QString displayType() const;
|
QString displayType() const;
|
||||||
Utils::OsType osType() const;
|
Utils::OsType osType() const;
|
||||||
|
@@ -98,6 +98,7 @@ static FolderNavigationWidgetFactory *m_instance = nullptr;
|
|||||||
QVector<FolderNavigationWidgetFactory::RootDirectory>
|
QVector<FolderNavigationWidgetFactory::RootDirectory>
|
||||||
FolderNavigationWidgetFactory::m_rootDirectories;
|
FolderNavigationWidgetFactory::m_rootDirectories;
|
||||||
|
|
||||||
|
Utils::FilePath FolderNavigationWidgetFactory::m_fallbackSyncFilePath;
|
||||||
|
|
||||||
static QWidget *createHLine()
|
static QWidget *createHLine()
|
||||||
{
|
{
|
||||||
@@ -653,7 +654,8 @@ int FolderNavigationWidget::bestRootForFile(const Utils::FilePath &filePath)
|
|||||||
int commonLength = 0;
|
int commonLength = 0;
|
||||||
for (int i = 1; i < m_rootSelector->count(); ++i) {
|
for (int i = 1; i < m_rootSelector->count(); ++i) {
|
||||||
const auto root = m_rootSelector->itemData(i).value<Utils::FilePath>();
|
const auto root = m_rootSelector->itemData(i).value<Utils::FilePath>();
|
||||||
if (filePath.isChildOf(root) && root.toString().size() > commonLength) {
|
if ((filePath == root || filePath.isChildOf(root))
|
||||||
|
&& root.toString().size() > commonLength) {
|
||||||
index = i;
|
index = i;
|
||||||
commonLength = root.toString().size();
|
commonLength = root.toString().size();
|
||||||
}
|
}
|
||||||
@@ -893,6 +895,8 @@ Core::NavigationView FolderNavigationWidgetFactory::createWidget()
|
|||||||
&FolderNavigationWidgetFactory::rootDirectoryRemoved,
|
&FolderNavigationWidgetFactory::rootDirectoryRemoved,
|
||||||
fnw,
|
fnw,
|
||||||
&FolderNavigationWidget::removeRootDirectory);
|
&FolderNavigationWidget::removeRootDirectory);
|
||||||
|
if (!Core::EditorManager::currentDocument() && !m_fallbackSyncFilePath.isEmpty())
|
||||||
|
fnw->syncWithFilePath(m_fallbackSyncFilePath);
|
||||||
|
|
||||||
Core::NavigationView n;
|
Core::NavigationView n;
|
||||||
n.widget = fnw;
|
n.widget = fnw;
|
||||||
@@ -965,6 +969,11 @@ void FolderNavigationWidgetFactory::removeRootDirectory(const QString &id)
|
|||||||
emit m_instance->rootDirectoryRemoved(id);
|
emit m_instance->rootDirectoryRemoved(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FolderNavigationWidgetFactory::setFallbackSyncFilePath(const FilePath &filePath)
|
||||||
|
{
|
||||||
|
m_fallbackSyncFilePath = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
int FolderNavigationWidgetFactory::rootIndex(const QString &id)
|
int FolderNavigationWidgetFactory::rootIndex(const QString &id)
|
||||||
{
|
{
|
||||||
return Utils::indexOf(m_rootDirectories,
|
return Utils::indexOf(m_rootDirectories,
|
||||||
|
@@ -77,6 +77,10 @@ public:
|
|||||||
static void insertRootDirectory(const RootDirectory &directory);
|
static void insertRootDirectory(const RootDirectory &directory);
|
||||||
static void removeRootDirectory(const QString &id);
|
static void removeRootDirectory(const QString &id);
|
||||||
|
|
||||||
|
static void setFallbackSyncFilePath(const Utils::FilePath &filePath);
|
||||||
|
|
||||||
|
static const Utils::FilePath &fallbackSyncFilePath();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rootDirectoryAdded(const RootDirectory &directory);
|
void rootDirectoryAdded(const RootDirectory &directory);
|
||||||
void rootDirectoryRemoved(const QString &id);
|
void rootDirectoryRemoved(const QString &id);
|
||||||
@@ -87,6 +91,7 @@ private:
|
|||||||
void registerActions();
|
void registerActions();
|
||||||
|
|
||||||
static QVector<RootDirectory> m_rootDirectories;
|
static QVector<RootDirectory> m_rootDirectories;
|
||||||
|
static Utils::FilePath m_fallbackSyncFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FolderNavigationWidget : public QWidget
|
class FolderNavigationWidget : public QWidget
|
||||||
|
@@ -47,17 +47,17 @@ void JsonFilePage::initializePage()
|
|||||||
|
|
||||||
if (fileName().isEmpty())
|
if (fileName().isEmpty())
|
||||||
setFileName(wiz->stringValue(QLatin1String("InitialFileName")));
|
setFileName(wiz->stringValue(QLatin1String("InitialFileName")));
|
||||||
if (path().isEmpty())
|
if (filePath().isEmpty())
|
||||||
setPath(wiz->stringValue(QLatin1String("InitialPath")));
|
setPath(wiz->stringValue(QLatin1String("InitialPath")));
|
||||||
setDefaultSuffix(wiz->stringValue("DefaultSuffix"));
|
setDefaultSuffix(wiz->stringValue("DefaultSuffix"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JsonFilePage::validatePage()
|
bool JsonFilePage::validatePage()
|
||||||
{
|
{
|
||||||
if (path().isEmpty() || fileName().isEmpty())
|
if (filePath().isEmpty() || fileName().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const FilePath dir = FilePath::fromString(path());
|
const FilePath dir = filePath();
|
||||||
if (!dir.isDir())
|
if (!dir.isDir())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/displayname.h>
|
#include <utils/displayname.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/filepath.h>
|
||||||
#include <utils/icon.h>
|
#include <utils/icon.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/optional.h>
|
#include <utils/optional.h>
|
||||||
@@ -42,10 +42,7 @@
|
|||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QStyle>
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
|
@@ -1005,6 +1005,9 @@ Tasks DeviceKitAspect::validate(const Kit *k) const
|
|||||||
else if (!dev->isCompatibleWith(k))
|
else if (!dev->isCompatibleWith(k))
|
||||||
result.append(BuildSystemTask(Task::Error, tr("Device is incompatible with this kit.")));
|
result.append(BuildSystemTask(Task::Error, tr("Device is incompatible with this kit.")));
|
||||||
|
|
||||||
|
if (dev)
|
||||||
|
result.append(dev->validate());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -386,6 +386,8 @@ void SessionManager::setStartupProject(Project *startupProject)
|
|||||||
ModeManager::activateMode(Constants::MODE_SESSION);
|
ModeManager::activateMode(Constants::MODE_SESSION);
|
||||||
ModeManager::setFocusToCurrentMode();
|
ModeManager::setFocusToCurrentMode();
|
||||||
}
|
}
|
||||||
|
FolderNavigationWidgetFactory::setFallbackSyncFilePath(
|
||||||
|
startupProject ? startupProject->projectFilePath().parentDir() : FilePath());
|
||||||
emit m_instance->startupProjectChanged(startupProject);
|
emit m_instance->startupProjectChanged(startupProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -148,8 +148,8 @@ public:
|
|||||||
addPage(m_secondPage);
|
addPage(m_secondPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString path() const { return m_firstPage->path(); }
|
Utils::FilePath projectDir() const { return m_firstPage->filePath(); }
|
||||||
void setPath(const QString &path) { m_firstPage->setPath(path); }
|
void setProjectDir(const Utils::FilePath &path) { m_firstPage->setFilePath(path); }
|
||||||
FilePaths selectedFiles() const { return m_secondPage->selectedFiles(); }
|
FilePaths selectedFiles() const { return m_secondPage->selectedFiles(); }
|
||||||
FilePaths selectedPaths() const { return m_secondPage->selectedPaths(); }
|
FilePaths selectedPaths() const { return m_secondPage->selectedPaths(); }
|
||||||
QString qtModules() const { return m_secondPage->qtModules(); }
|
QString qtModules() const { return m_secondPage->qtModules(); }
|
||||||
@@ -162,8 +162,7 @@ public:
|
|||||||
|
|
||||||
void FilesSelectionWizardPage::initializePage()
|
void FilesSelectionWizardPage::initializePage()
|
||||||
{
|
{
|
||||||
m_filesWidget->resetModel(FilePath::fromString(m_simpleProjectWizardDialog->path()),
|
m_filesWidget->resetModel(m_simpleProjectWizardDialog->projectDir(), FilePaths());
|
||||||
FilePaths());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleProjectWizard::SimpleProjectWizard()
|
SimpleProjectWizard::SimpleProjectWizard()
|
||||||
@@ -187,7 +186,7 @@ BaseFileWizard *SimpleProjectWizard::create(QWidget *parent,
|
|||||||
const WizardDialogParameters ¶meters) const
|
const WizardDialogParameters ¶meters) const
|
||||||
{
|
{
|
||||||
auto wizard = new SimpleProjectWizardDialog(this, parent);
|
auto wizard = new SimpleProjectWizardDialog(this, parent);
|
||||||
wizard->setPath(parameters.defaultPath());
|
wizard->setProjectDir(parameters.defaultPath());
|
||||||
|
|
||||||
for (QWizardPage *p : wizard->extensionPages())
|
for (QWizardPage *p : wizard->extensionPages())
|
||||||
wizard->addPage(p);
|
wizard->addPage(p);
|
||||||
@@ -199,7 +198,7 @@ GeneratedFiles generateQmakeFiles(const SimpleProjectWizardDialog *wizard,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
const QString projectPath = wizard->path();
|
const QString projectPath = wizard->projectDir().toString();
|
||||||
const QDir dir(projectPath);
|
const QDir dir(projectPath);
|
||||||
const QString projectName = wizard->projectName();
|
const QString projectName = wizard->projectName();
|
||||||
const FilePath proFileName = Utils::FilePath::fromString(QFileInfo(dir, projectName + ".pro").absoluteFilePath());
|
const FilePath proFileName = Utils::FilePath::fromString(QFileInfo(dir, projectName + ".pro").absoluteFilePath());
|
||||||
@@ -257,8 +256,7 @@ GeneratedFiles generateCmakeFiles(const SimpleProjectWizardDialog *wizard,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
const QString projectPath = wizard->path();
|
const QDir dir(wizard->projectDir().toString());
|
||||||
const QDir dir(projectPath);
|
|
||||||
const QString projectName = wizard->projectName();
|
const QString projectName = wizard->projectName();
|
||||||
const FilePath projectFileName = Utils::FilePath::fromString(QFileInfo(dir, "CMakeLists.txt").absoluteFilePath());
|
const FilePath projectFileName = Utils::FilePath::fromString(QFileInfo(dir, "CMakeLists.txt").absoluteFilePath());
|
||||||
const QStringList paths = Utils::transform(wizard->selectedPaths(), &FilePath::toString);
|
const QStringList paths = Utils::transform(wizard->selectedPaths(), &FilePath::toString);
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
@@ -155,6 +156,7 @@ void TaskHub::addTask(Task task)
|
|||||||
QTC_ASSERT(!task.description().isEmpty(), return);
|
QTC_ASSERT(!task.description().isEmpty(), return);
|
||||||
QTC_ASSERT(!task.isNull(), return);
|
QTC_ASSERT(!task.isNull(), return);
|
||||||
QTC_ASSERT(task.m_mark.isNull(), return);
|
QTC_ASSERT(task.m_mark.isNull(), return);
|
||||||
|
QTC_ASSERT(QThread::currentThread() == qApp->thread(), return);
|
||||||
|
|
||||||
if (task.file.isEmpty() || task.line <= 0)
|
if (task.file.isEmpty() || task.line <= 0)
|
||||||
task.line = -1;
|
task.line = -1;
|
||||||
|
@@ -32,19 +32,17 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// ----------- QtProjectParameters
|
// ----------- QtProjectParameters
|
||||||
QtProjectParameters::QtProjectParameters() = default;
|
QtProjectParameters::QtProjectParameters() = default;
|
||||||
|
|
||||||
QString QtProjectParameters::projectPath() const
|
FilePath QtProjectParameters::projectPath() const
|
||||||
{
|
{
|
||||||
QString rc = path;
|
return path / fileName;
|
||||||
if (!rc.isEmpty())
|
|
||||||
rc += QLatin1Char('/');
|
|
||||||
rc += fileName;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out a QT module line.
|
// Write out a QT module line.
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -41,14 +43,15 @@ QString createMacro(const QString &name, const QString &suffix);
|
|||||||
// Base parameters for application project generation with functionality to
|
// Base parameters for application project generation with functionality to
|
||||||
// write a .pro-file section.
|
// write a .pro-file section.
|
||||||
|
|
||||||
struct QtProjectParameters {
|
struct QtProjectParameters
|
||||||
|
{
|
||||||
enum Type { ConsoleApp, GuiApp, StaticLibrary, SharedLibrary, QtPlugin, EmptyProject };
|
enum Type { ConsoleApp, GuiApp, StaticLibrary, SharedLibrary, QtPlugin, EmptyProject };
|
||||||
enum QtVersionSupport { SupportQt4And5, SupportQt4Only, SupportQt5Only };
|
enum QtVersionSupport { SupportQt4And5, SupportQt4Only, SupportQt5Only };
|
||||||
enum Flags { WidgetsRequiredFlag = 0x1 };
|
enum Flags { WidgetsRequiredFlag = 0x1 };
|
||||||
|
|
||||||
QtProjectParameters();
|
QtProjectParameters();
|
||||||
// Return project path as "path/name"
|
// Return project path as "path/name"
|
||||||
QString projectPath() const;
|
Utils::FilePath projectPath() const;
|
||||||
void writeProFile(QTextStream &) const;
|
void writeProFile(QTextStream &) const;
|
||||||
static void writeProFileHeader(QTextStream &);
|
static void writeProFileHeader(QTextStream &);
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ struct QtProjectParameters {
|
|||||||
QtVersionSupport qtVersionSupport = SupportQt4And5;
|
QtVersionSupport qtVersionSupport = SupportQt4And5;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QString target;
|
QString target;
|
||||||
QString path;
|
Utils::FilePath path;
|
||||||
QStringList selectedModules;
|
QStringList selectedModules;
|
||||||
QStringList deselectedModules;
|
QStringList deselectedModules;
|
||||||
QString targetDirectory;
|
QString targetDirectory;
|
||||||
|
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -70,8 +72,8 @@ Core::GeneratedFiles SubdirsProjectWizard::generateFiles(const QWizard *w,
|
|||||||
{
|
{
|
||||||
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
||||||
const QtProjectParameters params = wizard->parameters();
|
const QtProjectParameters params = wizard->parameters();
|
||||||
const QString projectPath = params.projectPath();
|
const FilePath projectPath = params.projectPath();
|
||||||
const QString profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
const FilePath profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
||||||
|
|
||||||
Core::GeneratedFile profile(profileName);
|
Core::GeneratedFile profile(profileName);
|
||||||
profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute | Core::GeneratedFile::OpenEditorAttribute);
|
profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute | Core::GeneratedFile::OpenEditorAttribute);
|
||||||
@@ -85,10 +87,10 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
|
|||||||
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
||||||
if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
|
if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
|
||||||
const QtProjectParameters params = wizard->parameters();
|
const QtProjectParameters params = wizard->parameters();
|
||||||
const QString projectPath = params.projectPath();
|
const FilePath projectPath = params.projectPath();
|
||||||
const QString profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
const FilePath profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map.insert(QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE), profileName);
|
map.insert(QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE), profileName.toVariant());
|
||||||
map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS),
|
map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS),
|
||||||
Utils::transform<QStringList>(wizard->selectedKits(), &Utils::Id::toString));
|
Utils::transform<QStringList>(wizard->selectedKits(), &Utils::Id::toString));
|
||||||
IWizardFactory::requestNewItemDialog(tr("New Subproject", "Title of dialog"),
|
IWizardFactory::requestNewItemDialog(tr("New Subproject", "Title of dialog"),
|
||||||
@@ -96,7 +98,7 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
|
|||||||
[](Core::IWizardFactory *f) {
|
[](Core::IWizardFactory *f) {
|
||||||
return f->supportedProjectTypes().contains(Constants::QMAKEPROJECT_ID);
|
return f->supportedProjectTypes().contains(Constants::QMAKEPROJECT_ID);
|
||||||
}),
|
}),
|
||||||
Utils::FilePath::fromString(wizard->parameters().projectPath()),
|
wizard->parameters().projectPath(),
|
||||||
map);
|
map);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -55,7 +55,7 @@ QtProjectParameters SubdirsProjectWizardDialog::parameters() const
|
|||||||
QtProjectParameters rc;
|
QtProjectParameters rc;
|
||||||
rc.type = QtProjectParameters::EmptyProject;
|
rc.type = QtProjectParameters::EmptyProject;
|
||||||
rc.fileName = projectName();
|
rc.fileName = projectName();
|
||||||
rc.path = filePath().toString();
|
rc.path = filePath();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -595,9 +595,9 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type,
|
|||||||
|
|
||||||
for (const QmlJS::SimpleReaderNode::Ptr &node : nodes) {
|
for (const QmlJS::SimpleReaderNode::Ptr &node : nodes) {
|
||||||
if (node->propertyNames().contains("separateSection"))
|
if (node->propertyNames().contains("separateSection"))
|
||||||
separateSectionTypes.append(variantToStringList(node->property("typeNames")));
|
separateSectionTypes.append(variantToStringList(node->property("typeNames").value));
|
||||||
|
|
||||||
allTypes.append(variantToStringList(node->property("typeNames")));
|
allTypes.append(variantToStringList(node->property("typeNames").value));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<PropertyName> allProperties = type.propertyNames();
|
const QList<PropertyName> allProperties = type.propertyNames();
|
||||||
@@ -666,8 +666,8 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type,
|
|||||||
QString filledTemplate;
|
QString filledTemplate;
|
||||||
for (const QmlJS::SimpleReaderNode::Ptr &n : nodes) {
|
for (const QmlJS::SimpleReaderNode::Ptr &n : nodes) {
|
||||||
// Check if we have a template for the type
|
// Check if we have a template for the type
|
||||||
if (variantToStringList(n->property(QStringLiteral("typeNames"))).contains(QString::fromLatin1(typeName))) {
|
if (variantToStringList(n->property(QStringLiteral("typeNames")).value).contains(QString::fromLatin1(typeName))) {
|
||||||
const QString fileName = propertyTemplatesPath() + n->property(QStringLiteral("sourceFile")).toString();
|
const QString fileName = propertyTemplatesPath() + n->property(QStringLiteral("sourceFile")).value.toString();
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
QString source = QString::fromUtf8(file.readAll());
|
QString source = QString::fromUtf8(file.readAll());
|
||||||
@@ -682,7 +682,7 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type,
|
|||||||
};
|
};
|
||||||
|
|
||||||
// QML specfics preparation
|
// QML specfics preparation
|
||||||
QStringList imports = variantToStringList(templateConfiguration()->property(QStringLiteral("imports")));
|
QStringList imports = variantToStringList(templateConfiguration()->property(QStringLiteral("imports")).value);
|
||||||
QString qmlTemplate = imports.join(QLatin1Char('\n')) + QLatin1Char('\n');
|
QString qmlTemplate = imports.join(QLatin1Char('\n')) + QLatin1Char('\n');
|
||||||
bool emptyTemplate = true;
|
bool emptyTemplate = true;
|
||||||
|
|
||||||
|
@@ -54,9 +54,12 @@ public:
|
|||||||
void setQualifcation(const TypeName &qualification);
|
void setQualifcation(const TypeName &qualification);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void elementStart(const QString &name) override;
|
void elementStart(const QString &name, const QmlJS::SourceLocation &nameLocation) override;
|
||||||
void elementEnd() override;
|
void elementEnd() override;
|
||||||
void propertyDefinition(const QString &name, const QVariant &value) override;
|
void propertyDefinition(const QString &name,
|
||||||
|
const QmlJS::SourceLocation &nameLocation,
|
||||||
|
const QVariant &value,
|
||||||
|
const QmlJS::SourceLocation &valueLocation) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum ParserSate { Error,
|
enum ParserSate { Error,
|
||||||
|
@@ -87,7 +87,7 @@ void MetaInfoReader::setQualifcation(const TypeName &qualification)
|
|||||||
m_qualication = qualification;
|
m_qualication = qualification;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaInfoReader::elementStart(const QString &name)
|
void MetaInfoReader::elementStart(const QString &name, const QmlJS::SourceLocation &nameLocation)
|
||||||
{
|
{
|
||||||
switch (parserState()) {
|
switch (parserState()) {
|
||||||
case ParsingDocument: setParserState(readDocument(name)); break;
|
case ParsingDocument: setParserState(readDocument(name)); break;
|
||||||
@@ -128,7 +128,10 @@ void MetaInfoReader::elementEnd()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaInfoReader::propertyDefinition(const QString &name, const QVariant &value)
|
void MetaInfoReader::propertyDefinition(const QString &name,
|
||||||
|
const QmlJS::SourceLocation &nameLocation,
|
||||||
|
const QVariant &value,
|
||||||
|
const QmlJS::SourceLocation &valueLocation)
|
||||||
{
|
{
|
||||||
switch (parserState()) {
|
switch (parserState()) {
|
||||||
case ParsingType: readTypeProperty(name, value); break;
|
case ParsingType: readTypeProperty(name, value); break;
|
||||||
|
@@ -1161,7 +1161,7 @@ void checkNode(const QmlJS::SimpleReaderNode::Ptr &node, RewriterView *view)
|
|||||||
if (!node->propertyNames().contains("i"))
|
if (!node->propertyNames().contains("i"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int index = node->property("i").toInt();
|
const int index = node->property("i").value.toInt();
|
||||||
|
|
||||||
const ModelNode modelNode = view->getNodeForCanonicalIndex(index);
|
const ModelNode modelNode = view->getNodeForCanonicalIndex(index);
|
||||||
|
|
||||||
@@ -1174,7 +1174,7 @@ void checkNode(const QmlJS::SimpleReaderNode::Ptr &node, RewriterView *view)
|
|||||||
if (i.key() != "i") {
|
if (i.key() != "i") {
|
||||||
const PropertyName name = fixUpIllegalChars(i.key()).toUtf8();
|
const PropertyName name = fixUpIllegalChars(i.key()).toUtf8();
|
||||||
if (!modelNode.hasAuxiliaryData(name))
|
if (!modelNode.hasAuxiliaryData(name))
|
||||||
modelNode.setAuxiliaryData(name, i.value());
|
modelNode.setAuxiliaryData(name, i.value().value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,20 +37,20 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
static QString readProperty(const QString property, const QmlJS::SimpleReaderNode::Ptr &node)
|
static QString readProperty(const QString property, const QmlJS::SimpleReaderNode::Ptr &node)
|
||||||
{
|
{
|
||||||
const QVariant propertyVar = node->property(property);
|
const auto propertyVar = node->property(property);
|
||||||
|
|
||||||
if (!propertyVar.isNull() && propertyVar.isValid())
|
if (propertyVar.isValid())
|
||||||
return propertyVar.value<QString>();
|
return propertyVar.value.value<QString>();
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList readPropertyList(const QString &property, const QmlJS::SimpleReaderNode::Ptr &node)
|
static QStringList readPropertyList(const QString &property, const QmlJS::SimpleReaderNode::Ptr &node)
|
||||||
{
|
{
|
||||||
const QVariant propertyVar = node->property(property);
|
const auto propertyVar = node->property(property);
|
||||||
|
|
||||||
if (!propertyVar.isNull() && propertyVar.isValid())
|
if (propertyVar.isValid())
|
||||||
return propertyVar.value<QStringList>();
|
return propertyVar.value.value<QStringList>();
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -99,30 +99,31 @@ void DesignerMcuManager::readMetadata()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVariant defaultVersion = metadata->property("defaultVersion");
|
const QmlJS::SimpleReaderNode::Property defaultVersion = metadata->property("defaultVersion");
|
||||||
if (!defaultVersion.isNull() && defaultVersion.isValid()) {
|
|
||||||
|
if (defaultVersion.isValid()) {
|
||||||
for (const auto& version : versions) {
|
for (const auto& version : versions) {
|
||||||
Version newVersion;
|
Version newVersion;
|
||||||
|
|
||||||
const QVariant vId = version->property("id");
|
const auto vId = version->property("id");
|
||||||
if (vId.isNull() || !vId.isValid())
|
if (!vId.isValid())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const QVariant vName = version->property("name");
|
const auto vName = version->property("name");
|
||||||
if (!vName.isNull() && vName.isValid())
|
if (vName.isValid())
|
||||||
newVersion.name = vName.value<QString>();
|
newVersion.name = vName.value.value<QString>();
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const QVariant vPath = version->property("path");
|
const auto vPath = version->property("path");
|
||||||
if (!vPath.isNull() && vPath.isValid())
|
if (vPath.isValid())
|
||||||
newVersion.fileName = vPath.value<QString>();
|
newVersion.fileName = vPath.value.value<QString>();
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_versionsList.push_back(newVersion);
|
m_versionsList.push_back(newVersion);
|
||||||
|
|
||||||
if (vId == defaultVersion)
|
if (vId.value == defaultVersion.value)
|
||||||
m_defaultVersion = newVersion;
|
m_defaultVersion = newVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,10 +173,10 @@ void DesignerMcuManager::readVersionData(const DesignerMcuManager::Version &vers
|
|||||||
if (child->propertyNames().contains("allowedProperties")) {
|
if (child->propertyNames().contains("allowedProperties")) {
|
||||||
ItemProperties allowedProperties;
|
ItemProperties allowedProperties;
|
||||||
|
|
||||||
const QVariant childrenPropertyVar = child->property("allowChildren");
|
const auto childrenPropertyVar = child->property("allowChildren");
|
||||||
|
|
||||||
if (!childrenPropertyVar.isNull() && childrenPropertyVar.isValid())
|
if (childrenPropertyVar.isValid())
|
||||||
allowedProperties.allowChildren = childrenPropertyVar.toBool();
|
allowedProperties.allowChildren = childrenPropertyVar.value.toBool();
|
||||||
|
|
||||||
allowedProperties.properties = readPropertyList("allowedProperties", child);
|
allowedProperties.properties = readPropertyList("allowedProperties", child);
|
||||||
|
|
||||||
|
@@ -39,24 +39,30 @@ namespace {
|
|||||||
|
|
||||||
QmlProjectManager::FileFilterBaseItem *setupFileFilterItem(QmlProjectManager::FileFilterBaseItem *fileFilterItem, const QmlJS::SimpleReaderNode::Ptr &node)
|
QmlProjectManager::FileFilterBaseItem *setupFileFilterItem(QmlProjectManager::FileFilterBaseItem *fileFilterItem, const QmlJS::SimpleReaderNode::Ptr &node)
|
||||||
{
|
{
|
||||||
const QVariant directoryProperty = node->property(QLatin1String("directory"));
|
const auto directoryProperty = node->property(QLatin1String("directory"));
|
||||||
if (directoryProperty.isValid())
|
if (directoryProperty.isValid())
|
||||||
fileFilterItem->setDirectory(directoryProperty.toString());
|
fileFilterItem->setDirectory(directoryProperty.value.toString());
|
||||||
|
|
||||||
const QVariant recursiveProperty = node->property(QLatin1String("recursive"));
|
const auto recursiveProperty = node->property(QLatin1String("recursive"));
|
||||||
if (recursiveProperty.isValid())
|
if (recursiveProperty.isValid())
|
||||||
fileFilterItem->setRecursive(recursiveProperty.toBool());
|
fileFilterItem->setRecursive(recursiveProperty.value.toBool());
|
||||||
|
|
||||||
const QVariant pathsProperty = node->property(QLatin1String("paths"));
|
const auto pathsProperty = node->property(QLatin1String("paths"));
|
||||||
if (pathsProperty.isValid())
|
if (pathsProperty.isValid())
|
||||||
fileFilterItem->setPathsProperty(pathsProperty.toStringList());
|
fileFilterItem->setPathsProperty(pathsProperty.value.toStringList());
|
||||||
|
|
||||||
const QVariant filterProperty = node->property(QLatin1String("filter"));
|
// "paths" and "files" have the same functionality
|
||||||
|
const auto filesProperty = node->property(QLatin1String("files"));
|
||||||
|
if (filesProperty.isValid())
|
||||||
|
fileFilterItem->setPathsProperty(filesProperty.value.toStringList());
|
||||||
|
|
||||||
|
const auto filterProperty = node->property(QLatin1String("filter"));
|
||||||
if (filterProperty.isValid())
|
if (filterProperty.isValid())
|
||||||
fileFilterItem->setFilter(filterProperty.toString());
|
fileFilterItem->setFilter(filterProperty.value.toString());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "directory:" << directoryProperty << "recursive" << recursiveProperty << "paths" << pathsProperty;
|
qDebug() << "directory:" << directoryProperty.value << "recursive" << recursiveProperty.value
|
||||||
|
<< "paths" << pathsProperty.value << "files" << filesProperty.value;
|
||||||
return fileFilterItem;
|
return fileFilterItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,36 +87,36 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FilePath &fi
|
|||||||
if (rootNode->name() == QLatin1String("Project")) {
|
if (rootNode->name() == QLatin1String("Project")) {
|
||||||
auto projectItem = new QmlProjectItem;
|
auto projectItem = new QmlProjectItem;
|
||||||
|
|
||||||
const QVariant mainFileProperty = rootNode->property(QLatin1String("mainFile"));
|
const auto mainFileProperty = rootNode->property(QLatin1String("mainFile"));
|
||||||
if (mainFileProperty.isValid())
|
if (mainFileProperty.isValid())
|
||||||
projectItem->setMainFile(mainFileProperty.toString());
|
projectItem->setMainFile(mainFileProperty.value.toString());
|
||||||
|
|
||||||
const QVariant importPathsProperty = rootNode->property(QLatin1String("importPaths"));
|
const auto importPathsProperty = rootNode->property(QLatin1String("importPaths"));
|
||||||
if (importPathsProperty.isValid())
|
if (importPathsProperty.isValid())
|
||||||
projectItem->setImportPaths(importPathsProperty.toStringList());
|
projectItem->setImportPaths(importPathsProperty.value.toStringList());
|
||||||
|
|
||||||
const QVariant fileSelectorsProperty = rootNode->property(QLatin1String("fileSelectors"));
|
const auto fileSelectorsProperty = rootNode->property(QLatin1String("fileSelectors"));
|
||||||
if (fileSelectorsProperty.isValid())
|
if (fileSelectorsProperty.isValid())
|
||||||
projectItem->setFileSelectors(fileSelectorsProperty.toStringList());
|
projectItem->setFileSelectors(fileSelectorsProperty.value.toStringList());
|
||||||
|
|
||||||
const QVariant forceFreeTypeProperty = rootNode->property("forceFreeType");
|
const auto forceFreeTypeProperty = rootNode->property("forceFreeType");
|
||||||
if (forceFreeTypeProperty.isValid())
|
if (forceFreeTypeProperty.isValid())
|
||||||
projectItem->setForceFreeType(forceFreeTypeProperty.toBool());
|
projectItem->setForceFreeType(forceFreeTypeProperty.value.toBool());
|
||||||
|
|
||||||
const QVariant targetDirectoryPropery = rootNode->property("targetDirectory");
|
const auto targetDirectoryPropery = rootNode->property("targetDirectory");
|
||||||
if (targetDirectoryPropery.isValid())
|
if (targetDirectoryPropery.isValid())
|
||||||
projectItem->setTargetDirectory(targetDirectoryPropery.toString());
|
projectItem->setTargetDirectory(targetDirectoryPropery.value.toString());
|
||||||
|
|
||||||
const QVariant qtForMCUProperty = rootNode->property("qtForMCUs");
|
const auto qtForMCUProperty = rootNode->property("qtForMCUs");
|
||||||
if (qtForMCUProperty.isValid() && qtForMCUProperty.toBool())
|
if (qtForMCUProperty.isValid() && qtForMCUProperty.value.toBool())
|
||||||
projectItem->setQtForMCUs(qtForMCUProperty.toBool());
|
projectItem->setQtForMCUs(qtForMCUProperty.value.toBool());
|
||||||
|
|
||||||
const QVariant qt6ProjectProperty = rootNode->property("qt6Project");
|
const auto qt6ProjectProperty = rootNode->property("qt6Project");
|
||||||
if (qt6ProjectProperty.isValid() && qt6ProjectProperty.toBool())
|
if (qt6ProjectProperty.isValid() && qt6ProjectProperty.value.toBool())
|
||||||
projectItem->setQt6Project(qt6ProjectProperty.toBool());
|
projectItem->setQt6Project(qt6ProjectProperty.value.toBool());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "importPath:" << importPathsProperty << "mainFile:" << mainFileProperty;
|
qDebug() << "importPath:" << importPathsProperty.value << "mainFile:" << mainFileProperty.value;
|
||||||
|
|
||||||
foreach (const QmlJS::SimpleReaderNode::Ptr &childNode, rootNode->children()) {
|
foreach (const QmlJS::SimpleReaderNode::Ptr &childNode, rootNode->children()) {
|
||||||
if (debug)
|
if (debug)
|
||||||
@@ -132,7 +138,7 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FilePath &fi
|
|||||||
const auto properties = childNode->properties();
|
const auto properties = childNode->properties();
|
||||||
auto i = properties.constBegin();
|
auto i = properties.constBegin();
|
||||||
while (i != properties.constEnd()) {
|
while (i != properties.constEnd()) {
|
||||||
projectItem->addToEnviroment(i.key(), i.value().toString());
|
projectItem->addToEnviroment(i.key(), i.value().value.toString());
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -58,15 +58,22 @@ ProMessageHandler::~ProMessageHandler()
|
|||||||
Core::MessageManager::writeFlashing(m_messages);
|
Core::MessageManager::writeFlashing(m_messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addTask(Task::TaskType type,
|
||||||
|
const QString &description,
|
||||||
|
const Utils::FilePath &file = {},
|
||||||
|
int line = -1)
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(TaskHub::instance(), [=]() {
|
||||||
|
TaskHub::addTask(BuildSystemTask(type, description, file, line));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void ProMessageHandler::message(int type, const QString &msg, const QString &fileName, int lineNo)
|
void ProMessageHandler::message(int type, const QString &msg, const QString &fileName, int lineNo)
|
||||||
{
|
{
|
||||||
if ((type & CategoryMask) == ErrorMessage && ((type & SourceMask) == SourceParser || m_verbose)) {
|
if ((type & CategoryMask) == ErrorMessage && ((type & SourceMask) == SourceParser || m_verbose)) {
|
||||||
// parse error in qmake files
|
// parse error in qmake files
|
||||||
if (m_exact) {
|
if (m_exact) {
|
||||||
TaskHub::addTask(
|
addTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo);
|
||||||
BuildSystemTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo));
|
|
||||||
} else {
|
} else {
|
||||||
appendMessage(format(fileName, lineNo, msg));
|
appendMessage(format(fileName, lineNo, msg));
|
||||||
}
|
}
|
||||||
@@ -79,9 +86,9 @@ void ProMessageHandler::fileMessage(int type, const QString &msg)
|
|||||||
if (!m_verbose)
|
if (!m_verbose)
|
||||||
return;
|
return;
|
||||||
if (m_exact && type == QMakeHandler::ErrorMessage)
|
if (m_exact && type == QMakeHandler::ErrorMessage)
|
||||||
TaskHub::addTask(BuildSystemTask(Task::Error, msg));
|
addTask(Task::Error, msg);
|
||||||
else if (m_exact && type == QMakeHandler::WarningMessage)
|
else if (m_exact && type == QMakeHandler::WarningMessage)
|
||||||
TaskHub::addTask(BuildSystemTask(Task::Warning, msg));
|
addTask(Task::Warning, msg);
|
||||||
else
|
else
|
||||||
appendMessage(msg);
|
appendMessage(msg);
|
||||||
}
|
}
|
||||||
|
@@ -8546,14 +8546,14 @@ static void checkNode(QmlJS::SimpleReaderNode::Ptr node, TestRewriterView *view)
|
|||||||
{
|
{
|
||||||
QVERIFY(node);
|
QVERIFY(node);
|
||||||
QVERIFY(node->propertyNames().contains("i"));
|
QVERIFY(node->propertyNames().contains("i"));
|
||||||
const int internalId = node->property("i").toInt();
|
const int internalId = node->property("i").value.toInt();
|
||||||
const ModelNode modelNode = view->modelNodeForInternalId(internalId);
|
const ModelNode modelNode = view->modelNodeForInternalId(internalId);
|
||||||
QVERIFY(modelNode.isValid());
|
QVERIFY(modelNode.isValid());
|
||||||
auto properties = node->properties();
|
auto properties = node->properties();
|
||||||
|
|
||||||
for (auto i = properties.begin(); i != properties.end(); ++i) {
|
for (auto i = properties.begin(); i != properties.end(); ++i) {
|
||||||
if (i.key() != "i")
|
if (i.key() != "i")
|
||||||
QCOMPARE(i.value(), modelNode.auxiliaryData(i.key().toUtf8()));
|
QCOMPARE(i.value().value, modelNode.auxiliaryData(i.key().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
checkChildNodes(node, view);
|
checkChildNodes(node, view);
|
||||||
|
@@ -77,13 +77,13 @@ void tst_SimpleReader::testWellFormed()
|
|||||||
QCOMPARE(rootNode->properties().count(), 1);
|
QCOMPARE(rootNode->properties().count(), 1);
|
||||||
|
|
||||||
QVERIFY(rootNode->properties().contains("propertyBlah"));
|
QVERIFY(rootNode->properties().contains("propertyBlah"));
|
||||||
QCOMPARE(rootNode->property("property01").toBool(), false);
|
QCOMPARE(rootNode->property("property01").value.toBool(), false);
|
||||||
|
|
||||||
QVERIFY(rootNode->children().first()->isValid());
|
QVERIFY(rootNode->children().first()->isValid());
|
||||||
QVERIFY(!rootNode->children().first()->isRoot());
|
QVERIFY(!rootNode->children().first()->isRoot());
|
||||||
|
|
||||||
QVERIFY(rootNode->children().first()->properties().contains("property01"));
|
QVERIFY(rootNode->children().first()->properties().contains("property01"));
|
||||||
QCOMPARE(rootNode->children().first()->property("property01").toInt(), 10);
|
QCOMPARE(rootNode->children().first()->property("property01").value.toInt(), 10);
|
||||||
|
|
||||||
SimpleReaderNode::Ptr secondChild = rootNode->children().at(1);
|
SimpleReaderNode::Ptr secondChild = rootNode->children().at(1);
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ void tst_SimpleReader::testWellFormed()
|
|||||||
QCOMPARE(secondChild->name(), QLatin1String("ChildNode"));
|
QCOMPARE(secondChild->name(), QLatin1String("ChildNode"));
|
||||||
|
|
||||||
QVERIFY(secondChild->properties().contains("propertyString"));
|
QVERIFY(secondChild->properties().contains("propertyString"));
|
||||||
QCOMPARE(secondChild->property("propertyString").toString(), QLatin1String("str"));
|
QCOMPARE(secondChild->property("propertyString").value.toString(), QLatin1String("str"));
|
||||||
|
|
||||||
QCOMPARE(secondChild->children().count(), 1);
|
QCOMPARE(secondChild->children().count(), 1);
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ void tst_SimpleReader::testWellFormed()
|
|||||||
QCOMPARE(innerChild->name(), QLatin1String("InnerChild"));
|
QCOMPARE(innerChild->name(), QLatin1String("InnerChild"));
|
||||||
|
|
||||||
QVERIFY(innerChild->properties().contains("test"));
|
QVERIFY(innerChild->properties().contains("test"));
|
||||||
QCOMPARE(innerChild->property("test").toString(), QLatin1String("test"));
|
QCOMPARE(innerChild->property("test").value.toString(), QLatin1String("test"));
|
||||||
|
|
||||||
weak01 = rootNode;
|
weak01 = rootNode;
|
||||||
weak02 = secondChild;
|
weak02 = secondChild;
|
||||||
@@ -170,7 +170,7 @@ void tst_SimpleReader::testIllFormed02()
|
|||||||
|
|
||||||
QCOMPARE(firstChild->properties().count(), 1);
|
QCOMPARE(firstChild->properties().count(), 1);
|
||||||
QVERIFY(firstChild->properties().contains("property01"));
|
QVERIFY(firstChild->properties().contains("property01"));
|
||||||
QCOMPARE(firstChild->property("property01").toString(), QLatin1String("20"));
|
QCOMPARE(firstChild->property("property01").value.toString(), QLatin1String("20"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_SimpleReader::testArrays()
|
void tst_SimpleReader::testArrays()
|
||||||
@@ -194,7 +194,7 @@ void tst_SimpleReader::testArrays()
|
|||||||
QVERIFY(rootNode->isValid());
|
QVERIFY(rootNode->isValid());
|
||||||
QVERIFY(rootNode->isRoot());
|
QVERIFY(rootNode->isRoot());
|
||||||
|
|
||||||
QCOMPARE(rootNode->property("propertyArray"), variant);
|
QCOMPARE(rootNode->property("propertyArray").value, variant);
|
||||||
|
|
||||||
|
|
||||||
SimpleReaderNode::Ptr firstChild = rootNode->children().at(0);
|
SimpleReaderNode::Ptr firstChild = rootNode->children().at(0);
|
||||||
@@ -202,13 +202,13 @@ void tst_SimpleReader::testArrays()
|
|||||||
QVERIFY(firstChild);
|
QVERIFY(firstChild);
|
||||||
QVERIFY(firstChild->isValid());
|
QVERIFY(firstChild->isValid());
|
||||||
QVERIFY(!firstChild->isRoot());
|
QVERIFY(!firstChild->isRoot());
|
||||||
QCOMPARE(firstChild->property("propertyArray"), variant);
|
QCOMPARE(firstChild->property("propertyArray").value, variant);
|
||||||
|
|
||||||
QList<QVariant> variantList2;
|
QList<QVariant> variantList2;
|
||||||
variantList2 << QVariant(QLatin1String("string03")) << variant;
|
variantList2 << QVariant(QLatin1String("string03")) << variant;
|
||||||
const QVariant variant2 = variantList2;
|
const QVariant variant2 = variantList2;
|
||||||
|
|
||||||
QCOMPARE(firstChild->property("propertyArrayMixed"), variant2);
|
QCOMPARE(firstChild->property("propertyArrayMixed").value, variant2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_SimpleReader::testBug01()
|
void tst_SimpleReader::testBug01()
|
||||||
|