QmlDesigner: Merge cmake files

To improve testability external dependencies are now broken with an
interface. It is a first step to test individual units without injection
of source files.

Task-number: QDS-7571
Change-Id: I4255c8668022f1097947e4ea5788f2a6b605365d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2022-09-15 15:01:49 +02:00
committed by Tim Jenssen
parent 8b028a69a7
commit 78cf5051f5
165 changed files with 1865 additions and 2077 deletions

View File

@@ -11,6 +11,508 @@ add_feature_info("ProjectStorage" ${USE_PROJECTSTORAGE} "")
env_with_default("QDS_WITH_QMLDOM" ENV_QDS_WITH_QMLDOM OFF) env_with_default("QDS_WITH_QMLDOM" ENV_QDS_WITH_QMLDOM OFF)
option(WITH_QMLDOM "Build with QmlDom" ${ENV_QDS_WITH_QMLDOM}) option(WITH_QMLDOM "Build with QmlDom" ${ENV_QDS_WITH_QMLDOM})
add_feature_info("Build with QmlDom" ${WITH_QMLDOM} "") add_feature_info("Build with QmlDom" ${WITH_QMLDOM} "")
add_qtc_library(QmlDesignerUtils STATIC
DEPENDS
Qt5::Gui
DEFINES QMLDESIGNERUTILS_LIBRARY
PUBLIC_DEFINES $<$<BOOL:QTC_STATIC_BUILD>:QMLDESIGNER_STATIC_LIBRARY>
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/utils
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/utils
SOURCES
designersettings.cpp designersettings.h
hdrimage.cpp hdrimage.h
qmldesignerutils_global.h
)
add_qtc_library(QmlDesignerCore STATIC
DEPENDS
Threads::Threads
Qt5::CorePrivate
CPlusPlus
Utils
Qt5::Widgets
Qt5::Qml
Core
ProjectExplorer
QmakeProjectManager
QmlJS
QmlJSEditor
QmlJSTools
QmlProjectManager
QtSupport
PUBLIC_DEPENDS
QmlDesignerUtils
TextEditor
Sqlite
DEFINES QMLDESIGNERCORE_LIBRARY QMLDESIGNERUTILS_STATIC_LIBRARY
INCLUDES
${CMAKE_CURRENT_LIST_DIR}
PUBLIC_INCLUDES
${CMAKE_CURRENT_LIST_DIR}/designercore
${CMAKE_CURRENT_LIST_DIR}/designercore/include
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore
SOURCES
rewritertransaction.cpp
rewritertransaction.h
)
extend_qtc_library(QmlDesignerCore
CONDITION UNIX AND NOT APPLE
PUBLIC_DEPENDS rt
)
set(UI_FILES
${CMAKE_CURRENT_LIST_DIR}/designercore/instances/puppetbuildprogressdialog.ui
${CMAKE_CURRENT_LIST_DIR}/designercore/instances/puppetdialog.ui
)
qt_wrap_ui(UI_SOURCES ${UI_FILES})
extend_qtc_library(QmlDesignerCore
INCLUDES ${CMAKE_CURRENT_BINARY_DIR}
SOURCES
${UI_SOURCES}
${UI_FILES}
)
set_source_files_properties(${UI_FILES} PROPERTIES SKIP_AUTOUIC ON)
extend_qtc_library(QmlDesignerCore
INCLUDES ${CMAKE_CURRENT_LIST_DIR}/designercore/exceptions
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/exceptions
SOURCES
exception.cpp
invalidargumentexception.cpp
invalididexception.cpp
invalidmetainfoexception.cpp
invalidmodelnodeexception.cpp
invalidmodelstateexception.cpp
invalidpropertyexception.cpp
invalidqmlsourceexception.cpp
invalidreparentingexception.cpp
invalidslideindexexception.cpp
notimplementedexception.cpp
removebasestateexception.cpp
rewritingexception.cpp
)
extend_qtc_library(QmlDesignerCore
INCLUDES ${CMAKE_CURRENT_LIST_DIR}/designercore/filemanager
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/filemanager
SOURCES
addarraymembervisitor.cpp
addarraymembervisitor.h
addobjectvisitor.cpp
addobjectvisitor.h
addpropertyvisitor.cpp
addpropertyvisitor.h
astobjecttextextractor.cpp
astobjecttextextractor.h
changeimportsvisitor.cpp
changeimportsvisitor.h
changeobjecttypevisitor.cpp
changeobjecttypevisitor.h
changepropertyvisitor.cpp
changepropertyvisitor.h
firstdefinitionfinder.cpp
firstdefinitionfinder.h
moveobjectbeforeobjectvisitor.cpp
moveobjectbeforeobjectvisitor.h
moveobjectvisitor.cpp
moveobjectvisitor.h
objectlengthcalculator.cpp
objectlengthcalculator.h
qmlrefactoring.cpp
qmlrefactoring.h
qmlrewriter.cpp
qmlrewriter.h
removepropertyvisitor.cpp
removepropertyvisitor.h
removeuiobjectmembervisitor.cpp
removeuiobjectmembervisitor.h
)
extend_qtc_library(QmlDesignerCore
INCLUDES ${CMAKE_CURRENT_LIST_DIR}/designercore/imagecache
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/imagecache
SOURCES
asynchronousexplicitimagecache.cpp
asynchronousimagecache.cpp
asynchronousimagefactory.cpp
asynchronousimagefactory.h
imagecachecollector.cpp
imagecachecollector.h
imagecachedispatchcollector.h
imagecachecollectorinterface.h
imagecacheconnectionmanager.cpp
imagecacheconnectionmanager.h
imagecachefontcollector.cpp
imagecachefontcollector.h
imagecachegenerator.cpp
imagecachegenerator.h
imagecachegeneratorinterface.h
imagecachestorage.h
imagecachestorageinterface.h
meshimagecachecollector.cpp
meshimagecachecollector.h
synchronousimagecache.cpp
timestampprovider.cpp
timestampprovider.h
timestampproviderinterface.h
)
extend_qtc_library(QmlDesignerCore
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/include
SOURCES
abstractproperty.h
abstractview.h
anchorline.h
annotation.h
asynchronousexplicitimagecache.h
asynchronousimagecache.h
auxiliarydata.h
auxiliarydataproperties.h
basetexteditmodifier.h
bindingproperty.h
componenttextmodifier.h
customnotifications.h
documentmessage.h
enumerationmetainfo.h
exception.h
externaldependenciesinterface.h
forwardview.h
imagecacheauxiliarydata.h
import.h
invalidargumentexception.h
invalididexception.h
invalidmetainfoexception.h
invalidmodelnodeexception.h
invalidmodelstateexception.h
invalidpropertyexception.h
invalidqmlsourceexception.h
invalidreparentingexception.h
invalidslideindexexception.h
itemlibraryinfo.h
mathutils.h
metainfo.h
metainforeader.h
model.h
modelmerger.h
modelnode.h
modelnodepositionstorage.h
nodeabstractproperty.h
nodehints.h
nodeinstance.h
nodeinstanceview.h
nodelistproperty.h
nodemetainfo.h
nodeproperty.h
notimplementedexception.h
plaintexteditmodifier.h
propertycontainer.h
propertymetainfo.h
propertynode.h
propertyparser.h
qmlanchors.h
qmlchangeset.h
qmlconnections.h
qmldesignercorelib_global.h
qmlitemnode.h
qmlmodelnodefacade.h
qmlobjectnode.h
qmlstate.h
qmltimeline.h
qmltimelinekeyframegroup.h
removebasestateexception.h
rewriterview.h
rewritingexception.h
signalhandlerproperty.h
stylesheetmerger.h
subcomponentmanager.h
synchronousimagecache.h
textmodifier.h
variantproperty.h
)
extend_qtc_library(QmlDesignerCore
INCLUDES
${CMAKE_CURRENT_LIST_DIR}/designercore/metainfo
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/metainfo
SOURCES
itemlibraryinfo.cpp
metainfo.cpp
metainforeader.cpp
nodehints.cpp
nodemetainfo.cpp
subcomponentmanager.cpp
)
extend_qtc_library(QmlDesignerCore
PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/designercore/instances
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/instances
SOURCES
baseconnectionmanager.cpp
baseconnectionmanager.h
connectionmanager.cpp
connectionmanager.h
connectionmanagerinterface.cpp
connectionmanagerinterface.h
nodeinstance.cpp
nodeinstanceserverproxy.cpp
nodeinstanceserverproxy.h
nodeinstanceview.cpp
puppetbuildprogressdialog.cpp
puppetbuildprogressdialog.h
puppetstarter.cpp
puppetstarter.h
puppetdialog.cpp
puppetdialog.h
qprocessuniqueptr.h
)
extend_qtc_library(QmlDesignerCore
INCLUDES ${CMAKE_CURRENT_LIST_DIR}/designercore/model
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/model
SOURCES
abstractproperty.cpp
abstractview.cpp
anchorline.cpp
annotation.cpp
bindingproperty.cpp
componenttextmodifier.cpp
documentmessage.cpp
import.cpp
internalbindingproperty.cpp
internalbindingproperty.h
internalnode.cpp
internalnode_p.h
internalnodeabstractproperty.cpp
internalnodeabstractproperty.h
internalnodelistproperty.cpp
internalnodelistproperty.h
internalnodeproperty.cpp
internalnodeproperty.h
internalproperty.cpp
internalproperty.h
internalsignalhandlerproperty.cpp
internalsignalhandlerproperty.h
internalvariantproperty.cpp
internalvariantproperty.h
model.cpp
model_p.h
modelmerger.cpp
modelnode.cpp
modelnodepositionrecalculator.cpp
modelnodepositionrecalculator.h
modelnodepositionstorage.cpp
modeltotextmerger.cpp
modeltotextmerger.h
nodeabstractproperty.cpp
nodelistproperty.cpp
nodeproperty.cpp
plaintexteditmodifier.cpp
propertycontainer.cpp
propertynode.cpp
propertyparser.cpp
qml3dnode.cpp
qmlanchors.cpp
qmlchangeset.cpp
qmlconnections.cpp
qmlitemnode.cpp
qmlmodelnodefacade.cpp
qmlobjectnode.cpp
qmlstate.cpp
qmltextgenerator.cpp
qmltextgenerator.h
qmltimeline.cpp
qmltimelinekeyframegroup.cpp
qmlvisualnode.cpp
rewriteaction.cpp
rewriteaction.h
rewriteactioncompressor.cpp
rewriteactioncompressor.h
rewriterview.cpp
signalhandlerproperty.cpp
stylesheetmerger.cpp
textmodifier.cpp
texttomodelmerger.cpp
texttomodelmerger.h
variantproperty.cpp
)
extend_qtc_library(QmlDesignerCore
INCLUDES ${CMAKE_CURRENT_LIST_DIR}/designercore/pluginmanager
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/designercore/pluginmanager
SOURCES
widgetpluginmanager.cpp
widgetpluginmanager.h
widgetpluginpath.cpp
widgetpluginpath.h
)
extend_qtc_library(QmlDesignerCore
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet
INCLUDES
${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/commands
${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/container
PUBLIC_INCLUDES
"${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/interfaces"
"${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/types"
SOURCES
commands/captureddatacommand.h
commands/changeauxiliarycommand.cpp
commands/changeauxiliarycommand.h
commands/changebindingscommand.cpp
commands/changebindingscommand.h
commands/changefileurlcommand.cpp
commands/changefileurlcommand.h
commands/changeidscommand.cpp
commands/changeidscommand.h
commands/changelanguagecommand.cpp
commands/changelanguagecommand.h
commands/changenodesourcecommand.cpp
commands/changenodesourcecommand.h
commands/changepreviewimagesizecommand.cpp
commands/changepreviewimagesizecommand.h
commands/changeselectioncommand.cpp
commands/changeselectioncommand.h
commands/changestatecommand.cpp
commands/changestatecommand.h
commands/changevaluescommand.cpp
commands/changevaluescommand.h
commands/childrenchangedcommand.cpp
commands/childrenchangedcommand.h
commands/clearscenecommand.cpp
commands/clearscenecommand.h
commands/completecomponentcommand.cpp
commands/completecomponentcommand.h
commands/componentcompletedcommand.cpp
commands/componentcompletedcommand.h
commands/createinstancescommand.cpp
commands/createinstancescommand.h
commands/createscenecommand.cpp
commands/createscenecommand.h
commands/debugoutputcommand.cpp
commands/debugoutputcommand.h
commands/endpuppetcommand.cpp
commands/endpuppetcommand.h
commands/informationchangedcommand.cpp
commands/informationchangedcommand.h
commands/nanotracecommand.cpp
commands/nanotracecommand.h
commands/inputeventcommand.cpp
commands/inputeventcommand.h
commands/pixmapchangedcommand.cpp
commands/pixmapchangedcommand.h
commands/puppetalivecommand.cpp
commands/puppetalivecommand.h
commands/puppettocreatorcommand.cpp
commands/puppettocreatorcommand.h
commands/removeinstancescommand.cpp
commands/removeinstancescommand.h
commands/removepropertiescommand.cpp
commands/removepropertiescommand.h
commands/removesharedmemorycommand.cpp
commands/removesharedmemorycommand.h
commands/reparentinstancescommand.cpp
commands/reparentinstancescommand.h
commands/requestmodelnodepreviewimagecommand.cpp
commands/requestmodelnodepreviewimagecommand.h
commands/scenecreatedcommand.h
commands/statepreviewimagechangedcommand.cpp
commands/statepreviewimagechangedcommand.h
commands/synchronizecommand.h
commands/tokencommand.cpp
commands/tokencommand.h
commands/update3dviewstatecommand.cpp
commands/update3dviewstatecommand.h
commands/valueschangedcommand.cpp
commands/valueschangedcommand.h
commands/view3dactioncommand.cpp
commands/view3dactioncommand.h
container/addimportcontainer.cpp
container/addimportcontainer.h
container/idcontainer.cpp
container/idcontainer.h
container/imagecontainer.cpp
container/imagecontainer.h
container/informationcontainer.cpp
container/informationcontainer.h
container/instancecontainer.cpp
container/instancecontainer.h
container/mockuptypecontainer.cpp
container/mockuptypecontainer.h
container/propertyabstractcontainer.cpp
container/propertyabstractcontainer.h
container/propertybindingcontainer.cpp
container/propertybindingcontainer.h
container/propertyvaluecontainer.cpp
container/propertyvaluecontainer.h
container/reparentcontainer.cpp
container/reparentcontainer.h
container/sharedmemory.h
interfaces/commondefines.h
interfaces/nodeinstanceclientinterface.h
interfaces/nodeinstanceglobal.h
interfaces/nodeinstanceserverinterface.cpp
interfaces/nodeinstanceserverinterface.h
types/enumeration.h
)
extend_qtc_library(QmlDesignerCore
SOURCES_PREFIX designercore/projectstorage
PUBLIC_INCLUDES designercore/projectstorage
SOURCES
commontypecache.h
directorypathcompressor.h
filesysteminterface.h
filesystem.cpp filesystem.h
filestatus.h
filestatuscache.cpp filestatuscache.h
nonlockingmutex.h
projectstorageinterface.h
projectstoragefwd.h
projectstorageinfotypes.h
projectstoragepathwatcher.h
projectstoragepathwatcherinterface.h
projectstoragepathwatchernotifierinterface.h
projectstoragepathwatcher.h
projectstoragepathwatchertypes.h
projectstorageprinting.h
projectstoragetypes.h
projectstorageupdater.cpp projectstorageupdater.h
projectstorage.cpp projectstorage.h
sourcepath.h
sourcepathcache.h
sourcepathcache.h
sourcepathcachetypes.h
sourcepathview.h
storagecache.h
storagecacheentry.h
storagecachefwd.h
qmldocumentparserinterface.h
qmltypesparserinterface.h
qmltypesparser.cpp qmltypesparser.h
qmldocumentparser.cpp qmldocumentparser.h
)
extend_qtc_library(QmlDesignerCore
CONDITION UNIX
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/container
SOURCES sharedmemory_unix.cpp
)
extend_qtc_library(QmlDesignerCore
CONDITION NOT UNIX
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/container
SOURCES sharedmemory_qt.cpp
)
file(GLOB PROJECTSTORAGE_EXCLUDED_SOURCES designercore/projectstorage/*.cpp)
set_property(SOURCE ${PROJECTSTORAGE_EXCLUDED_SOURCES} PROPERTY SKIP_AUTOMOC ON)
add_qtc_plugin(QmlDesigner add_qtc_plugin(QmlDesigner
CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 AND TARGET Qt5::QuickWidgets AND TARGET Qt5::Svg CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 AND TARGET Qt5::QuickWidgets AND TARGET Qt5::Svg
DEPENDS DEPENDS
@@ -20,17 +522,30 @@ add_qtc_plugin(QmlDesigner
IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\" IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\"
SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner" SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner"
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE> $<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
QMLDESIGNER_LIBRARY QMLDESIGNERCORE_STATIC_LIBRARY QMLDESIGNERUTILS_STATIC_LIBRARY
INCLUDES
${CMAKE_CURRENT_LIST_DIR}/components
${CMAKE_CURRENT_LIST_DIR}/components/assetslibrary
${CMAKE_CURRENT_LIST_DIR}/components/debugview
${CMAKE_CURRENT_LIST_DIR}/components/edit3d
${CMAKE_CURRENT_LIST_DIR}/components/formeditor
${CMAKE_CURRENT_LIST_DIR}/components/integration
${CMAKE_CURRENT_LIST_DIR}/components/itemlibrary
${CMAKE_CURRENT_LIST_DIR}/components/materialbrowser
${CMAKE_CURRENT_LIST_DIR}/components/materialeditor
${CMAKE_CURRENT_LIST_DIR}/components/navigator
${CMAKE_CURRENT_LIST_DIR}/components/propertyeditor
${CMAKE_CURRENT_LIST_DIR}/components/stateseditor
${CMAKE_CURRENT_LIST_DIR}/components/texteditor
PUBLIC_INCLUDES PUBLIC_INCLUDES
"${CMAKE_CURRENT_LIST_DIR}" ${CMAKE_CURRENT_LIST_DIR}
"${CMAKE_CURRENT_LIST_DIR}/designercore/include" PUBLIC_DEPENDS
"${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/interfaces" QmlDesignerCore
"${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/types"
PLUGIN_DEPENDS PLUGIN_DEPENDS
Core ProjectExplorer QmlJSEditor QmakeProjectManager QmlProjectManager Core ProjectExplorer QmlJSEditor QmakeProjectManager QmlProjectManager
QtSupport TextEditor QtSupport
PLUGIN_RECOMMENDS QmlPreview PLUGIN_RECOMMENDS QmlPreview
SOURCES SOURCES
designersettings.cpp designersettings.h
designmodecontext.cpp designmodecontext.h designmodecontext.cpp designmodecontext.h
designmodewidget.cpp designmodewidget.h designmodewidget.cpp designmodewidget.h
documentmanager.cpp documentmanager.h documentmanager.cpp documentmanager.h
@@ -39,9 +554,11 @@ add_qtc_plugin(QmlDesigner
generateresource.cpp generateresource.h generateresource.cpp generateresource.h
openuiqmlfiledialog.cpp openuiqmlfiledialog.h openuiqmlfiledialog.ui openuiqmlfiledialog.cpp openuiqmlfiledialog.h openuiqmlfiledialog.ui
puppetenvironmentbuilder.cpp puppetenvironmentbuilder.h puppetenvironmentbuilder.cpp puppetenvironmentbuilder.h
qmldesigner_global.h
qmldesignerconstants.h qmldesignerconstants.h
qmldesignericons.h qmldesignericons.h
qmldesignerplugin.cpp qmldesignerplugin.h qmldesignerplugin.cpp qmldesignerplugin.h
qmldesignerexternaldependencies.cpp qmldesignerexternaldependencies.h
qmldesignerprojectmanager.cpp qmldesignerprojectmanager.h qmldesignerprojectmanager.cpp qmldesignerprojectmanager.h
settingspage.cpp settingspage.h settingspage.ui settingspage.cpp settingspage.h settingspage.ui
shortcutmanager.cpp shortcutmanager.h shortcutmanager.cpp shortcutmanager.h
@@ -57,9 +574,6 @@ add_qtc_plugin(QmlDesigner
QMLDESIGNER_PLUGIN_PATH "${QmlDesignerPluginInstallPrefix}" QMLDESIGNER_PLUGIN_PATH "${QmlDesignerPluginInstallPrefix}"
) )
include(qmldesignercore.cmake)
extend_with_qmldesigner_core(QmlDesigner)
function(get_and_add_as_subdirectory name repository git_tag build_dir source_dir source_subdir) function(get_and_add_as_subdirectory name repository git_tag build_dir source_dir source_subdir)
# make the configuration in the build dir # make the configuration in the build dir
file(MAKE_DIRECTORY ${build_dir}/${name}) file(MAKE_DIRECTORY ${build_dir}/${name})
@@ -191,6 +705,14 @@ add_qtc_plugin(qtquickplugin
add_subdirectory(studioplugin) add_subdirectory(studioplugin)
extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX components
PUBLIC_INCLUDES components
DEFINES QMLDESIGNERCOMPONENTS_LIBRARY
SOURCES
qmldesignercomponents_global.h
)
extend_qtc_plugin(QmlDesigner extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX components/componentcore SOURCES_PREFIX components/componentcore
PUBLIC_INCLUDES components/componentcore PUBLIC_INCLUDES components/componentcore
@@ -217,7 +739,6 @@ extend_qtc_plugin(QmlDesigner
selectioncontext.cpp selectioncontext.h selectioncontext.cpp selectioncontext.h
theme.cpp theme.h theme.cpp theme.h
zoomaction.cpp zoomaction.h zoomaction.cpp zoomaction.h
hdrimage.cpp hdrimage.h
svgpasteaction.cpp svgpasteaction.h svgpasteaction.cpp svgpasteaction.h
viewmanager.cpp viewmanager.h viewmanager.cpp viewmanager.h
) )
@@ -472,41 +993,6 @@ extend_qtc_plugin(QmlDesigner
) )
extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX designercore/projectstorage
SOURCES
commontypecache.h
directorypathcompressor.h
filesysteminterface.h
filesystem.cpp filesystem.h
filestatus.h
filestatuscache.cpp filestatuscache.h
nonlockingmutex.h
projectstorageinterface.h
projectstoragefwd.h
projectstorageinfotypes.h
projectstoragepathwatcher.h
projectstoragepathwatcherinterface.h
projectstoragepathwatchernotifierinterface.h
projectstoragepathwatcher.h
projectstoragepathwatchertypes.h
projectstorageprinting.h
projectstoragetypes.h
projectstorageupdater.cpp projectstorageupdater.h
sourcepath.h
sourcepathcache.h
sourcepathcache.h
sourcepathcachetypes.h
sourcepathview.h
storagecache.h
storagecacheentry.h
storagecachefwd.h
qmldocumentparserinterface.h
qmltypesparserinterface.h
qmltypesparser.cpp qmltypesparser.h
qmldocumentparser.cpp qmldocumentparser.h
)
extend_qtc_plugin(QmlDesigner extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX designercore/instances SOURCES_PREFIX designercore/instances
SOURCES SOURCES

View File

@@ -269,7 +269,8 @@ void AssetExporter::preprocessQmlFile(const Utils::FilePath &path)
textEdit.setPlainText(QString::fromUtf8(reader.data())); textEdit.setPlainText(QString::fromUtf8(reader.data()));
NotIndentingTextEditModifier *modifier = new NotIndentingTextEditModifier(&textEdit); NotIndentingTextEditModifier *modifier = new NotIndentingTextEditModifier(&textEdit);
modifier->setParent(model.get()); modifier->setParent(model.get());
auto rewriterView = std::make_unique<RewriterView>(QmlDesigner::RewriterView::Validate); auto rewriterView = std::make_unique<RewriterView>(m_view->externalDependencies(),
QmlDesigner::RewriterView::Validate);
rewriterView->setCheckSemanticErrors(false); rewriterView->setCheckSemanticErrors(false);
rewriterView->setTextModifier(modifier); rewriterView->setTextModifier(modifier);
model->attachView(rewriterView.get()); model->attachView(rewriterView.get());

View File

@@ -43,7 +43,8 @@ AssetExporterPlugin::AssetExporterPlugin()
auto *designerPlugin = QmlDesigner::QmlDesignerPlugin::instance(); auto *designerPlugin = QmlDesigner::QmlDesignerPlugin::instance();
auto &viewManager = designerPlugin->viewManager(); auto &viewManager = designerPlugin->viewManager();
m_view = viewManager.registerView(std::make_unique<AssetExporterView>()); m_view = viewManager.registerView(std::make_unique<AssetExporterView>(
designerPlugin->externalDependenciesForPluginInitializationOnly()));
// Add dumper templates for factory instantiation. // Add dumper templates for factory instantiation.
Component::addNodeDumper<ItemNodeDumper>(); Component::addNodeDumper<ItemNodeDumper>();

View File

@@ -23,8 +23,9 @@ const int MinRetry = 2;
namespace QmlDesigner { namespace QmlDesigner {
AssetExporterView::AssetExporterView() AssetExporterView::AssetExporterView(ExternalDependenciesInterface &externalDependencies)
: m_timer(this) : AbstractView(externalDependencies)
, m_timer(this)
{ {
m_timer.setInterval(RetryIntervalMs); m_timer.setInterval(RetryIntervalMs);
// We periodically check if file is loaded. // We periodically check if file is loaded.

View File

@@ -29,7 +29,7 @@ public:
Loaded Loaded
}; };
AssetExporterView(); AssetExporterView(ExternalDependenciesInterface &externalDependencies);
bool loadQmlFile(const Utils::FilePath &path, uint timeoutSecs = 10); bool loadQmlFile(const Utils::FilePath &path, uint timeoutSecs = 10);
bool saveQmlFile(QString *error) const; bool saveQmlFile(QString *error) const;

View File

@@ -4,8 +4,8 @@
#include "assetslibraryiconprovider.h" #include "assetslibraryiconprovider.h"
#include "assetslibrarymodel.h" #include "assetslibrarymodel.h"
#include <hdrimage.h>
#include <theme.h> #include <theme.h>
#include <utils/hdrimage.h>
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
namespace QmlDesigner { namespace QmlDesigner {

View File

@@ -7,10 +7,10 @@
#include <designersettings.h> #include <designersettings.h>
#include <documentmanager.h> #include <documentmanager.h>
#include <hdrimage.h>
#include <qmldesignerplugin.h>
#include <synchronousimagecache.h> #include <synchronousimagecache.h>
#include <theme.h> #include <theme.h>
#include <utils/hdrimage.h>
#include <qmldesignerplugin.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>

View File

@@ -43,7 +43,9 @@ public:
SynchronousImageCache synchronousFontImageCache{storage, timeStampProvider, fontCollector}; SynchronousImageCache synchronousFontImageCache{storage, timeStampProvider, fontCollector};
}; };
AssetsLibraryView::AssetsLibraryView() {} AssetsLibraryView::AssetsLibraryView(ExternalDependenciesInterface &externalDependencies)
: AbstractView{externalDependencies}
{}
AssetsLibraryView::~AssetsLibraryView() AssetsLibraryView::~AssetsLibraryView()
{} {}

View File

@@ -19,7 +19,7 @@ class AssetsLibraryView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
AssetsLibraryView(); AssetsLibraryView(ExternalDependenciesInterface &externalDependencies);
~AssetsLibraryView() override; ~AssetsLibraryView() override;
bool hasWidget() const override; bool hasWidget() const override;

View File

@@ -10,7 +10,7 @@
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT DefaultAction : public QAction class QMLDESIGNERCOMPONENTS_EXPORT DefaultAction : public QAction
{ {
Q_OBJECT Q_OBJECT
@@ -25,7 +25,7 @@ protected:
SelectionContext m_selectionContext; SelectionContext m_selectionContext;
}; };
class QMLDESIGNERCORE_EXPORT AbstractAction : public ActionInterface class QMLDESIGNERCOMPONENTS_EXPORT AbstractAction : public ActionInterface
{ {
public: public:
AbstractAction(const QString &description = QString()); AbstractAction(const QString &description = QString());

View File

@@ -11,7 +11,7 @@
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT AbstractActionGroup : public ActionInterface class QMLDESIGNERCOMPONENTS_EXPORT AbstractActionGroup : public ActionInterface
{ {
public: public:
AbstractActionGroup(const QString &displayName); AbstractActionGroup(const QString &displayName);

View File

@@ -12,7 +12,7 @@ QT_END_NAMESPACE
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT ActionInterface class QMLDESIGNERCOMPONENTS_EXPORT ActionInterface
{ {
public: public:
enum Type { enum Type {

View File

@@ -78,7 +78,8 @@ private:
QToolBar *m_toolBar; QToolBar *m_toolBar;
}; };
class QMLDESIGNERCORE_EXPORT DesignerActionManager { class QMLDESIGNERCOMPONENTS_EXPORT DesignerActionManager
{
public: public:
DesignerActionManager(DesignerActionManagerView *designerActionManagerView); DesignerActionManager(DesignerActionManagerView *designerActionManagerView);
~DesignerActionManager(); ~DesignerActionManager();

View File

@@ -11,8 +11,9 @@
namespace QmlDesigner { namespace QmlDesigner {
DesignerActionManagerView::DesignerActionManagerView() DesignerActionManagerView::DesignerActionManagerView(ExternalDependenciesInterface &externalDependencies)
: m_designerActionManager(this) : AbstractView{externalDependencies}
, m_designerActionManager(this)
, m_isInRewriterTransaction(false) , m_isInRewriterTransaction(false)
, m_setupContextDirty(false) , m_setupContextDirty(false)
{ {

View File

@@ -16,7 +16,7 @@ class DesignerActionManagerView : public AbstractView
{ {
Q_OBJECT Q_OBJECT
public: public:
DesignerActionManagerView(); DesignerActionManagerView(ExternalDependenciesInterface &externalDependencies);
void modelAttached(Model *model) override; void modelAttached(Model *model) override;
void modelAboutToBeDetached(Model *model) override; void modelAboutToBeDetached(Model *model) override;

View File

@@ -578,10 +578,14 @@ static QString toUpper(const QString &signal)
return ret; return ret;
} }
static void addSignal(const QString &typeName, const QString &itemId, const QString &signalName, bool isRootModelNode) static void addSignal(const QString &typeName,
const QString &itemId,
const QString &signalName,
bool isRootModelNode,
ExternalDependenciesInterface &externanDependencies)
{ {
auto model = Model::create("Item", 2, 0); auto model = Model::create("Item", 2, 0);
RewriterView rewriterView(RewriterView::Amend); RewriterView rewriterView(externanDependencies, RewriterView::Amend);
auto textEdit = qobject_cast<TextEditor::TextEditorWidget*> auto textEdit = qobject_cast<TextEditor::TextEditorWidget*>
(Core::EditorManager::currentEditor()->widget()); (Core::EditorManager::currentEditor()->widget());
@@ -700,12 +704,19 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
if (dialog->signal().isEmpty()) if (dialog->signal().isEmpty())
return; return;
qmlObjectNode.view()->executeInTransaction("NavigatorTreeModel:exportItem", [=](){ qmlObjectNode.view()->executeInTransaction("NavigatorTreeModel:exportItem", [=]() {
addSignal(typeName,
addSignal(typeName, itemId, dialog->signal(), isModelNodeRoot); itemId,
dialog->signal(),
isModelNodeRoot,
selectionState.view()->externalDependencies());
}); });
addSignal(typeName, itemId, dialog->signal(), isModelNodeRoot); addSignal(typeName,
itemId,
dialog->signal(),
isModelNodeRoot,
selectionState.view()->externalDependencies());
//Move cursor to correct curser position //Move cursor to correct curser position
const QString filePath = Core::EditorManager::currentDocument()->filePath().toString(); const QString filePath = Core::EditorManager::currentDocument()->filePath().toString();
@@ -1524,7 +1535,8 @@ void styleMerge(const SelectionContext &selectionContext, const QString &templat
textEditTemplate.setPlainText(imports + qmlTemplateString); textEditTemplate.setPlainText(imports + qmlTemplateString);
NotIndentingTextEditModifier textModifierTemplate(&textEditTemplate); NotIndentingTextEditModifier textModifierTemplate(&textEditTemplate);
QScopedPointer<RewriterView> templateRewriterView(new RewriterView(RewriterView::Amend)); QScopedPointer<RewriterView> templateRewriterView(
new RewriterView(selectionContext.view()->externalDependencies(), RewriterView::Amend));
templateRewriterView->setTextModifier(&textModifierTemplate); templateRewriterView->setTextModifier(&textModifierTemplate);
templateModel->attachView(templateRewriterView.data()); templateModel->attachView(templateRewriterView.data());
templateRewriterView->setCheckSemanticErrors(false); templateRewriterView->setCheckSemanticErrors(false);
@@ -1543,7 +1555,8 @@ void styleMerge(const SelectionContext &selectionContext, const QString &templat
textEditStyle.setPlainText(parentRewriterView->textModifierContent()); textEditStyle.setPlainText(parentRewriterView->textModifierContent());
NotIndentingTextEditModifier textModifierStyle(&textEditStyle); NotIndentingTextEditModifier textModifierStyle(&textEditStyle);
QScopedPointer<RewriterView> styleRewriterView(new RewriterView(RewriterView::Amend)); QScopedPointer<RewriterView> styleRewriterView(
new RewriterView(selectionContext.view()->externalDependencies(), RewriterView::Amend));
styleRewriterView->setTextModifier(&textModifierStyle); styleRewriterView->setTextModifier(&textModifierStyle);
styleModel->attachView(styleRewriterView.data()); styleModel->attachView(styleRewriterView.data());

View File

@@ -1,17 +1,17 @@
// Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include <qmldesignercorelib_global.h>
#include <abstractview.h> #include <abstractview.h>
#include <QPointF> #include <QPointF>
#include <QPointer> #include <QPointer>
#include <qmldesignercomponents_global.h>
#pragma once #pragma once
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT SelectionContext { class QMLDESIGNERCOMPONENTS_EXPORT SelectionContext
{
public: public:
enum class UpdateMode { enum class UpdateMode {
Normal, Normal,

View File

@@ -3,7 +3,7 @@
#pragma once #pragma once
#include <qmldesignercorelib_global.h> #include <qmldesignercomponents_global.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
@@ -16,7 +16,7 @@ QT_END_NAMESPACE
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT Theme : public Utils::Theme class QMLDESIGNERCOMPONENTS_EXPORT Theme : public Utils::Theme
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -47,9 +47,26 @@ static Q_LOGGING_CATEGORY(viewBenchmark, "qtc.viewmanager.attach", QtWarningMsg)
class ViewManagerData class ViewManagerData
{ {
public: public:
ViewManagerData(AsynchronousImageCache &imageCache) ViewManagerData(AsynchronousImageCache &imageCache,
: itemLibraryView(imageCache) ExternalDependenciesInterface &externalDependencies)
, propertyEditorView(imageCache) : debugView{externalDependencies}
, designerActionManagerView{externalDependencies}
, nodeInstanceView(QCoreApplication::arguments().contains("-capture-puppet-stream")
? capturingConnectionManager
: connectionManager,
externalDependencies)
, componentView{externalDependencies}
, edit3DView{externalDependencies}
, formEditorView{externalDependencies}
, textEditorView{externalDependencies}
, assetsLibraryView{externalDependencies}
, itemLibraryView(imageCache, externalDependencies)
, navigatorView{externalDependencies}
, propertyEditorView(imageCache, externalDependencies)
, materialEditorView{externalDependencies}
, materialBrowserView{externalDependencies}
, statesEditorView{externalDependencies}
, newStatesEditorView{externalDependencies}
{} {}
InteractiveConnectionManager connectionManager; InteractiveConnectionManager connectionManager;
@@ -57,9 +74,7 @@ public:
QmlModelState savedState; QmlModelState savedState;
Internal::DebugView debugView; Internal::DebugView debugView;
DesignerActionManagerView designerActionManagerView; DesignerActionManagerView designerActionManagerView;
NodeInstanceView nodeInstanceView{ NodeInstanceView nodeInstanceView;
QCoreApplication::arguments().contains("-capture-puppet-stream") ? capturingConnectionManager
: connectionManager};
ComponentView componentView; ComponentView componentView;
Edit3DView edit3DView; Edit3DView edit3DView;
FormEditorView formEditorView; FormEditorView formEditorView;
@@ -81,8 +96,9 @@ static CrumbleBar *crumbleBar() {
return QmlDesignerPlugin::instance()->mainWidget()->crumbleBar(); return QmlDesignerPlugin::instance()->mainWidget()->crumbleBar();
} }
ViewManager::ViewManager(AsynchronousImageCache &imageCache) ViewManager::ViewManager(AsynchronousImageCache &imageCache,
: d(std::make_unique<ViewManagerData>(imageCache)) ExternalDependenciesInterface &externalDependencies)
: d(std::make_unique<ViewManagerData>(imageCache, externalDependencies))
{ {
d->formEditorView.setGotoErrorCallback([this](int line, int column) { d->formEditorView.setGotoErrorCallback([this](int line, int column) {
d->textEditorView.gotoCursorPosition(line, column); d->textEditorView.gotoCursorPosition(line, column);

View File

@@ -3,7 +3,9 @@
#pragma once #pragma once
#include "abstractview.h" #include <qmldesignercomponents_global.h>
#include <abstractview.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
@@ -28,10 +30,11 @@ namespace Internal { class DesignModeWidget; }
class ViewManagerData; class ViewManagerData;
class QMLDESIGNERCORE_EXPORT ViewManager class QMLDESIGNERCOMPONENTS_EXPORT ViewManager
{ {
public: public:
ViewManager(class AsynchronousImageCache &imageCache); ViewManager(class AsynchronousImageCache &imageCache,
class ExternalDependenciesInterface &externalDependencies);
~ViewManager(); ~ViewManager();
void attachRewriterView(); void attachRewriterView();

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once #pragma once
#include <qmldesignercorelib_global.h> #include <qmldesignercomponents_global.h>
#include <QPointer> #include <QPointer>
#include <QWidgetAction> #include <QWidgetAction>
@@ -15,7 +15,7 @@ QT_END_NAMESPACE
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT ZoomAction : public QWidgetAction class QMLDESIGNERCOMPONENTS_EXPORT ZoomAction : public QWidgetAction
{ {
Q_OBJECT Q_OBJECT

View File

@@ -24,8 +24,9 @@ namespace QmlDesigner {
namespace Internal { namespace Internal {
ConnectionView::ConnectionView() ConnectionView::ConnectionView(ExternalDependenciesInterface &externalDependencies)
: m_connectionViewWidget(new ConnectionViewWidget()) : AbstractView{externalDependencies}
, m_connectionViewWidget(new ConnectionViewWidget())
, m_connectionModel(new ConnectionModel(this)) , m_connectionModel(new ConnectionModel(this))
, m_bindingModel(new BindingModel(this)) , m_bindingModel(new BindingModel(this))
, m_dynamicPropertiesModel(new DynamicPropertiesModel(false, this)) , m_dynamicPropertiesModel(new DynamicPropertiesModel(false, this))

View File

@@ -28,7 +28,7 @@ class ConnectionView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
ConnectionView(); ConnectionView(ExternalDependenciesInterface &externalDependencies);
~ConnectionView() override; ~ConnectionView() override;
// AbstractView // AbstractView

View File

@@ -13,6 +13,7 @@
#include "theme.h" #include "theme.h"
#include "signalhandlerproperty.h" #include "signalhandlerproperty.h"
#include <designeractionmanager.h>
#include <designersettings.h> #include <designersettings.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>

View File

@@ -21,8 +21,9 @@
namespace QmlDesigner { namespace QmlDesigner {
CurveEditorView::CurveEditorView() CurveEditorView::CurveEditorView(ExternalDependenciesInterface &externalDepoendencies)
: m_block(false) : AbstractView{externalDepoendencies}
, m_block(false)
, m_model(new CurveEditorModel()) , m_model(new CurveEditorModel())
, m_editor(new CurveEditor(m_model)) , m_editor(new CurveEditor(m_model))
{ {

View File

@@ -16,7 +16,7 @@ class CurveEditorView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
explicit CurveEditorView(); explicit CurveEditorView(ExternalDependenciesInterface &externalDepoendencies);
~CurveEditorView() override; ~CurveEditorView() override;
public: public:

View File

@@ -39,8 +39,9 @@ namespace QmlDesigner {
namespace Internal { namespace Internal {
DebugView::DebugView() DebugView::DebugView(ExternalDependenciesInterface &externalDependencies)
: m_debugViewWidget(new DebugViewWidget) : AbstractView{externalDependencies}
, m_debugViewWidget(new DebugViewWidget)
{ {
} }

View File

@@ -17,7 +17,7 @@ class DebugView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
DebugView(); DebugView(ExternalDependenciesInterface &externalDependencies);
~DebugView() override; ~DebugView() override;
// AbstractView // AbstractView

View File

@@ -10,7 +10,6 @@
#include "metainfo.h" #include "metainfo.h"
#include "nodehints.h" #include "nodehints.h"
#include "seekerslider.h" #include "seekerslider.h"
#include "view3dactioncommand.h"
#include <auxiliarydataproperties.h> #include <auxiliarydataproperties.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -31,7 +30,8 @@
namespace QmlDesigner { namespace QmlDesigner {
Edit3DView::Edit3DView() Edit3DView::Edit3DView(ExternalDependenciesInterface &externalDependencies)
: AbstractView{externalDependencies}
{ {
m_compressionTimer.setInterval(1000); m_compressionTimer.setInterval(1000);
m_compressionTimer.setSingleShot(true); m_compressionTimer.setSingleShot(true);

View File

@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once #pragma once
#include <qmldesignercomponents_global.h>
#include <abstractview.h> #include <abstractview.h>
#include <modelcache.h> #include <modelcache.h>
@@ -22,12 +24,12 @@ class Edit3DAction;
class Edit3DCameraAction; class Edit3DCameraAction;
class SeekerSlider; class SeekerSlider;
class QMLDESIGNERCORE_EXPORT Edit3DView : public AbstractView class QMLDESIGNERCOMPONENTS_EXPORT Edit3DView : public AbstractView
{ {
Q_OBJECT Q_OBJECT
public: public:
Edit3DView(); Edit3DView(ExternalDependenciesInterface &externalDependencies);
~Edit3DView() override; ~Edit3DView() override;
WidgetInfo widgetInfo() override; WidgetInfo widgetInfo() override;

View File

@@ -1,10 +1,10 @@
// Copyright (C) 2020 The Qt Company Ltd. // Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "edit3dwidget.h"
#include "edit3dactions.h" #include "edit3dactions.h"
#include "edit3dcanvas.h" #include "edit3dcanvas.h"
#include "edit3dview.h" #include "edit3dview.h"
#include "edit3dwidget.h"
#include "edit3dvisibilitytogglesmenu.h" #include "edit3dvisibilitytogglesmenu.h"
#include "metainfo.h" #include "metainfo.h"
#include "modelnodeoperations.h" #include "modelnodeoperations.h"
@@ -12,8 +12,9 @@
#include "qmldesignerplugin.h" #include "qmldesignerplugin.h"
#include "qmlvisualnode.h" #include "qmlvisualnode.h"
#include "viewmanager.h" #include "viewmanager.h"
#include <seekerslider.h> #include <designeractionmanager.h>
#include <nodeinstanceview.h> #include <nodeinstanceview.h>
#include <seekerslider.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h> #include <coreplugin/actionmanager/command.h>

View File

@@ -44,12 +44,12 @@ static Utils::FilePath findFile(const Utils::FilePath &path, const QString &file
return {}; return {};
} }
static std::unique_ptr<NodeListView> st_nodeView;
NodeListView *EventList::st_nodeView = nullptr;
void EventList::setNodeProperties(AbstractView *view) void EventList::setNodeProperties(AbstractView *view)
{ {
st_nodeView = new NodeListView(view); st_nodeView = std::make_unique<NodeListView>(view->externalDependencies());
view->model()->attachView(st_nodeView.get());
} }
void EventList::selectNode(int internalId) void EventList::selectNode(int internalId)
@@ -108,7 +108,7 @@ QStandardItemModel *EventList::nodeModel()
NodeListView *EventList::nodeListView() NodeListView *EventList::nodeListView()
{ {
return st_nodeView; return st_nodeView.get();
} }
ModelNode EventList::modelNode(const QString &id) ModelNode EventList::modelNode(const QString &id)
@@ -196,7 +196,8 @@ void EventList::initialize(EventListPluginView *parent)
} }
if (!m_eventView) { if (!m_eventView) {
m_eventView = std::make_unique<EventListView>(); m_eventView = std::make_unique<EventListView>(parent->externalDependencies());
m_model->attachView(m_eventView.get()); m_model->attachView(m_eventView.get());
} }
} }

View File

@@ -49,8 +49,6 @@ public:
void write(const QString &text); void write(const QString &text);
private: private:
static NodeListView *st_nodeView;
std::unique_ptr<Model> m_model; std::unique_ptr<Model> m_model;
std::unique_ptr<EventListView> m_eventView; std::unique_ptr<EventListView> m_eventView;
Utils::FilePath m_path; Utils::FilePath m_path;

View File

@@ -75,7 +75,8 @@ void EventListDialog::initialize(EventList &events)
Model *model = events.model(); Model *model = events.model();
m_modifier->setParent(model); m_modifier->setParent(model);
m_rewriter = new RewriterView(QmlDesigner::RewriterView::Validate); m_rewriter = new RewriterView(events.view()->externalDependencies(),
QmlDesigner::RewriterView::Validate);
m_rewriter->setParent(model); m_rewriter->setParent(model);
m_rewriter->setTextModifier(m_modifier); m_rewriter->setTextModifier(m_modifier);
m_rewriter->setCheckSemanticErrors(false); m_rewriter->setCheckSemanticErrors(false);

View File

@@ -7,11 +7,12 @@
#include "eventlistdialog.h" #include "eventlistdialog.h"
#include "signalhandlerproperty.h" #include "signalhandlerproperty.h"
#include <componentcore/componentcore_constants.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <designeractionmanager.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h> #include <extensionsystem/pluginspec.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <componentcore/componentcore_constants.h>
namespace QmlDesigner { namespace QmlDesigner {
@@ -30,8 +31,9 @@ SignalHandlerProperty signalPropertyFromAction(ActionInterface *interface)
return SignalHandlerProperty(); return SignalHandlerProperty();
} }
EventListPluginView::EventListPluginView() EventListPluginView::EventListPluginView(ExternalDependenciesInterface &externalDepoendencies)
: m_eventlist() : AbstractView{externalDepoendencies}
, m_eventlist()
, m_eventListDialog(nullptr) , m_eventListDialog(nullptr)
, m_assigner(nullptr) , m_assigner(nullptr)
, m_signalConnector(nullptr) , m_signalConnector(nullptr)

View File

@@ -16,7 +16,7 @@ class EventListPluginView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
EventListPluginView(); EventListPluginView(ExternalDependenciesInterface &externalDepoendencies);
~EventListPluginView() override = default; ~EventListPluginView() override = default;
void registerActions(); void registerActions();

View File

@@ -50,8 +50,9 @@ QStringList EventListModel::connectEvents(const QStringList &eventIds)
return out; return out;
} }
EventListView::EventListView() EventListView::EventListView(ExternalDependenciesInterface &externalDependencies)
: m_eventlist() : AbstractView{externalDependencies}
, m_eventlist()
, m_model(std::make_unique<EventListModel>()) , m_model(std::make_unique<EventListModel>())
{} {}

View File

@@ -51,7 +51,7 @@ class EventListView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
explicit EventListView(); explicit EventListView(ExternalDependenciesInterface &externalDependencies);
~EventListView() override; ~EventListView() override;
void nodeRemoved(const ModelNode &removedNode, void nodeRemoved(const ModelNode &removedNode,

View File

@@ -41,11 +41,10 @@ NodeListModel::NodeListModel(QObject *parent)
setSortRole(internalIdRole); setSortRole(internalIdRole);
} }
NodeListView::NodeListView(AbstractView *parent) NodeListView::NodeListView(ExternalDependenciesInterface &externalDependencies)
: m_itemModel(new NodeListModel(this)) : AbstractView{externalDependencies}
, m_itemModel(new NodeListModel(this))
{ {
setParent(parent);
parent->model()->attachView(this);
reset(); reset();
} }

View File

@@ -33,7 +33,7 @@ class NodeListView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
explicit NodeListView(AbstractView *parent); explicit NodeListView(ExternalDependenciesInterface &externalDependencies);
~NodeListView() override; ~NodeListView() override;
int currentNode() const; int currentNode() const;

View File

@@ -6,7 +6,7 @@
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool class QMLDESIGNERCOMPONENTS_EXPORT AbstractCustomTool : public QmlDesigner::AbstractFormEditorTool
{ {
public: public:
AbstractCustomTool(); AbstractCustomTool();

View File

@@ -4,7 +4,7 @@
#include "formeditoritem.h" #include "formeditoritem.h"
#include <qmldesignercorelib_global.h> #include <qmldesignercomponents_global.h>
#include "snapper.h" #include "snapper.h"
@@ -16,7 +16,7 @@ namespace QmlDesigner {
class FormEditorView; class FormEditorView;
class QMLDESIGNERCORE_EXPORT AbstractFormEditorTool class QMLDESIGNERCOMPONENTS_EXPORT AbstractFormEditorTool
{ {
friend FormEditorView; friend FormEditorView;

View File

@@ -2,9 +2,11 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once #pragma once
#include <qmlitemnode.h>
#include "snappinglinecreator.h" #include "snappinglinecreator.h"
#include <qmldesignercomponents_global.h>
#include <qmlitemnode.h>
#include <QPointer> #include <QPointer>
#include <QGraphicsWidget> #include <QGraphicsWidget>
@@ -25,7 +27,7 @@ namespace Internal {
class MoveController; class MoveController;
} }
class QMLDESIGNERCORE_EXPORT FormEditorItem : public QGraphicsItem class QMLDESIGNERCOMPONENTS_EXPORT FormEditorItem : public QGraphicsItem
{ {
friend FormEditorScene; friend FormEditorScene;

View File

@@ -21,7 +21,7 @@ class FormEditorItem;
class FormEditorView; class FormEditorView;
class LayerItem; class LayerItem;
class QMLDESIGNERCORE_EXPORT FormEditorScene : public QGraphicsScene class QMLDESIGNERCOMPONENTS_EXPORT FormEditorScene : public QGraphicsScene
{ {
Q_OBJECT Q_OBJECT

View File

@@ -42,7 +42,9 @@
namespace QmlDesigner { namespace QmlDesigner {
FormEditorView::FormEditorView() {} FormEditorView::FormEditorView(ExternalDependenciesInterface &externalDependencies)
: AbstractView{externalDependencies}
{}
FormEditorScene* FormEditorView::scene() const FormEditorScene* FormEditorView::scene() const
{ {

View File

@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once #pragma once
#include <qmldesignercomponents_global.h>
#include <abstractview.h> #include <abstractview.h>
#include <QPicture> #include <QPicture>
@@ -34,12 +36,12 @@ class DragTool;
class ItemLibraryEntry; class ItemLibraryEntry;
class QmlItemNode; class QmlItemNode;
class QMLDESIGNERCORE_EXPORT FormEditorView : public AbstractView class QMLDESIGNERCOMPONENTS_EXPORT FormEditorView : public AbstractView
{ {
Q_OBJECT Q_OBJECT
public: public:
FormEditorView(); FormEditorView(ExternalDependenciesInterface &externalDependencies);
~FormEditorView() override; ~FormEditorView() override;
// AbstractView // AbstractView

View File

@@ -4,13 +4,13 @@
#include "resizecontroller.h" #include "resizecontroller.h"
#include <qmldesignercorelib_global.h> #include <qmldesignercomponents_global.h>
#include <QGraphicsItem> #include <QGraphicsItem>
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT ResizeHandleItem : public QGraphicsItem class QMLDESIGNERCOMPONENTS_EXPORT ResizeHandleItem : public QGraphicsItem
{ {
public: public:
enum enum

View File

@@ -4,13 +4,13 @@
#include "rotationcontroller.h" #include "rotationcontroller.h"
#include <qmldesignercorelib_global.h> #include <qmldesignercomponents_global.h>
#include <QGraphicsItem> #include <QGraphicsItem>
namespace QmlDesigner { namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT RotationHandleItem : public QGraphicsItem class QMLDESIGNERCOMPONENTS_EXPORT RotationHandleItem : public QGraphicsItem
{ {
public: public:
enum enum

View File

@@ -15,8 +15,9 @@
namespace QmlDesigner { namespace QmlDesigner {
ComponentView::ComponentView() ComponentView::ComponentView(ExternalDependenciesInterface &externalDependencies)
: m_standardItemModel(new QStandardItemModel(this)) : AbstractView{externalDependencies}
, m_standardItemModel(new QStandardItemModel(this))
, m_componentAction(new ComponentAction(this)) , m_componentAction(new ComponentAction(this))
{ {
} }

View File

@@ -27,7 +27,7 @@ public:
ModelNodeRole = Qt::UserRole ModelNodeRole = Qt::UserRole
}; };
ComponentView(); ComponentView(ExternalDependenciesInterface &externalDependencies);
void modelAttached(Model *model) override; void modelAttached(Model *model) override;
void modelAboutToBeDetached(Model *model) override; void modelAboutToBeDetached(Model *model) override;

View File

@@ -60,13 +60,15 @@ namespace QmlDesigner {
DesignDocument acts as a facade to a model representing a qml document, DesignDocument acts as a facade to a model representing a qml document,
and the different views/widgets accessing it. and the different views/widgets accessing it.
*/ */
DesignDocument::DesignDocument(ProjectStorage<Sqlite::Database> &projectStorage) DesignDocument::DesignDocument(ProjectStorage<Sqlite::Database> &projectStorage,
ExternalDependenciesInterface &externalDependencies)
: m_documentModel(Model::create("QtQuick.Item", 1, 0)) : m_documentModel(Model::create("QtQuick.Item", 1, 0))
, m_subComponentManager(new SubComponentManager(m_documentModel.get(), this)) , m_subComponentManager(new SubComponentManager(m_documentModel.get(), externalDependencies))
, m_rewriterView(new RewriterView(RewriterView::Amend)) , m_rewriterView(new RewriterView(externalDependencies, RewriterView::Amend))
, m_documentLoaded(false) , m_documentLoaded(false)
, m_currentTarget(nullptr) , m_currentTarget(nullptr)
, m_projectStorage(projectStorage) , m_projectStorage(projectStorage)
, m_externalDependencies{externalDependencies}
{ {
} }
@@ -477,11 +479,11 @@ void DesignDocument::deleteSelected()
void DesignDocument::copySelected() void DesignDocument::copySelected()
{ {
DesignDocumentView view; DesignDocumentView view{m_externalDependencies};
currentModel()->attachView(&view); currentModel()->attachView(&view);
DesignDocumentView::copyModelNodes(view.selectedModelNodes()); DesignDocumentView::copyModelNodes(view.selectedModelNodes(), m_externalDependencies);
} }
void DesignDocument::cutSelected() void DesignDocument::cutSelected()
@@ -537,12 +539,12 @@ void DesignDocument::paste()
if (TimelineActions::clipboardContainsKeyframes()) // pasting keyframes is handled in TimelineView if (TimelineActions::clipboardContainsKeyframes()) // pasting keyframes is handled in TimelineView
return; return;
auto pasteModel = DesignDocumentView::pasteToModel(); auto pasteModel = DesignDocumentView::pasteToModel(m_externalDependencies);
if (!pasteModel) if (!pasteModel)
return; return;
DesignDocumentView view; DesignDocumentView view{m_externalDependencies};
pasteModel->attachView(&view); pasteModel->attachView(&view);
ModelNode rootNode(view.rootModelNode()); ModelNode rootNode(view.rootModelNode());
QList<ModelNode> selectedNodes = rootNode.directSubModelNodes(); QList<ModelNode> selectedNodes = rootNode.directSubModelNodes();
@@ -662,7 +664,7 @@ void DesignDocument::selectAll()
if (!currentModel()) if (!currentModel())
return; return;
DesignDocumentView view; DesignDocumentView view{m_externalDependencies};
currentModel()->attachView(&view); currentModel()->attachView(&view);
QList<ModelNode> allNodesExceptRootNode(view.allModelNodes()); QList<ModelNode> allNodesExceptRootNode(view.allModelNodes());

View File

@@ -10,6 +10,7 @@
#include <projectstorage/projectstoragefwd.h> #include <projectstorage/projectstoragefwd.h>
#include <rewriterview.h> #include <rewriterview.h>
#include <subcomponentmanager.h> #include <subcomponentmanager.h>
#include <qmldesignercomponents_global.h>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
@@ -33,12 +34,13 @@ class CrumbleBarInfo;
class ViewManager; class ViewManager;
class AbstractView; class AbstractView;
class QMLDESIGNERCORE_EXPORT DesignDocument: public QObject class QMLDESIGNERCOMPONENTS_EXPORT DesignDocument : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
DesignDocument(ProjectStorage<Sqlite::Database> &projectStorage); DesignDocument(ProjectStorage<Sqlite::Database> &projectStorage,
ExternalDependenciesInterface &externalDependencies);
~DesignDocument() override; ~DesignDocument() override;
QString displayName() const; QString displayName() const;
@@ -139,6 +141,7 @@ private: // variables
bool m_documentLoaded; bool m_documentLoaded;
ProjectExplorer::Target *m_currentTarget; ProjectExplorer::Target *m_currentTarget;
ProjectStorage<Sqlite::Database> &m_projectStorage; ProjectStorage<Sqlite::Database> &m_projectStorage;
ExternalDependenciesInterface &m_externalDependencies;
}; };
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -22,8 +22,9 @@
namespace QmlDesigner { namespace QmlDesigner {
DesignDocumentView::DesignDocumentView() DesignDocumentView::DesignDocumentView(ExternalDependenciesInterface &externalDependencies)
: m_modelMerger(new ModelMerger(this)) : AbstractView{externalDependencies}
, m_modelMerger(new ModelMerger(this))
{ {
} }
@@ -79,7 +80,6 @@ void DesignDocumentView::fromClipboard()
// } // }
} }
QString DesignDocumentView::toText() const QString DesignDocumentView::toText() const
{ {
auto outputModel = Model::create("QtQuick.Rectangle", 1, 0, model()); auto outputModel = Model::create("QtQuick.Rectangle", 1, 0, model());
@@ -97,7 +97,8 @@ QString DesignDocumentView::toText() const
textEdit.setPlainText(imports + QStringLiteral("Item {\n}\n")); textEdit.setPlainText(imports + QStringLiteral("Item {\n}\n"));
NotIndentingTextEditModifier modifier(&textEdit); NotIndentingTextEditModifier modifier(&textEdit);
QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend)); QScopedPointer<RewriterView> rewriterView(
new RewriterView(externalDependencies(), RewriterView::Amend));
rewriterView->setCheckSemanticErrors(false); rewriterView->setCheckSemanticErrors(false);
rewriterView->setTextModifier(&modifier); rewriterView->setTextModifier(&modifier);
outputModel->setRewriterView(rewriterView.data()); outputModel->setRewriterView(rewriterView.data());
@@ -126,7 +127,7 @@ void DesignDocumentView::fromText(const QString &text)
textEdit.setPlainText(imports + text); textEdit.setPlainText(imports + text);
NotIndentingTextEditModifier modifier(&textEdit); NotIndentingTextEditModifier modifier(&textEdit);
RewriterView rewriterView; RewriterView rewriterView{externalDependencies()};
rewriterView.setCheckSemanticErrors(false); rewriterView.setCheckSemanticErrors(false);
rewriterView.setTextModifier(&modifier); rewriterView.setTextModifier(&modifier);
inputModel->setRewriterView(&rewriterView); inputModel->setRewriterView(&rewriterView);
@@ -151,7 +152,7 @@ static Model *currentModel()
return nullptr; return nullptr;
} }
std::unique_ptr<Model> DesignDocumentView::pasteToModel() std::unique_ptr<Model> DesignDocumentView::pasteToModel(ExternalDependenciesInterface &externalDependencies)
{ {
Model *parentModel = currentModel(); Model *parentModel = currentModel();
@@ -167,7 +168,7 @@ std::unique_ptr<Model> DesignDocumentView::pasteToModel()
pasteModel->setFileUrl(parentModel->fileUrl()); pasteModel->setFileUrl(parentModel->fileUrl());
pasteModel->changeImports(parentModel->imports(), {}); pasteModel->changeImports(parentModel->imports(), {});
DesignDocumentView view; DesignDocumentView view{externalDependencies};
pasteModel->attachView(&view); pasteModel->attachView(&view);
view.fromClipboard(); view.fromClipboard();
@@ -175,7 +176,8 @@ std::unique_ptr<Model> DesignDocumentView::pasteToModel()
return pasteModel; return pasteModel;
} }
void DesignDocumentView::copyModelNodes(const QList<ModelNode> &nodesToCopy) void DesignDocumentView::copyModelNodes(const QList<ModelNode> &nodesToCopy,
ExternalDependenciesInterface &externalDependencies)
{ {
Model *parentModel = currentModel(); Model *parentModel = currentModel();
@@ -201,7 +203,7 @@ void DesignDocumentView::copyModelNodes(const QList<ModelNode> &nodesToCopy)
} }
} }
DesignDocumentView view; DesignDocumentView view{externalDependencies};
copyModel->attachView(&view); copyModel->attachView(&view);
if (selectedNodes.count() == 1) { if (selectedNodes.count() == 1) {

View File

@@ -4,6 +4,7 @@
#pragma once #pragma once
#include <abstractview.h> #include <abstractview.h>
#include <qmldesignercomponents_global.h>
#include <memory> #include <memory>
@@ -11,11 +12,11 @@ namespace QmlDesigner {
class ModelMerger; class ModelMerger;
class QMLDESIGNERCORE_EXPORT DesignDocumentView : public AbstractView class QMLDESIGNERCOMPONENTS_EXPORT DesignDocumentView : public AbstractView
{ {
Q_OBJECT Q_OBJECT
public: public:
DesignDocumentView(); DesignDocumentView(ExternalDependenciesInterface &externalDependencies);
~DesignDocumentView() override; ~DesignDocumentView() override;
ModelNode insertModel(const ModelNode &modelNode); ModelNode insertModel(const ModelNode &modelNode);
@@ -27,8 +28,9 @@ public:
QString toText() const; QString toText() const;
void fromText(const QString &text); void fromText(const QString &text);
static std::unique_ptr<Model> pasteToModel(); static std::unique_ptr<Model> pasteToModel(ExternalDependenciesInterface &externalDependencies);
static void copyModelNodes(const QList<ModelNode> &nodesToCopy); static void copyModelNodes(const QList<ModelNode> &nodesToCopy,
ExternalDependenciesInterface &externalDependencies);
private: private:
std::unique_ptr<ModelMerger> m_modelMerger; std::unique_ptr<ModelMerger> m_modelMerger;

View File

@@ -5,10 +5,10 @@
#include "qmldesignerplugin.h" #include "qmldesignerplugin.h"
#include "qmldesignerconstants.h" #include "qmldesignerconstants.h"
#include "rewriterview.h"
#include "model.h" #include "model.h"
#include "puppetcreator.h" #include "puppetstarter.h"
#include "rewritertransaction.h" #include "rewritertransaction.h"
#include "rewriterview.h"
#include "rewritingexception.h" #include "rewritingexception.h"
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
@@ -568,9 +568,6 @@ void ItemLibraryAssetImporter::startNextImportProcess()
Model *model = doc ? doc->currentModel() : nullptr; Model *model = doc ? doc->currentModel() : nullptr;
if (model) { if (model) {
PuppetCreator puppetCreator(doc->currentTarget(), model);
puppetCreator.createQml2PuppetExecutableIfMissing();
bool done = false; bool done = false;
while (!m_puppetQueue.isEmpty() && !done) { while (!m_puppetQueue.isEmpty() && !done) {
const ParseData pd = m_parseData.value(m_puppetQueue.takeLast()); const ParseData pd = m_parseData.value(m_puppetQueue.takeLast());
@@ -581,7 +578,8 @@ void ItemLibraryAssetImporter::startNextImportProcess()
<< pd.outDir.absolutePath() << QString::fromUtf8(optDoc.toJson()); << pd.outDir.absolutePath() << QString::fromUtf8(optDoc.toJson());
m_currentImportId = pd.importId; m_currentImportId = pd.importId;
m_puppetProcess = puppetCreator.createPuppetProcess( m_puppetProcess = PuppetStarter::createPuppetProcess(
{},
"custom", "custom",
{}, {},
[&] {}, [&] {},
@@ -611,15 +609,13 @@ void ItemLibraryAssetImporter::startNextIconProcess()
Model *model = doc ? doc->currentModel() : nullptr; Model *model = doc ? doc->currentModel() : nullptr;
if (model) { if (model) {
PuppetCreator puppetCreator(doc->currentTarget(), model);
puppetCreator.createQml2PuppetExecutableIfMissing();
bool done = false; bool done = false;
while (!m_puppetQueue.isEmpty() && !done) { while (!m_puppetQueue.isEmpty() && !done) {
const ParseData pd = m_parseData.value(m_puppetQueue.takeLast()); const ParseData pd = m_parseData.value(m_puppetQueue.takeLast());
QStringList puppetArgs; QStringList puppetArgs;
puppetArgs << "--rendericon" << QString::number(24) << pd.iconFile << pd.iconSource; puppetArgs << "--rendericon" << QString::number(24) << pd.iconFile << pd.iconSource;
m_puppetProcess = puppetCreator.createPuppetProcess( m_puppetProcess = PuppetStarter::createPuppetProcess(
{},
"custom", "custom",
{}, {},
[&] {}, [&] {},

View File

@@ -2,12 +2,14 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "itemlibraryview.h" #include "itemlibraryview.h"
#include "itemlibrarywidget.h"
#include "itemlibraryassetimportdialog.h" #include "itemlibraryassetimportdialog.h"
#include "itemlibrarywidget.h"
#include "metainfo.h" #include "metainfo.h"
#include <asynchronousimagecache.h> #include <asynchronousimagecache.h>
#include <bindingproperty.h> #include <bindingproperty.h>
#include <componentcore_constants.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <designeractionmanager.h>
#include <import.h> #include <import.h>
#include <nodelistproperty.h> #include <nodelistproperty.h>
#include <projectexplorer/kit.h> #include <projectexplorer/kit.h>
@@ -17,14 +19,15 @@
#include <rewriterview.h> #include <rewriterview.h>
#include <sqlitedatabase.h> #include <sqlitedatabase.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <qmlitemnode.h> #include <qmlitemnode.h>
#include <qmldesignerconstants.h>
namespace QmlDesigner { namespace QmlDesigner {
ItemLibraryView::ItemLibraryView(AsynchronousImageCache &imageCache) ItemLibraryView::ItemLibraryView(AsynchronousImageCache &imageCache,
: AbstractView() ExternalDependenciesInterface &externalDependencies)
: AbstractView(externalDependencies)
, m_imageCache(imageCache) , m_imageCache(imageCache)
{} {}

View File

@@ -16,7 +16,8 @@ class ItemLibraryView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
ItemLibraryView(class AsynchronousImageCache &imageCache); ItemLibraryView(class AsynchronousImageCache &imageCache,
ExternalDependenciesInterface &externalDependencies);
~ItemLibraryView() override; ~ItemLibraryView() override;
bool hasWidget() const override; bool hasWidget() const override;

View File

@@ -25,7 +25,9 @@
namespace QmlDesigner { namespace QmlDesigner {
MaterialBrowserView::MaterialBrowserView() {} MaterialBrowserView::MaterialBrowserView(ExternalDependenciesInterface &externalDependencies)
: AbstractView{externalDependencies}
{}
MaterialBrowserView::~MaterialBrowserView() MaterialBrowserView::~MaterialBrowserView()
{} {}

View File

@@ -18,7 +18,7 @@ class MaterialBrowserView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
MaterialBrowserView(); MaterialBrowserView(ExternalDependenciesInterface &externalDependencies);
~MaterialBrowserView() override; ~MaterialBrowserView() override;
bool hasWidget() const override; bool hasWidget() const override;

View File

@@ -48,8 +48,9 @@
namespace QmlDesigner { namespace QmlDesigner {
MaterialEditorView::MaterialEditorView() MaterialEditorView::MaterialEditorView(ExternalDependenciesInterface &externalDependencies)
: m_stackedWidget(new QStackedWidget) : AbstractView{externalDependencies}
, m_stackedWidget(new QStackedWidget)
, m_dynamicPropertiesModel(new Internal::DynamicPropertiesModel(true, this)) , m_dynamicPropertiesModel(new Internal::DynamicPropertiesModel(true, this))
{ {
m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F7), m_stackedWidget); m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F7), m_stackedWidget);

View File

@@ -31,7 +31,7 @@ class MaterialEditorView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
MaterialEditorView(); MaterialEditorView(ExternalDependenciesInterface &externalDependencies);
~MaterialEditorView() override; ~MaterialEditorView() override;
bool hasWidget() const override; bool hasWidget() const override;

View File

@@ -88,8 +88,9 @@ static inline void moveNodesDown(const QList<QmlDesigner::ModelNode> &nodes)
namespace QmlDesigner { namespace QmlDesigner {
NavigatorView::NavigatorView() NavigatorView::NavigatorView(ExternalDependenciesInterface &externalDependencies)
: m_blockSelectionChangedSignal(false) : AbstractView{externalDependencies}
, m_blockSelectionChangedSignal(false)
{ {
} }
@@ -702,10 +703,8 @@ void NavigatorView::setupWidget()
m_widget = new NavigatorWidget(this); m_widget = new NavigatorWidget(this);
m_treeModel = new NavigatorTreeModel(this); m_treeModel = new NavigatorTreeModel(this);
#ifndef QMLDESIGNER_TEST
auto navigatorContext = new Internal::NavigatorContext(m_widget.data()); auto navigatorContext = new Internal::NavigatorContext(m_widget.data());
Core::ICore::addContextObject(navigatorContext); Core::ICore::addContextObject(navigatorContext);
#endif
m_treeModel->setView(this); m_treeModel->setView(this);
m_widget->setTreeModel(m_treeModel.data()); m_widget->setTreeModel(m_treeModel.data());
@@ -722,7 +721,6 @@ void NavigatorView::setupWidget()
connect(m_widget.data(), &NavigatorWidget::textFilterChanged, this, &NavigatorView::textFilterChanged); connect(m_widget.data(), &NavigatorWidget::textFilterChanged, this, &NavigatorView::textFilterChanged);
#ifndef QMLDESIGNER_TEST
const QString fontName = "qtds_propertyIconFont.ttf"; const QString fontName = "qtds_propertyIconFont.ttf";
const QSize size = QSize(28, 28); const QSize size = QSize(28, 28);
@@ -808,8 +806,6 @@ void NavigatorView::setupWidget()
treeWidget()->setItemDelegateForColumn(NavigatorTreeModel::ColumnType::Alias, aliasDelegate); treeWidget()->setItemDelegateForColumn(NavigatorTreeModel::ColumnType::Alias, aliasDelegate);
treeWidget()->setItemDelegateForColumn(NavigatorTreeModel::ColumnType::Visibility, visibilityDelegate); treeWidget()->setItemDelegateForColumn(NavigatorTreeModel::ColumnType::Visibility, visibilityDelegate);
treeWidget()->setItemDelegateForColumn(NavigatorTreeModel::ColumnType::Lock, lockDelegate); treeWidget()->setItemDelegateForColumn(NavigatorTreeModel::ColumnType::Lock, lockDelegate);
#endif //QMLDESIGNER_TEST
} }
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -40,7 +40,7 @@ class NavigatorView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
NavigatorView(); NavigatorView(ExternalDependenciesInterface &externalDependencies);
~NavigatorView() override; ~NavigatorView() override;
bool hasWidget() const override; bool hasWidget() const override;

View File

@@ -5,17 +5,19 @@
#include "navigatorwidget.h" #include "navigatorwidget.h"
#include "navigatorview.h" #include "navigatorview.h"
#include <designeractionmanager.h>
#include <designersettings.h> #include <designersettings.h>
#include <theme.h>
#include <qmldesignerconstants.h> #include <qmldesignerconstants.h>
#include <qmldesignericons.h> #include <qmldesignericons.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <theme.h>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QBoxLayout> #include <QBoxLayout>
#include <QHeaderView> #include <QHeaderView>
#include <QMenu> #include <QMenu>
#include <QStackedWidget> #include <QStackedWidget>
#include <QToolBar>
#include <QToolButton> #include <QToolButton>
#include <utils/fileutils.h> #include <utils/fileutils.h>
@@ -56,11 +58,9 @@ NavigatorWidget::NavigatorWidget(NavigatorView *view)
setWindowTitle(tr("Navigator", "Title of navigator view")); setWindowTitle(tr("Navigator", "Title of navigator view"));
#ifndef QMLDESIGNER_TEST
QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css"); QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css");
sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css"); sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css");
setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(sheet))); setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(sheet)));
#endif
QmlDesignerPlugin::trackWidgetFocusTime(this, Constants::EVENT_NAVIGATORVIEW_TIME); QmlDesignerPlugin::trackWidgetFocusTime(this, Constants::EVENT_NAVIGATORVIEW_TIME);
} }

View File

@@ -117,8 +117,8 @@ protected:
} }
}; };
PathTool::PathTool() PathTool::PathTool(ExternalDependenciesInterface &externalDepoendencies)
: m_pathToolView(this) : m_pathToolView(this, externalDepoendencies)
{ {
auto textToolAction = new PathToolAction; auto textToolAction = new PathToolAction;
QmlDesignerPlugin::instance()->designerActionManager().addDesignerAction(textToolAction); QmlDesignerPlugin::instance()->designerActionManager().addDesignerAction(textToolAction);

View File

@@ -20,7 +20,7 @@ class PathTool : public QObject, public AbstractCustomTool
{ {
Q_OBJECT Q_OBJECT
public: public:
PathTool(); PathTool(ExternalDependenciesInterface &externalDepoendencies);
~PathTool() override; ~PathTool() override;
void mousePressEvent(const QList<QGraphicsItem*> &itemList, void mousePressEvent(const QList<QGraphicsItem*> &itemList,

View File

@@ -14,8 +14,9 @@
namespace QmlDesigner { namespace QmlDesigner {
PathToolView::PathToolView(PathTool *pathTool) PathToolView::PathToolView(PathTool *pathTool, ExternalDependenciesInterface &externalDependencies)
: m_pathTool(pathTool) : AbstractView{externalDependencies}
, m_pathTool(pathTool)
{ {
} }

View File

@@ -13,7 +13,7 @@ class PathToolView : public AbstractView
{ {
Q_OBJECT Q_OBJECT
public: public:
PathToolView(PathTool *pathTool); PathToolView(PathTool *pathTool, ExternalDependenciesInterface &externalDependencies);
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange) override; void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange) override;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) override; void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) override;

View File

@@ -4,8 +4,8 @@
#include "propertyeditorimageprovider.h" #include "propertyeditorimageprovider.h"
#include "assetslibrarymodel.h" #include "assetslibrarymodel.h"
#include <hdrimage.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <utils/hdrimage.h>
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
#include <QMetaObject> #include <QMetaObject>

View File

@@ -48,8 +48,9 @@ static bool propertyIsAttachedLayoutProperty(const PropertyName &propertyName)
return propertyName.contains("Layout."); return propertyName.contains("Layout.");
} }
PropertyEditorView::PropertyEditorView(AsynchronousImageCache &imageCache) PropertyEditorView::PropertyEditorView(AsynchronousImageCache &imageCache,
: AbstractView() ExternalDependenciesInterface &externalDependencies)
: AbstractView(externalDependencies)
, m_imageCache(imageCache) , m_imageCache(imageCache)
, m_updateShortcut(nullptr) , m_updateShortcut(nullptr)
, m_timerId(0) , m_timerId(0)

View File

@@ -29,7 +29,8 @@ class PropertyEditorView: public AbstractView
Q_OBJECT Q_OBJECT
public: public:
PropertyEditorView(class AsynchronousImageCache &imageCache); PropertyEditorView(class AsynchronousImageCache &imageCache,
ExternalDependenciesInterface &externalDependencies);
~PropertyEditorView() override; ~PropertyEditorView() override;
bool hasWidget() const override; bool hasWidget() const override;

View File

@@ -0,0 +1,14 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include <QtGlobal>
#if defined(QMLDESIGNERCOMPONENTS_LIBRARY)
#define QMLDESIGNERCOMPONENTS_EXPORT Q_DECL_EXPORT
#elif defined(QMLDESIGNERCOMPONENTS_STATIC_LIBRARY)
#define QMLDESIGNERCOMPONENTS_EXPORT
#else
#define QMLDESIGNERCOMPONENTS_EXPORT Q_DECL_IMPORT
#endif

View File

@@ -13,6 +13,7 @@
#include "nodemetainfo.h" #include "nodemetainfo.h"
#include "qmlitemnode.h" #include "qmlitemnode.h"
#include <designeractionmanager.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <abstractaction.h> #include <abstractaction.h>

View File

@@ -33,8 +33,9 @@ namespace QmlDesigner {
We always have 'one' current state, where we get updates from (see sceneChanged()). In case We always have 'one' current state, where we get updates from (see sceneChanged()). In case
the current state is the base state, we render the base state + all other states. the current state is the base state, we render the base state + all other states.
*/ */
StatesEditorView::StatesEditorView() StatesEditorView::StatesEditorView(ExternalDependenciesInterface &externalDependencies)
: m_statesEditorModel(new StatesEditorModel(this)) : AbstractView{externalDependencies}
, m_statesEditorModel(new StatesEditorModel(this))
, m_lastIndex(-1) , m_lastIndex(-1)
, m_editor(nullptr) , m_editor(nullptr)
{ {

View File

@@ -17,7 +17,7 @@ class StatesEditorView : public AbstractView {
Q_OBJECT Q_OBJECT
public: public:
explicit StatesEditorView(); explicit StatesEditorView(ExternalDependenciesInterface &externalDependencies);
~StatesEditorView() override; ~StatesEditorView() override;
void renameState(int internalNodeId,const QString &newName); void renameState(int internalNodeId,const QString &newName);

View File

@@ -57,10 +57,12 @@ namespace Experimental {
We always have 'one' current state, where we get updates from (see sceneChanged()). In case We always have 'one' current state, where we get updates from (see sceneChanged()). In case
the current state is the base state, we render the base state + all other states. the current state is the base state, we render the base state + all other states.
*/ */
StatesEditorView::StatesEditorView() :
m_statesEditorModel(new StatesEditorModel(this)), StatesEditorView::StatesEditorView(ExternalDependenciesInterface &externalDependencies)
m_lastIndex(-1), : AbstractView(externalDependencies)
m_editor(nullptr) , m_statesEditorModel(new StatesEditorModel(this))
, m_lastIndex(-1)
, m_editor(nullptr)
{ {
Q_ASSERT(m_statesEditorModel); Q_ASSERT(m_statesEditorModel);
// base state // base state

View File

@@ -45,7 +45,7 @@ class StatesEditorView : public AbstractView {
Q_OBJECT Q_OBJECT
public: public:
explicit StatesEditorView(); explicit StatesEditorView(ExternalDependenciesInterface &externalDependencies);
~StatesEditorView() override; ~StatesEditorView() override;
void renameState(int internalNodeId,const QString &newName); void renameState(int internalNodeId,const QString &newName);

View File

@@ -42,8 +42,9 @@ namespace QmlDesigner {
const char TEXTEDITOR_CONTEXT_ID[] = "QmlDesigner.TextEditorContext"; const char TEXTEDITOR_CONTEXT_ID[] = "QmlDesigner.TextEditorContext";
TextEditorView::TextEditorView() TextEditorView::TextEditorView(ExternalDependenciesInterface &externalDependencies)
: m_widget(new TextEditorWidget(this)) : AbstractView{externalDependencies}
, m_widget(new TextEditorWidget(this))
, m_textEditorContext(new Internal::TextEditorContext(m_widget)) , m_textEditorContext(new Internal::TextEditorContext(m_widget))
{ {
Core::ICore::addContextObject(m_textEditorContext); Core::ICore::addContextObject(m_textEditorContext);

View File

@@ -2,9 +2,11 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once #pragma once
#include <coreplugin/icontext.h>
#include <abstractview.h> #include <abstractview.h>
#include <qmldesignercomponents_global.h>
#include <coreplugin/icontext.h>
#include <memory> #include <memory>
@@ -20,12 +22,12 @@ class TextEditorContext;
class TextEditorWidget; class TextEditorWidget;
class QMLDESIGNERCORE_EXPORT TextEditorView : public AbstractView class QMLDESIGNERCOMPONENTS_EXPORT TextEditorView : public AbstractView
{ {
Q_OBJECT Q_OBJECT
public: public:
TextEditorView(); TextEditorView(ExternalDependenciesInterface &externalDependencies);
~TextEditorView() override; ~TextEditorView() override;
// AbstractView // AbstractView

View File

@@ -8,6 +8,7 @@
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <rewriterview.h> #include <rewriterview.h>
#include <designeractionmanager.h>
#include <qmldesignerconstants.h> #include <qmldesignerconstants.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>

View File

@@ -3,7 +3,9 @@
#include "textedititem.h" #include "textedititem.h"
#include <externaldependenciesinterface.h>
#include <formeditorscene.h> #include <formeditorscene.h>
#include <formeditorview.h>
#include <model.h> #include <model.h>
#include <nodemetainfo.h> #include <nodemetainfo.h>
#include <rewritingexception.h> #include <rewritingexception.h>
@@ -32,7 +34,11 @@ void TextEditItem::writeTextToProperty()
if (text().isEmpty()) if (text().isEmpty())
m_formEditorItem->qmlItemNode().removeProperty("text"); m_formEditorItem->qmlItemNode().removeProperty("text");
else if (m_formEditorItem->qmlItemNode().isTranslatableText("text")) else if (m_formEditorItem->qmlItemNode().isTranslatableText("text"))
m_formEditorItem->qmlItemNode().setBindingProperty("text", QmlObjectNode::generateTranslatableText(text())); m_formEditorItem->qmlItemNode().setBindingProperty(
"text",
QmlObjectNode::generateTranslatableText(
text(),
m_formEditorItem->formEditorView()->externalDependencies().designerSettings()));
else else
m_formEditorItem->qmlItemNode().setVariantProperty("text", text()); m_formEditorItem->qmlItemNode().setVariantProperty("text", text());
} }

View File

@@ -56,19 +56,20 @@ void TimelineActions::copyAllKeyframesForTarget(const ModelNode &targetNode,
const QmlTimeline &timeline) const QmlTimeline &timeline)
{ {
DesignDocumentView::copyModelNodes(Utils::transform(timeline.keyframeGroupsForTarget(targetNode), DesignDocumentView::copyModelNodes(Utils::transform(timeline.keyframeGroupsForTarget(targetNode),
&QmlTimelineKeyframeGroup::modelNode)); &QmlTimelineKeyframeGroup::modelNode),
targetNode.view()->externalDependencies());
} }
void TimelineActions::pasteKeyframesToTarget(const ModelNode &targetNode, void TimelineActions::pasteKeyframesToTarget(const ModelNode &targetNode,
const QmlTimeline &timeline) const QmlTimeline &timeline)
{ {
if (timeline.isValid()) { if (timeline.isValid()) {
auto pasteModel = DesignDocumentView::pasteToModel(); auto pasteModel = DesignDocumentView::pasteToModel(targetNode.view()->externalDependencies());
if (!pasteModel) if (!pasteModel)
return; return;
DesignDocumentView view; DesignDocumentView view{targetNode.view()->externalDependencies()};
pasteModel->attachView(&view); pasteModel->attachView(&view);
if (!view.rootModelNode().isValid()) if (!view.rootModelNode().isValid())
@@ -113,7 +114,8 @@ void TimelineActions::pasteKeyframesToTarget(const ModelNode &targetNode,
} }
} }
void TimelineActions::copyKeyframes(const QList<ModelNode> &keyframes) void TimelineActions::copyKeyframes(const QList<ModelNode> &keyframes,
ExternalDependenciesInterface &externalDependencies)
{ {
QList<ModelNode> nodes; QList<ModelNode> nodes;
for (const auto &node : keyframes) { for (const auto &node : keyframes) {
@@ -137,7 +139,7 @@ void TimelineActions::copyKeyframes(const QList<ModelNode> &keyframes)
nodes << node; nodes << node;
} }
DesignDocumentView::copyModelNodes(nodes); DesignDocumentView::copyModelNodes(nodes, externalDependencies);
} }
bool isKeyframe(const ModelNode &node) bool isKeyframe(const ModelNode &node)
@@ -238,12 +240,12 @@ std::vector<std::tuple<ModelNode, qreal>> getFramesRelative(const ModelNode &par
void TimelineActions::pasteKeyframes(AbstractView *timelineView, const QmlTimeline &timeline) void TimelineActions::pasteKeyframes(AbstractView *timelineView, const QmlTimeline &timeline)
{ {
auto pasteModel = DesignDocumentView::pasteToModel(); auto pasteModel = DesignDocumentView::pasteToModel(timelineView->externalDependencies());
if (!pasteModel) if (!pasteModel)
return; return;
DesignDocumentView view; DesignDocumentView view{timelineView->externalDependencies()};
pasteModel->attachView(&view); pasteModel->attachView(&view);
if (!view.rootModelNode().isValid()) if (!view.rootModelNode().isValid())

View File

@@ -8,6 +8,8 @@
namespace QmlDesigner { namespace QmlDesigner {
class ExternalDependenciesInterface;
class TimelineActions class TimelineActions
{ {
public: public:
@@ -18,7 +20,8 @@ public:
static void copyAllKeyframesForTarget(const ModelNode &targetNode, const QmlTimeline &timeline); static void copyAllKeyframesForTarget(const ModelNode &targetNode, const QmlTimeline &timeline);
static void pasteKeyframesToTarget(const ModelNode &targetNode, const QmlTimeline &timeline); static void pasteKeyframesToTarget(const ModelNode &targetNode, const QmlTimeline &timeline);
static void copyKeyframes(const QList<ModelNode> &keyframes); static void copyKeyframes(const QList<ModelNode> &keyframes,
ExternalDependenciesInterface &externalDependencies);
static void pasteKeyframes(AbstractView *timelineView, const QmlTimeline &TimelineActions); static void pasteKeyframes(AbstractView *timelineView, const QmlTimeline &TimelineActions);
static bool clipboardContainsKeyframes(); static bool clipboardContainsKeyframes();

View File

@@ -62,12 +62,14 @@ QList<QmlTimelineKeyframeGroup> allTimelineFrames(const QmlTimeline &timeline)
return returnList; return returnList;
} }
TimelineGraphicsScene::TimelineGraphicsScene(TimelineWidget *parent) TimelineGraphicsScene::TimelineGraphicsScene(TimelineWidget *parent,
ExternalDependenciesInterface &m_externalDependencies)
: AbstractScrollGraphicsScene(parent) : AbstractScrollGraphicsScene(parent)
, m_parent(parent) , m_parent(parent)
, m_layout(new TimelineGraphicsLayout(this)) , m_layout(new TimelineGraphicsLayout(this))
, m_currentFrameIndicator(new TimelineFrameHandle) , m_currentFrameIndicator(new TimelineFrameHandle)
, m_tools(this) , m_tools(this)
, m_externalDependencies{m_externalDependencies}
{ {
addItem(m_layout); addItem(m_layout);
addItem(m_currentFrameIndicator); addItem(m_currentFrameIndicator);
@@ -735,8 +737,9 @@ void TimelineGraphicsScene::pasteKeyframesToTarget(const ModelNode &targetNode)
void TimelineGraphicsScene::copySelectedKeyframes() void TimelineGraphicsScene::copySelectedKeyframes()
{ {
TimelineActions::copyKeyframes( TimelineActions::copyKeyframes(Utils::transform(selectedKeyframes(),
Utils::transform(selectedKeyframes(), &TimelineKeyframeItem::frameNode)); &TimelineKeyframeItem::frameNode),
m_externalDependencies);
} }
void TimelineGraphicsScene::pasteSelectedKeyframes() void TimelineGraphicsScene::pasteSelectedKeyframes()

View File

@@ -30,6 +30,7 @@ class TimelineKeyframeItem;
class TimelinePlaceholder; class TimelinePlaceholder;
class TimelineGraphicsLayout; class TimelineGraphicsLayout;
class TimelineToolBar; class TimelineToolBar;
class ExternalDependenciesInterface;
class AbstractScrollGraphicsScene : public QGraphicsScene class AbstractScrollGraphicsScene : public QGraphicsScene
{ {
@@ -87,7 +88,8 @@ class TimelineGraphicsScene : public AbstractScrollGraphicsScene
Q_OBJECT Q_OBJECT
public: public:
explicit TimelineGraphicsScene(TimelineWidget *parent); explicit TimelineGraphicsScene(TimelineWidget *parent,
ExternalDependenciesInterface &m_externalDependencies);
~TimelineGraphicsScene() override; ~TimelineGraphicsScene() override;
@@ -192,6 +194,8 @@ private:
TimelineToolDelegate m_tools; TimelineToolDelegate m_tools;
ExternalDependenciesInterface &m_externalDependencies;
// sorted, unique cache of keyframes positions, used for snapping // sorted, unique cache of keyframes positions, used for snapping
QVector<qreal> m_keyframePositionsCache; QVector<qreal> m_keyframePositionsCache;
QElapsedTimer m_usageTimer; QElapsedTimer m_usageTimer;

View File

@@ -15,6 +15,7 @@
#include <auxiliarydataproperties.h> #include <auxiliarydataproperties.h>
#include <bindingproperty.h> #include <bindingproperty.h>
#include <designeractionmanager.h>
#include <exception.h> #include <exception.h>
#include <modelnodecontextmenu_helper.h> #include <modelnodecontextmenu_helper.h>
#include <nodeabstractproperty.h> #include <nodeabstractproperty.h>
@@ -45,8 +46,9 @@
namespace QmlDesigner { namespace QmlDesigner {
TimelineView::TimelineView() TimelineView::TimelineView(ExternalDependenciesInterface &externalDepoendencies)
: m_timelineWidget(nullptr) : AbstractView{externalDepoendencies}
, m_timelineWidget(nullptr)
{ {
EasingCurve::registerStreamOperators(); EasingCurve::registerStreamOperators();
setEnabled(false); setEnabled(false);

View File

@@ -18,7 +18,7 @@ class TimelineView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
explicit TimelineView(); explicit TimelineView(ExternalDependenciesInterface &externalDepoendencies);
~TimelineView() override; ~TimelineView() override;
//Abstract View //Abstract View
WidgetInfo widgetInfo() override; WidgetInfo widgetInfo() override;

View File

@@ -100,7 +100,7 @@ TimelineWidget::TimelineWidget(TimelineView *view)
, m_scrollbar(new QScrollBar(this)) , m_scrollbar(new QScrollBar(this))
, m_statusBar(new QLabel(this)) , m_statusBar(new QLabel(this))
, m_timelineView(view) , m_timelineView(view)
, m_graphicsScene(new TimelineGraphicsScene(this)) , m_graphicsScene(new TimelineGraphicsScene(this, view->externalDependencies()))
, m_addButton(new QPushButton(this)) , m_addButton(new QPushButton(this))
, m_onboardingContainer(new QWidget(this)) , m_onboardingContainer(new QWidget(this))
, m_loopPlayback(false) , m_loopPlayback(false)

View File

@@ -40,8 +40,9 @@
namespace QmlDesigner { namespace QmlDesigner {
TransitionEditorView::TransitionEditorView() TransitionEditorView::TransitionEditorView(ExternalDependenciesInterface &externalDependencies)
: m_transitionEditorWidget(nullptr) : AbstractView{externalDependencies}
, m_transitionEditorWidget(nullptr)
{ {
} }

View File

@@ -16,7 +16,7 @@ class TransitionEditorView : public AbstractView
Q_OBJECT Q_OBJECT
public: public:
explicit TransitionEditorView(); explicit TransitionEditorView(ExternalDependenciesInterface &externalDependencies);
~TransitionEditorView() override; ~TransitionEditorView() override;
//Abstract View //Abstract View
WidgetInfo widgetInfo() override; WidgetInfo widgetInfo() override;

View File

@@ -7,6 +7,7 @@
#include "addtabdesigneraction.h" #include "addtabdesigneraction.h"
#include "entertabdesigneraction.h" #include "entertabdesigneraction.h"
#include <designeractionmanager.h>
#include <viewmanager.h> #include <viewmanager.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>

View File

@@ -41,10 +41,12 @@ QString fileToString(const QString &filename)
ImageCacheCollector::ImageCacheCollector(ImageCacheConnectionManager &connectionManager, ImageCacheCollector::ImageCacheCollector(ImageCacheConnectionManager &connectionManager,
QSize captureImageMinimumSize, QSize captureImageMinimumSize,
QSize captureImageMaximumSize, QSize captureImageMaximumSize,
ExternalDependenciesInterface &externalDependencies,
ImageCacheCollectorNullImageHandling nullImageHandling) ImageCacheCollectorNullImageHandling nullImageHandling)
: m_connectionManager{connectionManager} : m_connectionManager{connectionManager}
, captureImageMinimumSize{captureImageMinimumSize} , captureImageMinimumSize{captureImageMinimumSize}
, captureImageMaximumSize{captureImageMaximumSize} , captureImageMaximumSize{captureImageMaximumSize}
, m_externalDependencies{externalDependencies}
, nullImageHandling{nullImageHandling} , nullImageHandling{nullImageHandling}
{} {}
@@ -56,8 +58,8 @@ void ImageCacheCollector::start(Utils::SmallStringView name,
CaptureCallback captureCallback, CaptureCallback captureCallback,
AbortCallback abortCallback) AbortCallback abortCallback)
{ {
RewriterView rewriterView{RewriterView::Amend}; RewriterView rewriterView{m_externalDependencies, RewriterView::Amend};
NodeInstanceView nodeInstanceView{m_connectionManager}; NodeInstanceView nodeInstanceView{m_connectionManager, m_externalDependencies};
nodeInstanceView.setCaptureImageMinimumAndMaximumSize(captureImageMinimumSize, nodeInstanceView.setCaptureImageMinimumAndMaximumSize(captureImageMinimumSize,
captureImageMaximumSize); captureImageMaximumSize);

View File

@@ -22,6 +22,7 @@ class NotIndentingTextEditModifier;
class ImageCacheConnectionManager; class ImageCacheConnectionManager;
class RewriterView; class RewriterView;
class NodeInstanceView; class NodeInstanceView;
class ExternalDependenciesInterface;
enum class ImageCacheCollectorNullImageHandling { CaptureNullImage, DontCaptureNullImage }; enum class ImageCacheCollectorNullImageHandling { CaptureNullImage, DontCaptureNullImage };
@@ -31,6 +32,7 @@ public:
ImageCacheCollector(ImageCacheConnectionManager &connectionManager, ImageCacheCollector(ImageCacheConnectionManager &connectionManager,
QSize captureImageMinimumSize, QSize captureImageMinimumSize,
QSize captureImageMaximumSize, QSize captureImageMaximumSize,
ExternalDependenciesInterface &externalDependencies,
ImageCacheCollectorNullImageHandling nullImageHandling = {}); ImageCacheCollectorNullImageHandling nullImageHandling = {});
~ImageCacheCollector(); ~ImageCacheCollector();
@@ -57,6 +59,7 @@ private:
QPointer<ProjectExplorer::Target> m_target; QPointer<ProjectExplorer::Target> m_target;
QSize captureImageMinimumSize; QSize captureImageMinimumSize;
QSize captureImageMaximumSize; QSize captureImageMaximumSize;
ExternalDependenciesInterface &m_externalDependencies;
ImageCacheCollectorNullImageHandling nullImageHandling{}; ImageCacheCollectorNullImageHandling nullImageHandling{};
}; };

View File

@@ -3,10 +3,6 @@
#include "imagecachefontcollector.h" #include "imagecachefontcollector.h"
#ifndef QMLDESIGNER_TEST // Tests don't care about UI, and can't have theme dependency here
#include <theme.h>
#endif
#include <QtGui/qrawfont.h> #include <QtGui/qrawfont.h>
#include <QtGui/qpainter.h> #include <QtGui/qpainter.h>
#include <QtGui/qimage.h> #include <QtGui/qimage.h>

View File

@@ -12,14 +12,15 @@
namespace QmlDesigner { namespace QmlDesigner {
MeshImageCacheCollector::MeshImageCacheCollector( MeshImageCacheCollector::MeshImageCacheCollector(ImageCacheConnectionManager &connectionManager,
ImageCacheConnectionManager &connectionManager, QSize captureImageMinimumSize,
QSize captureImageMinimumSize, QSize captureImageMaximumSize,
QSize captureImageMaximumSize, ExternalDependenciesInterface &externalDependencies,
ImageCacheCollectorNullImageHandling nullImageHandling) ImageCacheCollectorNullImageHandling nullImageHandling)
: m_imageCacheCollector(connectionManager, : m_imageCacheCollector(connectionManager,
captureImageMinimumSize, captureImageMinimumSize,
captureImageMaximumSize, captureImageMaximumSize,
externalDependencies,
nullImageHandling) nullImageHandling)
{} {}

View File

@@ -20,6 +20,7 @@ public:
MeshImageCacheCollector(ImageCacheConnectionManager &connectionManager, MeshImageCacheCollector(ImageCacheConnectionManager &connectionManager,
QSize captureImageMinimumSize, QSize captureImageMinimumSize,
QSize captureImageMaximumSize, QSize captureImageMaximumSize,
ExternalDependenciesInterface &externalDependencies,
ImageCacheCollectorNullImageHandling nullImageHandling = {}); ImageCacheCollectorNullImageHandling nullImageHandling = {});
~MeshImageCacheCollector(); ~MeshImageCacheCollector();

View File

@@ -39,6 +39,7 @@ class NodeInstanceView;
class RewriterView; class RewriterView;
class QmlModelState; class QmlModelState;
class QmlTimeline; class QmlTimeline;
class ExternalDependenciesInterface;
enum DesignerWidgetFlags { enum DesignerWidgetFlags {
DisableOnError, DisableOnError,
@@ -78,7 +79,9 @@ public:
EmptyPropertiesRemoved = 0x2 EmptyPropertiesRemoved = 0x2
}; };
Q_DECLARE_FLAGS(PropertyChangeFlags, PropertyChangeFlag) Q_DECLARE_FLAGS(PropertyChangeFlags, PropertyChangeFlag)
AbstractView() {} AbstractView(ExternalDependenciesInterface &externalDependencies)
: m_externalDependencies{externalDependencies}
{}
~AbstractView() override; ~AbstractView() override;
@@ -259,6 +262,8 @@ public:
bool isEnabled() const; bool isEnabled() const;
void setEnabled(bool b); void setEnabled(bool b);
ExternalDependenciesInterface &externalDependencies() const { return m_externalDependencies; }
bool isBlockingNotifications() const { return m_isBlockingNotifications; } bool isBlockingNotifications() const { return m_isBlockingNotifications; }
class NotificationBlocker class NotificationBlocker
@@ -290,6 +295,7 @@ private: //functions
private: private:
QPointer<Model> m_model; QPointer<Model> m_model;
ExternalDependenciesInterface &m_externalDependencies;
bool m_enabled = true; bool m_enabled = true;
bool m_isBlockingNotifications = false; bool m_isBlockingNotifications = false;
}; };

View File

@@ -0,0 +1,42 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include <instances/puppetstartdata.h>
namespace QmlDesigner {
class DesignerSettings;
class ExternalDependenciesInterface
{
// Tis class worksaround external dependencies. In the long run the caller should
// be refactored and the dependencies cleaned up. Don't use it as a shortcut to provide
// functionality!
public:
ExternalDependenciesInterface() = default;
ExternalDependenciesInterface(const ExternalDependenciesInterface &) = delete;
ExternalDependenciesInterface &operator=(const ExternalDependenciesInterface &) = delete;
virtual double formEditorDevicePixelRatio() const = 0;
virtual QString defaultPuppetFallbackDirectory() const = 0;
virtual QString qmlPuppetFallbackDirectory() const = 0;
virtual QString defaultPuppetToplevelBuildDirectory() const = 0;
virtual QUrl projectUrl() const = 0;
virtual QString currentProjectDirPath() const = 0;
virtual QList<QColor> designerSettingsEdit3DViewBackgroundColor() const = 0;
virtual QColor designerSettingsEdit3DViewGridColor() const = 0;
virtual QUrl currentResourcePath() const = 0;
virtual void parseItemLibraryDescriptions() = 0;
virtual const DesignerSettings &designerSettings() const = 0;
virtual void undoOnCurrentDesignDocument() = 0;
virtual bool viewManagerUsesRewriterView(class RewriterView *view) const = 0;
virtual void viewManagerDiableWidgets() = 0;
virtual QString itemLibraryImportUserComponentsTitle() const = 0;
virtual bool isQt6Import() const = 0;
virtual bool hasStartupTarget() const = 0;
virtual PuppetStartData puppetStartData(const class Model &model) const = 0;
};
} // namespace QmlDesigner

View File

@@ -49,6 +49,8 @@ public:
static void setPluginPaths(const QStringList &paths); static void setPluginPaths(const QStringList &paths);
static void disableParseItemLibraryDescriptionsUgly(); // ugly hack around broken tests
private: private:
bool isGlobal() const; bool isGlobal() const;

View File

@@ -74,7 +74,6 @@ public:
} }
QUrl fileUrl() const; QUrl fileUrl() const;
QUrl projectUrl() const;
void setFileUrl(const QUrl &url); void setFileUrl(const QUrl &url);
const MetaInfo metaInfo() const; const MetaInfo metaInfo() const;

Some files were not shown because too many files have changed in this diff Show More