Merge remote-tracking branch 'origin/4.12'

Change-Id: I04d9cc69a07d4d07b1bf1df57681d6a68587d7ba
This commit is contained in:
Eike Ziller
2020-03-06 09:44:11 +01:00
74 changed files with 536 additions and 1097 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -58,10 +58,7 @@
\list 1
\li To generate debug symbols also for applications compiled in release
mode, select \uicontrol {Projects}, and then select
\uicontrol Details next to \uicontrol {Build Steps} to view the
build steps.
\li Select the \uicontrol {Generate separate debug info} check box.
\uicontrol Enable in the \uicontrol {Separate debug info} field.
\li Select \uicontrol Yes to recompile the project.

View File

@@ -67,7 +67,7 @@
\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,
which presents a security risk. Anyone on the Internet could connect

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
@@ -58,8 +58,9 @@
for building and running projects, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol General. The
\uicontrol CMake tab contains additional settings for CMake. You can find
more settings for CMake and Qbs in \uicontrol Tools > \uicontrol Options >
\uicontrol Kits > \uicontrol CMake and \uicontrol Qbs.
more settings for CMake in \uicontrol Tools > \uicontrol Options >
\uicontrol Kits > \uicontrol CMake and for Qbs in \uicontrol Tools >
\uicontrol Options > \uicontrol Qbs.
To specify build and run settings for different target platforms,
select \uicontrol Projects. For more information on the options you have,

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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.
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
@@ -59,22 +59,32 @@
\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
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
profiles in the Qbs settings directory instead, by deselecting the
\uicontrol {Store profiles in \QC settings directory} check box.
profiles in the Qbs settings directory instead.
In the \uicontrol Kit field, select a build and run kit to view the
properties of the associated Qbs profile. To modify the properties of the
Qbs profile associated with a kit, select \uicontrol Tools >
\uicontrol Options > \uicontrol Kits. For more
information, see \l{Editing Qbs Profiles}.
To specify settings for Qbs:
\list 1
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Qbs.
\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

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
@@ -41,15 +41,6 @@
\li In the \uicontrol {Parallel jobs} field, specify the number of
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
to the project. Use colons (:) to separate keys from values.
For more information, see
@@ -70,6 +61,13 @@
\li Select \uicontrol {Force probes} to force re-execution of
the configure scripts of
\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
location after building them. This option is enabled by

View File

@@ -59,9 +59,12 @@
Select the build configuration to edit in the
\uicontrol {Edit build configuration} field.
The available build settings depend on the build system that you selected
for the project.
\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
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
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
\section1 Starting External Processes
@@ -174,24 +201,6 @@
\uicontrol {Override MAKEFLAGS} check box to override existing MAKEFLAGS
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-settings-build-qbs.qdocinc qbs build steps

View File

@@ -199,7 +199,9 @@
\section1 Editing Qbs Profiles
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
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 {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
the key to add or modify as: \c <module_name>.<property_name>.

View File

@@ -27,9 +27,7 @@ HEADERS += $$PWD/changeauxiliarycommand.h
HEADERS += $$PWD/removesharedmemorycommand.h
HEADERS += $$PWD/puppetalivecommand.h
HEADERS += $$PWD/changeselectioncommand.h
HEADERS += $$PWD/drop3dlibraryitemcommand.h
HEADERS += $$PWD/update3dviewstatecommand.h
HEADERS += $$PWD/view3dclosedcommand.h
HEADERS += $$PWD/puppettocreatorcommand.h
HEADERS += $$PWD/inputeventcommand.h
HEADERS += $$PWD/view3dactioncommand.h
@@ -61,9 +59,7 @@ SOURCES += $$PWD/changeauxiliarycommand.cpp
SOURCES += $$PWD/removesharedmemorycommand.cpp
SOURCES += $$PWD/puppetalivecommand.cpp
SOURCES += $$PWD/changeselectioncommand.cpp
SOURCES += $$PWD/drop3dlibraryitemcommand.cpp
SOURCES += $$PWD/update3dviewstatecommand.cpp
SOURCES += $$PWD/view3dclosedcommand.cpp
SOURCES += $$PWD/puppettocreatorcommand.cpp
SOURCES += $$PWD/inputeventcommand.cpp
SOURCES += $$PWD/view3dactioncommand.cpp

View File

@@ -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

View File

@@ -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)

View File

@@ -34,7 +34,7 @@ namespace QmlDesigner {
class PuppetToCreatorCommand
{
public:
enum Type { KeyPressed, Edit3DToolState, Render3DView, ActiveSceneChanged, None };
enum Type { Edit3DToolState, Render3DView, ActiveSceneChanged, None };
PuppetToCreatorCommand(Type type, const QVariant &data);
PuppetToCreatorCommand() = default;

View File

@@ -30,47 +30,12 @@
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)
: m_size(size)
, 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
{
return m_size;
@@ -83,10 +48,6 @@ Update3dViewStateCommand::Type Update3dViewStateCommand::type() const
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 << command.size();
@@ -95,16 +56,8 @@ QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &comman
QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command)
{
in >> command.m_previousStates;
in >> command.m_currentStates;
qint32 active;
qint32 hasPopup;
qint32 type;
in >> active;
in >> hasPopup;
in >> type;
command.m_active = active;
command.m_hasPopup = hasPopup;
command.m_type = Update3dViewStateCommand::Type(type);
in >> command.m_size;

View File

@@ -36,28 +36,15 @@ class Update3dViewStateCommand
friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
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);
Update3dViewStateCommand() = default;
Qt::WindowStates previousStates() const;
Qt::WindowStates currentStates() const;
bool isActive() const;
bool hasPopup() const;
QSize size() const;
Type type() const;
private:
Qt::WindowStates m_previousStates = Qt::WindowNoState;
Qt::WindowStates m_currentStates = Qt::WindowNoState;
bool m_active = false;
bool m_hasPopup = false;
QSize m_size;
Type m_type = Empty;

View File

@@ -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

View File

@@ -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)

View File

@@ -71,8 +71,6 @@
#include "debugoutputcommand.h"
#include "puppetalivecommand.h"
#include "changeselectioncommand.h"
#include "drop3dlibraryitemcommand.h"
#include "view3dclosedcommand.h"
#include "puppettocreatorcommand.h"
namespace QmlDesigner {
@@ -152,7 +150,6 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand)
static const int tokenCommandType = QMetaType::type("TokenCommand");
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand");
if (command.userType() == controlCommand.userType()) {
if (command.userType() == informationChangedCommandType)
@@ -177,8 +174,6 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand)
return command.value<DebugOutputCommand>() == controlCommand.value<DebugOutputCommand>();
else if (command.userType() == changeSelectionCommandType)
return command.value<ChangeSelectionCommand>() == controlCommand.value<ChangeSelectionCommand>();
else if (command.userType() == drop3DLibraryItemCommandType)
return command.value<Drop3DLibraryItemCommand>() == controlCommand.value<Drop3DLibraryItemCommand>();
}
return false;
@@ -266,21 +261,11 @@ void NodeInstanceClientProxy::selectionChanged(const ChangeSelectionCommand &com
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::library3DItemDropped(const Drop3DLibraryItemCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::view3DClosed(const View3DClosedCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::flush()
{
}

View File

@@ -58,9 +58,7 @@ class ChangeStateCommand;
class ChangeNodeSourceCommand;
class EndPuppetCommand;
class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
class PuppetToCreatorCommand;
class View3DClosedCommand;
class InputEventCommand;
class View3DActionCommand;
@@ -82,9 +80,7 @@ public:
void debugOutput(const DebugOutputCommand &command) override;
void puppetAlive(const PuppetAliveCommand &command);
void selectionChanged(const ChangeSelectionCommand &command) override;
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) override;
void view3DClosed(const View3DClosedCommand &command) override;
void flush() override;
void synchronizeWithClientProcess() override;

View File

@@ -41,8 +41,6 @@ class RemoveSharedMemoryCommand;
class DebugOutputCommand;
class PuppetAliveCommand;
class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
class View3DClosedCommand;
class PuppetToCreatorCommand;
class NodeInstanceClientInterface
@@ -58,8 +56,6 @@ public:
virtual void token(const TokenCommand &command) = 0;
virtual void debugOutput(const DebugOutputCommand &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 flush() {}

View File

@@ -47,7 +47,6 @@
#include "addimportcontainer.h"
#include "changenodesourcecommand.h"
#include "changeselectioncommand.h"
#include "drop3dlibraryitemcommand.h"
#include "inputeventcommand.h"
#include "view3dactioncommand.h"
@@ -64,7 +63,6 @@
#include "endpuppetcommand.h"
#include "debugoutputcommand.h"
#include "puppetalivecommand.h"
#include "view3dclosedcommand.h"
#include "puppettocreatorcommand.h"
#include <enumeration.h>
@@ -116,9 +114,6 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<ChangeSelectionCommand>("ChangeSelectionCommand");
qRegisterMetaTypeStreamOperators<ChangeSelectionCommand>("ChangeSelectionCommand");
qRegisterMetaType<Drop3DLibraryItemCommand>("Drop3DLibraryItemCommand");
qRegisterMetaTypeStreamOperators<Drop3DLibraryItemCommand>("Drop3DLibraryItemCommand");
qRegisterMetaType<RemovePropertiesCommand>("RemovePropertiesCommand");
qRegisterMetaTypeStreamOperators<RemovePropertiesCommand>("RemovePropertiesCommand");
@@ -206,9 +201,6 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<PuppetAliveCommand>("PuppetAliveCommand");
qRegisterMetaTypeStreamOperators<PuppetAliveCommand>("PuppetAliveCommand");
qRegisterMetaType<View3DClosedCommand>("View3DClosedCommand");
qRegisterMetaTypeStreamOperators<View3DClosedCommand>("View3DClosedCommand");
qRegisterMetaType<PuppetToCreatorCommand>("PuppetToCreatorCommand");
qRegisterMetaTypeStreamOperators<PuppetToCreatorCommand>("PuppetToCreatorCommand");

View File

@@ -67,7 +67,6 @@
#include <tokencommand.h>
#include <removesharedmemorycommand.h>
#include <changeselectioncommand.h>
#include <drop3dlibraryitemcommand.h>
#include <inputeventcommand.h>
#include <view3dactioncommand.h>
@@ -1178,12 +1177,6 @@ ChangeSelectionCommand NodeInstanceServer::createChangeSelectionCommand(const QL
return ChangeSelectionCommand(idVector);
}
Drop3DLibraryItemCommand NodeInstanceServer::createDrop3DLibraryItemCommand(const QByteArray &itemData,
qint32 sceneRootId)
{
return Drop3DLibraryItemCommand(itemData, sceneRootId);
}
ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVector<InstancePropertyPair> &propertyList) const
{
QVector<PropertyValueContainer> valueVector;

View File

@@ -70,7 +70,6 @@ class AddImportContainer;
class MockupTypeContainer;
class IdContainer;
class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
namespace Internal {
class ChildrenChangeEventFilter;
@@ -184,7 +183,6 @@ protected:
ChildrenChangedCommand createChildrenChangedCommand(const ServerNodeInstance &parentInstance, const QList<ServerNodeInstance> &instanceList) const;
ComponentCompletedCommand createComponentCompletedCommand(const QList<ServerNodeInstance> &instanceList);
ChangeSelectionCommand createChangeSelectionCommand(const QList<ServerNodeInstance> &instanceList);
Drop3DLibraryItemCommand createDrop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId);
void addChangedProperty(const InstancePropertyPair &property);

View File

@@ -59,9 +59,7 @@
#include "tokencommand.h"
#include "removesharedmemorycommand.h"
#include "objectnodeinstance.h"
#include "drop3dlibraryitemcommand.h"
#include "puppettocreatorcommand.h"
#include "view3dclosedcommand.h"
#include "inputeventcommand.h"
#include "view3dactioncommand.h"
@@ -100,80 +98,9 @@ static QVariant objectToVariant(QObject *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()
{
#ifdef QUICK3D_MODULE
static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
qmlRegisterRevision<QQuick3DNode, 1>("MouseArea3D", 1, 0);
qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D");
qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("CameraGeometry", 1, 0, "CameraGeometry");
@@ -187,37 +114,19 @@ void Qt5InformationNodeInstanceServer::createEditView3D()
engine()->rootContext()->setContextProperty("_generalHelper", helper);
m_3dHelper = helper;
QQmlComponent component(engine());
if (showEditView) {
component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditWindow3D.qml"));
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());
QQmlComponent component(engine());
component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"));
m_editView3DRootItem = qobject_cast<QQuickItem *>(component.create());
}
if (!m_editView3DRootItem) {
qWarning() << "Could not create edit view 3D: " << component.errors();
return;
}
if (!showEditView) {
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)),
this, SLOT(handleSelectionChanged(QVariant)));
@@ -233,8 +142,6 @@ void Qt5InformationNodeInstanceServer::createEditView3D()
this, &Qt5InformationNodeInstanceServer::doRender3DEditView);
helper->setParent(m_editView3DRootItem);
if (showEditView)
helper->setEdit3DWindow(m_editWindow3D);
#endif
}
@@ -521,8 +428,7 @@ void Qt5InformationNodeInstanceServer::render3DEditView()
// render the 3D edit view and send the result to creator process
void Qt5InformationNodeInstanceServer::doRender3DEditView()
{
static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
if (m_editView3DRootItem && !showEditView) {
if (m_editView3DRootItem) {
if (!m_editView3DContentItem) {
m_editView3DContentItem = QQmlProperty::read(m_editView3DRootItem, "contentItem").value<QQuickItem *>();
if (m_editView3DContentItem) {
@@ -1258,7 +1164,7 @@ void Qt5InformationNodeInstanceServer::changeAuxiliaryValues(const ChangeAuxilia
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)
{
#ifdef QUICK3D_MODULE
@@ -1270,19 +1176,6 @@ void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewState
helper->storeToolState(helper->globalStateId(), "rootSize", QVariant(command.size()), 0);
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
Q_UNUSED(command)

View File

@@ -73,7 +73,6 @@ private slots:
protected:
void collectItemChangesAndSendChangeCommands() override;
bool eventFilter(QObject *obj, QEvent *event) override;
void sendChildrenChangedCommand(const QList<ServerNodeInstance> &childList);
void sendTokenBack();
bool isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const;
@@ -101,7 +100,6 @@ private:
void modifyVariantValue(const QVariant &node,
const PropertyName &propertyName,
ValuesModifiedCommand::TransactionOption option);
bool dropAcceptable(QDragMoveEvent *event) const;
void updateView3DRect(QObject *view3D);
void updateActiveSceneToEditView3D();
void removeNode3D(QObject *node);
@@ -111,7 +109,6 @@ private:
void doRender3DEditView();
QPointer<QQuickView> m_editView3D;
QPointer<QQuickWindow> m_editWindow3D;
QQuickItem *m_editView3DRootItem = nullptr;
QQuickItem *m_editView3DContentItem = nullptr;
QSet<QObject *> m_view3Ds;

View File

@@ -54,30 +54,20 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
NodeInstanceClientProxy(parent)
{
prioritizeDown();
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
DesignerSupport::activateDesignerWindowManager();
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");
setNodeInstanceServer(new Qt5TestNodeInstanceServer(this));
initializeCapturedStream(QCoreApplication::arguments().at(2));
readDataStream();
QCoreApplication::exit();
} else if (QCoreApplication::arguments().at(2) == QLatin1String("previewmode")) {
DesignerSupport::activateDesignerWindowManager();
setNodeInstanceServer(new Qt5PreviewNodeInstanceServer(this));
initializeSocket();
} 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));
initializeSocket();
} else if (QCoreApplication::arguments().at(2) == QLatin1String("rendermode")) {
DesignerSupport::activateDesignerWindowManager();
setNodeInstanceServer(new Qt5RenderNodeInstanceServer(this));
initializeSocket();
}

View File

@@ -71,21 +71,9 @@ void Qt5NodeInstanceServer::initializeView()
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")) {
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);
}
}

View File

@@ -79,7 +79,6 @@ void Quick3DNodeInstance::setPickable(bool enable, bool checkParent, bool applyT
#ifdef QUICK3D_MODULE
auto node = quick3DNode();
if (node) {
QQuick3DObject::Type nodeType = node->type();
bool parentHidden = false;
if (checkParent) {
// 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);
}
}
if (nodeType == QQuick3DObject::Type::Model)
if (qobject_cast<QQuick3DModel *>(node))
setPropertyVariant("pickable", enable); // allow 3D objects to receive mouse clicks
}
}

View File

@@ -88,6 +88,8 @@ Column {
//Delay setting the color to keep ui responsive
colorEditorTimer.restart()
}
colorPalette.selectedColor = color
}
ColorLine {
@@ -178,6 +180,7 @@ Column {
}
gradientLine.isInValidState = true
colorEditor.originalColor = colorEditor.color
colorPalette.selectedColor = colorEditor.color
}
}
@@ -673,8 +676,10 @@ Column {
border.width: 1
border.color: "#555555"
MouseArea {
ToolTipArea {
anchors.fill: parent
tooltip: originalColorRectangle.color
onClicked: {
if (!colorEditor.transparent)
colorEditor.color = colorEditor.originalColor
@@ -722,7 +727,6 @@ Column {
onDialogColorChanged: colorEditor.color = colorPalette.selectedColor
}
}
}
}
}

View File

@@ -73,9 +73,12 @@ Item {
border.width: 1
}
MouseArea {
ToolTipArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
tooltip: colorCode
onClicked: {
if ((mouse.button === Qt.LeftButton) && clickable)
selectedColor = colorRectangle.color
@@ -85,6 +88,7 @@ Item {
contextMenu.popup()
}
}
StudioControls.Menu {
id: contextMenu
StudioControls.MenuItem {

View 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>

View 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>

View File

@@ -92,10 +92,12 @@ namespace ADS
QString m_workspaceName;
bool m_workspaceListDirty = true;
QStringList m_workspaces;
QSet<QString> m_workspacePresets;
QHash<QString, QDateTime> m_workspaceDateTimes;
QString m_workspaceToRestoreAtStartup;
bool m_autorestoreLastWorkspace; // This option is set in the Workspace Manager!
QSettings *m_settings = nullptr;
QString m_workspacePresetsPath;
/**
* Private data constructor
@@ -127,17 +129,15 @@ namespace ADS
void hideFloatingWidgets()
{
// Hide updates of floating widgets from user
for (auto floatingWidget : m_floatingWidgets) { // TODO qAsConst()
for (auto floatingWidget : m_floatingWidgets) // TODO qAsConst()
floatingWidget->hide();
}
}
void markDockWidgetsDirty()
{
for (auto dockWidget : m_dockWidgetsMap) { // TODO qAsConst()
for (auto dockWidget : m_dockWidgetsMap) // TODO qAsConst()
dockWidget->setProperty("dirty", true);
}
}
/**
* Restores the container with the given index
@@ -153,9 +153,8 @@ namespace ADS
bool DockManagerPrivate::restoreContainer(int index, DockingStateReader &stream, bool testing)
{
if (testing) {
if (testing)
index = 0;
}
bool result = false;
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?
if (state.isEmpty()) {
if (state.isEmpty())
return false;
}
DockingStateReader stateReader(state);
stateReader.readNextStartElement();
if (!stateReader.readNextStartElement())
return false;
if (stateReader.name() != "QtAdvancedDockingSystem") {
if (stateReader.name() != "QtAdvancedDockingSystem")
return false;
}
qCInfo(adsLog) << stateReader.attributes().value("version");
bool ok;
int v = stateReader.attributes().value("version").toInt(&ok);
if (!ok || v > CurrentVersion) {
if (!ok || v > CurrentVersion)
return false;
}
stateReader.setFileVersion(v);
bool result = true;
@@ -210,9 +208,9 @@ namespace ADS
while (stateReader.readNextStartElement()) {
if (stateReader.name() == "container") {
result = restoreContainer(dockContainerCount, stateReader, testing);
if (!result) {
if (!result)
break;
}
dockContainerCount++;
}
}
@@ -265,9 +263,9 @@ namespace ADS
if (!dockWidget || dockWidget->isClosed()) {
int index = dockArea->indexOfFirstOpenDockWidget();
if (index < 0) {
if (index < 0)
continue;
}
dockArea->setCurrentIndex(index);
} else {
dockArea->internalSetCurrentDockWidget(dockWidget);
@@ -336,25 +334,17 @@ namespace ADS
d->m_dockAreaOverlay = new DockOverlay(this, DockOverlay::ModeDockAreaOverlay);
d->m_containerOverlay = new DockOverlay(this, DockOverlay::ModeContainerOverlay);
d->m_containers.append(this);
//d->loadStylesheet();
}
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);
save();
saveStartupWorkspace();
for (auto floatingWidget : d->m_floatingWidgets) {
for (auto floatingWidget : d->m_floatingWidgets)
delete floatingWidget;
}
delete d;
}
@@ -385,6 +375,8 @@ namespace ADS
void DockManager::setSettings(QSettings *settings) { d->m_settings = settings; }
void DockManager::setWorkspacePresetsPath(const QString &path) { d->m_workspacePresetsPath = path; }
DockAreaWidget *DockManager::addDockWidget(DockWidgetArea area,
DockWidget *dockWidget,
DockAreaWidget *dockAreaWidget)
@@ -393,6 +385,24 @@ namespace ADS
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 *areaWidget = lastAddedDockAreaWidget(area);
@@ -415,9 +425,8 @@ namespace ADS
{
d->m_dockWidgetsMap.insert(dockWidget->objectName(), dockWidget);
DockAreaWidget *oldDockArea = dockWidget->dockAreaWidget();
if (oldDockArea) {
if (oldDockArea)
oldDockArea->removeDockWidget(dockWidget);
}
dockWidget->setDockManager(this);
FloatingDockContainer *floatingWidget = new FloatingDockContainer(dockWidget);
@@ -480,9 +489,8 @@ namespace ADS
stream.writeStartElement("QtAdvancedDockingSystem");
stream.writeAttribute("version", QString::number(version));
stream.writeAttribute("containers", QString::number(d->m_containers.count()));
for (auto container : d->m_containers) {
for (auto container : d->m_containers)
container->saveState(stream);
}
stream.writeEndElement();
stream.writeEndDocument();
@@ -493,9 +501,8 @@ namespace ADS
{
// Prevent multiple calls as long as state is not restore. This may
// happen, if QApplication::processEvents() is called somewhere
if (d->m_restoringState) {
if (d->m_restoringState)
return false;
}
// We hide the complete dock manager here. Restoring the state means
// 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
// hiding
bool isHidden = this->isHidden();
if (!isHidden) {
if (!isHidden)
hide();
}
d->m_restoringState = true;
emit restoringState();
bool result = d->restoreState(state, version);
d->m_restoringState = false;
emit stateRestored();
if (!isHidden) {
if (!isHidden)
show();
}
return result;
}
@@ -524,13 +530,12 @@ namespace ADS
void DockManager::showEvent(QShowEvent *event)
{
Super::showEvent(event);
if (d->m_uninitializedFloatingWidgets.empty()) {
if (d->m_uninitializedFloatingWidgets.empty())
return;
}
for (auto floatingWidget : d->m_uninitializedFloatingWidgets) {
for (auto floatingWidget : d->m_uninitializedFloatingWidgets)
floatingWidget->show();
}
d->m_uninitializedFloatingWidgets.clear();
}
@@ -553,8 +558,7 @@ namespace ADS
void DockManager::showWorkspaceMananger()
{
// Save current workspace
save();
save(); // Save current workspace
WorkspaceDialog workspaceDialog(this, parentWidget());
workspaceDialog.setAutoLoadWorkspace(autoRestorLastWorkspace());
@@ -565,30 +569,22 @@ namespace ADS
workspaceDialog.autoLoadWorkspace());
}
bool DockManager::isFactoryDefaultWorkspace(const QString &workspace) const
bool DockManager::isWorkspacePreset(const QString &workspace) const
{
return workspace == QLatin1String(Constants::FACTORY_DEFAULT_NAME);
}
bool DockManager::isDefaultWorkspace(const QString &workspace) const
{
return workspace == QLatin1String(Constants::DEFAULT_NAME);
return d->m_workspacePresets.contains(workspace);
}
bool DockManager::save()
{
if (isFactoryDefaultWorkspace(activeWorkspace()))
return true;
emit aboutToSaveWorkspace();
bool result = write(saveState(), parentWidget());
bool result = write(activeWorkspace(), saveState(), parentWidget());
if (result) {
d->m_workspaceDateTimes.insert(activeWorkspace(), QDateTime::currentDateTime());
} else {
QMessageBox::warning(parentWidget(),
tr("Cannot Save Session"),
tr("Could not save session to file %1")
tr("Cannot Save Workspace"),
tr("Could not save workspace to file %1")
.arg(workspaceNameToFileName(d->m_workspaceName)
.toUserOutput()));
}
@@ -624,15 +620,13 @@ namespace ADS
QFileInfoList workspaceFiles
= workspaceDir.entryInfoList(QStringList() << QLatin1String("*.wrk"),
QDir::NoFilter,
QDir::Time); // TODO Choose different extension
QDir::Time);
for (const QFileInfo &fileInfo : workspaceFiles) {
QString filename = fileInfo.completeBaseName();
filename.replace("_", " ");
d->m_workspaceDateTimes.insert(filename, fileInfo.lastModified());
//if (name != QLatin1String(Constants::DEFAULT_NAME))
tmp.insert(filename);
}
//d->m_workspaces.prepend(QLatin1String(Constants::DEFAULT_NAME));
d->m_workspaceListDirty = false;
d->m_workspaces = Utils::toList(tmp);
@@ -640,6 +634,23 @@ namespace ADS
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
{
return d->m_workspaceDateTimes.value(workspace);
@@ -661,12 +672,21 @@ namespace ADS
{
if (workspaces().contains(workspace))
return false;
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)
@@ -674,7 +694,7 @@ namespace ADS
// 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
// load the default workspace.
if (workspace == d->m_workspaceName) // && !isFactoryDefaultWorkspace(workspace))
if (workspace == d->m_workspaceName && !isWorkspacePreset(workspace))
return true;
if (!workspaces().contains(workspace))
@@ -684,38 +704,45 @@ namespace ADS
if (!d->m_workspaceName.isEmpty()) {
// Allow everyone to set something in the workspace and before saving
emit aboutToUnloadWorkspace(d->m_workspaceName);
if (!save()) {
if (!save())
return false;
}
}
// Try loading the file
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()));
QByteArray data = loadWorkspace(workspace);
if (data.isEmpty())
return false;
}
data = file.readAll();
file.close();
}
emit openingWorkspace(workspace);
// If data was loaded from file try to restore its state
if (!data.isNull() && !restoreState(data)) {
if (!data.isNull() && !restoreState(data))
return false;
}
d->m_workspaceName = workspace;
emit workspaceLoaded(workspace);
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
*/
@@ -742,6 +769,7 @@ namespace ADS
// Remove workspace from internal list
if (!d->m_workspaces.contains(workspace))
return false;
d->m_workspaces.removeOne(workspace);
emit workspacesRemoved();
@@ -752,8 +780,7 @@ namespace ADS
if (fi.exists())
return fi.remove();
return false; // TODO If we allow temporary workspaces without writing them to file
// directly, this needs to be true otherwise in all those cases it will return false.
return false;
}
void DockManager::deleteWorkspaces(const QStringList &workspaces)
@@ -787,36 +814,111 @@ namespace ADS
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;
tmp.mkpath(fileName.toFileInfo().path());
Utils::FileSaver fileSaver(fileName.toString(), QIODevice::Text);
if (!fileSaver.hasError()) {
tmp.mkpath(filename.toFileInfo().path());
Utils::FileSaver fileSaver(filename.toString(), QIODevice::Text);
if (!fileSaver.hasError())
fileSaver.write(data);
}
bool ok = fileSaver.finalize();
if (!ok && errorString) {
if (!ok && errorString)
*errorString = fileSaver.errorString();
}
return ok;
}
#ifdef QT_GUI_LIB
bool DockManager::write(const QByteArray &data, QWidget *parent) const
bool DockManager::write(const QString &workspace, const QByteArray &data, QWidget *parent) const
{
QString errorString;
const bool success = write(data, &errorString);
const bool success = write(workspace, data, &errorString);
if (!success)
QMessageBox::critical(parent,
QCoreApplication::translate("Utils::FileSaverBase", "File Error"),
errorString);
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

View File

@@ -60,8 +60,7 @@ QT_END_NAMESPACE
namespace ADS {
namespace Constants {
const char FACTORY_DEFAULT_NAME[] = "factorydefault";
const char DEFAULT_NAME[] = "default";
const char DEFAULT_WORKSPACE[] = "Essentials"; // This needs to align with a name of the shipped presets
const char STARTUP_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/StartupWorkspace";
const char AUTO_RESTORE_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/AutoRestoreLastWorkspace";
} // namespace Constants
@@ -271,6 +270,13 @@ public:
*/
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.
* If DockAreaWidget is not null, then the area parameter indicates the area
@@ -445,12 +451,14 @@ public:
QString lastWorkspace() const;
bool autoRestorLastWorkspace() const;
QStringList workspaces();
QSet<QString> workspacePresets() const;
QDateTime workspaceDateTime(const QString &workspace) const;
Utils::FilePath workspaceNameToFileName(const QString &workspaceName) const;
bool createWorkspace(const QString &workspace);
bool openWorkspace(const QString &workspace);
bool reloadActiveWorkspace();
bool confirmWorkspaceDelete(const QStringList &workspaces);
bool deleteWorkspace(const QString &workspace);
@@ -459,22 +467,28 @@ public:
bool cloneWorkspace(const QString &original, const QString &clone);
bool renameWorkspace(const QString &original, const QString &newName);
bool resetWorkspacePreset(const QString &workspace);
bool save();
bool isFactoryDefaultWorkspace(const QString &workspace) const;
bool isDefaultWorkspace(const QString &workspace) const;
bool isWorkspacePreset(const QString &workspace) const;
signals:
void aboutToUnloadWorkspace(QString workspaceName);
void aboutToLoadWorkspace(QString workspaceName);
void workspaceLoaded(QString workspaceName);
void workspaceReloaded(QString workspaceName);
void aboutToSaveWorkspace();
private:
bool write(const QByteArray &data, QString *errorString) const;
#ifdef QT_GUI_LIB
bool write(const QByteArray &data, QWidget *parent) const;
#endif
bool write(const QString &workspace, const QByteArray &data, QString *errorString) const;
bool write(const QString &workspace, const QByteArray &data, QWidget *parent) const;
QByteArray loadWorkspace(const QString &workspace) const;
void syncWorkspacePresets();
void saveStartupWorkspace();
}; // class DockManager
} // namespace ADS

View File

@@ -64,9 +64,9 @@ QValidator::State WorkspaceValidator::validate(QString &input, int &pos) const
{
Q_UNUSED(pos)
if (input.contains(QLatin1Char('/')) || input.contains(QLatin1Char(':'))
|| input.contains(QLatin1Char('\\')) || input.contains(QLatin1Char('?'))
|| input.contains(QLatin1Char('*')) || input.contains(QLatin1Char('_')))
static QRegExp rx("[a-zA-Z0-9 ()\\-]*");
if (!rx.exactMatch(input))
return QValidator::Invalid;
if (m_workspaces.contains(input))
@@ -158,15 +158,22 @@ WorkspaceDialog::WorkspaceDialog(DockManager *manager, QWidget *parent)
&QAbstractButton::clicked,
m_ui.workspaceView,
&WorkspaceView::renameCurrentWorkspace);
connect(m_ui.btReset,
&QAbstractButton::clicked,
m_ui.workspaceView,
&WorkspaceView::resetCurrentWorkspace);
connect(m_ui.workspaceView,
&WorkspaceView::activated,
m_ui.workspaceView,
&WorkspaceView::switchToCurrentWorkspace);
connect(m_ui.workspaceView, &WorkspaceView::selected, this, &WorkspaceDialog::updateActions);
connect(m_ui.workspaceView, &WorkspaceView::workspaceSwitched, this, &QDialog::reject);
connect(m_ui.workspaceView,
&WorkspaceView::selected,
this,
&WorkspaceDialog::updateActions);
m_ui.whatsAWorkspaceLabel->setOpenExternalLinks(true);
updateActions(m_ui.workspaceView->selectedWorkspaces());
}
void WorkspaceDialog::setAutoLoadWorkspace(bool check)
@@ -190,16 +197,20 @@ void WorkspaceDialog::updateActions(const QStringList &workspaces)
m_ui.btDelete->setEnabled(false);
m_ui.btRename->setEnabled(false);
m_ui.btClone->setEnabled(false);
m_ui.btReset->setEnabled(false);
m_ui.btSwitch->setEnabled(false);
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) {
return workspace == m_manager->activeWorkspace();
});
m_ui.btDelete->setEnabled(!defaultIsSelected && !activeIsSelected);
m_ui.btRename->setEnabled(workspaces.size() == 1 && !defaultIsSelected);
m_ui.btDelete->setEnabled(!activeIsSelected && !presetIsSelected);
m_ui.btRename->setEnabled(workspaces.size() == 1 && !presetIsSelected);
m_ui.btClone->setEnabled(workspaces.size() == 1);
m_ui.btReset->setEnabled(presetIsSelected);
m_ui.btSwitch->setEnabled(workspaces.size() == 1);
}

View File

@@ -60,6 +60,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btReset">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btSwitch">
<property name="text">

View File

@@ -50,6 +50,7 @@ namespace ADS {
WorkspaceModel::WorkspaceModel(DockManager *manager, QObject *parent)
: QAbstractTableModel(parent)
, m_manager(manager)
, m_currentSortColumn(0)
{
m_sortedWorkspaces = m_manager->workspaces();
connect(m_manager, &DockManager::workspaceLoaded, this, &WorkspaceModel::resetWorkspaces);
@@ -134,19 +135,18 @@ QVariant WorkspaceModel::data(const QModelIndex &index, int role) const
break;
case Qt::FontRole: {
QFont font;
if (m_manager->isDefaultWorkspace(workspaceName))
if (m_manager->isWorkspacePreset(workspaceName))
font.setItalic(true);
else
font.setItalic(false);
if (m_manager->activeWorkspace() == workspaceName
&& !m_manager->isFactoryDefaultWorkspace(workspaceName))
if (m_manager->activeWorkspace() == workspaceName)
font.setBold(true);
else
font.setBold(false);
result = font;
} break;
case DefaultWorkspaceRole:
result = m_manager->isDefaultWorkspace(workspaceName);
case PresetWorkspaceRole:
result = m_manager->isWorkspacePreset(workspaceName);
break;
case LastWorkspaceRole:
result = m_manager->lastWorkspace() == workspaceName;
@@ -163,7 +163,7 @@ QVariant WorkspaceModel::data(const QModelIndex &index, int role) const
QHash<int, QByteArray> WorkspaceModel::roleNames() const
{
static QHash<int, QByteArray> extraRoles{{Qt::DisplayRole, "workspaceName"},
{DefaultWorkspaceRole, "defaultWorkspace"},
{PresetWorkspaceRole, "presetWorkspace"},
{LastWorkspaceRole, "activeWorkspace"},
{ActiveWorkspaceRole, "lastWorkspace"}};
return QAbstractTableModel::roleNames().unite(extraRoles);
@@ -171,6 +171,9 @@ QHash<int, QByteArray> WorkspaceModel::roleNames() const
void WorkspaceModel::sort(int column, Qt::SortOrder order)
{
m_currentSortColumn = column;
m_currentSortOrder = order;
beginResetModel();
const auto cmp = [this, column, order](const QString &s1, const QString &s2) {
bool isLess;
@@ -186,16 +189,10 @@ void WorkspaceModel::sort(int column, Qt::SortOrder order)
endResetModel();
}
bool WorkspaceModel::isDefaultVirgin() const
{
return false; //m_manager->isFactoryDefaultWorkspace(); // TODO
}
void WorkspaceModel::resetWorkspaces()
{
beginResetModel();
m_sortedWorkspaces = m_manager->workspaces();
endResetModel();
sort(m_currentSortColumn, m_currentSortOrder);
}
void WorkspaceModel::newWorkspace(QWidget *parent)
@@ -225,9 +222,10 @@ void WorkspaceModel::deleteWorkspaces(const QStringList &workspaces)
{
if (!m_manager->confirmWorkspaceDelete(workspaces))
return;
beginResetModel();
m_manager->deleteWorkspaces(workspaces);
endResetModel();
m_sortedWorkspaces = m_manager->workspaces();
sort(m_currentSortColumn, m_currentSortOrder);
}
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)
{
m_manager->openWorkspace(workspace);
@@ -255,13 +259,14 @@ void WorkspaceModel::runWorkspaceNameInputDialog(WorkspaceNameInputDialog *works
QString newWorkspace = workspaceInputDialog->value();
if (newWorkspace.isEmpty() || m_manager->workspaces().contains(newWorkspace))
return;
beginResetModel();
createWorkspace(newWorkspace);
m_sortedWorkspaces = m_manager->workspaces();
endResetModel();
sort(m_currentSortColumn, m_currentSortOrder);
if (workspaceInputDialog->isSwitchToRequested())
switchToWorkspace(newWorkspace);
emit workspaceCreated(newWorkspace);
}
}

View File

@@ -49,7 +49,7 @@ class WorkspaceModel : public QAbstractTableModel
Q_OBJECT
public:
enum { DefaultWorkspaceRole = Qt::UserRole + 1, LastWorkspaceRole, ActiveWorkspaceRole };
enum { PresetWorkspaceRole = Qt::UserRole + 1, LastWorkspaceRole, ActiveWorkspaceRole };
explicit WorkspaceModel(DockManager *manager, QObject *parent = nullptr);
@@ -64,8 +64,6 @@ public:
QHash<int, QByteArray> roleNames() const override;
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
Q_SCRIPTABLE bool isDefaultVirgin() const;
signals:
void workspaceSwitched();
void workspaceCreated(const QString &workspaceName);
@@ -76,6 +74,7 @@ public:
void cloneWorkspace(QWidget *parent, const QString &workspace);
void deleteWorkspaces(const QStringList &workspaces);
void renameWorkspace(QWidget *parent, const QString &workspace);
void resetWorkspace(const QString &workspace);
void switchToWorkspace(const QString &workspace);
private:
@@ -84,6 +83,8 @@ private:
QStringList m_sortedWorkspaces;
DockManager *m_manager;
int m_currentSortColumn;
Qt::SortOrder m_currentSortOrder = Qt::AscendingOrder;
};
} // namespace ADS

View File

@@ -84,7 +84,7 @@ WorkspaceView::WorkspaceView(QWidget *parent)
{
setItemDelegate(new RemoveItemFocusDelegate(this));
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::ExtendedSelection);
setSelectionMode(QAbstractItemView::SingleSelection);
setWordWrap(false);
setRootIsDecorated(false);
setSortingEnabled(true);
@@ -145,6 +145,11 @@ void WorkspaceView::renameCurrentWorkspace()
m_workspaceModel.renameWorkspace(this, currentWorkspace());
}
void WorkspaceView::resetCurrentWorkspace()
{
m_workspaceModel.resetWorkspace(currentWorkspace());
}
void WorkspaceView::switchToCurrentWorkspace()
{
m_workspaceModel.switchToWorkspace(currentWorkspace());
@@ -187,8 +192,7 @@ void WorkspaceView::keyPressEvent(QKeyEvent *event)
return;
}
const QStringList workspaces = selectedWorkspaces();
if (!workspaces.contains("default")
&& !Utils::anyOf(workspaces, [this](const QString &workspace) {
if (!Utils::anyOf(workspaces, [this](const QString &workspace) {
return workspace == m_manager->activeWorkspace();
})) {
deleteWorkspaces(workspaces);

View File

@@ -57,6 +57,7 @@ public:
void deleteSelectedWorkspaces();
void cloneCurrentWorkspace();
void renameCurrentWorkspace();
void resetCurrentWorkspace();
void switchToCurrentWorkspace();
QString currentWorkspace();
@@ -64,6 +65,8 @@ public:
void selectActiveWorkspace();
void selectWorkspace(const QString &workspaceName);
QStringList selectedWorkspaces() const;
signals:
void activated(const QString &workspace);
void selected(const QStringList &workspaces);
@@ -74,7 +77,6 @@ private:
void keyPressEvent(QKeyEvent *event) override;
void deleteWorkspaces(const QStringList &workspaces);
QStringList selectedWorkspaces() const;
static WorkspaceDialog *castToWorkspaceDialog(QWidget *widget);

View File

@@ -806,8 +806,12 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
m_versionNameLinedit->setText(manifest.attribute(QLatin1String("android:versionName")));
QDomElement usesSdkElement = manifest.firstChildElement(QLatin1String("uses-sdk"));
m_androidMinSdkVersion->setEnabled(!usesSdkElement.isNull());
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();

View File

@@ -149,15 +149,27 @@ AutotestPluginPrivate::AutotestPluginPrivate(AutotestPlugin *parent)
m_frameworkManager->activateFrameworksFromSettings(&m_settings);
TestTreeModel::instance()->synchronizeTestFrameworks();
connect(ProjectExplorer::SessionManager::instance(),
&ProjectExplorer::SessionManager::startupProjectChanged, this, [this] {
m_runconfigCache.clear();
});
auto sessionManager = ProjectExplorer::SessionManager::instance();
connect(sessionManager, &ProjectExplorer::SessionManager::startupProjectChanged,
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()
{
if (!s_projectSettings.isEmpty()) {
qDeleteAll(s_projectSettings.values());
s_projectSettings.clear();
}
delete m_navigationWidgetFactory;
delete m_resultsPane;
delete m_frameworkManager;

View File

@@ -166,8 +166,6 @@ signals:
void coreAboutToClose();
void contextAboutToChange(const QList<Core::IContext *> &context);
void contextChanged(const Core::Context &context);
void windowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
void windowActivationChanged(bool isActive, bool hasPopup);
public:
/* internal use */

View File

@@ -197,31 +197,6 @@ MainWindow::MainWindow()
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
{
return side == Side::Left ? m_leftNavigationWidget : m_rightNavigationWidget;

View File

@@ -116,7 +116,6 @@ public slots:
protected:
void closeEvent(QCloseEvent *event) override;
void changeEvent(QEvent *event) override;
private:
void openFile();
@@ -195,7 +194,6 @@ private:
QToolButton *m_toggleRightSideBarButton = nullptr;
QColor m_overrideColor;
QList<std::function<bool()>> m_preCloseListeners;
Qt::WindowStates m_previousWindowStates = Qt::WindowNoState;
};
} // namespace Internal

View File

@@ -320,7 +320,7 @@ bool Project::removeTarget(Target *target)
return true;
}
QList<Target *> Project::targets() const
const QList<Target *> Project::targets() const
{
return Utils::toRawPointer<QList>(d->m_targets);
}

View File

@@ -104,7 +104,7 @@ public:
Target *addTargetForKit(Kit *kit);
bool removeTarget(Target *target);
QList<Target *> targets() const;
const QList<Target *> targets() const;
// Note: activeTarget can be 0 (if no targets are defined).
Target *activeTarget() const;
Target *target(Core::Id id) const;

View File

@@ -117,8 +117,9 @@ void QbsSettings::loadSettings()
{
QSettings * const s = Core::ICore::settings();
m_settings.qbsExecutableFilePath = FilePath::fromString(s->value(QBS_EXE_KEY).toString());
m_settings.defaultInstallDirTemplate = s->value(QBS_DEFAULT_INSTALL_DIR_KEY,
"%{CurrentBuild:QbsBuildRoot}").toString();
m_settings.defaultInstallDirTemplate = s->value(
QBS_DEFAULT_INSTALL_DIR_KEY,
"%{CurrentBuild:QbsBuildRoot}/install-root").toString();
m_settings.useCreatorSettings = s->value(USE_CREATOR_SETTINGS_KEY, true).toBool();
}

View File

@@ -35,6 +35,7 @@
#include <coreplugin/fileiconprovider.h>
#include <extensionsystem/pluginmanager.h>
#include <qtsupport/qtsupportconstants.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/session.h>
@@ -83,12 +84,24 @@ QString ProFileEditorWidget::checkForPrfFile(const QString &baseName) const
{
const FilePath projectFile = textDocument()->filePath();
const QmakePriFileNode *projectNode = nullptr;
// FIXME: Remove this check once project nodes are fully "static".
for (const Project * const project : SessionManager::projects()) {
if (Target *t = project->activeTarget()) {
if (t->buildSystem()->isParsing())
continue;
static const auto isParsing = [](const Project *project) {
for (const Target * const t : project->targets()) {
for (const BuildConfiguration * const bc : t->buildConfigurations()) {
if (bc->buildSystem()->isParsing())
return true;
}
projectNode = dynamic_cast<const QmakePriFileNode *>(project->rootProjectNode()
}
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) {
return pn->filePath() == projectFile;
}));

View File

@@ -139,9 +139,7 @@ extend_qtc_plugin(QmlDesigner
tokencommand.cpp tokencommand.h
valueschangedcommand.cpp valueschangedcommand.h
changeselectioncommand.cpp changeselectioncommand.h
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
update3dviewstatecommand.cpp update3dviewstatecommand.h
view3dclosedcommand.cpp view3dclosedcommand.h
puppettocreatorcommand.cpp puppettocreatorcommand.h
inputeventcommand.cpp inputeventcommand.h
view3dactioncommand.cpp view3dactioncommand.h
@@ -248,7 +246,6 @@ extend_qtc_plugin(QmlDesigner
snapper.cpp snapper.h
snappinglinecreator.cpp snappinglinecreator.h
toolbox.cpp toolbox.h
option3daction.cpp option3daction.h
)
extend_qtc_plugin(QmlDesigner

View File

@@ -36,7 +36,6 @@ SOURCES += formeditoritem.cpp \
contentnoteditableindicator.cpp \
backgroundaction.cpp \
formeditortoolbutton.cpp \
option3daction.cpp \
formeditorannotationicon.cpp
HEADERS += formeditorscene.h \
@@ -76,7 +75,6 @@ HEADERS += formeditorscene.h \
contentnoteditableindicator.h \
backgroundaction.h \
formeditortoolbutton.h \
option3daction.h \
formeditorannotationicon.h
RESOURCES += formeditor.qrc

View File

@@ -27,7 +27,6 @@
#include "nodeinstanceview.h"
#include "selectiontool.h"
#include "movetool.h"
#include "option3daction.h"
#include "resizetool.h"
#include "dragtool.h"
#include "formeditorwidget.h"
@@ -87,12 +86,6 @@ void FormEditorView::modelAttached(Model *model)
setupFormEditorItemTree(rootModelNode());
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())
m_formEditorWidget->showErrorMessageBox(rewriterView()->errors());
@@ -213,7 +206,6 @@ void FormEditorView::createFormEditorWidget()
});
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);
}
@@ -236,9 +228,6 @@ void FormEditorView::nodeCreated(const ModelNode &node)
setupFormEditorItemTree(QmlItemNode(node));
else if (QmlVisualNode::isFlowTransition(node))
setupFormEditorItemTree(QmlItemNode(node));
if (node.isSubclassOf("QtQuick3D.Node"))
m_formEditorWidget->option3DAction()->setEnabled(true);
}
void FormEditorView::modelAboutToBeDetached(Model *model)
@@ -270,13 +259,6 @@ void FormEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
const QmlItemNode qmlItemNode(removedNode);
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*/)
@@ -534,9 +516,6 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const PropertyN
if (isInvisible)
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()) {
FormEditorItem *editorItem = m_scene->itemForQmlItemNode(item);
if (editorItem)
@@ -671,22 +650,6 @@ void FormEditorView::exportAsImage()
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)
{
QmlObjectNode qmlObjectNode = firstQmlObjectNode;

View File

@@ -133,7 +133,6 @@ private:
void createFormEditorWidget();
void temporaryBlockView();
void resetNodeInstanceView();
void toggle3DViewEnabled(bool enabled);
QPointer<FormEditorWidget> m_formEditorWidget;
QPointer<FormEditorScene> m_scene;

View File

@@ -39,7 +39,6 @@
#include <formeditorscene.h>
#include <formeditorview.h>
#include <lineeditaction.h>
#include <option3daction.h>
#include <zoomaction.h>
#include <toolbox.h>
@@ -146,13 +145,6 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
upperActions.append(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());
connect(m_zoomAction.data(), &ZoomAction::zoomLevelChanged,
this, &FormEditorWidget::setZoomLevel);
@@ -298,11 +290,6 @@ ZoomAction *FormEditorWidget::zoomAction() const
return m_zoomAction.data();
}
Option3DAction *FormEditorWidget::option3DAction() const
{
return m_option3DAction.data();
}
QAction *FormEditorWidget::resetAction() const
{
return m_resetAction.data();

View File

@@ -40,7 +40,6 @@ namespace QmlDesigner {
class ZoomAction;
class LineEditAction;
class BackgroundAction;
class Option3DAction;
class FormEditorView;
class FormEditorScene;
class FormEditorGraphicsView;
@@ -54,7 +53,6 @@ public:
FormEditorWidget(FormEditorView *view);
ZoomAction *zoomAction() const;
Option3DAction *option3DAction() const;
QAction *showBoundingRectAction() const;
QAction *snappingAction() const;
QAction *snappingAndAnchoringAction() const;
@@ -113,7 +111,6 @@ private:
QPointer<LineEditAction> m_rootWidthAction;
QPointer<LineEditAction> m_rootHeightAction;
QPointer<BackgroundAction> m_backgroundAction;
QPointer<Option3DAction> m_option3DAction;
QPointer<QAction> m_resetAction;
QPointer<DocumentWarningWidget> m_documentErrorWidget;
Core::IContext *m_context = nullptr;

View File

@@ -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

View File

@@ -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

View File

@@ -128,14 +128,10 @@ public:
void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
void selectionChanged(const ChangeSelectionCommand &command) override;
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
void view3DClosed(const View3DClosedCommand &command) override;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
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 view3DAction(const View3DActionCommand &command);
void edit3DViewResized(const QSize &size) const;

View File

@@ -43,9 +43,7 @@
#include <completecomponentcommand.h>
#include <changenodesourcecommand.h>
#include <changeselectioncommand.h>
#include <drop3dlibraryitemcommand.h>
#include <puppettocreatorcommand.h>
#include <view3dclosedcommand.h>
#include <inputeventcommand.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 puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand");
static const int puppetToCreatorCommand = QMetaType::type("PuppetToCreatorCommand");
static const int view3DClosedCommand = QMetaType::type("View3DClosedCommand");
if (m_destructing)
return;
@@ -314,19 +310,17 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>());
} else if (command.userType() == changeSelectionCommandType) {
nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>());
} else if (command.userType() == drop3DLibraryItemCommandType) {
nodeInstanceClient()->library3DItemDropped(command.value<Drop3DLibraryItemCommand>());
} else if (command.userType() == puppetToCreatorCommand) {
nodeInstanceClient()->handlePuppetToCreatorCommand(command.value<PuppetToCreatorCommand>());
} else if (command.userType() == view3DClosedCommand) {
nodeInstanceClient()->view3DClosed(command.value<View3DClosedCommand>());
} else if (command.userType() == puppetAliveCommandType) {
puppetAlive(puppetStreamType);
} else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
} else
} else {
Q_ASSERT(false);
}
qCInfo(instanceViewBenchmark) << "dispatching command" << "done" << command.userType();
}

View File

@@ -53,7 +53,6 @@
#include "changebindingscommand.h"
#include "changeidscommand.h"
#include "changeselectioncommand.h"
#include "drop3dlibraryitemcommand.h"
#include "changenodesourcecommand.h"
#include "removeinstancescommand.h"
#include "removepropertiescommand.h"
@@ -1447,23 +1446,10 @@ void NodeInstanceView::selectionChanged(const ChangeSelectionCommand &command)
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)
{
if (command.type() == PuppetToCreatorCommand::KeyPressed) {
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 (command.type() == PuppetToCreatorCommand::Edit3DToolState) {
if (!m_nodeInstanceServer.isNull()) {
auto data = qvariant_cast<QVariantList>(command.data());
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,
const QList<ModelNode> & /*lastSelectedNodeList*/)
{
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
{
nodeInstanceServer()->inputEvent(InputEventCommand(e));

View File

@@ -478,13 +478,10 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView();
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");
if (m_model->hasImport(import, true, true)
&& DesignerSettings::getValue(DesignerSettingsKey::VIEW_3D_ACTIVE).toBool()) {
view->rootModelNode().setAuxiliaryData("3d-view", true);
if (m_model->hasImport(import, true, true))
environment.set("QMLDESIGNER_QUICK3D_MODE", "true");
}
#endif
QStringList importPaths = m_model->importPaths();

View File

@@ -84,7 +84,6 @@ void DesignerSettings::fromSettings(QSettings *settings)
);
restoreValue(settings, DesignerSettingsKey::SIMPLE_COLOR_PALETTE_CONTENT, QStringList());
restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true);
restoreValue(settings, DesignerSettingsKey::VIEW_3D_ACTIVE, false);
settings->endGroup();
settings->endGroup();

View File

@@ -67,7 +67,6 @@ const char STANDALONE_MODE[] = "StandAloneMode";
const char ENABLE_TIMELINEVIEW[] = "EnableTimelineView";
const char SIMPLE_COLOR_PALETTE_CONTENT[] = "SimpleColorPaletteContent";
const char ALWAYS_DESIGN_MODE[] = "AlwaysDesignMode";
const char VIEW_3D_ACTIVE[] = "View3DActive";
}
class DesignerSettings : public QHash<QByteArray, QVariant>

View File

@@ -56,6 +56,7 @@
#include <coreplugin/idocument.h>
#include <coreplugin/inavigationwidgetfactory.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
@@ -230,9 +231,12 @@ void DesignModeWidget::setup()
actionManager.createDefaultAddResourceHandler();
actionManager.polishActions();
auto settings = Core::ICore::settings(QSettings::UserScope);
m_dockManager = new ADS::DockManager(this);
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"));
m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet));
@@ -369,32 +373,7 @@ void DesignModeWidget::setup()
if (currentDesignDocument())
setupNavigatorHistory(currentDesignDocument()->textEditor());
// Get a list of all available workspaces
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);
m_dockManager->initialize();
viewManager().enableWidgets();
readSettings();
show();
@@ -419,7 +398,11 @@ void DesignModeWidget::aboutToShowWorkspaces()
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);
action->setData(workspace);
@@ -430,87 +413,6 @@ void DesignModeWidget::aboutToShowWorkspaces()
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()
{
if (m_navigatorHistoryCounter > 0) {

View File

@@ -104,8 +104,6 @@ private: // functions
void aboutToShowWorkspaces();
void createFactoryDefaultWorkspace();
private: // variables
SwitchSplitTabWidget* m_centralTabWidget = nullptr;

View File

@@ -253,16 +253,6 @@ void QmlDesignerPlugin::extensionsInitialized()
connect(Core::ICore::instance(), &Core::ICore::coreAboutToOpen, this, [this] {
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)

View File

@@ -173,12 +173,8 @@ Project {
"commands/valueschangedcommand.h",
"commands/changeselectioncommand.cpp",
"commands/changeselectioncommand.h",
"commands/drop3dlibraryitemcommand.cpp",
"commands/drop3dlibraryitemcommand.h",
"commands/update3dviewstatecommand.cpp",
"commands/update3dviewstatecommand.h",
"commands/view3dclosedcommand.cpp",
"commands/view3dclosedcommand.h",
"commands/puppettocreatorcommand.cpp",
"commands/puppettocreatorcommand.h",
"commands/inputeventcommand.cpp",
@@ -534,8 +530,6 @@ Project {
"formeditor/toolbox.h",
"formeditor/formeditortoolbutton.cpp",
"formeditor/formeditortoolbutton.h",
"formeditor/option3daction.cpp",
"formeditor/option3daction.h",
"importmanager/importlabel.cpp",
"importmanager/importlabel.h",
"importmanager/importmanagercombobox.cpp",

View File

@@ -45,9 +45,7 @@ extend_qtc_executable(qml2puppet
synchronizecommand.cpp synchronizecommand.h
tokencommand.cpp tokencommand.h
changeselectioncommand.cpp changeselectioncommand.h
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
update3dviewstatecommand.cpp update3dviewstatecommand.h
view3dclosedcommand.cpp view3dclosedcommand.h
puppettocreatorcommand.cpp puppettocreatorcommand.h
inputeventcommand.cpp inputeventcommand.h
view3dactioncommand.cpp view3dactioncommand.h

View File

@@ -95,12 +95,8 @@ QtcTool {
"commands/valueschangedcommand.h",
"commands/changeselectioncommand.cpp",
"commands/changeselectioncommand.h",
"commands/drop3dlibraryitemcommand.cpp",
"commands/drop3dlibraryitemcommand.h",
"commands/update3dviewstatecommand.cpp",
"commands/update3dviewstatecommand.h",
"commands/view3dclosedcommand.cpp",
"commands/view3dclosedcommand.h",
"commands/puppettocreatorcommand.cpp",
"commands/puppettocreatorcommand.h",
"commands/inputeventcommand.cpp",