Merge remote-tracking branch 'origin/4.12'
Change-Id: I04d9cc69a07d4d07b1bf1df57681d6a68587d7ba
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 17 KiB |
BIN
doc/qtcreator/images/creator-qbs-profiles.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 5.4 KiB |
@@ -58,10 +58,7 @@
|
|||||||
\list 1
|
\list 1
|
||||||
\li To generate debug symbols also for applications compiled in release
|
\li To generate debug symbols also for applications compiled in release
|
||||||
mode, select \uicontrol {Projects}, and then select
|
mode, select \uicontrol {Projects}, and then select
|
||||||
\uicontrol Details next to \uicontrol {Build Steps} to view the
|
\uicontrol Enable in the \uicontrol {Separate debug info} field.
|
||||||
build steps.
|
|
||||||
|
|
||||||
\li Select the \uicontrol {Generate separate debug info} check box.
|
|
||||||
|
|
||||||
\li Select \uicontrol Yes to recompile the project.
|
\li Select \uicontrol Yes to recompile the project.
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
\li Debugging is enabled by default for Qt 5.0, or later.
|
\li Debugging is enabled by default for Qt 5.0, or later.
|
||||||
|
|
||||||
\image qml-link-debugging-library.png "Build Steps"
|
\image qtcreator-projectpane.png "qmake general build settings pane"
|
||||||
|
|
||||||
\note Debugging requires opening a socket at a TCP port,
|
\note Debugging requires opening a socket at a TCP port,
|
||||||
which presents a security risk. Anyone on the Internet could connect
|
which presents a security risk. Anyone on the Internet could connect
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the Qt Creator documentation.
|
** This file is part of the Qt Creator documentation.
|
||||||
@@ -58,8 +58,9 @@
|
|||||||
for building and running projects, select \uicontrol Tools >
|
for building and running projects, select \uicontrol Tools >
|
||||||
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol General. The
|
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol General. The
|
||||||
\uicontrol CMake tab contains additional settings for CMake. You can find
|
\uicontrol CMake tab contains additional settings for CMake. You can find
|
||||||
more settings for CMake and Qbs in \uicontrol Tools > \uicontrol Options >
|
more settings for CMake in \uicontrol Tools > \uicontrol Options >
|
||||||
\uicontrol Kits > \uicontrol CMake and \uicontrol Qbs.
|
\uicontrol Kits > \uicontrol CMake and for Qbs in \uicontrol Tools >
|
||||||
|
\uicontrol Options > \uicontrol Qbs.
|
||||||
|
|
||||||
To specify build and run settings for different target platforms,
|
To specify build and run settings for different target platforms,
|
||||||
select \uicontrol Projects. For more information on the options you have,
|
select \uicontrol Projects. For more information on the options you have,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the Qt Creator documentation.
|
** This file is part of the Qt Creator documentation.
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
kit. You can edit the build profiles by adding new keys and values.
|
kit. You can edit the build profiles by adding new keys and values.
|
||||||
|
|
||||||
To check which Qbs version is being used, select \uicontrol Tools >
|
To check which Qbs version is being used, select \uicontrol Tools >
|
||||||
\uicontrol Options > \uicontrol Kits > \uicontrol Qbs.
|
\uicontrol Options > \uicontrol Qbs > \uicontrol General.
|
||||||
|
|
||||||
\section1 Building Qbs
|
\section1 Building Qbs
|
||||||
|
|
||||||
@@ -59,22 +59,32 @@
|
|||||||
|
|
||||||
\section1 Specifying Qbs Settings
|
\section1 Specifying Qbs Settings
|
||||||
|
|
||||||
To specify settings for Qbs, select \uicontrol Tools > \uicontrol Options >
|
|
||||||
\uicontrol Kits > \uicontrol Qbs.
|
|
||||||
|
|
||||||
\image qtcreator-options-qbs.png
|
|
||||||
|
|
||||||
By default, Qbs profiles are stored in the \c qbs directory in the \QC
|
By default, Qbs profiles are stored in the \c qbs directory in the \QC
|
||||||
settings directory to ensure that different \QC instances do not overwrite
|
settings directory to ensure that different \QC instances do not overwrite
|
||||||
each other's profiles. If you only run one \QC instance, you can store the
|
each other's profiles. If you only run one \QC instance, you can store the
|
||||||
profiles in the Qbs settings directory instead, by deselecting the
|
profiles in the Qbs settings directory instead.
|
||||||
\uicontrol {Store profiles in \QC settings directory} check box.
|
|
||||||
|
|
||||||
In the \uicontrol Kit field, select a build and run kit to view the
|
To specify settings for Qbs:
|
||||||
properties of the associated Qbs profile. To modify the properties of the
|
|
||||||
Qbs profile associated with a kit, select \uicontrol Tools >
|
\list 1
|
||||||
\uicontrol Options > \uicontrol Kits. For more
|
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Qbs.
|
||||||
information, see \l{Editing Qbs Profiles}.
|
\image qtcreator-options-qbs.png
|
||||||
|
\li Deselect the \uicontrol {Use \QC settings directory for Qbs} check
|
||||||
|
box to store Qbs profiles in the Qbs settings directory.
|
||||||
|
\li In the \uicontrol {Path to qbs executable} field, you can view
|
||||||
|
and change the path to the Qbs executable.
|
||||||
|
The \uicontrol {Qbs version} field displays the version number
|
||||||
|
of the executable.
|
||||||
|
\li In the \uicontrol {Default installation directory} field, you
|
||||||
|
can view and change the Qbs installation directory.
|
||||||
|
\li Select the \uicontrol Profiles tab to specify settings for Qbs
|
||||||
|
profiles.
|
||||||
|
\image creator-qbs-profiles.png "Qbs Profiles tab"
|
||||||
|
\li In the \uicontrol Kit field, select a build and run kit to view
|
||||||
|
the properties of the associated profile. To modify the properties,
|
||||||
|
select \uicontrol Tools > \uicontrol Options > \uicontrol Kits.
|
||||||
|
For more information, see \l{Editing Qbs Profiles}.
|
||||||
|
\endlist
|
||||||
|
|
||||||
\section1 Related Topics
|
\section1 Related Topics
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the Qt Creator documentation.
|
** This file is part of the Qt Creator documentation.
|
||||||
@@ -41,15 +41,6 @@
|
|||||||
\li In the \uicontrol {Parallel jobs} field, specify the number of
|
\li In the \uicontrol {Parallel jobs} field, specify the number of
|
||||||
parallel jobs to use for building.
|
parallel jobs to use for building.
|
||||||
|
|
||||||
\li Select the \uicontrol {Enable QML debugging} check box to debug
|
|
||||||
Qt Quick application projects.
|
|
||||||
|
|
||||||
\note Debugging requires opening a socket at a well-known
|
|
||||||
port, which presents a security risk. Anyone on the Internet
|
|
||||||
could connect to the application that you are debugging and
|
|
||||||
execute any JavaScript functions. Therefore, you must make
|
|
||||||
sure that the port is properly protected by a firewall.
|
|
||||||
|
|
||||||
\li In the \uicontrol Properties field, specify the properties to pass
|
\li In the \uicontrol Properties field, specify the properties to pass
|
||||||
to the project. Use colons (:) to separate keys from values.
|
to the project. Use colons (:) to separate keys from values.
|
||||||
For more information, see
|
For more information, see
|
||||||
@@ -70,6 +61,13 @@
|
|||||||
\li Select \uicontrol {Force probes} to force re-execution of
|
\li Select \uicontrol {Force probes} to force re-execution of
|
||||||
the configure scripts of
|
the configure scripts of
|
||||||
\l{https://doc.qt.io/qbs/probe-item.html}{Probes}.
|
\l{https://doc.qt.io/qbs/probe-item.html}{Probes}.
|
||||||
|
\li In the \uicontrol Flags field:
|
||||||
|
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
\li In the \uicontrol {Installation flags} field:
|
||||||
|
|
||||||
|
\list
|
||||||
|
|
||||||
\li Select \uicontrol Install to copy artifacts to their install
|
\li Select \uicontrol Install to copy artifacts to their install
|
||||||
location after building them. This option is enabled by
|
location after building them. This option is enabled by
|
||||||
|
|||||||
@@ -59,9 +59,12 @@
|
|||||||
Select the build configuration to edit in the
|
Select the build configuration to edit in the
|
||||||
\uicontrol {Edit build configuration} field.
|
\uicontrol {Edit build configuration} field.
|
||||||
|
|
||||||
|
The available build settings depend on the build system that you selected
|
||||||
|
for the project.
|
||||||
|
|
||||||
\section2 qmake Build Configuration
|
\section2 qmake Build Configuration
|
||||||
|
|
||||||
\image qtcreator-projectpane.png
|
\image qtcreator-projectpane.png "qmake general build settings pane"
|
||||||
|
|
||||||
By default, \QC builds projects in a separate directory from the source
|
By default, \QC builds projects in a separate directory from the source
|
||||||
directory, as \l{glossary-shadow-build} {shadow builds}. This keeps the
|
directory, as \l{glossary-shadow-build} {shadow builds}. This keeps the
|
||||||
@@ -80,6 +83,30 @@
|
|||||||
{scopes} to select the file to process depending on which platform qmake is
|
{scopes} to select the file to process depending on which platform qmake is
|
||||||
run on.
|
run on.
|
||||||
|
|
||||||
|
To generate debug symbols also for applications compiled in release mode,
|
||||||
|
select \uicontrol Enable in the \uicontrol {Separate debug info} field. For
|
||||||
|
more information, see \l{Using the Performance Analyzer}. To use default
|
||||||
|
settings, select \uicontrol {Leave at Default}.
|
||||||
|
|
||||||
|
To set the default build properties, select \uicontrol Tools
|
||||||
|
> \uicontrol Options > \uicontrol {Build & Run} >
|
||||||
|
\uicontrol {Default Build Properties}.
|
||||||
|
|
||||||
|
\section3 Compiling QML
|
||||||
|
|
||||||
|
Since Qt 5.11, you can compile QML source code into the final binary. This
|
||||||
|
improves the startup time of the application and eliminates the need to
|
||||||
|
deploy QML files together with the application. For more information, see
|
||||||
|
\l{Ahead-of-Time Compilation}.
|
||||||
|
|
||||||
|
\QC new project wizards create Qt Quick projects that can be compiled,
|
||||||
|
because they are set up to use the Qt Resource System. To compile Qt Quick
|
||||||
|
code, select \uicontrol Enable in the \uicontrol {Qt Quick Compiler}
|
||||||
|
field. To use default settings, select \uicontrol {Leave at Default}.
|
||||||
|
|
||||||
|
\note In earlier Qt versions, this was a commercial feature. For more
|
||||||
|
information, see \l{http://doc.qt.io/QtQuickCompiler/}{Qt Quick Compiler}.
|
||||||
|
|
||||||
\include creator-projects-cmake-building.qdocinc cmake build configuration
|
\include creator-projects-cmake-building.qdocinc cmake build configuration
|
||||||
|
|
||||||
\section1 Starting External Processes
|
\section1 Starting External Processes
|
||||||
@@ -174,24 +201,6 @@
|
|||||||
\uicontrol {Override MAKEFLAGS} check box to override existing MAKEFLAGS
|
\uicontrol {Override MAKEFLAGS} check box to override existing MAKEFLAGS
|
||||||
variables.
|
variables.
|
||||||
|
|
||||||
To generate debug symbols also for applications compiled in release mode,
|
|
||||||
select the \uicontrol {Generate separate debug info} check box. For more
|
|
||||||
information, see \l{Using the Performance Analyzer}.
|
|
||||||
|
|
||||||
\section3 Compiling QML
|
|
||||||
|
|
||||||
Since Qt 5.11, you can compile QML source code into the final binary. This
|
|
||||||
improves the startup time of the application and eliminates the need to
|
|
||||||
deploy QML files together with the application. For more information, see
|
|
||||||
\l{Ahead-of-Time Compilation}.
|
|
||||||
|
|
||||||
\QC new project wizards create Qt Quick projects that can be compiled,
|
|
||||||
because they are set up to use the Qt Resource System. To compile Qt Quick
|
|
||||||
projects, select the \uicontrol {Enable Qt Quick Compiler} check box.
|
|
||||||
|
|
||||||
\note In earlier Qt versions, this was a commercial feature. For more
|
|
||||||
information, see \l{http://doc.qt.io/QtQuickCompiler/}{Qt Quick Compiler}.
|
|
||||||
|
|
||||||
\include creator-projects-cmake-building.qdocinc cmake build steps
|
\include creator-projects-cmake-building.qdocinc cmake build steps
|
||||||
\include creator-projects-settings-build-qbs.qdocinc qbs build steps
|
\include creator-projects-settings-build-qbs.qdocinc qbs build steps
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,9 @@
|
|||||||
\section1 Editing Qbs Profiles
|
\section1 Editing Qbs Profiles
|
||||||
|
|
||||||
To view the Qbs profile associated with the kit, select \uicontrol Tools >
|
To view the Qbs profile associated with the kit, select \uicontrol Tools >
|
||||||
\uicontrol Options > \uicontrol Kits > \uicontrol Qbs.
|
\uicontrol Options > \uicontrol Qbs > \uicontrol Profiles.
|
||||||
|
|
||||||
|
\image creator-qbs-profiles.png "Qbs Profiles tab"
|
||||||
|
|
||||||
You can add keys and values to the profile or remove them from it, as well
|
You can add keys and values to the profile or remove them from it, as well
|
||||||
as modify existing values. For a list of available keys and values, see
|
as modify existing values. For a list of available keys and values, see
|
||||||
@@ -214,7 +216,7 @@
|
|||||||
\uicontrol {Additional Qbs Profile Settings} field to open the
|
\uicontrol {Additional Qbs Profile Settings} field to open the
|
||||||
\uicontrol {Custom Properties} dialog.
|
\uicontrol {Custom Properties} dialog.
|
||||||
|
|
||||||
\image qtcreator-qbs-profile-settings.
|
\image qtcreator-qbs-profile-settings.png "Custom Properties dialog"
|
||||||
|
|
||||||
\li Double-click an empty cell in the \uicontrol Key column to specify
|
\li Double-click an empty cell in the \uicontrol Key column to specify
|
||||||
the key to add or modify as: \c <module_name>.<property_name>.
|
the key to add or modify as: \c <module_name>.<property_name>.
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ HEADERS += $$PWD/changeauxiliarycommand.h
|
|||||||
HEADERS += $$PWD/removesharedmemorycommand.h
|
HEADERS += $$PWD/removesharedmemorycommand.h
|
||||||
HEADERS += $$PWD/puppetalivecommand.h
|
HEADERS += $$PWD/puppetalivecommand.h
|
||||||
HEADERS += $$PWD/changeselectioncommand.h
|
HEADERS += $$PWD/changeselectioncommand.h
|
||||||
HEADERS += $$PWD/drop3dlibraryitemcommand.h
|
|
||||||
HEADERS += $$PWD/update3dviewstatecommand.h
|
HEADERS += $$PWD/update3dviewstatecommand.h
|
||||||
HEADERS += $$PWD/view3dclosedcommand.h
|
|
||||||
HEADERS += $$PWD/puppettocreatorcommand.h
|
HEADERS += $$PWD/puppettocreatorcommand.h
|
||||||
HEADERS += $$PWD/inputeventcommand.h
|
HEADERS += $$PWD/inputeventcommand.h
|
||||||
HEADERS += $$PWD/view3dactioncommand.h
|
HEADERS += $$PWD/view3dactioncommand.h
|
||||||
@@ -61,9 +59,7 @@ SOURCES += $$PWD/changeauxiliarycommand.cpp
|
|||||||
SOURCES += $$PWD/removesharedmemorycommand.cpp
|
SOURCES += $$PWD/removesharedmemorycommand.cpp
|
||||||
SOURCES += $$PWD/puppetalivecommand.cpp
|
SOURCES += $$PWD/puppetalivecommand.cpp
|
||||||
SOURCES += $$PWD/changeselectioncommand.cpp
|
SOURCES += $$PWD/changeselectioncommand.cpp
|
||||||
SOURCES += $$PWD/drop3dlibraryitemcommand.cpp
|
|
||||||
SOURCES += $$PWD/update3dviewstatecommand.cpp
|
SOURCES += $$PWD/update3dviewstatecommand.cpp
|
||||||
SOURCES += $$PWD/view3dclosedcommand.cpp
|
|
||||||
SOURCES += $$PWD/puppettocreatorcommand.cpp
|
SOURCES += $$PWD/puppettocreatorcommand.cpp
|
||||||
SOURCES += $$PWD/inputeventcommand.cpp
|
SOURCES += $$PWD/inputeventcommand.cpp
|
||||||
SOURCES += $$PWD/view3dactioncommand.cpp
|
SOURCES += $$PWD/view3dactioncommand.cpp
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2019 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "drop3dlibraryitemcommand.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
Drop3DLibraryItemCommand::Drop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId)
|
|
||||||
: m_itemData(itemData),
|
|
||||||
m_sceneRootId(sceneRootId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const Drop3DLibraryItemCommand &command)
|
|
||||||
{
|
|
||||||
out << command.itemData();
|
|
||||||
out << command.sceneRootId();
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator>>(QDataStream &in, Drop3DLibraryItemCommand &command)
|
|
||||||
{
|
|
||||||
in >> command.m_itemData;
|
|
||||||
in >> command.m_sceneRootId;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const Drop3DLibraryItemCommand &first, const Drop3DLibraryItemCommand &second)
|
|
||||||
{
|
|
||||||
return first.m_itemData == second.m_itemData && first.m_sceneRootId == second.m_sceneRootId;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2019 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QMimeData>
|
|
||||||
|
|
||||||
#include "instancecontainer.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class Drop3DLibraryItemCommand
|
|
||||||
{
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, Drop3DLibraryItemCommand &command);
|
|
||||||
friend QDebug operator<<(QDebug debug, const Drop3DLibraryItemCommand &command);
|
|
||||||
friend bool operator==(const Drop3DLibraryItemCommand &first,
|
|
||||||
const Drop3DLibraryItemCommand &second);
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit Drop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId);
|
|
||||||
Drop3DLibraryItemCommand() = default;
|
|
||||||
|
|
||||||
QByteArray itemData() const { return m_itemData; }
|
|
||||||
qint32 sceneRootId() const { return m_sceneRootId; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
QByteArray m_itemData;
|
|
||||||
qint32 m_sceneRootId;
|
|
||||||
};
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const Drop3DLibraryItemCommand &command);
|
|
||||||
QDataStream &operator>>(QDataStream &in, Drop3DLibraryItemCommand &command);
|
|
||||||
bool operator==(const Drop3DLibraryItemCommand &first, const Drop3DLibraryItemCommand &second);
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QmlDesigner::Drop3DLibraryItemCommand)
|
|
||||||
@@ -34,7 +34,7 @@ namespace QmlDesigner {
|
|||||||
class PuppetToCreatorCommand
|
class PuppetToCreatorCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type { KeyPressed, Edit3DToolState, Render3DView, ActiveSceneChanged, None };
|
enum Type { Edit3DToolState, Render3DView, ActiveSceneChanged, None };
|
||||||
|
|
||||||
PuppetToCreatorCommand(Type type, const QVariant &data);
|
PuppetToCreatorCommand(Type type, const QVariant &data);
|
||||||
PuppetToCreatorCommand() = default;
|
PuppetToCreatorCommand() = default;
|
||||||
|
|||||||
@@ -30,47 +30,12 @@
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
Update3dViewStateCommand::Update3dViewStateCommand(Qt::WindowStates previousStates,
|
|
||||||
Qt::WindowStates currentStates)
|
|
||||||
: m_previousStates(previousStates)
|
|
||||||
, m_currentStates(currentStates)
|
|
||||||
, m_type(Update3dViewStateCommand::StateChange)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Update3dViewStateCommand::Update3dViewStateCommand(bool active, bool hasPopup)
|
|
||||||
: m_active(active)
|
|
||||||
, m_hasPopup(hasPopup)
|
|
||||||
, m_type(Update3dViewStateCommand::ActiveChange)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Update3dViewStateCommand::Update3dViewStateCommand(const QSize &size)
|
Update3dViewStateCommand::Update3dViewStateCommand(const QSize &size)
|
||||||
: m_size(size)
|
: m_size(size)
|
||||||
, m_type(Update3dViewStateCommand::SizeChange)
|
, m_type(Update3dViewStateCommand::SizeChange)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::WindowStates Update3dViewStateCommand::previousStates() const
|
|
||||||
{
|
|
||||||
return m_previousStates;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::WindowStates Update3dViewStateCommand::currentStates() const
|
|
||||||
{
|
|
||||||
return m_currentStates;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Update3dViewStateCommand::isActive() const
|
|
||||||
{
|
|
||||||
return m_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Update3dViewStateCommand::hasPopup() const
|
|
||||||
{
|
|
||||||
return m_hasPopup;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize Update3dViewStateCommand::size() const
|
QSize Update3dViewStateCommand::size() const
|
||||||
{
|
{
|
||||||
return m_size;
|
return m_size;
|
||||||
@@ -83,10 +48,6 @@ Update3dViewStateCommand::Type Update3dViewStateCommand::type() const
|
|||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command)
|
QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command)
|
||||||
{
|
{
|
||||||
out << command.previousStates();
|
|
||||||
out << command.currentStates();
|
|
||||||
out << qint32(command.isActive());
|
|
||||||
out << qint32(command.hasPopup());
|
|
||||||
out << qint32(command.type());
|
out << qint32(command.type());
|
||||||
out << command.size();
|
out << command.size();
|
||||||
|
|
||||||
@@ -95,16 +56,8 @@ QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &comman
|
|||||||
|
|
||||||
QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command)
|
QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command)
|
||||||
{
|
{
|
||||||
in >> command.m_previousStates;
|
|
||||||
in >> command.m_currentStates;
|
|
||||||
qint32 active;
|
|
||||||
qint32 hasPopup;
|
|
||||||
qint32 type;
|
qint32 type;
|
||||||
in >> active;
|
|
||||||
in >> hasPopup;
|
|
||||||
in >> type;
|
in >> type;
|
||||||
command.m_active = active;
|
|
||||||
command.m_hasPopup = hasPopup;
|
|
||||||
command.m_type = Update3dViewStateCommand::Type(type);
|
command.m_type = Update3dViewStateCommand::Type(type);
|
||||||
in >> command.m_size;
|
in >> command.m_size;
|
||||||
|
|
||||||
|
|||||||
@@ -36,28 +36,15 @@ class Update3dViewStateCommand
|
|||||||
friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
|
friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Type { StateChange, ActiveChange, SizeChange, Empty };
|
enum Type { SizeChange, Empty };
|
||||||
|
|
||||||
explicit Update3dViewStateCommand(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
|
|
||||||
explicit Update3dViewStateCommand(bool active, bool hasPopup);
|
|
||||||
explicit Update3dViewStateCommand(const QSize &size);
|
explicit Update3dViewStateCommand(const QSize &size);
|
||||||
Update3dViewStateCommand() = default;
|
Update3dViewStateCommand() = default;
|
||||||
|
|
||||||
Qt::WindowStates previousStates() const;
|
|
||||||
Qt::WindowStates currentStates() const;
|
|
||||||
|
|
||||||
bool isActive() const;
|
|
||||||
bool hasPopup() const;
|
|
||||||
QSize size() const;
|
QSize size() const;
|
||||||
|
|
||||||
Type type() const;
|
Type type() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Qt::WindowStates m_previousStates = Qt::WindowNoState;
|
|
||||||
Qt::WindowStates m_currentStates = Qt::WindowNoState;
|
|
||||||
|
|
||||||
bool m_active = false;
|
|
||||||
bool m_hasPopup = false;
|
|
||||||
QSize m_size;
|
QSize m_size;
|
||||||
|
|
||||||
Type m_type = Empty;
|
Type m_type = Empty;
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "view3dclosedcommand.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
View3DClosedCommand::View3DClosedCommand() = default;
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const View3DClosedCommand &/*command*/)
|
|
||||||
{
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator>>(QDataStream &in, View3DClosedCommand &/*command*/)
|
|
||||||
{
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const View3DClosedCommand &/*command*/)
|
|
||||||
{
|
|
||||||
return debug.nospace() << "View3DClosedCommand()";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <qmetatype.h>
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class View3DClosedCommand
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
View3DClosedCommand();
|
|
||||||
};
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const View3DClosedCommand &command);
|
|
||||||
QDataStream &operator>>(QDataStream &in, View3DClosedCommand &command);
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const View3DClosedCommand &command);
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QmlDesigner::View3DClosedCommand)
|
|
||||||
@@ -71,8 +71,6 @@
|
|||||||
#include "debugoutputcommand.h"
|
#include "debugoutputcommand.h"
|
||||||
#include "puppetalivecommand.h"
|
#include "puppetalivecommand.h"
|
||||||
#include "changeselectioncommand.h"
|
#include "changeselectioncommand.h"
|
||||||
#include "drop3dlibraryitemcommand.h"
|
|
||||||
#include "view3dclosedcommand.h"
|
|
||||||
#include "puppettocreatorcommand.h"
|
#include "puppettocreatorcommand.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -152,7 +150,6 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand)
|
|||||||
static const int tokenCommandType = QMetaType::type("TokenCommand");
|
static const int tokenCommandType = QMetaType::type("TokenCommand");
|
||||||
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
|
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
|
||||||
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
|
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
|
||||||
static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand");
|
|
||||||
|
|
||||||
if (command.userType() == controlCommand.userType()) {
|
if (command.userType() == controlCommand.userType()) {
|
||||||
if (command.userType() == informationChangedCommandType)
|
if (command.userType() == informationChangedCommandType)
|
||||||
@@ -177,8 +174,6 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand)
|
|||||||
return command.value<DebugOutputCommand>() == controlCommand.value<DebugOutputCommand>();
|
return command.value<DebugOutputCommand>() == controlCommand.value<DebugOutputCommand>();
|
||||||
else if (command.userType() == changeSelectionCommandType)
|
else if (command.userType() == changeSelectionCommandType)
|
||||||
return command.value<ChangeSelectionCommand>() == controlCommand.value<ChangeSelectionCommand>();
|
return command.value<ChangeSelectionCommand>() == controlCommand.value<ChangeSelectionCommand>();
|
||||||
else if (command.userType() == drop3DLibraryItemCommandType)
|
|
||||||
return command.value<Drop3DLibraryItemCommand>() == controlCommand.value<Drop3DLibraryItemCommand>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -266,21 +261,11 @@ void NodeInstanceClientProxy::selectionChanged(const ChangeSelectionCommand &com
|
|||||||
writeCommand(QVariant::fromValue(command));
|
writeCommand(QVariant::fromValue(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeInstanceClientProxy::library3DItemDropped(const Drop3DLibraryItemCommand &command)
|
|
||||||
{
|
|
||||||
writeCommand(QVariant::fromValue(command));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceClientProxy::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command)
|
void NodeInstanceClientProxy::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command)
|
||||||
{
|
{
|
||||||
writeCommand(QVariant::fromValue(command));
|
writeCommand(QVariant::fromValue(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeInstanceClientProxy::view3DClosed(const View3DClosedCommand &command)
|
|
||||||
{
|
|
||||||
writeCommand(QVariant::fromValue(command));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceClientProxy::flush()
|
void NodeInstanceClientProxy::flush()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ class ChangeStateCommand;
|
|||||||
class ChangeNodeSourceCommand;
|
class ChangeNodeSourceCommand;
|
||||||
class EndPuppetCommand;
|
class EndPuppetCommand;
|
||||||
class ChangeSelectionCommand;
|
class ChangeSelectionCommand;
|
||||||
class Drop3DLibraryItemCommand;
|
|
||||||
class PuppetToCreatorCommand;
|
class PuppetToCreatorCommand;
|
||||||
class View3DClosedCommand;
|
|
||||||
class InputEventCommand;
|
class InputEventCommand;
|
||||||
class View3DActionCommand;
|
class View3DActionCommand;
|
||||||
|
|
||||||
@@ -82,9 +80,7 @@ public:
|
|||||||
void debugOutput(const DebugOutputCommand &command) override;
|
void debugOutput(const DebugOutputCommand &command) override;
|
||||||
void puppetAlive(const PuppetAliveCommand &command);
|
void puppetAlive(const PuppetAliveCommand &command);
|
||||||
void selectionChanged(const ChangeSelectionCommand &command) override;
|
void selectionChanged(const ChangeSelectionCommand &command) override;
|
||||||
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
|
|
||||||
void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) override;
|
void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) override;
|
||||||
void view3DClosed(const View3DClosedCommand &command) override;
|
|
||||||
|
|
||||||
void flush() override;
|
void flush() override;
|
||||||
void synchronizeWithClientProcess() override;
|
void synchronizeWithClientProcess() override;
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ class RemoveSharedMemoryCommand;
|
|||||||
class DebugOutputCommand;
|
class DebugOutputCommand;
|
||||||
class PuppetAliveCommand;
|
class PuppetAliveCommand;
|
||||||
class ChangeSelectionCommand;
|
class ChangeSelectionCommand;
|
||||||
class Drop3DLibraryItemCommand;
|
|
||||||
class View3DClosedCommand;
|
|
||||||
class PuppetToCreatorCommand;
|
class PuppetToCreatorCommand;
|
||||||
|
|
||||||
class NodeInstanceClientInterface
|
class NodeInstanceClientInterface
|
||||||
@@ -58,8 +56,6 @@ public:
|
|||||||
virtual void token(const TokenCommand &command) = 0;
|
virtual void token(const TokenCommand &command) = 0;
|
||||||
virtual void debugOutput(const DebugOutputCommand &command) = 0;
|
virtual void debugOutput(const DebugOutputCommand &command) = 0;
|
||||||
virtual void selectionChanged(const ChangeSelectionCommand &command) = 0;
|
virtual void selectionChanged(const ChangeSelectionCommand &command) = 0;
|
||||||
virtual void library3DItemDropped(const Drop3DLibraryItemCommand &command) = 0;
|
|
||||||
virtual void view3DClosed(const View3DClosedCommand &command) = 0;
|
|
||||||
virtual void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) = 0;
|
virtual void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) = 0;
|
||||||
|
|
||||||
virtual void flush() {}
|
virtual void flush() {}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
#include "addimportcontainer.h"
|
#include "addimportcontainer.h"
|
||||||
#include "changenodesourcecommand.h"
|
#include "changenodesourcecommand.h"
|
||||||
#include "changeselectioncommand.h"
|
#include "changeselectioncommand.h"
|
||||||
#include "drop3dlibraryitemcommand.h"
|
|
||||||
#include "inputeventcommand.h"
|
#include "inputeventcommand.h"
|
||||||
#include "view3dactioncommand.h"
|
#include "view3dactioncommand.h"
|
||||||
|
|
||||||
@@ -64,7 +63,6 @@
|
|||||||
#include "endpuppetcommand.h"
|
#include "endpuppetcommand.h"
|
||||||
#include "debugoutputcommand.h"
|
#include "debugoutputcommand.h"
|
||||||
#include "puppetalivecommand.h"
|
#include "puppetalivecommand.h"
|
||||||
#include "view3dclosedcommand.h"
|
|
||||||
#include "puppettocreatorcommand.h"
|
#include "puppettocreatorcommand.h"
|
||||||
|
|
||||||
#include <enumeration.h>
|
#include <enumeration.h>
|
||||||
@@ -116,9 +114,6 @@ void NodeInstanceServerInterface::registerCommands()
|
|||||||
qRegisterMetaType<ChangeSelectionCommand>("ChangeSelectionCommand");
|
qRegisterMetaType<ChangeSelectionCommand>("ChangeSelectionCommand");
|
||||||
qRegisterMetaTypeStreamOperators<ChangeSelectionCommand>("ChangeSelectionCommand");
|
qRegisterMetaTypeStreamOperators<ChangeSelectionCommand>("ChangeSelectionCommand");
|
||||||
|
|
||||||
qRegisterMetaType<Drop3DLibraryItemCommand>("Drop3DLibraryItemCommand");
|
|
||||||
qRegisterMetaTypeStreamOperators<Drop3DLibraryItemCommand>("Drop3DLibraryItemCommand");
|
|
||||||
|
|
||||||
qRegisterMetaType<RemovePropertiesCommand>("RemovePropertiesCommand");
|
qRegisterMetaType<RemovePropertiesCommand>("RemovePropertiesCommand");
|
||||||
qRegisterMetaTypeStreamOperators<RemovePropertiesCommand>("RemovePropertiesCommand");
|
qRegisterMetaTypeStreamOperators<RemovePropertiesCommand>("RemovePropertiesCommand");
|
||||||
|
|
||||||
@@ -206,9 +201,6 @@ void NodeInstanceServerInterface::registerCommands()
|
|||||||
qRegisterMetaType<PuppetAliveCommand>("PuppetAliveCommand");
|
qRegisterMetaType<PuppetAliveCommand>("PuppetAliveCommand");
|
||||||
qRegisterMetaTypeStreamOperators<PuppetAliveCommand>("PuppetAliveCommand");
|
qRegisterMetaTypeStreamOperators<PuppetAliveCommand>("PuppetAliveCommand");
|
||||||
|
|
||||||
qRegisterMetaType<View3DClosedCommand>("View3DClosedCommand");
|
|
||||||
qRegisterMetaTypeStreamOperators<View3DClosedCommand>("View3DClosedCommand");
|
|
||||||
|
|
||||||
qRegisterMetaType<PuppetToCreatorCommand>("PuppetToCreatorCommand");
|
qRegisterMetaType<PuppetToCreatorCommand>("PuppetToCreatorCommand");
|
||||||
qRegisterMetaTypeStreamOperators<PuppetToCreatorCommand>("PuppetToCreatorCommand");
|
qRegisterMetaTypeStreamOperators<PuppetToCreatorCommand>("PuppetToCreatorCommand");
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,6 @@
|
|||||||
#include <tokencommand.h>
|
#include <tokencommand.h>
|
||||||
#include <removesharedmemorycommand.h>
|
#include <removesharedmemorycommand.h>
|
||||||
#include <changeselectioncommand.h>
|
#include <changeselectioncommand.h>
|
||||||
#include <drop3dlibraryitemcommand.h>
|
|
||||||
#include <inputeventcommand.h>
|
#include <inputeventcommand.h>
|
||||||
#include <view3dactioncommand.h>
|
#include <view3dactioncommand.h>
|
||||||
|
|
||||||
@@ -1178,12 +1177,6 @@ ChangeSelectionCommand NodeInstanceServer::createChangeSelectionCommand(const QL
|
|||||||
return ChangeSelectionCommand(idVector);
|
return ChangeSelectionCommand(idVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
Drop3DLibraryItemCommand NodeInstanceServer::createDrop3DLibraryItemCommand(const QByteArray &itemData,
|
|
||||||
qint32 sceneRootId)
|
|
||||||
{
|
|
||||||
return Drop3DLibraryItemCommand(itemData, sceneRootId);
|
|
||||||
}
|
|
||||||
|
|
||||||
ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVector<InstancePropertyPair> &propertyList) const
|
ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVector<InstancePropertyPair> &propertyList) const
|
||||||
{
|
{
|
||||||
QVector<PropertyValueContainer> valueVector;
|
QVector<PropertyValueContainer> valueVector;
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ class AddImportContainer;
|
|||||||
class MockupTypeContainer;
|
class MockupTypeContainer;
|
||||||
class IdContainer;
|
class IdContainer;
|
||||||
class ChangeSelectionCommand;
|
class ChangeSelectionCommand;
|
||||||
class Drop3DLibraryItemCommand;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class ChildrenChangeEventFilter;
|
class ChildrenChangeEventFilter;
|
||||||
@@ -184,7 +183,6 @@ protected:
|
|||||||
ChildrenChangedCommand createChildrenChangedCommand(const ServerNodeInstance &parentInstance, const QList<ServerNodeInstance> &instanceList) const;
|
ChildrenChangedCommand createChildrenChangedCommand(const ServerNodeInstance &parentInstance, const QList<ServerNodeInstance> &instanceList) const;
|
||||||
ComponentCompletedCommand createComponentCompletedCommand(const QList<ServerNodeInstance> &instanceList);
|
ComponentCompletedCommand createComponentCompletedCommand(const QList<ServerNodeInstance> &instanceList);
|
||||||
ChangeSelectionCommand createChangeSelectionCommand(const QList<ServerNodeInstance> &instanceList);
|
ChangeSelectionCommand createChangeSelectionCommand(const QList<ServerNodeInstance> &instanceList);
|
||||||
Drop3DLibraryItemCommand createDrop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId);
|
|
||||||
|
|
||||||
void addChangedProperty(const InstancePropertyPair &property);
|
void addChangedProperty(const InstancePropertyPair &property);
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,7 @@
|
|||||||
#include "tokencommand.h"
|
#include "tokencommand.h"
|
||||||
#include "removesharedmemorycommand.h"
|
#include "removesharedmemorycommand.h"
|
||||||
#include "objectnodeinstance.h"
|
#include "objectnodeinstance.h"
|
||||||
#include "drop3dlibraryitemcommand.h"
|
|
||||||
#include "puppettocreatorcommand.h"
|
#include "puppettocreatorcommand.h"
|
||||||
#include "view3dclosedcommand.h"
|
|
||||||
#include "inputeventcommand.h"
|
#include "inputeventcommand.h"
|
||||||
#include "view3dactioncommand.h"
|
#include "view3dactioncommand.h"
|
||||||
|
|
||||||
@@ -100,80 +98,9 @@ static QVariant objectToVariant(QObject *object)
|
|||||||
return QVariant::fromValue(object);
|
return QVariant::fromValue(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Qt5InformationNodeInstanceServer::eventFilter(QObject *, QEvent *event)
|
|
||||||
{
|
|
||||||
switch (event->type()) {
|
|
||||||
case QEvent::DragMove: {
|
|
||||||
if (!dropAcceptable(static_cast<QDragMoveEvent *>(event))) {
|
|
||||||
event->ignore();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case QEvent::Drop: {
|
|
||||||
QDropEvent *dropEvent = static_cast<QDropEvent *>(event);
|
|
||||||
QByteArray data = dropEvent->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"));
|
|
||||||
if (!data.isEmpty()) {
|
|
||||||
nodeInstanceClient()->library3DItemDropped(createDrop3DLibraryItemCommand(
|
|
||||||
data, active3DSceneInstance().instanceId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case QEvent::Close: {
|
|
||||||
nodeInstanceClient()->view3DClosed(View3DClosedCommand());
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case QEvent::KeyPress: {
|
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
|
||||||
QPair<int, int> data = {keyEvent->key(), int(keyEvent->modifiers())};
|
|
||||||
nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::KeyPressed,
|
|
||||||
QVariant::fromValue(data)});
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Qt5InformationNodeInstanceServer::dropAcceptable(QDragMoveEvent *event) const
|
|
||||||
{
|
|
||||||
// Note: this method parses data out of the QDataStream. This should be in sync with how the
|
|
||||||
// data is written to the stream (check QDataStream overloaded operators << and >> in
|
|
||||||
// itemlibraryentry.cpp). If the write order changes, this logic may break.
|
|
||||||
QDataStream stream(event->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo")));
|
|
||||||
|
|
||||||
QString name;
|
|
||||||
TypeName typeName;
|
|
||||||
int majorVersion;
|
|
||||||
int minorVersion;
|
|
||||||
QIcon typeIcon;
|
|
||||||
QString libraryEntryIconPath;
|
|
||||||
QString category;
|
|
||||||
QString requiredImport;
|
|
||||||
QHash<QString, QString> hints;
|
|
||||||
|
|
||||||
stream >> name;
|
|
||||||
stream >> typeName;
|
|
||||||
stream >> majorVersion;
|
|
||||||
stream >> minorVersion;
|
|
||||||
stream >> typeIcon;
|
|
||||||
stream >> libraryEntryIconPath;
|
|
||||||
stream >> category;
|
|
||||||
stream >> requiredImport;
|
|
||||||
stream >> hints;
|
|
||||||
|
|
||||||
QString canBeDropped = hints.value("canBeDroppedInView3D");
|
|
||||||
return canBeDropped == "true" || canBeDropped == "True";
|
|
||||||
}
|
|
||||||
|
|
||||||
void Qt5InformationNodeInstanceServer::createEditView3D()
|
void Qt5InformationNodeInstanceServer::createEditView3D()
|
||||||
{
|
{
|
||||||
#ifdef QUICK3D_MODULE
|
#ifdef QUICK3D_MODULE
|
||||||
static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
|
|
||||||
|
|
||||||
qmlRegisterRevision<QQuick3DNode, 1>("MouseArea3D", 1, 0);
|
qmlRegisterRevision<QQuick3DNode, 1>("MouseArea3D", 1, 0);
|
||||||
qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D");
|
qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D");
|
||||||
qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("CameraGeometry", 1, 0, "CameraGeometry");
|
qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("CameraGeometry", 1, 0, "CameraGeometry");
|
||||||
@@ -187,37 +114,19 @@ void Qt5InformationNodeInstanceServer::createEditView3D()
|
|||||||
engine()->rootContext()->setContextProperty("_generalHelper", helper);
|
engine()->rootContext()->setContextProperty("_generalHelper", helper);
|
||||||
m_3dHelper = helper;
|
m_3dHelper = helper;
|
||||||
|
|
||||||
|
m_editView3D = new QQuickView(quickView()->engine(), quickView());
|
||||||
|
m_editView3D->setFormat(quickView()->format());
|
||||||
|
DesignerSupport::createOpenGLContext(m_editView3D.data());
|
||||||
QQmlComponent component(engine());
|
QQmlComponent component(engine());
|
||||||
if (showEditView) {
|
component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"));
|
||||||
component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditWindow3D.qml"));
|
m_editView3DRootItem = qobject_cast<QQuickItem *>(component.create());
|
||||||
m_editWindow3D = qobject_cast<QQuickWindow *>(component.create());
|
|
||||||
m_editView3DRootItem = QQmlProperty::read(m_editWindow3D, "editViewRoot").value<QQuickItem *>();
|
|
||||||
|
|
||||||
//For macOS we have to use the 4.1 core profile
|
|
||||||
QSurfaceFormat surfaceFormat = m_editWindow3D->requestedFormat();
|
|
||||||
surfaceFormat.setVersion(4, 1);
|
|
||||||
surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
|
|
||||||
m_editWindow3D->setFormat(surfaceFormat);
|
|
||||||
} else {
|
|
||||||
m_editView3D = new QQuickView(quickView()->engine(), quickView());
|
|
||||||
m_editView3D->setFormat(quickView()->format());
|
|
||||||
DesignerSupport::createOpenGLContext(m_editView3D.data());
|
|
||||||
component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"));
|
|
||||||
m_editView3DRootItem = qobject_cast<QQuickItem *>(component.create());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_editView3DRootItem) {
|
if (!m_editView3DRootItem) {
|
||||||
qWarning() << "Could not create edit view 3D: " << component.errors();
|
qWarning() << "Could not create edit view 3D: " << component.errors();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showEditView) {
|
DesignerSupport::setRootItem(m_editView3D, m_editView3DRootItem);
|
||||||
DesignerSupport::setRootItem(m_editView3D, m_editView3DRootItem);
|
|
||||||
} else {
|
|
||||||
m_editView3DRootItem->installEventFilter(this);
|
|
||||||
QQmlProperty showButtonsProperty(m_editView3DRootItem, "showButtons", context());
|
|
||||||
showButtonsProperty.write(QVariant(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(m_editView3DRootItem, SIGNAL(selectionChanged(QVariant)),
|
QObject::connect(m_editView3DRootItem, SIGNAL(selectionChanged(QVariant)),
|
||||||
this, SLOT(handleSelectionChanged(QVariant)));
|
this, SLOT(handleSelectionChanged(QVariant)));
|
||||||
@@ -233,8 +142,6 @@ void Qt5InformationNodeInstanceServer::createEditView3D()
|
|||||||
this, &Qt5InformationNodeInstanceServer::doRender3DEditView);
|
this, &Qt5InformationNodeInstanceServer::doRender3DEditView);
|
||||||
|
|
||||||
helper->setParent(m_editView3DRootItem);
|
helper->setParent(m_editView3DRootItem);
|
||||||
if (showEditView)
|
|
||||||
helper->setEdit3DWindow(m_editWindow3D);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,8 +428,7 @@ void Qt5InformationNodeInstanceServer::render3DEditView()
|
|||||||
// render the 3D edit view and send the result to creator process
|
// render the 3D edit view and send the result to creator process
|
||||||
void Qt5InformationNodeInstanceServer::doRender3DEditView()
|
void Qt5InformationNodeInstanceServer::doRender3DEditView()
|
||||||
{
|
{
|
||||||
static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
|
if (m_editView3DRootItem) {
|
||||||
if (m_editView3DRootItem && !showEditView) {
|
|
||||||
if (!m_editView3DContentItem) {
|
if (!m_editView3DContentItem) {
|
||||||
m_editView3DContentItem = QQmlProperty::read(m_editView3DRootItem, "contentItem").value<QQuickItem *>();
|
m_editView3DContentItem = QQmlProperty::read(m_editView3DRootItem, "contentItem").value<QQuickItem *>();
|
||||||
if (m_editView3DContentItem) {
|
if (m_editView3DContentItem) {
|
||||||
@@ -1258,7 +1164,7 @@ void Qt5InformationNodeInstanceServer::changeAuxiliaryValues(const ChangeAuxilia
|
|||||||
render3DEditView();
|
render3DEditView();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update 3D view window state when the main app window state change
|
// update 3D view size when it changes in creator side
|
||||||
void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command)
|
void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command)
|
||||||
{
|
{
|
||||||
#ifdef QUICK3D_MODULE
|
#ifdef QUICK3D_MODULE
|
||||||
@@ -1270,19 +1176,6 @@ void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewState
|
|||||||
helper->storeToolState(helper->globalStateId(), "rootSize", QVariant(command.size()), 0);
|
helper->storeToolState(helper->globalStateId(), "rootSize", QVariant(command.size()), 0);
|
||||||
render3DEditView();
|
render3DEditView();
|
||||||
}
|
}
|
||||||
} else if (m_editWindow3D) {
|
|
||||||
if (command.type() == Update3dViewStateCommand::StateChange) {
|
|
||||||
if (command.previousStates() & Qt::WindowMinimized) // main window expanded from minimize state
|
|
||||||
m_editWindow3D->show();
|
|
||||||
else if (command.currentStates() & Qt::WindowMinimized) // main window minimized
|
|
||||||
m_editWindow3D->hide();
|
|
||||||
} else if (command.type() == Update3dViewStateCommand::ActiveChange) {
|
|
||||||
m_editWindow3D->setFlag(Qt::WindowStaysOnTopHint, command.isActive());
|
|
||||||
|
|
||||||
// main window has a popup open, lower the edit view 3D so that the pop up is visible
|
|
||||||
if (command.hasPopup())
|
|
||||||
m_editWindow3D->lower();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(command)
|
Q_UNUSED(command)
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ private slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void collectItemChangesAndSendChangeCommands() override;
|
void collectItemChangesAndSendChangeCommands() override;
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
||||||
void sendChildrenChangedCommand(const QList<ServerNodeInstance> &childList);
|
void sendChildrenChangedCommand(const QList<ServerNodeInstance> &childList);
|
||||||
void sendTokenBack();
|
void sendTokenBack();
|
||||||
bool isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const;
|
bool isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const;
|
||||||
@@ -101,7 +100,6 @@ private:
|
|||||||
void modifyVariantValue(const QVariant &node,
|
void modifyVariantValue(const QVariant &node,
|
||||||
const PropertyName &propertyName,
|
const PropertyName &propertyName,
|
||||||
ValuesModifiedCommand::TransactionOption option);
|
ValuesModifiedCommand::TransactionOption option);
|
||||||
bool dropAcceptable(QDragMoveEvent *event) const;
|
|
||||||
void updateView3DRect(QObject *view3D);
|
void updateView3DRect(QObject *view3D);
|
||||||
void updateActiveSceneToEditView3D();
|
void updateActiveSceneToEditView3D();
|
||||||
void removeNode3D(QObject *node);
|
void removeNode3D(QObject *node);
|
||||||
@@ -111,7 +109,6 @@ private:
|
|||||||
void doRender3DEditView();
|
void doRender3DEditView();
|
||||||
|
|
||||||
QPointer<QQuickView> m_editView3D;
|
QPointer<QQuickView> m_editView3D;
|
||||||
QPointer<QQuickWindow> m_editWindow3D;
|
|
||||||
QQuickItem *m_editView3DRootItem = nullptr;
|
QQuickItem *m_editView3DRootItem = nullptr;
|
||||||
QQuickItem *m_editView3DContentItem = nullptr;
|
QQuickItem *m_editView3DContentItem = nullptr;
|
||||||
QSet<QObject *> m_view3Ds;
|
QSet<QObject *> m_view3Ds;
|
||||||
|
|||||||
@@ -54,30 +54,20 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
|
|||||||
NodeInstanceClientProxy(parent)
|
NodeInstanceClientProxy(parent)
|
||||||
{
|
{
|
||||||
prioritizeDown();
|
prioritizeDown();
|
||||||
|
DesignerSupport::activateDesignerWindowManager();
|
||||||
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
|
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
|
||||||
DesignerSupport::activateDesignerWindowManager();
|
|
||||||
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");
|
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");
|
||||||
setNodeInstanceServer(new Qt5TestNodeInstanceServer(this));
|
setNodeInstanceServer(new Qt5TestNodeInstanceServer(this));
|
||||||
initializeCapturedStream(QCoreApplication::arguments().at(2));
|
initializeCapturedStream(QCoreApplication::arguments().at(2));
|
||||||
readDataStream();
|
readDataStream();
|
||||||
QCoreApplication::exit();
|
QCoreApplication::exit();
|
||||||
} else if (QCoreApplication::arguments().at(2) == QLatin1String("previewmode")) {
|
} else if (QCoreApplication::arguments().at(2) == QLatin1String("previewmode")) {
|
||||||
DesignerSupport::activateDesignerWindowManager();
|
|
||||||
setNodeInstanceServer(new Qt5PreviewNodeInstanceServer(this));
|
setNodeInstanceServer(new Qt5PreviewNodeInstanceServer(this));
|
||||||
initializeSocket();
|
initializeSocket();
|
||||||
} else if (QCoreApplication::arguments().at(2) == QLatin1String("editormode")) {
|
} else if (QCoreApplication::arguments().at(2) == QLatin1String("editormode")) {
|
||||||
/* The editormode does not use the DesignerWindowManager,
|
|
||||||
* because we want to be able to show the 3D Edit View
|
|
||||||
* as a normal QQuickView.
|
|
||||||
* The DesignerWindowManager prevents any window from actually being shown. */
|
|
||||||
if (!qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE")
|
|
||||||
|| !qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")) {
|
|
||||||
DesignerSupport::activateDesignerWindowManager();
|
|
||||||
}
|
|
||||||
setNodeInstanceServer(new Qt5InformationNodeInstanceServer(this));
|
setNodeInstanceServer(new Qt5InformationNodeInstanceServer(this));
|
||||||
initializeSocket();
|
initializeSocket();
|
||||||
} else if (QCoreApplication::arguments().at(2) == QLatin1String("rendermode")) {
|
} else if (QCoreApplication::arguments().at(2) == QLatin1String("rendermode")) {
|
||||||
DesignerSupport::activateDesignerWindowManager();
|
|
||||||
setNodeInstanceServer(new Qt5RenderNodeInstanceServer(this));
|
setNodeInstanceServer(new Qt5RenderNodeInstanceServer(this));
|
||||||
initializeSocket();
|
initializeSocket();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,21 +71,9 @@ void Qt5NodeInstanceServer::initializeView()
|
|||||||
|
|
||||||
DesignerSupport::createOpenGLContext(m_quickView.data());
|
DesignerSupport::createOpenGLContext(m_quickView.data());
|
||||||
|
|
||||||
if (qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE")
|
|
||||||
&& qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")
|
|
||||||
&& QCoreApplication::arguments().at(2) == "editormode") {
|
|
||||||
/* In '3d editormode' we do not use the DesignerWindowManager
|
|
||||||
* and since we do not show the QQuickView we have to manually create the OpenGL context */
|
|
||||||
auto context = new QOpenGLContext(m_quickView);
|
|
||||||
context->setFormat(surfaceFormat);
|
|
||||||
context->create();
|
|
||||||
if (!context->makeCurrent(m_quickView))
|
|
||||||
qWarning("QOpenGLContext: makeCurrent() failed...");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qEnvironmentVariableIsSet("QML_FILE_SELECTORS")) {
|
if (qEnvironmentVariableIsSet("QML_FILE_SELECTORS")) {
|
||||||
QQmlFileSelector *fileSelector = new QQmlFileSelector(engine(), engine());
|
QQmlFileSelector *fileSelector = new QQmlFileSelector(engine(), engine());
|
||||||
QStringList customSelectors = QString::fromUtf8(qgetenv("QML_FILE_SELECTORS")).split(",");
|
QStringList customSelectors = QString::fromUtf8(qgetenv("QML_FILE_SELECTORS")).split(',');
|
||||||
fileSelector->setExtraSelectors(customSelectors);
|
fileSelector->setExtraSelectors(customSelectors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ void Quick3DNodeInstance::setPickable(bool enable, bool checkParent, bool applyT
|
|||||||
#ifdef QUICK3D_MODULE
|
#ifdef QUICK3D_MODULE
|
||||||
auto node = quick3DNode();
|
auto node = quick3DNode();
|
||||||
if (node) {
|
if (node) {
|
||||||
QQuick3DObject::Type nodeType = node->type();
|
|
||||||
bool parentHidden = false;
|
bool parentHidden = false;
|
||||||
if (checkParent) {
|
if (checkParent) {
|
||||||
// First check if any parent node is already hidden. Never set pickable on that case.
|
// First check if any parent node is already hidden. Never set pickable on that case.
|
||||||
@@ -129,7 +128,7 @@ void Quick3DNodeInstance::setPickable(bool enable, bool checkParent, bool applyT
|
|||||||
checkChildren(node);
|
checkChildren(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nodeType == QQuick3DObject::Type::Model)
|
if (qobject_cast<QQuick3DModel *>(node))
|
||||||
setPropertyVariant("pickable", enable); // allow 3D objects to receive mouse clicks
|
setPropertyVariant("pickable", enable); // allow 3D objects to receive mouse clicks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ Column {
|
|||||||
//Delay setting the color to keep ui responsive
|
//Delay setting the color to keep ui responsive
|
||||||
colorEditorTimer.restart()
|
colorEditorTimer.restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
colorPalette.selectedColor = color
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorLine {
|
ColorLine {
|
||||||
@@ -178,6 +180,7 @@ Column {
|
|||||||
}
|
}
|
||||||
gradientLine.isInValidState = true
|
gradientLine.isInValidState = true
|
||||||
colorEditor.originalColor = colorEditor.color
|
colorEditor.originalColor = colorEditor.color
|
||||||
|
colorPalette.selectedColor = colorEditor.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,8 +676,10 @@ Column {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: "#555555"
|
border.color: "#555555"
|
||||||
|
|
||||||
MouseArea {
|
ToolTipArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
tooltip: originalColorRectangle.color
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!colorEditor.transparent)
|
if (!colorEditor.transparent)
|
||||||
colorEditor.color = colorEditor.originalColor
|
colorEditor.color = colorEditor.originalColor
|
||||||
@@ -722,7 +727,6 @@ Column {
|
|||||||
onDialogColorChanged: colorEditor.color = colorPalette.selectedColor
|
onDialogColorChanged: colorEditor.color = colorPalette.selectedColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,9 +73,12 @@ Item {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
ToolTipArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
|
||||||
|
tooltip: colorCode
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if ((mouse.button === Qt.LeftButton) && clickable)
|
if ((mouse.button === Qt.LeftButton) && clickable)
|
||||||
selectedColor = colorRectangle.color
|
selectedColor = colorRectangle.color
|
||||||
@@ -85,6 +88,7 @@ Item {
|
|||||||
contextMenu.popup()
|
contextMenu.popup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StudioControls.Menu {
|
StudioControls.Menu {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
StudioControls.MenuItem {
|
StudioControls.MenuItem {
|
||||||
|
|||||||
47
share/qtcreator/qmldesigner/workspacePresets/3D_Preset.wrk
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<QtAdvancedDockingSystem version="1" containers="1">
|
||||||
|
<container floating="false">
|
||||||
|
<splitter orientation="Horizontal" count="3">
|
||||||
|
<splitter orientation="Vertical" count="2">
|
||||||
|
<area tabs="3" current="Library">
|
||||||
|
<widget name="Library" closed="false"/>
|
||||||
|
<widget name="Navigator" closed="false"/>
|
||||||
|
<widget name="DebugView" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="3" current="Projects">
|
||||||
|
<widget name="Projects" closed="false"/>
|
||||||
|
<widget name="FileSystem" closed="false"/>
|
||||||
|
<widget name="OpenDocuments" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<sizes>653 436</sizes>
|
||||||
|
</splitter>
|
||||||
|
<splitter orientation="Vertical" count="4">
|
||||||
|
<area tabs="2" current="FormEditor">
|
||||||
|
<widget name="FormEditor" closed="false"/>
|
||||||
|
<widget name="TextEditor" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="1" current="Editor3D">
|
||||||
|
<widget name="Editor3D" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="2" current="Timelines">
|
||||||
|
<widget name="StatesEditor" closed="true"/>
|
||||||
|
<widget name="Timelines" closed="true"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="1" current="OutputPane">
|
||||||
|
<widget name="OutputPane" closed="true"/>
|
||||||
|
</area>
|
||||||
|
<sizes>600 600 0 0</sizes>
|
||||||
|
</splitter>
|
||||||
|
<splitter orientation="Vertical" count="2">
|
||||||
|
<area tabs="1" current="Properties">
|
||||||
|
<widget name="Properties" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="1" current="ConnectionView">
|
||||||
|
<widget name="ConnectionView" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<sizes>762 327</sizes>
|
||||||
|
</splitter>
|
||||||
|
<sizes>376 1127 376</sizes>
|
||||||
|
</splitter>
|
||||||
|
</container>
|
||||||
|
</QtAdvancedDockingSystem>
|
||||||
46
share/qtcreator/qmldesigner/workspacePresets/Essentials.wrk
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<QtAdvancedDockingSystem version="1" containers="1">
|
||||||
|
<container floating="false">
|
||||||
|
<splitter orientation="Horizontal" count="3">
|
||||||
|
<splitter orientation="Vertical" count="3">
|
||||||
|
<area tabs="2" current="Library">
|
||||||
|
<widget name="Library" closed="false"/>
|
||||||
|
<widget name="DebugView" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="3" current="Projects">
|
||||||
|
<widget name="Projects" closed="false"/>
|
||||||
|
<widget name="FileSystem" closed="false"/>
|
||||||
|
<widget name="OpenDocuments" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="1" current="Navigator">
|
||||||
|
<widget name="Navigator" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<sizes>6000 1500 2500</sizes>
|
||||||
|
</splitter>
|
||||||
|
<splitter orientation="Vertical" count="3">
|
||||||
|
<area tabs="2" current="FormEditor">
|
||||||
|
<widget name="FormEditor" closed="false"/>
|
||||||
|
<widget name="TextEditor" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="2" current="StatesEditor">
|
||||||
|
<widget name="StatesEditor" closed="false"/>
|
||||||
|
<widget name="Timelines" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="1" current="OutputPane">
|
||||||
|
<widget name="OutputPane" closed="true"/>
|
||||||
|
</area>
|
||||||
|
<sizes>7000 1500 1500</sizes>
|
||||||
|
</splitter>
|
||||||
|
<splitter orientation="Vertical" count="2">
|
||||||
|
<area tabs="1" current="Properties">
|
||||||
|
<widget name="Properties" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<area tabs="1" current="ConnectionView">
|
||||||
|
<widget name="ConnectionView" closed="false"/>
|
||||||
|
</area>
|
||||||
|
<sizes>7000 3000</sizes>
|
||||||
|
</splitter>
|
||||||
|
<sizes>2000 6000 2000</sizes>
|
||||||
|
</splitter>
|
||||||
|
</container>
|
||||||
|
</QtAdvancedDockingSystem>
|
||||||
@@ -92,10 +92,12 @@ namespace ADS
|
|||||||
QString m_workspaceName;
|
QString m_workspaceName;
|
||||||
bool m_workspaceListDirty = true;
|
bool m_workspaceListDirty = true;
|
||||||
QStringList m_workspaces;
|
QStringList m_workspaces;
|
||||||
|
QSet<QString> m_workspacePresets;
|
||||||
QHash<QString, QDateTime> m_workspaceDateTimes;
|
QHash<QString, QDateTime> m_workspaceDateTimes;
|
||||||
QString m_workspaceToRestoreAtStartup;
|
QString m_workspaceToRestoreAtStartup;
|
||||||
bool m_autorestoreLastWorkspace; // This option is set in the Workspace Manager!
|
bool m_autorestoreLastWorkspace; // This option is set in the Workspace Manager!
|
||||||
QSettings *m_settings = nullptr;
|
QSettings *m_settings = nullptr;
|
||||||
|
QString m_workspacePresetsPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@@ -127,16 +129,14 @@ namespace ADS
|
|||||||
void hideFloatingWidgets()
|
void hideFloatingWidgets()
|
||||||
{
|
{
|
||||||
// Hide updates of floating widgets from user
|
// Hide updates of floating widgets from user
|
||||||
for (auto floatingWidget : m_floatingWidgets) { // TODO qAsConst()
|
for (auto floatingWidget : m_floatingWidgets) // TODO qAsConst()
|
||||||
floatingWidget->hide();
|
floatingWidget->hide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void markDockWidgetsDirty()
|
void markDockWidgetsDirty()
|
||||||
{
|
{
|
||||||
for (auto dockWidget : m_dockWidgetsMap) { // TODO qAsConst()
|
for (auto dockWidget : m_dockWidgetsMap) // TODO qAsConst()
|
||||||
dockWidget->setProperty("dirty", true);
|
dockWidget->setProperty("dirty", true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,9 +153,8 @@ namespace ADS
|
|||||||
|
|
||||||
bool DockManagerPrivate::restoreContainer(int index, DockingStateReader &stream, bool testing)
|
bool DockManagerPrivate::restoreContainer(int index, DockingStateReader &stream, bool testing)
|
||||||
{
|
{
|
||||||
if (testing) {
|
if (testing)
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (index >= m_containers.count()) {
|
if (index >= m_containers.count()) {
|
||||||
@@ -183,22 +182,21 @@ namespace ADS
|
|||||||
{
|
{
|
||||||
Q_UNUSED(version) // TODO version is not needed, why is it in here in the first place?
|
Q_UNUSED(version) // TODO version is not needed, why is it in here in the first place?
|
||||||
|
|
||||||
if (state.isEmpty()) {
|
if (state.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
DockingStateReader stateReader(state);
|
DockingStateReader stateReader(state);
|
||||||
stateReader.readNextStartElement();
|
|
||||||
if (!stateReader.readNextStartElement())
|
if (!stateReader.readNextStartElement())
|
||||||
return false;
|
return false;
|
||||||
if (stateReader.name() != "QtAdvancedDockingSystem") {
|
|
||||||
|
if (stateReader.name() != "QtAdvancedDockingSystem")
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
qCInfo(adsLog) << stateReader.attributes().value("version");
|
qCInfo(adsLog) << stateReader.attributes().value("version");
|
||||||
bool ok;
|
bool ok;
|
||||||
int v = stateReader.attributes().value("version").toInt(&ok);
|
int v = stateReader.attributes().value("version").toInt(&ok);
|
||||||
if (!ok || v > CurrentVersion) {
|
if (!ok || v > CurrentVersion)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
stateReader.setFileVersion(v);
|
stateReader.setFileVersion(v);
|
||||||
bool result = true;
|
bool result = true;
|
||||||
@@ -210,9 +208,9 @@ namespace ADS
|
|||||||
while (stateReader.readNextStartElement()) {
|
while (stateReader.readNextStartElement()) {
|
||||||
if (stateReader.name() == "container") {
|
if (stateReader.name() == "container") {
|
||||||
result = restoreContainer(dockContainerCount, stateReader, testing);
|
result = restoreContainer(dockContainerCount, stateReader, testing);
|
||||||
if (!result) {
|
if (!result)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
dockContainerCount++;
|
dockContainerCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,9 +263,9 @@ namespace ADS
|
|||||||
|
|
||||||
if (!dockWidget || dockWidget->isClosed()) {
|
if (!dockWidget || dockWidget->isClosed()) {
|
||||||
int index = dockArea->indexOfFirstOpenDockWidget();
|
int index = dockArea->indexOfFirstOpenDockWidget();
|
||||||
if (index < 0) {
|
if (index < 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
dockArea->setCurrentIndex(index);
|
dockArea->setCurrentIndex(index);
|
||||||
} else {
|
} else {
|
||||||
dockArea->internalSetCurrentDockWidget(dockWidget);
|
dockArea->internalSetCurrentDockWidget(dockWidget);
|
||||||
@@ -336,25 +334,17 @@ namespace ADS
|
|||||||
d->m_dockAreaOverlay = new DockOverlay(this, DockOverlay::ModeDockAreaOverlay);
|
d->m_dockAreaOverlay = new DockOverlay(this, DockOverlay::ModeDockAreaOverlay);
|
||||||
d->m_containerOverlay = new DockOverlay(this, DockOverlay::ModeContainerOverlay);
|
d->m_containerOverlay = new DockOverlay(this, DockOverlay::ModeContainerOverlay);
|
||||||
d->m_containers.append(this);
|
d->m_containers.append(this);
|
||||||
//d->loadStylesheet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DockManager::~DockManager()
|
DockManager::~DockManager()
|
||||||
{
|
{
|
||||||
// If the factory default workspace is still loaded, create a default workspace just in case
|
|
||||||
// the layout changed as there is no tracking of layout changes.
|
|
||||||
if (isFactoryDefaultWorkspace(d->m_workspaceName)
|
|
||||||
&& !isDefaultWorkspace(d->m_workspaceName)) {
|
|
||||||
createWorkspace(Constants::DEFAULT_NAME);
|
|
||||||
openWorkspace(Constants::DEFAULT_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit aboutToUnloadWorkspace(d->m_workspaceName);
|
emit aboutToUnloadWorkspace(d->m_workspaceName);
|
||||||
save();
|
save();
|
||||||
|
saveStartupWorkspace();
|
||||||
|
|
||||||
for (auto floatingWidget : d->m_floatingWidgets) {
|
for (auto floatingWidget : d->m_floatingWidgets)
|
||||||
delete floatingWidget;
|
delete floatingWidget;
|
||||||
}
|
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,6 +375,8 @@ namespace ADS
|
|||||||
|
|
||||||
void DockManager::setSettings(QSettings *settings) { d->m_settings = settings; }
|
void DockManager::setSettings(QSettings *settings) { d->m_settings = settings; }
|
||||||
|
|
||||||
|
void DockManager::setWorkspacePresetsPath(const QString &path) { d->m_workspacePresetsPath = path; }
|
||||||
|
|
||||||
DockAreaWidget *DockManager::addDockWidget(DockWidgetArea area,
|
DockAreaWidget *DockManager::addDockWidget(DockWidgetArea area,
|
||||||
DockWidget *dockWidget,
|
DockWidget *dockWidget,
|
||||||
DockAreaWidget *dockAreaWidget)
|
DockAreaWidget *dockAreaWidget)
|
||||||
@@ -393,6 +385,24 @@ namespace ADS
|
|||||||
return DockContainerWidget::addDockWidget(area, dockWidget, dockAreaWidget);
|
return DockContainerWidget::addDockWidget(area, dockWidget, dockAreaWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DockManager::initialize()
|
||||||
|
{
|
||||||
|
syncWorkspacePresets();
|
||||||
|
|
||||||
|
QString workspace = ADS::Constants::DEFAULT_WORKSPACE;
|
||||||
|
|
||||||
|
// Determine workspace to restore at startup
|
||||||
|
if (autoRestorLastWorkspace()) {
|
||||||
|
QString lastWS = lastWorkspace();
|
||||||
|
if (!lastWS.isEmpty() && workspaces().contains(lastWS))
|
||||||
|
workspace = lastWS;
|
||||||
|
else
|
||||||
|
qDebug() << "Couldn't restore last workspace!";
|
||||||
|
}
|
||||||
|
|
||||||
|
openWorkspace(workspace);
|
||||||
|
}
|
||||||
|
|
||||||
DockAreaWidget *DockManager::addDockWidgetTab(DockWidgetArea area, DockWidget *dockWidget)
|
DockAreaWidget *DockManager::addDockWidgetTab(DockWidgetArea area, DockWidget *dockWidget)
|
||||||
{
|
{
|
||||||
DockAreaWidget *areaWidget = lastAddedDockAreaWidget(area);
|
DockAreaWidget *areaWidget = lastAddedDockAreaWidget(area);
|
||||||
@@ -415,9 +425,8 @@ namespace ADS
|
|||||||
{
|
{
|
||||||
d->m_dockWidgetsMap.insert(dockWidget->objectName(), dockWidget);
|
d->m_dockWidgetsMap.insert(dockWidget->objectName(), dockWidget);
|
||||||
DockAreaWidget *oldDockArea = dockWidget->dockAreaWidget();
|
DockAreaWidget *oldDockArea = dockWidget->dockAreaWidget();
|
||||||
if (oldDockArea) {
|
if (oldDockArea)
|
||||||
oldDockArea->removeDockWidget(dockWidget);
|
oldDockArea->removeDockWidget(dockWidget);
|
||||||
}
|
|
||||||
|
|
||||||
dockWidget->setDockManager(this);
|
dockWidget->setDockManager(this);
|
||||||
FloatingDockContainer *floatingWidget = new FloatingDockContainer(dockWidget);
|
FloatingDockContainer *floatingWidget = new FloatingDockContainer(dockWidget);
|
||||||
@@ -480,9 +489,8 @@ namespace ADS
|
|||||||
stream.writeStartElement("QtAdvancedDockingSystem");
|
stream.writeStartElement("QtAdvancedDockingSystem");
|
||||||
stream.writeAttribute("version", QString::number(version));
|
stream.writeAttribute("version", QString::number(version));
|
||||||
stream.writeAttribute("containers", QString::number(d->m_containers.count()));
|
stream.writeAttribute("containers", QString::number(d->m_containers.count()));
|
||||||
for (auto container : d->m_containers) {
|
for (auto container : d->m_containers)
|
||||||
container->saveState(stream);
|
container->saveState(stream);
|
||||||
}
|
|
||||||
|
|
||||||
stream.writeEndElement();
|
stream.writeEndElement();
|
||||||
stream.writeEndDocument();
|
stream.writeEndDocument();
|
||||||
@@ -493,9 +501,8 @@ namespace ADS
|
|||||||
{
|
{
|
||||||
// Prevent multiple calls as long as state is not restore. This may
|
// Prevent multiple calls as long as state is not restore. This may
|
||||||
// happen, if QApplication::processEvents() is called somewhere
|
// happen, if QApplication::processEvents() is called somewhere
|
||||||
if (d->m_restoringState) {
|
if (d->m_restoringState)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// We hide the complete dock manager here. Restoring the state means
|
// We hide the complete dock manager here. Restoring the state means
|
||||||
// that DockWidgets are removed from the DockArea internal stack layout
|
// that DockWidgets are removed from the DockArea internal stack layout
|
||||||
@@ -506,17 +513,16 @@ namespace ADS
|
|||||||
// events until this function is finished, the user will not see this
|
// events until this function is finished, the user will not see this
|
||||||
// hiding
|
// hiding
|
||||||
bool isHidden = this->isHidden();
|
bool isHidden = this->isHidden();
|
||||||
if (!isHidden) {
|
if (!isHidden)
|
||||||
hide();
|
hide();
|
||||||
}
|
|
||||||
d->m_restoringState = true;
|
d->m_restoringState = true;
|
||||||
emit restoringState();
|
emit restoringState();
|
||||||
bool result = d->restoreState(state, version);
|
bool result = d->restoreState(state, version);
|
||||||
d->m_restoringState = false;
|
d->m_restoringState = false;
|
||||||
emit stateRestored();
|
emit stateRestored();
|
||||||
if (!isHidden) {
|
if (!isHidden)
|
||||||
show();
|
show();
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -524,13 +530,12 @@ namespace ADS
|
|||||||
void DockManager::showEvent(QShowEvent *event)
|
void DockManager::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
Super::showEvent(event);
|
Super::showEvent(event);
|
||||||
if (d->m_uninitializedFloatingWidgets.empty()) {
|
if (d->m_uninitializedFloatingWidgets.empty())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
for (auto floatingWidget : d->m_uninitializedFloatingWidgets) {
|
for (auto floatingWidget : d->m_uninitializedFloatingWidgets)
|
||||||
floatingWidget->show();
|
floatingWidget->show();
|
||||||
}
|
|
||||||
d->m_uninitializedFloatingWidgets.clear();
|
d->m_uninitializedFloatingWidgets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,8 +558,7 @@ namespace ADS
|
|||||||
|
|
||||||
void DockManager::showWorkspaceMananger()
|
void DockManager::showWorkspaceMananger()
|
||||||
{
|
{
|
||||||
// Save current workspace
|
save(); // Save current workspace
|
||||||
save();
|
|
||||||
|
|
||||||
WorkspaceDialog workspaceDialog(this, parentWidget());
|
WorkspaceDialog workspaceDialog(this, parentWidget());
|
||||||
workspaceDialog.setAutoLoadWorkspace(autoRestorLastWorkspace());
|
workspaceDialog.setAutoLoadWorkspace(autoRestorLastWorkspace());
|
||||||
@@ -565,30 +569,22 @@ namespace ADS
|
|||||||
workspaceDialog.autoLoadWorkspace());
|
workspaceDialog.autoLoadWorkspace());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DockManager::isFactoryDefaultWorkspace(const QString &workspace) const
|
bool DockManager::isWorkspacePreset(const QString &workspace) const
|
||||||
{
|
{
|
||||||
return workspace == QLatin1String(Constants::FACTORY_DEFAULT_NAME);
|
return d->m_workspacePresets.contains(workspace);
|
||||||
}
|
|
||||||
|
|
||||||
bool DockManager::isDefaultWorkspace(const QString &workspace) const
|
|
||||||
{
|
|
||||||
return workspace == QLatin1String(Constants::DEFAULT_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DockManager::save()
|
bool DockManager::save()
|
||||||
{
|
{
|
||||||
if (isFactoryDefaultWorkspace(activeWorkspace()))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
emit aboutToSaveWorkspace();
|
emit aboutToSaveWorkspace();
|
||||||
|
|
||||||
bool result = write(saveState(), parentWidget());
|
bool result = write(activeWorkspace(), saveState(), parentWidget());
|
||||||
if (result) {
|
if (result) {
|
||||||
d->m_workspaceDateTimes.insert(activeWorkspace(), QDateTime::currentDateTime());
|
d->m_workspaceDateTimes.insert(activeWorkspace(), QDateTime::currentDateTime());
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(parentWidget(),
|
QMessageBox::warning(parentWidget(),
|
||||||
tr("Cannot Save Session"),
|
tr("Cannot Save Workspace"),
|
||||||
tr("Could not save session to file %1")
|
tr("Could not save workspace to file %1")
|
||||||
.arg(workspaceNameToFileName(d->m_workspaceName)
|
.arg(workspaceNameToFileName(d->m_workspaceName)
|
||||||
.toUserOutput()));
|
.toUserOutput()));
|
||||||
}
|
}
|
||||||
@@ -624,15 +620,13 @@ namespace ADS
|
|||||||
QFileInfoList workspaceFiles
|
QFileInfoList workspaceFiles
|
||||||
= workspaceDir.entryInfoList(QStringList() << QLatin1String("*.wrk"),
|
= workspaceDir.entryInfoList(QStringList() << QLatin1String("*.wrk"),
|
||||||
QDir::NoFilter,
|
QDir::NoFilter,
|
||||||
QDir::Time); // TODO Choose different extension
|
QDir::Time);
|
||||||
for (const QFileInfo &fileInfo : workspaceFiles) {
|
for (const QFileInfo &fileInfo : workspaceFiles) {
|
||||||
QString filename = fileInfo.completeBaseName();
|
QString filename = fileInfo.completeBaseName();
|
||||||
filename.replace("_", " ");
|
filename.replace("_", " ");
|
||||||
d->m_workspaceDateTimes.insert(filename, fileInfo.lastModified());
|
d->m_workspaceDateTimes.insert(filename, fileInfo.lastModified());
|
||||||
//if (name != QLatin1String(Constants::DEFAULT_NAME))
|
|
||||||
tmp.insert(filename);
|
tmp.insert(filename);
|
||||||
}
|
}
|
||||||
//d->m_workspaces.prepend(QLatin1String(Constants::DEFAULT_NAME));
|
|
||||||
|
|
||||||
d->m_workspaceListDirty = false;
|
d->m_workspaceListDirty = false;
|
||||||
d->m_workspaces = Utils::toList(tmp);
|
d->m_workspaces = Utils::toList(tmp);
|
||||||
@@ -640,6 +634,23 @@ namespace ADS
|
|||||||
return d->m_workspaces;
|
return d->m_workspaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSet<QString> DockManager::workspacePresets() const
|
||||||
|
{
|
||||||
|
if (d->m_workspacePresets.isEmpty()) {
|
||||||
|
QDir workspacePresetsDir(d->m_workspacePresetsPath);
|
||||||
|
QFileInfoList workspacePresetsFiles
|
||||||
|
= workspacePresetsDir.entryInfoList(QStringList() << QLatin1String("*.wrk"),
|
||||||
|
QDir::NoFilter,
|
||||||
|
QDir::Time);
|
||||||
|
for (const QFileInfo &fileInfo : workspacePresetsFiles) {
|
||||||
|
QString filename = fileInfo.completeBaseName();
|
||||||
|
filename.replace("_", " ");
|
||||||
|
d->m_workspacePresets.insert(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return d->m_workspacePresets;
|
||||||
|
}
|
||||||
|
|
||||||
QDateTime DockManager::workspaceDateTime(const QString &workspace) const
|
QDateTime DockManager::workspaceDateTime(const QString &workspace) const
|
||||||
{
|
{
|
||||||
return d->m_workspaceDateTimes.value(workspace);
|
return d->m_workspaceDateTimes.value(workspace);
|
||||||
@@ -661,12 +672,21 @@ namespace ADS
|
|||||||
{
|
{
|
||||||
if (workspaces().contains(workspace))
|
if (workspaces().contains(workspace))
|
||||||
return false;
|
return false;
|
||||||
d->m_workspaces.insert(1, workspace);
|
|
||||||
d->m_workspaceDateTimes.insert(workspace, QDateTime::currentDateTime());
|
|
||||||
|
|
||||||
emit workspaceListChanged();
|
bool result = write(workspace, saveState(), parentWidget());
|
||||||
|
if (result) {
|
||||||
|
d->m_workspaces.insert(1, workspace);
|
||||||
|
d->m_workspaceDateTimes.insert(workspace, QDateTime::currentDateTime());
|
||||||
|
emit workspaceListChanged();
|
||||||
|
} else {
|
||||||
|
QMessageBox::warning(parentWidget(),
|
||||||
|
tr("Cannot Save Workspace"),
|
||||||
|
tr("Could not save workspace to file %1")
|
||||||
|
.arg(workspaceNameToFileName(d->m_workspaceName)
|
||||||
|
.toUserOutput()));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DockManager::openWorkspace(const QString &workspace)
|
bool DockManager::openWorkspace(const QString &workspace)
|
||||||
@@ -674,7 +694,7 @@ namespace ADS
|
|||||||
// Do nothing if we have that workspace already loaded, exception if the
|
// Do nothing if we have that workspace already loaded, exception if the
|
||||||
// workspace is the default virgin workspace we still want to be able to
|
// workspace is the default virgin workspace we still want to be able to
|
||||||
// load the default workspace.
|
// load the default workspace.
|
||||||
if (workspace == d->m_workspaceName) // && !isFactoryDefaultWorkspace(workspace))
|
if (workspace == d->m_workspaceName && !isWorkspacePreset(workspace))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!workspaces().contains(workspace))
|
if (!workspaces().contains(workspace))
|
||||||
@@ -684,38 +704,45 @@ namespace ADS
|
|||||||
if (!d->m_workspaceName.isEmpty()) {
|
if (!d->m_workspaceName.isEmpty()) {
|
||||||
// Allow everyone to set something in the workspace and before saving
|
// Allow everyone to set something in the workspace and before saving
|
||||||
emit aboutToUnloadWorkspace(d->m_workspaceName);
|
emit aboutToUnloadWorkspace(d->m_workspaceName);
|
||||||
if (!save()) {
|
if (!save())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try loading the file
|
// Try loading the file
|
||||||
QByteArray data;
|
QByteArray data = loadWorkspace(workspace);
|
||||||
Utils::FilePath fileName = workspaceNameToFileName(workspace);
|
if (data.isEmpty())
|
||||||
if (fileName.exists()) {
|
return false;
|
||||||
QFile file(fileName.toString());
|
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
||||||
QMessageBox::warning(parentWidget(),
|
|
||||||
tr("Cannot Restore Workspace"),
|
|
||||||
tr("Could not restore workspace %1")
|
|
||||||
.arg(fileName.toUserOutput()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
data = file.readAll();
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
emit openingWorkspace(workspace);
|
emit openingWorkspace(workspace);
|
||||||
// If data was loaded from file try to restore its state
|
// If data was loaded from file try to restore its state
|
||||||
if (!data.isNull() && !restoreState(data)) {
|
if (!data.isNull() && !restoreState(data))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
d->m_workspaceName = workspace;
|
d->m_workspaceName = workspace;
|
||||||
emit workspaceLoaded(workspace);
|
emit workspaceLoaded(workspace);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DockManager::reloadActiveWorkspace()
|
||||||
|
{
|
||||||
|
if (!workspaces().contains(activeWorkspace()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Try loading the file
|
||||||
|
QByteArray data = loadWorkspace(activeWorkspace());
|
||||||
|
if (data.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// If data was loaded from file try to restore its state
|
||||||
|
if (!data.isNull() && !restoreState(data))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
emit workspaceReloaded(activeWorkspace());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Shows a dialog asking the user to confirm deleting the workspace \p workspace
|
* \brief Shows a dialog asking the user to confirm deleting the workspace \p workspace
|
||||||
*/
|
*/
|
||||||
@@ -742,6 +769,7 @@ namespace ADS
|
|||||||
// Remove workspace from internal list
|
// Remove workspace from internal list
|
||||||
if (!d->m_workspaces.contains(workspace))
|
if (!d->m_workspaces.contains(workspace))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
d->m_workspaces.removeOne(workspace);
|
d->m_workspaces.removeOne(workspace);
|
||||||
|
|
||||||
emit workspacesRemoved();
|
emit workspacesRemoved();
|
||||||
@@ -752,8 +780,7 @@ namespace ADS
|
|||||||
if (fi.exists())
|
if (fi.exists())
|
||||||
return fi.remove();
|
return fi.remove();
|
||||||
|
|
||||||
return false; // TODO If we allow temporary workspaces without writing them to file
|
return false;
|
||||||
// directly, this needs to be true otherwise in all those cases it will return false.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockManager::deleteWorkspaces(const QStringList &workspaces)
|
void DockManager::deleteWorkspaces(const QStringList &workspaces)
|
||||||
@@ -787,36 +814,111 @@ namespace ADS
|
|||||||
return deleteWorkspace(original);
|
return deleteWorkspace(original);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DockManager::write(const QByteArray &data, QString *errorString) const
|
bool DockManager::resetWorkspacePreset(const QString &workspace)
|
||||||
{
|
{
|
||||||
Utils::FilePath fileName = workspaceNameToFileName(activeWorkspace());
|
if (!isWorkspacePreset(workspace))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Utils::FilePath filename = workspaceNameToFileName(workspace);
|
||||||
|
|
||||||
|
if (!QFile::remove(filename.toString()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QDir presetsDir(d->m_workspacePresetsPath);
|
||||||
|
QString presetName = workspace;
|
||||||
|
presetName.replace(" ", "_");
|
||||||
|
presetName.append(".wrk");
|
||||||
|
|
||||||
|
bool result = QFile::copy(presetsDir.filePath(presetName), filename.toString());
|
||||||
|
if (result)
|
||||||
|
d->m_workspaceDateTimes.insert(workspace, QDateTime::currentDateTime());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DockManager::write(const QString &workspace, const QByteArray &data, QString *errorString) const
|
||||||
|
{
|
||||||
|
Utils::FilePath filename = workspaceNameToFileName(workspace);
|
||||||
|
|
||||||
QDir tmp;
|
QDir tmp;
|
||||||
tmp.mkpath(fileName.toFileInfo().path());
|
tmp.mkpath(filename.toFileInfo().path());
|
||||||
Utils::FileSaver fileSaver(fileName.toString(), QIODevice::Text);
|
Utils::FileSaver fileSaver(filename.toString(), QIODevice::Text);
|
||||||
if (!fileSaver.hasError()) {
|
if (!fileSaver.hasError())
|
||||||
fileSaver.write(data);
|
fileSaver.write(data);
|
||||||
}
|
|
||||||
bool ok = fileSaver.finalize();
|
bool ok = fileSaver.finalize();
|
||||||
|
|
||||||
if (!ok && errorString) {
|
if (!ok && errorString)
|
||||||
*errorString = fileSaver.errorString();
|
*errorString = fileSaver.errorString();
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT_GUI_LIB
|
bool DockManager::write(const QString &workspace, const QByteArray &data, QWidget *parent) const
|
||||||
bool DockManager::write(const QByteArray &data, QWidget *parent) const
|
|
||||||
{
|
{
|
||||||
QString errorString;
|
QString errorString;
|
||||||
const bool success = write(data, &errorString);
|
const bool success = write(workspace, data, &errorString);
|
||||||
if (!success)
|
if (!success)
|
||||||
QMessageBox::critical(parent,
|
QMessageBox::critical(parent,
|
||||||
QCoreApplication::translate("Utils::FileSaverBase", "File Error"),
|
QCoreApplication::translate("Utils::FileSaverBase", "File Error"),
|
||||||
errorString);
|
errorString);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
#endif // QT_GUI_LIB
|
|
||||||
|
QByteArray DockManager::loadWorkspace(const QString &workspace) const
|
||||||
|
{
|
||||||
|
QByteArray data;
|
||||||
|
Utils::FilePath fileName = workspaceNameToFileName(workspace);
|
||||||
|
if (fileName.exists()) {
|
||||||
|
QFile file(fileName.toString());
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
QMessageBox::warning(parentWidget(),
|
||||||
|
tr("Cannot Restore Workspace"),
|
||||||
|
tr("Could not restore workspace %1")
|
||||||
|
.arg(fileName.toUserOutput()));
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
data = file.readAll();
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DockManager::syncWorkspacePresets()
|
||||||
|
{
|
||||||
|
// Get a list of all workspace presets
|
||||||
|
QSet<QString> presets = workspacePresets();
|
||||||
|
|
||||||
|
// Get a list of all available workspaces
|
||||||
|
QSet<QString> availableWorkspaces = Utils::toSet(workspaces());
|
||||||
|
presets.subtract(availableWorkspaces);
|
||||||
|
|
||||||
|
// Copy all missing workspace presets over to the local workspace folder
|
||||||
|
QDir presetsDir(d->m_workspacePresetsPath);
|
||||||
|
QDir workspaceDir(QFileInfo(d->m_settings->fileName()).path() + QLatin1String("/workspaces"));
|
||||||
|
|
||||||
|
for (const auto &preset : presets) {
|
||||||
|
QString filename = preset;
|
||||||
|
filename.replace(" ", "_");
|
||||||
|
filename.append(".wrk");
|
||||||
|
|
||||||
|
QString filePath = presetsDir.filePath(filename);
|
||||||
|
QFile file(filePath);
|
||||||
|
|
||||||
|
if (file.exists()) {
|
||||||
|
file.copy(workspaceDir.filePath(filename));
|
||||||
|
d->m_workspaceListDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// After copying over missing workspace presets, update the workspace list
|
||||||
|
workspaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DockManager::saveStartupWorkspace()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(d->m_settings, return );
|
||||||
|
d->m_settings->setValue(Constants::STARTUP_WORKSPACE_SETTINGS_KEY, activeWorkspace());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ADS
|
} // namespace ADS
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ QT_END_NAMESPACE
|
|||||||
namespace ADS {
|
namespace ADS {
|
||||||
|
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
const char FACTORY_DEFAULT_NAME[] = "factorydefault";
|
const char DEFAULT_WORKSPACE[] = "Essentials"; // This needs to align with a name of the shipped presets
|
||||||
const char DEFAULT_NAME[] = "default";
|
|
||||||
const char STARTUP_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/StartupWorkspace";
|
const char STARTUP_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/StartupWorkspace";
|
||||||
const char AUTO_RESTORE_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/AutoRestoreLastWorkspace";
|
const char AUTO_RESTORE_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/AutoRestoreLastWorkspace";
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
@@ -271,6 +270,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setSettings(QSettings *settings);
|
void setSettings(QSettings *settings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the path to the workspace presets folder.
|
||||||
|
*/
|
||||||
|
void setWorkspacePresetsPath(const QString &path);
|
||||||
|
|
||||||
|
void initialize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds dockwidget into the given area.
|
* Adds dockwidget into the given area.
|
||||||
* If DockAreaWidget is not null, then the area parameter indicates the area
|
* If DockAreaWidget is not null, then the area parameter indicates the area
|
||||||
@@ -445,12 +451,14 @@ public:
|
|||||||
QString lastWorkspace() const;
|
QString lastWorkspace() const;
|
||||||
bool autoRestorLastWorkspace() const;
|
bool autoRestorLastWorkspace() const;
|
||||||
QStringList workspaces();
|
QStringList workspaces();
|
||||||
|
QSet<QString> workspacePresets() const;
|
||||||
QDateTime workspaceDateTime(const QString &workspace) const;
|
QDateTime workspaceDateTime(const QString &workspace) const;
|
||||||
Utils::FilePath workspaceNameToFileName(const QString &workspaceName) const;
|
Utils::FilePath workspaceNameToFileName(const QString &workspaceName) const;
|
||||||
|
|
||||||
bool createWorkspace(const QString &workspace);
|
bool createWorkspace(const QString &workspace);
|
||||||
|
|
||||||
bool openWorkspace(const QString &workspace);
|
bool openWorkspace(const QString &workspace);
|
||||||
|
bool reloadActiveWorkspace();
|
||||||
|
|
||||||
bool confirmWorkspaceDelete(const QStringList &workspaces);
|
bool confirmWorkspaceDelete(const QStringList &workspaces);
|
||||||
bool deleteWorkspace(const QString &workspace);
|
bool deleteWorkspace(const QString &workspace);
|
||||||
@@ -459,22 +467,28 @@ public:
|
|||||||
bool cloneWorkspace(const QString &original, const QString &clone);
|
bool cloneWorkspace(const QString &original, const QString &clone);
|
||||||
bool renameWorkspace(const QString &original, const QString &newName);
|
bool renameWorkspace(const QString &original, const QString &newName);
|
||||||
|
|
||||||
|
bool resetWorkspacePreset(const QString &workspace);
|
||||||
|
|
||||||
bool save();
|
bool save();
|
||||||
|
|
||||||
bool isFactoryDefaultWorkspace(const QString &workspace) const;
|
bool isWorkspacePreset(const QString &workspace) const;
|
||||||
bool isDefaultWorkspace(const QString &workspace) const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void aboutToUnloadWorkspace(QString workspaceName);
|
void aboutToUnloadWorkspace(QString workspaceName);
|
||||||
void aboutToLoadWorkspace(QString workspaceName);
|
void aboutToLoadWorkspace(QString workspaceName);
|
||||||
void workspaceLoaded(QString workspaceName);
|
void workspaceLoaded(QString workspaceName);
|
||||||
|
void workspaceReloaded(QString workspaceName);
|
||||||
void aboutToSaveWorkspace();
|
void aboutToSaveWorkspace();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool write(const QByteArray &data, QString *errorString) const;
|
bool write(const QString &workspace, const QByteArray &data, QString *errorString) const;
|
||||||
#ifdef QT_GUI_LIB
|
bool write(const QString &workspace, const QByteArray &data, QWidget *parent) const;
|
||||||
bool write(const QByteArray &data, QWidget *parent) const;
|
|
||||||
#endif
|
QByteArray loadWorkspace(const QString &workspace) const;
|
||||||
|
|
||||||
|
void syncWorkspacePresets();
|
||||||
|
|
||||||
|
void saveStartupWorkspace();
|
||||||
}; // class DockManager
|
}; // class DockManager
|
||||||
|
|
||||||
} // namespace ADS
|
} // namespace ADS
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ QValidator::State WorkspaceValidator::validate(QString &input, int &pos) const
|
|||||||
{
|
{
|
||||||
Q_UNUSED(pos)
|
Q_UNUSED(pos)
|
||||||
|
|
||||||
if (input.contains(QLatin1Char('/')) || input.contains(QLatin1Char(':'))
|
static QRegExp rx("[a-zA-Z0-9 ()\\-]*");
|
||||||
|| input.contains(QLatin1Char('\\')) || input.contains(QLatin1Char('?'))
|
|
||||||
|| input.contains(QLatin1Char('*')) || input.contains(QLatin1Char('_')))
|
if (!rx.exactMatch(input))
|
||||||
return QValidator::Invalid;
|
return QValidator::Invalid;
|
||||||
|
|
||||||
if (m_workspaces.contains(input))
|
if (m_workspaces.contains(input))
|
||||||
@@ -158,15 +158,22 @@ WorkspaceDialog::WorkspaceDialog(DockManager *manager, QWidget *parent)
|
|||||||
&QAbstractButton::clicked,
|
&QAbstractButton::clicked,
|
||||||
m_ui.workspaceView,
|
m_ui.workspaceView,
|
||||||
&WorkspaceView::renameCurrentWorkspace);
|
&WorkspaceView::renameCurrentWorkspace);
|
||||||
|
connect(m_ui.btReset,
|
||||||
|
&QAbstractButton::clicked,
|
||||||
|
m_ui.workspaceView,
|
||||||
|
&WorkspaceView::resetCurrentWorkspace);
|
||||||
connect(m_ui.workspaceView,
|
connect(m_ui.workspaceView,
|
||||||
&WorkspaceView::activated,
|
&WorkspaceView::activated,
|
||||||
m_ui.workspaceView,
|
m_ui.workspaceView,
|
||||||
&WorkspaceView::switchToCurrentWorkspace);
|
&WorkspaceView::switchToCurrentWorkspace);
|
||||||
|
connect(m_ui.workspaceView,
|
||||||
connect(m_ui.workspaceView, &WorkspaceView::selected, this, &WorkspaceDialog::updateActions);
|
&WorkspaceView::selected,
|
||||||
connect(m_ui.workspaceView, &WorkspaceView::workspaceSwitched, this, &QDialog::reject);
|
this,
|
||||||
|
&WorkspaceDialog::updateActions);
|
||||||
|
|
||||||
m_ui.whatsAWorkspaceLabel->setOpenExternalLinks(true);
|
m_ui.whatsAWorkspaceLabel->setOpenExternalLinks(true);
|
||||||
|
|
||||||
|
updateActions(m_ui.workspaceView->selectedWorkspaces());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceDialog::setAutoLoadWorkspace(bool check)
|
void WorkspaceDialog::setAutoLoadWorkspace(bool check)
|
||||||
@@ -190,16 +197,20 @@ void WorkspaceDialog::updateActions(const QStringList &workspaces)
|
|||||||
m_ui.btDelete->setEnabled(false);
|
m_ui.btDelete->setEnabled(false);
|
||||||
m_ui.btRename->setEnabled(false);
|
m_ui.btRename->setEnabled(false);
|
||||||
m_ui.btClone->setEnabled(false);
|
m_ui.btClone->setEnabled(false);
|
||||||
|
m_ui.btReset->setEnabled(false);
|
||||||
m_ui.btSwitch->setEnabled(false);
|
m_ui.btSwitch->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const bool defaultIsSelected = workspaces.contains("default"); // TODO use const var
|
const bool presetIsSelected = Utils::anyOf(workspaces, [this](const QString &workspace) {
|
||||||
|
return m_manager->isWorkspacePreset(workspace);
|
||||||
|
});
|
||||||
const bool activeIsSelected = Utils::anyOf(workspaces, [this](const QString &workspace) {
|
const bool activeIsSelected = Utils::anyOf(workspaces, [this](const QString &workspace) {
|
||||||
return workspace == m_manager->activeWorkspace();
|
return workspace == m_manager->activeWorkspace();
|
||||||
});
|
});
|
||||||
m_ui.btDelete->setEnabled(!defaultIsSelected && !activeIsSelected);
|
m_ui.btDelete->setEnabled(!activeIsSelected && !presetIsSelected);
|
||||||
m_ui.btRename->setEnabled(workspaces.size() == 1 && !defaultIsSelected);
|
m_ui.btRename->setEnabled(workspaces.size() == 1 && !presetIsSelected);
|
||||||
m_ui.btClone->setEnabled(workspaces.size() == 1);
|
m_ui.btClone->setEnabled(workspaces.size() == 1);
|
||||||
|
m_ui.btReset->setEnabled(presetIsSelected);
|
||||||
m_ui.btSwitch->setEnabled(workspaces.size() == 1);
|
m_ui.btSwitch->setEnabled(workspaces.size() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btReset">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btSwitch">
|
<widget class="QPushButton" name="btSwitch">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ namespace ADS {
|
|||||||
WorkspaceModel::WorkspaceModel(DockManager *manager, QObject *parent)
|
WorkspaceModel::WorkspaceModel(DockManager *manager, QObject *parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
, m_manager(manager)
|
, m_manager(manager)
|
||||||
|
, m_currentSortColumn(0)
|
||||||
{
|
{
|
||||||
m_sortedWorkspaces = m_manager->workspaces();
|
m_sortedWorkspaces = m_manager->workspaces();
|
||||||
connect(m_manager, &DockManager::workspaceLoaded, this, &WorkspaceModel::resetWorkspaces);
|
connect(m_manager, &DockManager::workspaceLoaded, this, &WorkspaceModel::resetWorkspaces);
|
||||||
@@ -134,19 +135,18 @@ QVariant WorkspaceModel::data(const QModelIndex &index, int role) const
|
|||||||
break;
|
break;
|
||||||
case Qt::FontRole: {
|
case Qt::FontRole: {
|
||||||
QFont font;
|
QFont font;
|
||||||
if (m_manager->isDefaultWorkspace(workspaceName))
|
if (m_manager->isWorkspacePreset(workspaceName))
|
||||||
font.setItalic(true);
|
font.setItalic(true);
|
||||||
else
|
else
|
||||||
font.setItalic(false);
|
font.setItalic(false);
|
||||||
if (m_manager->activeWorkspace() == workspaceName
|
if (m_manager->activeWorkspace() == workspaceName)
|
||||||
&& !m_manager->isFactoryDefaultWorkspace(workspaceName))
|
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
else
|
else
|
||||||
font.setBold(false);
|
font.setBold(false);
|
||||||
result = font;
|
result = font;
|
||||||
} break;
|
} break;
|
||||||
case DefaultWorkspaceRole:
|
case PresetWorkspaceRole:
|
||||||
result = m_manager->isDefaultWorkspace(workspaceName);
|
result = m_manager->isWorkspacePreset(workspaceName);
|
||||||
break;
|
break;
|
||||||
case LastWorkspaceRole:
|
case LastWorkspaceRole:
|
||||||
result = m_manager->lastWorkspace() == workspaceName;
|
result = m_manager->lastWorkspace() == workspaceName;
|
||||||
@@ -163,7 +163,7 @@ QVariant WorkspaceModel::data(const QModelIndex &index, int role) const
|
|||||||
QHash<int, QByteArray> WorkspaceModel::roleNames() const
|
QHash<int, QByteArray> WorkspaceModel::roleNames() const
|
||||||
{
|
{
|
||||||
static QHash<int, QByteArray> extraRoles{{Qt::DisplayRole, "workspaceName"},
|
static QHash<int, QByteArray> extraRoles{{Qt::DisplayRole, "workspaceName"},
|
||||||
{DefaultWorkspaceRole, "defaultWorkspace"},
|
{PresetWorkspaceRole, "presetWorkspace"},
|
||||||
{LastWorkspaceRole, "activeWorkspace"},
|
{LastWorkspaceRole, "activeWorkspace"},
|
||||||
{ActiveWorkspaceRole, "lastWorkspace"}};
|
{ActiveWorkspaceRole, "lastWorkspace"}};
|
||||||
return QAbstractTableModel::roleNames().unite(extraRoles);
|
return QAbstractTableModel::roleNames().unite(extraRoles);
|
||||||
@@ -171,6 +171,9 @@ QHash<int, QByteArray> WorkspaceModel::roleNames() const
|
|||||||
|
|
||||||
void WorkspaceModel::sort(int column, Qt::SortOrder order)
|
void WorkspaceModel::sort(int column, Qt::SortOrder order)
|
||||||
{
|
{
|
||||||
|
m_currentSortColumn = column;
|
||||||
|
m_currentSortOrder = order;
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
const auto cmp = [this, column, order](const QString &s1, const QString &s2) {
|
const auto cmp = [this, column, order](const QString &s1, const QString &s2) {
|
||||||
bool isLess;
|
bool isLess;
|
||||||
@@ -186,16 +189,10 @@ void WorkspaceModel::sort(int column, Qt::SortOrder order)
|
|||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorkspaceModel::isDefaultVirgin() const
|
|
||||||
{
|
|
||||||
return false; //m_manager->isFactoryDefaultWorkspace(); // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkspaceModel::resetWorkspaces()
|
void WorkspaceModel::resetWorkspaces()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
|
||||||
m_sortedWorkspaces = m_manager->workspaces();
|
m_sortedWorkspaces = m_manager->workspaces();
|
||||||
endResetModel();
|
sort(m_currentSortColumn, m_currentSortOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceModel::newWorkspace(QWidget *parent)
|
void WorkspaceModel::newWorkspace(QWidget *parent)
|
||||||
@@ -225,9 +222,10 @@ void WorkspaceModel::deleteWorkspaces(const QStringList &workspaces)
|
|||||||
{
|
{
|
||||||
if (!m_manager->confirmWorkspaceDelete(workspaces))
|
if (!m_manager->confirmWorkspaceDelete(workspaces))
|
||||||
return;
|
return;
|
||||||
beginResetModel();
|
|
||||||
m_manager->deleteWorkspaces(workspaces);
|
m_manager->deleteWorkspaces(workspaces);
|
||||||
endResetModel();
|
m_sortedWorkspaces = m_manager->workspaces();
|
||||||
|
sort(m_currentSortColumn, m_currentSortOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceModel::renameWorkspace(QWidget *parent, const QString &workspace)
|
void WorkspaceModel::renameWorkspace(QWidget *parent, const QString &workspace)
|
||||||
@@ -242,6 +240,12 @@ void WorkspaceModel::renameWorkspace(QWidget *parent, const QString &workspace)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorkspaceModel::resetWorkspace(const QString &workspace)
|
||||||
|
{
|
||||||
|
if (m_manager->resetWorkspacePreset(workspace) && workspace == m_manager->activeWorkspace())
|
||||||
|
m_manager->reloadActiveWorkspace();
|
||||||
|
}
|
||||||
|
|
||||||
void WorkspaceModel::switchToWorkspace(const QString &workspace)
|
void WorkspaceModel::switchToWorkspace(const QString &workspace)
|
||||||
{
|
{
|
||||||
m_manager->openWorkspace(workspace);
|
m_manager->openWorkspace(workspace);
|
||||||
@@ -255,13 +259,14 @@ void WorkspaceModel::runWorkspaceNameInputDialog(WorkspaceNameInputDialog *works
|
|||||||
QString newWorkspace = workspaceInputDialog->value();
|
QString newWorkspace = workspaceInputDialog->value();
|
||||||
if (newWorkspace.isEmpty() || m_manager->workspaces().contains(newWorkspace))
|
if (newWorkspace.isEmpty() || m_manager->workspaces().contains(newWorkspace))
|
||||||
return;
|
return;
|
||||||
beginResetModel();
|
|
||||||
createWorkspace(newWorkspace);
|
createWorkspace(newWorkspace);
|
||||||
m_sortedWorkspaces = m_manager->workspaces();
|
m_sortedWorkspaces = m_manager->workspaces();
|
||||||
endResetModel();
|
sort(m_currentSortColumn, m_currentSortOrder);
|
||||||
|
|
||||||
if (workspaceInputDialog->isSwitchToRequested())
|
if (workspaceInputDialog->isSwitchToRequested())
|
||||||
switchToWorkspace(newWorkspace);
|
switchToWorkspace(newWorkspace);
|
||||||
|
|
||||||
emit workspaceCreated(newWorkspace);
|
emit workspaceCreated(newWorkspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class WorkspaceModel : public QAbstractTableModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { DefaultWorkspaceRole = Qt::UserRole + 1, LastWorkspaceRole, ActiveWorkspaceRole };
|
enum { PresetWorkspaceRole = Qt::UserRole + 1, LastWorkspaceRole, ActiveWorkspaceRole };
|
||||||
|
|
||||||
explicit WorkspaceModel(DockManager *manager, QObject *parent = nullptr);
|
explicit WorkspaceModel(DockManager *manager, QObject *parent = nullptr);
|
||||||
|
|
||||||
@@ -64,8 +64,6 @@ public:
|
|||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
|
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
|
||||||
|
|
||||||
Q_SCRIPTABLE bool isDefaultVirgin() const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void workspaceSwitched();
|
void workspaceSwitched();
|
||||||
void workspaceCreated(const QString &workspaceName);
|
void workspaceCreated(const QString &workspaceName);
|
||||||
@@ -76,6 +74,7 @@ public:
|
|||||||
void cloneWorkspace(QWidget *parent, const QString &workspace);
|
void cloneWorkspace(QWidget *parent, const QString &workspace);
|
||||||
void deleteWorkspaces(const QStringList &workspaces);
|
void deleteWorkspaces(const QStringList &workspaces);
|
||||||
void renameWorkspace(QWidget *parent, const QString &workspace);
|
void renameWorkspace(QWidget *parent, const QString &workspace);
|
||||||
|
void resetWorkspace(const QString &workspace);
|
||||||
void switchToWorkspace(const QString &workspace);
|
void switchToWorkspace(const QString &workspace);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -84,6 +83,8 @@ private:
|
|||||||
|
|
||||||
QStringList m_sortedWorkspaces;
|
QStringList m_sortedWorkspaces;
|
||||||
DockManager *m_manager;
|
DockManager *m_manager;
|
||||||
|
int m_currentSortColumn;
|
||||||
|
Qt::SortOrder m_currentSortOrder = Qt::AscendingOrder;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ADS
|
} // namespace ADS
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ WorkspaceView::WorkspaceView(QWidget *parent)
|
|||||||
{
|
{
|
||||||
setItemDelegate(new RemoveItemFocusDelegate(this));
|
setItemDelegate(new RemoveItemFocusDelegate(this));
|
||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
setWordWrap(false);
|
setWordWrap(false);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setSortingEnabled(true);
|
setSortingEnabled(true);
|
||||||
@@ -145,6 +145,11 @@ void WorkspaceView::renameCurrentWorkspace()
|
|||||||
m_workspaceModel.renameWorkspace(this, currentWorkspace());
|
m_workspaceModel.renameWorkspace(this, currentWorkspace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorkspaceView::resetCurrentWorkspace()
|
||||||
|
{
|
||||||
|
m_workspaceModel.resetWorkspace(currentWorkspace());
|
||||||
|
}
|
||||||
|
|
||||||
void WorkspaceView::switchToCurrentWorkspace()
|
void WorkspaceView::switchToCurrentWorkspace()
|
||||||
{
|
{
|
||||||
m_workspaceModel.switchToWorkspace(currentWorkspace());
|
m_workspaceModel.switchToWorkspace(currentWorkspace());
|
||||||
@@ -187,10 +192,9 @@ void WorkspaceView::keyPressEvent(QKeyEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QStringList workspaces = selectedWorkspaces();
|
const QStringList workspaces = selectedWorkspaces();
|
||||||
if (!workspaces.contains("default")
|
if (!Utils::anyOf(workspaces, [this](const QString &workspace) {
|
||||||
&& !Utils::anyOf(workspaces, [this](const QString &workspace) {
|
return workspace == m_manager->activeWorkspace();
|
||||||
return workspace == m_manager->activeWorkspace();
|
})) {
|
||||||
})) {
|
|
||||||
deleteWorkspaces(workspaces);
|
deleteWorkspaces(workspaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public:
|
|||||||
void deleteSelectedWorkspaces();
|
void deleteSelectedWorkspaces();
|
||||||
void cloneCurrentWorkspace();
|
void cloneCurrentWorkspace();
|
||||||
void renameCurrentWorkspace();
|
void renameCurrentWorkspace();
|
||||||
|
void resetCurrentWorkspace();
|
||||||
void switchToCurrentWorkspace();
|
void switchToCurrentWorkspace();
|
||||||
|
|
||||||
QString currentWorkspace();
|
QString currentWorkspace();
|
||||||
@@ -64,6 +65,8 @@ public:
|
|||||||
void selectActiveWorkspace();
|
void selectActiveWorkspace();
|
||||||
void selectWorkspace(const QString &workspaceName);
|
void selectWorkspace(const QString &workspaceName);
|
||||||
|
|
||||||
|
QStringList selectedWorkspaces() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activated(const QString &workspace);
|
void activated(const QString &workspace);
|
||||||
void selected(const QStringList &workspaces);
|
void selected(const QStringList &workspaces);
|
||||||
@@ -74,7 +77,6 @@ private:
|
|||||||
void keyPressEvent(QKeyEvent *event) override;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
void deleteWorkspaces(const QStringList &workspaces);
|
void deleteWorkspaces(const QStringList &workspaces);
|
||||||
QStringList selectedWorkspaces() const;
|
|
||||||
|
|
||||||
static WorkspaceDialog *castToWorkspaceDialog(QWidget *widget);
|
static WorkspaceDialog *castToWorkspaceDialog(QWidget *widget);
|
||||||
|
|
||||||
|
|||||||
@@ -806,8 +806,12 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
|
|||||||
m_versionNameLinedit->setText(manifest.attribute(QLatin1String("android:versionName")));
|
m_versionNameLinedit->setText(manifest.attribute(QLatin1String("android:versionName")));
|
||||||
|
|
||||||
QDomElement usesSdkElement = manifest.firstChildElement(QLatin1String("uses-sdk"));
|
QDomElement usesSdkElement = manifest.firstChildElement(QLatin1String("uses-sdk"));
|
||||||
setApiLevel(m_androidMinSdkVersion, usesSdkElement, QLatin1String("android:minSdkVersion"));
|
m_androidMinSdkVersion->setEnabled(!usesSdkElement.isNull());
|
||||||
setApiLevel(m_androidTargetSdkVersion, usesSdkElement, QLatin1String("android:targetSdkVersion"));
|
m_androidTargetSdkVersion->setEnabled(!usesSdkElement.isNull());
|
||||||
|
if (!usesSdkElement.isNull()) {
|
||||||
|
setApiLevel(m_androidMinSdkVersion, usesSdkElement, QLatin1String("android:minSdkVersion"));
|
||||||
|
setApiLevel(m_androidTargetSdkVersion, usesSdkElement, QLatin1String("android:targetSdkVersion"));
|
||||||
|
}
|
||||||
|
|
||||||
QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
|
QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
|
||||||
|
|
||||||
|
|||||||
@@ -149,15 +149,27 @@ AutotestPluginPrivate::AutotestPluginPrivate(AutotestPlugin *parent)
|
|||||||
m_frameworkManager->activateFrameworksFromSettings(&m_settings);
|
m_frameworkManager->activateFrameworksFromSettings(&m_settings);
|
||||||
TestTreeModel::instance()->synchronizeTestFrameworks();
|
TestTreeModel::instance()->synchronizeTestFrameworks();
|
||||||
|
|
||||||
connect(ProjectExplorer::SessionManager::instance(),
|
auto sessionManager = ProjectExplorer::SessionManager::instance();
|
||||||
&ProjectExplorer::SessionManager::startupProjectChanged, this, [this] {
|
connect(sessionManager, &ProjectExplorer::SessionManager::startupProjectChanged,
|
||||||
m_runconfigCache.clear();
|
this, [this] { m_runconfigCache.clear(); });
|
||||||
});
|
|
||||||
|
|
||||||
|
connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject,
|
||||||
|
this, [this] (ProjectExplorer::Project *project) {
|
||||||
|
auto it = s_projectSettings.find(project);
|
||||||
|
if (it != s_projectSettings.end()) {
|
||||||
|
delete it.value();
|
||||||
|
s_projectSettings.erase(it);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
AutotestPluginPrivate::~AutotestPluginPrivate()
|
AutotestPluginPrivate::~AutotestPluginPrivate()
|
||||||
{
|
{
|
||||||
|
if (!s_projectSettings.isEmpty()) {
|
||||||
|
qDeleteAll(s_projectSettings.values());
|
||||||
|
s_projectSettings.clear();
|
||||||
|
}
|
||||||
|
|
||||||
delete m_navigationWidgetFactory;
|
delete m_navigationWidgetFactory;
|
||||||
delete m_resultsPane;
|
delete m_resultsPane;
|
||||||
delete m_frameworkManager;
|
delete m_frameworkManager;
|
||||||
|
|||||||
@@ -166,8 +166,6 @@ signals:
|
|||||||
void coreAboutToClose();
|
void coreAboutToClose();
|
||||||
void contextAboutToChange(const QList<Core::IContext *> &context);
|
void contextAboutToChange(const QList<Core::IContext *> &context);
|
||||||
void contextChanged(const Core::Context &context);
|
void contextChanged(const Core::Context &context);
|
||||||
void windowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
|
|
||||||
void windowActivationChanged(bool isActive, bool hasPopup);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* internal use */
|
/* internal use */
|
||||||
|
|||||||
@@ -197,31 +197,6 @@ MainWindow::MainWindow()
|
|||||||
this, &MainWindow::openDroppedFiles);
|
this, &MainWindow::openDroppedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit View 3D needs to know when the main window's state or activation change
|
|
||||||
void MainWindow::changeEvent(QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::WindowStateChange) {
|
|
||||||
emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState());
|
|
||||||
m_previousWindowStates = windowState();
|
|
||||||
} else if (event->type() == QEvent::ActivationChange) {
|
|
||||||
// check the last 3 children for a possible active window
|
|
||||||
auto rIter = children().rbegin();
|
|
||||||
bool hasPopup = false;
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
|
||||||
if (rIter < children().rend()) {
|
|
||||||
auto child = qobject_cast<QWidget *>(*(rIter++));
|
|
||||||
if (child && child->isActiveWindow()) {
|
|
||||||
hasPopup = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
emit m_coreImpl->windowActivationChanged(isActiveWindow(), hasPopup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NavigationWidget *MainWindow::navigationWidget(Side side) const
|
NavigationWidget *MainWindow::navigationWidget(Side side) const
|
||||||
{
|
{
|
||||||
return side == Side::Left ? m_leftNavigationWidget : m_rightNavigationWidget;
|
return side == Side::Left ? m_leftNavigationWidget : m_rightNavigationWidget;
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
void changeEvent(QEvent *event) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openFile();
|
void openFile();
|
||||||
@@ -195,7 +194,6 @@ private:
|
|||||||
QToolButton *m_toggleRightSideBarButton = nullptr;
|
QToolButton *m_toggleRightSideBarButton = nullptr;
|
||||||
QColor m_overrideColor;
|
QColor m_overrideColor;
|
||||||
QList<std::function<bool()>> m_preCloseListeners;
|
QList<std::function<bool()>> m_preCloseListeners;
|
||||||
Qt::WindowStates m_previousWindowStates = Qt::WindowNoState;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ bool Project::removeTarget(Target *target)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Target *> Project::targets() const
|
const QList<Target *> Project::targets() const
|
||||||
{
|
{
|
||||||
return Utils::toRawPointer<QList>(d->m_targets);
|
return Utils::toRawPointer<QList>(d->m_targets);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
Target *addTargetForKit(Kit *kit);
|
Target *addTargetForKit(Kit *kit);
|
||||||
bool removeTarget(Target *target);
|
bool removeTarget(Target *target);
|
||||||
|
|
||||||
QList<Target *> targets() const;
|
const QList<Target *> targets() const;
|
||||||
// Note: activeTarget can be 0 (if no targets are defined).
|
// Note: activeTarget can be 0 (if no targets are defined).
|
||||||
Target *activeTarget() const;
|
Target *activeTarget() const;
|
||||||
Target *target(Core::Id id) const;
|
Target *target(Core::Id id) const;
|
||||||
|
|||||||
@@ -117,8 +117,9 @@ void QbsSettings::loadSettings()
|
|||||||
{
|
{
|
||||||
QSettings * const s = Core::ICore::settings();
|
QSettings * const s = Core::ICore::settings();
|
||||||
m_settings.qbsExecutableFilePath = FilePath::fromString(s->value(QBS_EXE_KEY).toString());
|
m_settings.qbsExecutableFilePath = FilePath::fromString(s->value(QBS_EXE_KEY).toString());
|
||||||
m_settings.defaultInstallDirTemplate = s->value(QBS_DEFAULT_INSTALL_DIR_KEY,
|
m_settings.defaultInstallDirTemplate = s->value(
|
||||||
"%{CurrentBuild:QbsBuildRoot}").toString();
|
QBS_DEFAULT_INSTALL_DIR_KEY,
|
||||||
|
"%{CurrentBuild:QbsBuildRoot}/install-root").toString();
|
||||||
m_settings.useCreatorSettings = s->value(USE_CREATOR_SETTINGS_KEY, true).toBool();
|
m_settings.useCreatorSettings = s->value(USE_CREATOR_SETTINGS_KEY, true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
@@ -83,12 +84,24 @@ QString ProFileEditorWidget::checkForPrfFile(const QString &baseName) const
|
|||||||
{
|
{
|
||||||
const FilePath projectFile = textDocument()->filePath();
|
const FilePath projectFile = textDocument()->filePath();
|
||||||
const QmakePriFileNode *projectNode = nullptr;
|
const QmakePriFileNode *projectNode = nullptr;
|
||||||
|
|
||||||
|
// FIXME: Remove this check once project nodes are fully "static".
|
||||||
for (const Project * const project : SessionManager::projects()) {
|
for (const Project * const project : SessionManager::projects()) {
|
||||||
if (Target *t = project->activeTarget()) {
|
static const auto isParsing = [](const Project *project) {
|
||||||
if (t->buildSystem()->isParsing())
|
for (const Target * const t : project->targets()) {
|
||||||
continue;
|
for (const BuildConfiguration * const bc : t->buildConfigurations()) {
|
||||||
}
|
if (bc->buildSystem()->isParsing())
|
||||||
projectNode = dynamic_cast<const QmakePriFileNode *>(project->rootProjectNode()
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if (isParsing(project))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ProjectNode * const rootNode = project->rootProjectNode();
|
||||||
|
QTC_ASSERT(rootNode, continue);
|
||||||
|
projectNode = dynamic_cast<const QmakePriFileNode *>(rootNode
|
||||||
->findProjectNode([&projectFile](const ProjectNode *pn) {
|
->findProjectNode([&projectFile](const ProjectNode *pn) {
|
||||||
return pn->filePath() == projectFile;
|
return pn->filePath() == projectFile;
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -139,9 +139,7 @@ extend_qtc_plugin(QmlDesigner
|
|||||||
tokencommand.cpp tokencommand.h
|
tokencommand.cpp tokencommand.h
|
||||||
valueschangedcommand.cpp valueschangedcommand.h
|
valueschangedcommand.cpp valueschangedcommand.h
|
||||||
changeselectioncommand.cpp changeselectioncommand.h
|
changeselectioncommand.cpp changeselectioncommand.h
|
||||||
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
|
|
||||||
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
||||||
view3dclosedcommand.cpp view3dclosedcommand.h
|
|
||||||
puppettocreatorcommand.cpp puppettocreatorcommand.h
|
puppettocreatorcommand.cpp puppettocreatorcommand.h
|
||||||
inputeventcommand.cpp inputeventcommand.h
|
inputeventcommand.cpp inputeventcommand.h
|
||||||
view3dactioncommand.cpp view3dactioncommand.h
|
view3dactioncommand.cpp view3dactioncommand.h
|
||||||
@@ -248,7 +246,6 @@ extend_qtc_plugin(QmlDesigner
|
|||||||
snapper.cpp snapper.h
|
snapper.cpp snapper.h
|
||||||
snappinglinecreator.cpp snappinglinecreator.h
|
snappinglinecreator.cpp snappinglinecreator.h
|
||||||
toolbox.cpp toolbox.h
|
toolbox.cpp toolbox.h
|
||||||
option3daction.cpp option3daction.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
extend_qtc_plugin(QmlDesigner
|
extend_qtc_plugin(QmlDesigner
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ SOURCES += formeditoritem.cpp \
|
|||||||
contentnoteditableindicator.cpp \
|
contentnoteditableindicator.cpp \
|
||||||
backgroundaction.cpp \
|
backgroundaction.cpp \
|
||||||
formeditortoolbutton.cpp \
|
formeditortoolbutton.cpp \
|
||||||
option3daction.cpp \
|
|
||||||
formeditorannotationicon.cpp
|
formeditorannotationicon.cpp
|
||||||
|
|
||||||
HEADERS += formeditorscene.h \
|
HEADERS += formeditorscene.h \
|
||||||
@@ -76,7 +75,6 @@ HEADERS += formeditorscene.h \
|
|||||||
contentnoteditableindicator.h \
|
contentnoteditableindicator.h \
|
||||||
backgroundaction.h \
|
backgroundaction.h \
|
||||||
formeditortoolbutton.h \
|
formeditortoolbutton.h \
|
||||||
option3daction.h \
|
|
||||||
formeditorannotationicon.h
|
formeditorannotationicon.h
|
||||||
|
|
||||||
RESOURCES += formeditor.qrc
|
RESOURCES += formeditor.qrc
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "nodeinstanceview.h"
|
#include "nodeinstanceview.h"
|
||||||
#include "selectiontool.h"
|
#include "selectiontool.h"
|
||||||
#include "movetool.h"
|
#include "movetool.h"
|
||||||
#include "option3daction.h"
|
|
||||||
#include "resizetool.h"
|
#include "resizetool.h"
|
||||||
#include "dragtool.h"
|
#include "dragtool.h"
|
||||||
#include "formeditorwidget.h"
|
#include "formeditorwidget.h"
|
||||||
@@ -87,12 +86,6 @@ void FormEditorView::modelAttached(Model *model)
|
|||||||
setupFormEditorItemTree(rootModelNode());
|
setupFormEditorItemTree(rootModelNode());
|
||||||
|
|
||||||
m_formEditorWidget->updateActions();
|
m_formEditorWidget->updateActions();
|
||||||
m_formEditorWidget->option3DAction()->set3DEnabled(rootModelNode().hasAuxiliaryData("3d-view"));
|
|
||||||
|
|
||||||
// disable option3DAction if no View3D(s) exists in attached model
|
|
||||||
const QList<ModelNode> views3D = rootModelNode().subModelNodesOfType("QtQuick3D.View3D");
|
|
||||||
if (views3D.size() == 0)
|
|
||||||
m_formEditorWidget->option3DAction()->setEnabled(false);
|
|
||||||
|
|
||||||
if (!rewriterView()->errors().isEmpty())
|
if (!rewriterView()->errors().isEmpty())
|
||||||
m_formEditorWidget->showErrorMessageBox(rewriterView()->errors());
|
m_formEditorWidget->showErrorMessageBox(rewriterView()->errors());
|
||||||
@@ -213,7 +206,6 @@ void FormEditorView::createFormEditorWidget()
|
|||||||
});
|
});
|
||||||
|
|
||||||
connect(m_formEditorWidget->showBoundingRectAction(), &QAction::toggled, scene(), &FormEditorScene::setShowBoundingRects);
|
connect(m_formEditorWidget->showBoundingRectAction(), &QAction::toggled, scene(), &FormEditorScene::setShowBoundingRects);
|
||||||
connect(m_formEditorWidget->option3DAction(), &Option3DAction::enabledChanged, this, &FormEditorView::toggle3DViewEnabled);
|
|
||||||
connect(m_formEditorWidget->resetAction(), &QAction::triggered, this, &FormEditorView::resetNodeInstanceView);
|
connect(m_formEditorWidget->resetAction(), &QAction::triggered, this, &FormEditorView::resetNodeInstanceView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,9 +228,6 @@ void FormEditorView::nodeCreated(const ModelNode &node)
|
|||||||
setupFormEditorItemTree(QmlItemNode(node));
|
setupFormEditorItemTree(QmlItemNode(node));
|
||||||
else if (QmlVisualNode::isFlowTransition(node))
|
else if (QmlVisualNode::isFlowTransition(node))
|
||||||
setupFormEditorItemTree(QmlItemNode(node));
|
setupFormEditorItemTree(QmlItemNode(node));
|
||||||
|
|
||||||
if (node.isSubclassOf("QtQuick3D.Node"))
|
|
||||||
m_formEditorWidget->option3DAction()->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorView::modelAboutToBeDetached(Model *model)
|
void FormEditorView::modelAboutToBeDetached(Model *model)
|
||||||
@@ -270,13 +259,6 @@ void FormEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
|
|||||||
const QmlItemNode qmlItemNode(removedNode);
|
const QmlItemNode qmlItemNode(removedNode);
|
||||||
|
|
||||||
removeNodeFromScene(qmlItemNode);
|
removeNodeFromScene(qmlItemNode);
|
||||||
|
|
||||||
const QList<ModelNode> nodes3D = rootModelNode().subModelNodesOfType("QtQuick3D.Node");
|
|
||||||
|
|
||||||
// if no more 3D Nodes exist after the node removal, disable option3DAction
|
|
||||||
bool hasView3D = nodes3D.size() > 1 || (nodes3D.size() == 1 && nodes3D[0] != removedNode);
|
|
||||||
if (!hasView3D)
|
|
||||||
m_formEditorWidget->option3DAction()->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
|
void FormEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
|
||||||
@@ -534,9 +516,6 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const PropertyN
|
|||||||
if (isInvisible)
|
if (isInvisible)
|
||||||
newNode.deselectNode();
|
newNode.deselectNode();
|
||||||
}
|
}
|
||||||
} else if (name == "3d-view") {
|
|
||||||
DesignerSettings::setValue(DesignerSettingsKey::VIEW_3D_ACTIVE, data);
|
|
||||||
m_formEditorWidget->option3DAction()->set3DEnabled(data.toBool());
|
|
||||||
} else if (item.isFlowTransition() || item.isFlowItem() || item.isFlowActionArea()) {
|
} else if (item.isFlowTransition() || item.isFlowItem() || item.isFlowActionArea()) {
|
||||||
FormEditorItem *editorItem = m_scene->itemForQmlItemNode(item);
|
FormEditorItem *editorItem = m_scene->itemForQmlItemNode(item);
|
||||||
if (editorItem)
|
if (editorItem)
|
||||||
@@ -671,22 +650,6 @@ void FormEditorView::exportAsImage()
|
|||||||
m_formEditorWidget->exportAsImage(m_scene->rootFormEditorItem()->boundingRect());
|
m_formEditorWidget->exportAsImage(m_scene->rootFormEditorItem()->boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorView::toggle3DViewEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(model(), return);
|
|
||||||
QTC_ASSERT(rootModelNode().isValid(), return);
|
|
||||||
|
|
||||||
if (enabled == rootModelNode().hasAuxiliaryData("3d-view"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (enabled)
|
|
||||||
rootModelNode().setAuxiliaryData("3d-view", true);
|
|
||||||
else
|
|
||||||
rootModelNode().removeAuxiliaryData("3d-view");
|
|
||||||
|
|
||||||
resetNodeInstanceView();
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
|
QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
|
||||||
{
|
{
|
||||||
QmlObjectNode qmlObjectNode = firstQmlObjectNode;
|
QmlObjectNode qmlObjectNode = firstQmlObjectNode;
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ private:
|
|||||||
void createFormEditorWidget();
|
void createFormEditorWidget();
|
||||||
void temporaryBlockView();
|
void temporaryBlockView();
|
||||||
void resetNodeInstanceView();
|
void resetNodeInstanceView();
|
||||||
void toggle3DViewEnabled(bool enabled);
|
|
||||||
|
|
||||||
QPointer<FormEditorWidget> m_formEditorWidget;
|
QPointer<FormEditorWidget> m_formEditorWidget;
|
||||||
QPointer<FormEditorScene> m_scene;
|
QPointer<FormEditorScene> m_scene;
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
#include <formeditorscene.h>
|
#include <formeditorscene.h>
|
||||||
#include <formeditorview.h>
|
#include <formeditorview.h>
|
||||||
#include <lineeditaction.h>
|
#include <lineeditaction.h>
|
||||||
#include <option3daction.h>
|
|
||||||
#include <zoomaction.h>
|
#include <zoomaction.h>
|
||||||
#include <toolbox.h>
|
#include <toolbox.h>
|
||||||
|
|
||||||
@@ -146,13 +145,6 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
|
|||||||
upperActions.append(m_backgroundAction.data());
|
upperActions.append(m_backgroundAction.data());
|
||||||
m_toolBox->addRightSideAction(m_backgroundAction.data());
|
m_toolBox->addRightSideAction(m_backgroundAction.data());
|
||||||
|
|
||||||
m_option3DAction = new Option3DAction(m_toolActionGroup.data());
|
|
||||||
if (qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")) {
|
|
||||||
addAction(m_option3DAction.data());
|
|
||||||
upperActions.append(m_option3DAction.data());
|
|
||||||
m_toolBox->addRightSideAction(m_option3DAction.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_zoomAction = new ZoomAction(m_toolActionGroup.data());
|
m_zoomAction = new ZoomAction(m_toolActionGroup.data());
|
||||||
connect(m_zoomAction.data(), &ZoomAction::zoomLevelChanged,
|
connect(m_zoomAction.data(), &ZoomAction::zoomLevelChanged,
|
||||||
this, &FormEditorWidget::setZoomLevel);
|
this, &FormEditorWidget::setZoomLevel);
|
||||||
@@ -298,11 +290,6 @@ ZoomAction *FormEditorWidget::zoomAction() const
|
|||||||
return m_zoomAction.data();
|
return m_zoomAction.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
Option3DAction *FormEditorWidget::option3DAction() const
|
|
||||||
{
|
|
||||||
return m_option3DAction.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
QAction *FormEditorWidget::resetAction() const
|
QAction *FormEditorWidget::resetAction() const
|
||||||
{
|
{
|
||||||
return m_resetAction.data();
|
return m_resetAction.data();
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ namespace QmlDesigner {
|
|||||||
class ZoomAction;
|
class ZoomAction;
|
||||||
class LineEditAction;
|
class LineEditAction;
|
||||||
class BackgroundAction;
|
class BackgroundAction;
|
||||||
class Option3DAction;
|
|
||||||
class FormEditorView;
|
class FormEditorView;
|
||||||
class FormEditorScene;
|
class FormEditorScene;
|
||||||
class FormEditorGraphicsView;
|
class FormEditorGraphicsView;
|
||||||
@@ -54,7 +53,6 @@ public:
|
|||||||
FormEditorWidget(FormEditorView *view);
|
FormEditorWidget(FormEditorView *view);
|
||||||
|
|
||||||
ZoomAction *zoomAction() const;
|
ZoomAction *zoomAction() const;
|
||||||
Option3DAction *option3DAction() const;
|
|
||||||
QAction *showBoundingRectAction() const;
|
QAction *showBoundingRectAction() const;
|
||||||
QAction *snappingAction() const;
|
QAction *snappingAction() const;
|
||||||
QAction *snappingAndAnchoringAction() const;
|
QAction *snappingAndAnchoringAction() const;
|
||||||
@@ -113,7 +111,6 @@ private:
|
|||||||
QPointer<LineEditAction> m_rootWidthAction;
|
QPointer<LineEditAction> m_rootWidthAction;
|
||||||
QPointer<LineEditAction> m_rootHeightAction;
|
QPointer<LineEditAction> m_rootHeightAction;
|
||||||
QPointer<BackgroundAction> m_backgroundAction;
|
QPointer<BackgroundAction> m_backgroundAction;
|
||||||
QPointer<Option3DAction> m_option3DAction;
|
|
||||||
QPointer<QAction> m_resetAction;
|
QPointer<QAction> m_resetAction;
|
||||||
QPointer<DocumentWarningWidget> m_documentErrorWidget;
|
QPointer<DocumentWarningWidget> m_documentErrorWidget;
|
||||||
Core::IContext *m_context = nullptr;
|
Core::IContext *m_context = nullptr;
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2019 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "option3daction.h"
|
|
||||||
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QPainter>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
Option3DAction::Option3DAction(QObject *parent) :
|
|
||||||
QWidgetAction(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Option3DAction::set3DEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
if (m_comboBox) {
|
|
||||||
m_comboBox->blockSignals(true);
|
|
||||||
m_comboBox->setCurrentIndex(enabled ? 1 : 0);
|
|
||||||
m_comboBox->blockSignals(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *Option3DAction::createWidget(QWidget *parent)
|
|
||||||
{
|
|
||||||
m_comboBox = new QComboBox(parent);
|
|
||||||
m_comboBox->setFixedWidth(82);
|
|
||||||
|
|
||||||
m_comboBox->addItem(tr("2D"));
|
|
||||||
m_comboBox->addItem(tr("2D/3D"));
|
|
||||||
|
|
||||||
m_comboBox->setCurrentIndex(0);
|
|
||||||
connect(m_comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]() {
|
|
||||||
emit enabledChanged(m_comboBox->currentIndex() != 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
m_comboBox->setProperty("hideborder", true);
|
|
||||||
m_comboBox->setToolTip(tr("Enable/Disable 3D edit mode."));
|
|
||||||
|
|
||||||
return m_comboBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2019 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.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QWidgetAction>
|
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QComboBox)
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class Option3DAction : public QWidgetAction
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit Option3DAction(QObject *parent);
|
|
||||||
void set3DEnabled(bool enabled);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void enabledChanged(bool enabled);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QWidget *createWidget(QWidget *parent) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPointer<QComboBox> m_comboBox;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
||||||
@@ -128,14 +128,10 @@ public:
|
|||||||
void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
|
void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
|
||||||
|
|
||||||
void selectionChanged(const ChangeSelectionCommand &command) override;
|
void selectionChanged(const ChangeSelectionCommand &command) override;
|
||||||
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
|
|
||||||
void view3DClosed(const View3DClosedCommand &command) override;
|
|
||||||
|
|
||||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> &lastSelectedNodeList) override;
|
const QList<ModelNode> &lastSelectedNodeList) override;
|
||||||
|
|
||||||
void mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
|
|
||||||
void mainWindowActiveChanged(bool active, bool hasPopup);
|
|
||||||
void sendInputEvent(QInputEvent *e) const;
|
void sendInputEvent(QInputEvent *e) const;
|
||||||
void view3DAction(const View3DActionCommand &command);
|
void view3DAction(const View3DActionCommand &command);
|
||||||
void edit3DViewResized(const QSize &size) const;
|
void edit3DViewResized(const QSize &size) const;
|
||||||
|
|||||||
@@ -43,9 +43,7 @@
|
|||||||
#include <completecomponentcommand.h>
|
#include <completecomponentcommand.h>
|
||||||
#include <changenodesourcecommand.h>
|
#include <changenodesourcecommand.h>
|
||||||
#include <changeselectioncommand.h>
|
#include <changeselectioncommand.h>
|
||||||
#include <drop3dlibraryitemcommand.h>
|
|
||||||
#include <puppettocreatorcommand.h>
|
#include <puppettocreatorcommand.h>
|
||||||
#include <view3dclosedcommand.h>
|
|
||||||
#include <inputeventcommand.h>
|
#include <inputeventcommand.h>
|
||||||
#include <view3dactioncommand.h>
|
#include <view3dactioncommand.h>
|
||||||
|
|
||||||
@@ -286,9 +284,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
|
|||||||
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
|
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
|
||||||
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
|
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
|
||||||
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
|
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
|
||||||
static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand");
|
|
||||||
static const int puppetToCreatorCommand = QMetaType::type("PuppetToCreatorCommand");
|
static const int puppetToCreatorCommand = QMetaType::type("PuppetToCreatorCommand");
|
||||||
static const int view3DClosedCommand = QMetaType::type("View3DClosedCommand");
|
|
||||||
|
|
||||||
if (m_destructing)
|
if (m_destructing)
|
||||||
return;
|
return;
|
||||||
@@ -314,20 +310,18 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
|
|||||||
nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>());
|
nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>());
|
||||||
} else if (command.userType() == changeSelectionCommandType) {
|
} else if (command.userType() == changeSelectionCommandType) {
|
||||||
nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>());
|
nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>());
|
||||||
} else if (command.userType() == drop3DLibraryItemCommandType) {
|
|
||||||
nodeInstanceClient()->library3DItemDropped(command.value<Drop3DLibraryItemCommand>());
|
|
||||||
} else if (command.userType() == puppetToCreatorCommand) {
|
} else if (command.userType() == puppetToCreatorCommand) {
|
||||||
nodeInstanceClient()->handlePuppetToCreatorCommand(command.value<PuppetToCreatorCommand>());
|
nodeInstanceClient()->handlePuppetToCreatorCommand(command.value<PuppetToCreatorCommand>());
|
||||||
} else if (command.userType() == view3DClosedCommand) {
|
|
||||||
nodeInstanceClient()->view3DClosed(command.value<View3DClosedCommand>());
|
|
||||||
} else if (command.userType() == puppetAliveCommandType) {
|
} else if (command.userType() == puppetAliveCommandType) {
|
||||||
puppetAlive(puppetStreamType);
|
puppetAlive(puppetStreamType);
|
||||||
} else if (command.userType() == synchronizeCommandType) {
|
} else if (command.userType() == synchronizeCommandType) {
|
||||||
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
|
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
|
||||||
m_synchronizeId = synchronizeCommand.synchronizeId();
|
m_synchronizeId = synchronizeCommand.synchronizeId();
|
||||||
} else
|
} else {
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
qCInfo(instanceViewBenchmark) << "dispatching command" << "done" << command.userType();
|
}
|
||||||
|
|
||||||
|
qCInfo(instanceViewBenchmark) << "dispatching command" << "done" << command.userType();
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeInstanceClientInterface *NodeInstanceServerProxy::nodeInstanceClient() const
|
NodeInstanceClientInterface *NodeInstanceServerProxy::nodeInstanceClient() const
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
#include "changebindingscommand.h"
|
#include "changebindingscommand.h"
|
||||||
#include "changeidscommand.h"
|
#include "changeidscommand.h"
|
||||||
#include "changeselectioncommand.h"
|
#include "changeselectioncommand.h"
|
||||||
#include "drop3dlibraryitemcommand.h"
|
|
||||||
#include "changenodesourcecommand.h"
|
#include "changenodesourcecommand.h"
|
||||||
#include "removeinstancescommand.h"
|
#include "removeinstancescommand.h"
|
||||||
#include "removepropertiescommand.h"
|
#include "removepropertiescommand.h"
|
||||||
@@ -1447,23 +1446,10 @@ void NodeInstanceView::selectionChanged(const ChangeSelectionCommand &command)
|
|||||||
selectModelNode(modelNodeForInternalId(instanceId));
|
selectModelNode(modelNodeForInternalId(instanceId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void NodeInstanceView::library3DItemDropped(const Drop3DLibraryItemCommand &command)
|
|
||||||
{
|
|
||||||
QDataStream stream(command.itemData());
|
|
||||||
ItemLibraryEntry itemLibraryEntry;
|
|
||||||
stream >> itemLibraryEntry;
|
|
||||||
QmlVisualNode::createQml3DNode(this, itemLibraryEntry, command.sceneRootId(), {});
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command)
|
void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command)
|
||||||
{
|
{
|
||||||
if (command.type() == PuppetToCreatorCommand::KeyPressed) {
|
if (command.type() == PuppetToCreatorCommand::Edit3DToolState) {
|
||||||
QPair<int, int> data = qvariant_cast<QPair<int, int>>(command.data());
|
|
||||||
int key = data.first;
|
|
||||||
Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers(data.second);
|
|
||||||
|
|
||||||
handlePuppetKeyPress(key, modifiers);
|
|
||||||
} else if (command.type() == PuppetToCreatorCommand::Edit3DToolState) {
|
|
||||||
if (!m_nodeInstanceServer.isNull()) {
|
if (!m_nodeInstanceServer.isNull()) {
|
||||||
auto data = qvariant_cast<QVariantList>(command.data());
|
auto data = qvariant_cast<QVariantList>(command.data());
|
||||||
if (data.size() == 3) {
|
if (data.size() == 3) {
|
||||||
@@ -1481,59 +1467,12 @@ void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// puppet to creator command handlers
|
|
||||||
void NodeInstanceView::handlePuppetKeyPress(int key, Qt::KeyboardModifiers modifiers)
|
|
||||||
{
|
|
||||||
// TODO: optimal way to handle key events is to just pass them on. This is done
|
|
||||||
// using the code below but it is so far not working, if someone could get it to work then
|
|
||||||
// it should be utilized and the rest of the method deleted
|
|
||||||
// QCoreApplication::postEvent([receiver], new QKeyEvent(QEvent::KeyPress, key, modifiers));
|
|
||||||
|
|
||||||
#ifndef QMLDESIGNER_TEST
|
|
||||||
// handle common keyboard actions coming from puppet
|
|
||||||
if (Core::ActionManager::command(Core::Constants::UNDO)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
|
|
||||||
QmlDesignerPlugin::instance()->currentDesignDocument()->undo();
|
|
||||||
else if (Core::ActionManager::command(Core::Constants::REDO)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
|
|
||||||
QmlDesignerPlugin::instance()->currentDesignDocument()->redo();
|
|
||||||
else if (Core::ActionManager::command(Core::Constants::SAVE)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
|
|
||||||
Core::EditorManager::saveDocument();
|
|
||||||
else if (Core::ActionManager::command(Core::Constants::SAVEAS)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
|
|
||||||
Core::EditorManager::saveDocumentAs();
|
|
||||||
else if (Core::ActionManager::command(Core::Constants::SAVEALL)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
|
|
||||||
Core::DocumentManager::saveAllModifiedDocuments();
|
|
||||||
else if (Core::ActionManager::command(QmlDesigner::Constants::C_DELETE)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch)
|
|
||||||
QmlDesignerPlugin::instance()->currentDesignDocument()->deleteSelected();
|
|
||||||
#else
|
|
||||||
Q_UNUSED(key);
|
|
||||||
Q_UNUSED(modifiers);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceView::view3DClosed(const View3DClosedCommand &command)
|
|
||||||
{
|
|
||||||
Q_UNUSED(command)
|
|
||||||
|
|
||||||
rootModelNode().removeAuxiliaryData("3d-view");
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> & /*lastSelectedNodeList*/)
|
const QList<ModelNode> & /*lastSelectedNodeList*/)
|
||||||
{
|
{
|
||||||
nodeInstanceServer()->changeSelection(createChangeSelectionCommand(selectedNodeList));
|
nodeInstanceServer()->changeSelection(createChangeSelectionCommand(selectedNodeList));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeInstanceView::mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates)
|
|
||||||
{
|
|
||||||
if (nodeInstanceServer())
|
|
||||||
nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(previousStates, currentStates));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceView::mainWindowActiveChanged(bool active, bool hasPopup)
|
|
||||||
{
|
|
||||||
if (nodeInstanceServer())
|
|
||||||
nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(active, hasPopup));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceView::sendInputEvent(QInputEvent *e) const
|
void NodeInstanceView::sendInputEvent(QInputEvent *e) const
|
||||||
{
|
{
|
||||||
nodeInstanceServer()->inputEvent(InputEventCommand(e));
|
nodeInstanceServer()->inputEvent(InputEventCommand(e));
|
||||||
|
|||||||
@@ -478,13 +478,10 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
|||||||
auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView();
|
auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView();
|
||||||
view->emitCustomNotification("PuppetStatus", {}, {QVariant(m_qrcMapping)});
|
view->emitCustomNotification("PuppetStatus", {}, {QVariant(m_qrcMapping)});
|
||||||
|
|
||||||
// set env var and aux data if 3d-view is enabled
|
// set env var if QtQuick3D import exists
|
||||||
QmlDesigner::Import import = QmlDesigner::Import::createLibraryImport("QtQuick3D", "1.0");
|
QmlDesigner::Import import = QmlDesigner::Import::createLibraryImport("QtQuick3D", "1.0");
|
||||||
if (m_model->hasImport(import, true, true)
|
if (m_model->hasImport(import, true, true))
|
||||||
&& DesignerSettings::getValue(DesignerSettingsKey::VIEW_3D_ACTIVE).toBool()) {
|
|
||||||
view->rootModelNode().setAuxiliaryData("3d-view", true);
|
|
||||||
environment.set("QMLDESIGNER_QUICK3D_MODE", "true");
|
environment.set("QMLDESIGNER_QUICK3D_MODE", "true");
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QStringList importPaths = m_model->importPaths();
|
QStringList importPaths = m_model->importPaths();
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ void DesignerSettings::fromSettings(QSettings *settings)
|
|||||||
);
|
);
|
||||||
restoreValue(settings, DesignerSettingsKey::SIMPLE_COLOR_PALETTE_CONTENT, QStringList());
|
restoreValue(settings, DesignerSettingsKey::SIMPLE_COLOR_PALETTE_CONTENT, QStringList());
|
||||||
restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true);
|
restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true);
|
||||||
restoreValue(settings, DesignerSettingsKey::VIEW_3D_ACTIVE, false);
|
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ const char STANDALONE_MODE[] = "StandAloneMode";
|
|||||||
const char ENABLE_TIMELINEVIEW[] = "EnableTimelineView";
|
const char ENABLE_TIMELINEVIEW[] = "EnableTimelineView";
|
||||||
const char SIMPLE_COLOR_PALETTE_CONTENT[] = "SimpleColorPaletteContent";
|
const char SIMPLE_COLOR_PALETTE_CONTENT[] = "SimpleColorPaletteContent";
|
||||||
const char ALWAYS_DESIGN_MODE[] = "AlwaysDesignMode";
|
const char ALWAYS_DESIGN_MODE[] = "AlwaysDesignMode";
|
||||||
const char VIEW_3D_ACTIVE[] = "View3DActive";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DesignerSettings : public QHash<QByteArray, QVariant>
|
class DesignerSettings : public QHash<QByteArray, QVariant>
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/inavigationwidgetfactory.h>
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -230,9 +231,12 @@ void DesignModeWidget::setup()
|
|||||||
actionManager.createDefaultAddResourceHandler();
|
actionManager.createDefaultAddResourceHandler();
|
||||||
actionManager.polishActions();
|
actionManager.polishActions();
|
||||||
|
|
||||||
|
auto settings = Core::ICore::settings(QSettings::UserScope);
|
||||||
|
|
||||||
m_dockManager = new ADS::DockManager(this);
|
m_dockManager = new ADS::DockManager(this);
|
||||||
m_dockManager->setConfigFlags(ADS::DockManager::DefaultNonOpaqueConfig);
|
m_dockManager->setConfigFlags(ADS::DockManager::DefaultNonOpaqueConfig);
|
||||||
m_dockManager->setSettings(Core::ICore::settings(QSettings::UserScope));
|
m_dockManager->setSettings(settings);
|
||||||
|
m_dockManager->setWorkspacePresetsPath(Core::ICore::resourcePath() + QLatin1String("/qmldesigner/workspacePresets/"));
|
||||||
|
|
||||||
QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/dockwidgets.css"));
|
QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/dockwidgets.css"));
|
||||||
m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet));
|
m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet));
|
||||||
@@ -369,32 +373,7 @@ void DesignModeWidget::setup()
|
|||||||
if (currentDesignDocument())
|
if (currentDesignDocument())
|
||||||
setupNavigatorHistory(currentDesignDocument()->textEditor());
|
setupNavigatorHistory(currentDesignDocument()->textEditor());
|
||||||
|
|
||||||
// Get a list of all available workspaces
|
m_dockManager->initialize();
|
||||||
QStringList workspaces = m_dockManager->workspaces();
|
|
||||||
QString workspace = ADS::Constants::FACTORY_DEFAULT_NAME;
|
|
||||||
|
|
||||||
// If there is no factory default workspace create one and write the xml file
|
|
||||||
if (!workspaces.contains(ADS::Constants::FACTORY_DEFAULT_NAME)) {
|
|
||||||
createFactoryDefaultWorkspace();
|
|
||||||
// List of workspaces needs to be updated
|
|
||||||
workspaces = m_dockManager->workspaces();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine workspace to restore at startup
|
|
||||||
if (m_dockManager->autoRestorLastWorkspace()) {
|
|
||||||
QString lastWorkspace = m_dockManager->lastWorkspace();
|
|
||||||
if (!lastWorkspace.isEmpty() && workspaces.contains(lastWorkspace))
|
|
||||||
workspace = lastWorkspace;
|
|
||||||
else
|
|
||||||
qDebug() << "Couldn't restore last workspace!";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (workspace.isNull() && workspaces.contains(ADS::Constants::DEFAULT_NAME)) {
|
|
||||||
workspace = ADS::Constants::DEFAULT_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_dockManager->openWorkspace(workspace);
|
|
||||||
|
|
||||||
viewManager().enableWidgets();
|
viewManager().enableWidgets();
|
||||||
readSettings();
|
readSettings();
|
||||||
show();
|
show();
|
||||||
@@ -419,7 +398,11 @@ void DesignModeWidget::aboutToShowWorkspaces()
|
|||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
for (const auto &workspace : m_dockManager->workspaces())
|
// Sort the list of workspaces
|
||||||
|
auto sortedWorkspaces = m_dockManager->workspaces();
|
||||||
|
Utils::sort(sortedWorkspaces);
|
||||||
|
|
||||||
|
for (const auto &workspace : sortedWorkspaces)
|
||||||
{
|
{
|
||||||
QAction *action = ag->addAction(workspace);
|
QAction *action = ag->addAction(workspace);
|
||||||
action->setData(workspace);
|
action->setData(workspace);
|
||||||
@@ -430,87 +413,6 @@ void DesignModeWidget::aboutToShowWorkspaces()
|
|||||||
menu->addActions(ag->actions());
|
menu->addActions(ag->actions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignModeWidget::createFactoryDefaultWorkspace()
|
|
||||||
{
|
|
||||||
ADS::DockAreaWidget* centerArea = nullptr;
|
|
||||||
ADS::DockAreaWidget* leftArea = nullptr;
|
|
||||||
ADS::DockAreaWidget* rightArea = nullptr;
|
|
||||||
ADS::DockAreaWidget* bottomArea = nullptr;
|
|
||||||
|
|
||||||
// Iterate over all widgets and only get the central once to start with creating the factory
|
|
||||||
// default workspace layout.
|
|
||||||
for (const WidgetInfo &widgetInfo : viewManager().widgetInfos()) {
|
|
||||||
if (widgetInfo.placementHint == widgetInfo.CentralPane) {
|
|
||||||
ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
|
|
||||||
if (centerArea)
|
|
||||||
m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, centerArea);
|
|
||||||
else
|
|
||||||
centerArea = m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate over all widgets and get the remaining left, right and bottom widgets
|
|
||||||
for (const WidgetInfo &widgetInfo : viewManager().widgetInfos()) {
|
|
||||||
if (widgetInfo.placementHint == widgetInfo.LeftPane) {
|
|
||||||
ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
|
|
||||||
if (leftArea)
|
|
||||||
m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, leftArea);
|
|
||||||
else
|
|
||||||
leftArea = m_dockManager->addDockWidget(ADS::LeftDockWidgetArea, dockWidget, centerArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (widgetInfo.placementHint == widgetInfo.RightPane) {
|
|
||||||
ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
|
|
||||||
if (rightArea)
|
|
||||||
m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, rightArea);
|
|
||||||
else
|
|
||||||
rightArea = m_dockManager->addDockWidget(ADS::RightDockWidgetArea, dockWidget, centerArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (widgetInfo.placementHint == widgetInfo.BottomPane) {
|
|
||||||
ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
|
|
||||||
if (bottomArea)
|
|
||||||
m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, bottomArea);
|
|
||||||
else
|
|
||||||
bottomArea = m_dockManager->addDockWidget(ADS::BottomDockWidgetArea, dockWidget, centerArea);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate over all 'special' widgets
|
|
||||||
QStringList specialWidgets = {"Projects", "FileSystem", "OpenDocuments"};
|
|
||||||
ADS::DockAreaWidget* leftBottomArea = nullptr;
|
|
||||||
for (const QString &uniqueId : specialWidgets) {
|
|
||||||
ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(uniqueId);
|
|
||||||
if (leftBottomArea)
|
|
||||||
m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, leftBottomArea);
|
|
||||||
else
|
|
||||||
leftBottomArea = m_dockManager->addDockWidget(ADS::BottomDockWidgetArea, dockWidget, leftArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the last widget 'OutputPane' as the bottom bottom area
|
|
||||||
ADS::DockWidget *dockWidget = m_dockManager->findDockWidget("OutputPane");
|
|
||||||
m_dockManager->addDockWidget(ADS::BottomDockWidgetArea, dockWidget, bottomArea);
|
|
||||||
|
|
||||||
// TODO This is just a test
|
|
||||||
auto splitter = centerArea->dockContainer()->rootSplitter();
|
|
||||||
splitter->setSizes({100, 800, 100});
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
m_dockManager->createWorkspace(ADS::Constants::FACTORY_DEFAULT_NAME);
|
|
||||||
|
|
||||||
// Write the xml file
|
|
||||||
Utils::FilePath fileName = m_dockManager->workspaceNameToFileName(ADS::Constants::FACTORY_DEFAULT_NAME);
|
|
||||||
QString errorString;
|
|
||||||
Utils::FileSaver fileSaver(fileName.toString(), QIODevice::Text);
|
|
||||||
QByteArray data = m_dockManager->saveState();
|
|
||||||
if (!fileSaver.hasError()) {
|
|
||||||
fileSaver.write(data);
|
|
||||||
}
|
|
||||||
if (!fileSaver.finalize()) {
|
|
||||||
errorString = fileSaver.errorString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesignModeWidget::toolBarOnGoBackClicked()
|
void DesignModeWidget::toolBarOnGoBackClicked()
|
||||||
{
|
{
|
||||||
if (m_navigatorHistoryCounter > 0) {
|
if (m_navigatorHistoryCounter > 0) {
|
||||||
|
|||||||
@@ -104,8 +104,6 @@ private: // functions
|
|||||||
|
|
||||||
void aboutToShowWorkspaces();
|
void aboutToShowWorkspaces();
|
||||||
|
|
||||||
void createFactoryDefaultWorkspace();
|
|
||||||
|
|
||||||
private: // variables
|
private: // variables
|
||||||
SwitchSplitTabWidget* m_centralTabWidget = nullptr;
|
SwitchSplitTabWidget* m_centralTabWidget = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -253,16 +253,6 @@ void QmlDesignerPlugin::extensionsInitialized()
|
|||||||
connect(Core::ICore::instance(), &Core::ICore::coreAboutToOpen, this, [this] {
|
connect(Core::ICore::instance(), &Core::ICore::coreAboutToOpen, this, [this] {
|
||||||
integrateIntoQtCreator(&d->mainWidget);
|
integrateIntoQtCreator(&d->mainWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(Core::ICore::instance(), &Core::ICore::windowStateChanged, this,
|
|
||||||
[this] (Qt::WindowStates previousStates, Qt::WindowStates currentStates) {
|
|
||||||
d->viewManager.nodeInstanceView()->mainWindowStateChanged(previousStates, currentStates);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(Core::ICore::instance(), &Core::ICore::windowActivationChanged, this,
|
|
||||||
[this] (bool isActive, bool hasPopup) {
|
|
||||||
d->viewManager.nodeInstanceView()->mainWindowActiveChanged(isActive, hasPopup);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList allUiQmlFilesforCurrentProject(const Utils::FilePath &fileName)
|
static QStringList allUiQmlFilesforCurrentProject(const Utils::FilePath &fileName)
|
||||||
|
|||||||
@@ -173,12 +173,8 @@ Project {
|
|||||||
"commands/valueschangedcommand.h",
|
"commands/valueschangedcommand.h",
|
||||||
"commands/changeselectioncommand.cpp",
|
"commands/changeselectioncommand.cpp",
|
||||||
"commands/changeselectioncommand.h",
|
"commands/changeselectioncommand.h",
|
||||||
"commands/drop3dlibraryitemcommand.cpp",
|
|
||||||
"commands/drop3dlibraryitemcommand.h",
|
|
||||||
"commands/update3dviewstatecommand.cpp",
|
"commands/update3dviewstatecommand.cpp",
|
||||||
"commands/update3dviewstatecommand.h",
|
"commands/update3dviewstatecommand.h",
|
||||||
"commands/view3dclosedcommand.cpp",
|
|
||||||
"commands/view3dclosedcommand.h",
|
|
||||||
"commands/puppettocreatorcommand.cpp",
|
"commands/puppettocreatorcommand.cpp",
|
||||||
"commands/puppettocreatorcommand.h",
|
"commands/puppettocreatorcommand.h",
|
||||||
"commands/inputeventcommand.cpp",
|
"commands/inputeventcommand.cpp",
|
||||||
@@ -534,8 +530,6 @@ Project {
|
|||||||
"formeditor/toolbox.h",
|
"formeditor/toolbox.h",
|
||||||
"formeditor/formeditortoolbutton.cpp",
|
"formeditor/formeditortoolbutton.cpp",
|
||||||
"formeditor/formeditortoolbutton.h",
|
"formeditor/formeditortoolbutton.h",
|
||||||
"formeditor/option3daction.cpp",
|
|
||||||
"formeditor/option3daction.h",
|
|
||||||
"importmanager/importlabel.cpp",
|
"importmanager/importlabel.cpp",
|
||||||
"importmanager/importlabel.h",
|
"importmanager/importlabel.h",
|
||||||
"importmanager/importmanagercombobox.cpp",
|
"importmanager/importmanagercombobox.cpp",
|
||||||
|
|||||||
@@ -45,9 +45,7 @@ extend_qtc_executable(qml2puppet
|
|||||||
synchronizecommand.cpp synchronizecommand.h
|
synchronizecommand.cpp synchronizecommand.h
|
||||||
tokencommand.cpp tokencommand.h
|
tokencommand.cpp tokencommand.h
|
||||||
changeselectioncommand.cpp changeselectioncommand.h
|
changeselectioncommand.cpp changeselectioncommand.h
|
||||||
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
|
|
||||||
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
||||||
view3dclosedcommand.cpp view3dclosedcommand.h
|
|
||||||
puppettocreatorcommand.cpp puppettocreatorcommand.h
|
puppettocreatorcommand.cpp puppettocreatorcommand.h
|
||||||
inputeventcommand.cpp inputeventcommand.h
|
inputeventcommand.cpp inputeventcommand.h
|
||||||
view3dactioncommand.cpp view3dactioncommand.h
|
view3dactioncommand.cpp view3dactioncommand.h
|
||||||
|
|||||||
@@ -95,12 +95,8 @@ QtcTool {
|
|||||||
"commands/valueschangedcommand.h",
|
"commands/valueschangedcommand.h",
|
||||||
"commands/changeselectioncommand.cpp",
|
"commands/changeselectioncommand.cpp",
|
||||||
"commands/changeselectioncommand.h",
|
"commands/changeselectioncommand.h",
|
||||||
"commands/drop3dlibraryitemcommand.cpp",
|
|
||||||
"commands/drop3dlibraryitemcommand.h",
|
|
||||||
"commands/update3dviewstatecommand.cpp",
|
"commands/update3dviewstatecommand.cpp",
|
||||||
"commands/update3dviewstatecommand.h",
|
"commands/update3dviewstatecommand.h",
|
||||||
"commands/view3dclosedcommand.cpp",
|
|
||||||
"commands/view3dclosedcommand.h",
|
|
||||||
"commands/puppettocreatorcommand.cpp",
|
"commands/puppettocreatorcommand.cpp",
|
||||||
"commands/puppettocreatorcommand.h",
|
"commands/puppettocreatorcommand.h",
|
||||||
"commands/inputeventcommand.cpp",
|
"commands/inputeventcommand.cpp",
|
||||||
|
|||||||