forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/5.0'
Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/plugins/android/createandroidmanifestwizard.cpp Change-Id: Ibd06a254f52c2c96d8c6ddd6b1d27483fcc29a17
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
<file>mockfiles/meshes/axishelper.mesh</file>
|
<file>mockfiles/meshes/axishelper.mesh</file>
|
||||||
<file>mockfiles/images/editor_camera.png</file>
|
<file>mockfiles/images/editor_camera.png</file>
|
||||||
<file>mockfiles/images/editor_camera@2x.png</file>
|
<file>mockfiles/images/editor_camera@2x.png</file>
|
||||||
|
<file>mockfiles/images/editor_particlesystem.png</file>
|
||||||
|
<file>mockfiles/images/editor_particlesystem@2x.png</file>
|
||||||
<file>mockfiles/images/area.png</file>
|
<file>mockfiles/images/area.png</file>
|
||||||
<file>mockfiles/images/area@2x.png</file>
|
<file>mockfiles/images/area@2x.png</file>
|
||||||
<file>mockfiles/images/directional.png</file>
|
<file>mockfiles/images/directional.png</file>
|
||||||
@@ -33,6 +35,7 @@
|
|||||||
<file>mockfiles/qt6/LightGizmo.qml</file>
|
<file>mockfiles/qt6/LightGizmo.qml</file>
|
||||||
<file>mockfiles/qt6/LightIconGizmo.qml</file>
|
<file>mockfiles/qt6/LightIconGizmo.qml</file>
|
||||||
<file>mockfiles/qt6/LightModel.qml</file>
|
<file>mockfiles/qt6/LightModel.qml</file>
|
||||||
|
<file>mockfiles/qt6/ParticleSystemGizmo.qml</file>
|
||||||
<file>mockfiles/qt6/Line3D.qml</file>
|
<file>mockfiles/qt6/Line3D.qml</file>
|
||||||
<file>mockfiles/qt6/MaterialNodeView.qml</file>
|
<file>mockfiles/qt6/MaterialNodeView.qml</file>
|
||||||
<file>mockfiles/qt6/ModelNode2DImageView.qml</file>
|
<file>mockfiles/qt6/ModelNode2DImageView.qml</file>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -54,6 +54,7 @@ Item {
|
|||||||
|
|
||||||
property var lightIconGizmos: []
|
property var lightIconGizmos: []
|
||||||
property var cameraGizmos: []
|
property var cameraGizmos: []
|
||||||
|
property var particleSystemIconGizmos: []
|
||||||
property var selectionBoxes: []
|
property var selectionBoxes: []
|
||||||
property rect viewPortRect: Qt.rect(0, 0, 1000, 1000)
|
property rect viewPortRect: Qt.rect(0, 0, 1000, 1000)
|
||||||
|
|
||||||
@@ -400,6 +401,45 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addParticleSystemGizmo(scene, obj)
|
||||||
|
{
|
||||||
|
// Insert into first available gizmo if we don't already have gizmo for this object
|
||||||
|
var slotFound = -1;
|
||||||
|
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
|
||||||
|
if (!particleSystemIconGizmos[i].targetNode) {
|
||||||
|
slotFound = i;
|
||||||
|
} else if (particleSystemIconGizmos[i].targetNode === obj) {
|
||||||
|
particleSystemIconGizmos[i].scene = scene;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slotFound !== -1) {
|
||||||
|
particleSystemIconGizmos[slotFound].scene = scene;
|
||||||
|
particleSystemIconGizmos[slotFound].targetNode = obj;
|
||||||
|
particleSystemIconGizmos[slotFound].locked = _generalHelper.isLocked(obj);
|
||||||
|
particleSystemIconGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
|
||||||
|
_generalHelper.registerGizmoTarget(obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No free gizmos available, create a new one
|
||||||
|
var gizmoComponent = Qt.createComponent("ParticleSystemGizmo.qml");
|
||||||
|
if (gizmoComponent.status === Component.Ready) {
|
||||||
|
_generalHelper.registerGizmoTarget(obj);
|
||||||
|
var gizmo = gizmoComponent.createObject(overlayView,
|
||||||
|
{"view3D": overlayView, "targetNode": obj,
|
||||||
|
"selectedNodes": selectedNodes, "scene": scene,
|
||||||
|
"activeScene": activeScene,
|
||||||
|
"locked": _generalHelper.isLocked(obj),
|
||||||
|
"hidden": _generalHelper.isHidden(obj)});
|
||||||
|
particleSystemIconGizmos[particleSystemIconGizmos.length] = gizmo;
|
||||||
|
gizmo.clicked.connect(handleObjectClicked);
|
||||||
|
gizmo.selectedNodes = Qt.binding(function() {return selectedNodes;});
|
||||||
|
gizmo.activeScene = Qt.binding(function() {return activeScene;});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function releaseLightGizmo(obj)
|
function releaseLightGizmo(obj)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < lightIconGizmos.length; ++i) {
|
for (var i = 0; i < lightIconGizmos.length; ++i) {
|
||||||
@@ -424,6 +464,18 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function releaseParticleSystemGizmo(obj)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
|
||||||
|
if (particleSystemIconGizmos[i].targetNode === obj) {
|
||||||
|
particleSystemIconGizmos[i].scene = null;
|
||||||
|
particleSystemIconGizmos[i].targetNode = null;
|
||||||
|
_generalHelper.unregisterGizmoTarget(obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateLightGizmoScene(scene, obj)
|
function updateLightGizmoScene(scene, obj)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < lightIconGizmos.length; ++i) {
|
for (var i = 0; i < lightIconGizmos.length; ++i) {
|
||||||
@@ -444,6 +496,16 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateParticleSystemGizmoScene(scene, obj)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
|
||||||
|
if (particleSystemIconGizmos[i].targetNode === obj) {
|
||||||
|
particleSystemIconGizmos[i].scene = scene;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
createEditView();
|
createEditView();
|
||||||
selectObjects([]);
|
selectObjects([]);
|
||||||
@@ -471,6 +533,13 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
|
||||||
|
if (particleSystemIconGizmos[i].targetNode === node) {
|
||||||
|
particleSystemIconGizmos[i].locked = _generalHelper.isLocked(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
function onHiddenStateChanged(node)
|
function onHiddenStateChanged(node)
|
||||||
{
|
{
|
||||||
@@ -486,6 +555,12 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
|
||||||
|
if (particleSystemIconGizmos[i].targetNode === node) {
|
||||||
|
particleSystemIconGizmos[i].hidden = _generalHelper.isHidden(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 6.0
|
||||||
|
import QtQuick3D 6.0
|
||||||
|
|
||||||
|
IconGizmo {
|
||||||
|
id: particleSystemGizmo
|
||||||
|
iconSource: "qrc:///qtquickplugin/mockfiles/images/editor_particlesystem.png"
|
||||||
|
}
|
||||||
@@ -9,6 +9,10 @@ versionAtLeast(QT_VERSION, 5.15.0) {
|
|||||||
QT *= quick3dassetimport-private
|
QT *= quick3dassetimport-private
|
||||||
DEFINES *= IMPORT_QUICK3D_ASSETS
|
DEFINES *= IMPORT_QUICK3D_ASSETS
|
||||||
}
|
}
|
||||||
|
qtHaveModule(quick3dparticles) {
|
||||||
|
QT *= quick3dparticles-private
|
||||||
|
DEFINES *= QUICK3D_PARTICLES_MODULE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HEADERS += $$PWD/qt5nodeinstanceserver.h \
|
HEADERS += $$PWD/qt5nodeinstanceserver.h \
|
||||||
|
|||||||
@@ -103,6 +103,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef QUICK3D_PARTICLES_MODULE
|
||||||
|
#include <QtQuick3DParticles/private/qquick3dparticlesystem_p.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef IMPORT_QUICK3D_ASSETS
|
#ifdef IMPORT_QUICK3D_ASSETS
|
||||||
#include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h>
|
#include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -618,6 +622,11 @@ void Qt5InformationNodeInstanceServer::handleNode3DDestroyed(QObject *obj)
|
|||||||
} else if (qobject_cast<QQuick3DAbstractLight *>(obj)) {
|
} else if (qobject_cast<QQuick3DAbstractLight *>(obj)) {
|
||||||
QMetaObject::invokeMethod(m_editView3DData.rootItem, "releaseLightGizmo",
|
QMetaObject::invokeMethod(m_editView3DData.rootItem, "releaseLightGizmo",
|
||||||
Q_ARG(QVariant, objectToVariant(obj)));
|
Q_ARG(QVariant, objectToVariant(obj)));
|
||||||
|
#ifdef QUICK3D_PARTICLES_MODULE
|
||||||
|
} else if (qobject_cast<QQuick3DParticleSystem *>(obj)) {
|
||||||
|
QMetaObject::invokeMethod(m_editView3DData.rootItem, "releaseParticleSystemGizmo",
|
||||||
|
Q_ARG(QVariant, objectToVariant(obj)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
removeNode3D(obj);
|
removeNode3D(obj);
|
||||||
#else
|
#else
|
||||||
@@ -720,6 +729,12 @@ void Qt5InformationNodeInstanceServer::resolveSceneRoots()
|
|||||||
QMetaObject::invokeMethod(m_editView3DData.rootItem, "updateLightGizmoScene",
|
QMetaObject::invokeMethod(m_editView3DData.rootItem, "updateLightGizmoScene",
|
||||||
Q_ARG(QVariant, objectToVariant(newRoot)),
|
Q_ARG(QVariant, objectToVariant(newRoot)),
|
||||||
Q_ARG(QVariant, objectToVariant(node)));
|
Q_ARG(QVariant, objectToVariant(node)));
|
||||||
|
#ifdef QUICK3D_PARTICLES_MODULE
|
||||||
|
} else if (qobject_cast<QQuick3DParticleSystem *>(node)) {
|
||||||
|
QMetaObject::invokeMethod(m_editView3DData.rootItem, "updateParticleSystemGizmoScene",
|
||||||
|
Q_ARG(QVariant, objectToVariant(newRoot)),
|
||||||
|
Q_ARG(QVariant, objectToVariant(node)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
@@ -1231,12 +1246,16 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos(
|
|||||||
{
|
{
|
||||||
QHash<QObject *, QObjectList> cameras;
|
QHash<QObject *, QObjectList> cameras;
|
||||||
QHash<QObject *, QObjectList> lights;
|
QHash<QObject *, QObjectList> lights;
|
||||||
|
QHash<QObject *, QObjectList> particleSystems;
|
||||||
|
|
||||||
for (const ServerNodeInstance &instance : instanceList) {
|
for (const ServerNodeInstance &instance : instanceList) {
|
||||||
if (instance.isSubclassOf("QQuick3DCamera"))
|
if (instance.isSubclassOf("QQuick3DCamera"))
|
||||||
cameras[find3DSceneRoot(instance)] << instance.internalObject();
|
cameras[find3DSceneRoot(instance)] << instance.internalObject();
|
||||||
else if (instance.isSubclassOf("QQuick3DAbstractLight"))
|
else if (instance.isSubclassOf("QQuick3DAbstractLight"))
|
||||||
lights[find3DSceneRoot(instance)] << instance.internalObject();
|
lights[find3DSceneRoot(instance)] << instance.internalObject();
|
||||||
|
else if (instance.isSubclassOf("QQuick3DParticleSystem"))
|
||||||
|
particleSystems[find3DSceneRoot(instance)] << instance.internalObject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cameraIt = cameras.constBegin();
|
auto cameraIt = cameras.constBegin();
|
||||||
@@ -1259,6 +1278,16 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos(
|
|||||||
}
|
}
|
||||||
++lightIt;
|
++lightIt;
|
||||||
}
|
}
|
||||||
|
auto particleIt = particleSystems.constBegin();
|
||||||
|
while (particleIt != particleSystems.constEnd()) {
|
||||||
|
const auto particleObjs = particleIt.value();
|
||||||
|
for (auto &obj : particleObjs) {
|
||||||
|
QMetaObject::invokeMethod(m_editView3DData.rootItem, "addParticleSystemGizmo",
|
||||||
|
Q_ARG(QVariant, objectToVariant(particleIt.key())),
|
||||||
|
Q_ARG(QVariant, objectToVariant(obj)));
|
||||||
|
}
|
||||||
|
++particleIt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt5InformationNodeInstanceServer::add3DViewPorts(const QList<ServerNodeInstance> &instanceList)
|
void Qt5InformationNodeInstanceServer::add3DViewPorts(const QList<ServerNodeInstance> &instanceList)
|
||||||
@@ -1740,6 +1769,9 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm
|
|||||||
#ifdef QUICK3D_MODULE
|
#ifdef QUICK3D_MODULE
|
||||||
if (qobject_cast<QQuick3DModel *>(object)
|
if (qobject_cast<QQuick3DModel *>(object)
|
||||||
|| qobject_cast<QQuick3DCamera *>(object)
|
|| qobject_cast<QQuick3DCamera *>(object)
|
||||||
|
#ifdef QUICK3D_PARTICLES_MODULE
|
||||||
|
|| qobject_cast<QQuick3DParticleSystem *>(object)
|
||||||
|
#endif
|
||||||
|| qobject_cast<QQuick3DAbstractLight *>(object)) {
|
|| qobject_cast<QQuick3DAbstractLight *>(object)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ StudioControls.AbstractButton {
|
|||||||
|
|
||||||
property alias tooltip: toolTipArea.tooltip
|
property alias tooltip: toolTipArea.tooltip
|
||||||
|
|
||||||
|
hover: toolTipArea.containsMouse
|
||||||
|
|
||||||
ToolTipArea {
|
ToolTipArea {
|
||||||
id: toolTipArea
|
id: toolTipArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ SecondColumnLayout {
|
|||||||
icon: StudioTheme.Constants.eyeDropper
|
icon: StudioTheme.Constants.eyeDropper
|
||||||
pixelSize: StudioTheme.Values.myIconFontSize * 1.4
|
pixelSize: StudioTheme.Values.myIconFontSize * 1.4
|
||||||
tooltip: qsTr("Eye Dropper")
|
tooltip: qsTr("Eye Dropper")
|
||||||
onClicked: ColorPaletteSingleton.eyeDropper()
|
onClicked: ColorPaletteBackend.eyeDropper()
|
||||||
}
|
}
|
||||||
|
|
||||||
IconIndicator {
|
IconIndicator {
|
||||||
@@ -700,7 +700,7 @@ SecondColumnLayout {
|
|||||||
|
|
||||||
StudioControls.MenuItem {
|
StudioControls.MenuItem {
|
||||||
text: qsTr("Add to Favorites")
|
text: qsTr("Add to Favorites")
|
||||||
onTriggered: ColorPaletteSingleton.addFavoriteColor(
|
onTriggered: ColorPaletteBackend.addFavoriteColor(
|
||||||
contextMenuFavorite.currentColor)
|
contextMenuFavorite.currentColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ Column {
|
|||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
function addColorToPalette(colorStr) {
|
function addColorToPalette(colorStr) {
|
||||||
ColorPaletteSingleton.addRecentColor(colorStr)
|
ColorPaletteBackend.addRecentColor(colorStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
function showColorDialog(color) {
|
function showColorDialog(color) {
|
||||||
root.oldColor = color
|
root.oldColor = color
|
||||||
ColorPaletteSingleton.showDialog(color)
|
ColorPaletteBackend.showDialog(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
signal dialogColorChanged
|
signal dialogColorChanged
|
||||||
@@ -92,14 +92,14 @@ Column {
|
|||||||
StudioControls.MenuItem {
|
StudioControls.MenuItem {
|
||||||
visible: colorMode.currentText === "Favorite"
|
visible: colorMode.currentText === "Favorite"
|
||||||
text: qsTr("Remove from Favorites")
|
text: qsTr("Remove from Favorites")
|
||||||
onTriggered: ColorPaletteSingleton.removeFavoriteColor(index)
|
onTriggered: ColorPaletteBackend.removeFavoriteColor(index)
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
StudioControls.MenuItem {
|
StudioControls.MenuItem {
|
||||||
visible: colorMode.currentText !== "Favorite"
|
visible: colorMode.currentText !== "Favorite"
|
||||||
text: qsTr("Add to Favorites")
|
text: qsTr("Add to Favorites")
|
||||||
onTriggered: ColorPaletteSingleton.addFavoriteColor(modelData)
|
onTriggered: ColorPaletteBackend.addFavoriteColor(modelData)
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ Column {
|
|||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
id: singletonConnection
|
id: singletonConnection
|
||||||
target: ColorPaletteSingleton
|
target: ColorPaletteBackend
|
||||||
|
|
||||||
function onCurrentColorChanged(color) {
|
function onCurrentColorChanged(color) {
|
||||||
root.selectedColor = color
|
root.selectedColor = color
|
||||||
@@ -132,18 +132,18 @@ Column {
|
|||||||
+ 4 * StudioTheme.Values.colorEditorPopupSpinBoxWidth
|
+ 4 * StudioTheme.Values.colorEditorPopupSpinBoxWidth
|
||||||
width: implicitWidth
|
width: implicitWidth
|
||||||
actionIndicatorVisible: false
|
actionIndicatorVisible: false
|
||||||
model: ColorPaletteSingleton.palettes
|
model: ColorPaletteBackend.palettes
|
||||||
currentIndex: colorMode.find(ColorPaletteSingleton.currentPalette)
|
currentIndex: colorMode.find(ColorPaletteBackend.currentPalette)
|
||||||
|
|
||||||
onActivated: ColorPaletteSingleton.currentPalette = colorMode.currentText
|
onActivated: ColorPaletteBackend.currentPalette = colorMode.currentText
|
||||||
|
|
||||||
Component.onCompleted: colorMode.currentIndex = colorMode.find(ColorPaletteSingleton.currentPalette)
|
Component.onCompleted: colorMode.currentIndex = colorMode.find(ColorPaletteBackend.currentPalette)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
id: colorPaletteView
|
id: colorPaletteView
|
||||||
model: ColorPaletteSingleton.currentPaletteColors
|
model: ColorPaletteBackend.currentPaletteColors
|
||||||
delegate: colorItemDelegate
|
delegate: colorItemDelegate
|
||||||
cellWidth: StudioTheme.Values.colorEditorPopupSpinBoxWidth
|
cellWidth: StudioTheme.Values.colorEditorPopupSpinBoxWidth
|
||||||
+ StudioTheme.Values.controlGap
|
+ StudioTheme.Values.controlGap
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ T.AbstractButton {
|
|||||||
id: myButton
|
id: myButton
|
||||||
|
|
||||||
property bool globalHover: false
|
property bool globalHover: false
|
||||||
|
property bool hover: myButton.hovered
|
||||||
|
|
||||||
property alias buttonIcon: buttonIcon.text
|
property alias buttonIcon: buttonIcon.text
|
||||||
property alias iconColor: buttonIcon.color
|
property alias iconColor: buttonIcon.color
|
||||||
@@ -51,7 +52,7 @@ T.AbstractButton {
|
|||||||
z: myButton.checked ? 10 : 3
|
z: myButton.checked ? 10 : 3
|
||||||
activeFocusOnTab: false
|
activeFocusOnTab: false
|
||||||
|
|
||||||
onHoveredChanged: {
|
onHoverChanged: {
|
||||||
if (parent !== undefined && parent.hoverCallback !== undefined && myButton.enabled)
|
if (parent !== undefined && parent.hoverCallback !== undefined && myButton.enabled)
|
||||||
parent.hoverCallback()
|
parent.hoverCallback()
|
||||||
}
|
}
|
||||||
@@ -119,7 +120,7 @@ T.AbstractButton {
|
|||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "default"
|
name: "default"
|
||||||
when: myButton.enabled && !myButton.globalHover && !myButton.hovered
|
when: myButton.enabled && !myButton.globalHover && !myButton.hover
|
||||||
&& !myButton.pressed && !myButton.checked
|
&& !myButton.pressed && !myButton.checked
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
@@ -132,7 +133,7 @@ T.AbstractButton {
|
|||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "globalHover"
|
name: "globalHover"
|
||||||
when: myButton.globalHover && !myButton.hovered && !myButton.pressed && myButton.enabled
|
when: myButton.globalHover && !myButton.hover && !myButton.pressed && myButton.enabled
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
color: StudioTheme.Values.themeControlBackgroundGlobalHover
|
color: StudioTheme.Values.themeControlBackgroundGlobalHover
|
||||||
@@ -140,7 +141,7 @@ T.AbstractButton {
|
|||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "hover"
|
name: "hover"
|
||||||
when: myButton.hovered && !myButton.pressed && myButton.enabled
|
when: myButton.hover && !myButton.pressed && myButton.enabled
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
color: StudioTheme.Values.themeControlBackgroundHover
|
color: StudioTheme.Values.themeControlBackgroundHover
|
||||||
@@ -148,7 +149,7 @@ T.AbstractButton {
|
|||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "press"
|
name: "press"
|
||||||
when: myButton.hovered && myButton.pressed
|
when: myButton.hover && myButton.pressed
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: buttonBackground
|
target: buttonBackground
|
||||||
color: StudioTheme.Values.themeControlBackgroundInteraction
|
color: StudioTheme.Values.themeControlBackgroundInteraction
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ Row {
|
|||||||
var hover = false
|
var hover = false
|
||||||
|
|
||||||
for (var i = 0; i < children.length; ++i) {
|
for (var i = 0; i < children.length; ++i) {
|
||||||
if (children[i].hovered !== undefined)
|
if (children[i].hover !== undefined)
|
||||||
hover = hover || children[i].hovered
|
hover = hover || children[i].hover
|
||||||
}
|
}
|
||||||
|
|
||||||
myButtonRow.childHover = hover
|
myButtonRow.childHover = hover
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ public:
|
|||||||
|
|
||||||
Utils::optional<Result> result() const
|
Utils::optional<Result> result() const
|
||||||
{
|
{
|
||||||
const QJsonValue &result = m_jsonObject.value("result");
|
const QJsonValue &result = m_jsonObject.value(resultKey);
|
||||||
if (result.isUndefined())
|
if (result.isUndefined())
|
||||||
return Utils::nullopt;
|
return Utils::nullopt;
|
||||||
return Utils::make_optional(Result(result));
|
return Utils::make_optional(Result(result));
|
||||||
@@ -259,6 +259,41 @@ public:
|
|||||||
{ return JsonRpcMessage::isValid(errorMessage) && id().isValid(); }
|
{ return JsonRpcMessage::isValid(errorMessage) && id().isValid(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename ErrorDataType>
|
||||||
|
class Response<std::nullptr_t, ErrorDataType> : public JsonRpcMessage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit Response(const MessageId &id) { setId(id); }
|
||||||
|
using JsonRpcMessage::JsonRpcMessage;
|
||||||
|
|
||||||
|
MessageId id() const
|
||||||
|
{ return MessageId(m_jsonObject.value(idKey)); }
|
||||||
|
void setId(MessageId id)
|
||||||
|
{ this->m_jsonObject.insert(idKey, id); }
|
||||||
|
|
||||||
|
Utils::optional<std::nullptr_t> result() const
|
||||||
|
{
|
||||||
|
return m_jsonObject.value(resultKey).isNull() ? Utils::make_optional(nullptr)
|
||||||
|
: Utils::nullopt;
|
||||||
|
}
|
||||||
|
void setResult(const std::nullptr_t &) { m_jsonObject.insert(resultKey, QJsonValue::Null); }
|
||||||
|
void clearResult() { m_jsonObject.remove(resultKey); }
|
||||||
|
|
||||||
|
using Error = ResponseError<ErrorDataType>;
|
||||||
|
Utils::optional<Error> error() const
|
||||||
|
{
|
||||||
|
const QJsonValue &val = m_jsonObject.value(errorKey);
|
||||||
|
return val.isUndefined() ? Utils::nullopt
|
||||||
|
: Utils::make_optional(fromJsonValue<Error>(val));
|
||||||
|
}
|
||||||
|
void setError(const Error &error)
|
||||||
|
{ m_jsonObject.insert(errorKey, QJsonValue(error)); }
|
||||||
|
void clearError() { m_jsonObject.remove(errorKey); }
|
||||||
|
|
||||||
|
bool isValid(QString *errorMessage) const override
|
||||||
|
{ return JsonRpcMessage::isValid(errorMessage) && id().isValid(); }
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Result, typename ErrorDataType, typename Params>
|
template <typename Result, typename ErrorDataType, typename Params>
|
||||||
class Request : public Notification<Params>
|
class Request : public Notification<Params>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void AndroidConfig::load(const QSettings &settings)
|
|||||||
// user settings
|
// user settings
|
||||||
m_emulatorArgs = settings.value(EmulatorArgsKey,
|
m_emulatorArgs = settings.value(EmulatorArgsKey,
|
||||||
QStringList({"-netdelay", "none", "-netspeed", "full"})).toStringList();
|
QStringList({"-netdelay", "none", "-netspeed", "full"})).toStringList();
|
||||||
m_sdkLocation = FilePath::fromString(settings.value(SDKLocationKey).toString());
|
m_sdkLocation = FilePath::fromUserInput(settings.value(SDKLocationKey).toString()).cleanPath();
|
||||||
m_customNdkList = settings.value(CustomNdkLocationsKey).toStringList();
|
m_customNdkList = settings.value(CustomNdkLocationsKey).toStringList();
|
||||||
m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList();
|
m_sdkManagerToolArgs = settings.value(SDKManagerToolArgsKey).toStringList();
|
||||||
m_openJDKLocation = FilePath::fromString(settings.value(OpenJDKLocationKey).toString());
|
m_openJDKLocation = FilePath::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||||
@@ -239,7 +239,7 @@ void AndroidConfig::load(const QSettings &settings)
|
|||||||
if (reader.load(FilePath::fromString(sdkSettingsFileName()))
|
if (reader.load(FilePath::fromString(sdkSettingsFileName()))
|
||||||
&& settings.value(changeTimeStamp).toInt() != QFileInfo(sdkSettingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
|
&& settings.value(changeTimeStamp).toInt() != QFileInfo(sdkSettingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
|
||||||
// persisten settings
|
// persisten settings
|
||||||
m_sdkLocation = FilePath::fromString(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString());
|
m_sdkLocation = FilePath::fromUserInput(reader.restoreValue(SDKLocationKey, m_sdkLocation.toString()).toString()).cleanPath();
|
||||||
m_customNdkList = reader.restoreValue(CustomNdkLocationsKey).toStringList();
|
m_customNdkList = reader.restoreValue(CustomNdkLocationsKey).toStringList();
|
||||||
m_sdkManagerToolArgs = reader.restoreValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs).toStringList();
|
m_sdkManagerToolArgs = reader.restoreValue(SDKManagerToolArgsKey, m_sdkManagerToolArgs).toStringList();
|
||||||
m_openJDKLocation = FilePath::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString());
|
m_openJDKLocation = FilePath::fromString(reader.restoreValue(OpenJDKLocationKey, m_openJDKLocation.toString()).toString());
|
||||||
@@ -1024,7 +1024,7 @@ FilePath AndroidConfig::defaultSdkPath()
|
|||||||
{
|
{
|
||||||
QString sdkFromEnvVar = QString::fromLocal8Bit(getenv("ANDROID_SDK_ROOT"));
|
QString sdkFromEnvVar = QString::fromLocal8Bit(getenv("ANDROID_SDK_ROOT"));
|
||||||
if (!sdkFromEnvVar.isEmpty())
|
if (!sdkFromEnvVar.isEmpty())
|
||||||
return Utils::FilePath::fromString(sdkFromEnvVar);
|
return FilePath::fromUserInput(sdkFromEnvVar).cleanPath();
|
||||||
|
|
||||||
// Set default path of SDK as used by Android Studio
|
// Set default path of SDK as used by Android Studio
|
||||||
if (Utils::HostOsInfo::isMacHost()) {
|
if (Utils::HostOsInfo::isMacHost()) {
|
||||||
|
|||||||
@@ -213,13 +213,13 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target)
|
|||||||
const QStringList abis = applicationAbis(target);
|
const QStringList abis = applicationAbis(target);
|
||||||
QTC_ASSERT(abis.size() == 1, return {});
|
QTC_ASSERT(abis.size() == 1, return {});
|
||||||
settings["stdcpp-path"] = (AndroidConfigurations::currentConfig().toolchainPath(qt)
|
settings["stdcpp-path"] = (AndroidConfigurations::currentConfig().toolchainPath(qt)
|
||||||
/ "sysroot/usr/lib/"
|
/ "sysroot/usr/lib"
|
||||||
/ archTriplet(abis.first())
|
/ archTriplet(abis.first())
|
||||||
/ "libc++_shared.so").toString();
|
/ "libc++_shared.so").toString();
|
||||||
} else {
|
} else {
|
||||||
settings["stdcpp-path"] = AndroidConfigurations::currentConfig()
|
settings["stdcpp-path"] = AndroidConfigurations::currentConfig()
|
||||||
.toolchainPath(qt)
|
.toolchainPath(qt)
|
||||||
.pathAppended("sysroot/usr/lib/")
|
.pathAppended("sysroot/usr/lib")
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
settings["toolchain-prefix"] = "llvm";
|
settings["toolchain-prefix"] = "llvm";
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ void AndroidSettingsWidget::validateOpenSsl()
|
|||||||
|
|
||||||
void AndroidSettingsWidget::onSdkPathChanged()
|
void AndroidSettingsWidget::onSdkPathChanged()
|
||||||
{
|
{
|
||||||
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath();
|
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath().cleanPath();
|
||||||
m_androidConfig.setSdkLocation(sdkPath);
|
m_androidConfig.setSdkLocation(sdkPath);
|
||||||
FilePath currentOpenSslPath = m_androidConfig.openSslLocation();
|
FilePath currentOpenSslPath = m_androidConfig.openSslLocation();
|
||||||
if (currentOpenSslPath.isEmpty() || !currentOpenSslPath.exists())
|
if (currentOpenSslPath.isEmpty() || !currentOpenSslPath.exists())
|
||||||
@@ -608,7 +608,7 @@ void AndroidSettingsWidget::onSdkPathChanged()
|
|||||||
|
|
||||||
void AndroidSettingsWidget::validateSdk()
|
void AndroidSettingsWidget::validateSdk()
|
||||||
{
|
{
|
||||||
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath();
|
const FilePath sdkPath = m_ui.SDKLocationPathChooser->filePath().cleanPath();
|
||||||
m_androidConfig.setSdkLocation(sdkPath);
|
m_androidConfig.setSdkLocation(sdkPath);
|
||||||
|
|
||||||
m_androidSummary->setPointValid(SdkPathExistsRow, m_androidConfig.sdkLocation().exists());
|
m_androidSummary->setPointValid(SdkPathExistsRow, m_androidConfig.sdkLocation().exists());
|
||||||
@@ -865,14 +865,15 @@ void AndroidSettingsWidget::downloadSdk()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QString message = tr("Download and install Android SDK Tools to: %1?")
|
const QString message = tr("Download and install Android SDK Tools to: %1?")
|
||||||
.arg(m_ui.SDKLocationPathChooser->filePath().toUserOutput());
|
.arg(m_ui.SDKLocationPathChooser->filePath().cleanPath().toUserOutput());
|
||||||
auto userInput = QMessageBox::information(this, AndroidSdkDownloader::dialogTitle(),
|
auto userInput = QMessageBox::information(this, AndroidSdkDownloader::dialogTitle(),
|
||||||
message, QMessageBox::Yes | QMessageBox::No);
|
message, QMessageBox::Yes | QMessageBox::No);
|
||||||
if (userInput == QMessageBox::Yes) {
|
if (userInput == QMessageBox::Yes) {
|
||||||
if (m_javaSummary->allRowsOk()) {
|
if (m_javaSummary->allRowsOk()) {
|
||||||
auto javaPath = m_ui.OpenJDKLocationPathChooser->filePath();
|
auto javaPath = m_ui.OpenJDKLocationPathChooser->filePath();
|
||||||
m_sdkDownloader.downloadAndExtractSdk(javaPath.toString(),
|
m_sdkDownloader.downloadAndExtractSdk(
|
||||||
m_ui.SDKLocationPathChooser->filePath().toString());
|
javaPath.toString(),
|
||||||
|
m_ui.SDKLocationPathChooser->filePath().cleanPath().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|||||||
if (m_copyGradle) {
|
if (m_copyGradle) {
|
||||||
FilePath gradlePath = version->prefix() / "src/3rdparty/gradle";
|
FilePath gradlePath = version->prefix() / "src/3rdparty/gradle";
|
||||||
if (!gradlePath.exists())
|
if (!gradlePath.exists())
|
||||||
gradlePath = AndroidConfigurations::currentConfig().sdkLocation() / "/tools/templates/gradle/wrapper";
|
gradlePath = AndroidConfigurations::currentConfig().sdkLocation() / "tools/templates/gradle/wrapper";
|
||||||
FileUtils::copyRecursively(gradlePath, m_directory, nullptr, copy);
|
FileUtils::copyRecursively(gradlePath, m_directory, nullptr, copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -669,7 +669,7 @@ void CMakeBuildSystem::updateProjectData()
|
|||||||
QList<QByteArray> moduleMappings;
|
QList<QByteArray> moduleMappings;
|
||||||
for (const RawProjectPart &rpp : qAsConst(rpps)) {
|
for (const RawProjectPart &rpp : qAsConst(rpps)) {
|
||||||
FilePath moduleMapFile = cmakeBuildConfiguration()->buildDirectory()
|
FilePath moduleMapFile = cmakeBuildConfiguration()->buildDirectory()
|
||||||
.pathAppended("/qml_module_mappings/" + rpp.buildSystemTarget);
|
.pathAppended("qml_module_mappings/" + rpp.buildSystemTarget);
|
||||||
if (moduleMapFile.exists()) {
|
if (moduleMapFile.exists()) {
|
||||||
QFile mmf(moduleMapFile.toString());
|
QFile mmf(moduleMapFile.toString());
|
||||||
if (mmf.open(QFile::ReadOnly)) {
|
if (mmf.open(QFile::ReadOnly)) {
|
||||||
|
|||||||
@@ -185,22 +185,25 @@ static QString defaultCommand()
|
|||||||
return "locate";
|
return "locate";
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString defaultArguments()
|
/*!
|
||||||
{
|
For the tools es [1] and locate [2], interpret space as AND operator.
|
||||||
if (HostOsInfo::isMacHost())
|
|
||||||
return "\"kMDItemFSName = '*%{Query:Escaped}*'c\"";
|
|
||||||
if (HostOsInfo::isWindowsHost())
|
|
||||||
return "-n 10000 -r \"%{Query:Regex}\"";
|
|
||||||
return "-i -l 10000 -r \"%{Query:Regex}\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString defaultCaseSensitiveArguments()
|
Currently doesn't support fine picking a file with a space in the path by escaped space.
|
||||||
|
|
||||||
|
[1]: https://www.voidtools.com/support/everything/command_line_interface/
|
||||||
|
[2]: https://www.gnu.org/software/findutils/manual/html_node/find_html/Invoking-locate.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
static QString defaultArguments(Qt::CaseSensitivity sens = Qt::CaseInsensitive)
|
||||||
{
|
{
|
||||||
if (HostOsInfo::isMacHost())
|
if (HostOsInfo::isMacHost())
|
||||||
return "\"kMDItemFSName = '*%{Query:Escaped}*'\"";
|
return QString("\"kMDItemFSName = '*%{Query:Escaped}*'%1\"")
|
||||||
|
.arg(sens == Qt::CaseInsensitive ? QString("c") : "");
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
return "-i -n 10000 -r \"%{Query:Regex}\"";
|
return QString("%1 -n 10000 %{Query:Escaped}")
|
||||||
return "-l 10000 -r \"%{Query:Regex}\"";
|
.arg(sens == Qt::CaseInsensitive ? QString() : "-i ");
|
||||||
|
return QString("%1 -A -l 10000 %{Query:Escaped}")
|
||||||
|
.arg(sens == Qt::CaseInsensitive ? QString() : "-i ");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char kCommandKey[] = "command";
|
const char kCommandKey[] = "command";
|
||||||
@@ -229,6 +232,7 @@ static MacroExpander *createMacroExpander(const QString &query)
|
|||||||
[query] {
|
[query] {
|
||||||
QString regex = query;
|
QString regex = query;
|
||||||
regex = regex.replace('*', ".*");
|
regex = regex.replace('*', ".*");
|
||||||
|
regex = regex.replace(' ', ".*");
|
||||||
return regex;
|
return regex;
|
||||||
});
|
});
|
||||||
return expander;
|
return expander;
|
||||||
@@ -305,7 +309,7 @@ void SpotlightLocatorFilter::saveState(QJsonObject &obj) const
|
|||||||
obj.insert(kCommandKey, m_command);
|
obj.insert(kCommandKey, m_command);
|
||||||
if (m_arguments != defaultArguments())
|
if (m_arguments != defaultArguments())
|
||||||
obj.insert(kArgumentsKey, m_arguments);
|
obj.insert(kArgumentsKey, m_arguments);
|
||||||
if (m_caseSensitiveArguments != defaultCaseSensitiveArguments())
|
if (m_caseSensitiveArguments != defaultArguments(Qt::CaseSensitive))
|
||||||
obj.insert(kCaseSensitiveKey, m_caseSensitiveArguments);
|
obj.insert(kCaseSensitiveKey, m_caseSensitiveArguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,14 +317,14 @@ void SpotlightLocatorFilter::restoreState(const QJsonObject &obj)
|
|||||||
{
|
{
|
||||||
m_command = obj.value(kCommandKey).toString(defaultCommand());
|
m_command = obj.value(kCommandKey).toString(defaultCommand());
|
||||||
m_arguments = obj.value(kArgumentsKey).toString(defaultArguments());
|
m_arguments = obj.value(kArgumentsKey).toString(defaultArguments());
|
||||||
m_caseSensitiveArguments = obj.value(kCaseSensitiveKey).toString(defaultCaseSensitiveArguments());
|
m_caseSensitiveArguments = obj.value(kCaseSensitiveKey).toString(defaultArguments(Qt::CaseSensitive));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpotlightLocatorFilter::reset()
|
void SpotlightLocatorFilter::reset()
|
||||||
{
|
{
|
||||||
m_command = defaultCommand();
|
m_command = defaultCommand();
|
||||||
m_arguments = defaultArguments();
|
m_arguments = defaultArguments();
|
||||||
m_caseSensitiveArguments = defaultCaseSensitiveArguments();
|
m_caseSensitiveArguments = defaultArguments(Qt::CaseSensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -155,6 +155,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
|
|||||||
connect(verticalScrollBar(), &QAbstractSlider::actionTriggered,
|
connect(verticalScrollBar(), &QAbstractSlider::actionTriggered,
|
||||||
this, &OutputWindow::updateAutoScroll);
|
this, &OutputWindow::updateAutoScroll);
|
||||||
|
|
||||||
|
// For when "Find" changes the position; see QTCREATORBUG-26100.
|
||||||
|
connect(this, &QPlainTextEdit::selectionChanged, this, &OutputWindow::updateAutoScroll,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
undoAction->setEnabled(false);
|
undoAction->setEnabled(false);
|
||||||
redoAction->setEnabled(false);
|
redoAction->setEnabled(false);
|
||||||
cutAction->setEnabled(false);
|
cutAction->setEnabled(false);
|
||||||
@@ -252,7 +256,7 @@ void OutputWindow::showEvent(QShowEvent *e)
|
|||||||
{
|
{
|
||||||
QPlainTextEdit::showEvent(e);
|
QPlainTextEdit::showEvent(e);
|
||||||
if (d->scrollToBottom)
|
if (d->scrollToBottom)
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputWindow::wheelEvent(QWheelEvent *e)
|
void OutputWindow::wheelEvent(QWheelEvent *e)
|
||||||
|
|||||||
@@ -1293,8 +1293,10 @@ void Client::handleMethod(const QString &method, const MessageId &id, const ICon
|
|||||||
response.setResult(result);
|
response.setResult(result);
|
||||||
sendContent(response);
|
sendContent(response);
|
||||||
} else if (method == WorkDoneProgressCreateRequest::methodName) {
|
} else if (method == WorkDoneProgressCreateRequest::methodName) {
|
||||||
sendContent(WorkDoneProgressCreateRequest::Response(
|
WorkDoneProgressCreateRequest::Response response(
|
||||||
dynamic_cast<const WorkDoneProgressCreateRequest *>(content)->id()));
|
dynamic_cast<const WorkDoneProgressCreateRequest *>(content)->id());
|
||||||
|
response.setResult(nullptr);
|
||||||
|
sendContent(response);
|
||||||
} else if (method == ProgressNotification::methodName) {
|
} else if (method == ProgressNotification::methodName) {
|
||||||
if (Utils::optional<ProgressParams> params
|
if (Utils::optional<ProgressParams> params
|
||||||
= dynamic_cast<const ProgressNotification *>(content)->params()) {
|
= dynamic_cast<const ProgressNotification *>(content)->params()) {
|
||||||
|
|||||||
@@ -110,23 +110,23 @@ void LanguageClientManager::clientStarted(Client *client)
|
|||||||
clientFinished(client);
|
clientFinished(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!managerInstance->m_clients.contains(client)) {
|
if (!managerInstance->m_clients.contains(client))
|
||||||
managerInstance->m_clients << client;
|
managerInstance->m_clients << client;
|
||||||
connect(client, &Client::finished, managerInstance, [client]() { clientFinished(client); });
|
|
||||||
connect(client,
|
connect(client, &Client::finished, managerInstance, [client]() { clientFinished(client); });
|
||||||
&Client::initialized,
|
connect(client,
|
||||||
managerInstance,
|
&Client::initialized,
|
||||||
[client](const LanguageServerProtocol::ServerCapabilities &capabilities) {
|
managerInstance,
|
||||||
managerInstance->m_currentDocumentLocatorFilter.updateCurrentClient();
|
[client](const LanguageServerProtocol::ServerCapabilities &capabilities) {
|
||||||
managerInstance->m_inspector.clientInitialized(client->name(), capabilities);
|
managerInstance->m_currentDocumentLocatorFilter.updateCurrentClient();
|
||||||
});
|
managerInstance->m_inspector.clientInitialized(client->name(), capabilities);
|
||||||
connect(client,
|
});
|
||||||
&Client::capabilitiesChanged,
|
connect(client,
|
||||||
managerInstance,
|
&Client::capabilitiesChanged,
|
||||||
[client](const DynamicCapabilities &capabilities) {
|
managerInstance,
|
||||||
managerInstance->m_inspector.updateCapabilities(client->name(), capabilities);
|
[client](const DynamicCapabilities &capabilities) {
|
||||||
});
|
managerInstance->m_inspector.updateCapabilities(client->name(), capabilities);
|
||||||
}
|
});
|
||||||
|
|
||||||
client->initialize();
|
client->initialize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ extend_qtc_plugin(QmlDesigner
|
|||||||
SOURCES_PREFIX components/propertyeditor
|
SOURCES_PREFIX components/propertyeditor
|
||||||
SOURCES
|
SOURCES
|
||||||
aligndistribute.cpp aligndistribute.h
|
aligndistribute.cpp aligndistribute.h
|
||||||
colorpalettesingleton.cpp colorpalettesingleton.h
|
colorpalettebackend.cpp colorpalettebackend.h
|
||||||
designerpropertymap.cpp designerpropertymap.h
|
designerpropertymap.cpp designerpropertymap.h
|
||||||
fileresourcesmodel.cpp fileresourcesmodel.h
|
fileresourcesmodel.cpp fileresourcesmodel.h
|
||||||
itemfiltermodel.cpp itemfiltermodel.h
|
itemfiltermodel.cpp itemfiltermodel.h
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of Qt Creator.
|
** This file is part of Qt Creator.
|
||||||
@@ -24,18 +24,17 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "annotationcommenttab.h"
|
#include "annotationcommenttab.h"
|
||||||
#include "defaultannotations.h"
|
|
||||||
#include "ui_annotationcommenttab.h"
|
#include "ui_annotationcommenttab.h"
|
||||||
|
|
||||||
#include "richtexteditor/richtexteditor.h"
|
#include "defaultannotations.h"
|
||||||
|
|
||||||
|
#include <qmldesignerplugin.h>
|
||||||
|
#include <richtexteditor/richtexteditor.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
#include <qmlprojectmanager/qmlproject.h>
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
#include "projectexplorer/session.h"
|
|
||||||
#include "projectexplorer/target.h"
|
|
||||||
#include "qmldesignerplugin.h"
|
|
||||||
#include "qmlprojectmanager/qmlproject.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
AnnotationCommentTab::AnnotationCommentTab(QWidget *parent)
|
AnnotationCommentTab::AnnotationCommentTab(QWidget *parent)
|
||||||
@@ -50,10 +49,27 @@ AnnotationCommentTab::AnnotationCommentTab(QWidget *parent)
|
|||||||
filePath = backupFile(filePath);
|
filePath = backupFile(filePath);
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils::FilePath projPath = ProjectExplorer::SessionManager::startupProject()->projectFilePath();
|
m_editor->setImageActionVisible(false);
|
||||||
|
|
||||||
m_editor->setDocumentBaseUrl(QUrl::fromLocalFile(projPath.toString()));
|
const QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
|
||||||
m_editor->setImageActionVisible(true);
|
->documentManager().currentDesignDocument();
|
||||||
|
Utils::FilePath projectPath;
|
||||||
|
|
||||||
|
Q_ASSERT(designDocument);
|
||||||
|
|
||||||
|
if (designDocument) {
|
||||||
|
if (designDocument->currentTarget() && designDocument->currentTarget()->project()) {
|
||||||
|
projectPath = designDocument->currentTarget()->project()->projectFilePath();
|
||||||
|
m_editor->setImageActionVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (projectPath.isEmpty()) {
|
||||||
|
projectPath = designDocument->fileName();
|
||||||
|
m_editor->setImageActionVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_editor->setDocumentBaseUrl(QUrl::fromLocalFile(projectPath.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
ui->formLayout->setWidget(3, QFormLayout::FieldRole, m_editor);
|
ui->formLayout->setWidget(3, QFormLayout::FieldRole, m_editor);
|
||||||
|
|
||||||
@@ -124,14 +140,35 @@ void AnnotationCommentTab::setDefaultAnnotations(DefaultAnnotationsModel *defaul
|
|||||||
|
|
||||||
QString AnnotationCommentTab::backupFile(const QString &filePath)
|
QString AnnotationCommentTab::backupFile(const QString &filePath)
|
||||||
{
|
{
|
||||||
const QDir projDir(
|
const QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
|
||||||
ProjectExplorer::SessionManager::startupProject()->projectDirectory().toString());
|
->documentManager().currentDesignDocument();
|
||||||
|
Utils::FilePath projectFolderPath;
|
||||||
|
|
||||||
|
Q_ASSERT(designDocument);
|
||||||
|
|
||||||
|
if (designDocument) {
|
||||||
|
if (designDocument->hasProject())
|
||||||
|
projectFolderPath = designDocument->projectFolder();
|
||||||
|
if (projectFolderPath.isEmpty())
|
||||||
|
projectFolderPath = designDocument->fileName().parentDir();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return {};
|
||||||
|
|
||||||
|
const QDir projDir(projectFolderPath.toDir());
|
||||||
|
|
||||||
|
if (!projDir.exists())
|
||||||
|
return {};
|
||||||
|
|
||||||
const QString imageSubDir(".AnnotationImages");
|
const QString imageSubDir(".AnnotationImages");
|
||||||
const QDir imgDir(projDir.absolutePath() + QDir::separator() + imageSubDir);
|
const QDir imgDir(projDir.absolutePath() + QDir::separator() + imageSubDir);
|
||||||
|
|
||||||
ensureDir(imgDir);
|
ensureDir(imgDir);
|
||||||
|
|
||||||
|
Q_ASSERT(imgDir.exists());
|
||||||
|
if (!imgDir.exists())
|
||||||
|
return {};
|
||||||
|
|
||||||
const QFileInfo oldFile(filePath);
|
const QFileInfo oldFile(filePath);
|
||||||
QFileInfo newFile(imgDir, oldFile.fileName());
|
QFileInfo newFile(imgDir, oldFile.fileName());
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of Qt Creator.
|
** This file is part of Qt Creator.
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "annotation.h"
|
#include <annotation.h>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
@@ -67,16 +67,17 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void titleChanged(const QString &text, QWidget *widget);
|
void titleChanged(const QString &text, QWidget *widget);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString backupFile(const QString &filePath);
|
||||||
|
void ensureDir(const QDir &dir);
|
||||||
|
int compareFileChecksum(const QString &firstFile, const QString &secondFile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::AnnotationCommentTab> ui;
|
std::unique_ptr<Ui::AnnotationCommentTab> ui;
|
||||||
RichTextEditor *m_editor;
|
RichTextEditor *m_editor;
|
||||||
|
|
||||||
Comment m_comment;
|
Comment m_comment;
|
||||||
QPointer<DefaultAnnotationsModel> m_defaults;
|
QPointer<DefaultAnnotationsModel> m_defaults;
|
||||||
|
|
||||||
QString backupFile(const QString &filePath);
|
|
||||||
void ensureDir(const QDir &dir);
|
|
||||||
int compareFileChecksum(const QString &firstFile, const QString &secondFile);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace QmlDesigner
|
} //namespace QmlDesigner
|
||||||
|
|||||||
@@ -357,14 +357,16 @@ QVector<Comment> AnnotationTableView::fetchComments() const
|
|||||||
|
|
||||||
Comment AnnotationTableView::fetchComment(int row) const
|
Comment AnnotationTableView::fetchComment(int row) const
|
||||||
{
|
{
|
||||||
auto *item = m_model->item(row, ColumnId::Title);
|
const auto *item = m_model->item(row, ColumnId::Title);
|
||||||
if (item->text().isEmpty())
|
Comment comment = item->data().value<Comment>();
|
||||||
|
|
||||||
|
if (comment.isEmpty())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
Comment comment = item->data().value<Comment>();
|
|
||||||
comment.setTitle(item->text());
|
comment.setTitle(item->text());
|
||||||
comment.setAuthor(m_model->item(row, ColumnId::Author)->text());
|
comment.setAuthor(m_model->item(row, ColumnId::Author)->text());
|
||||||
comment.setText(dataToCommentText(m_model->item(row, ColumnId::Value)->data(Qt::DisplayRole)));
|
comment.setText(dataToCommentText(m_model->item(row, ColumnId::Value)->data(Qt::DisplayRole)));
|
||||||
|
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,10 +127,10 @@ QString Theme::replaceCssColors(const QString &input)
|
|||||||
|
|
||||||
void Theme::setupTheme(QQmlEngine *engine)
|
void Theme::setupTheme(QQmlEngine *engine)
|
||||||
{
|
{
|
||||||
static const int typeIndex = qmlRegisterSingletonType<Utils::Theme>("QtQuickDesignerTheme", 1, 0,
|
static const int typeIndex = qmlRegisterSingletonType<Theme>(
|
||||||
"Theme", [](QQmlEngine *, QJSEngine *) {
|
"QtQuickDesignerTheme", 1, 0, "Theme", [](QQmlEngine *engine, QJSEngine *) {
|
||||||
return qobject_cast<QObject*>(new Theme(Utils::creatorTheme(), nullptr));
|
return new Theme(Utils::creatorTheme(), nullptr);
|
||||||
});
|
});
|
||||||
Q_UNUSED(typeIndex)
|
Q_UNUSED(typeIndex)
|
||||||
|
|
||||||
engine->addImageProvider(QLatin1String("icons"), new QmlDesignerIconProvider());
|
engine->addImageProvider(QLatin1String("icons"), new QmlDesignerIconProvider());
|
||||||
|
|||||||
@@ -288,6 +288,11 @@ Utils::FilePath DesignDocument::projectFolder() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DesignDocument::hasProject() const
|
||||||
|
{
|
||||||
|
return ProjectExplorer::SessionManager::projectForFile(fileName());
|
||||||
|
}
|
||||||
|
|
||||||
void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textModifer)
|
void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textModifer)
|
||||||
{
|
{
|
||||||
m_inFileComponentTextModifier.reset(textModifer);
|
m_inFileComponentTextModifier.reset(textModifer);
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public:
|
|||||||
bool isQtForMCUsProject() const;
|
bool isQtForMCUsProject() const;
|
||||||
|
|
||||||
Utils::FilePath projectFolder() const;
|
Utils::FilePath projectFolder() const;
|
||||||
|
bool hasProject() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayNameChanged(const QString &newFileName);
|
void displayNameChanged(const QString &newFileName);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "colorpalettesingleton.h"
|
#include "colorpalettebackend.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@@ -36,9 +36,9 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
QPointer<ColorPaletteSingleton> ColorPaletteSingleton::m_instance = nullptr;
|
QPointer<ColorPaletteBackend> ColorPaletteBackend::m_instance = nullptr;
|
||||||
|
|
||||||
ColorPaletteSingleton::ColorPaletteSingleton()
|
ColorPaletteBackend::ColorPaletteBackend()
|
||||||
: m_currentPalette()
|
: m_currentPalette()
|
||||||
, m_data()
|
, m_data()
|
||||||
, m_colorPickingEventFilter(nullptr)
|
, m_colorPickingEventFilter(nullptr)
|
||||||
@@ -58,24 +58,16 @@ ColorPaletteSingleton::ColorPaletteSingleton()
|
|||||||
dummyTransparentWindow.resize(1, 1);
|
dummyTransparentWindow.resize(1, 1);
|
||||||
dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint);
|
dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint);
|
||||||
updateTimer = new QTimer(this);
|
updateTimer = new QTimer(this);
|
||||||
connect(updateTimer, &QTimer::timeout, this, &ColorPaletteSingleton::updateEyeDropper);
|
connect(updateTimer, &QTimer::timeout, this, &ColorPaletteBackend::updateEyeDropper);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorPaletteSingleton::~ColorPaletteSingleton()
|
ColorPaletteBackend::~ColorPaletteBackend()
|
||||||
{
|
{
|
||||||
//writePalettes(); // TODO crash on QtDS close
|
//writePalettes(); // TODO crash on QtDS close
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorPaletteSingleton *ColorPaletteSingleton::instance()
|
void ColorPaletteBackend::readPalettes()
|
||||||
{
|
|
||||||
if (m_instance == nullptr)
|
|
||||||
m_instance = new ColorPaletteSingleton();
|
|
||||||
|
|
||||||
return m_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ColorPaletteSingleton::readPalettes()
|
|
||||||
{
|
{
|
||||||
QHash<QString, Palette>::iterator i = m_data.begin();
|
QHash<QString, Palette>::iterator i = m_data.begin();
|
||||||
while (i != m_data.end()) {
|
while (i != m_data.end()) {
|
||||||
@@ -84,7 +76,7 @@ void ColorPaletteSingleton::readPalettes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::writePalettes()
|
void ColorPaletteBackend::writePalettes()
|
||||||
{
|
{
|
||||||
QHash<QString, Palette>::iterator i = m_data.begin();
|
QHash<QString, Palette>::iterator i = m_data.begin();
|
||||||
while (i != m_data.end()) {
|
while (i != m_data.end()) {
|
||||||
@@ -93,10 +85,10 @@ void ColorPaletteSingleton::writePalettes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::addColor(const QString &color, const QString &palette)
|
void ColorPaletteBackend::addColor(const QString &color, const QString &palette)
|
||||||
{
|
{
|
||||||
if (!m_data.contains(palette)) {
|
if (!m_data.contains(palette)) {
|
||||||
qWarning() << "TODO";
|
qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,15 +108,15 @@ void ColorPaletteSingleton::addColor(const QString &color, const QString &palett
|
|||||||
m_data[palette].write();
|
m_data[palette].write();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::removeColor(int id, const QString &palette)
|
void ColorPaletteBackend::removeColor(int id, const QString &palette)
|
||||||
{
|
{
|
||||||
if (!m_data.contains(palette)) {
|
if (!m_data.contains(palette)) {
|
||||||
qWarning() << "TODO";
|
qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id >= m_data[palette].m_colors.size()) {
|
if (id >= m_data[palette].m_colors.size()) {
|
||||||
qWarning() << "TODO";
|
qWarning() << Q_FUNC_INFO << "Id(" << id << ") is out of bounds for palette " << palette;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +135,7 @@ void ColorPaletteSingleton::removeColor(int id, const QString &palette)
|
|||||||
m_data[palette].write();
|
m_data[palette].write();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::addRecentColor(const QString &item)
|
void ColorPaletteBackend::addRecentColor(const QString &item)
|
||||||
{
|
{
|
||||||
if (m_data[g_recent].m_colors.isEmpty()) {
|
if (m_data[g_recent].m_colors.isEmpty()) {
|
||||||
addColor(item, g_recent);
|
addColor(item, g_recent);
|
||||||
@@ -155,30 +147,30 @@ void ColorPaletteSingleton::addRecentColor(const QString &item)
|
|||||||
addColor(item, g_recent);
|
addColor(item, g_recent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::addFavoriteColor(const QString &item)
|
void ColorPaletteBackend::addFavoriteColor(const QString &item)
|
||||||
{
|
{
|
||||||
addColor(item, g_favorite);
|
addColor(item, g_favorite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::removeFavoriteColor(int id)
|
void ColorPaletteBackend::removeFavoriteColor(int id)
|
||||||
{
|
{
|
||||||
removeColor(id, g_favorite);
|
removeColor(id, g_favorite);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ColorPaletteSingleton::palettes() const
|
QStringList ColorPaletteBackend::palettes() const
|
||||||
{
|
{
|
||||||
return m_data.keys();
|
return m_data.keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &ColorPaletteSingleton::currentPalette() const
|
const QString &ColorPaletteBackend::currentPalette() const
|
||||||
{
|
{
|
||||||
return m_currentPalette;
|
return m_currentPalette;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::setCurrentPalette(const QString &palette)
|
void ColorPaletteBackend::setCurrentPalette(const QString &palette)
|
||||||
{
|
{
|
||||||
if (!m_data.contains(palette)) {
|
if (!m_data.contains(palette)) {
|
||||||
qWarning() << "TODO";
|
qWarning() << Q_FUNC_INFO << "Unknown palette: " << palette;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,35 +199,35 @@ void ColorPaletteSingleton::setCurrentPalette(const QString &palette)
|
|||||||
emit currentPaletteColorsChanged();
|
emit currentPaletteColorsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &ColorPaletteSingleton::currentPaletteColors() const
|
const QStringList &ColorPaletteBackend::currentPaletteColors() const
|
||||||
{
|
{
|
||||||
return m_currentPaletteColors;
|
return m_currentPaletteColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::registerDeclarativeType()
|
void ColorPaletteBackend::registerDeclarativeType()
|
||||||
{
|
{
|
||||||
static const int typeIndex = qmlRegisterSingletonType<ColorPaletteSingleton>(
|
static const int typeIndex = qmlRegisterSingletonType<ColorPaletteBackend>(
|
||||||
"QtQuickDesignerColorPalette", 1, 0, "ColorPaletteSingleton", [](QQmlEngine *, QJSEngine *) {
|
"QtQuickDesignerColorPalette", 1, 0, "ColorPaletteBackend", [](QQmlEngine *, QJSEngine *) {
|
||||||
return ColorPaletteSingleton::instance();
|
return new ColorPaletteBackend();
|
||||||
});
|
});
|
||||||
Q_UNUSED(typeIndex)
|
Q_UNUSED(typeIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::showDialog(QColor color)
|
void ColorPaletteBackend::showDialog(QColor color)
|
||||||
{
|
{
|
||||||
auto colorDialog = new QColorDialog(Core::ICore::dialogParent());
|
auto colorDialog = new QColorDialog(Core::ICore::dialogParent());
|
||||||
colorDialog->setCurrentColor(color);
|
colorDialog->setCurrentColor(color);
|
||||||
colorDialog->setAttribute(Qt::WA_DeleteOnClose);
|
colorDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
connect(colorDialog, &QDialog::rejected,
|
connect(colorDialog, &QDialog::rejected,
|
||||||
this, &ColorPaletteSingleton::colorDialogRejected);
|
this, &ColorPaletteBackend::colorDialogRejected);
|
||||||
connect(colorDialog, &QColorDialog::currentColorChanged,
|
connect(colorDialog, &QColorDialog::currentColorChanged,
|
||||||
this, &ColorPaletteSingleton::currentColorChanged);
|
this, &ColorPaletteBackend::currentColorChanged);
|
||||||
|
|
||||||
QTimer::singleShot(0, [colorDialog](){ colorDialog->exec(); });
|
QTimer::singleShot(0, [colorDialog](){ colorDialog->exec(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::eyeDropper()
|
void ColorPaletteBackend::eyeDropper()
|
||||||
{
|
{
|
||||||
QWidget *widget = QApplication::activeWindow();
|
QWidget *widget = QApplication::activeWindow();
|
||||||
if (!widget)
|
if (!widget)
|
||||||
@@ -274,12 +266,12 @@ const int g_screenGrabHeight = 7;
|
|||||||
const int g_pixelX = 3;
|
const int g_pixelX = 3;
|
||||||
const int g_pixelY = 3;
|
const int g_pixelY = 3;
|
||||||
|
|
||||||
QColor ColorPaletteSingleton::grabScreenColor(const QPoint &p)
|
QColor ColorPaletteBackend::grabScreenColor(const QPoint &p)
|
||||||
{
|
{
|
||||||
return grabScreenRect(p).pixel(g_pixelX, g_pixelY);
|
return grabScreenRect(p).pixel(g_pixelX, g_pixelY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage ColorPaletteSingleton::grabScreenRect(const QPoint &p)
|
QImage ColorPaletteBackend::grabScreenRect(const QPoint &p)
|
||||||
{
|
{
|
||||||
QScreen *screen = QGuiApplication::screenAt(p);
|
QScreen *screen = QGuiApplication::screenAt(p);
|
||||||
if (!screen)
|
if (!screen)
|
||||||
@@ -289,7 +281,7 @@ QImage ColorPaletteSingleton::grabScreenRect(const QPoint &p)
|
|||||||
return pixmap.toImage();
|
return pixmap.toImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::updateEyeDropper()
|
void ColorPaletteBackend::updateEyeDropper()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
static QPoint lastGlobalPos;
|
static QPoint lastGlobalPos;
|
||||||
@@ -306,12 +298,12 @@ void ColorPaletteSingleton::updateEyeDropper()
|
|||||||
#endif // ! QT_NO_CURSOR
|
#endif // ! QT_NO_CURSOR
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::updateEyeDropperPosition(const QPoint &globalPos)
|
void ColorPaletteBackend::updateEyeDropperPosition(const QPoint &globalPos)
|
||||||
{
|
{
|
||||||
updateCursor(grabScreenRect(globalPos));
|
updateCursor(grabScreenRect(globalPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::updateCursor(const QImage &image)
|
void ColorPaletteBackend::updateCursor(const QImage &image)
|
||||||
{
|
{
|
||||||
QWidget *widget = QApplication::activeWindow();
|
QWidget *widget = QApplication::activeWindow();
|
||||||
if (!widget)
|
if (!widget)
|
||||||
@@ -351,7 +343,7 @@ void ColorPaletteSingleton::updateCursor(const QImage &image)
|
|||||||
widget->setCursor(cursor);
|
widget->setCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPaletteSingleton::releaseEyeDropper()
|
void ColorPaletteBackend::releaseEyeDropper()
|
||||||
{
|
{
|
||||||
QWidget *widget = QApplication::activeWindow();
|
QWidget *widget = QApplication::activeWindow();
|
||||||
if (!widget)
|
if (!widget)
|
||||||
@@ -369,13 +361,13 @@ void ColorPaletteSingleton::releaseEyeDropper()
|
|||||||
widget->unsetCursor();
|
widget->unsetCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColorPaletteSingleton::handleEyeDropperMouseMove(QMouseEvent *e)
|
bool ColorPaletteBackend::handleEyeDropperMouseMove(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
updateEyeDropperPosition(e->globalPos());
|
updateEyeDropperPosition(e->globalPos());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColorPaletteSingleton::handleEyeDropperMouseButtonRelease(QMouseEvent *e)
|
bool ColorPaletteBackend::handleEyeDropperMouseButtonRelease(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
if (e->button() == Qt::LeftButton)
|
if (e->button() == Qt::LeftButton)
|
||||||
emit currentColorChanged(grabScreenColor(e->globalPos()));
|
emit currentColorChanged(grabScreenColor(e->globalPos()));
|
||||||
@@ -386,7 +378,7 @@ bool ColorPaletteSingleton::handleEyeDropperMouseButtonRelease(QMouseEvent *e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColorPaletteSingleton::handleEyeDropperKeyPress(QKeyEvent *e)
|
bool ColorPaletteBackend::handleEyeDropperKeyPress(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(shortcut)
|
#if QT_CONFIG(shortcut)
|
||||||
if (e->matches(QKeySequence::Cancel)) {
|
if (e->matches(QKeySequence::Cancel)) {
|
||||||
@@ -78,7 +78,7 @@ struct Palette
|
|||||||
QStringList m_colors;
|
QStringList m_colors;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ColorPaletteSingleton : public QObject
|
class ColorPaletteBackend : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -94,9 +94,7 @@ class ColorPaletteSingleton : public QObject
|
|||||||
NOTIFY palettesChanged)
|
NOTIFY palettesChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ColorPaletteSingleton *instance();
|
~ColorPaletteBackend();
|
||||||
|
|
||||||
~ColorPaletteSingleton();
|
|
||||||
|
|
||||||
void readPalettes();
|
void readPalettes();
|
||||||
void writePalettes();
|
void writePalettes();
|
||||||
@@ -140,8 +138,8 @@ public:
|
|||||||
bool handleEyeDropperKeyPress(QKeyEvent *e);
|
bool handleEyeDropperKeyPress(QKeyEvent *e);
|
||||||
|
|
||||||
|
|
||||||
ColorPaletteSingleton(const ColorPaletteSingleton &) = delete;
|
ColorPaletteBackend(const ColorPaletteBackend &) = delete;
|
||||||
void operator=(const ColorPaletteSingleton &) = delete;
|
void operator=(const ColorPaletteBackend &) = delete;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentPaletteChanged(const QString &palette);
|
void currentPaletteChanged(const QString &palette);
|
||||||
@@ -154,10 +152,10 @@ signals:
|
|||||||
void eyeDropperRejected();
|
void eyeDropperRejected();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ColorPaletteSingleton();
|
ColorPaletteBackend();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QPointer<ColorPaletteSingleton> m_instance;
|
static QPointer<ColorPaletteBackend> m_instance;
|
||||||
QString m_currentPalette;
|
QString m_currentPalette;
|
||||||
QStringList m_currentPaletteColors;
|
QStringList m_currentPaletteColors;
|
||||||
QHash<QString, Palette> m_data;
|
QHash<QString, Palette> m_data;
|
||||||
@@ -171,29 +169,33 @@ private:
|
|||||||
|
|
||||||
class QColorPickingEventFilter : public QObject {
|
class QColorPickingEventFilter : public QObject {
|
||||||
public:
|
public:
|
||||||
explicit QColorPickingEventFilter(QObject *parent = 0)
|
explicit QColorPickingEventFilter(ColorPaletteBackend *colorPalette)
|
||||||
: QObject(parent)
|
: QObject(colorPalette)
|
||||||
|
, m_colorPalette(colorPalette)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool eventFilter(QObject *, QEvent *event) override
|
bool eventFilter(QObject *, QEvent *event) override
|
||||||
{
|
{
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::MouseMove:
|
case QEvent::MouseMove:
|
||||||
return ColorPaletteSingleton::instance()->handleEyeDropperMouseMove(
|
return m_colorPalette->handleEyeDropperMouseMove(
|
||||||
static_cast<QMouseEvent *>(event));
|
static_cast<QMouseEvent *>(event));
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
return ColorPaletteSingleton::instance()->handleEyeDropperMouseButtonRelease(
|
return m_colorPalette->handleEyeDropperMouseButtonRelease(
|
||||||
static_cast<QMouseEvent *>(event));
|
static_cast<QMouseEvent *>(event));
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
return ColorPaletteSingleton::instance()->handleEyeDropperKeyPress(
|
return m_colorPalette->handleEyeDropperKeyPress(
|
||||||
static_cast<QKeyEvent *>(event));
|
static_cast<QKeyEvent *>(event));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ColorPaletteBackend *m_colorPalette;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
QML_DECLARE_TYPE(QmlDesigner::ColorPaletteSingleton)
|
QML_DECLARE_TYPE(QmlDesigner::ColorPaletteBackend)
|
||||||
@@ -16,7 +16,7 @@ SOURCES += propertyeditorview.cpp \
|
|||||||
gradientpresetlistmodel.cpp \
|
gradientpresetlistmodel.cpp \
|
||||||
gradientpresetdefaultlistmodel.cpp \
|
gradientpresetdefaultlistmodel.cpp \
|
||||||
gradientpresetcustomlistmodel.cpp \
|
gradientpresetcustomlistmodel.cpp \
|
||||||
colorpalettesingleton.cpp \
|
colorpalettebackend.cpp \
|
||||||
itemfiltermodel.cpp \
|
itemfiltermodel.cpp \
|
||||||
aligndistribute.cpp \
|
aligndistribute.cpp \
|
||||||
tooltip.cpp
|
tooltip.cpp
|
||||||
@@ -37,7 +37,7 @@ HEADERS += propertyeditorview.h \
|
|||||||
gradientpresetlistmodel.h \
|
gradientpresetlistmodel.h \
|
||||||
gradientpresetdefaultlistmodel.h \
|
gradientpresetdefaultlistmodel.h \
|
||||||
gradientpresetcustomlistmodel.h \
|
gradientpresetcustomlistmodel.h \
|
||||||
colorpalettesingleton.h \
|
colorpalettebackend.h \
|
||||||
itemfiltermodel.h \
|
itemfiltermodel.h \
|
||||||
aligndistribute.h \
|
aligndistribute.h \
|
||||||
tooltip.h
|
tooltip.h
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include "annotationeditor/annotationeditor.h"
|
#include "annotationeditor/annotationeditor.h"
|
||||||
#include "bindingeditor/actioneditor.h"
|
#include "bindingeditor/actioneditor.h"
|
||||||
#include "bindingeditor/bindingeditor.h"
|
#include "bindingeditor/bindingeditor.h"
|
||||||
#include "colorpalettesingleton.h"
|
#include "colorpalettebackend.h"
|
||||||
#include "fileresourcesmodel.h"
|
#include "fileresourcesmodel.h"
|
||||||
#include "gradientmodel.h"
|
#include "gradientmodel.h"
|
||||||
#include "gradientpresetcustomlistmodel.h"
|
#include "gradientpresetcustomlistmodel.h"
|
||||||
@@ -63,7 +63,7 @@ void Quick2PropertyEditorView::registerQmlTypes()
|
|||||||
GradientPresetDefaultListModel::registerDeclarativeType();
|
GradientPresetDefaultListModel::registerDeclarativeType();
|
||||||
GradientPresetCustomListModel::registerDeclarativeType();
|
GradientPresetCustomListModel::registerDeclarativeType();
|
||||||
ItemFilterModel::registerDeclarativeType();
|
ItemFilterModel::registerDeclarativeType();
|
||||||
ColorPaletteSingleton::registerDeclarativeType();
|
ColorPaletteBackend::registerDeclarativeType();
|
||||||
Internal::QmlAnchorBindingProxy::registerDeclarativeType();
|
Internal::QmlAnchorBindingProxy::registerDeclarativeType();
|
||||||
BindingEditor::registerDeclarativeType();
|
BindingEditor::registerDeclarativeType();
|
||||||
ActionEditor::registerDeclarativeType();
|
ActionEditor::registerDeclarativeType();
|
||||||
|
|||||||
@@ -47,22 +47,6 @@ MetaInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "QtQuick.Controls.SplitView"
|
|
||||||
icon: ":/componentsplugin/images/splitview-layouts-icon-16px.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "SplitView"
|
|
||||||
category: "Qt Quick - Layouts"
|
|
||||||
libraryIcon: ":/componentsplugin/images/splitview-layouts-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "QtQuick.Controls"
|
|
||||||
|
|
||||||
Property { name: "width"; type: "int"; value: 100; }
|
|
||||||
Property { name: "height"; type: "int"; value: 100; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
Type {
|
||||||
name: "QtQuick.Layouts.StackLayout"
|
name: "QtQuick.Layouts.StackLayout"
|
||||||
icon: ":/componentsplugin/images/stack-layouts-icon-16px.png"
|
icon: ":/componentsplugin/images/stack-layouts-icon-16px.png"
|
||||||
|
|||||||
@@ -535,6 +535,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
|||||||
import = QmlDesigner::Import::createLibraryImport("QtCharts", "2.0");
|
import = QmlDesigner::Import::createLibraryImport("QtCharts", "2.0");
|
||||||
if (m_model->hasImport(import, true, true))
|
if (m_model->hasImport(import, true, true))
|
||||||
environment.set("QMLDESIGNER_FORCE_QAPPLICATION", "true");
|
environment.set("QMLDESIGNER_FORCE_QAPPLICATION", "true");
|
||||||
|
environment.set("QT_QUICK3D_DISABLE_PARTICLE_SYSTEMS", "1");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QStringList importPaths = m_model->importPaths();
|
QStringList importPaths = m_model->importPaths();
|
||||||
|
|||||||
@@ -677,8 +677,8 @@ Project {
|
|||||||
"navigator/previewtooltip.ui",
|
"navigator/previewtooltip.ui",
|
||||||
"propertyeditor/aligndistribute.cpp",
|
"propertyeditor/aligndistribute.cpp",
|
||||||
"propertyeditor/aligndistribute.h",
|
"propertyeditor/aligndistribute.h",
|
||||||
"propertyeditor/colorpalettesingleton.cpp",
|
"propertyeditor/colorpalettebackend.cpp",
|
||||||
"propertyeditor/colorpalettesingleton.h",
|
"propertyeditor/colorpalettebackend.h",
|
||||||
"propertyeditor/designerpropertymap.cpp",
|
"propertyeditor/designerpropertymap.cpp",
|
||||||
"propertyeditor/designerpropertymap.h",
|
"propertyeditor/designerpropertymap.h",
|
||||||
"propertyeditor/fileresourcesmodel.cpp",
|
"propertyeditor/fileresourcesmodel.cpp",
|
||||||
|
|||||||
@@ -160,6 +160,14 @@ extend_qtc_executable(qml2puppet
|
|||||||
DEFINES IMPORT_QUICK3D_ASSETS
|
DEFINES IMPORT_QUICK3D_ASSETS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
find_package(Qt5 5.15.0 COMPONENTS Quick3DParticles QUIET)
|
||||||
|
extend_qtc_executable(qml2puppet
|
||||||
|
CONDITION TARGET Qt5::Quick3DParticles
|
||||||
|
FEATURE_INFO "Qt Quick 3D particles"
|
||||||
|
DEPENDS Qt5::Quick3DParticles Qt5::Quick3DParticlesPrivate
|
||||||
|
DEFINES QUICK3D_PARTICLES_MODULE
|
||||||
|
)
|
||||||
|
|
||||||
extend_qtc_executable(qml2puppet
|
extend_qtc_executable(qml2puppet
|
||||||
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.0.0
|
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.0.0
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,15 @@ QtcTool {
|
|||||||
Depends { name: "Qt.quick3d-private"; required: false }
|
Depends { name: "Qt.quick3d-private"; required: false }
|
||||||
property bool useQuick3d: Utilities.versionCompare(Qt.core.version, "5.15") >= 0
|
property bool useQuick3d: Utilities.versionCompare(Qt.core.version, "5.15") >= 0
|
||||||
&& Qt["quick3d-private"].present
|
&& Qt["quick3d-private"].present
|
||||||
|
property bool useParticle3d: Utilities.versionCompare(Qt.core.version, "6.2") >= 0
|
||||||
|
&& Qt["quick3dparticles-private"].present
|
||||||
|
|
||||||
cpp.defines: {
|
cpp.defines: {
|
||||||
var defines = base.filter(function(d) { return d != "QT_CREATOR"; });
|
var defines = base.filter(function(d) { return d != "QT_CREATOR"; });
|
||||||
if (useQuick3d)
|
if (useQuick3d)
|
||||||
defines.push("QUICK3D_MODULE");
|
defines.push("QUICK3D_MODULE");
|
||||||
|
if (useParticle3d)
|
||||||
|
defines.push("QUICK3D_PARTICLES_MODULE");
|
||||||
return defines;
|
return defines;
|
||||||
}
|
}
|
||||||
Properties {
|
Properties {
|
||||||
|
|||||||
@@ -23,7 +23,10 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
import __builtin__
|
try:
|
||||||
|
import __builtin__ # Python 2
|
||||||
|
except ImportError:
|
||||||
|
import builtins as __builtin__ # Python 3
|
||||||
|
|
||||||
# for easier re-usage (because Python hasn't an enum type)
|
# for easier re-usage (because Python hasn't an enum type)
|
||||||
class Targets:
|
class Targets:
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i
|
|||||||
|
|
||||||
def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
|
def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
|
||||||
directoryEdit = waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' "
|
directoryEdit = waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' "
|
||||||
"toolTip?='Full path: *'}")
|
"toolTip~='Full path: .*'}")
|
||||||
replaceEditorContent(directoryEdit, path)
|
replaceEditorContent(directoryEdit, path)
|
||||||
projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' "
|
projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' "
|
||||||
"type='Utils::FancyLineEdit'}")
|
"type='Utils::FancyLineEdit'}")
|
||||||
@@ -177,8 +177,7 @@ def __selectQtVersionDesktop__(checks, available=None, withoutQt4=False):
|
|||||||
|
|
||||||
def __createProjectHandleLastPage__(expectedFiles=[], addToVersionControl="<None>", addToProject=None):
|
def __createProjectHandleLastPage__(expectedFiles=[], addToVersionControl="<None>", addToProject=None):
|
||||||
if len(expectedFiles):
|
if len(expectedFiles):
|
||||||
summary = waitForObject("{name='filesLabel' text?='<qt>Files to be added in<pre>*</pre>' "
|
summary = waitForObject("{name='filesLabel' type='QLabel'}").text
|
||||||
"type='QLabel' visible='1'}").text
|
|
||||||
verifyItemOrder(expectedFiles, summary)
|
verifyItemOrder(expectedFiles, summary)
|
||||||
if addToProject:
|
if addToProject:
|
||||||
selectFromCombo(":projectComboBox_QComboBox", addToProject)
|
selectFromCombo(":projectComboBox_QComboBox", addToProject)
|
||||||
|
|||||||
@@ -34,7 +34,10 @@ import subprocess;
|
|||||||
import sys
|
import sys
|
||||||
import errno;
|
import errno;
|
||||||
from datetime import datetime,timedelta;
|
from datetime import datetime,timedelta;
|
||||||
import __builtin__
|
try:
|
||||||
|
import __builtin__ # Python 2
|
||||||
|
except ImportError:
|
||||||
|
import builtins as __builtin__ # Python 3
|
||||||
|
|
||||||
srcPath = ''
|
srcPath = ''
|
||||||
SettingsPath = []
|
SettingsPath = []
|
||||||
@@ -120,7 +123,7 @@ def waitForCleanShutdown(timeOut=10):
|
|||||||
while not shutdownDone:
|
while not shutdownDone:
|
||||||
try:
|
try:
|
||||||
os.kill(appCtxt.pid,0)
|
os.kill(appCtxt.pid,0)
|
||||||
except OSError, err:
|
except OSError as err:
|
||||||
if err.errno == errno.EPERM or err.errno == errno.ESRCH:
|
if err.errno == errno.EPERM or err.errno == errno.ESRCH:
|
||||||
shutdownDone=True
|
shutdownDone=True
|
||||||
if not shutdownDone and datetime.utcnow() > endtime:
|
if not shutdownDone and datetime.utcnow() > endtime:
|
||||||
@@ -208,7 +211,7 @@ def substituteCdb(settingsDir):
|
|||||||
try:
|
try:
|
||||||
serverIni = readFile(os.path.join(os.getenv("APPDATA"), "froglogic",
|
serverIni = readFile(os.path.join(os.getenv("APPDATA"), "froglogic",
|
||||||
"Squish", "ver1", "server.ini"))
|
"Squish", "ver1", "server.ini"))
|
||||||
autLine = filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines())[0]
|
autLine = list(filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines()))[0]
|
||||||
autPath = autLine.split("\"")[1]
|
autPath = autLine.split("\"")[1]
|
||||||
return os.path.exists(os.path.join(autPath, "..", "lib", "qtcreatorcdbext64"))
|
return os.path.exists(os.path.join(autPath, "..", "lib", "qtcreatorcdbext64"))
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
import __builtin__
|
|
||||||
|
|
||||||
# appends to line, by typing <typeWhat> after <insertAfterLine> text into <codeArea> widget
|
# appends to line, by typing <typeWhat> after <insertAfterLine> text into <codeArea> widget
|
||||||
def appendToLine(codeArea, insertAfterLine, typeWhat):
|
def appendToLine(codeArea, insertAfterLine, typeWhat):
|
||||||
if not placeCursorToLine(codeArea, insertAfterLine):
|
if not placeCursorToLine(codeArea, insertAfterLine):
|
||||||
|
|||||||
@@ -23,7 +23,10 @@
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
import urllib2
|
try:
|
||||||
|
from urllib2 import ProxyHandler, build_opener, install_opener, urlopen # Python 2
|
||||||
|
except ImportError:
|
||||||
|
from urllib.request import ProxyHandler, build_opener, install_opener, urlopen # Python 3
|
||||||
|
|
||||||
################ workarounds for issues tracked inside jira #################
|
################ workarounds for issues tracked inside jira #################
|
||||||
|
|
||||||
@@ -43,7 +46,7 @@ class JIRA:
|
|||||||
def __init__(self, number, bugType=Bug.CREATOR):
|
def __init__(self, number, bugType=Bug.CREATOR):
|
||||||
if JIRA.__instance__ == None:
|
if JIRA.__instance__ == None:
|
||||||
JIRA.__instance__ = JIRA.__impl(number, bugType)
|
JIRA.__instance__ = JIRA.__impl(number, bugType)
|
||||||
JIRA.__dict__['_JIRA__instance__'] = JIRA.__instance__
|
setattr(JIRA, '__instance__', JIRA.__instance__)
|
||||||
else:
|
else:
|
||||||
JIRA.__instance__._bugType = bugType
|
JIRA.__instance__._bugType = bugType
|
||||||
JIRA.__instance__._number = number
|
JIRA.__instance__._number = number
|
||||||
@@ -102,10 +105,10 @@ class JIRA:
|
|||||||
proxy = os.getenv("SYSTEST_PROXY", None)
|
proxy = os.getenv("SYSTEST_PROXY", None)
|
||||||
try:
|
try:
|
||||||
if proxy:
|
if proxy:
|
||||||
proxy = urllib2.ProxyHandler({'https': proxy})
|
proxy = ProxyHandler({'https': proxy})
|
||||||
opener = urllib2.build_opener(proxy)
|
opener = build_opener(proxy)
|
||||||
urllib2.install_opener(opener)
|
install_opener(opener)
|
||||||
bugReport = urllib2.urlopen('%s/%s' % (JIRA_URL, bug))
|
bugReport = urlopen('%s/%s' % (JIRA_URL, bug))
|
||||||
data = bugReport.read()
|
data = bugReport.read()
|
||||||
except:
|
except:
|
||||||
data = self.__tryExternalTools__(proxy)
|
data = self.__tryExternalTools__(proxy)
|
||||||
@@ -118,6 +121,8 @@ class JIRA:
|
|||||||
test.fatal("No resolution info for %s" % bug)
|
test.fatal("No resolution info for %s" % bug)
|
||||||
self._resolution = 'Done'
|
self._resolution = 'Done'
|
||||||
else:
|
else:
|
||||||
|
if isinstance(data, (bytes)):
|
||||||
|
data = str(data)
|
||||||
data = data.replace("\r", "").replace("\n", "")
|
data = data.replace("\r", "").replace("\n", "")
|
||||||
resPattern = re.compile('<span\s+id="resolution-val".*?>(?P<resolution>.*?)</span>')
|
resPattern = re.compile('<span\s+id="resolution-val".*?>(?P<resolution>.*?)</span>')
|
||||||
resolution = resPattern.search(data)
|
resolution = resPattern.search(data)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ source("../../shared/qtcreator.py")
|
|||||||
# test Qt Creator version information from file and dialog
|
# test Qt Creator version information from file and dialog
|
||||||
def getQtCreatorVersionFromDialog():
|
def getQtCreatorVersionFromDialog():
|
||||||
chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+[-\w]*",
|
chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+[-\w]*",
|
||||||
str(waitForObject("{text?='*Qt Creator*' type='QLabel' unnamed='1' visible='1' "
|
str(waitForObject("{text~='.*Qt Creator.*' type='QLabel' unnamed='1' visible='1' "
|
||||||
"window=':About Qt Creator_Core::Internal::VersionDialog'}").text))
|
"window=':About Qt Creator_Core::Internal::VersionDialog'}").text))
|
||||||
try:
|
try:
|
||||||
ver = chk.group(0).strip()
|
ver = chk.group(0).strip()
|
||||||
|
|||||||
@@ -117,10 +117,12 @@ def performTest(workingDir, projectName, availableConfigs):
|
|||||||
% (selfPercent, totalPercent))
|
% (selfPercent, totalPercent))
|
||||||
if str(model.index(row, colCalls).data()) == "1":
|
if str(model.index(row, colCalls).data()) == "1":
|
||||||
for col in [colMedian, colLongest, colShortest]:
|
for col in [colMedian, colLongest, colShortest]:
|
||||||
test.compare(model.index(row, colMean).data(), model.index(row, col).data(),
|
test.compare(str(model.index(row, colMean).data()),
|
||||||
|
str(model.index(row, col).data()),
|
||||||
"For just one call, no differences in execution time may be shown.")
|
"For just one call, no differences in execution time may be shown.")
|
||||||
elif str(model.index(row, colCalls).data()) == "2":
|
elif str(model.index(row, colCalls).data()) == "2":
|
||||||
test.compare(model.index(row, colMedian).data(), model.index(row, colMean).data(),
|
test.compare(str(model.index(row, colMedian).data()),
|
||||||
|
str(model.index(row, colMean).data()),
|
||||||
"For two calls, median and mean time must be the same.")
|
"For two calls, median and mean time must be the same.")
|
||||||
progressBarWait(15000, False) # wait for "Build" progressbar to disappear
|
progressBarWait(15000, False) # wait for "Build" progressbar to disappear
|
||||||
clickButton(waitForObject(":Analyzer Toolbar.Clear_QToolButton"))
|
clickButton(waitForObject(":Analyzer Toolbar.Clear_QToolButton"))
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
source("../../shared/qtcreator.py")
|
source("../../shared/qtcreator.py")
|
||||||
import __builtin__
|
|
||||||
|
|
||||||
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
|
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
|
||||||
originalSources = os.path.abspath(os.path.join(os.getcwd(), "..", "shared", "simplePlainCPP"))
|
originalSources = os.path.abspath(os.path.join(os.getcwd(), "..", "shared", "simplePlainCPP"))
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ def main():
|
|||||||
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
|
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
|
||||||
continue
|
continue
|
||||||
test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor")
|
test.compare(filenameCombo.currentText, "%s: %s" % (protocol, pasteId), "Verify title of editor")
|
||||||
if protocol in (NAME_DPCOM) and pastedText.endswith("\n"):
|
if protocol in (NAME_DPCOM, NAME_PBCOM) and pastedText.endswith("\n"):
|
||||||
pastedText = pastedText[:-1]
|
pastedText = pastedText[:-1]
|
||||||
test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
|
test.compare(editor.plainText, pastedText, "Verify that pasted and fetched texts are the same")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user