aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-02-26 08:35:05 +0100
committerEike Ziller <eike.ziller@qt.io>2020-02-26 08:35:05 +0100
commit61dc14b67f493aaed42f9fe34ddbd655eaf96b5e (patch)
treee97d965c71fdeb224a5567eae05e82360fdcd2f0
parent23946de45755ce58d55004bf3e508a83d6299573 (diff)
parentfa59e02f89cc581f27095fb63134a6eb3c554f95 (diff)
Merge remote-tracking branch 'origin/4.12'
-rw-r--r--.github/workflows/build_cmake.yml54
-rw-r--r--cmake/CMakeLists.txt13
-rw-r--r--cmake/QtCreatorAPI.cmake20
-rw-r--r--dist/installer/mac/entitlements.plist10
-rw-r--r--doc/CMakeLists.txt71
-rw-r--r--doc/doc.pri4
-rw-r--r--doc/qtcreator/images/qtcreator-workspace-manager.pngbin0 -> 8009 bytes
-rw-r--r--doc/qtcreator/src/howto/creator-sidebars.qdoc57
-rw-r--r--doc/qtcreator/src/howto/creator-ui.qdoc12
-rw-r--r--doc/qtcreator/src/howto/creator-views.qdoc (renamed from doc/qtcreator/src/howto/creator-sidebar-views.qdoc)47
-rw-r--r--doc/qtcreator/src/howto/creator-workspaces.qdoc64
-rw-r--r--doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc4
-rw-r--r--doc/qtcreator/src/qtcreator-toc.qdoc2
-rw-r--r--doc/qtcreator/src/qtquick/creator-only/qtquick-iso-icon-browser.qdoc2
-rw-r--r--doc/qtcreator/src/qtquick/creator-only/qtquick-modules-with-plugins.qdoc2
-rw-r--r--doc/qtcreator/src/qtquick/qtquick-components.qdoc6
-rw-r--r--doc/qtcreatordev/config/qtcreator-developer.qdocconf7
-rw-r--r--doc/qtcreatordev/src/common-extension-tasks.qdoc15
-rw-r--r--doc/qtcreatordev/src/qtcreator-module.qdoc7
-rw-r--r--doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc4
-rw-r--r--qtcreator_ide_branding.pri5
-rwxr-xr-xscripts/build.py244
-rw-r--r--scripts/common.py31
-rw-r--r--share/qtcreator/debugger/boosttypes.py2
-rw-r--r--share/qtcreator/debugger/cdbbridge.py32
-rw-r--r--share/qtcreator/debugger/creatortypes.py4
-rw-r--r--share/qtcreator/debugger/dumper.py625
-rw-r--r--share/qtcreator/debugger/gdbbridge.py148
-rw-r--r--share/qtcreator/debugger/lldbbridge.py171
-rw-r--r--share/qtcreator/debugger/misctypes.py9
-rw-r--r--share/qtcreator/debugger/opencvtypes.py9
-rw-r--r--share/qtcreator/debugger/pdbbridge.py4
-rw-r--r--share/qtcreator/debugger/personaltypes.py2
-rw-r--r--share/qtcreator/debugger/qttypes.py88
-rw-r--r--share/qtcreator/debugger/stdtypes.py41
-rw-r--r--share/qtcreator/debugger/utils.py130
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/commands.pri6
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.cpp96
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.h68
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h2
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp17
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h6
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.cpp (renamed from share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp)41
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h67
-rw-r--r--share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp38
-rw-r--r--share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h6
-rw-r--r--share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp12
-rw-r--r--share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h6
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml528
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/EditWindow3D.qml50
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml20
-rw-r--r--share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml3
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp53
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h10
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp16
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h3
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp309
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h16
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp4
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp1
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp12
-rw-r--r--share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc1
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml27
-rw-r--r--share/qtcreator/templates/wizards/classes/python/file.py7
-rw-r--r--share/qtcreator/templates/wizards/classes/python/wizard.json2
-rw-r--r--share/qtcreator/templates/wizards/files/python/file.py2
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json11
-rw-r--r--src/app/main.cpp1
-rw-r--r--src/libs/CMakeLists.txt1
-rw-r--r--src/libs/advanceddockingsystem/CMakeLists.txt31
-rw-r--r--src/libs/advanceddockingsystem/LICENSE.LGPLv21514
-rw-r--r--src/libs/advanceddockingsystem/ads_globals.cpp120
-rw-r--r--src/libs/advanceddockingsystem/ads_globals.h233
-rw-r--r--src/libs/advanceddockingsystem/advanceddockingsystem-lib.pri58
-rw-r--r--src/libs/advanceddockingsystem/advanceddockingsystem.pro6
-rw-r--r--src/libs/advanceddockingsystem/advanceddockingsystem.qbs48
-rw-r--r--src/libs/advanceddockingsystem/advanceddockingsystem_dependencies.pri3
-rw-r--r--src/libs/advanceddockingsystem/dockareatabbar.cpp402
-rw-r--r--src/libs/advanceddockingsystem/dockareatabbar.h217
-rw-r--r--src/libs/advanceddockingsystem/dockareatitlebar.cpp577
-rw-r--r--src/libs/advanceddockingsystem/dockareatitlebar.h209
-rw-r--r--src/libs/advanceddockingsystem/dockareawidget.cpp686
-rw-r--r--src/libs/advanceddockingsystem/dockareawidget.h321
-rw-r--r--src/libs/advanceddockingsystem/dockcomponentsfactory.cpp80
-rw-r--r--src/libs/advanceddockingsystem/dockcomponentsfactory.h109
-rw-r--r--src/libs/advanceddockingsystem/dockcontainerwidget.cpp1459
-rw-r--r--src/libs/advanceddockingsystem/dockcontainerwidget.h292
-rw-r--r--src/libs/advanceddockingsystem/dockingstatereader.cpp50
-rw-r--r--src/libs/advanceddockingsystem/dockingstatereader.h64
-rw-r--r--src/libs/advanceddockingsystem/dockmanager.cpp820
-rw-r--r--src/libs/advanceddockingsystem/dockmanager.h480
-rw-r--r--src/libs/advanceddockingsystem/dockoverlay.cpp773
-rw-r--r--src/libs/advanceddockingsystem/dockoverlay.h265
-rw-r--r--src/libs/advanceddockingsystem/docksplitter.cpp92
-rw-r--r--src/libs/advanceddockingsystem/docksplitter.h72
-rw-r--r--src/libs/advanceddockingsystem/dockwidget.cpp625
-rw-r--r--src/libs/advanceddockingsystem/dockwidget.h493
-rw-r--r--src/libs/advanceddockingsystem/dockwidgettab.cpp525
-rw-r--r--src/libs/advanceddockingsystem/dockwidgettab.h164
-rw-r--r--src/libs/advanceddockingsystem/elidinglabel.cpp184
-rw-r--r--src/libs/advanceddockingsystem/elidinglabel.h111
-rw-r--r--src/libs/advanceddockingsystem/floatingdockcontainer.cpp563
-rw-r--r--src/libs/advanceddockingsystem/floatingdockcontainer.h249
-rw-r--r--src/libs/advanceddockingsystem/floatingdragpreview.cpp355
-rw-r--r--src/libs/advanceddockingsystem/floatingdragpreview.h134
-rw-r--r--src/libs/advanceddockingsystem/iconprovider.cpp81
-rw-r--r--src/libs/advanceddockingsystem/iconprovider.h81
-rw-r--r--src/libs/advanceddockingsystem/images/close-button-disabled.svg122
-rw-r--r--src/libs/advanceddockingsystem/images/close-button.svg119
-rw-r--r--src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.cpp168
-rw-r--r--src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.h79
-rw-r--r--src/libs/advanceddockingsystem/linux/linux.pri4
-rw-r--r--src/libs/advanceddockingsystem/resources.qrc6
-rw-r--r--src/libs/advanceddockingsystem/workspacedialog.cpp206
-rw-r--r--src/libs/advanceddockingsystem/workspacedialog.h93
-rw-r--r--src/libs/advanceddockingsystem/workspacedialog.ui172
-rw-r--r--src/libs/advanceddockingsystem/workspacemodel.cpp269
-rw-r--r--src/libs/advanceddockingsystem/workspacemodel.h89
-rw-r--r--src/libs/advanceddockingsystem/workspaceview.cpp205
-rw-r--r--src/libs/advanceddockingsystem/workspaceview.h85
-rw-r--r--src/libs/clangsupport/connectionclient.cpp9
-rw-r--r--src/libs/clangsupport/connectionserver.h9
-rw-r--r--src/libs/extensionsystem/invoker.cpp8
-rw-r--r--src/libs/extensionsystem/iplugin.cpp16
-rw-r--r--src/libs/extensionsystem/pluginerroroverview.cpp2
-rw-r--r--src/libs/extensionsystem/pluginmanager.cpp23
-rw-r--r--src/libs/extensionsystem/pluginview.cpp6
-rw-r--r--src/libs/libs.pro7
-rw-r--r--src/libs/libs.qbs1
-rw-r--r--src/libs/modelinglib/qmt/infrastructure/handle.h2
-rw-r--r--src/libs/qmldebug/qmldebugconnection.cpp10
-rw-r--r--src/libs/qmljs/qmljscheck.cpp9
-rw-r--r--src/libs/qtcreatorcdbext/CMakeLists.txt1
-rw-r--r--src/libs/utils/algorithm.h11
-rw-r--r--src/libs/utils/checkablemessagebox.cpp1
-rw-r--r--src/libs/utils/namevaluesdialog.cpp1
-rw-r--r--src/libs/utils/qtcprocess.cpp3
-rw-r--r--src/libs/utils/wizard.cpp1
-rw-r--r--src/plugins/android/androiddevicedialog.cpp2
-rw-r--r--src/plugins/android/androidmanager.cpp2
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.cpp265
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.h19
-rw-r--r--src/plugins/android/androidsdkdownloader.cpp2
-rw-r--r--src/plugins/android/androidsdkmanager.cpp14
-rw-r--r--src/plugins/android/androidsettingswidget.cpp41
-rw-r--r--src/plugins/autotest/boost/boosttestsettingspage.cpp2
-rw-r--r--src/plugins/autotest/qtest/qttestparser.cpp2
-rw-r--r--src/plugins/autotest/testrunner.cpp1
-rw-r--r--src/plugins/bazaar/bazaareditor.cpp28
-rw-r--r--src/plugins/bazaar/bazaareditor.h1
-rw-r--r--src/plugins/bineditor/bineditorplugin.cpp2
-rw-r--r--src/plugins/boot2qt/device-detection/qdbwatcher.cpp10
-rw-r--r--src/plugins/boot2qt/qdbplugin.cpp2
-rw-r--r--src/plugins/clangformat/clangformatutils.cpp8
-rw-r--r--src/plugins/clearcase/clearcaseeditor.cpp31
-rw-r--r--src/plugins/clearcase/clearcaseeditor.h5
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildstep.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp14
-rw-r--r--src/plugins/cmakeprojectmanager/cmakekitinformation.cpp1
-rw-r--r--src/plugins/cmakeprojectmanager/fileapireader.cpp13
-rw-r--r--src/plugins/cmakeprojectmanager/servermode.cpp11
-rw-r--r--src/plugins/cmakeprojectmanager/servermodereader.cpp11
-rw-r--r--src/plugins/coreplugin/actionmanager/actioncontainer.cpp40
-rw-r--r--src/plugins/coreplugin/actionmanager/actionmanager.cpp6
-rw-r--r--src/plugins/coreplugin/actionmanager/command.cpp48
-rw-r--r--src/plugins/coreplugin/basefilewizardfactory.cpp95
-rw-r--r--src/plugins/coreplugin/dialogs/ioptionspage.cpp18
-rw-r--r--src/plugins/coreplugin/dialogs/newdialog.cpp2
-rw-r--r--src/plugins/coreplugin/dialogs/openwithdialog.cpp1
-rw-r--r--src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp1
-rw-r--r--src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp1
-rw-r--r--src/plugins/coreplugin/dialogs/saveitemsdialog.cpp1
-rw-r--r--src/plugins/coreplugin/dialogs/settingsdialog.cpp1
-rw-r--r--src/plugins/coreplugin/editormanager/documentmodel.cpp12
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp318
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.h2
-rw-r--r--src/plugins/coreplugin/editormanager/ieditor.cpp94
-rw-r--r--src/plugins/coreplugin/editormanager/ieditorfactory.cpp91
-rw-r--r--src/plugins/coreplugin/editormanager/iexternaleditor.cpp33
-rw-r--r--src/plugins/coreplugin/externaltool.cpp8
-rw-r--r--src/plugins/coreplugin/find/basetextfind.cpp4
-rw-r--r--src/plugins/coreplugin/find/ifindfilter.cpp28
-rw-r--r--src/plugins/coreplugin/find/ifindsupport.cpp30
-rw-r--r--src/plugins/coreplugin/find/searchresultwindow.cpp20
-rw-r--r--src/plugins/coreplugin/iwizardfactory.cpp74
-rw-r--r--src/plugins/coreplugin/locator/executefilter.cpp8
-rw-r--r--src/plugins/coreplugin/locator/ilocatorfilter.cpp10
-rw-r--r--src/plugins/coreplugin/messagemanager.cpp7
-rw-r--r--src/plugins/coreplugin/messagemanager.h1
-rw-r--r--src/plugins/coreplugin/plugindialog.cpp2
-rw-r--r--src/plugins/coreplugin/progressmanager/futureprogress.cpp12
-rw-r--r--src/plugins/coreplugin/progressmanager/progressmanager.cpp102
-rw-r--r--src/plugins/coreplugin/systemsettings.cpp2
-rw-r--r--src/plugins/coreplugin/versiondialog.cpp1
-rw-r--r--src/plugins/cppeditor/cpppreprocessordialog.cpp2
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp8
-rw-r--r--src/plugins/cpptools/symbolsearcher_test.cpp6
-rw-r--r--src/plugins/cvs/cvseditor.cpp43
-rw-r--r--src/plugins/cvs/cvseditor.h7
-rw-r--r--src/plugins/debugger/analyzer/startremotedialog.cpp1
-rw-r--r--src/plugins/debugger/breakhandler.cpp1
-rw-r--r--src/plugins/debugger/debuggeractions.cpp6
-rw-r--r--src/plugins/debugger/debuggeractions.h1
-rw-r--r--src/plugins/debugger/debuggercore.h1
-rw-r--r--src/plugins/debugger/debuggerdialogs.cpp47
-rw-r--r--src/plugins/debugger/debuggerengine.cpp4
-rw-r--r--src/plugins/debugger/debuggerengine.h5
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp45
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp22
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h1
-rw-r--r--src/plugins/debugger/gdb/gdboptionspage.cpp10
-rw-r--r--src/plugins/debugger/loadcoredialog.cpp1
-rw-r--r--src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp1
-rw-r--r--src/plugins/debugger/stackhandler.cpp1
-rw-r--r--src/plugins/debugger/unstartedappwatcherdialog.cpp1
-rw-r--r--src/plugins/debugger/uvsc/uvscclient.cpp14
-rw-r--r--src/plugins/git/branchview.cpp13
-rw-r--r--src/plugins/git/branchview.h1
-rw-r--r--src/plugins/git/changeselectiondialog.cpp1
-rw-r--r--src/plugins/git/gerrit/gerritdialog.cpp2
-rw-r--r--src/plugins/git/gerrit/gerritpushdialog.cpp1
-rw-r--r--src/plugins/git/gitclient.cpp73
-rw-r--r--src/plugins/git/gitclient.h2
-rw-r--r--src/plugins/git/gitconstants.h10
-rw-r--r--src/plugins/git/giteditor.cpp121
-rw-r--r--src/plugins/git/giteditor.h15
-rw-r--r--src/plugins/git/gitplugin.cpp94
-rw-r--r--src/plugins/git/gitsettings.cpp2
-rw-r--r--src/plugins/git/gitsettings.h1
-rw-r--r--src/plugins/git/gitutils.cpp1
-rw-r--r--src/plugins/git/logchangedialog.cpp1
-rw-r--r--src/plugins/git/remotedialog.cpp2
-rw-r--r--src/plugins/git/stashdialog.cpp1
-rw-r--r--src/plugins/help/openpageswidget.cpp2
-rw-r--r--src/plugins/imageviewer/exportdialog.cpp2
-rw-r--r--src/plugins/imageviewer/multiexportdialog.cpp2
-rw-r--r--src/plugins/languageclient/client.cpp19
-rw-r--r--src/plugins/languageclient/languageclientcompletionassist.cpp17
-rw-r--r--src/plugins/languageclient/languageclientfunctionhint.cpp17
-rw-r--r--src/plugins/languageclient/languageclientmanager.cpp5
-rw-r--r--src/plugins/languageclient/languageclientquickfix.cpp17
-rw-r--r--src/plugins/languageclient/languageclientsettings.cpp1
-rw-r--r--src/plugins/mcusupport/mcusupportrunconfiguration.cpp5
-rw-r--r--src/plugins/mercurial/constants.h8
-rw-r--r--src/plugins/mercurial/mercurialeditor.cpp33
-rw-r--r--src/plugins/mercurial/mercurialeditor.h10
-rw-r--r--src/plugins/perforce/perforceeditor.cpp32
-rw-r--r--src/plugins/perforce/perforceeditor.h5
-rw-r--r--src/plugins/perfprofiler/perfprofilerflamegraphmodel.cpp4
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.h2
-rw-r--r--src/plugins/projectexplorer/buildmanager.cpp1
-rw-r--r--src/plugins/projectexplorer/buildstep.cpp5
-rw-r--r--src/plugins/projectexplorer/buildstep.h2
-rw-r--r--src/plugins/projectexplorer/deployconfiguration.h2
-rw-r--r--src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp1
-rw-r--r--src/plugins/projectexplorer/projectconfiguration.h2
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp3
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h2
-rw-r--r--src/plugins/projectexplorer/sessionmodel.cpp6
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.h4
-rw-r--r--src/plugins/projectexplorer/waitforstopdialog.cpp1
-rw-r--r--src/plugins/python/pythonutils.cpp66
-rw-r--r--src/plugins/python/pythonutils.h5
-rw-r--r--src/plugins/qbsprojectmanager/qbsbuildstep.cpp3
-rw-r--r--src/plugins/qbsprojectmanager/qbscleanstep.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsinstallstep.cpp3
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp5
-rw-r--r--src/plugins/qbsprojectmanager/qbssettings.cpp9
-rw-r--r--src/plugins/qbsprojectmanager/qbssettings.h1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp12
-rw-r--r--src/plugins/qmakeprojectmanager/qmakestep.cpp9
-rw-r--r--src/plugins/qmldesigner/CMakeLists.txt15
-rw-r--r--src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp3
-rw-r--r--src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp37
-rw-r--r--src/plugins/qmldesigner/components/annotationeditor/annotationtool.cpp11
-rw-r--r--src/plugins/qmldesigner/components/bindingeditor/bindingeditordialog.cpp1
-rw-r--r--src/plugins/qmldesigner/components/componentcore/actioninterface.h3
-rw-r--r--src/plugins/qmldesigner/components/componentcore/addimagesdialog.cpp1
-rw-r--r--src/plugins/qmldesigner/components/componentcore/zoomaction.cpp9
-rw-r--r--src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.cpp1
-rw-r--r--src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp12
-rw-r--r--src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp2
-rw-r--r--src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h2
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3d.pri12
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3d.qrc34
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dactions.cpp97
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dactions.h84
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp125
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dcanvas.h66
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dview.cpp247
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dview.h87
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp106
-rw-r--r--src/plugins/qmldesigner/components/edit3d/edit3dwidget.h (renamed from share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h)33
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/edit_light_off.pngbin0 -> 1189 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/edit_light_off@2x.pngbin0 -> 1430 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/edit_light_on.pngbin0 -> 1355 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/edit_light_on@2x.pngbin0 -> 1766 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/fit_active.pngbin0 -> 266 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/fit_active@2x.pngbin0 -> 386 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/global.pngbin0 -> 433 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/global@2x.pngbin0 -> 561 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/group_selection_selected.pngbin0 -> 438 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/group_selection_selected@2x.pngbin0 -> 904 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/item_selection_selected.pngbin0 -> 355 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/item_selection_selected@2x.pngbin0 -> 661 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/local.pngbin0 -> 1309 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/local@2x.pngbin0 -> 1960 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/move_active.pngbin0 -> 294 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/move_active@2x.pngbin0 -> 303 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/move_selected.pngbin0 -> 191 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/move_selected@2x.pngbin0 -> 272 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/ortho.pngbin0 -> 1310 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/ortho@2x.pngbin0 -> 1727 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/persp.pngbin0 -> 1391 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/persp@2x.pngbin0 -> 1971 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/rotate_active.pngbin0 -> 451 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/rotate_active@2x.pngbin0 -> 869 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/rotate_selected.pngbin0 -> 478 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/rotate_selected@2x.pngbin0 -> 906 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/scale_active.pngbin0 -> 242 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/scale_active@2x.pngbin0 -> 338 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/scale_selected.pngbin0 -> 277 bytes
-rw-r--r--src/plugins/qmldesigner/components/edit3d/images/scale_selected@2x.pngbin0 -> 364 bytes
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp13
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp7
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorview.cpp4
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp18
-rw-r--r--src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp11
-rw-r--r--src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp2
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp3
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp6
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp4
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatorview.cpp3
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp32
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/gradientpresetdefaultlistmodel.cpp4
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/gradientpresetitem.h2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp2
-rw-r--r--src/plugins/qmldesigner/components/resources/centerwidget.css4
-rw-r--r--src/plugins/qmldesigner/components/resources/dockwidgets.css128
-rw-r--r--src/plugins/qmldesigner/components/resources/resources.qrc1
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp6
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h3
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/animationcurvedialog.cpp2
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp1
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.cpp1
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp2
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.cpp1
-rw-r--r--src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs1
-rw-r--r--src/plugins/qmldesigner/designercore/include/abstractview.h6
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodehints.h1
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodeinstanceview.h6
-rw-r--r--src/plugins/qmldesigner/designercore/include/viewmanager.h1
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp20
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h3
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp25
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp3
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp5
-rw-r--r--src/plugins/qmldesigner/designercore/model/abstractview.cpp20
-rw-r--r--src/plugins/qmldesigner/designercore/model/model.cpp16
-rw-r--r--src/plugins/qmldesigner/designercore/model/model_p.h3
-rw-r--r--src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/viewmanager.cpp14
-rw-r--r--src/plugins/qmldesigner/designmodewidget.cpp479
-rw-r--r--src/plugins/qmldesigner/designmodewidget.h23
-rw-r--r--src/plugins/qmldesigner/openuiqmlfiledialog.cpp1
-rw-r--r--src/plugins/qmldesigner/qmldesigner_dependencies.pri4
-rw-r--r--src/plugins/qmldesigner/qmldesignerconstants.h3
-rw-r--r--src/plugins/qmldesigner/qmldesignericons.h31
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.pro1
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.qbs18
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/quick.metainfo6
-rw-r--r--src/plugins/qmldesigner/shortcutmanager.cpp45
-rw-r--r--src/plugins/qmldesigner/shortcutmanager.h6
-rw-r--r--src/plugins/qmldesigner/switchsplittabwidget.cpp50
-rw-r--r--src/plugins/qmldesigner/switchsplittabwidget.h13
-rw-r--r--src/plugins/qmljseditor/qmljssemantichighlighter.cpp2
-rw-r--r--src/plugins/qmlprofiler/flamegraphmodel.cpp6
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp1
-rw-r--r--src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp4
-rw-r--r--src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp5
-rw-r--r--src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h4
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.cpp9
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.h1
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectconstants.h1
-rw-r--r--src/plugins/qtsupport/baseqtversion.cpp6
-rw-r--r--src/plugins/studiowelcome/CMakeLists.txt11
-rw-r--r--src/plugins/subversion/subversioneditor.cpp34
-rw-r--r--src/plugins/subversion/subversioneditor.h1
-rw-r--r--src/plugins/subversion/subversionplugin.cpp1
-rw-r--r--src/plugins/texteditor/codeassist/codeassistant.cpp2
-rw-r--r--src/plugins/texteditor/codeassist/documentcontentcompletion.cpp14
-rw-r--r--src/plugins/texteditor/codeassist/iassistprocessor.h1
-rw-r--r--src/plugins/texteditor/texteditor.cpp14
-rw-r--r--src/plugins/valgrind/memchecktool.cpp3
-rw-r--r--src/plugins/vcsbase/cleandialog.cpp1
-rw-r--r--src/plugins/vcsbase/diffandloghighlighter.cpp18
-rw-r--r--src/plugins/vcsbase/diffandloghighlighter.h5
-rw-r--r--src/plugins/vcsbase/nicknamedialog.cpp1
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp96
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.h11
-rw-r--r--src/plugins/vcsbase/vcsbasesubmiteditor.cpp1
-rw-r--r--src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h17
-rw-r--r--src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h12
-rw-r--r--src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h7
-rw-r--r--src/tools/clangrefactoringbackend/source/clangquery.cpp3
-rw-r--r--src/tools/clangrefactoringbackend/source/collectsymbolsaction.h6
-rw-r--r--src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp28
-rw-r--r--src/tools/clangrefactoringbackend/source/indexdataconsumer.h28
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolscollector.cpp4
-rw-r--r--src/tools/qml2puppet/CMakeLists.txt3
-rw-r--r--src/tools/qml2puppet/qml2puppet.qbs6
-rw-r--r--tests/auto/qml/qmldesigner/coretests/coretests.pro1
-rw-r--r--tests/system/shared/classes.py21
-rw-r--r--tests/system/shared/project_explorer.py20
419 files changed, 18923 insertions, 2713 deletions
diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml
index a8ff73315c7..5722143c046 100644
--- a/.github/workflows/build_cmake.yml
+++ b/.github/workflows/build_cmake.yml
@@ -168,6 +168,47 @@ jobs:
string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}")
+ - name: Download OpenSSL
+ shell: cmake -P {0}
+ run: |
+ if ("${{ runner.os }}" STREQUAL "Windows")
+ set(url_os "windows_x86")
+ set(openssl_localdir "Tools/OpenSSL/Win_x64/bin")
+ set(openssl_dest_dir "instdir/bin")
+ set(shared_suffix ".dll")
+ elseif ("${{ runner.os }}" STREQUAL "Linux")
+ set(url_os "linux_x64")
+ set(openssl_localdir "Tools/OpenSSL/binary/lib")
+ set(openssl_dest_dir "instdir/lib/Qt/lib")
+ set(shared_suffix ".so*")
+ elseif ("${{ runner.os }}" STREQUAL "macOS")
+ # Not needed on macOS
+ return()
+ endif()
+
+ set(openssl_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/tools_openssl_x64")
+ file(DOWNLOAD "${openssl_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
+
+ file(READ ./Updates.xml updates_xml)
+ string(REGEX MATCH
+ "<Name>(qt.tools.openssl.*)</Name>.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>(.*)</DownloadableArchives>" updates_xml_output "${updates_xml}")
+
+ set(openssl_directory ${CMAKE_MATCH_1})
+ set(openssl_version ${CMAKE_MATCH_2})
+ set(openssl_archive ${CMAKE_MATCH_3})
+
+ set(url "${openssl_base_url}/${openssl_directory}/${openssl_version}${openssl_archive}")
+
+ file(MAKE_DIRECTORY openssl)
+ file(MAKE_DIRECTORY ${openssl_dest_dir})
+
+ message("Downloading ${url}")
+ file(DOWNLOAD "${url}" ./openssl.7z SHOW_PROGRESS)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../openssl.7z WORKING_DIRECTORY openssl)
+
+ file(GLOB openssl_shared_objects "openssl/${openssl_localdir}/*${shared_suffix}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy ${openssl_shared_objects} ${openssl_dest_dir})
- name: Download libclang
id: libclang
@@ -358,13 +399,18 @@ jobs:
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/ctest -j ${N}
WORKING_DIRECTORY build
RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stdout
)
- # Do not fail on ctest failure
- #if (NOT result EQUAL 0)
- # message(FATAL_ERROR "Running tests failed!")
- #endif()
+ message("${stdout}")
+ if (NOT result EQUAL 0)
+ string(REGEX MATCH "[0-9]+% tests.*[0-9.]+ sec" pass_rate "${stdout}")
+
+ # Do not fail on ctest failure
+ message("::warning::${pass_rate}")
+ endif()
- name: Install Strip
run: |
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 5904b8bd307..47c8c696f0d 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -54,10 +54,23 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON)
include(InstallRequiredsystemLibraries)
+ # For Qt Creator
install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION ${IDE_APP_PATH}
COMPONENT Dependencies
EXCLUDE_FROM_ALL
)
+
+ # For qtcreatorcdbext
+ set(ArchSuffix 32)
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(ArchSuffix 64)
+ endif()
+
+ install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
+ DESTINATION lib/qtcreatorcdbext${ArchSuffix}
+ COMPONENT Dependencies
+ EXCLUDE_FROM_ALL
+ )
endif()
endif()
diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake
index 1e0829dd675..bbfb0a214be 100644
--- a/cmake/QtCreatorAPI.cmake
+++ b/cmake/QtCreatorAPI.cmake
@@ -433,7 +433,7 @@ endfunction()
#
function(add_qtc_library name)
- cmake_parse_arguments(_arg "STATIC;OBJECT;SKIP_TRANSLATION;BUILD_BY_DEFAULT;ALLOW_ASCII_CASTS"
+ cmake_parse_arguments(_arg "STATIC;OBJECT;SKIP_TRANSLATION;BUILD_BY_DEFAULT;ALLOW_ASCII_CASTS;UNVERSIONED"
"DESTINATION;COMPONENT"
"DEFINES;DEPENDS;EXTRA_TRANSLATIONS;INCLUDES;PUBLIC_DEFINES;PUBLIC_DEPENDS;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;PROPERTIES" ${ARGN}
)
@@ -536,6 +536,7 @@ function(add_qtc_library name)
SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
VERSION "${IDE_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}"
+ CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
BUILD_RPATH "${_LIB_RPATH}"
@@ -547,7 +548,7 @@ function(add_qtc_library name)
)
enable_pch(${name})
- if (WIN32 AND library_type STREQUAL "SHARED")
+ if (WIN32 AND library_type STREQUAL "SHARED" AND NOT _arg_UNVERSIONED)
# Match qmake naming scheme e.g. Library4.dll
set_target_properties(${name} PROPERTIES
SUFFIX "${PROJECT_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}"
@@ -781,6 +782,7 @@ function(add_qtc_plugin target_name)
qtc_output_binary_dir(_output_binary_dir)
set_target_properties(${target_name} PROPERTIES
SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
+ CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
_arg_DEPENDS "${_arg_PLUGIN_DEPENDS}"
@@ -991,6 +993,7 @@ function(add_qtc_executable name)
INSTALL_RPATH "${install_rpath}"
RUNTIME_OUTPUT_DIRECTORY "${_output_binary_dir}/${_DESTINATION}"
QT_SKIP_TRANSLATION "${skip_translation}"
+ CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
${_arg_PROPERTIES}
@@ -1121,3 +1124,16 @@ function(finalize_qtc_gtest test_name)
finalize_test_setup(${test})
endforeach()
endfunction()
+
+# This is the CMake equivalent of "RESOURCES = $$files()" from qmake
+function(qtc_glob_resources)
+ cmake_parse_arguments(_arg "" "QRC_FILE;ROOT;GLOB" "" ${ARGN})
+
+ file(GLOB_RECURSE fileList RELATIVE "${_arg_ROOT}" "${_arg_ROOT}/${_arg_GLOB}")
+ set(qrcData "<RCC><qresource>\n")
+ foreach(file IN LISTS fileList)
+ string(APPEND qrcData " <file alias=\"${file}\">${_arg_ROOT}/${file}</file>\n")
+ endforeach()
+ string(APPEND qrcData "</qresource></RCC>")
+ file(WRITE "${_arg_QRC_FILE}" "${qrcData}")
+endfunction()
diff --git a/dist/installer/mac/entitlements.plist b/dist/installer/mac/entitlements.plist
new file mode 100644
index 00000000000..0aae7ab39d9
--- /dev/null
+++ b/dist/installer/mac/entitlements.plist
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>com.apple.security.cs.debugger</key>
+ <true/>
+ <key>com.apple.security.cs.disable-library-validation</key>
+ <true/>
+</dict>
+</plist>
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index c8876613bc0..80f2b4cf66c 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -10,6 +10,33 @@ add_feature_info("Build online documentation" WITH_ONLINE_DOCS "")
option(BUILD_DEVELOPER_DOCS "Include developer documentation" OFF)
add_feature_info("Include developer documentation" BUILD_DEVELOPER_DOCS "")
+function(_find_all_includes _ret_includes _ret_framework_paths)
+ set(_all_includes "${PROJECT_SOURCE_DIR}/src/plugins;${PROJECT_SOURCE_DIR}/src/libs")
+ foreach(_target ${__QTC_PLUGINS} ${__QTC_LIBRARIES})
+ if (NOT TARGET ${_target})
+ continue()
+ endif()
+ get_target_property(_includes ${_target} INCLUDE_DIRECTORIES)
+ foreach(_include ${_includes})
+ string(FIND "${_include}" "/src/plugins/" _in_plugins)
+ string(FIND "${_include}" "/src/libs/" _in_libs)
+ string(FIND "${_include}" "${CMAKE_BINARY_DIR}" _in_build)
+ if(_in_plugins LESS 0 AND _in_libs LESS 0 AND _in_build LESS 0)
+ list(APPEND _all_includes ${_include})
+ endif()
+ endforeach()
+ endforeach()
+ list(APPEND _all_includes ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
+ list(REMOVE_DUPLICATES _all_includes)
+ set("${_ret_includes}" "${_all_includes}" PARENT_SCOPE)
+
+ # framework path
+ if (APPLE)
+ get_target_property(_qt_target Qt5::Core LOCATION) # <fw_path>/QtCore.framework/QtCore
+ get_filename_component(_qt_loc "${_qt_target}" DIRECTORY)
+ set("${_ret_framework_paths}" "${_qt_loc}/.." PARENT_SCOPE)
+ endif()
+endfunction()
# Find programs:
function(_doc_find_program result_var)
@@ -51,7 +78,7 @@ endfunction()
function(_setup_qdoc_targets _qdocconf_file _retval)
cmake_parse_arguments(_arg "" "HTML_DIR;INSTALL_DIR;POSTFIX"
- "INDEXES;ENVIRONMENT_EXPORTS" ${ARGN})
+ "INDEXES;INCLUDE_DIRECTORIES;FRAMEWORK_PATHS;ENVIRONMENT_EXPORTS" ${ARGN})
foreach(_index ${_arg_INDEXES})
list(APPEND _qdoc_index_args "-indexdir;${_index}")
@@ -79,9 +106,30 @@ function(_setup_qdoc_targets _qdocconf_file _retval)
set(_html_outputdir "${_arg_HTML_DIR}/${_target}${_arg_POSTFIX}")
file(MAKE_DIRECTORY "${_html_outputdir}")
+ set(_qdoc_include_args "")
+ if (_arg_INCLUDE_DIRECTORIES OR _arg_FRAMEWORK_PATHS)
+ # pass include directories to qdoc via hidden @ option, since we need to generate a file
+ # to be able to resolve the generators inside the include paths
+ set(_qdoc_includes "${CMAKE_CURRENT_BINARY_DIR}/cmake/qdoc_${_target}.inc")
+ set(_qdoc_include_args "@${_qdoc_includes}")
+ set(_includes "")
+ if (_arg_INCLUDE_DIRECTORIES)
+ set(_includes "-I$<JOIN:${_arg_INCLUDE_DIRECTORIES},\n-I>\n")
+ endif()
+ set(_frameworks "")
+ if (_arg_FRAMEWORK_PATHS)
+ set(_frameworks "-F$<JOIN:${_arg_FRAMEWORK_PATHS},\n-F>\n")
+ endif()
+ file(GENERATE
+ OUTPUT "${_qdoc_includes}"
+ CONTENT "${_includes}${_frameworks}"
+ )
+ endif()
+
set(_html_target "html_docs_${_target}")
add_custom_target("${_html_target}"
- ${_full_qdoc_command} "-outputdir" "${_html_outputdir}" "${_qdocconf_file}" ${_qdoc_index_args}
+ ${_full_qdoc_command} -outputdir "${_html_outputdir}" "${_qdocconf_file}"
+ ${_qdoc_index_args} ${_qdoc_include_args}
COMMENT "Build HTML documentation from ${_qdocconf_file}"
DEPENDS "${_qdocconf_file}"
SOURCES "${_qdocconf_file}"
@@ -176,7 +224,7 @@ function(qdoc_build_qdocconf_file _qdocconf_file)
endif()
cmake_parse_arguments(_arg "QCH" "HTML_DIR;QCH_DIR;INSTALL_DIR;POSTFIX"
- "INDEXES;ENVIRONMENT_EXPORTS" ${ARGN})
+ "INDEXES;INCLUDE_DIRECTORIES;FRAMEWORK_PATHS;ENVIRONMENT_EXPORTS" ${ARGN})
if (_arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "qdoc_build_qdocconf_file has unknown arguments: ${_arg_UNPARSED_ARGUMENTS}.")
endif()
@@ -188,7 +236,10 @@ function(qdoc_build_qdocconf_file _qdocconf_file)
_setup_qdoc_targets("${_qdocconf_file}" _html_outputdir
HTML_DIR "${_arg_HTML_DIR}" INSTALL_DIR "${_arg_INSTALL_DIR}"
INDEXES ${_arg_INDEXES} ENVIRONMENT_EXPORTS ${_arg_ENVIRONMENT_EXPORTS}
- POSTFIX "${_arg_POSTFIX}")
+ POSTFIX "${_arg_POSTFIX}"
+ INCLUDE_DIRECTORIES ${_arg_INCLUDE_DIRECTORIES}
+ FRAMEWORK_PATHS ${_arg_FRAMEWORK_PATHS}
+ )
if (_arg_QCH)
_setup_qhelpgenerator_targets("${_qdocconf_file}" "${_html_outputdir}"
@@ -231,13 +282,21 @@ if (WITH_ONLINE_DOCS OR WITH_DOCS)
if (WITH_DOCS)
qdoc_build_qdocconf_file("qtcreator/qtcreator.qdocconf" ${_qch_params} ${_qdoc_params})
if (BUILD_DEVELOPER_DOCS)
- qdoc_build_qdocconf_file("qtcreatordev/qtcreator-dev.qdocconf" ${_qch_params} ${_qdoc_params})
+ _find_all_includes(_all_includes _framework_paths)
+ qdoc_build_qdocconf_file("qtcreatordev/qtcreator-dev.qdocconf" ${_qch_params} ${_qdoc_params}
+ INCLUDE_DIRECTORIES ${_all_includes}
+ FRAMEWORK_PATHS ${_framework_paths}
+ )
endif()
endif()
if(WITH_ONLINE_DOCS)
qdoc_build_qdocconf_file("qtcreator/qtcreator-online.qdocconf" ${_qdoc_params})
if (BUILD_DEVELOPER_DOCS)
- qdoc_build_qdocconf_file("qtcreatordev/qtcreator-dev-online.qdocconf" ${_qdoc_params})
+ _find_all_includes(_all_includes _framework_paths)
+ qdoc_build_qdocconf_file("qtcreatordev/qtcreator-dev-online.qdocconf" ${_qdoc_params}
+ INCLUDE_DIRECTORIES ${_all_includes}
+ FRAMEWORK_PATHS ${_framework_paths}
+ )
endif()
endif()
endif()
diff --git a/doc/doc.pri b/doc/doc.pri
index 28c6be8520b..4f4c315c3cb 100644
--- a/doc/doc.pri
+++ b/doc/doc.pri
@@ -1,7 +1,7 @@
build_online_docs: \
- DOC_FILES += $$PWD/qtcreator/qtcreator-online.qdocconf $$PWD/qtcreatordev/qtcreator-dev-online.qdocconf
+ DOC_FILES += $$IDE_DOC_FILES_ONLINE
else: \
- DOC_FILES += $$PWD/qtcreator/qtcreator.qdocconf $$PWD/qtcreatordev/qtcreator-dev.qdocconf
+ DOC_FILES += $$IDE_DOC_FILES
include(../docs.pri)
diff --git a/doc/qtcreator/images/qtcreator-workspace-manager.png b/doc/qtcreator/images/qtcreator-workspace-manager.png
new file mode 100644
index 00000000000..3a42f3e536f
--- /dev/null
+++ b/doc/qtcreator/images/qtcreator-workspace-manager.png
Binary files differ
diff --git a/doc/qtcreator/src/howto/creator-sidebars.qdoc b/doc/qtcreator/src/howto/creator-sidebars.qdoc
new file mode 100644
index 00000000000..6cc9feebc4f
--- /dev/null
+++ b/doc/qtcreator/src/howto/creator-sidebars.qdoc
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Creator documentation.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+**
+****************************************************************************/
+
+/*!
+ \contentspage index.html
+ \page creator-sidebars.html
+ \previouspage creator-views.html
+ \nextpage creator-project-managing-workspaces.html
+
+ \title Working with Sidebars
+
+ In the \uicontrol Edit mode, you can use a left and right sidebar to
+ organize different views into project contents. Only views that are
+ relevant to the \l{Selecting Modes}{mode} you are working in are
+ available in it.
+
+ You can select views in the sidebar menu (1):
+
+ \image qtcreator-sidebar.png
+
+ You can change the view of the sidebars in the following ways:
+
+ \list
+ \li To toggle the left sidebar, click \inlineimage leftsidebaricon.png
+ (\uicontrol {Hide Left Sidebar/Show Left Sidebar}) or press
+ \key Alt+0 (\key Cmd+0 on \macos). To toggle the right
+ sidebar, click \inlineimage rightsidebaricon.png
+ (\uicontrol {Hide Right Sidebar/Show Right Sidebar}) or press
+ \key Alt+Shift+0 (\key Cmd+Shift+0 on \macos).
+ \li To split a sidebar, click \inlineimage splitbutton_horizontal.png
+ (\uicontrol {Split}). Select new content to view in the split view.
+ \li To close a sidebar view, click \inlineimage splitbutton_closetop.png
+ (\uicontrol {Close}).
+ \endlist
+*/
diff --git a/doc/qtcreator/src/howto/creator-ui.qdoc b/doc/qtcreator/src/howto/creator-ui.qdoc
index 8e6a23b317f..787633e5ecf 100644
--- a/doc/qtcreator/src/howto/creator-ui.qdoc
+++ b/doc/qtcreator/src/howto/creator-ui.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
@@ -87,11 +87,13 @@
\endif
- The following sections describe some of these controls in more detail:
+ The following sections describe some \QC controls in more detail:
\list
\li \l{Selecting Modes}{Mode selector}
- \li \l{Browsing Project Contents}{Sidebars}
+ \li \l{Browsing Project Contents}{Views}
+ \li \l{Working with Sidebars}{Sidebars}
+ \li \l{Managing Workspaces}{Workspaces}
\li \l{Viewing Output}{Output panes}
\endlist
@@ -253,7 +255,7 @@
\contentspage index.html
\page creator-modes.html
\previouspage creator-quick-tour.html
- \nextpage creator-sidebar-views.html
+ \nextpage creator-views.html
\title Selecting Modes
@@ -327,7 +329,7 @@
/*!
\contentspage index.html
\page creator-output-panes.html
- \previouspage creator-sidebar-views.html
+ \previouspage creator-project-managing-workspaces.html
\if defined(qtdesignstudio)
\nextpage creator-using-qt-quick-designer.html
\else
diff --git a/doc/qtcreator/src/howto/creator-sidebar-views.qdoc b/doc/qtcreator/src/howto/creator-views.qdoc
index 19662247758..1ae508d3401 100644
--- a/doc/qtcreator/src/howto/creator-sidebar-views.qdoc
+++ b/doc/qtcreator/src/howto/creator-views.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
@@ -25,22 +25,18 @@
/*!
\contentspage index.html
- \page creator-sidebar-views.html
+ \page creator-views.html
\previouspage creator-modes.html
- \nextpage creator-output-panes.html
+ \nextpage creator-sidebars.html
\title Browsing Project Contents
- A left and right sidebar are available in most \QC \l{Selecting Modes}
- {modes}. The availability of the sidebars and their contents depend on
- the mode.
+ You can organize \QC views in \l {Working with Sidebars}{sidebars} or as
+ \l {Managing Workspaces}{workspaces}, depending on the \l{Selecting Modes}
+ {mode} you are working in. Only views that are relevant to a mode are
+ available in it.
- In the \uicontrol Edit and \uicontrol Design mode, you can use the sidebars
- to browse the project contents.
-
- \image qtcreator-sidebar.png
-
- You can select the contents of the sidebars in the sidebar menu (1):
+ The following views are related to managing projects and files:
\list
\li \uicontrol Projects shows a list of projects open in the current
@@ -72,28 +68,8 @@
\endlist
\endif
- For more information about the sidebar views that are only
- available when editing QML files in the Design mode, see
- \l{Editing QML Files in Design Mode}.
-
- You can change the view of the sidebars in the following ways:
-
- \list
-
- \li To toggle the left sidebar, click \inlineimage leftsidebaricon.png
- (\uicontrol {Hide Left Sidebar/Show Left Sidebar}) or press
- \key Alt+0 (\key Cmd+0 on \macos). To toggle the right
- sidebar, click \inlineimage rightsidebaricon.png
- (\uicontrol {Hide Right Sidebar/Show Right Sidebar}) or press
- \key Alt+Shift+0 (\key Cmd+Shift+0 on \macos).
-
- \li To split a sidebar, click \inlineimage splitbutton_horizontal.png
- (\uicontrol {Split}). Select new content to view in the split view.
-
- \li To close a sidebar view, click \inlineimage splitbutton_closetop.png
- (\uicontrol {Close}).
-
- \endlist
+ For more information about views that are only available when editing QML
+ files in the Design mode, see \l{Editing QML Files in Design Mode}.
The additional options in each view are described in the following
sections.
@@ -103,7 +79,8 @@
\section1 Viewing Project Files
- The sidebar displays projects in a project tree. The project tree contains
+ The \uicontrol Projects view displays projects in a project tree. The
+ project tree contains
a list of all projects open in the current session. For each project, the
tree visualizes the build system structure of the project and lists all
files that are part of the project.
diff --git a/doc/qtcreator/src/howto/creator-workspaces.qdoc b/doc/qtcreator/src/howto/creator-workspaces.qdoc
new file mode 100644
index 00000000000..c297c4dc929
--- /dev/null
+++ b/doc/qtcreator/src/howto/creator-workspaces.qdoc
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Creator documentation.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+**
+****************************************************************************/
+
+/*!
+ \contentspage index.html
+ \previouspage creator-sidebars.html
+ \page creator-project-managing-workspaces.html
+ \nextpage creator-output-panes.html
+
+ \title Managing Workspaces
+
+ In the Design and Debug modes, you can arrange a set of \QC
+ views as a \e workspace on the screen. For a list of views,
+ select \uicontrol Window > \uicontrol Views.
+
+ In \QMLD, you can select the \uicontrol {Restore last workspace on startup}
+ check box to save the current workspace as a \e default workspace when you
+ exit \QC and to restore it the next time you start \QC.
+
+ To manage workspaces, select \uicontrol Window > \uicontrol Workspaces >
+ \uicontrol Manage.
+
+ \image qtcreator-workspace-manager.png "Workspace Manager"
+
+ To save a workspace under a new name, select \uicontrol Clone.
+
+ To delete the selected workspace, select \uicontrol Delete.
+
+ To switch between workspaces, select \uicontrol {Switch To}.
+
+ To create a new workspace:
+
+ \list 1
+ \li Select \uicontrol New.
+ \li In the \uicontrol {Enter the name of the workspace} field,
+ enter a name for the workspace.
+ \li Select \uicontrol Create to create a new empty workspace or
+ \uicontrol {Create and Open} to create a workspace and to
+ switch to it.
+ \endlist
+
+*/
diff --git a/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc b/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc
index d6a91039ed9..51b50d93ef2 100644
--- a/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc
+++ b/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
@@ -31,7 +31,7 @@
/*!
\contentspage index.html
- \previouspage creator-quick-tour.html
+ \previouspage creator-output-panes.html
\page creator-configuring.html
\nextpage creator-build-example-application.html
diff --git a/doc/qtcreator/src/qtcreator-toc.qdoc b/doc/qtcreator/src/qtcreator-toc.qdoc
index a01ad1cd34f..8a8cae0ddb5 100644
--- a/doc/qtcreator/src/qtcreator-toc.qdoc
+++ b/doc/qtcreator/src/qtcreator-toc.qdoc
@@ -38,6 +38,8 @@
\list
\li \l{Selecting Modes}
\li \l{Browsing Project Contents}
+ \li \l{Working with Sidebars}
+ \li \l{Managing Workspaces}
\li \l{Viewing Output}
\endlist
\li \l{Configuring Qt Creator}
diff --git a/doc/qtcreator/src/qtquick/creator-only/qtquick-iso-icon-browser.qdoc b/doc/qtcreator/src/qtquick/creator-only/qtquick-iso-icon-browser.qdoc
index c84529b2982..0dbfc06b9fb 100644
--- a/doc/qtcreator/src/qtquick/creator-only/qtquick-iso-icon-browser.qdoc
+++ b/doc/qtcreator/src/qtquick/creator-only/qtquick-iso-icon-browser.qdoc
@@ -48,7 +48,7 @@
\li Open the Qt Quick UI form in the \uicontrol Design mode.
- \li In the \uicontrol Library, select \uicontrol Imports >
+ \li In the \uicontrol Library, select \uicontrol {QML Imports} >
\uicontrol {Add Import} > \uicontrol {QtQuick.Extras} to import the
\l {Qt Quick Extras} module.
diff --git a/doc/qtcreator/src/qtquick/creator-only/qtquick-modules-with-plugins.qdoc b/doc/qtcreator/src/qtquick/creator-only/qtquick-modules-with-plugins.qdoc
index 0354299713a..709cadb3a81 100644
--- a/doc/qtcreator/src/qtquick/creator-only/qtquick-modules-with-plugins.qdoc
+++ b/doc/qtcreator/src/qtquick/creator-only/qtquick-modules-with-plugins.qdoc
@@ -76,7 +76,7 @@
\endlist
- Your module should now appear in the \uicontrol Imports tab in the
+ Your module should now appear in the \uicontrol {QML Imports} tab in the
\uicontrol Library in the Design mode. Your components should appear in the
\uicontrol {QML Types} tab if a valid \c .metainfo file is in place.
diff --git a/doc/qtcreator/src/qtquick/qtquick-components.qdoc b/doc/qtcreator/src/qtquick/qtquick-components.qdoc
index 475a8928b53..fac448c820a 100644
--- a/doc/qtcreator/src/qtquick/qtquick-components.qdoc
+++ b/doc/qtcreator/src/qtquick/qtquick-components.qdoc
@@ -48,7 +48,7 @@
applications.
The \uicontrol {Library} pane lists the available QML types, UI
- components, assets, and imports.
+ components, assets, and QML imports.
\image qmldesigner-qml-components.png "QML Components"
@@ -60,11 +60,11 @@
Quick Controls, Dialogs, and Layouts are available for creating user
interfaces using Qt Quick 2. The components and controls are based on
standard QML types. To view the components and controls in the
- \uicontrol {Library}, import the component sets in \uicontrol Imports.
+ \uicontrol {Library}, import the component sets in \uicontrol {QML Imports}.
The \uicontrol {Qt Quick Application} wizards for a particular platform add
the import statements automatically. You can remove import statements in
- \uicontrol Imports
+ \uicontrol {QML Imports}
\uicontrol {Assets} displays the images and other files that you copy
to the project folder (to the same subfolder as the QML files).
diff --git a/doc/qtcreatordev/config/qtcreator-developer.qdocconf b/doc/qtcreatordev/config/qtcreator-developer.qdocconf
index 72fd0efb2cd..f6a4b9a25cd 100644
--- a/doc/qtcreatordev/config/qtcreator-developer.qdocconf
+++ b/doc/qtcreatordev/config/qtcreator-developer.qdocconf
@@ -6,12 +6,15 @@ language = Cpp
headerdirs = . \
../src \
../../../src/libs/aggregation \
- ../../../src/libs/extensionsystem
+ ../../../src/libs/extensionsystem \
+ ../../../src/plugins/coreplugin
sourcedirs = . \
../src \
../../../src/libs/aggregation \
- ../../../src/libs/extensionsystem
+ ../../../src/libs/extensionsystem \
+ ../../../src/plugins/coreplugin
+
excludedirs = ../../../src/libs/aggregation/examples
diff --git a/doc/qtcreatordev/src/common-extension-tasks.qdoc b/doc/qtcreatordev/src/common-extension-tasks.qdoc
index 36f88967818..807c84e1bde 100644
--- a/doc/qtcreatordev/src/common-extension-tasks.qdoc
+++ b/doc/qtcreatordev/src/common-extension-tasks.qdoc
@@ -60,11 +60,16 @@
\row
\li Add a new wizard.
- \li You can extend the wizards in File > New File or Project with
- your own file and project templates.
- \li \l{Core::IWizard}, \l{Core::StandardFileWizard},
- \l{Core::BaseFileWizard}, \l{Core::BaseFileWizardParameters}
-
+ \li You can extend the wizards in \uicontrol File >
+ \uicontrol {New File or Project} with your own file
+ and project templates. We recommend that you create
+ JSON-based wizards instead of implementing new
+ wizards in C++ code.
+ \li \l{https://doc.qt.io/qtcreator/creator-project-wizards.html}
+ {Adding New Custom Wizards}
+
+ \l{Core::IWizardFactory}, \l{Core::BaseFileWizardFactory},
+ \l{Core::BaseFileWizard}, \l{Core::WizardDialogParameters}
\row
\li Add support for a new version control system.
\li Version control systems integrated in \QC are Bazaar, CVS, Git,
diff --git a/doc/qtcreatordev/src/qtcreator-module.qdoc b/doc/qtcreatordev/src/qtcreator-module.qdoc
index 4d57ca4a57c..2a4ec2d03de 100644
--- a/doc/qtcreatordev/src/qtcreator-module.qdoc
+++ b/doc/qtcreatordev/src/qtcreator-module.qdoc
@@ -77,8 +77,10 @@
\row
\li \l{qtcreatorcdbext}
\li Windows CDB debugger extension
+ \endomit
\endtable
+
\section1 Plugins
As already mentioned, \QC is basically only a plugin loader framework
@@ -98,9 +100,10 @@
most important ones.
This plugin also contains classes necessary to hook into the
- \l{Locator} as well as support for searching text in arbitrary
- widgets.
+ \l{Core::ILocatorFilter}{Locator} as well as support for
+ searching text in arbitrary widgets.
+ \omit
\row
\li \l{ProjectExplorer}
\li The project explorer plugin. Provides base classes for project
diff --git a/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc b/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc
index 2e76d6c59e0..412c20fca2e 100644
--- a/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc
+++ b/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc
@@ -168,8 +168,8 @@
example, if you drew a rectangle, you can export it as a
\l Rectangle component.
You can provide the import statement of the module where the QML
- type is defined in the \uicontrol Imports field.
- \li In the \uicontrol Imports field, enter
+ type is defined in the \uicontrol {QML Imports} field.
+ \li In the \uicontrol {QML Imports} field, enter
additional import statements to have them added to the generated QML
file. For example, to use Qt Quick Controls 2.3, you need the
import statement \c {QtQuick.Controls 2.3} and to use Qt Quick
diff --git a/qtcreator_ide_branding.pri b/qtcreator_ide_branding.pri
index 4f7aa7c39ca..cc802f0cc18 100644
--- a/qtcreator_ide_branding.pri
+++ b/qtcreator_ide_branding.pri
@@ -10,3 +10,8 @@ IDE_CASED_ID = QtCreator
PRODUCT_BUNDLE_ORGANIZATION = org.qt-project
PROJECT_USER_FILE_EXTENSION = .user
+
+IDE_DOC_FILES_ONLINE = $$PWD/doc/qtcreator/qtcreator-online.qdocconf \
+ $$PWD/doc/qtcreatordev/qtcreator-dev-online.qdocconf
+IDE_DOC_FILES = $$PWD/doc/qtcreator/qtcreator.qdocconf \
+ $$PWD/doc/qtcreatordev/qtcreator-dev.qdocconf
diff --git a/scripts/build.py b/scripts/build.py
new file mode 100755
index 00000000000..4724ece02a7
--- /dev/null
+++ b/scripts/build.py
@@ -0,0 +1,244 @@
+#!/usr/bin/env python
+#############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the release tools of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+# import the print function which is used in python 3.x
+from __future__ import print_function
+
+import argparse
+import collections
+import glob
+import os
+
+import common
+
+def existing_path(path):
+ return path if os.path.exists(path) else None
+
+def default_python3():
+ path_system = os.path.join('/usr', 'bin') if not common.is_windows_platform() else None
+ path = os.environ.get('PYTHON3_PATH') or path_system
+ postfix = '.exe' if common.is_windows_platform() else ''
+ return existing_path(os.path.join(path, 'python3' + postfix)) or existing_path(os.path.join(path, 'python' + postfix))
+
+def get_arguments():
+ parser = argparse.ArgumentParser(description='Build Qt Creator for packaging')
+ parser.add_argument('--src', help='path to sources', required=True)
+ parser.add_argument('--build', help='path that should be used for building', required=True)
+ parser.add_argument('--qt-path', help='Path to Qt', required=True)
+
+ parser.add_argument('--debug', help='Enable debug builds', action='store_true', default=False)
+
+ # clang codemodel
+ parser.add_argument('--llvm-path', help='Path to LLVM installation for Clang code model',
+ default=os.environ.get('LLVM_INSTALL_DIR'))
+
+ # perfparser
+ parser.add_argument('--elfutils-path',
+ help='Path to elfutils installation for use by perfprofiler (Windows, Linux)')
+
+ # signing
+ parser.add_argument('--keychain-unlock-script',
+ help='Path to script for unlocking the keychain used for signing (macOS)')
+
+ # cdbextension
+ parser.add_argument('--python-path',
+ help='Path to python libraries for use by cdbextension (Windows)')
+
+ parser.add_argument('--app-target', help='File name of the executable / app bundle',
+ default=('Qt Creator.app' if common.is_mac_platform()
+ else 'qtcreator'))
+ parser.add_argument('--python3', help='File path to python3 executable for generating translations',
+ default=default_python3())
+
+ parser.add_argument('--no-cdb',
+ help='Skip cdbextension and the python dependency packaging step (Windows)',
+ action='store_true', default=(not common.is_windows_platform()))
+ parser.add_argument('--no-docs', help='Skip documentation generation',
+ action='store_true', default=False)
+ return parser.parse_args()
+
+def build_qtcreator(args, paths):
+ if not os.path.exists(paths.build):
+ os.makedirs(paths.build)
+ prefix_paths = [paths.qt]
+ if args.llvm_path:
+ prefix_paths += [args.llvm_path]
+ if args.elfutils_path:
+ prefix_paths += [args.elfutils_path]
+ build_type = 'Debug' if args.debug else 'Release'
+ with_docs_str = 'OFF' if args.no_docs else 'ON'
+ cmake_args = ['cmake',
+ '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
+ '-DCMAKE_BUILD_TYPE=' + build_type,
+ '-DWITH_DOCS=' + with_docs_str,
+ '-DBUILD_DEVELOPER_DOCS=' + with_docs_str,
+ '-DBUILD_EXECUTABLE_SDKTOOL=OFF',
+ '-DCMAKE_INSTALL_PREFIX=' + paths.install,
+ '-DWITH_TESTS=OFF',
+ '-G', 'Ninja']
+
+ if args.python3:
+ cmake_args += ['-DPYTHON_EXECUTABLE=' + args.python3]
+
+ # force MSVC on Windows, because it looks for GCC in the PATH first,
+ # even if MSVC is first mentioned in the PATH...
+ # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH
+ if common.is_windows_platform():
+ cmake_args += ['-DCMAKE_C_COMPILER=cl',
+ '-DCMAKE_CXX_COMPILER=cl',
+ '-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF',
+ '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF',
+ '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF']
+ if args.python_path:
+ python_library = glob.glob(os.path.join(args.python_path, 'libs', 'python??.lib'))
+ if python_library:
+ cmake_args += ['-DPYTHON_LIBRARY=' + python_library[0],
+ '-DPYTHON_INCLUDE_DIR=' + os.path.join(args.python_path, 'include')]
+
+ # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119
+ if common.is_linux_platform():
+ cmake_args += ['-DBUILD_WITH_PCH=OFF']
+
+ ide_revision = common.get_commit_SHA(paths.src)
+ if ide_revision:
+ cmake_args += ['-DIDE_REVISION=ON',
+ '-DIDE_REVISION_STR=' + ide_revision,
+ '-DIDE_REVISION_URL_STR=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id=' + ide_revision]
+
+ common.check_print_call(cmake_args + [paths.src], paths.build)
+ common.check_print_call(['cmake', '--build', '.'], paths.build)
+ if not args.no_docs:
+ common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build)
+
+ common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--strip'],
+ paths.build)
+ common.check_print_call(['cmake', '--install', '.', '--prefix', paths.dev_install,
+ '--component', 'Devel'],
+ paths.build)
+
+def build_wininterrupt(args, paths):
+ if not common.is_windows_platform():
+ return
+ # assumes existing Qt Creator build
+ cmake_args = ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=ON',
+ '-DBUILD_EXECUTABLE_WIN64INTERRUPT=ON',
+ '-DBUILD_LIBRARY_QTCREATORCDBEXT=OFF']
+ common.check_print_call(['cmake'] + cmake_args + [paths.src], paths.build)
+ common.check_print_call(['cmake', '--build', '.'], paths.build)
+ common.check_print_call(['cmake', '--install', '.', '--prefix', paths.wininterrupt_install,
+ '--component', 'wininterrupt'],
+ paths.build)
+
+def build_qtcreatorcdbext(args, paths):
+ if args.no_cdb:
+ return
+ # assumes existing Qt Creator build
+ cmake_args = ['-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF',
+ '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF',
+ '-DBUILD_LIBRARY_QTCREATORCDBEXT=ON']
+ common.check_print_call(['cmake'] + cmake_args + [paths.src], paths.build)
+ common.check_print_call(['cmake', '--build', '.'], paths.build)
+ common.check_print_call(['cmake', '--install', '.', '--prefix', paths.qtcreatorcdbext_install,
+ '--component', 'qtcreatorcdbext'],
+ paths.build)
+
+def deploy_qt(args, paths):
+ if common.is_mac_platform():
+ script = os.path.join(paths.src, 'scripts', 'deployqtHelper_mac.sh')
+ app = os.path.join(paths.install, args.app_target)
+ # TODO this is wrong if Qt is set up non-standard
+ # TODO integrate deployqtHelper_mac.sh into deployqt.py, finally
+ qt_bins = os.path.join(paths.qt, 'bin')
+ qt_translations = os.path.join(paths.qt, 'translations')
+ qt_plugins = os.path.join(paths.qt, 'plugins')
+ qt_imports = os.path.join(paths.qt, 'imports')
+ qt_qml = os.path.join(paths.qt, 'qml')
+ common.check_print_call([script, app, qt_bins, qt_translations, qt_plugins,
+ qt_imports, qt_qml],
+ paths.build)
+ else:
+ exe = os.path.join(paths.install, 'bin', args.app_target)
+ common.check_print_call(['python', '-u', os.path.join(paths.src, 'scripts', 'deployqt.py'),
+ '-i', exe, os.path.join(paths.qt, 'bin', 'qmake')],
+ paths.build)
+
+def package_qtcreator(args, paths):
+ common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, 'qtcreator.7z'), '*'],
+ paths.install)
+ common.check_print_call(['7z', 'a', '-mmt2',
+ os.path.join(paths.result, 'qtcreator_dev.7z'), '*'],
+ paths.dev_install)
+ if common.is_windows_platform():
+ common.check_print_call(['7z', 'a', '-mmt2',
+ os.path.join(paths.result, 'wininterrupt.7z'), '*'],
+ paths.wininterrupt_install)
+ if not args.no_cdb:
+ common.check_print_call(['7z', 'a', '-mmt2',
+ os.path.join(paths.result, 'qtcreatorcdbext.7z'), '*'],
+ paths.qtcreatorcdbext_install)
+
+ if common.is_mac_platform():
+ if args.keychain_unlock_script:
+ common.check_print_call([args.keychain_unlock_script], paths.install)
+ common.check_print_call(['python', '-u',
+ os.path.join(paths.src, 'scripts', 'makedmg.py'),
+ 'qt-creator.dmg',
+ 'Qt Creator',
+ paths.src,
+ paths.install],
+ paths.result)
+
+def get_paths(args):
+ Paths = collections.namedtuple('Paths',
+ ['qt', 'src', 'build',
+ 'install', 'dev_install', 'wininterrupt_install',
+ 'qtcreatorcdbext_install', 'result'])
+ build_path = os.path.abspath(args.build)
+ install_path = os.path.join(build_path, 'install')
+ return Paths(qt=os.path.abspath(args.qt_path),
+ src=os.path.abspath(args.src),
+ build=os.path.join(build_path, 'build'),
+ install=os.path.join(install_path, 'qt-creator'),
+ dev_install=os.path.join(install_path, 'qt-creator-dev'),
+ wininterrupt_install=os.path.join(install_path, 'wininterrupt'),
+ qtcreatorcdbext_install=os.path.join(install_path, 'qtcreatorcdbext'),
+ result=build_path)
+
+def main():
+ args = get_arguments()
+ paths = get_paths(args)
+
+ build_qtcreator(args, paths)
+ build_wininterrupt(args, paths)
+ build_qtcreatorcdbext(args, paths)
+ deploy_qt(args, paths)
+ package_qtcreator(args, paths)
+
+if __name__ == '__main__':
+ main()
diff --git a/scripts/common.py b/scripts/common.py
index db97ea35616..61923803fb9 100644
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -40,6 +40,33 @@ def is_linux_platform():
def is_mac_platform():
return sys.platform.startswith('darwin')
+def check_print_call(command, workdir):
+ print('------------------------------------------')
+ print('COMMAND:')
+ print(' '.join(['"' + c.replace('"', '\\"') + '"' for c in command]))
+ print('PWD: "' + workdir + '"')
+ print('------------------------------------------')
+ subprocess.check_call(command, cwd=workdir)
+
+
+def get_git_SHA(path):
+ try:
+ return subprocess.check_output(['git', 'rev-list', '-n1', 'HEAD'], cwd=path).strip()
+ except subprocess.CalledProcessError:
+ return None
+ return None
+
+
+# get commit SHA either directly from git, or from a .tag file in the source directory
+def get_commit_SHA(path):
+ git_sha = get_git_SHA(path)
+ if not git_sha:
+ tagfile = os.path.join(path, '.tag')
+ if os.path.exists(tagfile):
+ with open(tagfile, 'r') as f:
+ git_sha = f.read().strip()
+ return git_sha
+
# copy of shutil.copytree that does not bail out if the target directory already exists
# and that does not create empty directories
def copytree(src, dst, symlinks=False, ignore=None):
@@ -211,5 +238,7 @@ def codesign(app_path):
lambda ff: ff.endswith('.dylib'))
codesign = codesign_call()
if is_mac_platform() and codesign:
+ entitlements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'dist',
+ 'installer', 'mac', 'entitlements.plist')
# sign the whole bundle
- subprocess.check_call(codesign + ['--deep', app_path])
+ subprocess.check_call(codesign + ['--deep', app_path, '--entitlements', entitlements_path])
diff --git a/share/qtcreator/debugger/boosttypes.py b/share/qtcreator/debugger/boosttypes.py
index e61d1e4bb8f..215ccc6922e 100644
--- a/share/qtcreator/debugger/boosttypes.py
+++ b/share/qtcreator/debugger/boosttypes.py
@@ -23,7 +23,7 @@
#
############################################################################
-from dumper import *
+from dumper import Children
def qdump__boost__bimaps__bimap(d, value):
#leftType = value.type[0]
diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py
index 097494cc90a..ad63a19b388 100644
--- a/share/qtcreator/debugger/cdbbridge.py
+++ b/share/qtcreator/debugger/cdbbridge.py
@@ -28,10 +28,12 @@ import os
import sys
import cdbext
import re
+import threading
+from utils import TypeCode
sys.path.insert(1, os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
-from dumper import *
+from dumper import DumperBase, SubItem
class FakeVoidType(cdbext.Type):
def __init__(self, name , dumper):
@@ -47,19 +49,19 @@ class FakeVoidType(cdbext.Type):
def code(self):
if self.typeName.endswith('*'):
- return TypeCodePointer
+ return TypeCode.TypeCodePointer
if self.typeName.endswith(']'):
- return TypeCodeArray
- return TypeCodeVoid
+ return TypeCode.TypeCodeArray
+ return TypeCode.TypeCodeVoid
def unqualified(self):
return self
def target(self):
code = self.code()
- if code == TypeCodePointer:
+ if code == TypeCode.TypeCodePointer:
return FakeVoidType(self.typeName[:-1], self.dumper)
- if code == TypeCodeVoid:
+ if code == TypeCode.TypeCodeVoid:
return self
try:
return FakeVoidType(self.typeName[:self.typeName.rindex('[')], self.dumper)
@@ -105,7 +107,7 @@ class Dumper(DumperBase):
val.type = self.fromNativeType(nativeValue.type())
# There is no cdb api for the size of bitfields.
# Workaround this issue by parsing the native debugger text for integral types.
- if val.type.code == TypeCodeIntegral:
+ if val.type.code == TypeCode.TypeCodeIntegral:
integerString = nativeValue.nativeDebuggerValue()
if integerString == 'true':
val.ldata = int(1).to_bytes(1, byteorder='little')
@@ -128,7 +130,7 @@ class Dumper(DumperBase):
except:
# read raw memory in case the integerString can not be interpreted
pass
- if val.type.code == TypeCodeEnum:
+ if val.type.code == TypeCode.TypeCodeEnum:
val.ldisplay = self.enumValue(nativeValue)
val.isBaseClass = val.name == val.type.name
val.nativeValue = nativeValue
@@ -159,21 +161,21 @@ class Dumper(DumperBase):
nativeType = FakeVoidType(nativeType.name(), self)
code = nativeType.code()
- if code == TypeCodePointer:
+ if code == TypeCode.TypeCodePointer:
if not nativeType.name().startswith('<function>'):
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
if targetType is not None:
return self.createPointerType(targetType)
- code = TypeCodeFunction
+ code = TypeCode.TypeCodeFunction
- if code == TypeCodeArray:
+ if code == TypeCode.TypeCodeArray:
# cdb reports virtual function tables as arrays those ar handled separetly by
# the DumperBase. Declare those types as structs prevents a lookup to a none existing type
if not nativeType.name().startswith('__fptr()') and not nativeType.name().startswith('<gentype '):
targetType = self.lookupType(nativeType.targetName(), nativeType.moduleId())
if targetType is not None:
return self.createArrayType(targetType, nativeType.arrayElements())
- code = TypeCodeStruct
+ code = TypeCode.TypeCodeStruct
tdata = self.TypeData(self)
tdata.name = nativeType.name()
@@ -182,12 +184,12 @@ class Dumper(DumperBase):
tdata.code = code
tdata.moduleName = nativeType.module()
self.registerType(typeId, tdata) # Prevent recursion in fields.
- if code == TypeCodeStruct:
+ if code == TypeCode.TypeCodeStruct:
tdata.lfields = lambda value : \
self.listFields(nativeType, value)
tdata.lalignment = lambda : \
self.nativeStructAlignment(nativeType)
- if code == TypeCodeEnum:
+ if code == TypeCode.TypeCodeEnum:
tdata.enumDisplay = lambda intval, addr, form : \
self.nativeTypeEnumDisplay(nativeType, intval, form)
tdata.templateArguments = self.listTemplateParameters(nativeType.name())
@@ -206,7 +208,7 @@ class Dumper(DumperBase):
nativeMember = nativeValue.childFromIndex(index)
def nativeStructAlignment(self, nativeType):
- #warn("NATIVE ALIGN FOR %s" % nativeType.name)
+ #DumperBase.warn("NATIVE ALIGN FOR %s" % nativeType.name)
def handleItem(nativeFieldType, align):
a = self.fromNativeType(nativeFieldType).alignment()
return a if a > align else align
diff --git a/share/qtcreator/debugger/creatortypes.py b/share/qtcreator/debugger/creatortypes.py
index cfdd248b232..346b53ae7da 100644
--- a/share/qtcreator/debugger/creatortypes.py
+++ b/share/qtcreator/debugger/creatortypes.py
@@ -23,8 +23,6 @@
#
############################################################################
-from dumper import *
-
def typeTarget(type):
target = type.target()
if target:
@@ -234,7 +232,7 @@ def qdump__CPlusPlus__Internal__PPToken(d, value):
data, size, alloc = d.byteArrayData(value["m_src"])
length = value["f"]["utf16chars"].integer()
offset = value["utf16charOffset"].integer()
- #warn("size: %s, alloc: %s, offset: %s, length: %s, data: %s"
+ #DumperBase.warn("size: %s, alloc: %s, offset: %s, length: %s, data: %s"
# % (size, alloc, offset, length, data))
d.putValue(d.readMemory(data + offset, min(100, length)), "latin1")
d.putPlainChildren(value)
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py
index 8ce967d3a55..6b0416c563d 100644
--- a/share/qtcreator/debugger/dumper.py
+++ b/share/qtcreator/debugger/dumper.py
@@ -34,15 +34,19 @@ import re
import time
import inspect
import threading
+from utils import DisplayFormat, TypeCode
try:
# That's only used in native combined debugging right now, so
# we do not need to hard fail in cases of partial python installation
# that will never use this.
import json
-except:
+except ModuleNotFoundError:
+ DumperBase.warn("Python module json not found. "
+ "Native combined debugging might not work.")
pass
+
if sys.version_info[0] >= 3:
xrange = range
toInteger = int
@@ -50,98 +54,6 @@ else:
toInteger = long
-# Debugger start modes. Keep in sync with DebuggerStartMode in debuggerconstants.h
-NoStartMode, \
-StartInternal, \
-StartExternal, \
-AttachExternal, \
-AttachCrashedExternal, \
-AttachCore, \
-AttachToRemoteServer, \
-AttachToRemoteProcess, \
-StartRemoteProcess, \
- = range(0, 9)
-
-
-# Known special formats. Keep in sync with DisplayFormat in debuggerprotocol.h
-AutomaticFormat, \
-RawFormat, \
-SimpleFormat, \
-EnhancedFormat, \
-SeparateFormat, \
-Latin1StringFormat, \
-SeparateLatin1StringFormat, \
-Utf8StringFormat, \
-SeparateUtf8StringFormat, \
-Local8BitStringFormat, \
-Utf16StringFormat, \
-Ucs4StringFormat, \
-Array10Format, \
-Array100Format, \
-Array1000Format, \
-Array10000Format, \
-ArrayPlotFormat, \
-CompactMapFormat, \
-DirectQListStorageFormat, \
-IndirectQListStorageFormat, \
- = range(0, 20)
-
-# Breakpoints. Keep synchronized with BreakpointType in breakpoint.h
-UnknownType, \
-BreakpointByFileAndLine, \
-BreakpointByFunction, \
-BreakpointByAddress, \
-BreakpointAtThrow, \
-BreakpointAtCatch, \
-BreakpointAtMain, \
-BreakpointAtFork, \
-BreakpointAtExec, \
-BreakpointAtSysCall, \
-WatchpointAtAddress, \
-WatchpointAtExpression, \
-BreakpointOnQmlSignalEmit, \
-BreakpointAtJavaScriptThrow, \
- = range(0, 14)
-
-
-# Internal codes for types keep in sync with cdbextensions pytype.cpp
-TypeCodeTypedef, \
-TypeCodeStruct, \
-TypeCodeVoid, \
-TypeCodeIntegral, \
-TypeCodeFloat, \
-TypeCodeEnum, \
-TypeCodePointer, \
-TypeCodeArray, \
-TypeCodeComplex, \
-TypeCodeReference, \
-TypeCodeFunction, \
-TypeCodeMemberPointer, \
-TypeCodeFortranString, \
-TypeCodeUnresolvable, \
-TypeCodeBitfield, \
-TypeCodeRValueReference, \
- = range(0, 16)
-
-def isIntegralTypeName(name):
- return name in ('int', 'unsigned int', 'signed int',
- 'short', 'unsigned short',
- 'long', 'unsigned long',
- 'long long', 'unsigned long long',
- 'char', 'signed char', 'unsigned char',
- 'bool')
-
-def isFloatingPointTypeName(name):
- return name in ('float', 'double', 'long double')
-
-
-def arrayForms():
- return [ArrayPlotFormat]
-
-def mapForms():
- return [CompactMapFormat]
-
-
class ReportItem:
"""
Helper structure to keep temporary 'best' information about a value
@@ -159,21 +71,6 @@ class ReportItem:
% (self.value, self.encoding, self.priority, self.elided)
-def warn(message):
- DumperBase.warn(message)
-
-def xwarn(message):
- warn(message)
- import traceback
- traceback.print_stack()
-
-def error(message):
- raise RuntimeError(message)
-
-def showException(msg, exType, exValue, exTraceback):
- DumperBase.showException(msg, exType, exValue, exTraceback)
-
-
class Timer:
def __init__(self, d, desc):
self.d = d
@@ -220,7 +117,7 @@ class Children:
def __exit__(self, exType, exValue, exTraceBack):
if exType is not None:
if self.d.passExceptions:
- showException('CHILDREN', exType, exValue, exTraceBack)
+ self.d.showException('CHILDREN', exType, exValue, exTraceBack)
self.d.putSpecialValue('notaccessible')
self.d.putNumChild(0)
if self.d.currentMaxNumChild is not None:
@@ -267,11 +164,11 @@ class DumperBase:
@staticmethod
def showException(msg, exType, exValue, exTraceback):
- warn('**** CAUGHT EXCEPTION: %s ****' % msg)
+ DumperBase.warn('**** CAUGHT EXCEPTION: %s ****' % msg)
try:
import traceback
for line in traceback.format_exception(exType, exValue, exTraceback):
- warn('%s' % line)
+ DumperBase.warn('%s' % line)
except:
pass
@@ -353,9 +250,9 @@ class DumperBase:
self.uninitialized = list(map(lambda x: self.hexdecode(x), self.uninitialized))
self.partialUpdate = int(args.get('partial', '0'))
self.fallbackQtVersion = 0x50200
- #warn('NAMESPACE: "%s"' % self.qtNamespace())
- #warn('EXPANDED INAMES: %s' % self.expandedINames)
- #warn('WATCHERS: %s' % self.watchers)
+ #DumperBase.warn('NAMESPACE: "%s"' % self.qtNamespace())
+ #DumperBase.warn('EXPANDED INAMES: %s' % self.expandedINames)
+ #DumperBase.warn('WATCHERS: %s' % self.watchers)
def resetPerStepCaches(self):
self.perStepCache = {}
@@ -363,7 +260,7 @@ class DumperBase:
def resetCaches(self):
# This is a cache mapping from 'type name' to 'display alternatives'.
- self.qqFormats = { 'QVariant (QVariantMap)' : mapForms() }
+ self.qqFormats = { 'QVariant (QVariantMap)' : [DisplayFormat.CompactMapFormat] }
# This is a cache of all known dumpers.
self.qqDumpers = {} # Direct type match
@@ -434,11 +331,11 @@ class DumperBase:
self.currentType = ReportItem();
def exitSubItem(self, item, exType, exValue, exTraceBack):
- #warn('CURRENT VALUE: %s: %s %s' %
+ #DumperBase.warn('CURRENT VALUE: %s: %s %s' %
# (self.currentIName, self.currentValue, self.currentType))
if not exType is None:
if self.passExceptions:
- showException('SUBITEM', exType, exValue, exTraceBack)
+ self.showException('SUBITEM', exType, exValue, exTraceBack)
self.putSpecialValue('notaccessible')
self.putNumChild(0)
if not self.isCli:
@@ -493,7 +390,7 @@ class DumperBase:
def stripForFormat(self, typeName):
if not isinstance(typeName, str):
- error('Expected string in stripForFormat(), got %s' % type(typeName))
+ raise RuntimeError('Expected string in stripForFormat(), got %s' % type(typeName))
if typeName in self.cachedFormats:
return self.cachedFormats[typeName]
stripped = ''
@@ -541,7 +438,7 @@ class DumperBase:
tdata.name = typeId
tdata.typeId = typeId
tdata.lbitsize = 16
- tdata.code = TypeCodeIntegral
+ tdata.code = TypeCode.TypeCodeIntegral
self.registerType(typeId, tdata)
typeId = 'QChar'
@@ -549,7 +446,7 @@ class DumperBase:
tdata.name = typeId
tdata.typeId = typeId
tdata.lbitsize = 16
- tdata.code = TypeCodeStruct
+ tdata.code = TypeCode.TypeCodeStruct
tdata.lfields = [self.Field(dumper=self, name='ucs', type='unsigned short', bitsize=16, bitpos=0)]
tdata.lalignment = 2
tdata.templateArguments = []
@@ -576,14 +473,14 @@ class DumperBase:
inner = inner[6:].strip()
if inner.endswith(' const'):
inner = inner[:-6].strip()
- #warn("FOUND: %s" % inner)
+ #DumperBase.warn("FOUND: %s" % inner)
targs.append(inner)
- #warn("SPLITTING %s" % typename)
+ #DumperBase.warn("SPLITTING %s" % typename)
level = 0
inner = ''
for c in typename[::-1]: # Reversed...
- #warn("C: %s" % c)
+ #DumperBase.warn("C: %s" % c)
if c == '>':
if level > 0:
inner += c
@@ -597,7 +494,7 @@ class DumperBase:
inner = ''
break
elif c == ',':
- #warn('c: %s level: %s' % (c, level))
+ #DumperBase.warn('c: %s level: %s' % (c, level))
if level == 1:
push(inner)
inner = ''
@@ -606,7 +503,7 @@ class DumperBase:
else:
inner += c
- #warn("TARGS: %s %s" % (typename, targs))
+ #DumperBase.warn("TARGS: %s %s" % (typename, targs))
res = []
for item in targs[::-1]:
if len(item) == 0:
@@ -626,7 +523,7 @@ class DumperBase:
res.append(val)
else:
res.append(self.Type(self, item))
- #warn("RES: %s %s" % (typename, [(None if t is None else t.name) for t in res]))
+ #DumperBase.warn("RES: %s %s" % (typename, [(None if t is None else t.name) for t in res]))
return res
# Hex decoding operating on str, return str.
@@ -729,12 +626,12 @@ class DumperBase:
return elided, self.readMemory(data, shown)
def putCharArrayValue(self, data, size, charSize,
- displayFormat = AutomaticFormat):
+ displayFormat = DisplayFormat.AutomaticFormat):
bytelen = size * charSize
elided, shown = self.computeLimit(bytelen, self.displayStringLimit)
mem = self.readMemory(data, shown)
if charSize == 1:
- if displayFormat in (Latin1StringFormat, SeparateLatin1StringFormat):
+ if displayFormat in (DisplayFormat.Latin1StringFormat, DisplayFormat.SeparateLatin1StringFormat):
encodingType = 'latin1'
else:
encodingType = 'utf8'
@@ -748,12 +645,12 @@ class DumperBase:
self.putValue(mem, encodingType, elided=elided)
- if displayFormat in (SeparateLatin1StringFormat, SeparateUtf8StringFormat, SeparateFormat):
+ if displayFormat in (DisplayFormat.SeparateLatin1StringFormat, DisplayFormat.SeparateUtf8StringFormat, DisplayFormat.SeparateFormat):
elided, shown = self.computeLimit(bytelen, 100000)
self.putDisplay(encodingType + ':separate', self.readMemory(data, shown))
def putCharArrayHelper(self, data, size, charType,
- displayFormat = AutomaticFormat,
+ displayFormat = DisplayFormat.AutomaticFormat,
makeExpandable = True):
charSize = charType.size()
self.putCharArrayValue(data, size, charSize, displayFormat = displayFormat)
@@ -976,7 +873,7 @@ class DumperBase:
def check(self, exp):
if not exp:
- error('Check failed: %s' % exp)
+ raise RuntimeError('Check failed: %s' % exp)
def checkRef(self, ref):
# Assume there aren't a million references to any object.
@@ -985,7 +882,7 @@ class DumperBase:
def checkIntType(self, thing):
if not self.isInt(thing):
- error('Expected an integral value, got %s' % type(thing))
+ raise RuntimeError('Expected an integral value, got %s' % type(thing))
def readToFirstZero(self, base, tsize, maximum):
self.checkIntType(base)
@@ -1001,9 +898,9 @@ class DumperBase:
break
except:
maximum = int(maximum / 2)
- warn('REDUCING READING MAXIMUM TO %s' % maximum)
+ self.warn('REDUCING READING MAXIMUM TO %s' % maximum)
- #warn('BASE: 0x%x TSIZE: %s MAX: %s' % (base, tsize, maximum))
+ #DumperBase.warn('BASE: 0x%x TSIZE: %s MAX: %s' % (base, tsize, maximum))
for i in xrange(0, maximum, tsize):
t = struct.unpack_from(code, blob, i)[0]
if t == 0:
@@ -1179,7 +1076,7 @@ class DumperBase:
self.putItem(value)
def isExpanded(self):
- #warn('IS EXPANDED: %s in %s: %s' % (self.currentIName,
+ #DumperBase.warn('IS EXPANDED: %s in %s: %s' % (self.currentIName,
# self.expandedINames, self.currentIName in self.expandedINames))
return self.currentIName in self.expandedINames
@@ -1213,7 +1110,7 @@ class DumperBase:
n = arrayByteSize // innerType.size()
p = value.address()
- if displayFormat != RawFormat and p:
+ if displayFormat != DisplayFormat.RawFormat and p:
if innerType.name in ('char', 'wchar_t', 'unsigned char', 'signed char', 'CHAR', 'WCHAR'):
self.putCharArrayHelper(p, n, innerType, self.currentItemFormat(),
makeExpandable = False)
@@ -1236,7 +1133,7 @@ class DumperBase:
ns = self.qtNamespace()
if len(ns) > 0 and typeName.startswith(ns):
typeName = typeName[len(ns):]
- # warn( 'stripping %s' % typeName )
+ # DumperBase.warn( 'stripping %s' % typeName )
lvl = 0
pos = None
stripChunks = []
@@ -1251,24 +1148,24 @@ class DumperBase:
elif s == '>':
lvl -= 1
if lvl < 0 :
- error("Unbalanced '<' in type, @index %d" % index)
+ raise RuntimeError("Unbalanced '<' in type, @index %d" % index)
if lvl == 0:
stripChunks.append((pos, index+1))
if lvl != 0:
- error("unbalanced at end of type name")
+ raise RuntimeError("unbalanced at end of type name")
for (f, l) in reversed(stripChunks):
typeName = typeName[:f] + typeName[l:]
return typeName
def tryPutPrettyItem(self, typeName, value):
value.check()
- if self.useFancy and self.currentItemFormat() != RawFormat:
+ if self.useFancy and self.currentItemFormat() != DisplayFormat.RawFormat:
self.putType(typeName)
nsStrippedType = self.stripNamespaceFromType(typeName)\
.replace('::', '__')
- #warn('STRIPPED: %s' % nsStrippedType)
+ #DumperBase.warn('STRIPPED: %s' % nsStrippedType)
# The following block is only needed for D.
if nsStrippedType.startswith('_A'):
# DMD v2.058 encodes string[] as _Array_uns long long.
@@ -1281,7 +1178,7 @@ class DumperBase:
return True
dumper = self.qqDumpers.get(nsStrippedType)
- #warn('DUMPER: %s' % dumper)
+ #DumperBase.warn('DUMPER: %s' % dumper)
if dumper is not None:
dumper(self, value)
return True
@@ -1308,7 +1205,7 @@ class DumperBase:
# This is shared by pointer and array formatting.
def tryPutSimpleFormattedPointer(self, ptr, typeName, innerType, displayFormat, limit):
- if displayFormat == AutomaticFormat:
+ if displayFormat == DisplayFormat.AutomaticFormat:
if innerType.name in ('char', 'signed char', 'unsigned char', 'CHAR'):
# Use UTF-8 as default for char *.
self.putType(typeName)
@@ -1328,45 +1225,45 @@ class DumperBase:
self.putValue(data, 'ucs4', elided=elided)
return True
- if displayFormat == Latin1StringFormat:
+ if displayFormat == DisplayFormat.Latin1StringFormat:
self.putType(typeName)
(elided, data) = self.encodeCArray(ptr, 1, limit)
self.putValue(data, 'latin1', elided=elided)
return True
- if displayFormat == SeparateLatin1StringFormat:
+ if displayFormat == DisplayFormat.SeparateLatin1StringFormat:
self.putType(typeName)
(elided, data) = self.encodeCArray(ptr, 1, limit)
self.putValue(data, 'latin1', elided=elided)
self.putDisplay('latin1:separate', data)
return True
- if displayFormat == Utf8StringFormat:
+ if displayFormat == DisplayFormat.Utf8StringFormat:
self.putType(typeName)
(elided, data) = self.encodeCArray(ptr, 1, limit)
self.putValue(data, 'utf8', elided=elided)
return True
- if displayFormat == SeparateUtf8StringFormat:
+ if displayFormat == DisplayFormat.SeparateUtf8StringFormat:
self.putType(typeName)
(elided, data) = self.encodeCArray(ptr, 1, limit)
self.putValue(data, 'utf8', elided=elided)
self.putDisplay('utf8:separate', data)
return True
- if displayFormat == Local8BitStringFormat:
+ if displayFormat == DisplayFormat.Local8BitStringFormat:
self.putType(typeName)
(elided, data) = self.encodeCArray(ptr, 1, limit)
self.putValue(data, 'local8bit', elided=elided)
return True
- if displayFormat == Utf16StringFormat:
+ if displayFormat == DisplayFormat.Utf16StringFormat:
self.putType(typeName)
(elided, data) = self.encodeCArray(ptr, 2, limit)
self.putValue(data, 'utf16', elided=elided)
return True
- if displayFormat == Ucs4StringFormat:
+ if displayFormat == DisplayFormat.Ucs4StringFormat:
self.putType(typeName)
(elided, data) = self.encodeCArray(ptr, 4, limit)
self.putValue(data, 'ucs4', elided=elided)
@@ -1390,12 +1287,12 @@ class DumperBase:
def putFormattedPointerX(self, value):
self.putOriginalAddress(value.address())
- #warn("PUT FORMATTED: %s" % value)
+ #DumperBase.warn("PUT FORMATTED: %s" % value)
pointer = value.pointer()
self.putAddress(pointer)
- #warn('POINTER: 0x%x' % pointer)
+ #DumperBase.warn('POINTER: 0x%x' % pointer)
if pointer == 0:
- #warn('NULL POINTER')
+ #DumperBase.warn('NULL POINTER')
self.putType(value.type)
self.putValue('0x0')
self.putNumChild(0)
@@ -1408,7 +1305,7 @@ class DumperBase:
except:
# Failure to dereference a pointer should at least
# show the value of a pointer.
- #warn('BAD POINTER: %s' % value)
+ #DumperBase.warn('BAD POINTER: %s' % value)
self.putValue('0x%x' % pointer)
self.putType(typeName)
self.putNumChild(0)
@@ -1422,15 +1319,15 @@ class DumperBase:
innerType = value.type.target() #.unqualified()
if innerType.name == 'void':
- #warn('VOID POINTER: %s' % displayFormat)
+ #DumperBase.warn('VOID POINTER: %s' % displayFormat)
self.putType(typeName)
self.putSymbolValue(pointer)
self.putNumChild(0)
return
- if displayFormat == RawFormat:
+ if displayFormat == DisplayFormat.RawFormat:
# Explicitly requested bald pointer.
- #warn('RAW')
+ #DumperBase.warn('RAW')
self.putType(typeName)
self.putValue('0x%x' % pointer)
self.putNumChild(1)
@@ -1441,38 +1338,38 @@ class DumperBase:
return
limit = self.displayStringLimit
- if displayFormat in (SeparateLatin1StringFormat, SeparateUtf8StringFormat):
+ if displayFormat in (DisplayFormat.SeparateLatin1StringFormat, DisplayFormat.SeparateUtf8StringFormat):
limit = 1000000
if self.tryPutSimpleFormattedPointer(pointer, typeName,
innerType, displayFormat, limit):
self.putNumChild(1)
return
- if Array10Format <= displayFormat and displayFormat <= Array1000Format:
- n = (10, 100, 1000, 10000)[displayFormat - Array10Format]
+ if DisplayFormat.Array10Format <= displayFormat and displayFormat <= DisplayFormat.Array1000Format:
+ n = (10, 100, 1000, 10000)[displayFormat - DisplayFormat.Array10Format]
self.putType(typeName)
self.putItemCount(n)
self.putArrayData(value.pointer(), n, innerType)
return
- if innerType.code == TypeCodeFunction:
+ if innerType.code == TypeCode.TypeCodeFunction:
# A function pointer.
self.putSymbolValue(pointer)
self.putType(typeName)
self.putNumChild(0)
return
- #warn('AUTODEREF: %s' % self.autoDerefPointers)
- #warn('INAME: %s' % self.currentIName)
- #warn('INNER: %s' % innerType.name)
+ #DumperBase.warn('AUTODEREF: %s' % self.autoDerefPointers)
+ #DumperBase.warn('INAME: %s' % self.currentIName)
+ #DumperBase.warn('INNER: %s' % innerType.name)
if self.autoDerefPointers:
# Generic pointer type with AutomaticFormat, but never dereference char types:
if innerType.name not in ('char', 'signed char', 'unsigned char', 'wchar_t', 'CHAR', 'WCHAR'):
self.putDerefedPointer(value)
return
- #warn('GENERIC PLAIN POINTER: %s' % value.type)
- #warn('ADDR PLAIN POINTER: 0x%x' % value.laddress)
+ #DumperBase.warn('GENERIC PLAIN POINTER: %s' % value.type)
+ #DumperBase.warn('ADDR PLAIN POINTER: 0x%x' % value.laddress)
self.putType(typeName)
self.putSymbolValue(pointer)
self.putNumChild(1)
@@ -1631,14 +1528,14 @@ class DumperBase:
# metaObjectFunc = self.extractPointer(vtablePtr)
# cmd = '((void*(*)(void*))0x%x)((void*)0x%x)' % (metaObjectFunc, objectPtr)
# try:
-# #warn('MO CMD: %s' % cmd)
+# #DumperBase.warn('MO CMD: %s' % cmd)
# res = self.parseAndEvaluate(cmd)
-# #warn('MO RES: %s' % res)
+# #DumperBase.warn('MO RES: %s' % res)
# self.bump('successfulMetaObjectCall')
# return res.pointer()
# except:
# self.bump('failedMetaObjectCall')
-# #warn('COULD NOT EXECUTE: %s' % cmd)
+# #DumperBase.warn('COULD NOT EXECUTE: %s' % cmd)
# return 0
def extractMetaObjectPtr(self, objectPtr, typeobj):
@@ -1659,14 +1556,14 @@ class DumperBase:
metaObjectFunc = self.extractPointer(vtablePtr)
cmd = '((void*(*)(void*))0x%x)((void*)0x%x)' % (metaObjectFunc, objectPtr)
try:
- #warn('MO CMD: %s' % cmd)
+ #DumperBase.warn('MO CMD: %s' % cmd)
res = self.parseAndEvaluate(cmd)
- #warn('MO RES: %s' % res)
+ #DumperBase.warn('MO RES: %s' % res)
self.bump('successfulMetaObjectCall')
return res.pointer()
except:
self.bump('failedMetaObjectCall')
- #warn('COULD NOT EXECUTE: %s' % cmd)
+ #DumperBase.warn('COULD NOT EXECUTE: %s' % cmd)
return 0
def extractStaticMetaObjectFromTypeHelper(someTypeObj):
@@ -1729,12 +1626,12 @@ class DumperBase:
result = self.knownStaticMetaObjects.get(typeName, None)
if result is not None: # Is 0 or the static metaobject.
self.bump('typecached')
- #warn('CACHED RESULT: %s %s 0x%x' % (self.currentIName, typeName, result))
+ #DumperBase.warn('CACHED RESULT: %s %s 0x%x' % (self.currentIName, typeName, result))
return result
if not self.couldBeQObjectPointer(objectPtr):
self.bump('cannotBeQObject')
- #warn('DOES NOT LOOK LIKE A QOBJECT: %s' % self.currentIName)
+ #DumperBase.warn('DOES NOT LOOK LIKE A QOBJECT: %s' % self.currentIName)
return 0
metaObjectPtr = 0
@@ -1761,7 +1658,7 @@ class DumperBase:
val = self.Value(self)
val.laddress = value
return val.split(pattern)
- error('CANNOT EXTRACT STRUCT FROM %s' % type(value))
+ raise RuntimeError('CANNOT EXTRACT STRUCT FROM %s' % type(value))
def extractCString(self, addr):
result = bytearray()
@@ -1878,9 +1775,9 @@ class DumperBase:
isQMetaObject = origType == 'QMetaObject'
isQObject = origType == 'QObject'
- #warn('OBJECT GUTS: %s 0x%x ' % (self.currentIName, metaObjectPtr))
+ #DumperBase.warn('OBJECT GUTS: %s 0x%x ' % (self.currentIName, metaObjectPtr))
dataPtr = extractDataPtr(metaObjectPtr)
- #warn('DATA PTRS: %s 0x%x ' % (self.currentIName, dataPtr))
+ #DumperBase.warn('DATA PTRS: %s 0x%x ' % (self.currentIName, dataPtr))
(revision, classname,
classinfo, classinfo2,
methodCount, methods,
@@ -2048,18 +1945,18 @@ class DumperBase:
# LLDB doesn't like calling it on a derived class, possibly
# due to type information living in a different shared object.
#base = self.createValue(qobjectPtr, '@QObject')
- #warn("CALL FUNC: 0x%x" % self.qtPropertyFunc)
+ #DumperBase.warn("CALL FUNC: 0x%x" % self.qtPropertyFunc)
cmd = '((QVariant(*)(void*,char*))0x%x)((void*)0x%x,"%s")' \
% (self.qtPropertyFunc, qobjectPtr, name)
try:
- #warn('PROP CMD: %s' % cmd)
+ #DumperBase.warn('PROP CMD: %s' % cmd)
res = self.parseAndEvaluate(cmd)
- #warn('PROP RES: %s' % res)
+ #DumperBase.warn('PROP RES: %s' % res)
except:
self.bump('failedMetaObjectCall')
putt(name, ' ')
continue
- #warn('COULD NOT EXECUTE: %s' % cmd)
+ #DumperBase.warn('COULD NOT EXECUTE: %s' % cmd)
#self.putCallItem(name, '@QVariant', base, 'property', '"' + name + '"')
if res is None:
self.bump('failedMetaObjectCall2')
@@ -2205,19 +2102,19 @@ class DumperBase:
break
def currentItemFormat(self, typeName = None):
- displayFormat = self.formats.get(self.currentIName, AutomaticFormat)
- if displayFormat == AutomaticFormat:
+ displayFormat = self.formats.get(self.currentIName, DisplayFormat.AutomaticFormat)
+ if displayFormat == DisplayFormat.AutomaticFormat:
if typeName is None:
typeName = self.currentType.value
needle = None if typeName is None else self.stripForFormat(typeName)
- displayFormat = self.typeformats.get(needle, AutomaticFormat)
+ displayFormat = self.typeformats.get(needle, DisplayFormat.AutomaticFormat)
return displayFormat
def putSubItem(self, component, value): # -> ReportItem
if not isinstance(value, self.Value):
- error('WRONG VALUE TYPE IN putSubItem: %s' % type(value))
+ raise RuntimeError('WRONG VALUE TYPE IN putSubItem: %s' % type(value))
if not isinstance(value.type, self.Type):
- error('WRONG TYPE TYPE IN putSubItem: %s' % type(value.type))
+ raise RuntimeError('WRONG TYPE TYPE IN putSubItem: %s' % type(value.type))
res = None
with SubItem(self, component):
self.putItem(value)
@@ -2230,7 +2127,7 @@ class DumperBase:
addrBase = base
innerSize = innerType.size()
self.putNumChild(n)
- #warn('ADDRESS: 0x%x INNERSIZE: %s INNERTYPE: %s' % (addrBase, innerSize, innerType))
+ #DumperBase.warn('ADDRESS: 0x%x INNERSIZE: %s INNERTYPE: %s' % (addrBase, innerSize, innerType))
enc = innerType.simpleEncoding()
if enc:
self.put('childtype="%s",' % innerType.name)
@@ -2262,7 +2159,7 @@ class DumperBase:
if n > maxNumChild:
self.putField('plotelided', n) # FIXME: Act on that in frontend
n = maxNumChild
- if self.currentItemFormat() == ArrayPlotFormat and innerType.isSimpleType():
+ if self.currentItemFormat() == DisplayFormat.ArrayPlotFormat and innerType.isSimpleType():
enc = innerType.simpleEncoding()
if enc:
self.putField('editencoding', enc)
@@ -2302,7 +2199,7 @@ class DumperBase:
def extractPointer(self, value):
try:
- if value.type.code == TypeCodeArray:
+ if value.type.code == TypeCode.TypeCodeArray:
return value.address()
except:
pass
@@ -2337,7 +2234,7 @@ class DumperBase:
return val.extractSomething(pattern, bitsize)
if isinstance(value, self.Value):
return value.extractSomething(pattern, bitsize)
- error('CANT EXTRACT FROM %s' % type(value))
+ raise RuntimeError('CANT EXTRACT FROM %s' % type(value))
# Parses a..b and a.(s).b
def parseRange(self, exp):
@@ -2394,13 +2291,13 @@ class DumperBase:
self.putField('numchild', numchild)
def handleLocals(self, variables):
- #warn('VARIABLES: %s' % variables)
+ #DumperBase.warn('VARIABLES: %s' % variables)
#with self.timer('locals'):
shadowed = {}
for value in variables:
if value.name == 'argv':
- if value.type.code == TypeCodePointer:
- if value.type.ltarget.code == TypeCodePointer:
+ if value.type.code == TypeCode.TypeCodePointer:
+ if value.type.ltarget.code == TypeCode.TypeCodePointer:
if value.type.ltarget.ltarget.name == 'char':
self.putSpecialArgv(value)
continue
@@ -2430,7 +2327,7 @@ class DumperBase:
def handleWatch(self, origexp, exp, iname):
exp = str(exp).strip()
escapedExp = self.hexencode(exp)
- #warn('HANDLING WATCH %s -> %s, INAME: "%s"' % (origexp, exp, iname))
+ #DumperBase.warn('HANDLING WATCH %s -> %s, INAME: "%s"' % (origexp, exp, iname))
# Grouped items separated by semicolon.
if exp.find(';') >= 0:
@@ -2450,7 +2347,7 @@ class DumperBase:
# Special array index: e.g a[1..199] or a[1.(3).199] for stride 3.
isRange, begin, step, end, template = self.parseRange(exp)
if isRange:
- #warn('RANGE: %s %s %s in %s' % (begin, step, end, template))
+ #DumperBase.warn('RANGE: %s %s %s in %s' % (begin, step, end, template))
r = range(begin, end, step)
n = len(r)
with TopLevelItem(self, iname):
@@ -2632,7 +2529,7 @@ class DumperBase:
resdict = json.loads(payload)
continue
except:
- warn('Cannot parse native payload: %s' % payload)
+ self.warn('Cannot parse native payload: %s' % payload)
else:
print('interpreteralien=%s'
% {'service': service, 'payload': self.hexencode(payload)})
@@ -2640,7 +2537,7 @@ class DumperBase:
expr = 'qt_qmlDebugClearBuffer()'
res = self.parseAndEvaluate(expr)
except RuntimeError as error:
- warn('Cleaning buffer failed: %s: %s' % (expr, error))
+ self.warn('Cleaning buffer failed: %s: %s' % (expr, error))
return resdict
@@ -2651,14 +2548,14 @@ class DumperBase:
try:
res = self.parseAndEvaluate(expr)
except RuntimeError as error:
- warn('Interpreter command failed: %s: %s' % (encoded, error))
+ self.warn('Interpreter command failed: %s: %s' % (encoded, error))
return {}
except AttributeError as error:
# Happens with LLDB and 'None' current thread.
- warn('Interpreter command failed: %s: %s' % (encoded, error))
+ self.warn('Interpreter command failed: %s: %s' % (encoded, error))
return {}
if not res:
- warn('Interpreter command failed: %s ' % encoded)
+ self.warn('Interpreter command failed: %s ' % encoded)
return {}
return self.fetchInterpreterResult()
@@ -2683,7 +2580,7 @@ class DumperBase:
self.doContinue()
def doInsertInterpreterBreakpoint(self, args, wasPending):
- #warn('DO INSERT INTERPRETER BREAKPOINT, WAS PENDING: %s' % wasPending)
+ #DumperBase.warn('DO INSERT INTERPRETER BREAKPOINT, WAS PENDING: %s' % wasPending)
# Will fail if the service is not yet up and running.
response = self.sendInterpreterRequest('setbreakpoint', args)
bp = None if response is None else response.get('breakpoint', None)
@@ -2738,7 +2635,7 @@ class DumperBase:
self.putItemX(value)
def putItemX(self, value):
- #warn('PUT ITEM: %s' % value.stringify())
+ #DumperBase.warn('PUT ITEM: %s' % value.stringify())
typeobj = value.type #unqualified()
typeName = typeobj.name
@@ -2753,23 +2650,23 @@ class DumperBase:
return
if not isinstance(value, self.Value):
- error('WRONG TYPE IN putItem: %s' % type(self.Value))
+ raise RuntimeError('WRONG TYPE IN putItem: %s' % type(self.Value))
# Try on possibly typedefed type first.
if self.tryPutPrettyItem(typeName, value):
- if typeobj.code == TypeCodePointer:
+ if typeobj.code == TypeCode.TypeCodePointer:
self.putOriginalAddress(value.address())
else:
self.putAddress(value.address())
return
- if typeobj.code == TypeCodeTypedef:
- #warn('TYPEDEF VALUE: %s' % value.stringify())
+ if typeobj.code == TypeCode.TypeCodeTypedef:
+ #DumperBase.warn('TYPEDEF VALUE: %s' % value.stringify())
self.putItem(value.detypedef())
self.putBetterType(typeName)
return
- if typeobj.code == TypeCodePointer:
+ if typeobj.code == TypeCode.TypeCodePointer:
self.putFormattedPointer(value)
if value.summary and self.useFancy:
self.putValue(self.hexencode(value.summary), 'utf8:1:0')
@@ -2777,50 +2674,50 @@ class DumperBase:
self.putAddress(value.address())
- if typeobj.code == TypeCodeFunction:
- #warn('FUNCTION VALUE: %s' % value)
+ if typeobj.code == TypeCode.TypeCodeFunction:
+ #DumperBase.warn('FUNCTION VALUE: %s' % value)
self.putType(typeobj)
self.putSymbolValue(value.pointer())
self.putNumChild(0)
return
- if typeobj.code == TypeCodeEnum:
- #warn('ENUM VALUE: %s' % value.stringify())
+ if typeobj.code == TypeCode.TypeCodeEnum:
+ #DumperBase.warn('ENUM VALUE: %s' % value.stringify())
self.putType(typeobj.name)
self.putValue(value.display())
self.putNumChild(0)
return
- if typeobj.code == TypeCodeArray:
- #warn('ARRAY VALUE: %s' % value)
+ if typeobj.code == TypeCode.TypeCodeArray:
+ #DumperBase.warn('ARRAY VALUE: %s' % value)
self.putCStyleArray(value)
return
- if typeobj.code == TypeCodeBitfield:
- #warn('BITFIELD VALUE: %s %d %s' % (value.name, value.lvalue, typeName))
+ if typeobj.code == TypeCode.TypeCodeBitfield:
+ #DumperBase.warn('BITFIELD VALUE: %s %d %s' % (value.name, value.lvalue, typeName))
self.putNumChild(0)
dd = typeobj.ltarget.typeData().enumDisplay
self.putValue(str(value.lvalue) if dd is None else dd(value.lvalue, value.laddress, '%d'))
self.putType(typeName)
return
- if typeobj.code == TypeCodeIntegral:
- #warn('INTEGER: %s %s' % (value.name, value))
+ if typeobj.code == TypeCode.TypeCodeIntegral:
+ #DumperBase.warn('INTEGER: %s %s' % (value.name, value))
val = value.value()
self.putNumChild(0)
self.putValue(val)
self.putType(typeName)
return
- if typeobj.code == TypeCodeFloat:
- #warn('FLOAT VALUE: %s' % value)
+ if typeobj.code == TypeCode.TypeCodeFloat:
+ #DumperBase.warn('FLOAT VALUE: %s' % value)
self.putValue(value.value())
self.putNumChild(0)
self.putType(typeobj.name)
return
- if typeobj.code in (TypeCodeReference, TypeCodeRValueReference):
- #warn('REFERENCE VALUE: %s' % value)
+ if typeobj.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
+ #DumperBase.warn('REFERENCE VALUE: %s' % value)
val = value.dereference()
if val.laddress != 0:
self.putItem(val)
@@ -2829,13 +2726,13 @@ class DumperBase:
self.putBetterType(typeName)
return
- if typeobj.code == TypeCodeComplex:
+ if typeobj.code == TypeCode.TypeCodeComplex:
self.putType(typeobj)
self.putValue(value.display())
self.putNumChild(0)
return
- if typeobj.code == TypeCodeFortranString:
+ if typeobj.code == TypeCode.TypeCodeFortranString:
self.putValue(self.hexencode(value.data()), 'latin1')
self.putNumChild(0)
self.putType(typeobj)
@@ -2850,12 +2747,12 @@ class DumperBase:
self.putArrayData(base.pointer(), n, base.type.target())
return
- #warn('SOME VALUE: %s' % value)
- #warn('HAS CHILDREN VALUE: %s' % value.hasChildren())
- #warn('GENERIC STRUCT: %s' % typeobj)
- #warn('INAME: %s ' % self.currentIName)
- #warn('INAMES: %s ' % self.expandedINames)
- #warn('EXPANDED: %s ' % (self.currentIName in self.expandedINames))
+ #DumperBase.warn('SOME VALUE: %s' % value)
+ #DumperBase.warn('HAS CHILDREN VALUE: %s' % value.hasChildren())
+ #DumperBase.warn('GENERIC STRUCT: %s' % typeobj)
+ #DumperBase.warn('INAME: %s ' % self.currentIName)
+ #DumperBase.warn('INAMES: %s ' % self.expandedINames)
+ #DumperBase.warn('EXPANDED: %s ' % (self.currentIName in self.expandedINames))
self.putType(typeName)
if value.summary is not None and self.useFancy:
@@ -2865,7 +2762,7 @@ class DumperBase:
self.putNumChild(1)
self.putEmptyValue()
- #warn('STRUCT GUTS: %s ADDRESS: 0x%x ' % (value.name, value.address()))
+ #DumperBase.warn('STRUCT GUTS: %s ADDRESS: 0x%x ' % (value.name, value.address()))
if self.showQObjectNames:
#with self.timer(self.currentIName):
self.putQObjectNameValue(value)
@@ -2888,7 +2785,7 @@ class DumperBase:
if addr:
# Only available with Qt 5.3+
(hookVersion, x, x, x, x, x, tiVersion) = self.split('ppppppp', addr)
- #warn('HOOK: %s TI: %s' % (hookVersion, tiVersion))
+ #DumperBase.warn('HOOK: %s TI: %s' % (hookVersion, tiVersion))
if hookVersion >= 3:
self.qtTypeInfoVersion = lambda: tiVersion
return tiVersion
@@ -2948,12 +2845,12 @@ class DumperBase:
def check(self):
if self.laddress is not None and not self.dumper.isInt(self.laddress):
- error('INCONSISTENT ADDRESS: %s' % type(self.laddress))
+ raise RuntimeError('INCONSISTENT ADDRESS: %s' % type(self.laddress))
if self.type is not None and not isinstance(self.type, self.dumper.Type):
- error('INCONSISTENT TYPE: %s' % type(self.type))
+ raise RuntimeError('INCONSISTENT TYPE: %s' % type(self.type))
def __str__(self):
- #error('Not implemented')
+ #raise RuntimeError('Not implemented')
return self.stringify()
def __int__(self):
@@ -2987,14 +2884,14 @@ class DumperBase:
return '<unknown data>'
def pointer(self):
- if self.type.code == TypeCodeTypedef:
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.detypedef().pointer()
return self.extractInteger(self.dumper.ptrSize() * 8, True)
def integer(self, bitsize=None):
- if self.type.code == TypeCodeTypedef:
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.detypedef().integer()
- elif self.type.code == TypeCodeBitfield:
+ elif self.type.code == TypeCode.TypeCodeBitfield:
return self.lvalue
# Could be something like 'short unsigned int'
unsigned = self.type.name == 'unsigned' \
@@ -3007,7 +2904,7 @@ class DumperBase:
def floatingPoint(self):
if self.nativeValue is not None and not self.dumper.isCdb:
return str(self.nativeValue)
- if self.type.code == TypeCodeTypedef:
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.detypedef().floatingPoint()
if self.type.size() == 8:
return self.extractSomething('d', 64)
@@ -3022,7 +2919,7 @@ class DumperBase:
exp = (h & 0x7fff)
fraction = l
bit63 = (l >> 63) & 1
- #warn("SIGN: %s EXP: %s H: 0x%x L: 0x%x" % (sign, exp, h, l))
+ #DumperBase.warn("SIGN: %s EXP: %s H: 0x%x L: 0x%x" % (sign, exp, h, l))
if exp == 0:
if bit63 == 0:
if l == 0:
@@ -3039,7 +2936,7 @@ class DumperBase:
sign = h >> 63
exp = (h >> 48) & 0x7fff
fraction = h & (2**48 - 1)
- #warn("SIGN: %s EXP: %s FRAC: %s H: 0x%x L: 0x%x" % (sign, exp, fraction, h, l))
+ #DumperBase.warn("SIGN: %s EXP: %s FRAC: %s H: 0x%x L: 0x%x" % (sign, exp, fraction, h, l))
if exp == 0:
if fraction == 0:
res = -0.0 if sign else 0.0
@@ -3053,17 +2950,17 @@ class DumperBase:
def value(self):
if self.type is not None:
- if self.type.code == TypeCodeEnum:
+ if self.type.code == TypeCode.TypeCodeEnum:
return self.displayEnum()
- if self.type.code == TypeCodeTypedef:
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.detypedef().value()
- if self.type.code == TypeCodeIntegral:
+ if self.type.code == TypeCode.TypeCodeIntegral:
return self.integer()
- if self.type.code == TypeCodeBitfield:
+ if self.type.code == TypeCode.TypeCodeBitfield:
return self.integer()
- if self.type.code == TypeCodeFloat:
+ if self.type.code == TypeCode.TypeCodeFloat:
return self.floatingPoint()
- if self.type.code == TypeCodePointer:
+ if self.type.code == TypeCode.TypeCodePointer:
return self.pointer()
return None
@@ -3072,42 +2969,42 @@ class DumperBase:
def findMemberByName(self, name):
self.check()
- if self.type.code == TypeCodeTypedef:
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.findMemberByName(self.detypedef())
- if self.type.code in (TypeCodePointer, TypeCodeReference, TypeCodeRValueReference):
+ if self.type.code in (TypeCode.TypeCodePointer, TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
res = self.dereference().findMemberByName(name)
if res is not None:
return res
- if self.type.code == TypeCodeStruct:
- #warn('SEARCHING FOR MEMBER: %s IN %s' % (name, self.type.name))
+ if self.type.code == TypeCode.TypeCodeStruct:
+ #DumperBase.warn('SEARCHING FOR MEMBER: %s IN %s' % (name, self.type.name))
members = self.members(True)
- #warn('MEMBERS: %s' % members)
+ #DumperBase.warn('MEMBERS: %s' % members)
for member in members:
- #warn('CHECKING FIELD %s' % member.name)
- if member.type.code == TypeCodeTypedef:
+ #DumperBase.warn('CHECKING FIELD %s' % member.name)
+ if member.type.code == TypeCode.TypeCodeTypedef:
member = member.detypedef()
if member.name == name:
return member
for member in members:
- if member.type.code == TypeCodeTypedef:
+ if member.type.code == TypeCode.TypeCodeTypedef:
member = member.detypedef()
if member.name == name: # Could be base class.
return member
- if member.type.code == TypeCodeStruct:
+ if member.type.code == TypeCode.TypeCodeStruct:
res = member.findMemberByName(name)
if res is not None:
return res
return None
def __getitem__(self, index):
- #warn('GET ITEM %s %s' % (self, index))
+ #DumperBase.warn('GET ITEM %s %s' % (self, index))
self.check()
- if self.type.code == TypeCodeTypedef:
- #warn('GET ITEM STRIP TYPEDEFS TO %s' % self.type.ltarget)
+ if self.type.code == TypeCode.TypeCodeTypedef:
+ #DumperBase.warn('GET ITEM STRIP TYPEDEFS TO %s' % self.type.ltarget)
return self.cast(self.type.ltarget).__getitem__(index)
if isinstance(index, str):
- if self.type.code == TypeCodePointer:
- #warn('GET ITEM %s DEREFERENCE TO %s' % (self, self.dereference()))
+ if self.type.code == TypeCode.TypeCodePointer:
+ #DumperBase.warn('GET ITEM %s DEREFERENCE TO %s' % (self, self.dereference()))
return self.dereference().__getitem__(index)
res = self.findMemberByName(index)
if res is None:
@@ -3117,40 +3014,40 @@ class DumperBase:
elif isinstance(index, self.dumper.Field):
field = index
elif self.dumper.isInt(index):
- if self.type.code == TypeCodeArray:
+ if self.type.code == TypeCode.TypeCodeArray:
addr = self.laddress + int(index) * self.type.ltarget.size()
return self.dumper.createValue(addr, self.type.ltarget)
- if self.type.code == TypeCodePointer:
+ if self.type.code == TypeCode.TypeCodePointer:
addr = self.pointer() + int(index) * self.type.ltarget.size()
return self.dumper.createValue(addr, self.type.ltarget)
return self.members(False)[index]
else:
- error('BAD INDEX TYPE %s' % type(index))
+ raise RuntimeError('BAD INDEX TYPE %s' % type(index))
field.check()
- #warn('EXTRACT FIELD: %s, BASE 0x%x' % (field, self.address()))
- if self.type.code == TypeCodePointer:
- #warn('IS TYPEDEFED POINTER!')
+ #DumperBase.warn('EXTRACT FIELD: %s, BASE 0x%x' % (field, self.address()))
+ if self.type.code == TypeCode.TypeCodePointer:
+ #DumperBase.warn('IS TYPEDEFED POINTER!')
res = self.dereference()
- #warn('WAS POINTER: %s' % res)
+ #DumperBase.warn('WAS POINTER: %s' % res)
return field.extract(self)
def extractField(self, field):
if not isinstance(field, self.dumper.Field):
- error('BAD INDEX TYPE %s' % type(field))
+ raise RuntimeError('BAD INDEX TYPE %s' % type(field))
if field.extractor is not None:
val = field.extractor(self)
if val is not None:
- #warn('EXTRACTOR SUCCEEDED: %s ' % val)
+ #DumperBase.warn('EXTRACTOR SUCCEEDED: %s ' % val)
return val
- if self.type.code == TypeCodeTypedef:
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.cast(self.type.ltarget).extractField(field)
- if self.type.code in (TypeCodeReference, TypeCodeRValueReference):
+ if self.type.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
return self.dereference().extractField(field)
- #warn('FIELD: %s ' % field)
+ #DumperBase.warn('FIELD: %s ' % field)
val = self.dumper.Value(self.dumper)
val.name = field.name
val.isBaseClass = field.isBase
@@ -3169,7 +3066,7 @@ class DumperBase:
fieldOffset = fieldBitpos // 8
fieldType = field.fieldType()
- if fieldType.code == TypeCodeBitfield:
+ if fieldType.code == TypeCode.TypeCodeBitfield:
fieldBitpos -= fieldOffset * 8
ldata = self.data()
data = 0
@@ -3193,12 +3090,12 @@ class DumperBase:
else:
self.dumper.check(False)
- if fieldType.code in (TypeCodeReference, TypeCodeRValueReference):
+ if fieldType.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
if val.laddress is not None:
val = self.dumper.createReferenceValue(val.laddress, fieldType.ltarget)
val.name = field.name
- #warn('GOT VAL %s FOR FIELD %s' % (val, field))
+ #DumperBase.warn('GOT VAL %s FOR FIELD %s' % (val, field))
val.lbitsize = fieldBitsize
val.check()
return val
@@ -3207,8 +3104,8 @@ class DumperBase:
# The native backends replace it in their fromNativeValue()
# implementations.
def members(self, includeBases):
- #warn("LISTING MEMBERS OF %s" % self)
- if self.type.code == TypeCodeTypedef:
+ #DumperBase.warn("LISTING MEMBERS OF %s" % self)
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.detypedef().members(includeBases)
tdata = self.type.typeData()
@@ -3222,47 +3119,47 @@ class DumperBase:
else:
fields = list(tdata.lfields(self))
- #warn("FIELDS: %s" % fields)
+ #DumperBase.warn("FIELDS: %s" % fields)
res = []
for field in fields:
if isinstance(field, self.dumper.Value):
- #warn("USING VALUE DIRECTLY %s" % field.name)
+ #DumperBase.warn("USING VALUE DIRECTLY %s" % field.name)
res.append(field)
continue
if field.isBase and not includeBases:
- #warn("DROPPING BASE %s" % field.name)
+ #DumperBase.warn("DROPPING BASE %s" % field.name)
continue
res.append(self.extractField(field))
- #warn("GOT MEMBERS: %s" % res)
+ #DumperBase.warn("GOT MEMBERS: %s" % res)
return res
def __add__(self, other):
self.check()
if self.dumper.isInt(other):
stripped = self.type.stripTypedefs()
- if stripped.code == TypeCodePointer:
+ if stripped.code == TypeCode.TypeCodePointer:
address = self.pointer() + stripped.dereference().size() * other
val = self.dumper.Value(self.dumper)
val.laddress = None
val.ldata = bytes(struct.pack(self.dumper.packCode + 'Q', address))
val.type = self.type
return val
- error('BAD DATA TO ADD TO: %s %s' % (self.type, other))
+ raise RuntimeError('BAD DATA TO ADD TO: %s %s' % (self.type, other))
def __sub__(self, other):
self.check()
if self.type.name == other.type.name:
stripped = self.type.stripTypedefs()
- if stripped.code == TypeCodePointer:
+ if stripped.code == TypeCode.TypeCodePointer:
return (self.pointer() - other.pointer()) // stripped.dereference().size()
- error('BAD DATA TO SUB TO: %s %s' % (self.type, other))
+ raise RuntimeError('BAD DATA TO SUB TO: %s %s' % (self.type, other))
def dereference(self):
self.check()
- if self.type.code == TypeCodeTypedef:
+ if self.type.code == TypeCode.TypeCodeTypedef:
return self.detypedef().dereference()
val = self.dumper.Value(self.dumper)
- if self.type.code in (TypeCodeReference, TypeCodeRValueReference):
+ if self.type.code in (TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
val.summary = self.summary
if self.nativeValue is None:
val.laddress = self.pointer()
@@ -3271,16 +3168,16 @@ class DumperBase:
val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference())
else:
val = self.dumper.nativeValueDereferenceReference(self)
- elif self.type.code == TypeCodePointer:
+ elif self.type.code == TypeCode.TypeCodePointer:
if self.nativeValue is None:
val.laddress = self.pointer()
val.type = self.dumper.nativeDynamicType(val.laddress, self.type.dereference())
else:
val = self.dumper.nativeValueDereferencePointer(self)
else:
- error("WRONG: %s" % self.type.code)
- #warn("DEREFERENCING FROM: %s" % self)
- #warn("DEREFERENCING TO: %s" % val)
+ raise RuntimeError("WRONG: %s" % self.type.code)
+ #DumperBase.warn("DEREFERENCING FROM: %s" % self)
+ #DumperBase.warn("DEREFERENCING TO: %s" % val)
#dynTypeName = val.type.dynamicTypeName(val.laddress)
#if dynTypeName is not None:
# val.type = self.dumper.createType(dynTypeName)
@@ -3288,12 +3185,12 @@ class DumperBase:
def detypedef(self):
self.check()
- if self.type.code != TypeCodeTypedef:
- error("WRONG")
+ if self.type.code != TypeCode.TypeCodeTypedef:
+ raise RuntimeError("WRONG")
val = self.copy()
val.type = self.type.ltarget
- #warn("DETYPEDEF FROM: %s" % self)
- #warn("DETYPEDEF TO: %s" % val)
+ #DumperBase.warn("DETYPEDEF FROM: %s" % self)
+ #DumperBase.warn("DETYPEDEF TO: %s" % val)
return val
def extend(self, size):
@@ -3304,7 +3201,7 @@ class DumperBase:
return val
if self.type.size() == size:
return self
- error('NOT IMPLEMENTED')
+ raise RuntimeError('NOT IMPLEMENTED')
def zeroExtend(self, data, size):
ext = '\0' * (size - len(data))
@@ -3337,7 +3234,7 @@ class DumperBase:
return self.ldata
if size < len(self.ldata):
return self.ldata[:size]
- #error('ZERO-EXTENDING DATA TO %s BYTES: %s' % (size, self))
+ #raise RuntimeError('ZERO-EXTENDING DATA TO %s BYTES: %s' % (size, self))
return self.zeroExtend(self.ldata, size)
if self.laddress is not None:
if size is None:
@@ -3345,8 +3242,8 @@ class DumperBase:
res = self.dumper.readRawMemory(self.laddress, size)
if len(res) > 0:
return res
- error('CANNOT CONVERT ADDRESS TO BYTES: %s' % self)
- error('CANNOT CONVERT TO BYTES: %s' % self)
+ raise RuntimeError('CANNOT CONVERT ADDRESS TO BYTES: %s' % self)
+ raise RuntimeError('CANNOT CONVERT TO BYTES: %s' % self)
def extractInteger(self, bitsize, unsigned):
#with self.dumper.timer('extractInt'):
@@ -3365,7 +3262,7 @@ class DumperBase:
code = 'B' if unsigned else 'b'
rawBytes = self.data(size)
res = struct.unpack_from(self.dumper.packCode + code, rawBytes, 0)[0]
- #warn('Extract: Code: %s Bytes: %s Bitsize: %s Size: %s'
+ #DumperBase.warn('Extract: Code: %s Bytes: %s Bitsize: %s Size: %s'
# % (self.dumper.packCode + code, self.dumper.hexencode(rawBytes), bitsize, size))
return res
@@ -3382,25 +3279,25 @@ class DumperBase:
def split(self, pattern):
#with self.dumper.timer('split'):
- #warn('EXTRACT STRUCT FROM: %s' % self.type)
+ #DumperBase.warn('EXTRACT STRUCT FROM: %s' % self.type)
(pp, size, fields) = self.dumper.describeStruct(pattern)
- #warn('SIZE: %s ' % size)
+ #DumperBase.warn('SIZE: %s ' % size)
result = struct.unpack_from(self.dumper.packCode + pp, self.data(size))
def structFixer(field, thing):
- #warn('STRUCT MEMBER: %s' % type(thing))
+ #DumperBase.warn('STRUCT MEMBER: %s' % type(thing))
if field.isStruct:
#if field.type != field.fieldType():
- # error('DO NOT SIMPLIFY')
- #warn('FIELD POS: %s' % field.type.stringify())
- #warn('FIELD TYE: %s' % field.fieldType().stringify())
+ # raise RuntimeError('DO NOT SIMPLIFY')
+ #DumperBase.warn('FIELD POS: %s' % field.type.stringify())
+ #DumperBase.warn('FIELD TYE: %s' % field.fieldType().stringify())
res = self.dumper.createValue(thing, field.fieldType())
- #warn('RES TYPE: %s' % res.type)
+ #DumperBase.warn('RES TYPE: %s' % res.type)
if self.laddress is not None:
res.laddress = self.laddress + field.offset()
return res
return thing
if len(fields) != len(result):
- error('STRUCT ERROR: %s %s' % (fields, result))
+ raise RuntimeError('STRUCT ERROR: %s %s' % (fields, result))
return tuple(map(structFixer, fields, result))
def checkPointer(self, p, align = 1):
@@ -3424,14 +3321,14 @@ class DumperBase:
return (type_name[0:pos1].strip(), type_name[pos2+1:].strip(), int(item_count))
def registerType(self, typeId, tdata):
- #warn('REGISTER TYPE: %s' % typeId)
+ #DumperBase.warn('REGISTER TYPE: %s' % typeId)
self.typeData[typeId] = tdata
#typeId = typeId.replace(' ', '')
#self.typeData[typeId] = tdata
- #warn('REGISTERED: %s' % self.typeData)
+ #DumperBase.warn('REGISTERED: %s' % self.typeData)
def registerTypeAlias(self, existingTypeId, aliasId):
- #warn('REGISTER ALIAS %s FOR %s' % (aliasId, existingTypeId))
+ #DumperBase.warn('REGISTER ALIAS %s FOR %s' % (aliasId, existingTypeId))
self.typeData[aliasId] = self.typeData[existingTypeId]
class TypeData:
@@ -3475,13 +3372,13 @@ class DumperBase:
def typeData(self):
tdata = self.dumper.typeData.get(self.typeId, None)
if tdata is not None:
- #warn('USING : %s' % self.typeId)
+ #DumperBase.warn('USING : %s' % self.typeId)
return tdata
typeId = self.typeId.replace(' ', '')
if tdata is not None:
- #warn('USING FALLBACK : %s' % self.typeId)
+ #DumperBase.warn('USING FALLBACK : %s' % self.typeId)
return tdata
- #warn('EXPANDING LAZILY: %s' % self.typeId)
+ #DumperBase.warn('EXPANDING LAZILY: %s' % self.typeId)
self.dumper.lookupType(self.typeId)
return self.dumper.typeData.get(self.typeId)
@@ -3522,19 +3419,19 @@ class DumperBase:
def __getitem__(self, index):
if self.dumper.isInt(index):
return self.templateArgument(index)
- error('CANNOT INDEX TYPE')
+ raise RuntimeError('CANNOT INDEX TYPE')
def dynamicTypeName(self, address):
tdata = self.typeData()
if tdata is None:
return None
- if tdata.code != TypeCodeStruct:
+ if tdata.code != TypeCode.TypeCodeStruct:
return None
try:
vtbl = self.dumper.extractPointer(address)
except:
return None
- #warn('VTBL: 0x%x' % vtbl)
+ #DumperBase.warn('VTBL: 0x%x' % vtbl)
if not self.dumper.couldBePointer(vtbl):
return None
return self.dumper.nativeDynamicTypeName(address, self)
@@ -3552,12 +3449,12 @@ class DumperBase:
def check(self):
tdata = self.typeData()
if tdata is None:
- error('TYPE WITHOUT DATA: %s ALL: %s' % (self.typeId, self.dumper.typeData.keys()))
+ raise RuntimeError('TYPE WITHOUT DATA: %s ALL: %s' % (self.typeId, self.dumper.typeData.keys()))
if tdata.name is None:
- error('TYPE WITHOUT NAME: %s' % self.typeId)
+ raise RuntimeError('TYPE WITHOUT NAME: %s' % self.typeId)
def dereference(self):
- if self.code == TypeCodeTypedef:
+ if self.code == TypeCode.TypeCodeTypedef:
return self.ltarget.dereference()
self.check()
return self.ltarget
@@ -3573,18 +3470,18 @@ class DumperBase:
def templateArgument(self, position):
tdata = self.typeData()
- #warn('TDATA: %s' % tdata)
- #warn('ID: %s' % self.typeId)
+ #DumperBase.warn('TDATA: %s' % tdata)
+ #DumperBase.warn('ID: %s' % self.typeId)
if tdata is None:
# Native lookups didn't help. Happens for 'wrong' placement of 'const'
# etc. with LLDB. But not all is lost:
ta = self.dumper.listTemplateParameters(self.typeId)
- #warn('MANUAL: %s' % ta)
+ #DumperBase.warn('MANUAL: %s' % ta)
res = ta[position]
- #warn('RES: %s' % res.typeId)
+ #DumperBase.warn('RES: %s' % res.typeId)
return res
- #warn('TA: %s %s' % (position, self.typeId))
- #warn('ARGS: %s' % tdata.templateArguments)
+ #DumperBase.warn('TA: %s %s' % (position, self.typeId))
+ #DumperBase.warn('ARGS: %s' % tdata.templateArguments)
return tdata.templateArguments[position]
def simpleEncoding(self):
@@ -3605,18 +3502,18 @@ class DumperBase:
return res
def isSimpleType(self):
- return self.code in (TypeCodeIntegral, TypeCodeFloat, TypeCodeEnum)
+ return self.code in (TypeCode.TypeCodeIntegral, TypeCode.TypeCodeFloat, TypeCode.TypeCodeEnum)
def alignment(self):
tdata = self.typeData()
- if tdata.code == TypeCodeTypedef:
+ if tdata.code == TypeCode.TypeCodeTypedef:
return tdata.ltarget.alignment()
- if tdata.code in (TypeCodeIntegral, TypeCodeFloat, TypeCodeEnum):
+ if tdata.code in (TypeCode.TypeCodeIntegral, TypeCode.TypeCodeFloat, TypeCode.TypeCodeEnum):
if tdata.name in ('double', 'long long', 'unsigned long long'):
# Crude approximation.
return 8 if self.dumper.isWindowsTarget() else self.dumper.ptrSize()
return self.size()
- if tdata.code in (TypeCodePointer, TypeCodeReference, TypeCodeRValueReference):
+ if tdata.code in (TypeCode.TypeCodePointer, TypeCode.TypeCodeReference, TypeCode.TypeCodeRValueReference):
return self.dumper.ptrSize()
if tdata.lalignment is not None:
#if isinstance(tdata.lalignment, function): # Does not work that way.
@@ -3632,24 +3529,24 @@ class DumperBase:
return self.typeData().ltarget
def stripTypedefs(self):
- if isinstance(self, self.dumper.Type) and self.code != TypeCodeTypedef:
- #warn('NO TYPEDEF: %s' % self)
+ if isinstance(self, self.dumper.Type) and self.code != TypeCode.TypeCodeTypedef:
+ #DumperBase.warn('NO TYPEDEF: %s' % self)
return self
return self.ltarget
def size(self):
bs = self.bitsize()
if bs % 8 != 0:
- warn('ODD SIZE: %s' % self)
+ DumperBase.warn('ODD SIZE: %s' % self)
return (7 + bs) >> 3
def bitsize(self):
if self.lbitsize is not None:
return self.lbitsize
- error('DONT KNOW SIZE: %s' % self)
+ raise RuntimeError('DONT KNOW SIZE: %s' % self)
def isMovableType(self):
- if self.code in (TypeCodePointer, TypeCodeIntegral, TypeCodeFloat):
+ if self.code in (TypeCode.TypeCodePointer, TypeCode.TypeCodeIntegral, TypeCode.TypeCodeFloat):
return True
strippedName = self.dumper.stripNamespaceFromType(self.name)
if strippedName in (
@@ -3704,7 +3601,7 @@ class DumperBase:
def fieldType(self):
if self.type is not None:
return self.type
- error('CANT GET FIELD TYPE FOR %s' % self)
+ raise RuntimeError('CANT GET FIELD TYPE FOR %s' % self)
return None
def ptrCode(self):
@@ -3712,7 +3609,7 @@ class DumperBase:
def toPointerData(self, address):
if not self.isInt(address):
- error('wrong')
+ raise RuntimeError('wrong')
return bytes(struct.pack(self.packCode + self.ptrCode(), address))
def fromPointerData(self, bytes_value):
@@ -3720,10 +3617,10 @@ class DumperBase:
def createPointerValue(self, targetAddress, targetTypish):
if not isinstance(targetTypish, self.Type) and not isinstance(targetTypish, str):
- error('Expected type in createPointerValue(), got %s'
+ raise RuntimeError('Expected type in createPointerValue(), got %s'
% type(targetTypish))
if not self.isInt(targetAddress):
- error('Expected integral address value in createPointerValue(), got %s'
+ raise RuntimeError('Expected integral address value in createPointerValue(), got %s'
% type(targetTypish))
val = self.Value(self)
val.ldata = self.toPointerData(targetAddress)
@@ -3733,10 +3630,10 @@ class DumperBase:
def createReferenceValue(self, targetAddress, targetType):
if not isinstance(targetType, self.Type):
- error('Expected type in createReferenceValue(), got %s'
+ raise RuntimeError('Expected type in createReferenceValue(), got %s'
% type(targetType))
if not self.isInt(targetAddress):
- error('Expected integral address value in createReferenceValue(), got %s'
+ raise RuntimeError('Expected integral address value in createReferenceValue(), got %s'
% type(targetType))
val = self.Value(self)
val.ldata = self.toPointerData(targetAddress)
@@ -3746,27 +3643,27 @@ class DumperBase:
def createPointerType(self, targetType):
if not isinstance(targetType, self.Type):
- error('Expected type in createPointerType(), got %s'
+ raise RuntimeError('Expected type in createPointerType(), got %s'
% type(targetType))
typeId = targetType.typeId + ' *'
tdata = self.TypeData(self)
tdata.name = targetType.name + '*'
tdata.typeId = typeId
tdata.lbitsize = 8 * self.ptrSize()
- tdata.code = TypeCodePointer
+ tdata.code = TypeCode.TypeCodePointer
tdata.ltarget = targetType
self.registerType(typeId, tdata)
return self.Type(self, typeId)
def createReferenceType(self, targetType):
if not isinstance(targetType, self.Type):
- error('Expected type in createReferenceType(), got %s'
+ raise RuntimeError('Expected type in createReferenceType(), got %s'
% type(targetType))
typeId = targetType.typeId + ' &'
tdata = self.TypeData(self)
tdata.name = targetType.name + ' &'
tdata.typeId = typeId
- tdata.code = TypeCodeReference
+ tdata.code = TypeCode.TypeCodeReference
tdata.ltarget = targetType
tdata.lbitsize = 8 * self.ptrSize() # Needed for Gdb13393 test.
#tdata.lbitsize = None
@@ -3775,13 +3672,13 @@ class DumperBase:
def createRValueReferenceType(self, targetType):
if not isinstance(targetType, self.Type):
- error('Expected type in createRValueReferenceType(), got %s'
+ raise RuntimeError('Expected type in createRValueReferenceType(), got %s'
% type(targetType))
typeId = targetType.typeId + ' &&'
tdata = self.TypeData(self)
tdata.name = targetType.name + ' &&'
tdata.typeId = typeId
- tdata.code = TypeCodeRValueReference
+ tdata.code = TypeCode.TypeCodeRValueReference
tdata.ltarget = targetType
tdata.lbitsize = None
self.registerType(typeId, tdata)
@@ -3789,7 +3686,7 @@ class DumperBase:
def createArrayType(self, targetType, count):
if not isinstance(targetType, self.Type):
- error('Expected type in createArrayType(), got %s'
+ raise RuntimeError('Expected type in createArrayType(), got %s'
% type(targetType))
targetTypeId = targetType.typeId
@@ -3804,7 +3701,7 @@ class DumperBase:
tdata = self.TypeData(self)
tdata.name = type_name
tdata.typeId = type_id
- tdata.code = TypeCodeArray
+ tdata.code = TypeCode.TypeCodeArray
tdata.ltarget = targetType
tdata.lbitsize = targetType.lbitsize * count
self.registerType(type_id, tdata)
@@ -3812,13 +3709,13 @@ class DumperBase:
def createBitfieldType(self, targetType, bitsize):
if not isinstance(targetType, self.Type):
- error('Expected type in createBitfieldType(), got %s'
+ raise RuntimeError('Expected type in createBitfieldType(), got %s'
% type(targetType))
typeId = '%s:%d' % (targetType.typeId, bitsize)
tdata = self.TypeData(self)
tdata.name = '%s : %d' % (targetType.typeId, bitsize)
tdata.typeId = typeId
- tdata.code = TypeCodeBitfield
+ tdata.code = TypeCode.TypeCodeBitfield
tdata.ltarget = targetType
tdata.lbitsize = bitsize
self.registerType(typeId, tdata)
@@ -3828,7 +3725,7 @@ class DumperBase:
if typeId is None:
typeId = typeName
if not isinstance(targetType, self.Type):
- error('Expected type in createTypedefType(), got %s'
+ raise RuntimeError('Expected type in createTypedefType(), got %s'
% type(targetType))
# Happens for C-style struct in GDB: typedef { int x; } struct S1;
if targetType.typeId == typeId:
@@ -3836,7 +3733,7 @@ class DumperBase:
tdata = self.TypeData(self)
tdata.name = typeName
tdata.typeId = typeId
- tdata.code = TypeCodeTypedef
+ tdata.code = TypeCode.TypeCodeTypedef
tdata.ltarget = targetType
tdata.lbitsize = targetType.lbitsize
#tdata.lfields = targetType.lfields
@@ -3889,12 +3786,12 @@ class DumperBase:
return self.Type(self, typish)
knownType = self.lookupType(typish)
- #warn('KNOWN: %s' % knownType)
+ #DumperBase.warn('KNOWN: %s' % knownType)
if knownType is not None:
- #warn('USE FROM NATIVE')
+ #DumperBase.warn('USE FROM NATIVE')
return knownType
- #warn('FAKING: %s SIZE: %s' % (typish, size))
+ #DumperBase.warn('FAKING: %s SIZE: %s' % (typish, size))
tdata = self.TypeData(self)
tdata.name = typish
tdata.typeId = typish
@@ -3903,25 +3800,25 @@ class DumperBase:
tdata.lbitsize = 8 * size
self.registerType(typish, tdata)
typeobj = self.Type(self, typish)
- #warn('CREATE TYPE: %s' % typeobj.stringify())
+ #DumperBase.warn('CREATE TYPE: %s' % typeobj.stringify())
typeobj.check()
return typeobj
- error('NEED TYPE, NOT %s' % type(typish))
+ raise RuntimeError('NEED TYPE, NOT %s' % type(typish))
def createValue(self, datish, typish):
val = self.Value(self)
val.type = self.createType(typish)
if self.isInt(datish): # Used as address.
- #warn('CREATING %s AT 0x%x' % (val.type.name, datish))
+ #DumperBase.warn('CREATING %s AT 0x%x' % (val.type.name, datish))
val.laddress = datish
val.type = val.type.dynamicType(datish)
return val
if isinstance(datish, bytes):
- #warn('CREATING %s WITH DATA %s' % (val.type.name, self.hexencode(datish)))
+ #DumperBase.warn('CREATING %s WITH DATA %s' % (val.type.name, self.hexencode(datish)))
val.ldata = datish
val.check()
return val
- error('EXPECTING ADDRESS OR BYTES, GOT %s' % type(datish))
+ raise RuntimeError('EXPECTING ADDRESS OR BYTES, GOT %s' % type(datish))
def createContainerItem(self, data, innerTypish, container):
innerType = self.createType(innerTypish)
@@ -3966,7 +3863,7 @@ class DumperBase:
if self.autoPadNext:
self.currentBitsize = 8 * ((self.currentBitsize + 7) >> 3) # Fill up byte.
padding = (fieldAlign - (self.currentBitsize >> 3)) % fieldAlign
- #warn('AUTO PADDING AT %s BITS BY %s BYTES' % (self.currentBitsize, padding))
+ #DumperBase.warn('AUTO PADDING AT %s BITS BY %s BYTES' % (self.currentBitsize, padding))
field = self.dumper.Field(self.dumper, bitpos=self.currentBitsize,
bitsize=padding*8)
self.pattern += '%ds' % padding
@@ -3976,7 +3873,7 @@ class DumperBase:
if fieldAlign > self.maxAlign:
self.maxAlign = fieldAlign
- #warn("MAX ALIGN: %s" % self.maxAlign)
+ #DumperBase.warn("MAX ALIGN: %s" % self.maxAlign)
field = self.dumper.Field(dumper=self.dumper, name=fieldName, type=fieldType,
isStruct=fieldIsStruct, bitpos=self.currentBitsize,
@@ -4046,7 +3943,7 @@ class DumperBase:
builder.fields.append(field)
n = None
else:
- error('UNKNOWN STRUCT CODE: %s' % c)
+ raise RuntimeError('UNKNOWN STRUCT CODE: %s' % c)
pp = builder.pattern
size = (builder.currentBitsize + 7) >> 3
fields = builder.fields
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py
index 6a912ea388d..c50ba14281c 100644
--- a/share/qtcreator/debugger/gdbbridge.py
+++ b/share/qtcreator/debugger/gdbbridge.py
@@ -37,8 +37,8 @@ import struct
import tempfile
import types
-from dumper import *
-
+from dumper import DumperBase, Children, toInteger, TopLevelItem
+from utils import TypeCode
#######################################################################
#
@@ -168,7 +168,7 @@ def importPlainDumpers(args):
gdb.execute('disable pretty-printer .* .*')
except:
# Might occur in non-ASCII directories
- warn('COULD NOT DISABLE PRETTY PRINTERS')
+ DumperBase.warn('COULD NOT DISABLE PRETTY PRINTERS')
else:
theDumper.importPlainDumpers()
@@ -186,7 +186,7 @@ class OutputSaver:
def __exit__(self, exType, exValue, exTraceBack):
if self.d.passExceptions and not exType is None:
- showException('OUTPUTSAVER', exType, exValue, exTraceBack)
+ self.d.showException('OUTPUTSAVER', exType, exValue, exTraceBack)
self.d.output = self.savedOutput
else:
self.savedOutput += self.d.output
@@ -217,7 +217,7 @@ class Dumper(DumperBase):
self.setVariableFetchingOptions(args)
def fromFrameValue(self, nativeValue):
- #warn('FROM FRAME VALUE: %s' % nativeValue.address)
+ #DumperBase.warn('FROM FRAME VALUE: %s' % nativeValue.address)
val = nativeValue
try:
val = nativeValue.cast(nativeValue.dynamic_type)
@@ -226,7 +226,7 @@ class Dumper(DumperBase):
return self.fromNativeValue(val)
def fromNativeValue(self, nativeValue):
- #warn('FROM NATIVE VALUE: %s' % nativeValue)
+ #DumperBase.warn('FROM NATIVE VALUE: %s' % nativeValue)
self.check(isinstance(nativeValue, gdb.Value))
nativeType = nativeValue.type
code = nativeType.code
@@ -234,7 +234,7 @@ class Dumper(DumperBase):
targetType = self.fromNativeType(nativeType.target().unqualified())
val = self.createReferenceValue(toInteger(nativeValue.address), targetType)
val.nativeValue = nativeValue
- #warn('CREATED REF: %s' % val)
+ #DumperBase.warn('CREATED REF: %s' % val)
return val
if code == gdb.TYPE_CODE_PTR:
try:
@@ -248,14 +248,14 @@ class Dumper(DumperBase):
# later which
# is surprisingly expensive.
val.nativeValue = nativeValue
- #warn('CREATED PTR 1: %s' % val)
+ #DumperBase.warn('CREATED PTR 1: %s' % val)
if not nativeValue.address is None:
val.laddress = toInteger(nativeValue.address)
- #warn('CREATED PTR 2: %s' % val)
+ #DumperBase.warn('CREATED PTR 2: %s' % val)
return val
if code == gdb.TYPE_CODE_TYPEDEF:
targetType = nativeType.strip_typedefs().unqualified()
- #warn('TARGET TYPE: %s' % targetType)
+ #DumperBase.warn('TARGET TYPE: %s' % targetType)
if targetType.code == gdb.TYPE_CODE_ARRAY:
val = self.Value(self)
else:
@@ -267,7 +267,7 @@ class Dumper(DumperBase):
val = self.fromNativeValue(nativeValue.cast(targetType))
except:
val = self.Value(self)
- #warn('CREATED TYPEDEF: %s' % val)
+ #DumperBase.warn('CREATED TYPEDEF: %s' % val)
else:
val = self.Value(self)
@@ -308,34 +308,34 @@ class Dumper(DumperBase):
def fromNativeType(self, nativeType):
self.check(isinstance(nativeType, gdb.Type))
code = nativeType.code
- #warn('FROM NATIVE TYPE: %s' % nativeType)
+ #DumperBase.warn('FROM NATIVE TYPE: %s' % nativeType)
nativeType = nativeType.unqualified()
if code == gdb.TYPE_CODE_PTR:
- #warn('PTR')
+ #DumperBase.warn('PTR')
targetType = self.fromNativeType(nativeType.target().unqualified())
return self.createPointerType(targetType)
if code == gdb.TYPE_CODE_REF:
- #warn('REF')
+ #DumperBase.warn('REF')
targetType = self.fromNativeType(nativeType.target().unqualified())
return self.createReferenceType(targetType)
if hasattr(gdb, "TYPE_CODE_RVALUE_REF"):
if code == gdb.TYPE_CODE_RVALUE_REF:
- #warn('RVALUEREF')
+ #DumperBase.warn('RVALUEREF')
targetType = self.fromNativeType(nativeType.target())
return self.createRValueReferenceType(targetType)
if code == gdb.TYPE_CODE_ARRAY:
- #warn('ARRAY')
+ #DumperBase.warn('ARRAY')
nativeTargetType = nativeType.target().unqualified()
targetType = self.fromNativeType(nativeTargetType)
count = nativeType.sizeof // nativeTargetType.sizeof
return self.createArrayType(targetType, count)
if code == gdb.TYPE_CODE_TYPEDEF:
- #warn('TYPEDEF')
+ #DumperBase.warn('TYPEDEF')
nativeTargetType = nativeType.unqualified()
while nativeTargetType.code == gdb.TYPE_CODE_TYPEDEF:
nativeTargetType = nativeTargetType.strip_typedefs().unqualified()
@@ -344,7 +344,7 @@ class Dumper(DumperBase):
self.nativeTypeId(nativeType))
if code == gdb.TYPE_CODE_ERROR:
- warn('Type error: %s' % nativeType)
+ self.warn('Type error: %s' % nativeType)
return self.Type(self, '')
typeId = self.nativeTypeId(nativeType)
@@ -356,28 +356,28 @@ class Dumper(DumperBase):
tdata.lbitsize = nativeType.sizeof * 8
tdata.code = {
#gdb.TYPE_CODE_TYPEDEF : TypeCodeTypedef, # Handled above.
- gdb.TYPE_CODE_METHOD : TypeCodeFunction,
- gdb.TYPE_CODE_VOID : TypeCodeVoid,
- gdb.TYPE_CODE_FUNC : TypeCodeFunction,
- gdb.TYPE_CODE_METHODPTR : TypeCodeFunction,
- gdb.TYPE_CODE_MEMBERPTR : TypeCodeFunction,
- #gdb.TYPE_CODE_PTR : TypeCodePointer, # Handled above.
- #gdb.TYPE_CODE_REF : TypeCodeReference, # Handled above.
- gdb.TYPE_CODE_BOOL : TypeCodeIntegral,
- gdb.TYPE_CODE_CHAR : TypeCodeIntegral,
- gdb.TYPE_CODE_INT : TypeCodeIntegral,
- gdb.TYPE_CODE_FLT : TypeCodeFloat,
- gdb.TYPE_CODE_ENUM : TypeCodeEnum,
- #gdb.TYPE_CODE_ARRAY : TypeCodeArray,
- gdb.TYPE_CODE_STRUCT : TypeCodeStruct,
- gdb.TYPE_CODE_UNION : TypeCodeStruct,
- gdb.TYPE_CODE_COMPLEX : TypeCodeComplex,
- gdb.TYPE_CODE_STRING : TypeCodeFortranString,
+ gdb.TYPE_CODE_METHOD : TypeCode.TypeCodeFunction,
+ gdb.TYPE_CODE_VOID : TypeCode.TypeCodeVoid,
+ gdb.TYPE_CODE_FUNC : TypeCode.TypeCodeFunction,
+ gdb.TYPE_CODE_METHODPTR : TypeCode.TypeCodeFunction,
+ gdb.TYPE_CODE_MEMBERPTR : TypeCode.TypeCodeFunction,
+ #gdb.TYPE_CODE_PTR : TypeCode.TypeCodePointer, # Handled above.
+ #gdb.TYPE_CODE_REF : TypeCode.TypeCodeReference, # Handled above.
+ gdb.TYPE_CODE_BOOL : TypeCode.TypeCodeIntegral,
+ gdb.TYPE_CODE_CHAR : TypeCode.TypeCodeIntegral,
+ gdb.TYPE_CODE_INT : TypeCode.TypeCodeIntegral,
+ gdb.TYPE_CODE_FLT : TypeCode.TypeCodeFloat,
+ gdb.TYPE_CODE_ENUM : TypeCode.TypeCodeEnum,
+ #gdb.TYPE_CODE_ARRAY : TypeCode.TypeCodeArray,
+ gdb.TYPE_CODE_STRUCT : TypeCode.TypeCodeStruct,
+ gdb.TYPE_CODE_UNION : TypeCode.TypeCodeStruct,
+ gdb.TYPE_CODE_COMPLEX : TypeCode.TypeCodeComplex,
+ gdb.TYPE_CODE_STRING : TypeCode.TypeCodeFortranString,
}[code]
- if tdata.code == TypeCodeEnum:
+ if tdata.code == TypeCode.TypeCodeEnum:
tdata.enumDisplay = lambda intval, addr, form : \
self.nativeTypeEnumDisplay(nativeType, intval, form)
- if tdata.code == TypeCodeStruct:
+ if tdata.code == TypeCode.TypeCodeStruct:
tdata.lalignment = lambda : \
self.nativeStructAlignment(nativeType)
tdata.lfields = lambda value : \
@@ -402,7 +402,7 @@ class Dumper(DumperBase):
elif isinstance(targ, gdb.Value):
targs.append(self.fromNativeValue(targ).value())
else:
- error('UNKNOWN TEMPLATE PARAMETER')
+ raise RuntimeError('UNKNOWN TEMPLATE PARAMETER')
pos += 1
targs2 = self.listTemplateParametersManually(str(nativeType))
return targs if len(targs) >= len(targs2) else targs2
@@ -451,7 +451,7 @@ class Dumper(DumperBase):
return typeId
def nativeStructAlignment(self, nativeType):
- #warn('NATIVE ALIGN FOR %s' % nativeType.name)
+ #DumperBase.warn('NATIVE ALIGN FOR %s' % nativeType.name)
def handleItem(nativeFieldType, align):
a = self.fromNativeType(nativeFieldType).alignment()
return a if a > align else align
@@ -507,7 +507,7 @@ class Dumper(DumperBase):
anonNumber = 0
- #warn('LISTING FIELDS FOR %s' % nativeType)
+ #DumperBase.warn('LISTING FIELDS FOR %s' % nativeType)
for nativeField in nativeType.fields():
fieldName = nativeField.name
# Something without a name.
@@ -521,7 +521,7 @@ class Dumper(DumperBase):
# multiple anonymous unions in the struct.
anonNumber += 1
fieldName = '#%s' % anonNumber
- #warn('FIELD: %s' % fieldName)
+ #DumperBase.warn('FIELD: %s' % fieldName)
# hasattr(nativeField, 'bitpos') == False indicates a static field,
# but if we have access to a nativeValue .fromNativeField will
# also succeed. We essentially skip only static members from
@@ -531,8 +531,8 @@ class Dumper(DumperBase):
def fromNativeField(self, nativeField, nativeValue, fieldName):
nativeFieldType = nativeField.type.unqualified()
- #warn(' TYPE: %s' % nativeFieldType)
- #warn(' TYPEID: %s' % self.nativeTypeId(nativeFieldType))
+ #DumperBase.warn(' TYPE: %s' % nativeFieldType)
+ #DumperBase.warn(' TYPEID: %s' % self.nativeTypeId(nativeFieldType))
if hasattr(nativeField, 'bitpos'):
bitpos = nativeField.bitpos
@@ -562,7 +562,7 @@ class Dumper(DumperBase):
capturedFieldName,
value)
- #warn("FOUND NATIVE FIELD: %s bitpos: %s" % (fieldName, bitpos))
+ #DumperBase.warn("FOUND NATIVE FIELD: %s bitpos: %s" % (fieldName, bitpos))
return self.Field(dumper=self, name=fieldName, isBase=nativeField.is_base_class,
bitsize=bitsize, bitpos=bitpos, type=fieldType,
extractor=extractor)
@@ -574,19 +574,19 @@ class Dumper(DumperBase):
try:
block = frame.block()
- #warn('BLOCK: %s ' % block)
+ #DumperBase.warn('BLOCK: %s ' % block)
except RuntimeError as error:
- #warn('BLOCK IN FRAME NOT ACCESSIBLE: %s' % error)
+ #DumperBase.warn('BLOCK IN FRAME NOT ACCESSIBLE: %s' % error)
return []
except:
- warn('BLOCK NOT ACCESSIBLE FOR UNKNOWN REASONS')
+ self.warn('BLOCK NOT ACCESSIBLE FOR UNKNOWN REASONS')
return []
items = []
shadowed = {}
while True:
if block is None:
- warn("UNEXPECTED 'None' BLOCK")
+ self.warn("UNEXPECTED 'None' BLOCK")
break
for symbol in block:
@@ -602,12 +602,12 @@ class Dumper(DumperBase):
# 'NotImplementedError: Symbol type not yet supported in
# Python scripts.'
- #warn('SYMBOL %s (%s, %s)): ' % (symbol, name, symbol.name))
+ #DumperBase.warn('SYMBOL %s (%s, %s)): ' % (symbol, name, symbol.name))
if self.passExceptions and not self.isTesting:
nativeValue = frame.read_var(name, block)
value = self.fromFrameValue(nativeValue)
value.name = name
- #warn('READ 0: %s' % value.stringify())
+ #DumperBase.warn('READ 0: %s' % value.stringify())
items.append(value)
continue
@@ -616,14 +616,14 @@ class Dumper(DumperBase):
nativeValue = frame.read_var(name, block)
value = self.fromFrameValue(nativeValue)
value.name = name
- #warn('READ 1: %s' % value.stringify())
+ #DumperBase.warn('READ 1: %s' % value.stringify())
items.append(value)
continue
except:
pass
try:
- #warn('READ 2: %s' % item.value)
+ #DumperBase.warn('READ 2: %s' % item.value)
value = self.fromFrameValue(frame.read_var(name))
value.name = name
items.append(value)
@@ -637,8 +637,8 @@ class Dumper(DumperBase):
pass
try:
- #warn('READ 3: %s %s' % (name, item.value))
- #warn('ITEM 3: %s' % item.value)
+ #DumperBase.warn('READ 3: %s %s' % (name, item.value))
+ #DumperBase.warn('ITEM 3: %s' % item.value)
value = self.fromFrameValue(gdb.parse_and_eval(name))
value.name = name
items.append(value)
@@ -685,7 +685,7 @@ class Dumper(DumperBase):
partialName = partialVar.split('.')[1].split('@')[0] if isPartial else None
variables = self.listLocals(partialName)
- #warn('VARIABLES: %s' % variables)
+ #DumperBase.warn('VARIABLES: %s' % variables)
# Take care of the return value of the last function call.
if len(self.resultVarName) > 0:
@@ -728,13 +728,13 @@ class Dumper(DumperBase):
return None if val is None else self.fromNativeValue(val)
def nativeParseAndEvaluate(self, exp):
- #warn('EVALUATE "%s"' % exp)
+ #DumperBase.warn('EVALUATE "%s"' % exp)
try:
val = gdb.parse_and_eval(exp)
return val
except RuntimeError as error:
if self.passExceptions:
- warn("Cannot evaluate '%s': %s" % (exp, error))
+ self.warn("Cannot evaluate '%s': %s" % (exp, error))
return None
def callHelper(self, rettype, value, function, args):
@@ -749,7 +749,7 @@ class Dumper(DumperBase):
else:
arg += a
- #warn('CALL: %s -> %s(%s)' % (value, function, arg))
+ #DumperBase.warn('CALL: %s -> %s(%s)' % (value, function, arg))
typeName = value.type.name
if typeName.find(':') >= 0:
typeName = "'" + typeName + "'"
@@ -758,11 +758,11 @@ class Dumper(DumperBase):
addr = value.address()
if addr is None:
addr = self.pokeValue(value)
- #warn('PTR: %s -> %s(%s)' % (value, function, addr))
+ #DumperBase.warn('PTR: %s -> %s(%s)' % (value, function, addr))
exp = '((%s*)0x%x)->%s(%s)' % (typeName, addr, function, arg)
- #warn('CALL: %s' % exp)
+ #DumperBase.warn('CALL: %s' % exp)
result = gdb.parse_and_eval(exp)
- #warn(' -> %s' % result)
+ #DumperBase.warn(' -> %s' % result)
res = self.fromNativeValue(result)
if value.address() is None:
self.releaseValue(addr)
@@ -770,9 +770,9 @@ class Dumper(DumperBase):
def makeExpression(self, value):
typename = '::' + value.type.name
- #warn(' TYPE: %s' % typename)
+ #DumperBase.warn(' TYPE: %s' % typename)
exp = '(*(%s*)(0x%x))' % (typename, value.address())
- #warn(' EXP: %s' % exp)
+ #DumperBase.warn(' EXP: %s' % exp)
return exp
def makeStdString(init):
@@ -790,13 +790,13 @@ class Dumper(DumperBase):
size = value.type.size()
data = value.data()
h = self.hexencode(data)
- #warn('DATA: %s' % h)
+ #DumperBase.warn('DATA: %s' % h)
string = ''.join('\\x' + h[2*i:2*i+2] for i in range(size))
exp = '(%s*)memcpy(calloc(%d, 1), "%s", %d)' \
% (value.type.name, size, string, size)
- #warn('EXP: %s' % exp)
+ #DumperBase.warn('EXP: %s' % exp)
res = gdb.parse_and_eval(exp)
- #warn('RES: %s' % res)
+ #DumperBase.warn('RES: %s' % res)
return toInteger(res)
def releaseValue(self, address):
@@ -824,7 +824,7 @@ class Dumper(DumperBase):
return self.cachedInferior
def readRawMemory(self, address, size):
- #warn('READ: %s FROM 0x%x' % (size, address))
+ #DumperBase.warn('READ: %s FROM 0x%x' % (size, address))
if address == 0 or size == 0:
return bytes()
res = self.selectedInferior().read_memory(address, size)
@@ -1185,7 +1185,7 @@ class Dumper(DumperBase):
def lookupNativeTypeHelper(self, typeName):
typeobj = self.typeCache.get(typeName)
- #warn('LOOKUP 1: %s -> %s' % (typeName, typeobj))
+ #DumperBase.warn('LOOKUP 1: %s -> %s' % (typeName, typeobj))
if not typeobj is None:
return typeobj
@@ -1217,7 +1217,7 @@ class Dumper(DumperBase):
self.typesToReport[typeName] = typeobj
return typeobj
- #warn(" RESULT FOR 7.2: '%s': %s" % (typeName, typeobj))
+ #DumperBase.warn(" RESULT FOR 7.2: '%s': %s" % (typeName, typeobj))
# This part should only trigger for
# gdb 7.1 for types with namespace separators.
@@ -1255,24 +1255,24 @@ class Dumper(DumperBase):
return typeobj
try:
- #warn("LOOKING UP 1 '%s'" % ts)
+ #DumperBase.warn("LOOKING UP 1 '%s'" % ts)
typeobj = gdb.lookup_type(ts)
except RuntimeError as error:
- #warn("LOOKING UP 2 '%s' ERROR %s" % (ts, error))
+ #DumperBase.warn("LOOKING UP 2 '%s' ERROR %s" % (ts, error))
# See http://sourceware.org/bugzilla/show_bug.cgi?id=11912
exp = "(class '%s'*)0" % ts
try:
typeobj = self.parse_and_eval(exp).type.target()
- #warn("LOOKING UP 3 '%s'" % typeobj)
+ #DumperBase.warn("LOOKING UP 3 '%s'" % typeobj)
except:
# Can throw 'RuntimeError: No type named class Foo.'
pass
except:
- #warn("LOOKING UP '%s' FAILED" % ts)
+ #DumperBase.warn("LOOKING UP '%s' FAILED" % ts)
pass
if not typeobj is None:
- #warn('CACHING: %s' % typeobj)
+ #DumperBase.warn('CACHING: %s' % typeobj)
self.typeCache[typeName] = typeobj
self.typesToReport[typeName] = typeobj
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py
index 7d84bccdae8..3617d398a6a 100644
--- a/share/qtcreator/debugger/lldbbridge.py
+++ b/share/qtcreator/debugger/lldbbridge.py
@@ -31,6 +31,8 @@ import sys
import threading
import time
import lldb
+import utils
+from utils import DebuggerStartMode, BreakpointType, TypeCode
from contextlib import contextmanager
@@ -40,7 +42,7 @@ sys.path.insert(1, os.path.dirname(os.path.abspath(inspect.getfile(inspect.curre
if 'dumper' in sys.modules:
reload(sys.modules['dumper'])
-from dumper import *
+from dumper import DumperBase, SubItem, Children, TopLevelItem
#######################################################################
#
@@ -154,23 +156,23 @@ class Dumper(DumperBase):
targetType = self.fromNativeType(nativeTargetType)
val = self.createReferenceValue(nativeValue.GetValueAsUnsigned(), targetType)
val.laddress = nativeValue.AddressOf().GetValueAsUnsigned()
- #warn('CREATED REF: %s' % val)
+ #DumperBase.warn('CREATED REF: %s' % val)
elif code == lldb.eTypeClassPointer:
nativeTargetType = nativeType.GetPointeeType()
if not nativeTargetType.IsPointerType():
nativeTargetType = nativeTargetType.GetUnqualifiedType()
targetType = self.fromNativeType(nativeTargetType)
val = self.createPointerValue(nativeValue.GetValueAsUnsigned(), targetType)
- #warn('CREATED PTR 1: %s' % val)
+ #DumperBase.warn('CREATED PTR 1: %s' % val)
val.laddress = nativeValue.AddressOf().GetValueAsUnsigned()
- #warn('CREATED PTR 2: %s' % val)
+ #DumperBase.warn('CREATED PTR 2: %s' % val)
elif code == lldb.eTypeClassTypedef:
nativeTargetType = nativeType.GetUnqualifiedType()
if hasattr(nativeTargetType, 'GetCanonicalType'):
nativeTargetType = nativeTargetType.GetCanonicalType()
val = self.fromNativeValue(nativeValue.Cast(nativeTargetType))
val.type = self.fromNativeType(nativeType)
- #warn('CREATED TYPEDEF: %s' % val)
+ #DumperBase.warn('CREATED TYPEDEF: %s' % val)
else:
val = self.Value(self)
address = nativeValue.GetLoadAddress()
@@ -233,7 +235,7 @@ class Dumper(DumperBase):
return align
def listMembers(self, value, nativeType):
- #warn("ADDR: 0x%x" % self.fakeAddress)
+ #DumperBase.warn("ADDR: 0x%x" % self.fakeAddress)
fakeAddress = self.fakeAddress if value.laddress is None else value.laddress
sbaddr = lldb.SBAddress(fakeAddress, self.target)
fakeValue = self.target.CreateValueFromAddress('x', sbaddr, nativeType)
@@ -359,8 +361,8 @@ class Dumper(DumperBase):
# // Define a mask that can be used for any type when finding types
# eTypeClassAny = (0xffffffffu)
- #warn('CURRENT: %s' % self.typeData.keys())
- #warn('FROM NATIVE TYPE: %s' % nativeType.GetName())
+ #DumperBase.warn('CURRENT: %s' % self.typeData.keys())
+ #DumperBase.warn('FROM NATIVE TYPE: %s' % nativeType.GetName())
if code == lldb.eTypeClassInvalid:
return None
@@ -368,23 +370,23 @@ class Dumper(DumperBase):
nativeType = nativeType.GetUnqualifiedType()
if code == lldb.eTypeClassPointer:
- #warn('PTR')
+ #DumperBase.warn('PTR')
nativeTargetType = nativeType.GetPointeeType()
if not nativeTargetType.IsPointerType():
nativeTargetType = nativeTargetType.GetUnqualifiedType()
- #warn('PTR: %s' % nativeTargetType.name)
+ #DumperBase.warn('PTR: %s' % nativeTargetType.name)
return self.createPointerType(self.fromNativeType(nativeTargetType))
if code == lldb.eTypeClassReference:
- #warn('REF')
+ #DumperBase.warn('REF')
nativeTargetType = nativeType.GetDereferencedType()
if not nativeTargetType.IsPointerType():
nativeTargetType = nativeTargetType.GetUnqualifiedType()
- #warn('REF: %s' % nativeTargetType.name)
+ #DumperBase.warn('REF: %s' % nativeTargetType.name)
return self.createReferenceType(self.fromNativeType(nativeTargetType))
if code == lldb.eTypeClassTypedef:
- #warn('TYPEDEF')
+ #DumperBase.warn('TYPEDEF')
nativeTargetType = nativeType.GetUnqualifiedType()
if hasattr(nativeTargetType, 'GetCanonicalType'):
nativeTargetType = nativeTargetType.GetCanonicalType()
@@ -395,12 +397,12 @@ class Dumper(DumperBase):
typeName = self.typeName(nativeType)
if code in (lldb.eTypeClassArray, lldb.eTypeClassVector):
- #warn('ARRAY: %s' % nativeType.GetName())
+ #DumperBase.warn('ARRAY: %s' % nativeType.GetName())
if hasattr(nativeType, 'GetArrayElementType'): # New in 3.8(?) / 350.x
nativeTargetType = nativeType.GetArrayElementType()
if not nativeTargetType.IsValid():
if hasattr(nativeType, 'GetVectorElementType'): # New in 3.8(?) / 350.x
- #warn('BAD: %s ' % nativeTargetType.get_fields_array())
+ #DumperBase.warn('BAD: %s ' % nativeTargetType.get_fields_array())
nativeTargetType = nativeType.GetVectorElementType()
count = nativeType.GetByteSize() // nativeTargetType.GetByteSize()
targetTypeName = nativeTargetType.GetName()
@@ -408,7 +410,7 @@ class Dumper(DumperBase):
typeName = nativeType.GetName()
pos1 = typeName.rfind('[')
targetTypeName = typeName[0:pos1].strip()
- #warn("TARGET TYPENAME: %s" % targetTypeName)
+ #DumperBase.warn("TARGET TYPENAME: %s" % targetTypeName)
targetType = self.fromNativeType(nativeTargetType)
tdata = targetType.typeData().copy()
tdata.name = targetTypeName
@@ -431,33 +433,33 @@ class Dumper(DumperBase):
tdata.name = typeName
tdata.lbitsize = nativeType.GetByteSize() * 8
if code == lldb.eTypeClassBuiltin:
- if isFloatingPointTypeName(typeName):
- tdata.code = TypeCodeFloat
- elif isIntegralTypeName(typeName):
- tdata.code = TypeCodeIntegral
+ if utils.isFloatingPointTypeName(typeName):
+ tdata.code = TypeCode.TypeCodeFloat
+ elif utils.isIntegralTypeName(typeName):
+ tdata.code = TypeCode.TypeCodeIntegral
elif typeName in ('__int128', 'unsigned __int128'):
- tdata.code = TypeCodeIntegral
+ tdata.code = TypeCode.TypeCodeIntegral
elif typeName == 'void':
- tdata.code = TypeCodeVoid
+ tdata.code = TypeCode.TypeCodeVoid
else:
- warn('UNKNOWN TYPE KEY: %s: %s' % (typeName, code))
+ self.warn('UNKNOWN TYPE KEY: %s: %s' % (typeName, code))
elif code == lldb.eTypeClassEnumeration:
- tdata.code = TypeCodeEnum
+ tdata.code = TypeCode.TypeCodeEnum
tdata.enumDisplay = lambda intval, addr, form : \
self.nativeTypeEnumDisplay(nativeType, intval, form)
elif code in (lldb.eTypeClassComplexInteger, lldb.eTypeClassComplexFloat):
- tdata.code = TypeCodeComplex
+ tdata.code = TypeCode.TypeCodeComplex
elif code in (lldb.eTypeClassClass, lldb.eTypeClassStruct, lldb.eTypeClassUnion):
- tdata.code = TypeCodeStruct
+ tdata.code = TypeCode.TypeCodeStruct
tdata.lalignment = lambda : \
self.nativeStructAlignment(nativeType)
tdata.lfields = lambda value : \
self.listMembers(value, nativeType)
tdata.templateArguments = self.listTemplateParametersHelper(nativeType)
elif code == lldb.eTypeClassFunction:
- tdata.code = TypeCodeFunction
+ tdata.code = TypeCode.TypeCodeFunction
elif code == lldb.eTypeClassMemberPointer:
- tdata.code = TypeCodeMemberPointer
+ tdata.code = TypeCode.TypeCodeMemberPointer
self.registerType(typeId, tdata) # Fix up fields and template args
# warn('CREATE TYPE: %s' % typeId)
@@ -491,12 +493,12 @@ class Dumper(DumperBase):
targs.append(self.fromNativeType(innerType))
#elif kind == lldb.eTemplateArgumentKindIntegral:
# innerType = nativeType.GetTemplateArgumentType(i).GetUnqualifiedType().GetCanonicalType()
- # #warn('INNER TYP: %s' % innerType)
+ # #DumperBase.warn('INNER TYP: %s' % innerType)
# basicType = innerType.GetBasicType()
- # #warn('IBASIC TYP: %s' % basicType)
+ # #DumperBase.warn('IBASIC TYP: %s' % basicType)
# inner = self.extractTemplateArgument(nativeType.GetName(), i)
# exp = '(%s)%s' % (innerType.GetName(), inner)
- # #warn('EXP : %s' % exp)
+ # #DumperBase.warn('EXP : %s' % exp)
# val = self.nativeParseAndEvaluate('(%s)%s' % (innerType.GetName(), inner))
# # Clang writes 'int' and '0xfffffff' into the debug info
# # LLDB manages to read a value of 0xfffffff...
@@ -504,12 +506,12 @@ class Dumper(DumperBase):
# value = val.GetValueAsUnsigned()
# if value >= 0x8000000:
# value -= 0x100000000
- # #warn('KIND: %s' % kind)
+ # #DumperBase.warn('KIND: %s' % kind)
# targs.append(value)
else:
- #warn('UNHANDLED TEMPLATE TYPE : %s' % kind)
+ #DumperBase.warn('UNHANDLED TEMPLATE TYPE : %s' % kind)
targs.append(stringArgs[i]) # Best we can do.
- #warn('TARGS: %s %s' % (nativeType.GetName(), [str(x) for x in targs]))
+ #DumperBase.warn('TARGS: %s %s' % (nativeType.GetName(), [str(x) for x in targs]))
return targs
def typeName(self, nativeType):
@@ -529,7 +531,7 @@ class Dumper(DumperBase):
return name
fields = nativeType.get_fields_array()
typeId = c + ''.join(['{%s:%s}' % (f.name, self.nativeTypeId(f.GetType())) for f in fields])
- #warn('NATIVE TYPE ID FOR %s IS %s' % (name, typeId))
+ #DumperBase.warn('NATIVE TYPE ID FOR %s IS %s' % (name, typeId))
return typeId
def nativeTypeEnumDisplay(self, nativeType, intval, form):
@@ -614,12 +616,12 @@ class Dumper(DumperBase):
def callHelper(self, rettype, value, func, args):
# args is a tuple.
arg = ','.join(args)
- #warn('PRECALL: %s -> %s(%s)' % (value.address(), func, arg))
+ #DumperBase.warn('PRECALL: %s -> %s(%s)' % (value.address(), func, arg))
typename = value.type.name
exp = '((%s*)0x%x)->%s(%s)' % (typename, value.address(), func, arg)
- #warn('CALL: %s' % exp)
+ #DumperBase.warn('CALL: %s' % exp)
result = self.currentContextValue.CreateValueFromExpression('', exp)
- #warn(' -> %s' % result)
+ #DumperBase.warn(' -> %s' % result)
return self.fromNativeValue(result)
def pokeValue(self, typeName, *args):
@@ -627,9 +629,9 @@ class Dumper(DumperBase):
frame = thread.GetFrameAtIndex(0)
inner = ','.join(args)
value = frame.EvaluateExpression(typeName + '{' + inner + '}')
- #self.warn(' TYPE: %s' % value.type)
- #self.warn(' ADDR: 0x%x' % value.address)
- #self.warn(' VALUE: %s' % value)
+ #DumperBase.warn(' TYPE: %s' % value.type)
+ #DumperBase.warn(' ADDR: 0x%x' % value.address)
+ #DumperBase.warn(' VALUE: %s' % value)
return value
def nativeParseAndEvaluate(self, exp):
@@ -640,10 +642,10 @@ class Dumper(DumperBase):
#val = self.target.EvaluateExpression(exp, options)
err = val.GetError()
if err.Fail():
- #warn('FAILING TO EVAL: %s' % exp)
+ #DumperBase.warn('FAILING TO EVAL: %s' % exp)
return None
- #warn('NO ERROR.')
- #warn('EVAL: %s -> %s' % (exp, val.IsValid()))
+ #DumperBase.warn('NO ERROR.')
+ #DumperBase.warn('EVAL: %s -> %s' % (exp, val.IsValid()))
return val
def parseAndEvaluate(self, exp):
@@ -749,14 +751,14 @@ class Dumper(DumperBase):
return re.sub('^(struct|class|union|enum|typedef) ', '', name)
def lookupNativeType(self, name):
- #warn('LOOKUP TYPE NAME: %s' % name)
+ #DumperBase.warn('LOOKUP TYPE NAME: %s' % name)
typeobj = self.typeCache.get(name)
if not typeobj is None:
- #warn('CACHED: %s' % name)
+ #DumperBase.warn('CACHED: %s' % name)
return typeobj
typeobj = self.target.FindFirstType(name)
if typeobj.IsValid():
- #warn('VALID FIRST : %s' % typeobj)
+ #DumperBase.warn('VALID FIRST : %s' % typeobj)
self.typeCache[name] = typeobj
return typeobj
@@ -773,16 +775,16 @@ class Dumper(DumperBase):
for typeobj in typeobjlist:
n = self.canonicalTypeName(self.removeTypePrefix(typeobj.GetDisplayTypeName()))
if n == nonPrefixedName:
- #warn('FOUND TYPE USING FindTypes : %s' % typeobj)
+ #DumperBase.warn('FOUND TYPE USING FindTypes : %s' % typeobj)
self.typeCache[name] = typeobj
return typeobj
if name.endswith('*'):
- #warn('RECURSE PTR')
+ #DumperBase.warn('RECURSE PTR')
typeobj = self.lookupNativeType(name[:-1].strip())
if typeobj is not None:
- #warn('RECURSE RESULT X: %s' % typeobj)
+ #DumperBase.warn('RECURSE RESULT X: %s' % typeobj)
self.fromNativeType(typeobj.GetPointerType())
- #warn('RECURSE RESULT: %s' % typeobj.GetPointerType())
+ #DumperBase.warn('RECURSE RESULT: %s' % typeobj.GetPointerType())
return typeobj.GetPointerType()
#typeobj = self.target.FindFirstType(name[:-1].strip())
@@ -791,13 +793,13 @@ class Dumper(DumperBase):
# return typeobj.GetPointerType()
if name.endswith(' const'):
- #warn('LOOKUP END CONST')
+ #DumperBase.warn('LOOKUP END CONST')
typeobj = self.lookupNativeType(name[:-6])
if typeobj is not None:
return typeobj
if name.startswith('const '):
- #warn('LOOKUP START CONST')
+ #DumperBase.warn('LOOKUP START CONST')
typeobj = self.lookupNativeType(name[6:])
if typeobj is not None:
return typeobj
@@ -806,17 +808,17 @@ class Dumper(DumperBase):
def lookupNativeTypeInAllModules(self, name):
needle = self.canonicalTypeName(name)
- #warn('NEEDLE: %s ' % needle)
- warn('Searching for type %s across all target modules, this could be very slow' % name)
+ #DumperBase.warn('NEEDLE: %s ' % needle)
+ self.warn('Searching for type %s across all target modules, this could be very slow' % name)
for i in xrange(self.target.GetNumModules()):
module = self.target.GetModuleAtIndex(i)
# SBModule.GetType is new somewhere after early 300.x
# So this may fail.
for t in module.GetTypes():
n = self.canonicalTypeName(t.GetName())
- #warn('N: %s' % n)
+ #DumperBase.warn('N: %s' % n)
if n == needle:
- #warn('FOUND TYPE DIRECT 2: %s ' % t)
+ #DumperBase.warn('FOUND TYPE DIRECT 2: %s ' % t)
self.typeCache[name] = t
return t
if n == needle + '*':
@@ -824,16 +826,16 @@ class Dumper(DumperBase):
self.typeCache[name] = res
x = self.fromNativeType(res) # Register under both names
self.registerTypeAlias(x.typeId, name)
- #warn('FOUND TYPE BY POINTER: %s ' % res.name)
+ #DumperBase.warn('FOUND TYPE BY POINTER: %s ' % res.name)
return res
if n == needle + '&':
res = t.GetDereferencedType().GetUnqualifiedType()
self.typeCache[name] = res
x = self.fromNativeType(res) # Register under both names
self.registerTypeAlias(x.typeId, name)
- #warn('FOUND TYPE BY REFERENCE: %s ' % res.name)
+ #DumperBase.warn('FOUND TYPE BY REFERENCE: %s ' % res.name)
return res
- #warn('NOT FOUND: %s ' % needle)
+ #DumperBase.warn('NOT FOUND: %s ' % needle)
return None
def setupInferior(self, args):
@@ -861,7 +863,7 @@ class Dumper(DumperBase):
self.ignoreStops = 0
if platform.system() == 'Linux':
- if self.startMode_ == AttachCore:
+ if self.startMode_ == DebuggerStartMode.AttachCore:
pass
else:
if self.useTerminal_:
@@ -911,7 +913,8 @@ class Dumper(DumperBase):
self.reportState('enginerunandinferiorstopok')
else:
self.reportState('enginerunandinferiorrunok')
- elif self.startMode_ == AttachToRemoteServer or self.startMode_ == AttachToRemoteProcess:
+ elif (self.startMode_ == DebuggerStartMode.AttachToRemoteServer
+ or self.startMode_ == DebuggerStartMode.AttachToRemoteProcess):
self.process = self.target.ConnectRemote(
self.debugger.GetListener(),
self.remoteChannel_, None, error)
@@ -923,7 +926,7 @@ class Dumper(DumperBase):
# and later detects that it did stop after all, so it is be
# better to mirror that and wait for the spontaneous stop.
self.reportState('enginerunandinferiorrunok')
- elif self.startMode_ == AttachCore:
+ elif self.startMode_ == DebuggerStartMode.AttachCore:
coreFile = args.get('coreFile', '');
self.process = self.target.LoadCore(coreFile)
if self.process.IsValid():
@@ -1124,7 +1127,7 @@ class Dumper(DumperBase):
if size == 0:
return bytes()
error = lldb.SBError()
- #warn("READ: %s %s" % (address, size))
+ #DumperBase.warn("READ: %s %s" % (address, size))
res = self.process.ReadMemory(address, size, error)
if res is None or len(res) != size:
# Using code in e.g. readToFirstZero relies on exceptions.
@@ -1307,12 +1310,12 @@ class Dumper(DumperBase):
self.handleBreakpointEvent(event)
return
if not lldb.SBProcess.EventIsProcessEvent(event):
- warn("UNEXPECTED event (%s)" % event.GetType())
+ self.warn("UNEXPECTED event (%s)" % event.GetType())
return
out = lldb.SBStream()
event.GetDescription(out)
- #warn("EVENT: %s" % event)
+ #DumperBase.warn("EVENT: %s" % event)
eventType = event.GetType()
msg = lldb.SBEvent.GetCStringFromEvent(event)
flavor = event.GetDataFlavor()
@@ -1430,7 +1433,7 @@ class Dumper(DumperBase):
def insertBreakpoint(self, args):
bpType = args['type']
- if bpType == BreakpointByFileAndLine:
+ if bpType == BreakpointType.BreakpointByFileAndLine:
fileName = args['file']
if fileName.endswith('.js') or fileName.endswith('.qml'):
self.insertInterpreterBreakpoint(args)
@@ -1438,28 +1441,28 @@ class Dumper(DumperBase):
extra = ''
more = True
- if bpType == BreakpointByFileAndLine:
+ if bpType == BreakpointType.BreakpointByFileAndLine:
bp = self.target.BreakpointCreateByLocation(
str(args['file']), int(args['line']))
- elif bpType == BreakpointByFunction:
+ elif bpType == BreakpointType.BreakpointByFunction:
bp = self.target.BreakpointCreateByName(args['function'])
- elif bpType == BreakpointByAddress:
+ elif bpType == BreakpointType.BreakpointByAddress:
bp = self.target.BreakpointCreateByAddress(args['address'])
- elif bpType == BreakpointAtMain:
+ elif bpType == BreakpointType.BreakpointAtMain:
bp = self.createBreakpointAtMain()
- elif bpType == BreakpointAtThrow:
+ elif bpType == BreakpointType.BreakpointAtThrow:
bp = self.target.BreakpointCreateForException(
lldb.eLanguageTypeC_plus_plus, False, True)
- elif bpType == BreakpointAtCatch:
+ elif bpType == BreakpointType.BreakpointAtCatch:
bp = self.target.BreakpointCreateForException(
lldb.eLanguageTypeC_plus_plus, True, False)
- elif bpType == WatchpointAtAddress:
+ elif bpType == BreakpointType.WatchpointAtAddress:
error = lldb.SBError()
# This might yield bp.IsValid() == False and
# error.desc == 'process is not alive'.
bp = self.target.WatchAddress(args['address'], 4, False, True, error)
extra = self.describeError(error)
- elif bpType == WatchpointAtExpression:
+ elif bpType == BreakpointType.WatchpointAtExpression:
# FIXME: Top level-only for now.
try:
frame = self.currentFrame()
@@ -1702,7 +1705,7 @@ class Dumper(DumperBase):
else:
base = args.get('address', 0)
if int(base) == 0xffffffffffffffff:
- warn('INVALID DISASSEMBLER BASE')
+ self.warn('INVALID DISASSEMBLER BASE')
return
addr = lldb.SBAddress(base, self.target)
instructions = self.target.ReadInstructions(addr, 100)
@@ -1736,7 +1739,7 @@ class Dumper(DumperBase):
# With lldb-3.8 files like /data/dev/creator-3.6/tests/
# auto/debugger/qt_tst_dumpers_StdVector_bfNWZa/main.cpp
# with non-existent directories appear.
- warn('FILE: %s ERROR: %s' % (fileName, error))
+ self.warn('FILE: %s ERROR: %s' % (fileName, error))
source = ''
result += '{line="%s"' % lineNumber
result += ',file="%s"' % fileName
@@ -1836,7 +1839,7 @@ class Tester(Dumper):
self.target = self.debugger.CreateTarget(binary, None, None, True, error)
if error.GetType():
- warn('ERROR: %s' % error)
+ self.warn('ERROR: %s' % error)
return
s = threading.Thread(target=self.testLoop, args=(args,))
@@ -1856,14 +1859,14 @@ class Tester(Dumper):
self.process = self.target.Launch(launchInfo, error)
if error.GetType():
- warn('ERROR: %s' % error)
+ self.warn('ERROR: %s' % error)
event = lldb.SBEvent()
listener = self.debugger.GetListener()
while True:
state = self.process.GetState()
if listener.WaitForEvent(100, event):
- #warn('EVENT: %s' % event)
+ #DumperBase.warn('EVENT: %s' % event)
state = lldb.SBProcess.GetStateFromEvent(event)
if state == lldb.eStateExited: # 10
break
@@ -1872,7 +1875,7 @@ class Tester(Dumper):
for i in xrange(0, self.process.GetNumThreads()):
thread = self.process.GetThreadAtIndex(i)
reason = thread.GetStopReason()
- #warn('THREAD: %s REASON: %s' % (thread, reason))
+ #DumperBase.warn('THREAD: %s REASON: %s' % (thread, reason))
if (reason == lldb.eStopReasonBreakpoint or
reason == lldb.eStopReasonException or
reason == lldb.eStopReasonSignal):
@@ -1894,8 +1897,8 @@ class Tester(Dumper):
break
else:
- warn('TIMEOUT')
- warn('Cannot determined stopped thread')
+ self.warn('TIMEOUT')
+ self.warn('Cannot determined stopped thread')
lldb.SBDebugger.Destroy(self.debugger)
@@ -1981,7 +1984,7 @@ class SummaryDumper(Dumper, LogMixin):
return # Don't mess up lldb output
def lookupNativeTypeInAllModules(self, name):
- warn('Failed to resolve type %s' % name)
+ self.warn('Failed to resolve type %s' % name)
return None
def dump_summary(self, valobj, expanded = False):
diff --git a/share/qtcreator/debugger/misctypes.py b/share/qtcreator/debugger/misctypes.py
index 72e42e45101..a1343eb9dc8 100644
--- a/share/qtcreator/debugger/misctypes.py
+++ b/share/qtcreator/debugger/misctypes.py
@@ -23,7 +23,8 @@
#
############################################################################
-from dumper import *
+from dumper import Children, SubItem
+from utils import TypeCode, DisplayFormat
import re
#######################################################################
@@ -100,7 +101,7 @@ def qdump____m512i(d, value):
#######################################################################
def qform__std__array():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__gsl__span(d, value):
size, pointer = value.split('pp')
@@ -186,7 +187,7 @@ def qdump__NimStringDesc(d, value):
def qdump__NimGenericSequence__(d, value, regex = '^TY[\d]+$'):
code = value.type.stripTypedefs().code
- if code == TypeCodeStruct:
+ if code == TypeCode.TypeCodeStruct:
size, reserved = d.split('pp', value)
data = value.address() + 2 * d.ptrSize()
typeobj = value['data'].type.dereference()
@@ -322,7 +323,7 @@ def qdump__KDSoapValue1(d, value):
d.putPlainChildren(inner)
def qdump__KDSoapValue(d, value):
- p = (value.cast(lookupType('char*')) + 4).dereference().cast(lookupType('QString'))
+ p = (value.cast(d.lookupType('char*')) + 4).dereference().cast(d.lookupType('QString'))
d.putStringValue(p)
d.putPlainChildren(value['d']['d'].dereference())
diff --git a/share/qtcreator/debugger/opencvtypes.py b/share/qtcreator/debugger/opencvtypes.py
index 2e58637b383..7a62af7041f 100644
--- a/share/qtcreator/debugger/opencvtypes.py
+++ b/share/qtcreator/debugger/opencvtypes.py
@@ -23,14 +23,15 @@
#
############################################################################
-from dumper import *
+from dumper import Children, SubItem
+from utils import TypeCode, DisplayFormat
def qdump__cv__Size_(d, value):
d.putValue('(%s, %s)' % (value[0].display(), value[1].display()))
d.putPlainChildren(value)
def qform__cv__Mat():
- return [SeparateFormat]
+ return [DisplayFormat.SeparateFormat]
def qdump__cv__Mat(d, value):
(flag, dims, rows, cols, data, refcount, datastart, dataend,
@@ -43,7 +44,7 @@ def qdump__cv__Mat(d, value):
d.putPlainChildren(value)
return
- if d.currentItemFormat() == SeparateFormat:
+ if d.currentItemFormat() == DisplayFormat.SeparateFormat:
rs = steps[0] * innerSize
cs = cols * innerSize
dform = 'arraydata:separate:int:%d::2:%d:%d' % (innerSize, cols, rows)
@@ -53,7 +54,7 @@ def qdump__cv__Mat(d, value):
d.putValue('(%s x %s)' % (rows, cols))
if d.isExpanded():
with Children(d):
- innerType = d.createType(TypeCodeIntegral, innerSize)
+ innerType = d.createType(TypeCode.TypeCodeIntegral, innerSize)
for i in range(rows):
for j in range(cols):
with SubItem(d, None):
diff --git a/share/qtcreator/debugger/pdbbridge.py b/share/qtcreator/debugger/pdbbridge.py
index 4f3a0fcd3bf..4c77d41ce5b 100644
--- a/share/qtcreator/debugger/pdbbridge.py
+++ b/share/qtcreator/debugger/pdbbridge.py
@@ -1552,10 +1552,10 @@ class QtcInternalDumper:
self.put('name="%s",' % name)
def isExpanded(self, iname):
- # self.warn('IS EXPANDED: %s in %s' % (iname, self.expandedINames))
+ # DumperBase.warn('IS EXPANDED: %s in %s' % (iname, self.expandedINames))
if iname.startswith('None'):
raise "Illegal iname '%s'" % iname
- # self.warn(' --> %s' % (iname in self.expandedINames))
+ # DumperBase.warn(' --> %s' % (iname in self.expandedINames))
return iname in self.expandedINames
def isExpandedIName(self, iname):
diff --git a/share/qtcreator/debugger/personaltypes.py b/share/qtcreator/debugger/personaltypes.py
index b4d34db10c8..7f82cc57dfb 100644
--- a/share/qtcreator/debugger/personaltypes.py
+++ b/share/qtcreator/debugger/personaltypes.py
@@ -56,6 +56,6 @@
# for more details or look at qttypes.py, stdtypes.py, boosttypes.py
# for more complex examples.
-from dumper import *
+import dumper
######################## Your code below #######################
diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py
index 65b0828cdb9..705a0051c22 100644
--- a/share/qtcreator/debugger/qttypes.py
+++ b/share/qtcreator/debugger/qttypes.py
@@ -25,8 +25,8 @@
import platform
import re
-from dumper import *
-
+from dumper import Children, SubItem, UnnamedSubItem, toInteger
+from utils import DisplayFormat
def qdump__QAtomicInt(d, value):
d.putValue(value.integer())
@@ -44,8 +44,8 @@ def qdump__QAtomicPointer(d, value):
def qform__QByteArray():
- return [Latin1StringFormat, SeparateLatin1StringFormat,
- Utf8StringFormat, SeparateUtf8StringFormat ]
+ return [DisplayFormat.Latin1StringFormat, DisplayFormat.SeparateLatin1StringFormat,
+ DisplayFormat.Utf8StringFormat, DisplayFormat.SeparateUtf8StringFormat ]
def qedit__QByteArray(d, value, data):
d.call('void', value, 'resize', str(len(data)))
@@ -58,14 +58,14 @@ def qdump__QByteArray(d, value):
d.putNumChild(size)
elided, p = d.encodeByteArrayHelper(d.extractPointer(value), d.displayStringLimit)
displayFormat = d.currentItemFormat()
- if displayFormat == AutomaticFormat or displayFormat == Latin1StringFormat:
+ if displayFormat == DisplayFormat.AutomaticFormat or displayFormat == DisplayFormat.Latin1StringFormat:
d.putValue(p, 'latin1', elided=elided)
- elif displayFormat == SeparateLatin1StringFormat:
+ elif displayFormat == DisplayFormat.SeparateLatin1StringFormat:
d.putValue(p, 'latin1', elided=elided)
d.putDisplay('latin1:separate', d.encodeByteArray(value, limit=100000))
- elif displayFormat == Utf8StringFormat:
+ elif displayFormat == DisplayFormat.Utf8StringFormat:
d.putValue(p, 'utf8', elided=elided)
- elif displayFormat == SeparateUtf8StringFormat:
+ elif displayFormat == DisplayFormat.SeparateUtf8StringFormat:
d.putValue(p, 'utf8', elided=elided)
d.putDisplay('utf8:separate', d.encodeByteArray(value, limit=100000))
if d.isExpanded():
@@ -103,11 +103,11 @@ def qdump__QChar(d, value):
def qform_X_QAbstractItemModel():
- return [SimpleFormat, EnhancedFormat]
+ return [DisplayFormat.SimpleFormat, DisplayFormat.EnhancedFormat]
def qdump_X_QAbstractItemModel(d, value):
displayFormat = d.currentItemFormat()
- if displayFormat == SimpleFormat:
+ if displayFormat == DisplayFormat.SimpleFormat:
d.putPlainChildren(value)
return
#displayFormat == EnhancedFormat:
@@ -137,11 +137,11 @@ def qdump_X_QAbstractItemModel(d, value):
#gdb.execute('call free($ri)')
def qform_X_QModelIndex():
- return [SimpleFormat, EnhancedFormat]
+ return [DisplayFormat.SimpleFormat, DisplayFormat.EnhancedFormat]
def qdump_X_QModelIndex(d, value):
displayFormat = d.currentItemFormat()
- if displayFormat == SimpleFormat:
+ if displayFormat == DisplayFormat.SimpleFormat:
d.putPlainChildren(value)
return
r = value['r']
@@ -306,12 +306,12 @@ def qdump__QDateTime(d, value):
is32bit = d.ptrSize() == 4
if qtVersion >= 0x050200:
tiVersion = d.qtTypeInfoVersion()
- #warn('TI VERSION: %s' % tiVersion)
+ #DumperBase.warn('TI VERSION: %s' % tiVersion)
if tiVersion is None:
tiVersion = 4
if tiVersion > 10:
status = d.extractByte(value)
- #warn('STATUS: %s' % status)
+ #DumperBase.warn('STATUS: %s' % status)
if status & 0x01:
# Short data
msecs = d.extractUInt64(value) >> 8
@@ -757,7 +757,7 @@ def qdump__QFixed(d, value):
def qform__QFiniteStack():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__QFiniteStack(d, value):
array, alloc, size = value.split('pii')
@@ -775,7 +775,7 @@ def qdump__QFlags(d, value):
def qform__QHash():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__QHash(d, value):
qdumpHelper_QHash(d, value, value.type[0], value.type[1])
@@ -835,7 +835,7 @@ def qdumpHelper_QHash(d, value, keyType, valueType):
def qform__QHashNode():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__QHashNode(d, value):
d.putPairItem(None, value)
@@ -872,7 +872,7 @@ def qdump__QHostAddress(d, value):
dd = d.extractPointer(value)
qtVersion = d.qtVersion()
tiVersion = d.qtTypeInfoVersion()
- #warn('QT: %x, TI: %s' % (qtVersion, tiVersion))
+ #DumperBase.warn('QT: %x, TI: %s' % (qtVersion, tiVersion))
mayNeedParse = True
if tiVersion is not None:
if tiVersion >= 16:
@@ -942,7 +942,7 @@ def qdump__QIPv6Address(d, value):
d.putArrayData(value.address(), 16, d.lookupType('unsigned char'))
def qform__QList():
- return [DirectQListStorageFormat, IndirectQListStorageFormat]
+ return [DisplayFormat.DirectQListStorageFormat, DisplayFormat.IndirectQListStorageFormat]
def qdump__QList(d, value):
return qdumpHelper_QList(d, value, value.type[0])
@@ -972,9 +972,9 @@ def qdumpHelper_QList(d, value, innerType):
# in the frontend.
# So as first approximation only do the 'isLarge' check:
displayFormat = d.currentItemFormat()
- if displayFormat == DirectQListStorageFormat:
+ if displayFormat == DisplayFormat.DirectQListStorageFormat:
isInternal = True
- elif displayFormat == IndirectQListStorageFormat:
+ elif displayFormat == DisplayFormat.IndirectQListStorageFormat:
isInternal = False
else:
isInternal = innerSize <= stepSize and innerType.isMovableType()
@@ -995,7 +995,7 @@ def qdumpHelper_QList(d, value, innerType):
d.putSubItem(i, x)
def qform__QImage():
- return [SimpleFormat, SeparateFormat]
+ return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
def qdump__QImage(d, value):
if d.qtVersion() < 0x050000:
@@ -1024,7 +1024,7 @@ def qdump__QImage(d, value):
d.putType('void *')
displayFormat = d.currentItemFormat()
- if displayFormat == SeparateFormat:
+ if displayFormat == DisplayFormat.SeparateFormat:
d.putDisplay('imagedata:separate', '%08x%08x%08x%08x' % (width, height, nbytes, iformat)
+ d.readMemory(bits, nbytes))
@@ -1167,7 +1167,7 @@ def qdumpHelper_Qt5_QMap(d, value, keyType, valueType):
def qform__QMap():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__QMap(d, value):
qdumpHelper_QMap(d, value, value.type[0], value.type[1])
@@ -1179,13 +1179,13 @@ def qdumpHelper_QMap(d, value, keyType, valueType):
qdumpHelper_Qt5_QMap(d, value, keyType, valueType)
def qform__QMultiMap():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__QMultiMap(d, value):
qdump__QMap(d, value)
def qform__QVariantMap():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__QVariantMap(d, value):
qdumpHelper_QMap(d, value, d.createType('QString'), d.createType('QVariant'))
@@ -1458,7 +1458,7 @@ def qdump__QSizePolicy(d, value):
def qform__QStack():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__QStack(d, value):
qdump__QVector(d, value)
@@ -1492,14 +1492,14 @@ def qedit__QString(d, value, data):
d.setValues(base, 'short', [ord(c) for c in data])
def qform__QString():
- return [SimpleFormat, SeparateFormat]
+ return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
def qdump__QString(d, value):
d.putStringValue(value)
(data, size, alloc) = d.stringData(value)
d.putNumChild(size)
displayFormat = d.currentItemFormat()
- if displayFormat == SeparateFormat:
+ if displayFormat == DisplayFormat.SeparateFormat:
d.putDisplay('utf16:separate', d.encodeString(value, limit=100000))
if d.isExpanded():
d.putArrayData(data, size, d.createType('QChar'))
@@ -1596,7 +1596,7 @@ def qdump__QTextDocument(d, value):
def qform__QUrl():
- return [SimpleFormat, SeparateFormat]
+ return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
def qdump__QUrl(d, value):
privAddress = d.extractPointer(value)
@@ -1637,7 +1637,7 @@ def qdump__QUrl(d, value):
d.putValue(url, 'utf16')
displayFormat = d.currentItemFormat()
- if displayFormat == SeparateFormat:
+ if displayFormat == DisplayFormat.SeparateFormat:
d.putDisplay('utf16:separate', url)
d.putNumChild(1)
@@ -1851,7 +1851,7 @@ def qdump__QVariant(d, value):
d.putNumChild(0)
return None
- #warn('TYPE: %s' % variantType)
+ #DumperBase.warn('TYPE: %s' % variantType)
if variantType <= 86:
# Known Core or Gui type.
@@ -1867,15 +1867,15 @@ def qdump__QVariant(d, value):
#data = value['d']['data']
innerType = d.qtNamespace() + innert
- #warn('SHARED: %s' % isShared)
+ #DumperBase.warn('SHARED: %s' % isShared)
if isShared:
base1 = d.extractPointer(value)
- #warn('BASE 1: %s %s' % (base1, innert))
+ #DumperBase.warn('BASE 1: %s %s' % (base1, innert))
base = d.extractPointer(base1)
- #warn('SIZE 1: %s' % size)
+ #DumperBase.warn('SIZE 1: %s' % size)
val = d.createValue(base, innerType)
else:
- #warn('DIRECT ITEM 1: %s' % innerType)
+ #DumperBase.warn('DIRECT ITEM 1: %s' % innerType)
val = d.createValue(data, innerType)
val.laddress = value.laddress
@@ -1939,7 +1939,7 @@ def qedit__QVector(d, value, data):
def qform__QVector():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__QVector(d, value):
@@ -2053,17 +2053,17 @@ def qdump__QXmlStreamAttribute(d, value):
#######################################################################
def extractQmlData(d, value):
- #if value.type.code == TypeCodePointer:
+ #if value.type.code == TypeCode.TypeCodePointer:
# value = value.dereference()
base = value.split('p')[0]
#mmdata = d.split('Q', base)[0]
#PointerMask = 0xfffffffffffffffd
#vtable = mmdata & PointerMask
- #warn('QML DATA: %s' % value.stringify())
+ #DumperBase.warn('QML DATA: %s' % value.stringify())
#data = value['data']
#return #data.cast(d.lookupType(value.type.name.replace('QV4::', 'QV4::Heap::')))
typeName = value.type.name.replace('QV4::', 'QV4::Heap::')
- #warn('TYOE DATA: %s' % typeName)
+ #DumperBase.warn('TYOE DATA: %s' % typeName)
return d.createValue(base, typeName)
def qdump__QV4__Heap__Base(d, value):
@@ -2236,7 +2236,7 @@ def QV4_valueForData(d, jsval): # (Dumper, QJSValue *jsval) -> QV4::Value *
v = QV4_getValue(d, jsval)
if v:
return v
- warn('Not implemented: VARIANT')
+ d.warn('Not implemented: VARIANT')
return 0
def QV4_putObjectValue(d, objectPtr):
@@ -2424,7 +2424,7 @@ def qdump_64__QV4__Value(d, value):
d.putBetterType('%sQV4::Value (object)' % ns)
#QV4_putObjectValue(d, d.extractPointer(value) + 2 * d.ptrSize())
arrayVTable = d.symbolAddress(ns + 'QV4::ArrayObject::static_vtbl')
- #warn('ARRAY VTABLE: 0x%x' % arrayVTable)
+ #DumperBase.warn('ARRAY VTABLE: 0x%x' % arrayVTable)
d.putNumChild(1)
d.putItem(d.createValue(d.extractPointer(value) + 2 * d.ptrSize(), ns + 'QV4::Object'))
return
@@ -2630,7 +2630,7 @@ def qdump__QScriptValue(d, value):
payload = x['asBits']['payload']
#isValid = int(x['asBits']['tag']) != -6 # Empty
#isCell = int(x['asBits']['tag']) == -2
- #warn('IS CELL: %s ' % isCell)
+ #DumperBase.warn('IS CELL: %s ' % isCell)
#isObject = False
#className = 'UNKNOWN NAME'
#if isCell:
@@ -2648,7 +2648,7 @@ def qdump__QScriptValue(d, value):
# type = cell['m_structure']['m_typeInfo']['m_type']
# isObject = int(type) == 7 # ObjectType;
# className = 'UNKNOWN NAME'
- #warn('IS OBJECT: %s ' % isObject)
+ #DumperBase.warn('IS OBJECT: %s ' % isObject)
#inline bool JSCell::inherits(const ClassInfo* info) const
#for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) {
diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py
index 56890487b11..83201e42e83 100644
--- a/share/qtcreator/debugger/stdtypes.py
+++ b/share/qtcreator/debugger/stdtypes.py
@@ -23,10 +23,11 @@
#
############################################################################
-from dumper import *
+from utils import DisplayFormat
+from dumper import Children, SubItem
def qform__std__array():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__std__array(d, value):
size = value.type[1]
@@ -36,7 +37,7 @@ def qdump__std__array(d, value):
def qform__std____1__array():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__std____1__array(d, value):
qdump__std__array(d, value)
@@ -260,7 +261,7 @@ def qdump__std____1__list(d, value):
d.putSubItem(i, val)
def qform__std__map():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__std__map(d, value):
if d.isQnxTarget() or d.isMsvcTarget():
@@ -334,7 +335,7 @@ def qdump__std____cxx1998__map(d, value):
qdump__std__map(d, value)
def qform__std__multimap():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__std__multimap(d, value):
return qdump__std__map(d, value)
@@ -537,7 +538,7 @@ def qdump__std____1__multiset(d, value):
qdump__std____1__set(d, value)
def qform__std____1__map():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__std____1__map(d, value):
try:
@@ -574,7 +575,7 @@ def qdump__std____1__map(d, value):
d.putPairItem(i, pair, 'key', 'value')
def qform__std____1__multimap():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__std____1__multimap(d, value):
qdump__std____1__map(d, value)
@@ -620,8 +621,8 @@ def qdump__std____1__stack(d, value):
d.putBetterType(value.type)
def qform__std__string():
- return [Latin1StringFormat, SeparateLatin1StringFormat,
- Utf8StringFormat, SeparateUtf8StringFormat ]
+ return [DisplayFormat.Latin1StringFormat, DisplayFormat.SeparateLatin1StringFormat,
+ DisplayFormat.Utf8StringFormat, DisplayFormat.SeparateUtf8StringFormat ]
def qdump__std__string(d, value):
qdumpHelper_std__string(d, value, d.createType("char"), d.currentItemFormat())
@@ -760,10 +761,10 @@ def qdump__std__pair(d, value):
d.putValue(value.value, value.encoding)
def qform__std__unordered_map():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qform__std____debug__unordered_map():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__std__unordered_map(d, value):
if d.isQnxTarget() or d.isMsvcTarget():
@@ -861,7 +862,7 @@ def qdump__std__unordered_set(d, value):
p = d.extractPointer(p + offset)
def qform__std____1__unordered_map():
- return mapForms()
+ return [DisplayFormat.CompactMapFormat]
def qdump__std____1__unordered_map(d, value):
(size, _) = value["__table_"]["__p2_"].split("pp")
@@ -916,7 +917,7 @@ def qdump__std____debug__unordered_multiset(d, value):
def qform__std__valarray():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__std__valarray(d, value):
if d.isMsvcTarget():
@@ -928,7 +929,7 @@ def qdump__std__valarray(d, value):
def qform__std____1__valarray():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__std____1__valarray(d, value):
innerType = value.type[0]
@@ -939,7 +940,7 @@ def qdump__std____1__valarray(d, value):
def qform__std__vector():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qedit__std__vector(d, value, data):
import gdb
@@ -1036,13 +1037,13 @@ def qdumpHelper__std__vector__QNX(d, value):
d.putPlotData(start, size, innerType)
def qform__std____1__vector():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__std____1__vector(d, value):
qdumpHelper__std__vector(d, value, True)
def qform__std____debug__vector():
- return arrayForms()
+ return [DisplayFormat.ArrayPlotFormat]
def qdump__std____debug__vector(d, value):
qdump__std__vector(d, value)
@@ -1088,7 +1089,7 @@ def qdump__string(d, value):
qdump__std__string(d, value)
def qform__std__wstring():
- return [SimpleFormat, SeparateFormat]
+ return [DisplayFormat.SimpleFormat, DisplayFormat.SeparateFormat]
def qdump__std__wstring(d, value):
qdumpHelper_std__string(d, value, d.createType('wchar_t'), d.currentItemFormat())
@@ -1131,7 +1132,7 @@ def qdump__std____1__basic_string(d, value):
elif innerType == "wchar_t":
qdump__std____1__wstring(d, value)
else:
- warn("UNKNOWN INNER TYPE %s" % innerType)
+ d.warn("UNKNOWN INNER TYPE %s" % innerType)
def qdump__wstring(d, value):
qdump__std__wstring(d, value)
@@ -1183,7 +1184,7 @@ def qdump__std__byte(d, value):
def qdump__std__optional(d, value):
innerType = value.type[0]
- (initialized, pad, payload) = d.split('b@{%s}' % innerType.name, value)
+ (payload, pad, initialized) = d.split('{%s}@b' % innerType.name, value)
if initialized:
d.putItem(payload)
d.putBetterType(value.type)
diff --git a/share/qtcreator/debugger/utils.py b/share/qtcreator/debugger/utils.py
new file mode 100644
index 00000000000..f67b9311199
--- /dev/null
+++ b/share/qtcreator/debugger/utils.py
@@ -0,0 +1,130 @@
+############################################################################
+#
+# Copyright (C) 2016 The Qt Company Ltd.
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of Qt Creator.
+#
+# Commercial License Usage
+# Licensees holding valid commercial Qt licenses may use this file in
+# accordance with the commercial license agreement provided with the
+# Software or, alternatively, in accordance with the terms contained in
+# a written agreement between you and The Qt Company. For licensing terms
+# and conditions see https://www.qt.io/terms-conditions. For further
+# information use the contact form at https://www.qt.io/contact-us.
+#
+# GNU General Public License Usage
+# Alternatively, this file may be used under the terms of the GNU
+# General Public License version 3 as published by the Free Software
+# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+# included in the packaging of this file. Please review the following
+# information to ensure the GNU General Public License requirements will
+# be met: https://www.gnu.org/licenses/gpl-3.0.html.
+#
+############################################################################
+
+# Debugger start modes. Keep in sync with DebuggerStartMode in debuggerconstants.h
+
+
+class DebuggerStartMode:
+ (
+ NoStartMode,
+ StartInternal,
+ StartExternal,
+ AttachExternal,
+ AttachCrashedExternal,
+ AttachCore,
+ AttachToRemoteServer,
+ AttachToRemoteProcess,
+ StartRemoteProcess,
+ ) = range(0, 9)
+
+
+# Known special formats. Keep in sync with DisplayFormat in debuggerprotocol.h
+class DisplayFormat:
+ (
+ AutomaticFormat,
+ RawFormat,
+ SimpleFormat,
+ EnhancedFormat,
+ SeparateFormat,
+ Latin1StringFormat,
+ SeparateLatin1StringFormat,
+ Utf8StringFormat,
+ SeparateUtf8StringFormat,
+ Local8BitStringFormat,
+ Utf16StringFormat,
+ Ucs4StringFormat,
+ Array10Format,
+ Array100Format,
+ Array1000Format,
+ Array10000Format,
+ ArrayPlotFormat,
+ CompactMapFormat,
+ DirectQListStorageFormat,
+ IndirectQListStorageFormat,
+ ) = range(0, 20)
+
+
+# Breakpoints. Keep synchronized with BreakpointType in breakpoint.h
+class BreakpointType:
+ (
+ UnknownType,
+ BreakpointByFileAndLine,
+ BreakpointByFunction,
+ BreakpointByAddress,
+ BreakpointAtThrow,
+ BreakpointAtCatch,
+ BreakpointAtMain,
+ BreakpointAtFork,
+ BreakpointAtExec,
+ BreakpointAtSysCall,
+ WatchpointAtAddress,
+ WatchpointAtExpression,
+ BreakpointOnQmlSignalEmit,
+ BreakpointAtJavaScriptThrow,
+ ) = range(0, 14)
+
+
+# Internal codes for types keep in sync with cdbextensions pytype.cpp
+class TypeCode:
+ (
+ TypeCodeTypedef,
+ TypeCodeStruct,
+ TypeCodeVoid,
+ TypeCodeIntegral,
+ TypeCodeFloat,
+ TypeCodeEnum,
+ TypeCodePointer,
+ TypeCodeArray,
+ TypeCodeComplex,
+ TypeCodeReference,
+ TypeCodeFunction,
+ TypeCodeMemberPointer,
+ TypeCodeFortranString,
+ TypeCodeUnresolvable,
+ TypeCodeBitfield,
+ TypeCodeRValueReference,
+ ) = range(0, 16)
+
+
+def isIntegralTypeName(name):
+ return name in (
+ "int",
+ "unsigned int",
+ "signed int",
+ "short",
+ "unsigned short",
+ "long",
+ "unsigned long",
+ "long long",
+ "unsigned long long",
+ "char",
+ "signed char",
+ "unsigned char",
+ "bool",
+ )
+
+
+def isFloatingPointTypeName(name):
+ return name in ("float", "double", "long double")
diff --git a/share/qtcreator/qml/qmlpuppet/commands/commands.pri b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
index 7bc595154b3..deee4c34e1c 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/commands.pri
+++ b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
@@ -29,9 +29,10 @@ HEADERS += $$PWD/puppetalivecommand.h
HEADERS += $$PWD/changeselectioncommand.h
HEADERS += $$PWD/drop3dlibraryitemcommand.h
HEADERS += $$PWD/update3dviewstatecommand.h
-HEADERS += $$PWD/enable3dviewcommand.h
HEADERS += $$PWD/view3dclosedcommand.h
HEADERS += $$PWD/puppettocreatorcommand.h
+HEADERS += $$PWD/inputeventcommand.h
+HEADERS += $$PWD/view3dactioncommand.h
SOURCES += $$PWD/synchronizecommand.cpp
SOURCES += $$PWD/debugoutputcommand.cpp
@@ -62,6 +63,7 @@ SOURCES += $$PWD/puppetalivecommand.cpp
SOURCES += $$PWD/changeselectioncommand.cpp
SOURCES += $$PWD/drop3dlibraryitemcommand.cpp
SOURCES += $$PWD/update3dviewstatecommand.cpp
-SOURCES += $$PWD/enable3dviewcommand.cpp
SOURCES += $$PWD/view3dclosedcommand.cpp
SOURCES += $$PWD/puppettocreatorcommand.cpp
+SOURCES += $$PWD/inputeventcommand.cpp
+SOURCES += $$PWD/view3dactioncommand.cpp
diff --git a/share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.cpp
new file mode 100644
index 00000000000..73a68b06207
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "inputeventcommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+InputEventCommand::InputEventCommand() = default;
+
+InputEventCommand::InputEventCommand(QInputEvent *e)
+ : m_type(e->type()),
+ m_modifiers(e->modifiers())
+{
+ if (m_type == QEvent::Wheel) {
+ auto we = static_cast<QWheelEvent *>(e);
+#if QT_VERSION <= QT_VERSION_CHECK(5, 15, 0)
+ m_pos = we->pos();
+#else
+ m_pos = we->position().toPoint();
+#endif
+ m_buttons = we->buttons();
+ m_angleDelta = we->angleDelta().y();
+ } else {
+ auto me = static_cast<QMouseEvent *>(e);
+ m_pos = me->pos();
+ m_button = me->button();
+ m_buttons = me->buttons();
+ }
+}
+
+QDataStream &operator<<(QDataStream &out, const InputEventCommand &command)
+{
+ out << command.type();
+ out << command.pos();
+ out << command.button();
+ out << command.buttons();
+ out << command.modifiers();
+ out << command.angleDelta();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, InputEventCommand &command)
+{
+ int type;
+ int button;
+ in >> type;
+ command.m_type = (QEvent::Type)type;
+ in >> command.m_pos;
+ in >> button;
+ command.m_button = (Qt::MouseButton)button;
+ in >> command.m_buttons;
+ in >> command.m_modifiers;
+ in >> command.m_angleDelta;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const InputEventCommand &command)
+{
+ return debug.nospace() << "InputEventCommand("
+ << "type: " << command.type() << ", "
+ << "pos: " << command.pos() << ", "
+ << "button: " << command.button() << ", "
+ << "buttons: " << command.buttons() << ", "
+ << "modifiers: " << command.modifiers() << ", "
+ << "angleDelta: " << command.angleDelta() << ")";
+
+}
+
+} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.h b/share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.h
new file mode 100644
index 00000000000..2d77cab6dd5
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/inputeventcommand.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtCore/qmetatype.h>
+#include <QtCore/qdatastream.h>
+#include <QtGui/qevent.h>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class InputEventCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, InputEventCommand &command);
+ friend QDebug operator <<(QDebug debug, const InputEventCommand &command);
+
+public:
+ InputEventCommand();
+ explicit InputEventCommand(QInputEvent *e);
+
+ QEvent::Type type() const { return m_type; }
+ QPoint pos() const { return m_pos; }
+ Qt::MouseButton button() const { return m_button; }
+ Qt::MouseButtons buttons() const { return m_buttons; }
+ Qt::KeyboardModifiers modifiers() const { return m_modifiers; }
+ int angleDelta() const { return m_angleDelta; }
+
+private:
+ QEvent::Type m_type;
+ QPoint m_pos;
+ Qt::MouseButton m_button = Qt::NoButton;
+ Qt::MouseButtons m_buttons = Qt::NoButton;
+ Qt::KeyboardModifiers m_modifiers = Qt::NoModifier;
+ int m_angleDelta = 0;
+};
+
+QDataStream &operator<<(QDataStream &out, const InputEventCommand &command);
+QDataStream &operator>>(QDataStream &in, InputEventCommand &command);
+
+QDebug operator <<(QDebug debug, const InputEventCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::InputEventCommand)
diff --git a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
index 3ac17ee0c5b..91c2877f4b3 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
@@ -34,7 +34,7 @@ namespace QmlDesigner {
class PuppetToCreatorCommand
{
public:
- enum Type { KeyPressed, Edit3DToolState, None };
+ enum Type { KeyPressed, Edit3DToolState, Render3DView, ActiveSceneChanged, None };
PuppetToCreatorCommand(Type type, const QVariant &data);
PuppetToCreatorCommand() = default;
diff --git a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp
index b387cf09f3d..584e041c7ab 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp
+++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp
@@ -45,6 +45,12 @@ Update3dViewStateCommand::Update3dViewStateCommand(bool active, bool hasPopup)
{
}
+Update3dViewStateCommand::Update3dViewStateCommand(const QSize &size)
+ : m_size(size)
+ , m_type(Update3dViewStateCommand::SizeChange)
+{
+}
+
Qt::WindowStates Update3dViewStateCommand::previousStates() const
{
return m_previousStates;
@@ -65,6 +71,11 @@ bool Update3dViewStateCommand::hasPopup() const
return m_hasPopup;
}
+QSize Update3dViewStateCommand::size() const
+{
+ return m_size;
+}
+
Update3dViewStateCommand::Type Update3dViewStateCommand::type() const
{
return m_type;
@@ -77,6 +88,7 @@ QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &comman
out << qint32(command.isActive());
out << qint32(command.hasPopup());
out << qint32(command.type());
+ out << command.size();
return out;
}
@@ -94,13 +106,16 @@ QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command)
command.m_active = active;
command.m_hasPopup = hasPopup;
command.m_type = Update3dViewStateCommand::Type(type);
+ in >> command.m_size;
return in;
}
QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command)
{
- return debug.nospace() << "Update3dViewStateCommand(type: " << command.m_type << ")";
+ return debug.nospace() << "Update3dViewStateCommand(type: "
+ << command.m_type << ","
+ << command.m_size << ")";
}
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h
index de8511255d5..a38ca4bb543 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h
@@ -26,6 +26,7 @@
#pragma once
#include <QMetaType>
+#include <QtCore/qsize.h>
namespace QmlDesigner {
@@ -35,10 +36,11 @@ class Update3dViewStateCommand
friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
public:
- enum Type { StateChange, ActiveChange, Empty };
+ enum Type { StateChange, ActiveChange, SizeChange, Empty };
explicit Update3dViewStateCommand(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
explicit Update3dViewStateCommand(bool active, bool hasPopup);
+ explicit Update3dViewStateCommand(const QSize &size);
Update3dViewStateCommand() = default;
Qt::WindowStates previousStates() const;
@@ -46,6 +48,7 @@ public:
bool isActive() const;
bool hasPopup() const;
+ QSize size() const;
Type type() const;
@@ -55,6 +58,7 @@ private:
bool m_active = false;
bool m_hasPopup = false;
+ QSize m_size;
Type m_type = Empty;
};
diff --git a/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.cpp
index 7fd3b3f350a..ae94ed79812 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.cpp
+++ b/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -23,43 +23,54 @@
**
****************************************************************************/
-#include "enable3dviewcommand.h"
+#include "view3dactioncommand.h"
#include <QDebug>
#include <QDataStream>
namespace QmlDesigner {
-// open / close edit view 3D command
-Enable3DViewCommand::Enable3DViewCommand(bool enable)
- : m_enable(enable)
+View3DActionCommand::View3DActionCommand(Type type, bool enable)
+ : m_type(type)
+ , m_enabled(enable)
{
}
-bool Enable3DViewCommand::isEnable() const
+bool View3DActionCommand::isEnabled() const
{
- return m_enable;
+ return m_enabled;
}
-QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command)
+View3DActionCommand::Type View3DActionCommand::type() const
{
- out << qint32(command.isEnable());
+ return m_type;
+}
+
+QDataStream &operator<<(QDataStream &out, const View3DActionCommand &command)
+{
+ out << qint32(command.isEnabled());
+ out << qint32(command.type());
return out;
}
-QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command)
+QDataStream &operator>>(QDataStream &in, View3DActionCommand &command)
{
- qint32 enable;
- in >> enable;
- command.m_enable = enable;
+ qint32 enabled;
+ qint32 type;
+ in >> enabled;
+ in >> type;
+ command.m_enabled = bool(enabled);
+ command.m_type = View3DActionCommand::Type(type);
return in;
}
-QDebug operator<<(QDebug debug, const Enable3DViewCommand &command)
+QDebug operator<<(QDebug debug, const View3DActionCommand &command)
{
- return debug.nospace() << "Enable3DViewCommand(enable: " << command.m_enable << ")";
+ return debug.nospace() << "View3DActionCommand(type: "
+ << command.m_type << ","
+ << command.m_enabled << ")";
}
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h b/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h
new file mode 100644
index 00000000000..9f25e2abb4b
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/view3dactioncommand.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QMetaType>
+
+namespace QmlDesigner {
+
+class View3DActionCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, View3DActionCommand &command);
+ friend QDebug operator<<(QDebug debug, const View3DActionCommand &command);
+
+public:
+ enum Type { Empty,
+ MoveTool,
+ ScaleTool,
+ RotateTool,
+ FitToView,
+ SelectionModeToggle,
+ CameraToggle,
+ OrientationToggle,
+ EditLightToggle
+ };
+
+ explicit View3DActionCommand(Type type, bool enable);
+ View3DActionCommand() = default;
+
+ bool isEnabled() const;
+ Type type() const;
+
+private:
+ Type m_type = Empty;
+ bool m_enabled = false;
+};
+
+QDataStream &operator<<(QDataStream &out, const View3DActionCommand &command);
+QDataStream &operator>>(QDataStream &in, View3DActionCommand &command);
+
+QDebug operator<<(QDebug debug, const View3DActionCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::View3DActionCommand)
diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
index 4ca4f0fb385..e42c8bb3a2a 100644
--- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
+++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
@@ -42,7 +42,6 @@
#include "createinstancescommand.h"
#include "createscenecommand.h"
#include "update3dviewstatecommand.h"
-#include "enable3dviewcommand.h"
#include "changevaluescommand.h"
#include "changebindingscommand.h"
#include "changeauxiliarycommand.h"
@@ -57,6 +56,8 @@
#include "synchronizecommand.h"
#include "removesharedmemorycommand.h"
#include "tokencommand.h"
+#include "inputeventcommand.h"
+#include "view3dactioncommand.h"
#include "informationchangedcommand.h"
#include "pixmapchangedcommand.h"
@@ -76,6 +77,13 @@
namespace QmlDesigner {
+constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ = &QLocalSocket::error;
+#else
+ = &QLocalSocket::errorOccurred;
+#endif
+
NodeInstanceClientProxy::NodeInstanceClientProxy(QObject *parent)
: QObject(parent),
m_inputIoDevice(nullptr),
@@ -93,7 +101,7 @@ void NodeInstanceClientProxy::initializeSocket()
{
QLocalSocket *localSocket = new QLocalSocket(this);
connect(localSocket, &QIODevice::readyRead, this, &NodeInstanceClientProxy::readDataStream);
- connect(localSocket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
+ connect(localSocket, LocalSocketErrorFunction,
QCoreApplication::instance(), &QCoreApplication::quit);
connect(localSocket, &QLocalSocket::disconnected, QCoreApplication::instance(), &QCoreApplication::quit);
localSocket->connectToServer(QCoreApplication::arguments().at(1), QIODevice::ReadWrite | QIODevice::Unbuffered);
@@ -321,6 +329,16 @@ QVariant NodeInstanceClientProxy::readCommandFromIOStream(QIODevice *ioDevice, q
return command;
}
+void NodeInstanceClientProxy::inputEvent(const InputEventCommand &command)
+{
+ nodeInstanceServer()->inputEvent(command);
+}
+
+void NodeInstanceClientProxy::view3DAction(const View3DActionCommand &command)
+{
+ nodeInstanceServer()->view3DAction(command);
+}
+
void NodeInstanceClientProxy::readDataStream()
{
QList<QVariant> commandList;
@@ -379,11 +397,6 @@ void NodeInstanceClientProxy::update3DViewState(const Update3dViewStateCommand &
nodeInstanceServer()->update3DViewState(command);
}
-void NodeInstanceClientProxy::enable3DView(const Enable3DViewCommand &command)
-{
- nodeInstanceServer()->enable3DView(command);
-}
-
void NodeInstanceClientProxy::clearScene(const ClearSceneCommand &command)
{
nodeInstanceServer()->clearScene(command);
@@ -472,7 +485,6 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
{
static const int createInstancesCommandType = QMetaType::type("CreateInstancesCommand");
static const int update3dViewStateCommand = QMetaType::type("Update3dViewStateCommand");
- static const int enable3DViewCommandType = QMetaType::type("Enable3DViewCommand");
static const int changeFileUrlCommandType = QMetaType::type("ChangeFileUrlCommand");
static const int createSceneCommandType = QMetaType::type("CreateSceneCommand");
static const int clearSceneCommandType = QMetaType::type("ClearSceneCommand");
@@ -491,15 +503,17 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
static const int tokenCommandType = QMetaType::type("TokenCommand");
static const int endPuppetCommandType = QMetaType::type("EndPuppetCommand");
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
+ static const int inputEventCommandType = QMetaType::type("InputEventCommand");
+ static const int view3DActionCommandType = QMetaType::type("View3DActionCommand");
const int commandType = command.userType();
- if (commandType == createInstancesCommandType)
+ if (commandType == inputEventCommandType)
+ inputEvent(command.value<InputEventCommand>());
+ else if (commandType == createInstancesCommandType)
createInstances(command.value<CreateInstancesCommand>());
else if (commandType == update3dViewStateCommand)
update3DViewState(command.value<Update3dViewStateCommand>());
- else if (commandType == enable3DViewCommandType)
- enable3DView(command.value<Enable3DViewCommand>());
else if (commandType == changeFileUrlCommandType)
changeFileUrl(command.value<ChangeFileUrlCommand>());
else if (commandType == createSceneCommandType)
@@ -532,6 +546,8 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
redirectToken(command.value<TokenCommand>());
else if (commandType == endPuppetCommandType)
redirectToken(command.value<EndPuppetCommand>());
+ else if (commandType == view3DActionCommandType)
+ view3DAction(command.value<View3DActionCommand>());
else if (commandType == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
index 6a114bbe3e1..6cafd282af4 100644
--- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
+++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
@@ -46,7 +46,6 @@ class CreateInstancesCommand;
class ClearSceneCommand;
class ReparentInstancesCommand;
class Update3dViewStateCommand;
-class Enable3DViewCommand;
class ChangeFileUrlCommand;
class ChangeValuesCommand;
class ChangeAuxiliaryCommand;
@@ -62,6 +61,8 @@ class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
class PuppetToCreatorCommand;
class View3DClosedCommand;
+class InputEventCommand;
+class View3DActionCommand;
class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface
{
@@ -102,7 +103,6 @@ protected:
void createScene(const CreateSceneCommand &command);
void clearScene(const ClearSceneCommand &command);
void update3DViewState(const Update3dViewStateCommand &command);
- void enable3DView(const Enable3DViewCommand &command);
void removeInstances(const RemoveInstancesCommand &command);
void removeProperties(const RemovePropertiesCommand &command);
void changePropertyBindings(const ChangeBindingsCommand &command);
@@ -118,6 +118,8 @@ protected:
void redirectToken(const EndPuppetCommand &command);
void changeSelection(const ChangeSelectionCommand &command);
static QVariant readCommandFromIOStream(QIODevice *ioDevice, quint32 *readCommandCounter, quint32 *blockSize);
+ void inputEvent(const InputEventCommand &command);
+ void view3DAction(const View3DActionCommand &command);
protected slots:
void readDataStream();
diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
index 5c7c9d2953a..b2703f7f320 100644
--- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
+++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
@@ -33,7 +33,6 @@
#include "createinstancescommand.h"
#include "createscenecommand.h"
#include "update3dviewstatecommand.h"
-#include "enable3dviewcommand.h"
#include "changevaluescommand.h"
#include "changebindingscommand.h"
#include "changeauxiliarycommand.h"
@@ -49,6 +48,8 @@
#include "changenodesourcecommand.h"
#include "changeselectioncommand.h"
#include "drop3dlibraryitemcommand.h"
+#include "inputeventcommand.h"
+#include "view3dactioncommand.h"
#include "informationchangedcommand.h"
#include "pixmapchangedcommand.h"
@@ -97,9 +98,6 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<Update3dViewStateCommand>("Update3dViewStateCommand");
qRegisterMetaTypeStreamOperators<Update3dViewStateCommand>("Update3dViewStateCommand");
- qRegisterMetaType<Enable3DViewCommand>("Enable3DViewCommand");
- qRegisterMetaTypeStreamOperators<Enable3DViewCommand>("Enable3DViewCommand");
-
qRegisterMetaType<ChangeBindingsCommand>("ChangeBindingsCommand");
qRegisterMetaTypeStreamOperators<ChangeBindingsCommand>("ChangeBindingsCommand");
@@ -214,6 +212,12 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<PuppetToCreatorCommand>("PuppetToCreatorCommand");
qRegisterMetaTypeStreamOperators<PuppetToCreatorCommand>("PuppetToCreatorCommand");
+ qRegisterMetaType<InputEventCommand>("InputEventCommand");
+ qRegisterMetaTypeStreamOperators<InputEventCommand>("InputEventCommand");
+
+ qRegisterMetaType<View3DActionCommand>("View3DActionCommand");
+ qRegisterMetaTypeStreamOperators<View3DActionCommand>("View3DActionCommand");
+
qRegisterMetaType<QPair<int, int>>("QPairIntInt");
qRegisterMetaTypeStreamOperators<QPair<int, int>>("QPairIntInt");
}
diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h
index e60d99b1e19..0c6009e4778 100644
--- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h
+++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h
@@ -34,7 +34,6 @@ class PropertyBindingContainer;
class PropertyValueContainer;
class Update3dViewStateCommand;
-class Enable3DViewCommand;
class ChangeFileUrlCommand;
class ChangeValuesCommand;
class ChangeBindingsCommand;
@@ -52,6 +51,8 @@ class ChangeNodeSourceCommand;
class TokenCommand;
class RemoveSharedMemoryCommand;
class ChangeSelectionCommand;
+class InputEventCommand;
+class View3DActionCommand;
class NodeInstanceServerInterface : public QObject
{
@@ -69,7 +70,6 @@ public:
virtual void createScene(const CreateSceneCommand &command) = 0;
virtual void clearScene(const ClearSceneCommand &command) = 0;
virtual void update3DViewState(const Update3dViewStateCommand &command) = 0;
- virtual void enable3DView(const Enable3DViewCommand &command) = 0;
virtual void removeInstances(const RemoveInstancesCommand &command) = 0;
virtual void removeProperties(const RemovePropertiesCommand &command) = 0;
virtual void changePropertyBindings(const ChangeBindingsCommand &command) = 0;
@@ -83,6 +83,8 @@ public:
virtual void token(const TokenCommand &command) = 0;
virtual void removeSharedMemory(const RemoveSharedMemoryCommand &command) = 0;
virtual void changeSelection(const ChangeSelectionCommand &command) = 0;
+ virtual void inputEvent(const InputEventCommand &command) = 0;
+ virtual void view3DAction(const View3DActionCommand &command) = 0;
virtual void benchmark(const QString &)
{}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
index 4b90659e6e6..9ee23e48a4e 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml
@@ -30,16 +30,11 @@ import QtQuick.Controls 2.0
import QtGraphicalEffects 1.0
import MouseArea3D 1.0
-Window {
- id: viewWindow
+Item {
+ id: viewRoot
width: 1024
height: 768
- minimumHeight: 200
- minimumWidth: 200
visible: true
- title: qsTr("3D Edit View [") + sceneId + qsTr("]")
- // need all those flags otherwise the title bar disappears after setting WindowStaysOnTopHint flag later
- flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
property Node activeScene: null
property View3D editView: null
@@ -48,6 +43,7 @@ Window {
property alias showEditLight: btnEditViewLight.toggled
property alias usePerspective: btnPerspective.toggled
property alias globalOrientation: btnLocalGlobal.toggled
+ property alias contentItem: contentItem
property Node selectedNode: null // This is non-null only in single selection case
property var selectedNodes: [] // All selected nodes
@@ -57,6 +53,8 @@ Window {
property var selectionBoxes: []
property rect viewPortRect: Qt.rect(0, 0, 1000, 1000)
+ property bool showButtons: false
+
signal selectionChanged(var selectedNodes)
signal commitObjectProperty(var object, var propName)
signal changeObjectProperty(var object, var propName)
@@ -86,7 +84,7 @@ Window {
editView.cameraZoomFactor = Qt.binding(function() {return cameraControl._zoomFactor;});
selectionBoxes.length = 0;
- updateToolStates();
+ updateToolStates(_generalHelper.getToolStates(sceneId), true);
}
}
}
@@ -99,54 +97,62 @@ Window {
_generalHelper.enableItemUpdate(editView, (scene && scene === activeScene));
}
-
- function restoreWindowState()
+ function fitToView()
{
- // It is expected that tool states have been initialized before calling this
- _generalHelper.restoreWindowState(viewWindow);
+ if (editView) {
+ var targetNode = selectedNodes.length > 0
+ ? selectionBoxes[0].model : null;
+ cameraControl.focusObject(targetNode, editView.camera.rotation, true);
+ }
}
- function updateToolStates()
+ // If resetToDefault is true, tool states not specifically set to anything will be reset to
+ // their default state.
+ function updateToolStates(toolStates, resetToDefault)
{
- var toolStates = _generalHelper.getToolStates(sceneId);
if ("showEditLight" in toolStates)
showEditLight = toolStates.showEditLight;
- else
+ else if (resetToDefault)
showEditLight = false;
if ("usePerspective" in toolStates)
usePerspective = toolStates.usePerspective;
- else
+ else if (resetToDefault)
usePerspective = false;
if ("globalOrientation" in toolStates)
globalOrientation = toolStates.globalOrientation;
- else
+ else if (resetToDefault)
globalOrientation = false;
var groupIndex;
var group;
var i;
- btnSelectItem.selected = false;
- btnSelectGroup.selected = true;
+
if ("groupSelect" in toolStates) {
groupIndex = toolStates.groupSelect;
group = toolbarButtons.buttonGroups["groupSelect"];
for (i = 0; i < group.length; ++i)
group[i].selected = (i === groupIndex);
+ _generalHelper.storeToolState(sceneId, "groupSelect", groupIndex)
+ } else if (resetToDefault) {
+ btnSelectItem.selected = true;
+ btnSelectGroup.selected = false;
}
- btnRotate.selected = false;
- btnScale.selected = false;
- btnMove.selected = true;
if ("groupTransform" in toolStates) {
groupIndex = toolStates.groupTransform;
group = toolbarButtons.buttonGroups["groupTransform"];
for (i = 0; i < group.length; ++i)
group[i].selected = (i === groupIndex);
+ _generalHelper.storeToolState(sceneId, "groupTransform", groupIndex)
+ } else if (resetToDefault) {
+ btnRotate.selected = false;
+ btnScale.selected = false;
+ btnMove.selected = true;
}
if ("editCamState" in toolStates)
cameraControl.restoreCameraState(toolStates.editCamState);
- else
+ else if (resetToDefault)
cameraControl.restoreDefaultState();
}
@@ -324,37 +330,27 @@ Window {
_generalHelper.requestOverlayUpdate();
}
- onWidthChanged: {
- _generalHelper.requestOverlayUpdate();
- _generalHelper.storeWindowState(viewWindow);
- }
- onHeightChanged: {
- _generalHelper.requestOverlayUpdate();
- _generalHelper.storeWindowState(viewWindow);
-
- }
- onXChanged: _generalHelper.storeWindowState(viewWindow);
- onYChanged: _generalHelper.storeWindowState(viewWindow);
- onWindowStateChanged: _generalHelper.storeWindowState(viewWindow);
+ onWidthChanged: _generalHelper.requestOverlayUpdate()
+ onHeightChanged: _generalHelper.requestOverlayUpdate()
Node {
id: overlayScene
PerspectiveCamera {
id: overlayPerspectiveCamera
- clipFar: viewWindow.editView ? viewWindow.editView.perpectiveCamera.clipFar : 1000
- clipNear: viewWindow.editView ? viewWindow.editView.perpectiveCamera.clipNear : 1
- position: viewWindow.editView ? viewWindow.editView.perpectiveCamera.position : Qt.vector3d(0, 0, 0)
- rotation: viewWindow.editView ? viewWindow.editView.perpectiveCamera.rotation : Qt.vector3d(0, 0, 0)
+ clipFar: viewRoot.editView ? viewRoot.editView.perpectiveCamera.clipFar : 1000
+ clipNear: viewRoot.editView ? viewRoot.editView.perpectiveCamera.clipNear : 1
+ position: viewRoot.editView ? viewRoot.editView.perpectiveCamera.position : Qt.vector3d(0, 0, 0)
+ rotation: viewRoot.editView ? viewRoot.editView.perpectiveCamera.rotation : Qt.vector3d(0, 0, 0)
}
OrthographicCamera {
id: overlayOrthoCamera
- clipFar: viewWindow.editView ? viewWindow.editView.orthoCamera.clipFar : 1000
- clipNear: viewWindow.editView ? viewWindow.editView.orthoCamera.clipNear : 1
- position: viewWindow.editView ? viewWindow.editView.orthoCamera.position : Qt.vector3d(0, 0, 0)
- rotation: viewWindow.editView ? viewWindow.editView.orthoCamera.rotation : Qt.vector3d(0, 0, 0)
- scale: viewWindow.editView ? viewWindow.editView.orthoCamera.scale : Qt.vector3d(0, 0, 0)
+ clipFar: viewRoot.editView ? viewRoot.editView.orthoCamera.clipFar : 1000
+ clipNear: viewRoot.editView ? viewRoot.editView.orthoCamera.clipNear : 1
+ position: viewRoot.editView ? viewRoot.editView.orthoCamera.position : Qt.vector3d(0, 0, 0)
+ rotation: viewRoot.editView ? viewRoot.editView.orthoCamera.rotation : Qt.vector3d(0, 0, 0)
+ scale: viewRoot.editView ? viewRoot.editView.orthoCamera.scale : Qt.vector3d(0, 0, 0)
}
MouseArea3D {
@@ -366,41 +362,41 @@ Window {
id: moveGizmo
scale: autoScale.getScale(Qt.vector3d(5, 5, 5))
highlightOnHover: true
- targetNode: viewWindow.selectedNode
- globalOrientation: viewWindow.globalOrientation
- visible: viewWindow.selectedNode && btnMove.selected
+ targetNode: viewRoot.selectedNode
+ globalOrientation: viewRoot.globalOrientation
+ visible: viewRoot.selectedNode && btnMove.selected
view3D: overlayView
dragHelper: gizmoDragHelper
- onPositionCommit: viewWindow.commitObjectProperty(viewWindow.selectedNode, "position")
- onPositionMove: viewWindow.changeObjectProperty(viewWindow.selectedNode, "position")
+ onPositionCommit: viewRoot.commitObjectProperty(viewRoot.selectedNode, "position")
+ onPositionMove: viewRoot.changeObjectProperty(viewRoot.selectedNode, "position")
}
ScaleGizmo {
id: scaleGizmo
scale: autoScale.getScale(Qt.vector3d(5, 5, 5))
highlightOnHover: true
- targetNode: viewWindow.selectedNode
- visible: viewWindow.selectedNode && btnScale.selected
+ targetNode: viewRoot.selectedNode
+ visible: viewRoot.selectedNode && btnScale.selected
view3D: overlayView
dragHelper: gizmoDragHelper
- onScaleCommit: viewWindow.commitObjectProperty(viewWindow.selectedNode, "scale")
- onScaleChange: viewWindow.changeObjectProperty(viewWindow.selectedNode, "scale")
+ onScaleCommit: viewRoot.commitObjectProperty(viewRoot.selectedNode, "scale")
+ onScaleChange: viewRoot.changeObjectProperty(viewRoot.selectedNode, "scale")
}
RotateGizmo {
id: rotateGizmo
scale: autoScale.getScale(Qt.vector3d(7, 7, 7))
highlightOnHover: true
- targetNode: viewWindow.selectedNode
- globalOrientation: viewWindow.globalOrientation
- visible: viewWindow.selectedNode && btnRotate.selected
+ targetNode: viewRoot.selectedNode
+ globalOrientation: viewRoot.globalOrientation
+ visible: viewRoot.selectedNode && btnRotate.selected
view3D: overlayView
dragHelper: gizmoDragHelper
- onRotateCommit: viewWindow.commitObjectProperty(viewWindow.selectedNode, "rotation")
- onRotateChange: viewWindow.changeObjectProperty(viewWindow.selectedNode, "rotation")
+ onRotateCommit: viewRoot.commitObjectProperty(viewRoot.selectedNode, "rotation")
+ onRotateChange: viewRoot.changeObjectProperty(viewRoot.selectedNode, "rotation")
}
AutoScaleHelper {
@@ -412,31 +408,31 @@ Window {
Line3D {
id: pivotLine
- visible: viewWindow.selectedNode
+ visible: viewRoot.selectedNode
name: "3D Edit View Pivot Line"
color: "#ddd600"
function flipIfNeeded(vec) {
- if (!viewWindow.selectedNode || viewWindow.selectedNode.orientation === Node.LeftHanded)
+ if (!viewRoot.selectedNode || viewRoot.selectedNode.orientation === Node.LeftHanded)
return vec;
else
return Qt.vector3d(vec.x, vec.y, -vec.z);
}
- startPos: viewWindow.selectedNode ? flipIfNeeded(viewWindow.selectedNode.scenePosition)
+ startPos: viewRoot.selectedNode ? flipIfNeeded(viewRoot.selectedNode.scenePosition)
: Qt.vector3d(0, 0, 0)
Connections {
- target: viewWindow
+ target: viewRoot
onSelectedNodeChanged: {
pivotLine.endPos = pivotLine.flipIfNeeded(gizmoDragHelper.pivotScenePosition(
- viewWindow.selectedNode));
+ viewRoot.selectedNode));
}
}
Connections {
- target: viewWindow.selectedNode
+ target: viewRoot.selectedNode
onSceneTransformChanged: {
pivotLine.endPos = pivotLine.flipIfNeeded(gizmoDragHelper.pivotScenePosition(
- viewWindow.selectedNode));
+ viewRoot.selectedNode));
}
}
@@ -457,243 +453,235 @@ Window {
}
}
- Rectangle {
- id: viewRect
+ Item {
+ id: contentItem
anchors.fill: parent
- focus: true
-
- gradient: Gradient {
- GradientStop { position: 1.0; color: "#222222" }
- GradientStop { position: 0.0; color: "#999999" }
- }
-
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton
- onClicked: {
- if (viewWindow.editView) {
- var pickResult = viewWindow.editView.pick(mouse.x, mouse.y);
- handleObjectClicked(_generalHelper.resolvePick(pickResult.objectHit),
- mouse.modifiers & Qt.ControlModifier);
- if (!pickResult.objectHit)
- mouse.accepted = false;
- }
- }
- }
- DropArea {
+ Rectangle {
+ id: viewRect
anchors.fill: parent
- }
+ focus: true
- View3D {
- id: overlayView
- anchors.fill: parent
- camera: usePerspective ? overlayPerspectiveCamera : overlayOrthoCamera
- importScene: overlayScene
- z: 2
- }
+ gradient: Gradient {
+ GradientStop { position: 1.0; color: "#222222" }
+ GradientStop { position: 0.0; color: "#999999" }
+ }
- Overlay2D {
- id: gizmoLabel
- targetNode: moveGizmo.visible ? moveGizmo : scaleGizmo
- targetView: overlayView
- visible: targetNode.dragging
- z: 3
-
- Rectangle {
- color: "white"
- x: -width / 2
- y: -height - 8
- width: gizmoLabelText.width + 4
- height: gizmoLabelText.height + 4
- border.width: 1
- Text {
- id: gizmoLabelText
- text: {
- var l = Qt.locale();
- var targetProperty;
- if (viewWindow.selectedNode) {
- if (gizmoLabel.targetNode === moveGizmo)
- targetProperty = viewWindow.selectedNode.position;
- else
- targetProperty = viewWindow.selectedNode.scale;
- return qsTr("x:") + Number(targetProperty.x).toLocaleString(l, 'f', 1)
- + qsTr(" y:") + Number(targetProperty.y).toLocaleString(l, 'f', 1)
- + qsTr(" z:") + Number(targetProperty.z).toLocaleString(l, 'f', 1);
- } else {
- return "";
- }
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton
+ onClicked: {
+ if (viewRoot.editView) {
+ var pickResult = viewRoot.editView.pick(mouse.x, mouse.y);
+ handleObjectClicked(_generalHelper.resolvePick(pickResult.objectHit),
+ mouse.modifiers & Qt.ControlModifier);
+ if (!pickResult.objectHit)
+ mouse.accepted = false;
}
- anchors.centerIn: parent
}
}
- }
-
- EditCameraController {
- id: cameraControl
- camera: viewWindow.editView ? viewWindow.editView.camera : null
- anchors.fill: parent
- view3d: viewWindow.editView
- sceneId: viewWindow.sceneId
- }
- }
- Rectangle { // toolbar
- id: toolbar
- color: "#9F000000"
- width: 35
- height: toolbarButtons.height
-
- Column {
- id: toolbarButtons
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: 5
- padding: 5
-
- // Button groups must be defined in parent object of buttons
- property var buttonGroups: {
- "groupSelect": [btnSelectGroup, btnSelectItem],
- "groupTransform": [btnMove, btnRotate, btnScale]
+ DropArea {
+ anchors.fill: parent
}
- ToolBarButton {
- id: btnSelectItem
- selected: true
- tooltip: qsTr("Select Item")
- shortcut: "Q"
- currentShortcut: selected ? "" : shortcut
- tool: "item_selection"
- buttonGroup: "groupSelect"
- sceneId: viewWindow.sceneId
+ View3D {
+ id: overlayView
+ anchors.fill: parent
+ camera: usePerspective ? overlayPerspectiveCamera : overlayOrthoCamera
+ importScene: overlayScene
+ z: 2
}
- ToolBarButton {
- id: btnSelectGroup
- tooltip: qsTr("Select Group")
- shortcut: "Q"
- currentShortcut: btnSelectItem.currentShortcut === shortcut ? "" : shortcut
- tool: "group_selection"
- buttonGroup: "groupSelect"
- sceneId: viewWindow.sceneId
+ Overlay2D {
+ id: gizmoLabel
+ targetNode: moveGizmo.visible ? moveGizmo : scaleGizmo
+ targetView: overlayView
+ visible: targetNode.dragging
+ z: 3
+
+ Rectangle {
+ color: "white"
+ x: -width / 2
+ y: -height - 8
+ width: gizmoLabelText.width + 4
+ height: gizmoLabelText.height + 4
+ border.width: 1
+ Text {
+ id: gizmoLabelText
+ text: {
+ var l = Qt.locale();
+ var targetProperty;
+ if (viewRoot.selectedNode) {
+ if (gizmoLabel.targetNode === moveGizmo)
+ targetProperty = viewRoot.selectedNode.position;
+ else
+ targetProperty = viewRoot.selectedNode.scale;
+ return qsTr("x:") + Number(targetProperty.x).toLocaleString(l, 'f', 1)
+ + qsTr(" y:") + Number(targetProperty.y).toLocaleString(l, 'f', 1)
+ + qsTr(" z:") + Number(targetProperty.z).toLocaleString(l, 'f', 1);
+ } else {
+ return "";
+ }
+ }
+ anchors.centerIn: parent
+ }
+ }
}
- Rectangle { // separator
- width: 25
- height: 1
- color: "#f1f1f1"
- anchors.horizontalCenter: parent.horizontalCenter
+ EditCameraController {
+ id: cameraControl
+ camera: viewRoot.editView ? viewRoot.editView.camera : null
+ anchors.fill: parent
+ view3d: viewRoot.editView
+ sceneId: viewRoot.sceneId
}
+ }
- ToolBarButton {
- id: btnMove
- selected: true
- tooltip: qsTr("Move current selection")
- shortcut: "W"
- currentShortcut: shortcut
- tool: "move"
- buttonGroup: "groupTransform"
- sceneId: viewWindow.sceneId
- }
+ Rectangle { // toolbar
+ id: toolbar
+ color: "#9F000000"
+ width: 35
+ height: toolbarButtons.height
+ visible: viewRoot.showButtons
- ToolBarButton {
- id: btnRotate
- tooltip: qsTr("Rotate current selection")
- shortcut: "E"
- currentShortcut: shortcut
- tool: "rotate"
- buttonGroup: "groupTransform"
- sceneId: viewWindow.sceneId
- }
+ Column {
+ id: toolbarButtons
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 5
+ padding: 5
- ToolBarButton {
- id: btnScale
- tooltip: qsTr("Scale current selection")
- shortcut: "R"
- currentShortcut: shortcut
- tool: "scale"
- buttonGroup: "groupTransform"
- sceneId: viewWindow.sceneId
- }
+ // Button groups must be defined in parent object of buttons
+ property var buttonGroups: {
+ "groupSelect": [btnSelectGroup, btnSelectItem],
+ "groupTransform": [btnMove, btnRotate, btnScale]
+ }
- Rectangle { // separator
- width: 25
- height: 1
- color: "#f1f1f1"
- anchors.horizontalCenter: parent.horizontalCenter
- }
+ ToolBarButton {
+ id: btnSelectItem
+ selected: true
+ tooltip: qsTr("Select Item")
+ shortcut: "Q"
+ currentShortcut: selected ? "" : shortcut
+ tool: "item_selection"
+ buttonGroup: "groupSelect"
+ sceneId: viewRoot.sceneId
+ }
- ToolBarButton {
- id: btnFit
- tooltip: qsTr("Fit camera to current selection")
- shortcut: "F"
- currentShortcut: shortcut
- tool: "fit"
- togglable: false
-
- onSelectedChanged: {
- if (viewWindow.editView && selected) {
- var targetNode = viewWindow.selectedNodes.length > 0
- ? selectionBoxes[0].model : null;
- cameraControl.focusObject(targetNode, viewWindow.editView.camera.rotation, true);
- }
+ ToolBarButton {
+ id: btnSelectGroup
+ tooltip: qsTr("Select Group")
+ shortcut: "Q"
+ currentShortcut: btnSelectItem.currentShortcut === shortcut ? "" : shortcut
+ tool: "group_selection"
+ buttonGroup: "groupSelect"
+ sceneId: viewRoot.sceneId
}
- }
- }
- }
- AxisHelper {
- anchors.right: parent.right
- anchors.top: parent.top
- width: 100
- height: width
- editCameraCtrl: cameraControl
- selectedNode : viewWindow.selectedNodes.length ? selectionBoxes[0].model : null
- }
+ Rectangle { // separator
+ width: 25
+ height: 1
+ color: "#f1f1f1"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
- Rectangle { // top controls bar
- color: "#aa000000"
- width: 290
- height: btnPerspective.height + 10
- anchors.top: parent.top
- anchors.right: parent.right
- anchors.rightMargin: 100
+ ToolBarButton {
+ id: btnMove
+ selected: true
+ tooltip: qsTr("Move current selection")
+ shortcut: "W"
+ currentShortcut: shortcut
+ tool: "move"
+ buttonGroup: "groupTransform"
+ sceneId: viewRoot.sceneId
+ }
- Row {
- padding: 5
- anchors.fill: parent
- ToggleButton {
- id: btnPerspective
- width: 105
- tooltip: qsTr("Toggle Perspective / Orthographic Projection")
- states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}]
- }
+ ToolBarButton {
+ id: btnRotate
+ tooltip: qsTr("Rotate current selection")
+ shortcut: "E"
+ currentShortcut: shortcut
+ tool: "rotate"
+ buttonGroup: "groupTransform"
+ sceneId: viewRoot.sceneId
+ }
- ToggleButton {
- id: btnLocalGlobal
- width: 65
- tooltip: qsTr("Toggle Global / Local Orientation")
- states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}]
- }
+ ToolBarButton {
+ id: btnScale
+ tooltip: qsTr("Scale current selection")
+ shortcut: "R"
+ currentShortcut: shortcut
+ tool: "scale"
+ buttonGroup: "groupTransform"
+ sceneId: viewRoot.sceneId
+ }
+
+ Rectangle { // separator
+ width: 25
+ height: 1
+ color: "#f1f1f1"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
- ToggleButton {
- id: btnEditViewLight
- width: 110
- toggleBackground: true
- tooltip: qsTr("Toggle Edit Light")
- states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}]
+ ToolBarButton {
+ id: btnFit
+ tooltip: qsTr("Fit camera to current selection")
+ shortcut: "F"
+ currentShortcut: shortcut
+ tool: "fit"
+ togglable: false
+
+ onSelectedChanged: {
+ if (selected)
+ viewRoot.fitToView();
+ }
+ }
}
}
- }
+ AxisHelper {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ width: 100
+ height: width
+ editCameraCtrl: cameraControl
+ selectedNode : viewRoot.selectedNodes.length ? selectionBoxes[0].model : null
+ }
- Text {
- id: helpText
+ Rectangle { // top controls bar
+ color: "#aa000000"
+ width: 290
+ height: btnPerspective.height + 10
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.rightMargin: 100
+ visible: viewRoot.showButtons
+
+ Row {
+ padding: 5
+ anchors.fill: parent
+ ToggleButton {
+ id: btnPerspective
+ width: 105
+ tooltip: qsTr("Toggle Perspective / Orthographic Projection")
+ states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}]
+ }
- property string modKey: _generalHelper.isMacOS ? qsTr("Option") : qsTr("Alt")
+ ToggleButton {
+ id: btnLocalGlobal
+ width: 65
+ tooltip: qsTr("Toggle Global / Local Orientation")
+ states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}]
+ }
- color: "white"
- text: qsTr("Camera controls: ") + modKey
- + qsTr(" + mouse press and drag. Left: Rotate, Middle: Pan, Right/Wheel: Zoom.")
- anchors.bottom: parent.bottom
+ ToggleButton {
+ id: btnEditViewLight
+ width: 110
+ toggleBackground: true
+ tooltip: qsTr("Toggle Edit Light")
+ states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}]
+ }
+ }
+ }
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditWindow3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditWindow3D.qml
new file mode 100644
index 00000000000..4ec92e63c35
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditWindow3D.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Window 2.12
+
+Window {
+ id: viewWindow
+ width: 1024
+ height: 768
+ visible: true
+ title: qsTr("3D Edit View [") + sceneId + qsTr("]")
+ // need all those flags otherwise the title bar disappears after setting WindowStaysOnTopHint flag later
+ flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
+
+ property alias editViewRoot: windowContentItem
+
+ onWidthChanged: _generalHelper.storeWindowState();
+ onHeightChanged: _generalHelper.storeWindowState();
+ onXChanged: _generalHelper.storeWindowState();
+ onYChanged: _generalHelper.storeWindowState();
+ onWindowStateChanged: _generalHelper.storeWindowState();
+
+ EditView3D {
+ id: windowContentItem
+ anchors.fill: parent
+ }
+}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml
index a198cae04bc..77f3a54a055 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml
@@ -45,7 +45,7 @@ Node {
}
property alias iconSource: iconImage.source
- property alias overlayColor: colorOverlay.color
+ //property alias overlayColor: colorOverlay.color
signal positionCommit()
signal clicked(Node node, bool multi)
@@ -94,15 +94,15 @@ Node {
acceptedButtons: Qt.LeftButton
}
}
- ColorOverlay {
- id: colorOverlay
- anchors.fill: parent
- cached: true
- source: iconImage
- color: "transparent"
- opacity: 0.6
- }
-
+// ColorOverlay doesn't work correctly with hidden windows so commenting it out for now
+// ColorOverlay {
+// id: colorOverlay
+// anchors.fill: parent
+// cached: true
+// source: iconImage
+// color: "#00000000"
+// opacity: 0.6
+// }
}
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml
index 6e321f8398a..7c9953e9bb5 100644
--- a/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml
+++ b/share/qtcreator/qml/qmlpuppet/mockfiles/LightGizmo.qml
@@ -37,5 +37,6 @@ IconGizmo {
: "qrc:///qtquickplugin/mockfiles/images/point_light_gradient.png"
: "qrc:///qtquickplugin/mockfiles/images/point_light_gradient.png"
- overlayColor: targetNode ? targetNode.color : "transparent"
+ // ColorOverlay doesn't work correctly with hidden windows so commenting it out for now
+ //overlayColor: targetNode ? targetNode.color : "transparent"
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
index 7c33ab2b8e4..c123a68d47d 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
@@ -48,7 +48,7 @@
namespace QmlDesigner {
namespace Internal {
-const QString globalStateId = QStringLiteral("@GTS"); // global tool state
+const QString _globalStateId = QStringLiteral("@GTS"); // global tool state
GeneralHelper::GeneralHelper()
: QObject()
@@ -260,37 +260,42 @@ void GeneralHelper::initToolStates(const QString &sceneId, const QVariantMap &to
m_toolStates[sceneId] = toolStates;
}
-void GeneralHelper::storeWindowState(QQuickWindow *w)
+void GeneralHelper::storeWindowState()
{
+ if (!m_edit3DWindow)
+ return;
+
QVariantMap windowState;
- const QRect geometry = w->geometry();
- const bool maximized = w->windowState() == Qt::WindowMaximized;
+ const QRect geometry = m_edit3DWindow->geometry();
+ const bool maximized = m_edit3DWindow->windowState() == Qt::WindowMaximized;
windowState.insert("maximized", maximized);
windowState.insert("geometry", geometry);
- storeToolState(globalStateId, "windowState", windowState, 500);
+ storeToolState(globalStateId(), "windowState", windowState, 500);
}
-void GeneralHelper::restoreWindowState(QQuickWindow *w)
+void GeneralHelper::restoreWindowState()
{
- if (m_toolStates.contains(globalStateId)) {
- const QVariantMap &globalStateMap = m_toolStates[globalStateId];
+ if (!m_edit3DWindow)
+ return;
+
+ if (m_toolStates.contains(globalStateId())) {
+ const QVariantMap &globalStateMap = m_toolStates[globalStateId()];
const QString stateKey = QStringLiteral("windowState");
if (globalStateMap.contains(stateKey)) {
QVariantMap windowState = globalStateMap[stateKey].value<QVariantMap>();
- doRestoreWindowState(w, windowState);
+ doRestoreWindowState(windowState);
// If the mouse cursor at puppet launch time is in a different screen than the one where the
// view geometry was saved on, the initial position and size can be incorrect, but if
// we reset the geometry again asynchronously, it should end up with correct geometry.
- QTimer::singleShot(0, [this, w, windowState]() {
- doRestoreWindowState(w, windowState);
-
- QTimer::singleShot(0, [w]() {
+ QTimer::singleShot(0, [this, windowState]() {
+ doRestoreWindowState(windowState);
+ QTimer::singleShot(0, [this]() {
// Make sure that the window is at least partially visible on the screen
- QRect geo = w->geometry();
- QRect sRect = w->screen()->geometry();
+ QRect geo = m_edit3DWindow->geometry();
+ QRect sRect = m_edit3DWindow->screen()->geometry();
if (geo.left() > sRect.right() - 150)
geo.moveRight(sRect.right());
if (geo.right() < sRect.left() + 150)
@@ -303,7 +308,7 @@ void GeneralHelper::restoreWindowState(QQuickWindow *w)
geo.setWidth(sRect.width());
if (geo.height() > sRect.height())
geo.setHeight(sRect.height());
- w->setGeometry(geo);
+ m_edit3DWindow->setGeometry(geo);
});
});
}
@@ -324,7 +329,17 @@ QVariantMap GeneralHelper::getToolStates(const QString &sceneId)
return {};
}
-void GeneralHelper::doRestoreWindowState(QQuickWindow *w, const QVariantMap &windowState)
+void GeneralHelper::setEdit3DWindow(QQuickWindow *w)
+{
+ m_edit3DWindow = w;
+}
+
+QString GeneralHelper::globalStateId() const
+{
+ return _globalStateId;
+}
+
+void GeneralHelper::doRestoreWindowState(const QVariantMap &windowState)
{
const QString geoKey = QStringLiteral("geometry");
if (windowState.contains(geoKey)) {
@@ -335,9 +350,9 @@ void GeneralHelper::doRestoreWindowState(QQuickWindow *w, const QVariantMap &win
QRect rect = windowState[geoKey].value<QRect>();
- w->setGeometry(rect);
+ m_edit3DWindow->setGeometry(rect);
if (maximized)
- w->showMaximized();
+ m_edit3DWindow->showMaximized();
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
index a6b66907488..f36e7458173 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
@@ -30,6 +30,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qtimer.h>
#include <QtCore/qhash.h>
+#include <QtCore/qpointer.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qmatrix4x4.h>
@@ -74,10 +75,12 @@ public:
Q_INVOKABLE void storeToolState(const QString &sceneId, const QString &tool,
const QVariant &state, int delayEmit = 0);
void initToolStates(const QString &sceneId, const QVariantMap &toolStates);
- Q_INVOKABLE void storeWindowState(QQuickWindow *w);
- void restoreWindowState(QQuickWindow *w);
+ Q_INVOKABLE void storeWindowState();
+ void restoreWindowState();
Q_INVOKABLE void enableItemUpdate(QQuickItem *item, bool enable);
Q_INVOKABLE QVariantMap getToolStates(const QString &sceneId);
+ void setEdit3DWindow(QQuickWindow *w);
+ QString globalStateId() const;
bool isMacOS() const;
@@ -86,7 +89,7 @@ signals:
void toolStateChanged(const QString &sceneId, const QString &tool, const QVariant &toolState);
private slots:
- void doRestoreWindowState(QQuickWindow *w, const QVariantMap &windowState);
+ void doRestoreWindowState(const QVariantMap &windowState);
private:
void handlePendingToolStateUpdate();
@@ -95,6 +98,7 @@ private:
QTimer m_toolStateUpdateTimer;
QHash<QString, QVariantMap> m_toolStates;
QHash<QString, QVariantMap> m_toolStatesPending;
+ QPointer<QQuickWindow> m_edit3DWindow;
};
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
index d772844b3c6..2b5f805f174 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
@@ -68,6 +68,8 @@
#include <removesharedmemorycommand.h>
#include <changeselectioncommand.h>
#include <drop3dlibraryitemcommand.h>
+#include <inputeventcommand.h>
+#include <view3dactioncommand.h>
#include <QDebug>
#include <QQmlEngine>
@@ -336,10 +338,6 @@ void NodeInstanceServer::update3DViewState(const Update3dViewStateCommand &/*com
{
}
-void NodeInstanceServer::enable3DView(const Enable3DViewCommand &/*command*/)
-{
-}
-
void NodeInstanceServer::changeSelection(const ChangeSelectionCommand & /*command*/)
{
}
@@ -1395,6 +1393,16 @@ QStringList NodeInstanceServer::dummyDataDirectories(const QString& directoryPat
}
}
+void NodeInstanceServer::inputEvent(const InputEventCommand &command)
+{
+ Q_UNUSED(command)
+}
+
+void NodeInstanceServer::view3DAction(const View3DActionCommand &command)
+{
+ Q_UNUSED(command)
+}
+
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h
index 1c3ee59791c..e2a5528bcf1 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h
@@ -102,7 +102,6 @@ public:
void createScene(const CreateSceneCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void update3DViewState(const Update3dViewStateCommand &command) override;
- void enable3DView(const Enable3DViewCommand &command) override;
void removeInstances(const RemoveInstancesCommand &command) override;
void removeProperties(const RemovePropertiesCommand &command) override;
void reparentInstances(const ReparentInstancesCommand &command) override;
@@ -112,6 +111,8 @@ public:
void token(const TokenCommand &command) override;
void removeSharedMemory(const RemoveSharedMemoryCommand &command) override;
void changeSelection(const ChangeSelectionCommand &command) override;
+ void inputEvent(const InputEventCommand &command) override;
+ void view3DAction(const View3DActionCommand &command) override;
ServerNodeInstance instanceForId(qint32 id) const;
bool hasInstanceForId(qint32 id) const;
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
index a30f972025e..3b8cb04a909 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
@@ -41,7 +41,6 @@
#include "clearscenecommand.h"
#include "reparentinstancescommand.h"
#include "update3dviewstatecommand.h"
-#include "enable3dviewcommand.h"
#include "changevaluescommand.h"
#include "changebindingscommand.h"
#include "changeidscommand.h"
@@ -63,6 +62,8 @@
#include "drop3dlibraryitemcommand.h"
#include "puppettocreatorcommand.h"
#include "view3dclosedcommand.h"
+#include "inputeventcommand.h"
+#include "view3dactioncommand.h"
#include "dummycontextobject.h"
#include "../editor3d/generalhelper.h"
@@ -73,6 +74,7 @@
#include "../editor3d/linegeometry.h"
#include <designersupportdelegate.h>
+#include <qmlprivategate.h>
#include <QVector3D>
#include <QQmlProperty>
@@ -80,6 +82,8 @@
#include <QQuickView>
#include <QQmlContext>
#include <QQmlEngine>
+#include <QtGui/qevent.h>
+#include <QtGui/qguiapplication.h>
#ifdef QUICK3D_MODULE
#include <QtQuick3D/private/qquick3dnode_p.h>
@@ -165,53 +169,72 @@ bool Qt5InformationNodeInstanceServer::dropAcceptable(QDragMoveEvent *event) con
return canBeDropped == "true" || canBeDropped == "True";
}
-QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine)
+void Qt5InformationNodeInstanceServer::createEditView3D()
{
#ifdef QUICK3D_MODULE
- auto helper = new QmlDesigner::Internal::GeneralHelper();
- QObject::connect(helper, &QmlDesigner::Internal::GeneralHelper::toolStateChanged,
- this, &Qt5InformationNodeInstanceServer::handleToolStateChanged);
- engine->rootContext()->setContextProperty("_generalHelper", helper);
- m_3dHelper = helper;
+ static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
+
qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D");
qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("CameraGeometry", 1, 0, "CameraGeometry");
qmlRegisterType<QmlDesigner::Internal::GridGeometry>("GridGeometry", 1, 0, "GridGeometry");
qmlRegisterType<QmlDesigner::Internal::SelectionBoxGeometry>("SelectionBoxGeometry", 1, 0, "SelectionBoxGeometry");
qmlRegisterType<QmlDesigner::Internal::LineGeometry>("LineGeometry", 1, 0, "LineGeometry");
-#endif
- QQmlComponent component(engine, QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"));
+ auto helper = new QmlDesigner::Internal::GeneralHelper();
+ QObject::connect(helper, &QmlDesigner::Internal::GeneralHelper::toolStateChanged,
+ this, &Qt5InformationNodeInstanceServer::handleToolStateChanged);
+ engine()->rootContext()->setContextProperty("_generalHelper", helper);
+ m_3dHelper = helper;
- QWindow *window = qobject_cast<QWindow *>(component.create());
+ QQmlComponent component(engine());
+ if (showEditView) {
+ component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditWindow3D.qml"));
+ m_editWindow3D = qobject_cast<QQuickWindow *>(component.create());
+ m_editView3DRootItem = QQmlProperty::read(m_editWindow3D, "editViewRoot").value<QQuickItem *>();
+
+ //For macOS we have to use the 4.1 core profile
+ QSurfaceFormat surfaceFormat = m_editWindow3D->requestedFormat();
+ surfaceFormat.setVersion(4, 1);
+ surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
+ m_editWindow3D->setFormat(surfaceFormat);
+ } else {
+ m_editView3D = new QQuickView(quickView()->engine(), quickView());
+ m_editView3D->setFormat(quickView()->format());
+ DesignerSupport::createOpenGLContext(m_editView3D.data());
+ component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"));
+ m_editView3DRootItem = qobject_cast<QQuickItem *>(component.create());
+ }
- if (!window) {
+ if (!m_editView3DRootItem) {
qWarning() << "Could not create edit view 3D: " << component.errors();
- return nullptr;
+ return;
+ }
+
+ if (!showEditView) {
+ DesignerSupport::setRootItem(m_editView3D, m_editView3DRootItem);
+ } else {
+ m_editView3DRootItem->installEventFilter(this);
+ QQmlProperty showButtonsProperty(m_editView3DRootItem, "showButtons", context());
+ showButtonsProperty.write(QVariant(true));
}
- window->installEventFilter(this);
- QObject::connect(window, SIGNAL(selectionChanged(QVariant)),
+ QObject::connect(m_editView3DRootItem, SIGNAL(selectionChanged(QVariant)),
this, SLOT(handleSelectionChanged(QVariant)));
- QObject::connect(window, SIGNAL(commitObjectProperty(QVariant, QVariant)),
+ QObject::connect(m_editView3DRootItem, SIGNAL(commitObjectProperty(QVariant, QVariant)),
this, SLOT(handleObjectPropertyCommit(QVariant, QVariant)));
- QObject::connect(window, SIGNAL(changeObjectProperty(QVariant, QVariant)),
+ QObject::connect(m_editView3DRootItem, SIGNAL(changeObjectProperty(QVariant, QVariant)),
this, SLOT(handleObjectPropertyChange(QVariant, QVariant)));
QObject::connect(&m_propertyChangeTimer, &QTimer::timeout,
this, &Qt5InformationNodeInstanceServer::handleObjectPropertyChangeTimeout);
QObject::connect(&m_selectionChangeTimer, &QTimer::timeout,
this, &Qt5InformationNodeInstanceServer::handleSelectionChangeTimeout);
+ QObject::connect(&m_renderTimer, &QTimer::timeout,
+ this, &Qt5InformationNodeInstanceServer::doRender3DEditView);
- //For macOS we have to use the 4.1 core profile
- QSurfaceFormat surfaceFormat = window->requestedFormat();
- surfaceFormat.setVersion(4, 1);
- surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
- window->setFormat(surfaceFormat);
-
-#ifdef QUICK3D_MODULE
- helper->setParent(window);
+ helper->setParent(m_editView3DRootItem);
+ if (showEditView)
+ helper->setEdit3DWindow(m_editWindow3D);
#endif
-
- return window;
}
// The selection has changed in the edit view 3D. Empty list indicates selection is cleared.
@@ -357,10 +380,10 @@ void Qt5InformationNodeInstanceServer::handleNode3DDestroyed(QObject *obj)
{
#ifdef QUICK3D_MODULE
if (qobject_cast<QQuick3DCamera *>(obj)) {
- QMetaObject::invokeMethod(m_editView3D, "releaseCameraGizmo",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "releaseCameraGizmo",
Q_ARG(QVariant, objectToVariant(obj)));
} else if (qobject_cast<QQuick3DAbstractLight *>(obj)) {
- QMetaObject::invokeMethod(m_editView3D, "releaseLightGizmo",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "releaseLightGizmo",
Q_ARG(QVariant, objectToVariant(obj)));
}
removeNode3D(obj);
@@ -376,29 +399,41 @@ void Qt5InformationNodeInstanceServer::updateView3DRect(QObject *view3D)
viewPortrect = QRectF(0., 0., view3D->property("width").toDouble(),
view3D->property("height").toDouble());
}
- QQmlProperty viewPortProperty(m_editView3D, "viewPortRect", context());
+ QQmlProperty viewPortProperty(m_editView3DRootItem, "viewPortRect", context());
viewPortProperty.write(viewPortrect);
}
void Qt5InformationNodeInstanceServer::updateActiveSceneToEditView3D()
{
+#ifdef QUICK3D_MODULE
// Active scene change handling on qml side is async, so a deleted importScene would crash
// editView when it updates next. Disable/enable edit view update synchronously to avoid this.
QVariant activeSceneVar = objectToVariant(m_active3DScene);
- QMetaObject::invokeMethod(m_editView3D, "enableEditViewUpdate",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "enableEditViewUpdate",
Q_ARG(QVariant, activeSceneVar));
ServerNodeInstance sceneInstance = active3DSceneInstance();
- QVariant sceneInstanceVar;
- QQmlProperty sceneIdProperty(m_editView3D, "sceneId", context());
+ QVariant sceneIdVar;
+ QQmlProperty sceneIdProperty(m_editView3DRootItem, "sceneId", context());
+ const QString sceneId = sceneInstance.id();
if (sceneInstance.isValid())
- sceneInstanceVar = QVariant::fromValue(sceneInstance.id());
- sceneIdProperty.write(sceneInstanceVar);
+ sceneIdVar = QVariant::fromValue(sceneId);
+ sceneIdProperty.write(sceneIdVar);
- QQmlProperty sceneProperty(m_editView3D, "activeScene", context());
+ QQmlProperty sceneProperty(m_editView3DRootItem, "activeScene", context());
sceneProperty.write(activeSceneVar);
+ auto helper = qobject_cast<QmlDesigner::Internal::GeneralHelper *>(m_3dHelper);
+ QVariantMap toolStates;
+ if (helper)
+ toolStates = helper->getToolStates(sceneId);
+ toolStates.insert("sceneInstanceId", QVariant::fromValue(sceneInstance.instanceId()));
+
+ nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::ActiveSceneChanged,
+ toolStates});
+
updateView3DRect(m_active3DView);
+#endif
}
void Qt5InformationNodeInstanceServer::removeNode3D(QObject *node)
@@ -439,11 +474,11 @@ void Qt5InformationNodeInstanceServer::resolveSceneRoots()
if (newRoot != oldRoot) {
if (qobject_cast<QQuick3DCamera *>(node)) {
- QMetaObject::invokeMethod(m_editView3D, "updateCameraGizmoScene",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "updateCameraGizmoScene",
Q_ARG(QVariant, objectToVariant(newRoot)),
Q_ARG(QVariant, objectToVariant(node)));
} else if (qobject_cast<QQuick3DAbstractLight *>(node)) {
- QMetaObject::invokeMethod(m_editView3D, "updateLightGizmoScene",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "updateLightGizmoScene",
Q_ARG(QVariant, objectToVariant(newRoot)),
Q_ARG(QVariant, objectToVariant(node)));
}
@@ -467,11 +502,65 @@ ServerNodeInstance Qt5InformationNodeInstanceServer::active3DSceneInstance() con
return sceneInstance;
}
+void Qt5InformationNodeInstanceServer::render3DEditView()
+{
+ m_needRender = true;
+ if (!m_renderTimer.isActive())
+ m_renderTimer.start(0);
+}
+
+// render the 3D edit view and send the result to creator process
+void Qt5InformationNodeInstanceServer::doRender3DEditView()
+{
+ static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW");
+ if (m_editView3DRootItem && !showEditView) {
+ auto t = std::chrono::steady_clock::now();
+ if (!m_editView3DContentItem) {
+ m_editView3DContentItem = QQmlProperty::read(m_editView3DRootItem, "contentItem").value<QQuickItem *>();
+ if (m_editView3DContentItem) {
+ designerSupport()->refFromEffectItem(m_editView3DContentItem, false);
+ QmlDesigner::Internal::QmlPrivateGate::disableNativeTextRendering(m_editView3DContentItem);
+ }
+ }
+
+ std::function<void (QQuickItem *)> updateNodesRecursive;
+ updateNodesRecursive = [&updateNodesRecursive](QQuickItem *item) {
+ for (QQuickItem *childItem : item->childItems())
+ updateNodesRecursive(childItem);
+ DesignerSupport::updateDirtyNode(item);
+ };
+ updateNodesRecursive(m_editView3DContentItem);
+
+ QSizeF size = qobject_cast<QQuickItem *>(m_editView3DContentItem)->size();
+ QRectF renderRect(QPointF(0., 0.), size);
+ QImage renderImage = designerSupport()->renderImageForItem(m_editView3DContentItem,
+ renderRect, size.toSize());
+
+ // There's no instance related to image, so instance id is -1.
+ // Key number is selected so that it is unlikely to conflict other ImageContainer use.
+ const qint32 edit3DKey = 2100000000;
+ auto imgContainer = ImageContainer(-1, renderImage, edit3DKey);
+
+ // send the rendered image to creator process
+ nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::Render3DView,
+ QVariant::fromValue(imgContainer)});
+ qDebug() << "\x1b[42m \x1b[1m" << __FUNCTION__
+ << ", t=" << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now()-t).count()
+ << "\x1b[m";
+
+ if (m_needRender) {
+ m_renderTimer.start(0);
+ m_needRender = false;
+ }
+ }
+}
+
Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
Qt5NodeInstanceServer(nodeInstanceClient)
{
m_propertyChangeTimer.setInterval(100);
m_selectionChangeTimer.setSingleShot(true);
+ m_renderTimer.setSingleShot(true);
}
void Qt5InformationNodeInstanceServer::sendTokenBack()
@@ -523,7 +612,6 @@ bool Qt5InformationNodeInstanceServer::isDirtyRecursiveForParentInstances(QQuick
return false;
return isDirtyRecursiveForParentInstances(parentItem);
-
}
return false;
@@ -549,12 +637,14 @@ QList<ServerNodeInstance> Qt5InformationNodeInstanceServer::createInstances(
{
const auto createdInstances = NodeInstanceServer::createInstances(container);
- if (m_editView3D) {
+ if (m_editView3DRootItem) {
add3DViewPorts(createdInstances);
add3DScenes(createdInstances);
createCameraAndLightGizmos(createdInstances);
}
+ render3DEditView();
+
return createdInstances;
}
@@ -586,7 +676,7 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos(
while (cameraIt != cameras.constEnd()) {
const auto cameraObjs = cameraIt.value();
for (auto &obj : cameraObjs) {
- QMetaObject::invokeMethod(m_editView3D, "addCameraGizmo",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "addCameraGizmo",
Q_ARG(QVariant, objectToVariant(cameraIt.key())),
Q_ARG(QVariant, objectToVariant(obj)));
}
@@ -596,7 +686,7 @@ void Qt5InformationNodeInstanceServer::createCameraAndLightGizmos(
while (lightIt != lights.constEnd()) {
const auto lightObjs = lightIt.value();
for (auto &obj : lightObjs) {
- QMetaObject::invokeMethod(m_editView3D, "addLightGizmo",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "addLightGizmo",
Q_ARG(QVariant, objectToVariant(lightIt.key())),
Q_ARG(QVariant, objectToVariant(obj)));
}
@@ -791,8 +881,8 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
m_active3DView = findView3DForSceneRoot(m_active3DScene);
}
if (m_active3DScene) {
- m_editView3D = createEditView3D(engine());
- if (!m_editView3D) {
+ createEditView3D();
+ if (!m_editView3DRootItem) {
m_active3DScene = nullptr;
m_active3DView = nullptr;
return;
@@ -805,7 +895,11 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
helper->initToolStates(it.key(), it.value());
++it;
}
- helper->restoreWindowState(qobject_cast<QQuickWindow *>(m_editView3D));
+ helper->restoreWindowState();
+ if (toolStates.contains(helper->globalStateId())
+ && toolStates[helper->globalStateId()].contains("rootSize")) {
+ m_editView3DRootItem->setSize(toolStates[helper->globalStateId()]["rootSize"].value<QSize>());
+ }
}
updateActiveSceneToEditView3D();
@@ -900,7 +994,7 @@ void Qt5InformationNodeInstanceServer::reparentInstances(const ReparentInstances
Qt5NodeInstanceServer::reparentInstances(command);
- if (m_editView3D)
+ if (m_editView3DRootItem)
resolveSceneRoots();
}
@@ -991,7 +1085,7 @@ void QmlDesigner::Qt5InformationNodeInstanceServer::removeSharedMemory(const Qml
void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionCommand &command)
{
- if (!m_editView3D)
+ if (!m_editView3DRootItem)
return;
if (m_selectionChangeTimer.isActive()) {
@@ -1033,16 +1127,18 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm
// Ensure the UI has enough selection box items. If it doesn't yet have them, which can be the
// case when the first selection processed is a multiselection, we wait a bit as
// using the new boxes immediately leads to visual glitches.
- int boxCount = m_editView3D->property("selectionBoxes").value<QVariantList>().size();
+ int boxCount = m_editView3DRootItem->property("selectionBoxes").value<QVariantList>().size();
if (boxCount < selectedObjs.size()) {
- QMetaObject::invokeMethod(m_editView3D, "ensureSelectionBoxes",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "ensureSelectionBoxes",
Q_ARG(QVariant, QVariant::fromValue(selectedObjs.size())));
m_pendingSelectionChangeCommand = command;
m_selectionChangeTimer.start(100);
} else {
- QMetaObject::invokeMethod(m_editView3D, "selectObjects",
+ QMetaObject::invokeMethod(m_editView3DRootItem, "selectObjects",
Q_ARG(QVariant, QVariant::fromValue(selectedObjs)));
}
+
+ render3DEditView();
}
void Qt5InformationNodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command)
@@ -1060,6 +1156,8 @@ void Qt5InformationNodeInstanceServer::changePropertyValues(const ChangeValuesCo
refreshBindings();
startRenderTimer();
+
+ render3DEditView();
}
void Qt5InformationNodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
@@ -1074,45 +1172,118 @@ void Qt5InformationNodeInstanceServer::removeInstances(const RemoveInstancesComm
resolveSceneRoots();
}
- if (m_editView3D && (!m_active3DScene || !m_active3DView)) {
+ if (m_editView3DRootItem && (!m_active3DScene || !m_active3DView)) {
if (!m_active3DScene && !m_3DSceneMap.isEmpty())
m_active3DScene = m_3DSceneMap.begin().key();
m_active3DView = findView3DForSceneRoot(m_active3DScene);
updateActiveSceneToEditView3D();
}
+ render3DEditView();
+}
+
+void Qt5InformationNodeInstanceServer::inputEvent(const InputEventCommand &command)
+{
+ if (m_editView3D) {
+ if (command.type() == QEvent::Wheel) {
+ QWheelEvent *we
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
+ = new QWheelEvent(command.pos(), command.pos(), {0, 0}, {0, command.angleDelta()},
+ command.buttons(), command.modifiers(), Qt::NoScrollPhase,
+ false);
+#else
+ = new QWheelEvent(command.pos(), command.pos(), {0, 0}, {0, command.angleDelta()},
+ 0, Qt::Horizontal, command.buttons(), command.modifiers(),
+ Qt::NoScrollPhase, Qt::MouseEventNotSynthesized);
+#endif
+
+ QGuiApplication::postEvent(m_editView3D, we);
+ } else {
+ auto me = new QMouseEvent(command.type(), command.pos(), command.button(),
+ command.buttons(), command.modifiers());
+ QGuiApplication::postEvent(m_editView3D, me);
+ }
+
+ render3DEditView();
+ }
+}
+
+void Qt5InformationNodeInstanceServer::view3DAction(const View3DActionCommand &command)
+{
+ QVariantMap updatedState;
+
+ switch (command.type()) {
+ case View3DActionCommand::MoveTool:
+ updatedState.insert("groupTransform", 0);
+ break;
+ case View3DActionCommand::RotateTool:
+ updatedState.insert("groupTransform", 1);
+ break;
+ case View3DActionCommand::ScaleTool:
+ updatedState.insert("groupTransform", 2);
+ break;
+ case View3DActionCommand::FitToView:
+ QMetaObject::invokeMethod(m_editView3DRootItem, "fitToView");
+ break;
+ case View3DActionCommand::SelectionModeToggle:
+ updatedState.insert("groupSelect", command.isEnabled() ? 0 : 1);
+ break;
+ case View3DActionCommand::CameraToggle:
+ updatedState.insert("usePerspective", command.isEnabled());
+ break;
+ case View3DActionCommand::OrientationToggle:
+ updatedState.insert("globalOrientation", command.isEnabled());
+ break;
+ case View3DActionCommand::EditLightToggle:
+ updatedState.insert("showEditLight", command.isEnabled());
+ break;
+ default:
+ break;
+ }
+
+ if (!updatedState.isEmpty()) {
+ QMetaObject::invokeMethod(m_editView3DRootItem, "updateToolStates",
+ Q_ARG(QVariant, updatedState),
+ Q_ARG(QVariant, QVariant::fromValue(false)));
+ }
+
+ render3DEditView();
+}
+
+void Qt5InformationNodeInstanceServer::changeAuxiliaryValues(const ChangeAuxiliaryCommand &command)
+{
+ Qt5NodeInstanceServer::changeAuxiliaryValues(command);
+ render3DEditView();
}
// update 3D view window state when the main app window state change
void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command)
{
- auto window = qobject_cast<QWindow *>(m_editView3D);
- if (window) {
+#ifdef QUICK3D_MODULE
+ if (command.type() == Update3dViewStateCommand::SizeChange) {
+ if (m_editView3DRootItem) {
+ m_editView3DRootItem->setSize(command.size());
+ auto helper = qobject_cast<QmlDesigner::Internal::GeneralHelper *>(m_3dHelper);
+ if (helper)
+ helper->storeToolState(helper->globalStateId(), "rootSize", QVariant(command.size()), 0);
+ render3DEditView();
+ }
+ } else if (m_editWindow3D) {
if (command.type() == Update3dViewStateCommand::StateChange) {
if (command.previousStates() & Qt::WindowMinimized) // main window expanded from minimize state
- window->show();
+ m_editWindow3D->show();
else if (command.currentStates() & Qt::WindowMinimized) // main window minimized
- window->hide();
+ m_editWindow3D->hide();
} else if (command.type() == Update3dViewStateCommand::ActiveChange) {
- window->setFlag(Qt::WindowStaysOnTopHint, command.isActive());
+ m_editWindow3D->setFlag(Qt::WindowStaysOnTopHint, command.isActive());
// main window has a popup open, lower the edit view 3D so that the pop up is visible
if (command.hasPopup())
- window->lower();
+ m_editWindow3D->lower();
}
}
-}
-
-void Qt5InformationNodeInstanceServer::enable3DView(const Enable3DViewCommand &command)
-{
- // TODO: this method is not currently in use as the 3D view is currently enabled by resetting the puppet.
- // It should however be implemented here.
-
- auto window = qobject_cast<QWindow *>(m_editView3D);
- if (window && !command.isEnable()) {
- // TODO: remove the 3D view
- } else if (!window && command.isEnable()) {
- // TODO: create the 3D view
- }
+#else
+ Q_UNUSED(command)
+#endif
}
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h
index 12b2f12821a..1e4d70577b0 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h
@@ -32,6 +32,7 @@
#include <QTimer>
#include <QVariant>
+#include <QPointer>
QT_BEGIN_NAMESPACE
class QDragMoveEvent;
@@ -49,7 +50,6 @@ public:
void reparentInstances(const ReparentInstancesCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void update3DViewState(const Update3dViewStateCommand &command) override;
- void enable3DView(const Enable3DViewCommand &command) override;
void createScene(const CreateSceneCommand &command) override;
void completeComponent(const CompleteComponentCommand &command) override;
void token(const TokenCommand &command) override;
@@ -57,6 +57,9 @@ public:
void changeSelection(const ChangeSelectionCommand &command) override;
void changePropertyValues(const ChangeValuesCommand &command) override;
void removeInstances(const RemoveInstancesCommand &command) override;
+ void inputEvent(const InputEventCommand &command) override;
+ void view3DAction(const View3DActionCommand &command) override;
+ void changeAuxiliaryValues(const ChangeAuxiliaryCommand &command) override;
private slots:
void handleSelectionChanged(const QVariant &objs);
@@ -82,7 +85,7 @@ protected:
private:
void handleObjectPropertyChangeTimeout();
void handleSelectionChangeTimeout();
- QObject *createEditView3D(QQmlEngine *engine);
+ void createEditView3D();
void setup3DEditView(const QList<ServerNodeInstance> &instanceList,
const QHash<QString, QVariantMap> &toolStates);
void createCameraAndLightGizmos(const QList<ServerNodeInstance> &instanceList) const;
@@ -104,8 +107,13 @@ private:
void removeNode3D(QObject *node);
void resolveSceneRoots();
ServerNodeInstance active3DSceneInstance() const;
+ void render3DEditView();
+ void doRender3DEditView();
- QObject *m_editView3D = nullptr;
+ QPointer<QQuickView> m_editView3D;
+ QPointer<QQuickWindow> m_editWindow3D;
+ QQuickItem *m_editView3DRootItem = nullptr;
+ QQuickItem *m_editView3DContentItem = nullptr;
QSet<QObject *> m_view3Ds;
QMultiHash<QObject *, QObject *> m_3DSceneMap; // key: scene root, value: node
QObject *m_active3DView;
@@ -115,10 +123,12 @@ private:
QList<TokenCommand> m_tokenList;
QTimer m_propertyChangeTimer;
QTimer m_selectionChangeTimer;
+ QTimer m_renderTimer;
QVariant m_changedNode;
PropertyName m_changedProperty;
ChangeSelectionCommand m_pendingSelectionChangeCommand;
QObject *m_3dHelper = nullptr;
+ bool m_needRender = false;
};
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp
index dbee5969be4..be54efd2c54 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp
@@ -70,8 +70,10 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
* because we want to be able to show the 3D Edit View
* as a normal QQuickView.
* The DesignerWindowManager prevents any window from actually being shown. */
- if (!qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE"))
+ if (!qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE")
+ || !qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")) {
DesignerSupport::activateDesignerWindowManager();
+ }
setNodeInstanceServer(new Qt5InformationNodeInstanceServer(this));
initializeSocket();
} else if (QCoreApplication::arguments().at(2) == QLatin1String("rendermode")) {
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
index 39653af4129..b503afb655c 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp
@@ -72,6 +72,7 @@ void Qt5NodeInstanceServer::initializeView()
DesignerSupport::createOpenGLContext(m_quickView.data());
if (qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE")
+ && qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")
&& QCoreApplication::arguments().at(2) == "editormode") {
/* In '3d editormode' we do not use the DesignerWindowManager
* and since we do not show the QQuickView we have to manually create the OpenGL context */
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
index b128161aeee..395b56e2416 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/servernodeinstance.cpp
@@ -627,16 +627,18 @@ QList<QQuickItem *> ServerNodeInstance::allItemsRecursive() const
QString ServerNodeInstance::id() const
{
- return m_nodeInstance->id();
+ if (isValid())
+ return m_nodeInstance->id();
+
+ return {};
}
qint32 ServerNodeInstance::instanceId() const
{
- if (isValid()) {
+ if (isValid())
return m_nodeInstance->instanceId();
- } else {
- return -1;
- }
+
+ return -1;
}
QList<ServerNodeInstance> ServerNodeInstance::stateInstances() const
diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
index 79ffb4934f2..749517125f5 100644
--- a/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
+++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet.qrc
@@ -8,6 +8,7 @@
<file>mockfiles/GenericBackend.qml</file>
<file>mockfiles/Dialog.qml</file>
<file>mockfiles/EditView3D.qml</file>
+ <file>mockfiles/EditWindow3D.qml</file>
<file>mockfiles/EditCameraController.qml</file>
<file>mockfiles/Arrow.qml</file>
<file>mockfiles/AutoScaleHelper.qml</file>
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml
index bbc2444ac12..a353d9fec53 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml
@@ -146,6 +146,12 @@ Rectangle {
tooltip: qsTr("Toggles whether this item is exported as an alias property of the root item.")
}
}
+ Item { //dummy object to preserve layout in case of multiselection
+ Layout.preferredWidth: 20
+ Layout.preferredHeight: 20
+ enabled: modelNodeBackend.multiSelection
+ visible: enabled
+ }
}
Label {
@@ -154,13 +160,11 @@ Rectangle {
SecondColumnLayout {
enabled: !modelNodeBackend.multiSelection
- visible: enabled
spacing: 2
LineEdit {
id: annotationEdit
- enabled: annotationEditor.hasAuxData
- visible: enabled
+ visible: annotationEditor.hasAuxData
backendValue: backendValues.customId__AUX
placeholderText: qsTr("customId")
@@ -176,8 +180,8 @@ Rectangle {
StudioControls.AbstractButton {
id: editAnnotationButton
- enabled: annotationEditor.hasAuxData
- visible: enabled
+ visible: annotationEditor.hasAuxData
+
Layout.preferredWidth: 22
Layout.preferredHeight: 22
width: 22
@@ -185,14 +189,13 @@ Rectangle {
buttonIcon: StudioTheme.Constants.edit
onClicked: annotationEditor.showWidget()
-
onHoveredChanged: annotationEditor.checkAux()
}
StudioControls.AbstractButton {
id: removeAnnotationButton
- enabled: annotationEditor.hasAuxData
- visible: enabled
+ visible: annotationEditor.hasAuxData
+
Layout.preferredWidth: 22
Layout.preferredHeight: 22
width: 22
@@ -200,19 +203,18 @@ Rectangle {
buttonIcon: StudioTheme.Constants.closeCross
onClicked: annotationEditor.removeFullAnnotation()
-
onHoveredChanged: annotationEditor.checkAux()
}
StudioControls.AbstractButton {
id: addAnnotationButton
- enabled: !annotationEditor.hasAuxData
- visible: enabled
+ visible: !annotationEditor.hasAuxData
buttonIcon: qsTr("Add Annotation")
iconFont: StudioTheme.Constants.font
Layout.fillWidth: true
Layout.preferredWidth: 240
+ width: 240
onClicked: annotationEditor.showWidget()
@@ -222,8 +224,7 @@ Rectangle {
Item {
Layout.preferredWidth: 22
Layout.preferredHeight: 22
- enabled: !annotationEditor.hasAuxData
- visible: enabled
+ visible: !annotationEditor.hasAuxData
}
AnnotationEditor {
diff --git a/share/qtcreator/templates/wizards/classes/python/file.py b/share/qtcreator/templates/wizards/classes/python/file.py
index adcbc1ed2d0..5698022dd85 100644
--- a/share/qtcreator/templates/wizards/classes/python/file.py
+++ b/share/qtcreator/templates/wizards/classes/python/file.py
@@ -21,6 +21,7 @@ from PyQt5 import QtQuick
@endif
@endif
+
@if '%{Base}'
class %{Class}(%{Base}):
@else
@@ -29,11 +30,9 @@ class %{Class}:
def __init__(self):
@if '%{Base}' === 'QWidget'
QtWidgets.QWidget.__init__(self)
-@endif
-@if '%{Base}' === 'QMainWindow'
+@elif '%{Base}' === 'QMainWindow'
QtWidgets.QMainWindow.__init__(self)
-@if '%{Base}' === 'QQuickItem'
+@elif '%{Base}' === 'QQuickItem'
QtQuick.QQuickItem.__init__(self)
@endif
pass
-
diff --git a/share/qtcreator/templates/wizards/classes/python/wizard.json b/share/qtcreator/templates/wizards/classes/python/wizard.json
index 552c3f15a0e..aeebd1f2a30 100644
--- a/share/qtcreator/templates/wizards/classes/python/wizard.json
+++ b/share/qtcreator/templates/wizards/classes/python/wizard.json
@@ -46,7 +46,7 @@
"data":
{
"items": [ { "trKey": "<Custom>", "value": "" },
- "QObject", "QWidget", "QMainWindow", "QDeclarativeItem" ]
+ "QObject", "QWidget", "QMainWindow", "QDeclarativeItem", "QQuickItem" ]
}
},
{
diff --git a/share/qtcreator/templates/wizards/files/python/file.py b/share/qtcreator/templates/wizards/files/python/file.py
index 003f8414973..fcb605f9f72 100644
--- a/share/qtcreator/templates/wizards/files/python/file.py
+++ b/share/qtcreator/templates/wizards/files/python/file.py
@@ -1,4 +1,4 @@
# This Python file uses the following encoding: utf-8
-# if__name__ == "__main__":
+# if __name__ == "__main__":
# pass
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json
index 38f68550882..444f22d2de5 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json
@@ -83,10 +83,19 @@
"persistenceKey": "QtQuick.minimumQtVersion",
"data":
{
- "index": 2,
+ "index": 3,
"items":
[
{
+ "trKey": "Qt 5.15",
+ "value":
+ {
+ "QtQuickVersion": "2.15",
+ "QtQuickWindowVersion": "2.15",
+ "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15"
+ }
+ },
+ {
"trKey": "Qt 5.14",
"value":
{
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json
index 576e47d3e8a..1ad41e72302 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json
@@ -85,10 +85,19 @@
"persistenceKey": "QtQuick.minimumQtVersion",
"data":
{
- "index": 2,
+ "index": 3,
"items":
[
{
+ "trKey": "Qt 5.15",
+ "value":
+ {
+ "QtQuickVersion": "2.15",
+ "QtQuickControlsVersion": "2.15",
+ "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15"
+ }
+ },
+ {
"trKey": "Qt 5.14",
"value":
{
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json
index 34eca289d58..e3966ca5231 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json
@@ -85,10 +85,19 @@
"persistenceKey": "QtQuick.minimumQtVersion",
"data":
{
- "index": 2,
+ "index": 3,
"items":
[
{
+ "trKey": "Qt 5.15",
+ "value":
+ {
+ "QtQuickVersion": "2.15",
+ "QtQuickControlsVersion": "2.15",
+ "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15"
+ }
+ },
+ {
"trKey": "Qt 5.14",
"value":
{
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json
index 5f9a544cfc8..67dd9fb711a 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json
@@ -85,10 +85,19 @@
"persistenceKey": "QtQuick.minimumQtVersion",
"data":
{
- "index": 2,
+ "index": 3,
"items":
[
{
+ "trKey": "Qt 5.15",
+ "value":
+ {
+ "QtQuickVersion": "2.15",
+ "QtQuickControlsVersion": "2.15",
+ "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15"
+ }
+ },
+ {
"trKey": "Qt 5.14",
"value":
{
diff --git a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json
index c1a966b4b2b..ac39bb90be6 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json
@@ -40,10 +40,19 @@
"type": "ComboBox",
"data":
{
- "index": 2,
+ "index": 3,
"items":
[
{
+ "trKey": "Qt 5.15",
+ "value":
+ {
+ "QtQuickVersion": "2.15",
+ "QtQuickWindowVersion": "2.15",
+ "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15"
+ }
+ },
+ {
"trKey": "Qt 5.14",
"value":
{
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 0cd77cee29d..f2adb8b6206 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -546,6 +546,7 @@ int main(int argc, char **argv)
#endif
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
+ app.setAttribute(Qt::AA_DisableWindowContextHelpButton);
PluginManager pluginManager;
PluginManager::setPluginIID(QLatin1String("org.qt-project.Qt.QtCreatorPlugin"));
diff --git a/src/libs/CMakeLists.txt b/src/libs/CMakeLists.txt
index ef261231f4d..4cb8e8d925f 100644
--- a/src/libs/CMakeLists.txt
+++ b/src/libs/CMakeLists.txt
@@ -1,5 +1,6 @@
add_subdirectory(3rdparty)
+add_subdirectory(advanceddockingsystem)
add_subdirectory(aggregation)
add_subdirectory(extensionsystem)
add_subdirectory(utils)
diff --git a/src/libs/advanceddockingsystem/CMakeLists.txt b/src/libs/advanceddockingsystem/CMakeLists.txt
new file mode 100644
index 00000000000..ba5deced265
--- /dev/null
+++ b/src/libs/advanceddockingsystem/CMakeLists.txt
@@ -0,0 +1,31 @@
+add_qtc_library(AdvancedDockingSystem
+ DEPENDS Qt5::Widgets Qt5::Core Qt5::Gui Utils
+ SOURCES
+ ads_globals.cpp ads_globals.h
+ dockareatabbar.cpp dockareatabbar.h
+ dockareatitlebar.cpp dockareatitlebar.h
+ dockareawidget.cpp dockareawidget.h
+ dockcomponentsfactory.cpp dockcomponentsfactory.h
+ dockcontainerwidget.cpp dockcontainerwidget.h
+ dockingstatereader.cpp dockingstatereader.h
+ dockmanager.cpp dockmanager.h
+ dockoverlay.cpp dockoverlay.h
+ docksplitter.cpp docksplitter.h
+ dockwidget.cpp dockwidget.h
+ dockwidgettab.cpp dockwidgettab.h
+ elidinglabel.cpp elidinglabel.h
+ floatingdockcontainer.cpp floatingdockcontainer.h
+ floatingdragpreview.cpp floatingdragpreview.h
+ iconprovider.cpp iconprovider.h
+ workspacedialog.cpp workspacedialog.h
+ workspacemodel.cpp workspacemodel.h
+ workspaceview.cpp workspaceview.h
+ workspacedialog.ui
+ resources.qrc
+)
+
+extend_qtc_target(AdvancedDockingSystem
+ INCLUDES linux
+ SOURCES
+ linux/floatingwidgettitlebar.cpp linux/floatingwidgettitlebar.h
+)
diff --git a/src/libs/advanceddockingsystem/LICENSE.LGPLv21 b/src/libs/advanceddockingsystem/LICENSE.LGPLv21
new file mode 100644
index 00000000000..dfcab5e29b7
--- /dev/null
+++ b/src/libs/advanceddockingsystem/LICENSE.LGPLv21
@@ -0,0 +1,514 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+
+ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
+ Contact: http://www.qt.io/licensing/
+
+ You may use, distribute and copy the Qt Toolkit under the terms of
+ GNU Lesser General Public License version 2.1, which is displayed below.
+
+-------------------------------------------------------------------------
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/src/libs/advanceddockingsystem/ads_globals.cpp b/src/libs/advanceddockingsystem/ads_globals.cpp
new file mode 100644
index 00000000000..36df8ed869c
--- /dev/null
+++ b/src/libs/advanceddockingsystem/ads_globals.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "ads_globals.h"
+
+#include "dockmanager.h"
+#include "docksplitter.h"
+#include "iconprovider.h"
+
+#include <QAbstractButton>
+#include <QPainter>
+#include <QVariant>
+
+namespace ADS {
+
+namespace internal {
+
+void replaceSplitterWidget(QSplitter *splitter, QWidget *from, QWidget *to)
+{
+ int index = splitter->indexOf(from);
+ from->setParent(nullptr);
+ splitter->insertWidget(index, to);
+}
+
+DockInsertParam dockAreaInsertParameters(DockWidgetArea area)
+{
+ switch (area) {
+ case TopDockWidgetArea:
+ return DockInsertParam(Qt::Vertical, false);
+ case RightDockWidgetArea:
+ return DockInsertParam(Qt::Horizontal, true);
+ case CenterDockWidgetArea:
+ case BottomDockWidgetArea:
+ return DockInsertParam(Qt::Vertical, true);
+ case LeftDockWidgetArea:
+ return DockInsertParam(Qt::Horizontal, false);
+ default:
+ DockInsertParam(Qt::Vertical, false);
+ }
+
+ return DockInsertParam(Qt::Vertical, false);
+}
+
+QPixmap createTransparentPixmap(const QPixmap &source, qreal opacity)
+{
+ QPixmap transparentPixmap(source.size());
+ transparentPixmap.fill(Qt::transparent);
+ QPainter painter(&transparentPixmap);
+ painter.setOpacity(opacity);
+ painter.drawPixmap(0, 0, source);
+ return transparentPixmap;
+}
+
+void hideEmptyParentSplitters(DockSplitter *splitter)
+{
+ while (splitter && splitter->isVisible()) {
+ if (!splitter->hasVisibleContent()) {
+ splitter->hide();
+ }
+ splitter = internal::findParent<DockSplitter *>(splitter);
+ }
+}
+
+void setButtonIcon(QAbstractButton* button,
+ QStyle::StandardPixmap standarPixmap,
+ ADS::eIcon customIconId)
+{
+ // First we try to use custom icons if available
+ QIcon icon = DockManager::iconProvider().customIcon(customIconId);
+ if (!icon.isNull()) {
+ button->setIcon(icon);
+ return;
+ }
+
+ if (Utils::HostOsInfo::isLinuxHost()) {
+ button->setIcon(button->style()->standardIcon(standarPixmap));
+ } else {
+ // The standard icons does not look good on high DPI screens so we create
+ // our own "standard" icon here.
+ QPixmap normalPixmap = button->style()->standardPixmap(standarPixmap, nullptr, button);
+ icon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
+ icon.addPixmap(normalPixmap, QIcon::Normal);
+ button->setIcon(icon);
+ }
+}
+
+} // namespace internal
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/ads_globals.h b/src/libs/advanceddockingsystem/ads_globals.h
new file mode 100644
index 00000000000..4c0b8d6896a
--- /dev/null
+++ b/src/libs/advanceddockingsystem/ads_globals.h
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QDebug>
+#include <QPair>
+#include <QPixmap>
+#include <QStyle>
+#include <QWidget>
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+class QAbstractButton;
+class QSplitter;
+QT_END_NAMESPACE
+
+#ifndef ADS_STATIC
+#ifdef ADVANCEDDOCKINGSYSTEM_LIBRARY
+#define ADS_EXPORT Q_DECL_EXPORT
+#else
+#define ADS_EXPORT Q_DECL_IMPORT
+#endif
+#else
+#define ADS_EXPORT
+#endif
+
+//#define ADS_DEBUG_PRINT
+
+// Define ADS_DEBUG_PRINT to enable a lot of debug output
+#ifdef ADS_DEBUG_PRINT
+#define ADS_PRINT(s) qDebug() << s
+#else
+#define ADS_PRINT(s)
+#endif
+
+// Set ADS_DEBUG_LEVEL to enable additional debug output and to enable layout
+// dumps to qDebug and std::cout after layout changes
+#define ADS_DEBUG_LEVEL 0
+
+namespace ADS {
+
+enum eStateFileVersion { InitialVerison = 0, Version1 = 1, CurrentVersion = Version1 };
+
+class DockSplitter;
+
+enum DockWidgetArea {
+ NoDockWidgetArea = 0x00,
+ LeftDockWidgetArea = 0x01,
+ RightDockWidgetArea = 0x02,
+ TopDockWidgetArea = 0x04,
+ BottomDockWidgetArea = 0x08,
+ CenterDockWidgetArea = 0x10,
+
+ InvalidDockWidgetArea = NoDockWidgetArea,
+ OuterDockAreas = TopDockWidgetArea | LeftDockWidgetArea | RightDockWidgetArea
+ | BottomDockWidgetArea,
+ AllDockAreas = OuterDockAreas | CenterDockWidgetArea
+};
+Q_DECLARE_FLAGS(DockWidgetAreas, DockWidgetArea)
+
+enum eTitleBarButton { TitleBarButtonTabsMenu, TitleBarButtonUndock, TitleBarButtonClose };
+
+/**
+ * The different dragging states
+ */
+enum eDragState {
+ DraggingInactive, //!< DraggingInactive
+ DraggingMousePressed, //!< DraggingMousePressed
+ DraggingTab, //!< DraggingTab
+ DraggingFloatingWidget //!< DraggingFloatingWidget
+};
+
+/**
+ * The different icons used in the UI
+ */
+enum eIcon {
+ TabCloseIcon, //!< TabCloseIcon
+ DockAreaMenuIcon, //!< DockAreaMenuIcon
+ DockAreaUndockIcon, //!< DockAreaUndockIcon
+ DockAreaCloseIcon, //!< DockAreaCloseIcon
+
+ IconCount, //!< just a delimiter for range checks
+};
+
+/**
+ * For bitwise combination of dock wdget features
+ */
+enum eBitwiseOperator
+{
+ BitwiseAnd,
+ BitwiseOr
+};
+
+namespace internal {
+const bool restoreTesting = true;
+const bool restore = false;
+const char *const closedProperty = "close";
+const char *const dirtyProperty = "dirty";
+
+/**
+ * Replace the from widget in the given splitter with the To widget
+ */
+void replaceSplitterWidget(QSplitter *splitter, QWidget *from, QWidget *to);
+
+/**
+ * This function walks the splitter tree upwards to hides all splitters
+ * that do not have visible content
+ */
+void hideEmptyParentSplitters(DockSplitter *firstParentSplitter);
+
+/**
+ * Convenience class for QPair to provide better naming than first and
+ * second
+ */
+class DockInsertParam : public QPair<Qt::Orientation, bool>
+{
+public:
+ using QPair::QPair;
+ Qt::Orientation orientation() const { return this->first; }
+ bool append() const { return this->second; }
+ int insertOffset() const { return append() ? 1 : 0; }
+};
+
+/**
+ * Returns the insertion parameters for the given dock area
+ */
+DockInsertParam dockAreaInsertParameters(DockWidgetArea area);
+
+/**
+ * Searches for the parent widget of the given type.
+ * Returns the parent widget of the given widget or 0 if the widget is not
+ * child of any widget of type T
+ *
+ * It is not safe to use this function in in DockWidget because only
+ * the current dock widget has a parent. All dock widgets that are not the
+ * current dock widget in a dock area have no parent.
+ */
+template<class T>
+T findParent(const QWidget *widget)
+{
+ QWidget *parentWidget = widget->parentWidget();
+ while (parentWidget) {
+ T parentImpl = qobject_cast<T>(parentWidget);
+ if (parentImpl) {
+ return parentImpl;
+ }
+ parentWidget = parentWidget->parentWidget();
+ }
+ return 0;
+}
+
+/**
+ * Creates a semi transparent pixmap from the given pixmap Source.
+ * The Opacity parameter defines the opacity from completely transparent (0.0)
+ * to completely opaque (1.0)
+ */
+QPixmap createTransparentPixmap(const QPixmap &source, qreal opacity);
+
+/**
+ * Helper function for settings flags in a QFlags instance.
+ */
+template<class T>
+void setFlag(T &flags, typename T::enum_type flag, bool on = true)
+{
+ flags.setFlag(flag, on);
+}
+
+/**
+ * Helper function for settings tooltips without cluttering the code with
+ * tests for preprocessor macros
+ */
+template <class QObjectPtr>
+void setToolTip(QObjectPtr obj, const QString &tip)
+{
+#ifndef QT_NO_TOOLTIP
+ obj->setToolTip(tip);
+#else
+ Q_UNUSED(obj);
+ Q_UNUSED(tip);
+#endif
+}
+
+/**
+ * Helper function to set the icon of a certain button.
+ * Use this function to set the icons for the dock area and dock widget buttons.
+ * The function first uses the CustomIconId to get an icon from the
+ * IconProvider. You can register your custom icons with the icon provider, if
+ * you do not want to use the default buttons and if you do not want to use
+ * stylesheets.
+ * If the IconProvider does not return a valid icon (icon is null), the function
+ * fetches the given standard pixmap from the QStyle.
+ * param[in] Button The button whose icons are to be set
+ * param[in] StandardPixmap The standard pixmap to be used for the button
+ * param[in] CustomIconId The identifier for the custom icon.
+ */
+void setButtonIcon(QAbstractButton *button, QStyle::StandardPixmap standarPixmap,
+ ADS::eIcon CustomIconId);
+
+} // namespace internal
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/advanceddockingsystem-lib.pri b/src/libs/advanceddockingsystem/advanceddockingsystem-lib.pri
new file mode 100644
index 00000000000..57526219853
--- /dev/null
+++ b/src/libs/advanceddockingsystem/advanceddockingsystem-lib.pri
@@ -0,0 +1,58 @@
+shared {
+ DEFINES += ADVANCEDDOCKINGSYSTEM_LIBRARY
+} else {
+ DEFINES += BUILD_ADVANCEDDOCKINGSYSTEM_STATIC_LIB
+}
+
+## Input
+RESOURCES += \
+ resources.qrc
+
+HEADERS += \
+ ads_globals.h \
+ dockareatabbar.h \
+ dockareatitlebar.h \
+ dockareawidget.h \
+ dockcomponentsfactory.h \
+ dockcontainerwidget.h \
+ dockingstatereader.h \
+ dockmanager.h \
+ dockoverlay.h \
+ docksplitter.h \
+ dockwidget.h \
+ dockwidgettab.h \
+ elidinglabel.h \
+ floatingdockcontainer.h \
+ floatingdragpreview.h \
+ iconprovider.h \
+ workspacedialog.h \
+ workspacemodel.h \
+ workspaceview.h
+
+SOURCES += \
+ ads_globals.cpp \
+ dockareatabbar.cpp \
+ dockareatitlebar.cpp \
+ dockareawidget.cpp \
+ dockcomponentsfactory.cpp \
+ dockcontainerwidget.cpp \
+ dockingstatereader.cpp \
+ dockmanager.cpp \
+ dockoverlay.cpp \
+ docksplitter.cpp \
+ dockwidget.cpp \
+ dockwidgettab.cpp \
+ elidinglabel.cpp \
+ floatingdockcontainer.cpp \
+ floatingdragpreview.cpp \
+ iconprovider.cpp \
+ workspacedialog.cpp \
+ workspacemodel.cpp \
+ workspaceview.cpp
+
+FORMS += \
+ workspacedialog.ui
+
+include(linux/linux.pri)
+
+DISTFILES += advanceddockingsystem.pri
diff --git a/src/libs/advanceddockingsystem/advanceddockingsystem.pro b/src/libs/advanceddockingsystem/advanceddockingsystem.pro
new file mode 100644
index 00000000000..30b4a3a77e8
--- /dev/null
+++ b/src/libs/advanceddockingsystem/advanceddockingsystem.pro
@@ -0,0 +1,6 @@
+unix:QMAKE_CXXFLAGS_DEBUG += -O3
+
+INCLUDEPATH += $$PWD $$PWD/linux
+
+include(../../qtcreatorlibrary.pri)
+include(advanceddockingsystem-lib.pri)
diff --git a/src/libs/advanceddockingsystem/advanceddockingsystem.qbs b/src/libs/advanceddockingsystem/advanceddockingsystem.qbs
new file mode 100644
index 00000000000..e2877556f0e
--- /dev/null
+++ b/src/libs/advanceddockingsystem/advanceddockingsystem.qbs
@@ -0,0 +1,48 @@
+import qbs 1.0
+
+QtcLibrary {
+ name: "AdvancedDockingSystem"
+
+ cpp.optimization: "fast"
+ cpp.defines: base.concat("ADVANCEDDOCKINGSYSTEM_LIBRARY")
+ cpp.includePaths: base.concat([".", linux.prefix])
+
+ Depends { name: "Qt"; submodules: ["widgets", "core", "gui"] }
+ Depends { name: "Utils" }
+
+ Group {
+ name: "General"
+ files: [
+ "ads_globals.cpp", "ads_globals.h",
+ "dockareatabbar.cpp", "dockareatabbar.h",
+ "dockareatitlebar.cpp", "dockareatitlebar.h",
+ "dockareawidget.cpp", "dockareawidget.h",
+ "dockcomponentsfactory.cpp", "dockcomponentsfactory.h",
+ "dockcontainerwidget.cpp", "dockcontainerwidget.h",
+ "dockingstatereader.cpp", "dockingstatereader.h",
+ "dockmanager.cpp", "dockmanager.h",
+ "dockoverlay.cpp", "dockoverlay.h",
+ "docksplitter.cpp", "docksplitter.h",
+ "dockwidget.cpp", "dockwidget.h",
+ "dockwidgettab.cpp", "dockwidgettab.h",
+ "elidinglabel.cpp", "elidinglabel.h",
+ "floatingdockcontainer.cpp", "floatingdockcontainer.h",
+ "floatingdragpreview.cpp", "floatingdragpreview.h",
+ "iconprovider.cpp", "iconprovider.h",
+ "workspacedialog.cpp", "workspacedialog.h",
+ "workspacemodel.cpp", "workspacemodel.h",
+ "workspaceview.cpp", "workspaceview.h",
+ "workspacedialog.ui",
+ "resources.qrc"
+ ]
+ }
+
+ Group {
+ name: "Linux"
+ id: linux
+ prefix: "linux/"
+ files: [
+ "floatingwidgettitlebar.cpp", "floatingwidgettitlebar.h"
+ ]
+ }
+}
diff --git a/src/libs/advanceddockingsystem/advanceddockingsystem_dependencies.pri b/src/libs/advanceddockingsystem/advanceddockingsystem_dependencies.pri
new file mode 100644
index 00000000000..df4563c7936
--- /dev/null
+++ b/src/libs/advanceddockingsystem/advanceddockingsystem_dependencies.pri
@@ -0,0 +1,3 @@
+QTC_LIB_NAME = AdvancedDockingSystem
+QTC_LIB_DEPENDS += utils
+INCLUDEPATH *= $$IDE_SOURCE_TREE/src/libs/advanceddockingsystem
diff --git a/src/libs/advanceddockingsystem/dockareatabbar.cpp b/src/libs/advanceddockingsystem/dockareatabbar.cpp
new file mode 100644
index 00000000000..6c98ebe4fc0
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockareatabbar.cpp
@@ -0,0 +1,402 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockareatabbar.h"
+
+#include "dockareawidget.h"
+#include "dockmanager.h"
+#include "dockoverlay.h"
+#include "dockwidget.h"
+#include "dockwidgettab.h"
+#include "floatingdockcontainer.h"
+#include "floatingdragpreview.h"
+
+#include <QApplication>
+#include <QBoxLayout>
+#include <QLoggingCategory>
+#include <QMouseEvent>
+#include <QScrollBar>
+#include <QtGlobal>
+
+#include <iostream>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ /**
+ * Private data class of DockAreaTabBar class (pimpl)
+ */
+ struct DockAreaTabBarPrivate
+ {
+ DockAreaTabBar *q;
+ DockAreaWidget *m_dockArea;
+ QWidget *m_tabsContainerWidget;
+ QBoxLayout *m_tabsLayout;
+ int m_currentIndex = -1;
+
+ /**
+ * Private data constructor
+ */
+ DockAreaTabBarPrivate(DockAreaTabBar *parent);
+
+ /**
+ * Update tabs after current index changed or when tabs are removed.
+ * The function reassigns the stylesheet to update the tabs
+ */
+ void updateTabs();
+
+ /**
+ * Convenience function to access first tab
+ */
+ DockWidgetTab *firstTab() const {return q->tab(0);}
+
+ /**
+ * Convenience function to access last tab
+ */
+ DockWidgetTab *lastTab() const {return q->tab(q->count() - 1);}
+ };
+ // struct DockAreaTabBarPrivate
+
+ DockAreaTabBarPrivate::DockAreaTabBarPrivate(DockAreaTabBar *parent)
+ : q(parent)
+ {}
+
+ void DockAreaTabBarPrivate::updateTabs()
+ {
+ // Set active TAB and update all other tabs to be inactive
+ for (int i = 0; i < q->count(); ++i) {
+ auto tabWidget = q->tab(i);
+ if (!tabWidget)
+ continue;
+
+ if (i == m_currentIndex) {
+ tabWidget->show();
+ tabWidget->setActiveTab(true);
+ q->ensureWidgetVisible(tabWidget);
+ } else {
+ tabWidget->setActiveTab(false);
+ }
+ }
+ }
+
+ DockAreaTabBar::DockAreaTabBar(DockAreaWidget *parent)
+ : QScrollArea(parent)
+ , d(new DockAreaTabBarPrivate(this))
+ {
+ d->m_dockArea = parent;
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ setFrameStyle(QFrame::NoFrame);
+ setWidgetResizable(true);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ d->m_tabsContainerWidget = new QWidget();
+ d->m_tabsContainerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ d->m_tabsContainerWidget->setObjectName("tabsContainerWidget");
+ d->m_tabsLayout = new QBoxLayout(QBoxLayout::LeftToRight);
+ d->m_tabsLayout->setContentsMargins(0, 0, 0, 0);
+ d->m_tabsLayout->setSpacing(0);
+ d->m_tabsLayout->addStretch(1);
+ d->m_tabsContainerWidget->setLayout(d->m_tabsLayout);
+ setWidget(d->m_tabsContainerWidget);
+ }
+
+ DockAreaTabBar::~DockAreaTabBar() { delete d; }
+
+ void DockAreaTabBar::wheelEvent(QWheelEvent *event)
+ {
+ event->accept();
+ const int direction = event->angleDelta().y();
+ if (direction < 0) {
+ horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 20);
+ } else {
+ horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
+ }
+ }
+
+ void DockAreaTabBar::setCurrentIndex(int index)
+ {
+ if (index == d->m_currentIndex)
+ return;
+
+ if (index < -1 || index > (count() - 1)) {
+ qWarning() << Q_FUNC_INFO << "Invalid index" << index;
+ return;
+ }
+
+ emit currentChanging(index);
+ d->m_currentIndex = index;
+ d->updateTabs();
+ updateGeometry();
+ emit currentChanged(index);
+ }
+
+ int DockAreaTabBar::count() const
+ {
+ // The tab bar contains a stretch item as last item
+ return d->m_tabsLayout->count() - 1;
+ }
+
+ void DockAreaTabBar::insertTab(int index, DockWidgetTab *dockWidgetTab)
+ {
+ d->m_tabsLayout->insertWidget(index, dockWidgetTab);
+ connect(dockWidgetTab, &DockWidgetTab::clicked, this, &DockAreaTabBar::onTabClicked);
+ connect(dockWidgetTab,
+ &DockWidgetTab::closeRequested,
+ this,
+ &DockAreaTabBar::onTabCloseRequested);
+ connect(dockWidgetTab,
+ &DockWidgetTab::closeOtherTabsRequested,
+ this,
+ &DockAreaTabBar::onCloseOtherTabsRequested);
+ connect(dockWidgetTab, &DockWidgetTab::moved, this, &DockAreaTabBar::onTabWidgetMoved);
+ connect(dockWidgetTab,
+ &DockWidgetTab::elidedChanged,
+ this,
+ &DockAreaTabBar::elidedChanged);
+ dockWidgetTab->installEventFilter(this);
+ emit tabInserted(index);
+ if (index <= d->m_currentIndex || d->m_currentIndex == -1) {
+ setCurrentIndex(d->m_currentIndex + 1);
+ }
+ updateGeometry();
+ }
+
+ void DockAreaTabBar::removeTab(DockWidgetTab *dockWidgetTab)
+ {
+ if (!count())
+ return;
+
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ int newCurrentIndex = currentIndex();
+ int removeIndex = d->m_tabsLayout->indexOf(dockWidgetTab);
+ if (count() == 1)
+ newCurrentIndex = -1;
+
+ if (newCurrentIndex > removeIndex) {
+ newCurrentIndex--;
+ } else if (newCurrentIndex == removeIndex) {
+ newCurrentIndex = -1;
+ // First we walk to the right to search for the next visible tab
+ for (int i = (removeIndex + 1); i < count(); ++i) {
+ if (tab(i)->isVisibleTo(this)) {
+ newCurrentIndex = i - 1;
+ break;
+ }
+ }
+
+ // If there is no visible tab right to this tab then we walk to
+ // the left to find a visible tab
+ if (newCurrentIndex < 0) {
+ for (int i = (removeIndex - 1); i >= 0; --i) {
+ if (tab(i)->isVisibleTo(this)) {
+ newCurrentIndex = i;
+ break;
+ }
+ }
+ }
+ }
+
+ emit removingTab(removeIndex);
+ d->m_tabsLayout->removeWidget(dockWidgetTab);
+ dockWidgetTab->disconnect(this);
+ dockWidgetTab->removeEventFilter(this);
+ qCInfo(adsLog) << "NewCurrentIndex " << newCurrentIndex;
+ if (newCurrentIndex != d->m_currentIndex) {
+ setCurrentIndex(newCurrentIndex);
+ } else {
+ d->updateTabs();
+ }
+ updateGeometry();
+ }
+
+ int DockAreaTabBar::currentIndex() const { return d->m_currentIndex; }
+
+ DockWidgetTab *DockAreaTabBar::currentTab() const
+ {
+ if (d->m_currentIndex < 0) {
+ return nullptr;
+ } else {
+ return qobject_cast<DockWidgetTab *>(
+ d->m_tabsLayout->itemAt(d->m_currentIndex)->widget());
+ }
+ }
+
+ void DockAreaTabBar::onTabClicked()
+ {
+ DockWidgetTab *tab = qobject_cast<DockWidgetTab *>(sender());
+ if (!tab)
+ return;
+
+ int index = d->m_tabsLayout->indexOf(tab);
+ if (index < 0)
+ return;
+
+ setCurrentIndex(index);
+ emit tabBarClicked(index);
+ }
+
+ void DockAreaTabBar::onTabCloseRequested()
+ {
+ DockWidgetTab *tab = qobject_cast<DockWidgetTab *>(sender());
+ int index = d->m_tabsLayout->indexOf(tab);
+ closeTab(index);
+ }
+
+ void DockAreaTabBar::onCloseOtherTabsRequested()
+ {
+ auto senderTab = qobject_cast<DockWidgetTab *>(sender());
+ for (int i = 0; i < count(); ++i) {
+ auto currentTab = tab(i);
+ if (currentTab->isClosable() && !currentTab->isHidden() && currentTab != senderTab) {
+ // If the dock widget is deleted with the closeTab() call, its tab it will no longer
+ // be in the layout, and thus the index needs to be updated to not skip any tabs
+ int offset = currentTab->dockWidget()->features().testFlag(
+ DockWidget::DockWidgetDeleteOnClose)
+ ? 1
+ : 0;
+ closeTab(i);
+ // If the the dock widget blocks closing, i.e. if the flag
+ // CustomCloseHandling is set, and the dock widget is still open,
+ // then we do not need to correct the index
+ if (currentTab->dockWidget()->isClosed()) {
+ i -= offset;
+ }
+ }
+ }
+ }
+
+ DockWidgetTab *DockAreaTabBar::tab(int index) const
+ {
+ if (index >= count() || index < 0)
+ return nullptr;
+
+ return qobject_cast<DockWidgetTab *>(d->m_tabsLayout->itemAt(index)->widget());
+ }
+
+ void DockAreaTabBar::onTabWidgetMoved(const QPoint &globalPosition)
+ {
+ DockWidgetTab *movingTab = qobject_cast<DockWidgetTab *>(sender());
+ if (!movingTab)
+ return;
+
+ int fromIndex = d->m_tabsLayout->indexOf(movingTab);
+ auto mousePos = mapFromGlobal(globalPosition);
+ mousePos.rx() = qMax(d->firstTab()->geometry().left(), mousePos.x());
+ mousePos.rx() = qMin(d->lastTab()->geometry().right(), mousePos.x());
+ int toIndex = -1;
+ // Find tab under mouse
+ for (int i = 0; i < count(); ++i) {
+ DockWidgetTab *dropTab = tab(i);
+ if (dropTab == movingTab || !dropTab->isVisibleTo(this)
+ || !dropTab->geometry().contains(mousePos))
+ continue;
+
+ toIndex = d->m_tabsLayout->indexOf(dropTab);
+ if (toIndex == fromIndex)
+ toIndex = -1;
+
+ break;
+ }
+
+ if (toIndex > -1) {
+ d->m_tabsLayout->removeWidget(movingTab);
+ d->m_tabsLayout->insertWidget(toIndex, movingTab);
+ qCInfo(adsLog) << "tabMoved from" << fromIndex << "to" << toIndex;
+ emit tabMoved(fromIndex, toIndex);
+ setCurrentIndex(toIndex);
+ } else {
+ // Ensure that the moved tab is reset to its start position
+ d->m_tabsLayout->update();
+ }
+ }
+
+ void DockAreaTabBar::closeTab(int index)
+ {
+ if (index < 0 || index >= count())
+ return;
+
+ auto dockWidgetTab = tab(index);
+ if (dockWidgetTab->isHidden())
+ return;
+
+ emit tabCloseRequested(index);
+ }
+
+ bool DockAreaTabBar::eventFilter(QObject *watched, QEvent *event)
+ {
+ bool result = Super::eventFilter(watched, event);
+ DockWidgetTab *dockWidgetTab = qobject_cast<DockWidgetTab *>(watched);
+ if (!dockWidgetTab)
+ return result;
+
+ switch (event->type()) {
+ case QEvent::Hide:
+ emit tabClosed(d->m_tabsLayout->indexOf(dockWidgetTab));
+ updateGeometry();
+ break;
+ case QEvent::Show:
+ emit tabOpened(d->m_tabsLayout->indexOf(dockWidgetTab));
+ updateGeometry();
+ break;
+ default:
+ break;
+ }
+
+ return result;
+ }
+
+ bool DockAreaTabBar::isTabOpen(int index) const
+ {
+ if (index < 0 || index >= count())
+ return false;
+
+ return !tab(index)->isHidden();
+ }
+
+ QSize DockAreaTabBar::minimumSizeHint() const
+ {
+ QSize size = sizeHint();
+ size.setWidth(10);
+ return size;
+ }
+
+ QSize DockAreaTabBar::sizeHint() const
+ {
+ return d->m_tabsContainerWidget->sizeHint();
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockareatabbar.h b/src/libs/advanceddockingsystem/dockareatabbar.h
new file mode 100644
index 00000000000..991286c45ee
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockareatabbar.h
@@ -0,0 +1,217 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QScrollArea>
+
+namespace ADS {
+
+class DockAreaWidget;
+class DockWidgetTab;
+struct DockAreaTabBarPrivate;
+class DockAreaTitleBar;
+class FloatingDockContainer;
+class AbstractFloatingWidget;
+
+/**
+ * Custom tabbar implementation for tab area that is shown on top of a
+ * dock area widget.
+ * The tabbar displays the tab widgets of the contained dock widgets.
+ * We cannot use QTabBar here because it does a lot of fancy animations
+ * that will crash the application if a tab is removed while the animation
+ * has not finished. And we need to remove a tab, if the user drags a
+ * a dock widget out of a group of tabbed widgets
+ */
+class ADS_EXPORT DockAreaTabBar : public QScrollArea
+{
+ Q_OBJECT
+private:
+ DockAreaTabBarPrivate *d; ///< private data (pimpl)
+ friend struct DockAreaTabBarPrivate;
+ friend class DockAreaTitleBar;
+
+ void onTabClicked();
+ void onTabCloseRequested();
+ void onCloseOtherTabsRequested();
+ void onTabWidgetMoved(const QPoint &globalPos);
+
+protected:
+ virtual void wheelEvent(QWheelEvent *event) override;
+
+public:
+ using Super = QScrollArea;
+
+ /**
+ * Default Constructor
+ */
+ DockAreaTabBar(DockAreaWidget *parent);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~DockAreaTabBar() override;
+
+ /**
+ * Inserts the given dock widget tab at the given position.
+ * Inserting a new tab at an index less than or equal to the current index
+ * will increment the current index, but keep the current tab.
+ */
+ void insertTab(int Index, DockWidgetTab *tab);
+
+ /**
+ * Removes the given DockWidgetTab from the tabbar
+ */
+ void removeTab(DockWidgetTab *tab);
+
+ /**
+ * Returns the number of tabs in this tabbar
+ */
+ int count() const;
+
+ /**
+ * Returns the current index or -1 if no tab is selected
+ */
+ int currentIndex() const;
+
+ /**
+ * Returns the current tab or a nullptr if no tab is selected.
+ */
+ DockWidgetTab *currentTab() const;
+
+ /**
+ * Returns the tab with the given index
+ */
+ DockWidgetTab *tab(int index) const;
+
+ /**
+ * Filters the tab widget events
+ */
+ virtual bool eventFilter(QObject *watched, QEvent *event) override;
+
+ /**
+ * This function returns true if the tab is open, that means if it is
+ * visible to the user. If the function returns false, the tab is
+ * closed
+ */
+ bool isTabOpen(int index) const;
+
+ /**
+ * Overrides the minimumSizeHint() function of QScrollArea
+ * The minimumSizeHint() is bigger than the sizeHint () for the scroll
+ * area because even if the scrollbars are invisible, the required speace
+ * is reserved in the minimumSizeHint(). This override simply returns
+ * sizeHint();
+ */
+ virtual QSize minimumSizeHint() const override;
+
+ /**
+ * The function provides a sizeHint that matches the height of the
+ * internal viewport.
+ */
+ virtual QSize sizeHint() const override;
+
+ /**
+ * This property sets the index of the tab bar's visible tab
+ */
+ void setCurrentIndex(int index);
+
+ /**
+ * This function will close the tab given in Index param.
+ * Closing a tab means, the tab will be hidden, it will not be removed
+ */
+ void closeTab(int index);
+
+signals:
+ /**
+ * This signal is emitted when the tab bar's current tab is about to be changed. The new
+ * current has the given index, or -1 if there isn't a new one.
+ */
+ void currentChanging(int index);
+
+ /**
+ * This signal is emitted when the tab bar's current tab changes. The new
+ * current has the given index, or -1 if there isn't a new one
+ */
+ void currentChanged(int index);
+
+ /**
+ * This signal is emitted when user clicks on a tab
+ */
+ void tabBarClicked(int index);
+
+ /**
+ * This signal is emitted when the close button on a tab is clicked.
+ * The index is the index that should be closed.
+ */
+ void tabCloseRequested(int index);
+
+ /**
+ * This signal is emitted if a tab has been closed
+ */
+ void tabClosed(int index);
+
+ /**
+ * This signal is emitted if a tab has been opened.
+ * A tab is opened if it has been made visible
+ */
+ void tabOpened(int index);
+
+ /**
+ * This signal is emitted when the tab has moved the tab at index position
+ * from to index position to.
+ */
+ void tabMoved(int from, int to);
+
+ /**
+ * This signal is emitted, just before the tab with the given index is
+ * removed
+ */
+ void removingTab(int index);
+
+ /**
+ * This signal is emitted if a tab has been inserted
+ */
+ void tabInserted(int index);
+
+ /**
+ * This signal is emitted when a tab title elide state has been changed
+ */
+ void elidedChanged(bool elided);
+}; // class DockAreaTabBar
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockareatitlebar.cpp b/src/libs/advanceddockingsystem/dockareatitlebar.cpp
new file mode 100644
index 00000000000..a24055d194f
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockareatitlebar.cpp
@@ -0,0 +1,577 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockareatitlebar.h"
+
+#include "ads_globals.h"
+#include "dockareatabbar.h"
+#include "dockareawidget.h"
+#include "dockmanager.h"
+#include "dockoverlay.h"
+#include "dockwidget.h"
+#include "dockwidgettab.h"
+#include "floatingdockcontainer.h"
+#include "floatingdragpreview.h"
+#include "iconprovider.h"
+#include "dockcomponentsfactory.h"
+
+#include <QBoxLayout>
+#include <QLoggingCategory>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QPushButton>
+#include <QScrollArea>
+#include <QStyle>
+
+#include <iostream>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ /**
+ * Private data class of DockAreaTitleBar class (pimpl)
+ */
+ struct DockAreaTitleBarPrivate
+ {
+ DockAreaTitleBar *q;
+ QPointer<TitleBarButtonType> m_tabsMenuButton;
+ QPointer<TitleBarButtonType> m_undockButton;
+ QPointer<TitleBarButtonType> m_closeButton;
+ QBoxLayout *m_layout;
+ DockAreaWidget *m_dockArea;
+ DockAreaTabBar *m_tabBar;
+ bool m_menuOutdated = true;
+ QMenu *m_tabsMenu;
+ QList<TitleBarButtonType *> m_dockWidgetActionsButtons;
+
+ QPoint m_dragStartMousePos;
+ eDragState m_dragState = DraggingInactive;
+ AbstractFloatingWidget *m_floatingWidget = nullptr;
+
+ /**
+ * Private data constructor
+ */
+ DockAreaTitleBarPrivate(DockAreaTitleBar *parent);
+
+ /**
+ * Creates the title bar close and menu buttons
+ */
+ void createButtons();
+
+ /**
+ * Creates the internal TabBar
+ */
+ void createTabBar();
+
+ /**
+ * Convenience function for DockManager access
+ */
+ DockManager *dockManager() const { return m_dockArea->dockManager(); }
+
+ /**
+ * Returns true if the given config flag is set
+ */
+ static bool testConfigFlag(DockManager::eConfigFlag flag)
+ {
+ return DockManager::configFlags().testFlag(flag);
+ }
+
+ /**
+ * Test function for current drag state
+ */
+ bool isDraggingState(eDragState dragState) const { return this->m_dragState == dragState; }
+
+
+ /**
+ * Starts floating
+ */
+ void startFloating(const QPoint &offset);
+
+ /**
+ * Makes the dock area floating
+ */
+ AbstractFloatingWidget *makeAreaFloating(const QPoint &offset, eDragState dragState);
+ }; // struct DockAreaTitleBarPrivate
+
+
+ DockAreaTitleBarPrivate::DockAreaTitleBarPrivate(DockAreaTitleBar *parent)
+ : q(parent)
+ {}
+
+ void DockAreaTitleBarPrivate::createButtons()
+ {
+ QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+ // Tabs menu button
+ m_tabsMenuButton = new TitleBarButton(testConfigFlag(DockManager::DockAreaHasTabsMenuButton));
+ m_tabsMenuButton->setObjectName("tabsMenuButton");
+ m_tabsMenuButton->setAutoRaise(true);
+ m_tabsMenuButton->setPopupMode(QToolButton::InstantPopup);
+ internal::setButtonIcon(m_tabsMenuButton,
+ QStyle::SP_TitleBarUnshadeButton,
+ ADS::DockAreaMenuIcon);
+ QMenu *tabsMenu = new QMenu(m_tabsMenuButton);
+#ifndef QT_NO_TOOLTIP
+ tabsMenu->setToolTipsVisible(true);
+#endif
+ QObject::connect(tabsMenu, &QMenu::aboutToShow, q, &DockAreaTitleBar::onTabsMenuAboutToShow);
+ m_tabsMenuButton->setMenu(tabsMenu);
+ internal::setToolTip(m_tabsMenuButton, QObject::tr("List All Tabs"));
+ m_tabsMenuButton->setSizePolicy(sizePolicy);
+ m_layout->addWidget(m_tabsMenuButton, 0);
+ QObject::connect(m_tabsMenuButton->menu(),
+ &QMenu::triggered,
+ q,
+ &DockAreaTitleBar::onTabsMenuActionTriggered);
+
+ // Undock button
+ m_undockButton = new TitleBarButton(testConfigFlag(DockManager::DockAreaHasUndockButton));
+ m_undockButton->setObjectName("undockButton");
+ m_undockButton->setAutoRaise(true);
+ internal::setToolTip(m_undockButton, QObject::tr("Detach Group"));
+ internal::setButtonIcon(m_undockButton,
+ QStyle::SP_TitleBarNormalButton,
+ ADS::DockAreaUndockIcon);
+ m_undockButton->setSizePolicy(sizePolicy);
+ m_layout->addWidget(m_undockButton, 0);
+ QObject::connect(m_undockButton,
+ &QToolButton::clicked,
+ q,
+ &DockAreaTitleBar::onUndockButtonClicked);
+
+ // Close button
+ m_closeButton = new TitleBarButton(testConfigFlag(DockManager::DockAreaHasCloseButton));
+ m_closeButton->setObjectName("closeButton");
+ m_closeButton->setAutoRaise(true);
+ internal::setButtonIcon(m_closeButton,
+ QStyle::SP_TitleBarCloseButton,
+ ADS::DockAreaCloseIcon);
+ if (testConfigFlag(DockManager::DockAreaCloseButtonClosesTab)) {
+ internal::setToolTip(m_closeButton, QObject::tr("Close Active Tab"));
+ } else {
+ internal::setToolTip(m_closeButton, QObject::tr("Close Group"));
+ }
+ m_closeButton->setSizePolicy(sizePolicy);
+ m_closeButton->setIconSize(QSize(16, 16));
+ m_layout->addWidget(m_closeButton, 0);
+ QObject::connect(m_closeButton,
+ &QToolButton::clicked,
+ q,
+ &DockAreaTitleBar::onCloseButtonClicked);
+ }
+
+ void DockAreaTitleBarPrivate::createTabBar()
+ {
+ m_tabBar = componentsFactory()->createDockAreaTabBar(m_dockArea);
+ m_tabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
+ m_layout->addWidget(m_tabBar);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::tabClosed,
+ q,
+ &DockAreaTitleBar::markTabsMenuOutdated);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::tabOpened,
+ q,
+ &DockAreaTitleBar::markTabsMenuOutdated);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::tabInserted,
+ q,
+ &DockAreaTitleBar::markTabsMenuOutdated);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::removingTab,
+ q,
+ &DockAreaTitleBar::markTabsMenuOutdated);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::tabMoved,
+ q,
+ &DockAreaTitleBar::markTabsMenuOutdated);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::currentChanged,
+ q,
+ &DockAreaTitleBar::onCurrentTabChanged);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::tabBarClicked,
+ q,
+ &DockAreaTitleBar::tabBarClicked);
+ QObject::connect(m_tabBar,
+ &DockAreaTabBar::elidedChanged,
+ q,
+ &DockAreaTitleBar::markTabsMenuOutdated);
+ }
+
+ AbstractFloatingWidget *DockAreaTitleBarPrivate::makeAreaFloating(const QPoint &offset,
+ eDragState dragState)
+ {
+ QSize size = m_dockArea->size();
+ m_dragState = dragState;
+ bool opaqueUndocking = DockManager::configFlags().testFlag(DockManager::OpaqueUndocking)
+ || (DraggingFloatingWidget != dragState);
+ FloatingDockContainer *floatingDockContainer = nullptr;
+ AbstractFloatingWidget *floatingWidget;
+ if (opaqueUndocking) {
+ floatingWidget = floatingDockContainer = new FloatingDockContainer(m_dockArea);
+ } else {
+ auto w = new FloatingDragPreview(m_dockArea);
+ QObject::connect(w, &FloatingDragPreview::draggingCanceled, [=]() {
+ m_dragState = DraggingInactive;
+ });
+ floatingWidget = w;
+ }
+
+ floatingWidget->startFloating(offset, size, dragState, nullptr);
+ if (floatingDockContainer) {
+ auto topLevelDockWidget = floatingDockContainer->topLevelDockWidget();
+ if (topLevelDockWidget) {
+ topLevelDockWidget->emitTopLevelChanged(true);
+ }
+ }
+
+ return floatingWidget;
+ }
+
+ void DockAreaTitleBarPrivate::startFloating(const QPoint &offset)
+ {
+ m_floatingWidget = makeAreaFloating(offset, DraggingFloatingWidget);
+ }
+
+ TitleBarButton::TitleBarButton(bool visible, QWidget *parent)
+ : TitleBarButtonType(parent),
+ m_visible(visible),
+ m_hideWhenDisabled(DockAreaTitleBarPrivate::testConfigFlag(DockManager::DockAreaHideDisabledButtons))
+ {}
+
+ void TitleBarButton::setVisible(bool visible)
+ {
+ // 'visible' can stay 'true' if and only if this button is configured to generaly visible:
+ visible = visible && m_visible;
+
+ // 'visible' can stay 'true' unless: this button is configured to be invisible when it
+ // is disabled and it is currently disabled:
+ if (visible && m_hideWhenDisabled) {
+ visible = isEnabled();
+ }
+
+ Super::setVisible(visible);
+ }
+
+ bool TitleBarButton::event(QEvent *event)
+ {
+ if (QEvent::EnabledChange == event->type() && m_hideWhenDisabled) {
+ // force setVisible() call
+ // Calling setVisible() directly here doesn't work well when button is expected to be shown first time
+ QMetaObject::invokeMethod(this, "setVisible", Qt::QueuedConnection, Q_ARG(bool, isEnabled()));
+ }
+
+ return Super::event(event);
+ }
+
+ SpacerWidget::SpacerWidget(QWidget *parent)
+ : QWidget(parent)
+ {
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ setStyleSheet("border: none; background: none;");
+ }
+
+ DockAreaTitleBar::DockAreaTitleBar(DockAreaWidget *parent)
+ : QFrame(parent)
+ , d(new DockAreaTitleBarPrivate(this))
+ {
+ d->m_dockArea = parent;
+
+ setObjectName("dockAreaTitleBar");
+ d->m_layout = new QBoxLayout(QBoxLayout::LeftToRight);
+ d->m_layout->setContentsMargins(0, 0, 0, 0);
+ d->m_layout->setSpacing(0);
+ setLayout(d->m_layout);
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+
+ d->createTabBar();
+ d->m_layout->addWidget(new SpacerWidget(this));
+ d->createButtons();
+ }
+
+ DockAreaTitleBar::~DockAreaTitleBar() {
+ if (!d->m_closeButton.isNull())
+ delete d->m_closeButton;
+
+ if (!d->m_tabsMenuButton.isNull())
+ delete d->m_tabsMenuButton;
+
+ if (!d->m_undockButton.isNull())
+ delete d->m_undockButton;
+
+ delete d;
+ }
+
+ DockAreaTabBar *DockAreaTitleBar::tabBar() const { return d->m_tabBar; }
+
+ void DockAreaTitleBar::markTabsMenuOutdated() {
+ if (DockAreaTitleBarPrivate::testConfigFlag(DockManager::DockAreaDynamicTabsMenuButtonVisibility)) {
+ bool hasElidedTabTitle = false;
+ for (int i = 0; i < d->m_tabBar->count(); ++i) {
+ if (!d->m_tabBar->isTabOpen(i))
+ continue;
+
+ DockWidgetTab* tab = d->m_tabBar->tab(i);
+ if (tab->isTitleElided()) {
+ hasElidedTabTitle = true;
+ break;
+ }
+ }
+ bool visible = (hasElidedTabTitle && (d->m_tabBar->count() > 1));
+ QMetaObject::invokeMethod(d->m_tabsMenuButton, "setVisible", Qt::QueuedConnection, Q_ARG(bool, visible));
+ }
+ d->m_menuOutdated = true;
+ }
+
+ void DockAreaTitleBar::onTabsMenuAboutToShow()
+ {
+ if (!d->m_menuOutdated) {
+ return;
+ }
+
+ QMenu *menu = d->m_tabsMenuButton->menu();
+ menu->clear();
+ for (int i = 0; i < d->m_tabBar->count(); ++i) {
+ if (!d->m_tabBar->isTabOpen(i))
+ continue;
+
+ auto tab = d->m_tabBar->tab(i);
+ QAction *action = menu->addAction(tab->icon(), tab->text());
+ internal::setToolTip(action, tab->toolTip());
+ action->setData(i);
+ }
+
+ d->m_menuOutdated = false;
+ }
+
+ void DockAreaTitleBar::onCloseButtonClicked()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ if (d->testConfigFlag(DockManager::DockAreaCloseButtonClosesTab)) {
+ d->m_tabBar->closeTab(d->m_tabBar->currentIndex());
+ } else {
+ d->m_dockArea->closeArea();
+ }
+ }
+
+ void DockAreaTitleBar::onUndockButtonClicked()
+ {
+ if (d->m_dockArea->features().testFlag(DockWidget::DockWidgetFloatable)) {
+ d->makeAreaFloating(mapFromGlobal(QCursor::pos()), DraggingInactive);
+ }
+ }
+
+ void DockAreaTitleBar::onTabsMenuActionTriggered(QAction *action)
+ {
+ int index = action->data().toInt();
+ d->m_tabBar->setCurrentIndex(index);
+ emit tabBarClicked(index);
+ }
+
+ void DockAreaTitleBar::updateDockWidgetActionsButtons()
+ {
+ DockWidget* dockWidget = d->m_tabBar->currentTab()->dockWidget();
+ if (!d->m_dockWidgetActionsButtons.isEmpty()) {
+ for (auto button : d->m_dockWidgetActionsButtons) {
+ d->m_layout->removeWidget(button);
+ delete button;
+ }
+ d->m_dockWidgetActionsButtons.clear();
+ }
+
+ auto actions = dockWidget->titleBarActions();
+ if (actions.isEmpty())
+ return;
+
+ int insertIndex = indexOf(d->m_tabsMenuButton);
+ for (auto action : actions) {
+ auto button = new TitleBarButton(true, this);
+ button->setDefaultAction(action);
+ button->setAutoRaise(true);
+ button->setPopupMode(QToolButton::InstantPopup);
+ button->setObjectName(action->objectName());
+ d->m_layout->insertWidget(insertIndex++, button, 0);
+ d->m_dockWidgetActionsButtons.append(button);
+ }
+ }
+
+ void DockAreaTitleBar::onCurrentTabChanged(int index)
+ {
+ if (index < 0)
+ return;
+
+ if (d->testConfigFlag(DockManager::DockAreaCloseButtonClosesTab)) {
+ DockWidget *dockWidget = d->m_tabBar->tab(index)->dockWidget();
+ d->m_closeButton->setEnabled(
+ dockWidget->features().testFlag(DockWidget::DockWidgetClosable));
+ }
+
+ updateDockWidgetActionsButtons();
+ }
+
+ QAbstractButton *DockAreaTitleBar::button(eTitleBarButton which) const
+ {
+ switch (which) {
+ case TitleBarButtonTabsMenu:
+ return d->m_tabsMenuButton;
+ case TitleBarButtonUndock:
+ return d->m_undockButton;
+ case TitleBarButtonClose:
+ return d->m_closeButton;
+ }
+ return nullptr;
+ }
+
+ void DockAreaTitleBar::setVisible(bool visible)
+ {
+ Super::setVisible(visible);
+ markTabsMenuOutdated();
+ }
+
+
+ void DockAreaTitleBar::mousePressEvent(QMouseEvent *event)
+ {
+ if (event->button() == Qt::LeftButton) {
+ event->accept();
+ d->m_dragStartMousePos = event->pos();
+ d->m_dragState = DraggingMousePressed;
+ return;
+ }
+ Super::mousePressEvent(event);
+ }
+
+ void DockAreaTitleBar::mouseReleaseEvent(QMouseEvent *event)
+ {
+ if (event->button() == Qt::LeftButton) {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ event->accept();
+ auto CurrentDragState = d->m_dragState;
+ d->m_dragStartMousePos = QPoint();
+ d->m_dragState = DraggingInactive;
+ if (DraggingFloatingWidget == CurrentDragState)
+ d->m_floatingWidget->finishDragging();
+
+ return;
+ }
+ Super::mouseReleaseEvent(event);
+ }
+
+ void DockAreaTitleBar::mouseMoveEvent(QMouseEvent *event)
+ {
+ Super::mouseMoveEvent(event);
+ if (!(event->buttons() & Qt::LeftButton) || d->isDraggingState(DraggingInactive)) {
+ d->m_dragState = DraggingInactive;
+ return;
+ }
+
+ // move floating window
+ if (d->isDraggingState(DraggingFloatingWidget)) {
+ d->m_floatingWidget->moveFloating();
+ return;
+ }
+
+ // If this is the last dock area in a dock container it does not make
+ // sense to move it to a new floating widget and leave this one empty
+ if (d->m_dockArea->dockContainer()->isFloating()
+ && d->m_dockArea->dockContainer()->visibleDockAreaCount() == 1) {
+ return;
+ }
+
+ // If one single dock widget in this area is not floatable then the whole
+ // area is not floatable
+ // If we do non opaque undocking, then we can create the floating drag
+ // preview if the dock widget is movable
+ auto features = d->m_dockArea->features();
+ if (!features.testFlag(DockWidget::DockWidgetFloatable)
+ && !(features.testFlag(DockWidget::DockWidgetMovable)
+ && !DockManager::testConfigFlag(DockManager::OpaqueUndocking))) {
+ return;
+ }
+
+ int dragDistance = (d->m_dragStartMousePos - event->pos()).manhattanLength();
+ if (dragDistance >= DockManager::startDragDistance()) {
+ qCInfo(adsLog) << "TabsScrollArea::startFloating";
+ d->startFloating(d->m_dragStartMousePos);
+ auto overlay = d->m_dockArea->dockManager()->containerOverlay();
+ overlay->setAllowedAreas(OuterDockAreas);
+ }
+
+ return;
+ }
+
+ void DockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
+ {
+ // If this is the last dock area in a dock container it does not make
+ // sense to move it to a new floating widget and leave this one empty
+ if (d->m_dockArea->dockContainer()->isFloating()
+ && d->m_dockArea->dockContainer()->dockAreaCount() == 1)
+ return;
+
+ if (!d->m_dockArea->features().testFlag(DockWidget::DockWidgetFloatable))
+ return;
+
+ d->makeAreaFloating(event->pos(), DraggingInactive);
+ }
+
+ void DockAreaTitleBar::contextMenuEvent(QContextMenuEvent *event)
+ {
+ event->accept();
+ if (d->isDraggingState(DraggingFloatingWidget))
+ return;
+
+ QMenu menu(this);
+ auto action = menu.addAction(tr("Detach Area"),
+ this,
+ &DockAreaTitleBar::onUndockButtonClicked);
+ action->setEnabled(d->m_dockArea->features().testFlag(DockWidget::DockWidgetFloatable));
+ menu.addSeparator();
+ action = menu.addAction(tr("Close Area"), this, &DockAreaTitleBar::onCloseButtonClicked);
+ action->setEnabled(d->m_dockArea->features().testFlag(DockWidget::DockWidgetClosable));
+ menu.addAction(tr("Close Other Areas"), d->m_dockArea, &DockAreaWidget::closeOtherAreas);
+ menu.exec(event->globalPos());
+ }
+
+ void DockAreaTitleBar::insertWidget(int index, QWidget *widget)
+ {
+ d->m_layout->insertWidget(index, widget);
+ }
+
+ int DockAreaTitleBar::indexOf(QWidget *widget) const
+ {
+ return d->m_layout->indexOf(widget);
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockareatitlebar.h b/src/libs/advanceddockingsystem/dockareatitlebar.h
new file mode 100644
index 00000000000..482816a34ee
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockareatitlebar.h
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QFrame>
+#include <QToolButton>
+
+QT_BEGIN_NAMESPACE
+class QAbstractButton;
+QT_END_NAMESPACE
+
+namespace ADS {
+
+class DockAreaTabBar;
+class DockAreaWidget;
+struct DockAreaTitleBarPrivate;
+
+using TitleBarButtonType = QToolButton;
+
+/**
+ * Title bar button of a dock area that customizes TitleBarButtonType appearance/behavior
+ * according to various config flags such as:
+ * DockManager::DockAreaHas_xxx_Button - if set to 'false' keeps the button always invisible
+ * DockManager::DockAreaHideDisabledButtons - if set to 'true' hides button when it is disabled
+ */
+class TitleBarButton : public TitleBarButtonType
+{
+ Q_OBJECT
+ bool m_visible = true;
+ bool m_hideWhenDisabled = false;
+public:
+ using Super = TitleBarButtonType;
+ TitleBarButton(bool visible = true, QWidget *parent = nullptr);
+
+ /**
+ * Adjust this visibility change request with our internal settings:
+ */
+ virtual void setVisible(bool visible) override;
+
+protected:
+ /**
+ * Handle EnabledChanged signal to set button invisible if the configured
+ */
+ bool event(QEvent *event) override;
+};
+
+/**
+ * This spacer widget is here because of the following problem.
+ * The dock area title bar handles mouse dragging and moving the floating widget.
+ * The problem is, that if the title bar becomes invisible, i.e. if the dock
+ * area contains only one single dock widget and the dock area is moved
+ * into a floating widget, then mouse events are not handled anymore and dragging
+ * of the floating widget stops.
+ */
+class SpacerWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ SpacerWidget(QWidget *parent = nullptr);
+ virtual QSize sizeHint() const override {return QSize(0, 0);}
+ virtual QSize minimumSizeHint() const override {return QSize(0, 0);}
+};
+
+/**
+ * Title bar of a dock area.
+ * The title bar contains a tabbar with all tabs for a dock widget group and
+ * with a tabs menu button, a undock button and a close button.
+ */
+class ADS_EXPORT DockAreaTitleBar : public QFrame
+{
+ Q_OBJECT
+private:
+ DockAreaTitleBarPrivate *d; ///< private data (pimpl)
+ friend struct DockAreaTitleBarPrivate;
+
+ void onTabsMenuAboutToShow();
+ void onCloseButtonClicked();
+ void onUndockButtonClicked();
+ void onTabsMenuActionTriggered(QAction *action);
+ void onCurrentTabChanged(int index);
+
+protected:
+ /**
+ * Stores mouse position to detect dragging
+ */
+ virtual void mousePressEvent(QMouseEvent *event) override;
+
+ /**
+ * Stores mouse position to detect dragging
+ */
+ virtual void mouseReleaseEvent(QMouseEvent *event) override;
+
+ /**
+ * Starts floating the complete docking area including all dock widgets,
+ * if it is not the last dock area in a floating widget
+ */
+ virtual void mouseMoveEvent(QMouseEvent *event) override;
+
+ /**
+ * Double clicking the title bar also starts floating of the complete area
+ */
+ virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
+
+ /**
+ * Show context menu
+ */
+ virtual void contextMenuEvent(QContextMenuEvent *event) override;
+
+public:
+ /**
+ * Call this slot to tell the title bar that it should update the tabs menu
+ * the next time it is shown.
+ */
+ void markTabsMenuOutdated();
+
+ using Super = QFrame;
+ /**
+ * Default Constructor
+ */
+ DockAreaTitleBar(DockAreaWidget *parent);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~DockAreaTitleBar() override;
+
+ /**
+ * Returns the pointer to the tabBar()
+ */
+ DockAreaTabBar *tabBar() const;
+
+ /**
+ * Returns the button corresponding to the given title bar button identifier
+ */
+ QAbstractButton *button(eTitleBarButton which) const;
+
+ /**
+ * Updates the visibility of the dock widget actions in the title bar
+ */
+ void updateDockWidgetActionsButtons();
+
+ /**
+ * Marks the tabs menu outdated before it calls its base class
+ * implementation
+ */
+ virtual void setVisible(bool visible) override;
+
+ /**
+ * Inserts a custom widget at position index into this title bar.
+ * If index is negative, the widget is added at the end.
+ * You can use this function to insert custom widgets into the title bar.
+ */
+ void insertWidget(int index, QWidget *widget);
+
+ /**
+ * Searches for widget widget in this title bar.
+ * You can use this function, to get the position of the default
+ * widget in the tile bar.
+ * \code
+ * int tabBarIndex = TitleBar->indexOf(TitleBar->tabBar());
+ * int closeButtonIndex = TitleBar->indexOf(TitleBar->button(TitleBarButtonClose));
+ * \endcode
+ */
+ int indexOf(QWidget *widget) const;
+
+signals:
+ /**
+ * This signal is emitted if a tab in the tab bar is clicked by the user
+ * or if the user clicks on a tab item in the title bar tab menu.
+ */
+ void tabBarClicked(int index);
+}; // class DockAreaTitleBar
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockareawidget.cpp b/src/libs/advanceddockingsystem/dockareawidget.cpp
new file mode 100644
index 00000000000..16bd88f5716
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockareawidget.cpp
@@ -0,0 +1,686 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockareawidget.h"
+
+#include "dockareatabbar.h"
+#include "dockareatitlebar.h"
+#include "dockcomponentsfactory.h"
+#include "dockcontainerwidget.h"
+#include "dockmanager.h"
+#include "dockoverlay.h"
+#include "docksplitter.h"
+#include "dockwidget.h"
+#include "dockwidgettab.h"
+#include "floatingdockcontainer.h"
+
+#include <QList>
+#include <QLoggingCategory>
+#include <QMenu>
+#include <QPushButton>
+#include <QScrollArea>
+#include <QScrollBar>
+#include <QSplitter>
+#include <QStackedLayout>
+#include <QStyle>
+#include <QVector>
+#include <QWheelEvent>
+#include <QXmlStreamWriter>
+
+#include <iostream>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ static const char *const INDEX_PROPERTY = "index";
+ static const char *const ACTION_PROPERTY = "action";
+
+ /**
+ * Internal dock area layout mimics stack layout but only inserts the current
+ * widget into the internal QLayout object.
+ * \warning Only the current widget has a parent. All other widgets
+ * do not have a parent. That means, a widget that is in this layout may
+ * return nullptr for its parent() function if it is not the current widget.
+ */
+ class DockAreaLayout
+ {
+ private:
+ QBoxLayout *m_parentLayout;
+ QList<QWidget *> m_widgets;
+ int m_currentIndex = -1;
+ QWidget *m_currentWidget = nullptr;
+
+ public:
+ /**
+ * Creates an instance with the given parent layout
+ */
+ DockAreaLayout(QBoxLayout *parentLayout)
+ : m_parentLayout(parentLayout)
+ {}
+
+ /**
+ * Returns the number of widgets in this layout
+ */
+ int count() const { return m_widgets.count(); }
+
+ /**
+ * Inserts the widget at the given index position into the internal widget
+ * list
+ */
+ void insertWidget(int index, QWidget *widget)
+ {
+ widget->setParent(nullptr);
+ if (index < 0) {
+ index = m_widgets.count();
+ }
+ m_widgets.insert(index, widget);
+ if (m_currentIndex < 0) {
+ setCurrentIndex(index);
+ } else {
+ if (index <= m_currentIndex) {
+ ++m_currentIndex;
+ }
+ }
+ }
+
+ /**
+ * Removes the given widget from the layout
+ */
+ void removeWidget(QWidget *widget)
+ {
+ if (currentWidget() == widget) {
+ auto layoutItem = m_parentLayout->takeAt(1);
+ if (layoutItem) {
+ layoutItem->widget()->setParent(nullptr);
+ }
+ m_currentWidget = nullptr;
+ m_currentIndex = -1;
+ }
+ m_widgets.removeOne(widget);
+ }
+
+ /**
+ * Returns the current selected widget
+ */
+ QWidget *currentWidget() const { return m_currentWidget; }
+
+ /**
+ * Activates the widget with the give index.
+ */
+ void setCurrentIndex(int index)
+ {
+ QWidget *prev = currentWidget();
+ QWidget *next = widget(index);
+ if (!next || (next == prev && !m_currentWidget)) {
+ return;
+ }
+
+ bool reenableUpdates = false;
+ QWidget *parent = m_parentLayout->parentWidget();
+
+ if (parent && parent->updatesEnabled()) {
+ reenableUpdates = true;
+ parent->setUpdatesEnabled(false);
+ }
+
+ // TODO
+ auto layoutItem = m_parentLayout->takeAt(1);
+ if (layoutItem) {
+ layoutItem->widget()->setParent(nullptr);
+ }
+
+ m_parentLayout->addWidget(next);
+ if (prev) {
+ prev->hide();
+ }
+ m_currentIndex = index;
+ m_currentWidget = next;
+
+ if (reenableUpdates) {
+ parent->setUpdatesEnabled(true);
+ }
+ }
+
+ /**
+ * Returns the index of the current active widget
+ */
+ int currentIndex() const { return m_currentIndex; }
+
+ /**
+ * Returns true if there are no widgets in the layout
+ */
+ bool isEmpty() const { return m_widgets.empty(); }
+
+ /**
+ * Returns the index of the given widget
+ */
+ int indexOf(QWidget *widget) const { return m_widgets.indexOf(widget); }
+
+ /**
+ * Returns the widget for the given index
+ */
+ QWidget *widget(int index) const
+ {
+ return (index < m_widgets.size()) ? m_widgets.at(index) : nullptr;
+ }
+
+ /**
+ * Returns the geometry of the current active widget
+ */
+ QRect geometry() const { return m_widgets.empty() ? QRect() : currentWidget()->geometry(); }
+ };
+
+ /**
+ * Private data class of DockAreaWidget class (pimpl)
+ */
+ struct DockAreaWidgetPrivate
+ {
+ DockAreaWidget *q = nullptr;
+ QBoxLayout *m_layout = nullptr;
+ DockAreaLayout *m_contentsLayout = nullptr;
+ DockAreaTitleBar *m_titleBar = nullptr;
+ DockManager *m_dockManager = nullptr;
+ bool m_updateTitleBarButtons = false;
+ DockWidgetAreas m_allowedAreas = AllDockAreas;
+
+ /**
+ * Private data constructor
+ */
+ DockAreaWidgetPrivate(DockAreaWidget *parent);
+
+ /**
+ * Creates the layout for top area with tabs and close button
+ */
+ void createTitleBar();
+
+ /**
+ * Returns the dock widget with the given index
+ */
+ DockWidget *dockWidgetAt(int index)
+ {
+ return qobject_cast<DockWidget *>(m_contentsLayout->widget(index));
+ }
+
+ /**
+ * Convenience function to ease title widget access by index
+ */
+ DockWidgetTab *tabWidgetAt(int index) { return dockWidgetAt(index)->tabWidget(); }
+
+ /**
+ * Returns the tab action of the given dock widget
+ */
+ QAction *dockWidgetTabAction(DockWidget *dockWidget) const
+ {
+ return qvariant_cast<QAction *>(dockWidget->property(ACTION_PROPERTY));
+ }
+
+ /**
+ * Returns the index of the given dock widget
+ */
+ int dockWidgetIndex(DockWidget *dockWidget) const
+ {
+ return dockWidget->property(INDEX_PROPERTY).toInt();
+ }
+
+ /**
+ * Convenience function for tabbar access
+ */
+ DockAreaTabBar *tabBar() const { return m_titleBar->tabBar(); }
+
+ /**
+ * Udpates the enable state of the close and detach button
+ */
+ void updateTitleBarButtonStates();
+ };
+ // struct DockAreaWidgetPrivate
+
+ DockAreaWidgetPrivate::DockAreaWidgetPrivate(DockAreaWidget *parent)
+ : q(parent)
+ {}
+
+ void DockAreaWidgetPrivate::createTitleBar()
+ {
+ m_titleBar = componentsFactory()->createDockAreaTitleBar(q);
+ m_layout->addWidget(m_titleBar);
+ QObject::connect(tabBar(),
+ &DockAreaTabBar::tabCloseRequested,
+ q,
+ &DockAreaWidget::onTabCloseRequested);
+ QObject::connect(m_titleBar,
+ &DockAreaTitleBar::tabBarClicked,
+ q,
+ &DockAreaWidget::setCurrentIndex);
+ QObject::connect(tabBar(), &DockAreaTabBar::tabMoved, q, &DockAreaWidget::reorderDockWidget);
+ }
+
+ void DockAreaWidgetPrivate::updateTitleBarButtonStates()
+ {
+ if (q->isHidden()) {
+ m_updateTitleBarButtons = true;
+ return;
+ }
+
+ m_titleBar->button(TitleBarButtonClose)
+ ->setEnabled(q->features().testFlag(DockWidget::DockWidgetClosable));
+ m_titleBar->button(TitleBarButtonUndock)
+ ->setEnabled(q->features().testFlag(DockWidget::DockWidgetFloatable));
+ m_titleBar->updateDockWidgetActionsButtons();
+ m_updateTitleBarButtons = false;
+ }
+
+ DockAreaWidget::DockAreaWidget(DockManager *dockManager, DockContainerWidget *parent)
+ : QFrame(parent)
+ , d(new DockAreaWidgetPrivate(this))
+ {
+ d->m_dockManager = dockManager;
+ d->m_layout = new QBoxLayout(QBoxLayout::TopToBottom);
+ d->m_layout->setContentsMargins(0, 0, 0, 0);
+ d->m_layout->setSpacing(0);
+ setLayout(d->m_layout);
+
+ d->createTitleBar();
+ d->m_contentsLayout = new DockAreaLayout(d->m_layout);
+ if (d->m_dockManager) {
+ emit d->m_dockManager->dockAreaCreated(this);
+ }
+ }
+
+ DockAreaWidget::~DockAreaWidget()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ delete d->m_contentsLayout;
+ delete d;
+ }
+
+ DockManager *DockAreaWidget::dockManager() const { return d->m_dockManager; }
+
+ DockContainerWidget *DockAreaWidget::dockContainer() const
+ {
+ return internal::findParent<DockContainerWidget *>(this);
+ }
+
+ void DockAreaWidget::addDockWidget(DockWidget *dockWidget)
+ {
+ insertDockWidget(d->m_contentsLayout->count(), dockWidget);
+ }
+
+ void DockAreaWidget::insertDockWidget(int index, DockWidget *dockWidget, bool activate)
+ {
+ d->m_contentsLayout->insertWidget(index, dockWidget);
+ dockWidget->tabWidget()->setDockAreaWidget(this);
+ auto tabWidget = dockWidget->tabWidget();
+ // Inserting the tab will change the current index which in turn will
+ // make the tab widget visible in the slot
+ d->tabBar()->blockSignals(true);
+ d->tabBar()->insertTab(index, tabWidget);
+ d->tabBar()->blockSignals(false);
+ tabWidget->setVisible(!dockWidget->isClosed());
+ dockWidget->setProperty(INDEX_PROPERTY, index);
+ if (activate) {
+ setCurrentIndex(index);
+ }
+ dockWidget->setDockArea(this);
+ d->updateTitleBarButtonStates();
+ }
+
+ void DockAreaWidget::removeDockWidget(DockWidget *dockWidget)
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ auto nextOpen = nextOpenDockWidget(dockWidget);
+
+ d->m_contentsLayout->removeWidget(dockWidget);
+ auto tabWidget = dockWidget->tabWidget();
+ tabWidget->hide();
+ d->tabBar()->removeTab(tabWidget);
+ DockContainerWidget *dockContainerWidget = dockContainer();
+ if (nextOpen) {
+ setCurrentDockWidget(nextOpen);
+ } else if (d->m_contentsLayout->isEmpty() && dockContainerWidget->dockAreaCount() > 1) {
+ qCInfo(adsLog) << "Dock Area empty";
+ dockContainerWidget->removeDockArea(this);
+ this->deleteLater();
+ } else {
+ // if contents layout is not empty but there are no more open dock
+ // widgets, then we need to hide the dock area because it does not
+ // contain any visible content
+ hideAreaWithNoVisibleContent();
+ }
+
+ d->updateTitleBarButtonStates();
+ updateTitleBarVisibility();
+ auto topLevelDockWidget = dockContainerWidget->topLevelDockWidget();
+ if (topLevelDockWidget) {
+ topLevelDockWidget->emitTopLevelChanged(true);
+ }
+
+#if (ADS_DEBUG_LEVEL > 0)
+ dockContainerWidget->dumpLayout();
+#endif
+ }
+
+ void DockAreaWidget::hideAreaWithNoVisibleContent()
+ {
+ this->toggleView(false);
+
+ // Hide empty parent splitters
+ auto splitter = internal::findParent<DockSplitter *>(this);
+ internal::hideEmptyParentSplitters(splitter);
+
+ //Hide empty floating widget
+ DockContainerWidget *container = this->dockContainer();
+ if (!container->isFloating()) {
+ return;
+ }
+
+ updateTitleBarVisibility();
+ auto topLevelWidget = container->topLevelDockWidget();
+ auto floatingWidget = container->floatingWidget();
+ if (topLevelWidget) {
+ floatingWidget->updateWindowTitle();
+ DockWidget::emitTopLevelEventForWidget(topLevelWidget, true);
+ } else if (container->openedDockAreas().isEmpty()) {
+ floatingWidget->hide();
+ }
+ }
+
+ void DockAreaWidget::onTabCloseRequested(int index)
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO << "index" << index;
+ auto *currentDockWidget = dockWidget(index);
+ if (currentDockWidget->features().testFlag(DockWidget::DockWidgetDeleteOnClose)) {
+ currentDockWidget->closeDockWidgetInternal();
+ } else {
+ currentDockWidget->toggleView(false);
+ }
+ }
+
+ DockWidget *DockAreaWidget::currentDockWidget() const
+ {
+ int currentIdx = currentIndex();
+ if (currentIdx < 0) {
+ return nullptr;
+ }
+
+ return dockWidget(currentIdx);
+ }
+
+ void DockAreaWidget::setCurrentDockWidget(DockWidget *dockWidget)
+ {
+ if (dockManager()->isRestoringState()) {
+ return;
+ }
+
+ internalSetCurrentDockWidget(dockWidget);
+ }
+
+ void DockAreaWidget::internalSetCurrentDockWidget(DockWidget *dockWidget)
+ {
+ int index = indexOf(dockWidget);
+ if (index < 0) {
+ return;
+ }
+
+ setCurrentIndex(index);
+ }
+
+ void DockAreaWidget::setCurrentIndex(int index)
+ {
+ auto currentTabBar = d->tabBar();
+ if (index < 0 || index > (currentTabBar->count() - 1)) {
+ qWarning() << Q_FUNC_INFO << "Invalid index" << index;
+ return;
+ }
+
+ auto cw = d->m_contentsLayout->currentWidget();
+ auto nw = d->m_contentsLayout->widget(index);
+ if (cw == nw && !nw->isHidden()) {
+ return;
+ }
+
+ emit currentChanging(index);
+ currentTabBar->setCurrentIndex(index);
+ d->m_contentsLayout->setCurrentIndex(index);
+ d->m_contentsLayout->currentWidget()->show();
+ emit currentChanged(index);
+ }
+
+ int DockAreaWidget::currentIndex() const { return d->m_contentsLayout->currentIndex(); }
+
+ QRect DockAreaWidget::titleBarGeometry() const { return d->m_titleBar->geometry(); }
+
+ QRect DockAreaWidget::contentAreaGeometry() const { return d->m_contentsLayout->geometry(); }
+
+ int DockAreaWidget::indexOf(DockWidget *dockWidget)
+ {
+ return d->m_contentsLayout->indexOf(dockWidget);
+ }
+
+ QList<DockWidget *> DockAreaWidget::dockWidgets() const
+ {
+ QList<DockWidget *> dockWidgetList;
+ for (int i = 0; i < d->m_contentsLayout->count(); ++i) {
+ dockWidgetList.append(dockWidget(i));
+ }
+ return dockWidgetList;
+ }
+
+ int DockAreaWidget::openDockWidgetsCount() const
+ {
+ int count = 0;
+ for (int i = 0; i < d->m_contentsLayout->count(); ++i) {
+ if (!dockWidget(i)->isClosed()) {
+ ++count;
+ }
+ }
+ return count;
+ }
+
+ QList<DockWidget *> DockAreaWidget::openedDockWidgets() const
+ {
+ QList<DockWidget *> dockWidgetList;
+ for (int i = 0; i < d->m_contentsLayout->count(); ++i) {
+ DockWidget *currentDockWidget = dockWidget(i);
+ if (!currentDockWidget->isClosed()) {
+ dockWidgetList.append(dockWidget(i));
+ }
+ }
+ return dockWidgetList;
+ }
+
+ int DockAreaWidget::indexOfFirstOpenDockWidget() const
+ {
+ for (int i = 0; i < d->m_contentsLayout->count(); ++i) {
+ if (!dockWidget(i)->isClosed()) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ int DockAreaWidget::dockWidgetsCount() const { return d->m_contentsLayout->count(); }
+
+ DockWidget *DockAreaWidget::dockWidget(int index) const
+ {
+ return qobject_cast<DockWidget *>(d->m_contentsLayout->widget(index));
+ }
+
+ void DockAreaWidget::reorderDockWidget(int fromIndex, int toIndex)
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ if (fromIndex >= d->m_contentsLayout->count() || fromIndex < 0
+ || toIndex >= d->m_contentsLayout->count() || toIndex < 0 || fromIndex == toIndex) {
+ qCInfo(adsLog) << "Invalid index for tab movement" << fromIndex << toIndex;
+ return;
+ }
+
+ auto widget = d->m_contentsLayout->widget(fromIndex);
+ d->m_contentsLayout->removeWidget(widget);
+ d->m_contentsLayout->insertWidget(toIndex, widget);
+ setCurrentIndex(toIndex);
+ }
+
+ void DockAreaWidget::toggleDockWidgetView(DockWidget *dockWidget, bool open)
+ {
+ Q_UNUSED(dockWidget)
+ Q_UNUSED(open)
+ updateTitleBarVisibility();
+ }
+
+ void DockAreaWidget::updateTitleBarVisibility()
+ {
+ DockContainerWidget *container = dockContainer();
+ if (!container) {
+ return;
+ }
+
+ if (DockManager::configFlags().testFlag(DockManager::AlwaysShowTabs)) {
+ return;
+ }
+
+ if (d->m_titleBar) {
+ d->m_titleBar->setVisible(!container->isFloating() || !container->hasTopLevelDockWidget());
+ }
+ }
+
+ void DockAreaWidget::markTitleBarMenuOutdated()
+ {
+ if (d->m_titleBar) {
+ d->m_titleBar->markTabsMenuOutdated();
+ }
+ }
+
+ void DockAreaWidget::saveState(QXmlStreamWriter &stream) const
+ {
+ stream.writeStartElement("area");
+ stream.writeAttribute("tabs", QString::number(d->m_contentsLayout->count()));
+ auto localDockWidget = currentDockWidget();
+ QString name = localDockWidget ? localDockWidget->objectName() : "";
+ stream.writeAttribute("current", name);
+ qCInfo(adsLog) << Q_FUNC_INFO << "TabCount: " << d->m_contentsLayout->count()
+ << " Current: " << name;
+ for (int i = 0; i < d->m_contentsLayout->count(); ++i) {
+ dockWidget(i)->saveState(stream);
+ }
+ stream.writeEndElement();
+ }
+
+ DockWidget *DockAreaWidget::nextOpenDockWidget(DockWidget *dockWidget) const
+ {
+ auto openDockWidgets = openedDockWidgets();
+ if (openDockWidgets.count() > 1
+ || (openDockWidgets.count() == 1 && openDockWidgets[0] != dockWidget)) {
+ DockWidget *nextDockWidget;
+ if (openDockWidgets.last() == dockWidget) {
+ nextDockWidget = openDockWidgets[openDockWidgets.count() - 2];
+ } else {
+ int nextIndex = openDockWidgets.indexOf(dockWidget) + 1;
+ nextDockWidget = openDockWidgets[nextIndex];
+ }
+
+ return nextDockWidget;
+ } else {
+ return nullptr;
+ }
+ }
+
+ DockWidget::DockWidgetFeatures DockAreaWidget::features(eBitwiseOperator mode) const
+ {
+ if (BitwiseAnd == mode) {
+ DockWidget::DockWidgetFeatures features(DockWidget::AllDockWidgetFeatures);
+ for (const auto dockWidget : dockWidgets()) {
+ features &= dockWidget->features();
+ }
+ return features;
+ } else {
+ DockWidget::DockWidgetFeatures features(DockWidget::NoDockWidgetFeatures);
+ for (const auto dockWidget : dockWidgets()) {
+ features |= dockWidget->features();
+ }
+ return features;
+ }
+ }
+
+ void DockAreaWidget::toggleView(bool open)
+ {
+ setVisible(open);
+
+ emit viewToggled(open);
+ }
+
+ void DockAreaWidget::setVisible(bool visible)
+ {
+ Super::setVisible(visible);
+ if (d->m_updateTitleBarButtons) {
+ d->updateTitleBarButtonStates();
+ }
+ }
+
+ void DockAreaWidget::setAllowedAreas(DockWidgetAreas areas)
+ {
+ d->m_allowedAreas = areas;
+ }
+
+ DockWidgetAreas DockAreaWidget::allowedAreas() const
+ {
+ return d->m_allowedAreas;
+ }
+
+ QAbstractButton *DockAreaWidget::titleBarButton(eTitleBarButton which) const
+ {
+ return d->m_titleBar->button(which);
+ }
+
+ void DockAreaWidget::closeArea()
+ {
+ // If there is only one single dock widget and this widget has the
+ // DeleteOnClose feature, then we delete the dock widget now
+ auto openDockWidgets = openedDockWidgets();
+ if (openDockWidgets.count() == 1
+ && openDockWidgets[0]->features().testFlag(DockWidget::DockWidgetDeleteOnClose)) {
+ openDockWidgets[0]->closeDockWidgetInternal();
+ } else {
+ for (auto dockWidget : openedDockWidgets()) {
+ dockWidget->toggleView(false);
+ }
+ }
+ }
+
+ void DockAreaWidget::closeOtherAreas() { dockContainer()->closeOtherAreas(this); }
+
+ DockAreaTitleBar *DockAreaWidget::titleBar() const { return d->m_titleBar; }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockareawidget.h b/src/libs/advanceddockingsystem/dockareawidget.h
new file mode 100644
index 00000000000..fab47e94769
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockareawidget.h
@@ -0,0 +1,321 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+#include "dockwidget.h"
+
+#include <QFrame>
+
+QT_BEGIN_NAMESPACE
+class QAbstractButton;
+class QXmlStreamWriter;
+QT_END_NAMESPACE
+
+namespace ADS {
+
+struct DockAreaWidgetPrivate;
+class DockManager;
+class DockContainerWidget;
+class DockContainerWidgetPrivate;
+class DockAreaTitleBar;
+
+/**
+ * DockAreaWidget manages multiple instances of DockWidgets.
+ * It displays a title tab, which is clickable and will switch to
+ * the contents associated to the title when clicked.
+ */
+class ADS_EXPORT DockAreaWidget : public QFrame
+{
+ Q_OBJECT
+private:
+ DockAreaWidgetPrivate *d; ///< private data (pimpl)
+ friend struct DockAreaWidgetPrivate;
+ friend class DockContainerWidget;
+ friend class DockContainerWidgetPrivate;
+ friend class DockWidgetTab;
+ friend struct DockWidgetPrivate;
+ friend class DockWidget;
+ friend struct DockManagerPrivate;
+ friend class DockManager;
+
+ void onTabCloseRequested(int index);
+
+ /**
+ * Reorder the index position of DockWidget at fromIndx to toIndex
+ * if a tab in the tabbar is dragged from one index to another one
+ */
+ void reorderDockWidget(int fromIndex, int toIndex);
+
+protected:
+ /**
+ * Inserts a dock widget into dock area.
+ * All dockwidgets in the dock area tabified in a stacked layout with tabs.
+ * The index indicates the index of the new dockwidget in the tabbar and
+ * in the stacked layout. If the Activate parameter is true, the new
+ * DockWidget will be the active one in the stacked layout
+ */
+ void insertDockWidget(int index, DockWidget *dockWidget, bool activate = true);
+
+ /**
+ * Add a new dock widget to dock area.
+ * All dockwidgets in the dock area tabified in a stacked layout with tabs
+ */
+ void addDockWidget(DockWidget *dockWidget);
+
+ /**
+ * Removes the given dock widget from the dock area
+ */
+ void removeDockWidget(DockWidget *dockWidget);
+
+ /**
+ * Called from dock widget if it is opened or closed
+ */
+ void toggleDockWidgetView(DockWidget *dockWidget, bool open);
+
+ /**
+ * This is a helper function to get the next open dock widget to activate
+ * if the given DockWidget will be closed or removed.
+ * The function returns the next widget that should be activated or
+ * nullptr in case there are no more open widgets in this area.
+ */
+ DockWidget *nextOpenDockWidget(DockWidget *dockWidget) const;
+
+ /**
+ * Returns the index of the given DockWidget in the internal layout
+ */
+ int indexOf(DockWidget *dockWidget);
+
+ /**
+ * Call this function, if you already know, that the dock does not
+ * contain any visible content (any open dock widgets).
+ */
+ void hideAreaWithNoVisibleContent();
+
+ /**
+ * Updates the dock area layout and components visibility
+ */
+ void updateTitleBarVisibility();
+
+ /**
+ * This is the internal private function for setting the current widget.
+ * This function is called by the public setCurrentDockWidget() function
+ * and by the dock manager when restoring the state
+ */
+ void internalSetCurrentDockWidget(DockWidget *dockWidget);
+
+ /**
+ * Marks tabs menu to update
+ */
+ void markTitleBarMenuOutdated();
+
+ void toggleView(bool open);
+
+public:
+ using Super = QFrame;
+
+ /**
+ * Default Constructor
+ */
+ DockAreaWidget(DockManager *dockManager, DockContainerWidget *parent);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~DockAreaWidget() override;
+
+ /**
+ * Returns the dock manager object this dock area belongs to
+ */
+ DockManager *dockManager() const;
+
+ /**
+ * Returns the dock container widget this dock area widget belongs to or 0
+ * if there is no
+ */
+ DockContainerWidget *dockContainer() const;
+
+ /**
+ * Returns the rectangle of the title area
+ */
+ QRect titleBarGeometry() const;
+
+ /**
+ * Returns the rectangle of the content
+ */
+ QRect contentAreaGeometry() const;
+
+ /**
+ * Returns the number of dock widgets in this area
+ */
+ int dockWidgetsCount() const;
+
+ /**
+ * Returns a list of all dock widgets in this dock area.
+ * This list contains open and closed dock widgets.
+ */
+ QList<DockWidget *> dockWidgets() const;
+
+ /**
+ * Returns the number of open dock widgets in this area
+ */
+ int openDockWidgetsCount() const;
+
+ /**
+ * Returns a list of dock widgets that are not closed.
+ */
+ QList<DockWidget *> openedDockWidgets() const;
+
+ /**
+ * Returns a dock widget by its index
+ */
+ DockWidget *dockWidget(int indexOf) const;
+
+ /**
+ * Returns the index of the current active dock widget or -1 if there
+ * are is no active dock widget (ie.e if all dock widgets are closed)
+ */
+ int currentIndex() const;
+
+ /**
+ * Returns the index of the first open dock widgets in the list of
+ * dock widgets.
+ * This function is here for performance reasons. Normally it would
+ * be possible to take the first dock widget from the list returned by
+ * openedDockWidgets() function. But that function enumerates all
+ * dock widgets while this functions stops after the first open dock widget.
+ * If there are no open dock widgets, the function returns -1.
+ */
+ int indexOfFirstOpenDockWidget() const;
+
+ /**
+ * Returns the current active dock widget or a nullptr if there is no
+ * active dock widget (i.e. if all dock widgets are closed)
+ */
+ DockWidget *currentDockWidget() const;
+
+ /**
+ * Shows the tab with the given dock widget
+ */
+ void setCurrentDockWidget(DockWidget *dockWidget);
+
+ /**
+ * Saves the state into the given stream
+ */
+ void saveState(QXmlStreamWriter &stream) const;
+
+ /**
+ * This functions returns the dock widget features of all dock widget in
+ * this area.
+ * A bitwise and is used to combine the flags of all dock widgets. That
+ * means, if only one single dock widget does not support a certain flag,
+ * the whole dock are does not support the flag. I.e. if one single
+ * dock widget in this area is not closable, the whole dock are is not
+ * closable.
+ */
+ DockWidget::DockWidgetFeatures features(eBitwiseOperator mode = BitwiseAnd) const;
+
+ /**
+ * Returns the title bar button corresponding to the given title bar
+ * button identifier
+ */
+ QAbstractButton *titleBarButton(eTitleBarButton which) const;
+
+ /**
+ * Update the close button if visibility changed
+ */
+ virtual void setVisible(bool visible) override;
+
+ /**
+ * Configures the areas of this particular dock area that are allowed for docking
+ */
+ void setAllowedAreas(DockWidgetAreas areas);
+
+ /**
+ * Returns flags with all allowed drop areas of this particular dock area
+ */
+ DockWidgetAreas allowedAreas() const;
+
+ /**
+ * Returns the title bar of this dock area
+ */
+ DockAreaTitleBar *titleBar() const;
+
+ /**
+ * This activates the tab for the given tab index.
+ * If the dock widget for the given tab is not visible, the this function
+ * call will make it visible.
+ */
+ void setCurrentIndex(int indexOf);
+
+ /**
+ * Closes the dock area and all dock widgets in this area
+ */
+ void closeArea();
+
+ /**
+ * This function closes all other areas except of this area
+ */
+ void closeOtherAreas();
+
+signals:
+ /**
+ * This signal is emitted when user clicks on a tab at an index.
+ */
+ void tabBarClicked(int indexOf);
+
+ /**
+ * This signal is emitted when the tab bar's current tab is about to be changed. The new
+ * current has the given index, or -1 if there isn't a new one.
+ * @param index
+ */
+ void currentChanging(int indexOf);
+
+ /**
+ * This signal is emitted when the tab bar's current tab changes. The new
+ * current has the given index, or -1 if there isn't a new one
+ * @param index
+ */
+ void currentChanged(int indexOf);
+
+ /**
+ * This signal is emitted if the visibility of this dock area is toggled
+ * via toggle view function
+ */
+ void viewToggled(bool open);
+}; // class DockAreaWidget
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockcomponentsfactory.cpp b/src/libs/advanceddockingsystem/dockcomponentsfactory.cpp
new file mode 100644
index 00000000000..1b5a0933c2a
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockcomponentsfactory.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockcomponentsfactory.h"
+
+#include "dockwidgettab.h"
+#include "dockareatabbar.h"
+#include "dockareatitlebar.h"
+#include "dockwidget.h"
+#include "dockareawidget.h"
+
+#include <memory>
+
+namespace ADS
+{
+ static std::unique_ptr<DockComponentsFactory> g_defaultFactory(new DockComponentsFactory());
+
+ DockWidgetTab *DockComponentsFactory::createDockWidgetTab(DockWidget *dockWidget) const
+ {
+ return new DockWidgetTab(dockWidget);
+ }
+
+ DockAreaTabBar *DockComponentsFactory::createDockAreaTabBar(DockAreaWidget *dockArea) const
+ {
+ return new DockAreaTabBar(dockArea);
+ }
+
+ DockAreaTitleBar *DockComponentsFactory::createDockAreaTitleBar(DockAreaWidget *dockArea) const
+ {
+ return new DockAreaTitleBar(dockArea);
+ }
+
+ const DockComponentsFactory *DockComponentsFactory::factory()
+ {
+ return g_defaultFactory.get();
+ }
+
+ void DockComponentsFactory::setFactory(DockComponentsFactory *factory)
+ {
+ g_defaultFactory.reset(factory);
+ }
+
+ void DockComponentsFactory::resetDefaultFactory()
+ {
+ g_defaultFactory.reset(new DockComponentsFactory());
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockcomponentsfactory.h b/src/libs/advanceddockingsystem/dockcomponentsfactory.h
new file mode 100644
index 00000000000..8e1019a9312
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockcomponentsfactory.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+namespace ADS {
+
+class DockWidgetTab;
+class DockAreaTitleBar;
+class DockAreaTabBar;
+class DockAreaWidget;
+class DockWidget;
+
+/**
+ * Factory for creation of certain GUI elements for the docking framework.
+ * A default unique instance provided by DockComponentsFactory is used for
+ * creation of all supported components. To inject your custom components,
+ * you can create your own derived dock components factory and register
+ * it via setDefaultFactory() function.
+ * \code
+ * CDockComponentsFactory::setDefaultFactory(new MyComponentsFactory()));
+ * \endcode
+ */
+class ADS_EXPORT DockComponentsFactory
+{
+public:
+ /**
+ * Force virtual destructor
+ */
+ virtual ~DockComponentsFactory() {}
+
+ /**
+ * This default implementation just creates a dock widget tab with
+ * new DockWidgetTab(dockWidget).
+ */
+ virtual DockWidgetTab *createDockWidgetTab(DockWidget *dockWidget) const;
+
+ /**
+ * This default implementation just creates a dock area tab bar with
+ * new DockAreaTabBar(dockArea).
+ */
+ virtual DockAreaTabBar *createDockAreaTabBar(DockAreaWidget *dockArea) const;
+
+ /**
+ * This default implementation just creates a dock area title bar with
+ * new DockAreaTitleBar(dockArea).
+ */
+ virtual DockAreaTitleBar *createDockAreaTitleBar(DockAreaWidget *dockArea) const;
+
+ /**
+ * Returns the default components factory
+ */
+ static const DockComponentsFactory *factory();
+
+ /**
+ * Sets a new default factory for creation of GUI elements.
+ * This function takes ownership of the given Factory.
+ */
+ static void setFactory(DockComponentsFactory* factory);
+
+ /**
+ * Resets the current factory to the
+ */
+ static void resetDefaultFactory();
+};
+
+/**
+ * Convenience function to ease factory instance access
+ */
+inline const DockComponentsFactory *componentsFactory()
+{
+ return DockComponentsFactory::factory();
+}
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockcontainerwidget.cpp b/src/libs/advanceddockingsystem/dockcontainerwidget.cpp
new file mode 100644
index 00000000000..10fdc8cde25
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockcontainerwidget.cpp
@@ -0,0 +1,1459 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockcontainerwidget.h"
+
+#include "ads_globals.h"
+#include "dockareawidget.h"
+#include "dockingstatereader.h"
+#include "dockmanager.h"
+#include "dockoverlay.h"
+#include "docksplitter.h"
+#include "dockwidget.h"
+#include "floatingdockcontainer.h"
+
+#include <QAbstractButton>
+#include <QDebug>
+#include <QEvent>
+#include <QGridLayout>
+#include <QList>
+#include <QLoggingCategory>
+#include <QPointer>
+#include <QVariant>
+#include <QXmlStreamWriter>
+
+#include <functional>
+#include <iostream>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ static unsigned int zOrderCounter = 0;
+
+ enum eDropMode {
+ DropModeIntoArea, ///< drop widget into a dock area
+ DropModeIntoContainer, ///< drop into container
+ DropModeInvalid ///< invalid mode - do not drop
+ };
+
+ /**
+ * Converts dock area ID to an index for array access
+ */
+ static int areaIdToIndex(DockWidgetArea area)
+ {
+ switch (area) {
+ case LeftDockWidgetArea:
+ return 0;
+ case RightDockWidgetArea:
+ return 1;
+ case TopDockWidgetArea:
+ return 2;
+ case BottomDockWidgetArea:
+ return 3;
+ case CenterDockWidgetArea:
+ return 4;
+ default:
+ return 4;
+ }
+ }
+
+ /**
+ * Helper function to ease insertion of dock area into splitter
+ */
+ static void insertWidgetIntoSplitter(QSplitter *splitter, QWidget *widget, bool append)
+ {
+ if (append) {
+ splitter->addWidget(widget);
+ } else {
+ splitter->insertWidget(0, widget);
+ }
+ }
+
+ /**
+ * Private data class of DockContainerWidget class (pimpl)
+ */
+ class DockContainerWidgetPrivate
+ {
+ public:
+ DockContainerWidget *q;
+ QPointer<DockManager> m_dockManager;
+ unsigned int m_zOrderIndex = 0;
+ QList<DockAreaWidget *> m_dockAreas;
+ QGridLayout *m_layout = nullptr;
+ QSplitter *m_rootSplitter = nullptr;
+ bool m_isFloating = false;
+ DockAreaWidget *m_lastAddedAreaCache[5];
+ int m_visibleDockAreaCount = -1;
+ DockAreaWidget *m_topLevelDockArea = nullptr;
+
+ /**
+ * Private data constructor
+ */
+ DockContainerWidgetPrivate(DockContainerWidget *parent);
+
+ /**
+ * Adds dock widget to container and returns the dock area that contains
+ * the inserted dock widget
+ */
+ DockAreaWidget *dockWidgetIntoContainer(DockWidgetArea area, DockWidget *dockWidget);
+
+ /**
+ * Adds dock widget to a existing DockWidgetArea
+ */
+ DockAreaWidget *dockWidgetIntoDockArea(DockWidgetArea area,
+ DockWidget *dockWidget,
+ DockAreaWidget *targetDockArea);
+
+ /**
+ * Add dock area to this container
+ */
+ void addDockArea(DockAreaWidget *newDockWidget, DockWidgetArea area = CenterDockWidgetArea);
+
+ /**
+ * Drop floating widget into container
+ */
+ void dropIntoContainer(FloatingDockContainer *floatingWidget, DockWidgetArea area);
+
+ /**
+ * Drop floating widget into dock area
+ */
+ void dropIntoSection(FloatingDockContainer *floatingWidget,
+ DockAreaWidget *targetArea,
+ DockWidgetArea area);
+
+ /**
+ * Moves the dock widget or dock area given in Widget parameter to a
+ * new dock widget area
+ */
+ void moveToNewSection(QWidget *widget, DockAreaWidget *targetArea, DockWidgetArea area);
+
+ /**
+ * Moves the dock widget or dock area given in Widget parameter to a
+ * a dock area in container
+ */
+ void moveToContainer(QWidget *widget, DockWidgetArea area);
+
+ /**
+ * Creates a new tab for a widget dropped into the center of a section
+ */
+ void dropIntoCenterOfSection(FloatingDockContainer *floatingWidget,
+ DockAreaWidget *targetArea);
+
+ /**
+ * Creates a new tab for a widget dropped into the center of a section
+ */
+ void moveIntoCenterOfSection(QWidget *widget, DockAreaWidget *targetArea);
+
+ /**
+ * Adds new dock areas to the internal dock area list
+ */
+ void addDockAreasToList(const QList<DockAreaWidget *> newDockAreas);
+
+ /**
+ * Wrapper function for DockAreas append, that ensures that dock area signals
+ * are properly connected to dock container slots
+ */
+ void appendDockAreas(const QList<DockAreaWidget *> newDockAreas);
+
+ /**
+ * Save state of child nodes
+ */
+ void saveChildNodesState(QXmlStreamWriter &stream, QWidget *widget);
+
+ /**
+ * Restore state of child nodes.
+ * \param[in] Stream The data stream that contains the serialized state
+ * \param[out] CreatedWidget The widget created from parsed data or 0 if
+ * the parsed widget was an empty splitter
+ * \param[in] Testing If Testing is true, only the stream data is
+ * parsed without modifiying anything.
+ */
+ bool restoreChildNodes(DockingStateReader &stateReader,
+ QWidget *&createdWidget,
+ bool testing);
+
+ /**
+ * Restores a splitter.
+ * \see restoreChildNodes() for details
+ */
+ bool restoreSplitter(DockingStateReader &stateReader, QWidget *&createdWidget, bool testing);
+
+ /**
+ * Restores a dock area.
+ * \see restoreChildNodes() for details
+ */
+ bool restoreDockArea(DockingStateReader &stateReader, QWidget *&createdWidget, bool testing);
+
+ /**
+ * Helper function for recursive dumping of layout
+ */
+ void dumpRecursive(int level, QWidget *widget) const;
+
+ /**
+ * Calculate the drop mode from the given target position
+ */
+ eDropMode getDropMode(const QPoint &targetPosition);
+
+ /**
+ * Initializes the visible dock area count variable if it is not initialized
+ * yet
+ */
+ void initVisibleDockAreaCount()
+ {
+ if (m_visibleDockAreaCount > -1) {
+ return;
+ }
+
+ m_visibleDockAreaCount = 0;
+ for (auto dockArea : m_dockAreas) {
+ m_visibleDockAreaCount += dockArea->isHidden() ? 0 : 1;
+ }
+ }
+
+ /**
+ * Access function for the visible dock area counter
+ */
+ int visibleDockAreaCount()
+ {
+ // Lazy initialization - we initialize the VisibleDockAreaCount variable
+ // on first use
+ initVisibleDockAreaCount();
+ return m_visibleDockAreaCount;
+ }
+
+ /**
+ * The visible dock area count changes, if dock areas are remove, added or
+ * when its view is toggled
+ */
+ void onVisibleDockAreaCountChanged();
+
+ void emitDockAreasRemoved()
+ {
+ onVisibleDockAreaCountChanged();
+ emit q->dockAreasRemoved();
+ }
+
+ void emitDockAreasAdded()
+ {
+ onVisibleDockAreaCountChanged();
+ emit q->dockAreasAdded();
+ }
+
+ /**
+ * Helper function for creation of new splitter
+ */
+ DockSplitter *createSplitter(Qt::Orientation orientation, QWidget *parent = nullptr)
+ {
+ auto *splitter = new DockSplitter(orientation, parent);
+ splitter->setOpaqueResize(
+ DockManager::configFlags().testFlag(DockManager::OpaqueSplitterResize));
+ splitter->setChildrenCollapsible(false);
+ return splitter;
+ }
+
+ void onDockAreaViewToggled(bool visible)
+ {
+ DockAreaWidget *dockArea = qobject_cast<DockAreaWidget *>(q->sender());
+ m_visibleDockAreaCount += visible ? 1 : -1;
+ onVisibleDockAreaCountChanged();
+ emit q->dockAreaViewToggled(dockArea, visible);
+ }
+ }; // struct DockContainerWidgetPrivate
+
+ DockContainerWidgetPrivate::DockContainerWidgetPrivate(DockContainerWidget *parent)
+ : q(parent)
+ {
+ std::fill(std::begin(m_lastAddedAreaCache), std::end(m_lastAddedAreaCache), nullptr);
+ }
+
+ eDropMode DockContainerWidgetPrivate::getDropMode(const QPoint &targetPosition)
+ {
+ DockAreaWidget *dockArea = q->dockAreaAt(targetPosition);
+ auto dropArea = InvalidDockWidgetArea;
+ auto containerDropArea = m_dockManager->containerOverlay()->dropAreaUnderCursor();
+
+ if (dockArea) {
+ auto dropOverlay = m_dockManager->dockAreaOverlay();
+ dropOverlay->setAllowedAreas(dockArea->allowedAreas());
+ dropArea = dropOverlay->showOverlay(dockArea);
+ if (containerDropArea != InvalidDockWidgetArea && containerDropArea != dropArea) {
+ dropArea = InvalidDockWidgetArea;
+ }
+
+ if (dropArea != InvalidDockWidgetArea) {
+ qCInfo(adsLog) << "Dock Area Drop Content: " << dropArea;
+ return DropModeIntoArea;
+ }
+ }
+
+ // mouse is over container
+ if (InvalidDockWidgetArea == dropArea) {
+ dropArea = containerDropArea;
+ qCInfo(adsLog) << "Container Drop Content: " << dropArea;
+ if (dropArea != InvalidDockWidgetArea) {
+ return DropModeIntoContainer;
+ }
+ }
+
+ return DropModeInvalid;
+ }
+
+ void DockContainerWidgetPrivate::onVisibleDockAreaCountChanged()
+ {
+ auto topLevelDockArea = q->topLevelDockArea();
+
+ if (topLevelDockArea) {
+ this->m_topLevelDockArea = topLevelDockArea;
+ topLevelDockArea->titleBarButton(TitleBarButtonUndock)
+ ->setVisible(false || !q->isFloating());
+ topLevelDockArea->titleBarButton(TitleBarButtonClose)
+ ->setVisible(false || !q->isFloating());
+ } else if (this->m_topLevelDockArea) {
+ this->m_topLevelDockArea->titleBarButton(TitleBarButtonUndock)->setVisible(true);
+ this->m_topLevelDockArea->titleBarButton(TitleBarButtonClose)->setVisible(true);
+ this->m_topLevelDockArea = nullptr;
+ }
+ }
+
+ void DockContainerWidgetPrivate::dropIntoContainer(FloatingDockContainer *floatingWidget,
+ DockWidgetArea area)
+ {
+ auto insertParam = internal::dockAreaInsertParameters(area);
+ DockContainerWidget *floatingDockContainer = floatingWidget->dockContainer();
+ auto newDockAreas = floatingDockContainer
+ ->findChildren<DockAreaWidget *>(QString(),
+ Qt::FindChildrenRecursively);
+ QSplitter *splitter = m_rootSplitter;
+
+ if (m_dockAreas.count() <= 1) {
+ splitter->setOrientation(insertParam.orientation());
+ } else if (splitter->orientation() != insertParam.orientation()) {
+ QSplitter *newSplitter = createSplitter(insertParam.orientation());
+ QLayoutItem *layoutItem = m_layout->replaceWidget(splitter, newSplitter);
+ newSplitter->addWidget(splitter);
+ splitter = newSplitter;
+ delete layoutItem;
+ }
+
+ // Now we can insert the floating widget content into this container
+ auto floatingSplitter = floatingDockContainer->rootSplitter();
+ if (floatingSplitter->count() == 1) {
+ insertWidgetIntoSplitter(splitter, floatingSplitter->widget(0), insertParam.append());
+ } else if (floatingSplitter->orientation() == insertParam.orientation()) {
+ while (floatingSplitter->count()) {
+ insertWidgetIntoSplitter(splitter,
+ floatingSplitter->widget(0),
+ insertParam.append());
+ }
+ } else {
+ insertWidgetIntoSplitter(splitter, floatingSplitter, insertParam.append());
+ }
+
+ m_rootSplitter = splitter;
+ addDockAreasToList(newDockAreas);
+
+ // If we dropped the floating widget into the main dock container that does
+ // not contain any dock widgets, then splitter is invisible and we need to
+ // show it to display the docked widgets
+ if (!splitter->isVisible()) {
+ splitter->show();
+ }
+ q->dumpLayout();
+ }
+
+ void DockContainerWidgetPrivate::dropIntoCenterOfSection(FloatingDockContainer *floatingWidget,
+ DockAreaWidget *targetArea)
+ {
+ DockContainerWidget *floatingContainer = floatingWidget->dockContainer();
+ auto newDockWidgets = floatingContainer->dockWidgets();
+ auto topLevelDockArea = floatingContainer->topLevelDockArea();
+ int newCurrentIndex = -1;
+
+ // If the floating widget contains only one single dock are, then the
+ // current dock widget of the dock area will also be the future current
+ // dock widget in the drop area.
+ if (topLevelDockArea) {
+ newCurrentIndex = topLevelDockArea->currentIndex();
+ }
+
+ for (int i = 0; i < newDockWidgets.count(); ++i) {
+ DockWidget *dockWidget = newDockWidgets[i];
+ targetArea->insertDockWidget(i, dockWidget, false);
+ // If the floating widget contains multiple visible dock areas, then we
+ // simply pick the first visible open dock widget and make it
+ // the current one.
+ if (newCurrentIndex < 0 && !dockWidget->isClosed()) {
+ newCurrentIndex = i;
+ }
+ }
+ targetArea->setCurrentIndex(newCurrentIndex);
+ targetArea->updateTitleBarVisibility();
+ return;
+ }
+
+ void DockContainerWidgetPrivate::dropIntoSection(FloatingDockContainer *floatingWidget,
+ DockAreaWidget *targetArea,
+ DockWidgetArea area)
+ {
+ // Dropping into center means all dock widgets in the dropped floating
+ // widget will become tabs of the drop area
+ if (CenterDockWidgetArea == area) {
+ dropIntoCenterOfSection(floatingWidget, targetArea);
+ return;
+ }
+
+ auto insertParam = internal::dockAreaInsertParameters(area);
+ auto newDockAreas = floatingWidget->dockContainer()
+ ->findChildren<DockAreaWidget *>(QString(),
+ Qt::FindChildrenRecursively);
+ QSplitter *targetAreaSplitter = internal::findParent<QSplitter *>(targetArea);
+
+ if (!targetAreaSplitter) {
+ QSplitter *splitter = createSplitter(insertParam.orientation());
+ m_layout->replaceWidget(targetArea, splitter);
+ splitter->addWidget(targetArea);
+ targetAreaSplitter = splitter;
+ }
+ int areaIndex = targetAreaSplitter->indexOf(targetArea);
+ auto widget = floatingWidget->dockContainer()
+ ->findChild<QWidget *>(QString(), Qt::FindDirectChildrenOnly);
+ auto floatingSplitter = qobject_cast<QSplitter *>(widget);
+
+ if (targetAreaSplitter->orientation() == insertParam.orientation()) {
+ auto sizes = targetAreaSplitter->sizes();
+ int targetAreaSize = (insertParam.orientation() == Qt::Horizontal)
+ ? targetArea->width()
+ : targetArea->height();
+ bool adjustSplitterSizes = true;
+ if ((floatingSplitter->orientation() != insertParam.orientation())
+ && floatingSplitter->count() > 1) {
+ targetAreaSplitter->insertWidget(areaIndex + insertParam.insertOffset(), widget);
+ } else {
+ adjustSplitterSizes = (floatingSplitter->count() == 1);
+ int insertIndex = areaIndex + insertParam.insertOffset();
+ while (floatingSplitter->count()) {
+ targetAreaSplitter->insertWidget(insertIndex++, floatingSplitter->widget(0));
+ }
+ }
+
+ if (adjustSplitterSizes) {
+ int size = (targetAreaSize - targetAreaSplitter->handleWidth()) / 2;
+ sizes[areaIndex] = size;
+ sizes.insert(areaIndex, size);
+ targetAreaSplitter->setSizes(sizes);
+ }
+ } else {
+ QList<int> newSplitterSizes;
+ QSplitter *newSplitter = createSplitter(insertParam.orientation());
+ int targetAreaSize = (insertParam.orientation() == Qt::Horizontal)
+ ? targetArea->width()
+ : targetArea->height();
+ bool adjustSplitterSizes = true;
+ if ((floatingSplitter->orientation() != insertParam.orientation())
+ && floatingSplitter->count() > 1) {
+ newSplitter->addWidget(widget);
+ } else {
+ adjustSplitterSizes = (floatingSplitter->count() == 1);
+ while (floatingSplitter->count()) {
+ newSplitter->addWidget(floatingSplitter->widget(0));
+ }
+ }
+
+ // Save the sizes before insertion and restore it later to prevent
+ // shrinking of existing area
+ auto sizes = targetAreaSplitter->sizes();
+ insertWidgetIntoSplitter(newSplitter, targetArea, !insertParam.append());
+ if (adjustSplitterSizes) {
+ int size = targetAreaSize / 2;
+ newSplitter->setSizes({size, size});
+ }
+ targetAreaSplitter->insertWidget(areaIndex, newSplitter);
+ targetAreaSplitter->setSizes(sizes);
+ }
+
+ addDockAreasToList(newDockAreas);
+ q->dumpLayout();
+ }
+
+ void DockContainerWidgetPrivate::moveIntoCenterOfSection(QWidget *widget,
+ DockAreaWidget *targetArea)
+ {
+ auto droppedDockWidget = qobject_cast<DockWidget *>(widget);
+ auto droppedArea = qobject_cast<DockAreaWidget *>(widget);
+
+ if (droppedDockWidget) {
+ DockAreaWidget *oldDockArea = droppedDockWidget->dockAreaWidget();
+ if (oldDockArea) {
+ oldDockArea->removeDockWidget(droppedDockWidget);
+ }
+ targetArea->insertDockWidget(0, droppedDockWidget, true);
+ } else {
+ QList<DockWidget *> newDockWidgets = droppedArea->dockWidgets();
+ int newCurrentIndex = droppedArea->currentIndex();
+ for (int i = 0; i < newDockWidgets.count(); ++i) {
+ DockWidget *dockWidget = newDockWidgets[i];
+ targetArea->insertDockWidget(i, dockWidget, false);
+ }
+ targetArea->setCurrentIndex(newCurrentIndex);
+ droppedArea->dockContainer()->removeDockArea(droppedArea);
+ droppedArea->deleteLater();
+ }
+
+ targetArea->updateTitleBarVisibility();
+ return;
+ }
+
+ void DockContainerWidgetPrivate::moveToNewSection(QWidget *widget,
+ DockAreaWidget *targetArea,
+ DockWidgetArea area)
+ {
+ // Dropping into center means all dock widgets in the dropped floating
+ // widget will become tabs of the drop area
+ if (CenterDockWidgetArea == area) {
+ moveIntoCenterOfSection(widget, targetArea);
+ return;
+ }
+
+ DockWidget *droppedDockWidget = qobject_cast<DockWidget *>(widget);
+ DockAreaWidget *droppedDockArea = qobject_cast<DockAreaWidget *>(widget);
+ DockAreaWidget *newDockArea;
+ if (droppedDockWidget) {
+ newDockArea = new DockAreaWidget(m_dockManager, q);
+ DockAreaWidget *oldDockArea = droppedDockWidget->dockAreaWidget();
+ if (oldDockArea) {
+ oldDockArea->removeDockWidget(droppedDockWidget);
+ }
+ newDockArea->addDockWidget(droppedDockWidget);
+ } else {
+ droppedDockArea->dockContainer()->removeDockArea(droppedDockArea);
+ newDockArea = droppedDockArea;
+ }
+
+ auto insertParam = internal::dockAreaInsertParameters(area);
+ QSplitter *targetAreaSplitter = internal::findParent<QSplitter *>(targetArea);
+ int areaIndex = targetAreaSplitter->indexOf(targetArea);
+ auto sizes = targetAreaSplitter->sizes();
+ if (targetAreaSplitter->orientation() == insertParam.orientation()) {
+ int targetAreaSize = (insertParam.orientation() == Qt::Horizontal)
+ ? targetArea->width()
+ : targetArea->height();
+ targetAreaSplitter->insertWidget(areaIndex + insertParam.insertOffset(), newDockArea);
+ int size = (targetAreaSize - targetAreaSplitter->handleWidth()) / 2;
+ sizes[areaIndex] = size;
+ sizes.insert(areaIndex, size);
+ } else {
+ auto sizes = targetAreaSplitter->sizes();
+ int targetAreaSize = (insertParam.orientation() == Qt::Horizontal)
+ ? targetArea->width()
+ : targetArea->height();
+ QSplitter *newSplitter = createSplitter(insertParam.orientation());
+ newSplitter->addWidget(targetArea);
+ insertWidgetIntoSplitter(newSplitter, newDockArea, insertParam.append());
+ int size = targetAreaSize / 2;
+ newSplitter->setSizes({size, size});
+ targetAreaSplitter->insertWidget(areaIndex, newSplitter);
+ }
+ targetAreaSplitter->setSizes(sizes);
+
+ addDockAreasToList({newDockArea});
+ }
+
+ void DockContainerWidgetPrivate::moveToContainer(QWidget *widget, DockWidgetArea area)
+ {
+ DockWidget *droppedDockWidget = qobject_cast<DockWidget *>(widget);
+ DockAreaWidget *droppedDockArea = qobject_cast<DockAreaWidget *>(widget);
+ DockAreaWidget *newDockArea;
+
+ if (droppedDockWidget) {
+ newDockArea = new DockAreaWidget(m_dockManager, q);
+ DockAreaWidget *oldDockArea = droppedDockWidget->dockAreaWidget();
+ if (oldDockArea) {
+ oldDockArea->removeDockWidget(droppedDockWidget);
+ }
+ newDockArea->addDockWidget(droppedDockWidget);
+ } else {
+ droppedDockArea->dockContainer()->removeDockArea(droppedDockArea);
+ newDockArea = droppedDockArea;
+ }
+
+ addDockArea(newDockArea, area);
+ m_lastAddedAreaCache[areaIdToIndex(area)] = newDockArea;
+ }
+
+ void DockContainerWidgetPrivate::addDockAreasToList(const QList<DockAreaWidget *> newDockAreas)
+ {
+ int countBefore = m_dockAreas.count();
+ int newAreaCount = newDockAreas.count();
+ appendDockAreas(newDockAreas);
+ // If the user dropped a floating widget that contains only one single
+ // visible dock area, then its title bar button TitleBarButtonUndock is
+ // likely hidden. We need to ensure, that it is visible
+ for (auto dockArea : newDockAreas) {
+ dockArea->titleBarButton(TitleBarButtonUndock)->setVisible(true);
+ dockArea->titleBarButton(TitleBarButtonClose)->setVisible(true);
+ }
+
+ // We need to ensure, that the dock area title bar is visible. The title bar
+ // is invisible, if the dock are is a single dock area in a floating widget.
+ if (1 == countBefore) {
+ m_dockAreas.at(0)->updateTitleBarVisibility();
+ }
+
+ if (1 == newAreaCount) {
+ m_dockAreas.last()->updateTitleBarVisibility();
+ }
+
+ emitDockAreasAdded();
+ }
+
+ void DockContainerWidgetPrivate::appendDockAreas(const QList<DockAreaWidget *> newDockAreas)
+ {
+ m_dockAreas.append(newDockAreas);
+ for (auto dockArea : newDockAreas) {
+ QObject::connect(dockArea,
+ &DockAreaWidget::viewToggled,
+ q,
+ std::bind(&DockContainerWidgetPrivate::onDockAreaViewToggled,
+ this,
+ std::placeholders::_1));
+ }
+ }
+
+ void DockContainerWidgetPrivate::saveChildNodesState(QXmlStreamWriter &stream, QWidget *widget)
+ {
+ QSplitter *splitter = qobject_cast<QSplitter *>(widget);
+ if (splitter) {
+ stream.writeStartElement("splitter");
+ stream.writeAttribute("orientation",
+ QVariant::fromValue(splitter->orientation()).toString());
+ stream.writeAttribute("count", QString::number(splitter->count()));
+ qCInfo(adsLog) << "NodeSplitter orient: " << splitter->orientation()
+ << " WidgetCont: " << splitter->count();
+ for (int i = 0; i < splitter->count(); ++i) {
+ saveChildNodesState(stream, splitter->widget(i));
+ }
+
+ stream.writeStartElement("sizes");
+ QStringList sizes;
+ for (auto size : splitter->sizes()) {
+ sizes.append(QString::number(size));
+ }
+ stream.writeCharacters(sizes.join(" "));
+ stream.writeEndElement();
+ stream.writeEndElement();
+ } else {
+ DockAreaWidget *dockArea = qobject_cast<DockAreaWidget *>(widget);
+ if (dockArea) {
+ dockArea->saveState(stream);
+ }
+ }
+ }
+
+ bool DockContainerWidgetPrivate::restoreSplitter(DockingStateReader &stateReader,
+ QWidget *&createdWidget,
+ bool testing)
+ {
+ QVariant orientationVar = QVariant(stateReader.attributes().value("orientation").toString());
+
+ // Check if the orientation string is convertable
+ if (!orientationVar.canConvert<Qt::Orientation>()) {
+ return false;
+ }
+ Qt::Orientation orientation = orientationVar.value<Qt::Orientation>();
+
+ bool ok;
+ int widgetCount = stateReader.attributes().value("count").toInt(&ok);
+ if (!ok) {
+ return false;
+ }
+ qCInfo(adsLog) << "Restore NodeSplitter Orientation: " << orientation
+ << " WidgetCount: " << widgetCount;
+ QSplitter *splitter = nullptr;
+ if (!testing) {
+ splitter = createSplitter(orientation);
+ }
+ bool visible = false;
+ QList<int> sizes;
+ while (stateReader.readNextStartElement()) {
+ QWidget *childNode = nullptr;
+ bool result = true;
+ if (stateReader.name() == "splitter") {
+ result = restoreSplitter(stateReader, childNode, testing);
+ } else if (stateReader.name() == "area") {
+ result = restoreDockArea(stateReader, childNode, testing);
+ } else if (stateReader.name() == "sizes") {
+ QString size = stateReader.readElementText().trimmed();
+ qCInfo(adsLog) << "Size: " << size;
+ QTextStream textStream(&size);
+ while (!textStream.atEnd()) {
+ int value;
+ textStream >> value;
+ sizes.append(value);
+ }
+ } else {
+ stateReader.skipCurrentElement();
+ }
+
+ if (!result) {
+ return false;
+ }
+
+ if (testing || !childNode) {
+ continue;
+ }
+
+ qCInfo(adsLog) << "ChildNode isVisible " << childNode->isVisible() << " isVisibleTo "
+ << childNode->isVisibleTo(splitter);
+ splitter->addWidget(childNode);
+ visible |= childNode->isVisibleTo(splitter);
+ }
+
+ if (sizes.count() != widgetCount) {
+ return false;
+ }
+
+ if (!testing) {
+ if (!splitter->count()) {
+ delete splitter;
+ splitter = nullptr;
+ } else {
+ splitter->setSizes(sizes);
+ splitter->setVisible(visible);
+ }
+ createdWidget = splitter;
+ } else {
+ createdWidget = nullptr;
+ }
+
+ return true;
+ }
+
+ bool DockContainerWidgetPrivate::restoreDockArea(DockingStateReader &stateReader,
+ QWidget *&createdWidget,
+ bool testing)
+ {
+ QString currentDockWidget = stateReader.attributes().value("current").toString();
+
+#ifdef ADS_DEBUG_PRINT
+ bool ok;
+ int tabs = stateReader.attributes().value("tabs").toInt(&ok);
+ if (!ok) {
+ return false;
+ }
+ qCInfo(adsLog) << "Restore NodeDockArea Tabs: " << tabs
+ << " Current: " << currentDockWidget;
+#endif
+
+ DockAreaWidget *dockArea = nullptr;
+ if (!testing) {
+ dockArea = new DockAreaWidget(m_dockManager, q);
+ }
+
+ while (stateReader.readNextStartElement()) {
+ if (stateReader.name() != "widget") {
+ continue;
+ }
+
+ auto objectName = stateReader.attributes().value("name");
+ if (objectName.isEmpty()) {
+ qCInfo(adsLog) << "Error: Empty name!";
+ return false;
+ }
+
+ QVariant closedVar = QVariant(stateReader.attributes().value("closed").toString());
+ if (!closedVar.canConvert<bool>()) {
+ return false;
+ }
+ bool closed = closedVar.value<bool>();
+
+ stateReader.skipCurrentElement();
+ DockWidget *dockWidget = m_dockManager->findDockWidget(objectName.toString());
+ if (!dockWidget || testing) {
+ continue;
+ }
+
+ qCInfo(adsLog) << "Dock Widget found - parent " << dockWidget->parent();
+ // We hide the DockArea here to prevent the short display (the flashing)
+ // of the dock areas during application startup
+ dockArea->hide();
+ dockArea->addDockWidget(dockWidget);
+ dockWidget->setToggleViewActionChecked(!closed);
+ dockWidget->setClosedState(closed);
+ dockWidget->setProperty(internal::closedProperty, closed);
+ dockWidget->setProperty(internal::dirtyProperty, false);
+ }
+
+ if (testing) {
+ return true;
+ }
+
+ if (!dockArea->dockWidgetsCount()) {
+ delete dockArea;
+ dockArea = nullptr;
+ } else {
+ dockArea->setProperty("currentDockWidget", currentDockWidget);
+ appendDockAreas({dockArea});
+ }
+
+ createdWidget = dockArea;
+ return true;
+ }
+
+ bool DockContainerWidgetPrivate::restoreChildNodes(DockingStateReader &stateReader,
+ QWidget *&createdWidget,
+ bool testing)
+ {
+ bool result = true;
+ while (stateReader.readNextStartElement()) {
+ if (stateReader.name() == "splitter") {
+ result = restoreSplitter(stateReader, createdWidget, testing);
+ qCInfo(adsLog) << "Splitter";
+ } else if (stateReader.name() == "area") {
+ result = restoreDockArea(stateReader, createdWidget, testing);
+ qCInfo(adsLog) << "DockAreaWidget";
+ } else {
+ stateReader.skipCurrentElement();
+ qCInfo(adsLog) << "Unknown element" << stateReader.name();
+ }
+ }
+
+ return result;
+ }
+
+ DockAreaWidget *DockContainerWidgetPrivate::dockWidgetIntoContainer(DockWidgetArea area,
+ DockWidget *dockWidget)
+ {
+ DockAreaWidget *newDockArea = new DockAreaWidget(m_dockManager, q);
+ newDockArea->addDockWidget(dockWidget);
+ addDockArea(newDockArea, area);
+ newDockArea->updateTitleBarVisibility();
+ m_lastAddedAreaCache[areaIdToIndex(area)] = newDockArea;
+ return newDockArea;
+ }
+
+ void DockContainerWidgetPrivate::addDockArea(DockAreaWidget *newDockArea, DockWidgetArea area)
+ {
+ auto insertParam = internal::dockAreaInsertParameters(area);
+ // As long as we have only one dock area in the splitter we can adjust its orientation
+ if (m_dockAreas.count() <= 1) {
+ m_rootSplitter->setOrientation(insertParam.orientation());
+ }
+
+ QSplitter *splitter = m_rootSplitter;
+ if (splitter->orientation() == insertParam.orientation()) {
+ insertWidgetIntoSplitter(splitter, newDockArea, insertParam.append());
+ } else {
+ QSplitter *newSplitter = createSplitter(insertParam.orientation());
+ if (insertParam.append()) {
+ QLayoutItem *layoutItem = m_layout->replaceWidget(splitter, newSplitter);
+ newSplitter->addWidget(splitter);
+ newSplitter->addWidget(newDockArea);
+ delete layoutItem;
+ } else {
+ newSplitter->addWidget(newDockArea);
+ QLayoutItem *layoutItem = m_layout->replaceWidget(splitter, newSplitter);
+ newSplitter->addWidget(splitter);
+ delete layoutItem;
+ }
+ m_rootSplitter = newSplitter;
+ }
+
+ addDockAreasToList({newDockArea});
+ }
+
+ void DockContainerWidgetPrivate::dumpRecursive(int level, QWidget *widget) const
+ {
+#if defined(QT_DEBUG)
+ QSplitter *splitter = qobject_cast<QSplitter *>(widget);
+ QByteArray buf;
+ buf.fill(' ', level * 4);
+ if (splitter) {
+#ifdef ADS_DEBUG_PRINT
+ qDebug("%sSplitter %s v: %s c: %s",
+ buf.data(),
+ (splitter->orientation() == Qt::Vertical) ? "--" : "|",
+ splitter->isHidden() ? " " : "v",
+ QString::number(splitter->count()).toStdString().c_str());
+ std::cout << buf.data() << "Splitter "
+ << ((splitter->orientation() == Qt::Vertical) ? "--" : "|") << " "
+ << (splitter->isHidden() ? " " : "v") << " "
+ << QString::number(splitter->count()).toStdString() << std::endl;
+#endif
+ for (int i = 0; i < splitter->count(); ++i) {
+ dumpRecursive(level + 1, splitter->widget(i));
+ }
+ } else {
+ DockAreaWidget *dockArea = qobject_cast<DockAreaWidget *>(widget);
+ if (!dockArea) {
+ return;
+ }
+#ifdef ADS_DEBUG_PRINT
+ qDebug("%sDockArea", buf.data());
+ std::cout << buf.data() << (dockArea->isHidden() ? " " : "v")
+ << (dockArea->openDockWidgetsCount() > 0 ? " " : "c") << " DockArea"
+ << std::endl;
+ buf.fill(' ', (level + 1) * 4);
+ for (int i = 0; i < dockArea->dockWidgetsCount(); ++i) {
+ std::cout << buf.data() << (i == dockArea->currentIndex() ? "*" : " ");
+ DockWidget *dockWidget = dockArea->dockWidget(i);
+ std::cout << (dockWidget->isHidden() ? " " : "v");
+ std::cout << (dockWidget->isClosed() ? "c" : " ") << " ";
+ std::cout << dockWidget->windowTitle().toStdString() << std::endl;
+ }
+#endif
+ }
+#else
+ Q_UNUSED(level)
+ Q_UNUSED(widget)
+#endif
+ }
+
+ DockAreaWidget *DockContainerWidgetPrivate::dockWidgetIntoDockArea(DockWidgetArea area,
+ DockWidget *dockWidget,
+ DockAreaWidget
+ *targetDockArea)
+ {
+ if (CenterDockWidgetArea == area) {
+ targetDockArea->addDockWidget(dockWidget);
+ targetDockArea->updateTitleBarVisibility();
+ return targetDockArea;
+ }
+
+ DockAreaWidget *newDockArea = new DockAreaWidget(m_dockManager, q);
+ newDockArea->addDockWidget(dockWidget);
+ auto insertParam = internal::dockAreaInsertParameters(area);
+
+ QSplitter *targetAreaSplitter = internal::findParent<QSplitter *>(targetDockArea);
+ int index = targetAreaSplitter->indexOf(targetDockArea);
+ if (targetAreaSplitter->orientation() == insertParam.orientation()) {
+ qCInfo(adsLog) << "TargetAreaSplitter->orientation() == InsertParam.orientation()";
+ targetAreaSplitter->insertWidget(index + insertParam.insertOffset(), newDockArea);
+ } else {
+ qCInfo(adsLog) << "TargetAreaSplitter->orientation() != InsertParam.orientation()";
+ QSplitter *newSplitter = createSplitter(insertParam.orientation());
+ newSplitter->addWidget(targetDockArea);
+ insertWidgetIntoSplitter(newSplitter, newDockArea, insertParam.append());
+ targetAreaSplitter->insertWidget(index, newSplitter);
+ }
+
+ appendDockAreas({newDockArea});
+ emitDockAreasAdded();
+ return newDockArea;
+ }
+
+ DockContainerWidget::DockContainerWidget(DockManager *dockManager, QWidget *parent)
+ : QFrame(parent)
+ , d(new DockContainerWidgetPrivate(this))
+ {
+ d->m_dockManager = dockManager;
+ d->m_isFloating = floatingWidget() != nullptr;
+
+ d->m_layout = new QGridLayout();
+ d->m_layout->setContentsMargins(0, 1, 0, 1);
+ d->m_layout->setSpacing(0);
+ setLayout(d->m_layout);
+
+ // The function d->createSplitter() accesses the config flags from dock
+ // manager which in turn requires a properly constructed dock manager.
+ // If this dock container is the dock manager, then it is not properly
+ // constructed yet because this base class constructor is called before
+ // the constructor of the DockManager private class
+ if (dockManager != this) {
+ d->m_dockManager->registerDockContainer(this);
+ createRootSplitter();
+ }
+ }
+
+ DockContainerWidget::~DockContainerWidget()
+ {
+ if (d->m_dockManager) {
+ d->m_dockManager->removeDockContainer(this);
+ }
+ delete d;
+ }
+
+ DockAreaWidget *DockContainerWidget::addDockWidget(DockWidgetArea area,
+ DockWidget *dockWidget,
+ DockAreaWidget *dockAreaWidget)
+ {
+ DockAreaWidget *oldDockArea = dockWidget->dockAreaWidget();
+ if (oldDockArea) {
+ oldDockArea->removeDockWidget(dockWidget);
+ }
+
+ dockWidget->setDockManager(d->m_dockManager);
+ if (dockAreaWidget) {
+ return d->dockWidgetIntoDockArea(area, dockWidget, dockAreaWidget);
+ } else {
+ return d->dockWidgetIntoContainer(area, dockWidget);
+ }
+ }
+
+ void DockContainerWidget::removeDockWidget(DockWidget * dockWidget)
+ {
+ DockAreaWidget *area = dockWidget->dockAreaWidget();
+ if (area) {
+ area->removeDockWidget(dockWidget);
+ }
+ }
+
+ unsigned int DockContainerWidget::zOrderIndex() const { return d->m_zOrderIndex; }
+
+ bool DockContainerWidget::isInFrontOf(DockContainerWidget *other) const
+ {
+ return this->zOrderIndex() > other->zOrderIndex();
+ }
+
+ bool DockContainerWidget::event(QEvent *event)
+ {
+ bool result = QWidget::event(event);
+ if (event->type() == QEvent::WindowActivate) {
+ d->m_zOrderIndex = ++zOrderCounter;
+ } else if (event->type() == QEvent::Show && !d->m_zOrderIndex) {
+ d->m_zOrderIndex = ++zOrderCounter;
+ }
+
+ return result;
+ }
+
+ void DockContainerWidget::addDockArea(DockAreaWidget *dockAreaWidget, DockWidgetArea area)
+ {
+ DockContainerWidget *container = dockAreaWidget->dockContainer();
+ if (container && container != this) {
+ container->removeDockArea(dockAreaWidget);
+ }
+
+ d->addDockArea(dockAreaWidget, area);
+ }
+
+ void DockContainerWidget::removeDockArea(DockAreaWidget *area)
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ area->disconnect(this);
+ d->m_dockAreas.removeAll(area);
+ DockSplitter *splitter = internal::findParent<DockSplitter *>(area);
+
+ // Remove area from parent splitter and recursively hide tree of parent
+ // splitters if it has no visible content
+ area->setParent(nullptr);
+ internal::hideEmptyParentSplitters(splitter);
+
+ // Remove this area from cached areas
+ const auto &cache = d->m_lastAddedAreaCache;
+ if (auto p = std::find(cache, cache + sizeof(cache) / sizeof(cache[0]), area)) {
+ d->m_lastAddedAreaCache[std::distance(cache, p)] = nullptr;
+ }
+
+ // If splitter has more than 1 widgets, we are finished and can leave
+ if (splitter->count() > 1) {
+ emitAndExit();
+ return;
+ }
+
+ // If this is the RootSplitter we need to remove empty splitters to
+ // avoid too many empty splitters
+ if (splitter == d->m_rootSplitter) {
+ qCInfo(adsLog) << "Removed from RootSplitter";
+ // If splitter is empty, we are finished
+ if (!splitter->count()) {
+ splitter->hide();
+ emitAndExit();
+ return;
+ }
+
+ QWidget *widget = splitter->widget(0);
+ QSplitter *childSplitter = qobject_cast<QSplitter *>(widget);
+ // If the one and only content widget of the splitter is not a splitter
+ // then we are finished
+ if (!childSplitter) {
+ emitAndExit();
+ return;
+ }
+
+ // We replace the superfluous RootSplitter with the ChildSplitter
+ childSplitter->setParent(nullptr);
+ QLayoutItem *layoutItem = d->m_layout->replaceWidget(splitter, childSplitter);
+ d->m_rootSplitter = childSplitter;
+ delete layoutItem;
+ qCInfo(adsLog) << "RootSplitter replaced by child splitter";
+ } else if (splitter->count() == 1) {
+ qCInfo(adsLog) << "Replacing splitter with content";
+ QSplitter *parentSplitter = internal::findParent<QSplitter *>(splitter);
+ auto sizes = parentSplitter->sizes();
+ QWidget *widget = splitter->widget(0);
+ widget->setParent(this);
+ internal::replaceSplitterWidget(parentSplitter, splitter, widget);
+ parentSplitter->setSizes(sizes);
+ }
+
+ delete splitter;
+ }
+
+ void DockContainerWidget::emitAndExit() const
+ {
+ DockWidget *topLevelWidget = topLevelDockWidget();
+
+ // Updated the title bar visibility of the dock widget if there is only
+ // one single visible dock widget
+ DockWidget::emitTopLevelEventForWidget(topLevelWidget, true);
+ dumpLayout();
+ d->emitDockAreasRemoved();
+ }
+
+ DockAreaWidget *DockContainerWidget::dockAreaAt(const QPoint &globalPosition) const
+ {
+ for (auto dockArea : d->m_dockAreas) {
+ if (dockArea->isVisible()
+ && dockArea->rect().contains(dockArea->mapFromGlobal(globalPosition))) {
+ return dockArea;
+ }
+ }
+
+ return nullptr;
+ }
+
+ DockAreaWidget *DockContainerWidget::dockArea(int index) const
+ {
+ return (index < dockAreaCount()) ? d->m_dockAreas[index] : nullptr;
+ }
+
+ bool DockContainerWidget::isFloating() const { return d->m_isFloating; }
+
+ int DockContainerWidget::dockAreaCount() const { return d->m_dockAreas.count(); }
+
+ int DockContainerWidget::visibleDockAreaCount() const
+ {
+ int result = 0;
+ for (auto dockArea : d->m_dockAreas) {
+ result += dockArea->isHidden() ? 0 : 1;
+ }
+
+ return result;
+
+ // TODO Cache or precalculate this to speed it up because it is used during
+ // movement of floating widget
+ //return d->visibleDockAreaCount();
+ }
+
+ void DockContainerWidget::dropFloatingWidget(FloatingDockContainer *floatingWidget,
+ const QPoint &targetPosition)
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ DockWidget *singleDroppedDockWidget = floatingWidget->topLevelDockWidget();
+ DockWidget *singleDockWidget = topLevelDockWidget();
+ DockAreaWidget *dockArea = dockAreaAt(targetPosition);
+ auto dropArea = InvalidDockWidgetArea;
+ auto containerDropArea = d->m_dockManager->containerOverlay()->dropAreaUnderCursor();
+ bool dropped = false;
+
+ if (dockArea) {
+ auto dropOverlay = d->m_dockManager->dockAreaOverlay();
+ dropOverlay->setAllowedAreas(dockArea->allowedAreas());
+ dropArea = dropOverlay->showOverlay(dockArea);
+ if (containerDropArea != InvalidDockWidgetArea && containerDropArea != dropArea) {
+ dropArea = InvalidDockWidgetArea;
+ }
+
+ if (dropArea != InvalidDockWidgetArea) {
+ qCInfo(adsLog) << "Dock Area Drop Content: " << dropArea;
+ d->dropIntoSection(floatingWidget, dockArea, dropArea);
+ dropped = true;
+ }
+ }
+
+ // mouse is over container
+ if (InvalidDockWidgetArea == dropArea) {
+ dropArea = containerDropArea;
+ qCInfo(adsLog) << "Container Drop Content: " << dropArea;
+ if (dropArea != InvalidDockWidgetArea) {
+ d->dropIntoContainer(floatingWidget, dropArea);
+ dropped = true;
+ }
+ }
+
+ if (dropped) {
+ floatingWidget->deleteLater();
+
+ // If we dropped a floating widget with only one single dock widget, then we
+ // drop a top level widget that changes from floating to docked now
+ DockWidget::emitTopLevelEventForWidget(singleDroppedDockWidget, false);
+
+ // If there was a top level widget before the drop, then it is not top
+ // level widget anymore
+ DockWidget::emitTopLevelEventForWidget(singleDockWidget, false);
+ }
+ }
+
+ void DockContainerWidget::dropWidget(QWidget *widget, const QPoint &targetPosition)
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ DockWidget *singleDockWidget = topLevelDockWidget();
+ DockAreaWidget *dockArea = dockAreaAt(targetPosition);
+ auto dropArea = InvalidDockWidgetArea;
+ auto containerDropArea = d->m_dockManager->containerOverlay()->dropAreaUnderCursor();
+
+ if (dockArea) {
+ auto dropOverlay = d->m_dockManager->dockAreaOverlay();
+ dropOverlay->setAllowedAreas(dockArea->allowedAreas());
+ dropArea = dropOverlay->showOverlay(dockArea);
+ if (containerDropArea != InvalidDockWidgetArea && containerDropArea != dropArea) {
+ dropArea = InvalidDockWidgetArea;
+ }
+
+ if (dropArea != InvalidDockWidgetArea) {
+ qCInfo(adsLog) << "Dock Area Drop Content: " << dropArea;
+ d->moveToNewSection(widget, dockArea, dropArea);
+ }
+ }
+
+ // mouse is over container
+ if (InvalidDockWidgetArea == dropArea) {
+ dropArea = containerDropArea;
+ qCInfo(adsLog) << "Container Drop Content: " << dropArea;
+ if (dropArea != InvalidDockWidgetArea) {
+ d->moveToContainer(widget, dropArea);
+ }
+ }
+
+ // If there was a top level widget before the drop, then it is not top
+ // level widget anymore
+ DockWidget::emitTopLevelEventForWidget(singleDockWidget, false);
+ }
+
+ QList<DockAreaWidget *> DockContainerWidget::openedDockAreas() const
+ {
+ QList<DockAreaWidget *> result;
+ for (auto dockArea : d->m_dockAreas) {
+ if (!dockArea->isHidden()) {
+ result.append(dockArea);
+ }
+ }
+
+ return result;
+ }
+
+ void DockContainerWidget::saveState(QXmlStreamWriter &stream) const
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO << "isFloating " << isFloating();
+
+ stream.writeStartElement("container");
+ stream.writeAttribute("floating", QVariant::fromValue(isFloating()).toString());
+ if (isFloating()) {
+ FloatingDockContainer *floatingDockContainer = floatingWidget();
+ QByteArray geometry = floatingDockContainer->saveGeometry();
+ stream.writeTextElement("geometry", QString::fromLatin1(geometry.toBase64()));
+ }
+ d->saveChildNodesState(stream, d->m_rootSplitter);
+ stream.writeEndElement();
+ }
+
+ bool DockContainerWidget::restoreState(DockingStateReader &stateReader, bool testing)
+ {
+ QVariant floatingVar = QVariant(stateReader.attributes().value("floating").toString());
+ if (!floatingVar.canConvert<bool>()) {
+ return false;
+ }
+ bool isFloating = floatingVar.value<bool>();
+ qCInfo(adsLog) << "Restore DockContainerWidget Floating" << isFloating;
+
+ QWidget *newRootSplitter{};
+ if (!testing) {
+ d->m_visibleDockAreaCount = -1; // invalidate the dock area count
+ d->m_dockAreas.clear();
+ std::fill(std::begin(d->m_lastAddedAreaCache),
+ std::end(d->m_lastAddedAreaCache),
+ nullptr);
+ }
+
+ if (isFloating) {
+ qCInfo(adsLog) << "Restore floating widget";
+ if (!stateReader.readNextStartElement() || stateReader.name() != "geometry") {
+ return false;
+ }
+
+ QByteArray geometryString = stateReader
+ .readElementText(
+ DockingStateReader::ErrorOnUnexpectedElement)
+ .toLocal8Bit();
+ QByteArray geometry = QByteArray::fromBase64(geometryString);
+ if (geometry.isEmpty()) {
+ return false;
+ }
+
+ if (!testing) {
+ FloatingDockContainer *floatingDockContainer = floatingWidget();
+ floatingDockContainer->restoreGeometry(geometry);
+ }
+ }
+
+ if (!d->restoreChildNodes(stateReader, newRootSplitter, testing)) {
+ return false;
+ }
+
+ if (testing) {
+ return true;
+ }
+
+ // If the root splitter is empty, rostoreChildNodes returns a 0 pointer
+ // and we need to create a new empty root splitter
+ if (!newRootSplitter) {
+ newRootSplitter = d->createSplitter(Qt::Horizontal);
+ }
+
+ d->m_layout->replaceWidget(d->m_rootSplitter, newRootSplitter);
+ QSplitter *oldRoot = d->m_rootSplitter;
+ d->m_rootSplitter = qobject_cast<QSplitter *>(newRootSplitter);
+ oldRoot->deleteLater();
+
+ return true;
+ }
+
+ QSplitter *DockContainerWidget::rootSplitter() const { return d->m_rootSplitter; }
+
+ void DockContainerWidget::createRootSplitter()
+ {
+ if (d->m_rootSplitter) {
+ return;
+ }
+ d->m_rootSplitter = d->createSplitter(Qt::Horizontal);
+ d->m_layout->addWidget(d->m_rootSplitter);
+ }
+
+ void DockContainerWidget::dumpLayout() const
+ {
+#if (ADS_DEBUG_LEVEL > 0)
+ qDebug("\n\nDumping layout --------------------------");
+ std::cout << "\n\nDumping layout --------------------------" << std::endl;
+ d->dumpRecursive(0, d->m_rootSplitter);
+ qDebug("--------------------------\n\n");
+ std::cout << "--------------------------\n\n" << std::endl;
+#endif
+ }
+
+ DockAreaWidget *DockContainerWidget::lastAddedDockAreaWidget(DockWidgetArea area) const
+ {
+ return d->m_lastAddedAreaCache[areaIdToIndex(area)];
+ }
+
+ bool DockContainerWidget::hasTopLevelDockWidget() const
+ {
+ if (!isFloating()) {
+ return false;
+ }
+
+ auto dockAreas = openedDockAreas();
+ if (dockAreas.count() != 1) {
+ return false;
+ }
+
+ return dockAreas[0]->openDockWidgetsCount() == 1;
+ }
+
+ DockWidget *DockContainerWidget::topLevelDockWidget() const
+ {
+ auto dockArea = topLevelDockArea();
+ if (!dockArea) {
+ return nullptr;
+ }
+
+ auto dockWidgets = dockArea->openedDockWidgets();
+ if (dockWidgets.count() != 1) {
+ return nullptr;
+ }
+
+ return dockWidgets[0];
+ }
+
+ DockAreaWidget *DockContainerWidget::topLevelDockArea() const
+ {
+ if (!isFloating()) {
+ return nullptr;
+ }
+
+ auto dockAreas = openedDockAreas();
+ if (dockAreas.count() != 1) {
+ return nullptr;
+ }
+
+ return dockAreas[0];
+ }
+
+ QList<DockWidget *> DockContainerWidget::dockWidgets() const
+ {
+ QList<DockWidget *> result;
+ for (const auto dockArea : d->m_dockAreas) {
+ result.append(dockArea->dockWidgets());
+ }
+
+ return result;
+ }
+
+ DockWidget::DockWidgetFeatures DockContainerWidget::features() const
+ {
+ DockWidget::DockWidgetFeatures features(DockWidget::AllDockWidgetFeatures);
+ for (const auto dockArea : d->m_dockAreas) {
+ features &= dockArea->features();
+ }
+
+ return features;
+ }
+
+ FloatingDockContainer *DockContainerWidget::floatingWidget() const
+ {
+ return internal::findParent<FloatingDockContainer *>(this);
+ }
+
+ void DockContainerWidget::closeOtherAreas(DockAreaWidget *keepOpenArea)
+ {
+ for (const auto dockArea : d->m_dockAreas) {
+ if (dockArea == keepOpenArea) {
+ continue;
+ }
+
+ if (!dockArea->features(BitwiseAnd).testFlag(DockWidget::DockWidgetClosable)) {
+ continue;
+ }
+
+ // We do not close areas with widgets with custom close handling
+ if (dockArea->features(BitwiseOr).testFlag(DockWidget::CustomCloseHandling)) {
+ continue;
+ }
+
+ dockArea->closeArea();
+ }
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockcontainerwidget.h b/src/libs/advanceddockingsystem/dockcontainerwidget.h
new file mode 100644
index 00000000000..497b4caa194
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockcontainerwidget.h
@@ -0,0 +1,292 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+#include "dockwidget.h"
+
+#include <QFrame>
+
+QT_BEGIN_NAMESPACE
+class QXmlStreamWriter;
+QT_END_NAMESPACE
+
+namespace ADS {
+
+class DockContainerWidgetPrivate;
+class DockAreaWidget;
+class DockWidget;
+class DockManager;
+struct DockManagerPrivate;
+class FloatingDockContainer;
+struct FloatingDockContainerPrivate;
+class FloatingDragPreview;
+struct FloatingDragPreviewPrivate;
+class DockingStateReader;
+
+/**
+ * Container that manages a number of dock areas with single dock widgets
+ * or tabyfied dock widgets in each area.
+ * Each window that support docking has a DockContainerWidget. That means
+ * the main application window and all floating windows contain
+ * a DockContainerWidget.
+ */
+class ADS_EXPORT DockContainerWidget : public QFrame
+{
+ Q_OBJECT
+private:
+ DockContainerWidgetPrivate *d; ///< private data (pimpl)
+ friend class DockContainerWidgetPrivate;
+ friend class DockManager;
+ friend struct DockManagerPrivate;
+ friend class DockAreaWidget;
+ friend struct DockAreaWidgetPrivate;
+ friend class FloatingDockContainer;
+ friend struct FloatingDockContainerPrivate;
+ friend class DockWidget;
+ friend class FloatingDragPreview;
+ friend struct FloatingDragPreviewPrivate;
+
+protected:
+ /**
+ * Handles activation events to update zOrderIndex
+ */
+ virtual bool event(QEvent *event) override;
+
+public: // TODO temporary
+ /**
+ * Access function for the internal root splitter
+ */
+ QSplitter *rootSplitter() const;
+
+protected:
+ /**
+ * Helper function for creation of the root splitter
+ */
+ void createRootSplitter();
+
+ /**
+ * Drop floating widget into the container
+ */
+ void dropFloatingWidget(FloatingDockContainer *floatingWidget, const QPoint &targetPos);
+
+ /**
+ * Drop a dock area or a dock widget given in widget parameter
+ */
+ void dropWidget(QWidget *widget, const QPoint &targetPos);
+
+ /**
+ * Adds the given dock area to this container widget
+ */
+ void addDockArea(DockAreaWidget *dockAreaWidget, DockWidgetArea area = CenterDockWidgetArea);
+
+ /**
+ * Removes the given dock area from this container
+ */
+ void removeDockArea(DockAreaWidget *area);
+
+ /**
+ * This function replaces the goto construct. Still need to write a good description.
+ */
+ void emitAndExit() const; // TODO rename
+
+ /**
+ * Saves the state into the given stream
+ */
+ void saveState(QXmlStreamWriter &stream) const;
+
+ /**
+ * Restores the state from given stream.
+ * If Testing is true, the function only parses the data from the given
+ * stream but does not restore anything. You can use this check for
+ * faulty files before you start restoring the state
+ */
+ bool restoreState(DockingStateReader &stream, bool testing);
+
+ /**
+ * This function returns the last added dock area widget for the given
+ * area identifier or 0 if no dock area widget has been added for the given
+ * area
+ */
+ DockAreaWidget *lastAddedDockAreaWidget(DockWidgetArea area) const;
+
+ /**
+ * If hasSingleVisibleDockWidget() returns true, this function returns the
+ * one and only visible dock widget. Otherwise it returns a nullptr.
+ */
+ DockWidget *topLevelDockWidget() const;
+
+ /**
+ * Returns the top level dock area.
+ */
+ DockAreaWidget *topLevelDockArea() const;
+
+ /**
+ * This function returns a list of all dock widgets in this floating widget.
+ * It may be possible, depending on the implementation, that dock widgets,
+ * that are not visible to the user have no parent widget. Therefore simply
+ * calling findChildren() would not work here. Therefore this function
+ * iterates over all dock areas and creates a list that contains all
+ * dock widgets returned from all dock areas.
+ */
+ QList<DockWidget *> dockWidgets() const;
+
+public:
+ /**
+ * Default Constructor
+ */
+ DockContainerWidget(DockManager *dockManager, QWidget *parent = nullptr);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~DockContainerWidget() override;
+
+ /**
+ * Adds dockwidget into the given area.
+ * If DockAreaWidget is not null, then the area parameter indicates the area
+ * into the DockAreaWidget. If DockAreaWidget is null, the Dockwidget will
+ * be dropped into the container.
+ * \return Returns the dock area widget that contains the new DockWidget
+ */
+ DockAreaWidget *addDockWidget(DockWidgetArea area,
+ DockWidget *dockWidget,
+ DockAreaWidget *dockAreaWidget = nullptr);
+
+ /**
+ * Removes dockwidget
+ */
+ void removeDockWidget(DockWidget *dockWidget);
+
+ /**
+ * Returns the current zOrderIndex
+ */
+ virtual unsigned int zOrderIndex() const;
+
+ /**
+ * This function returns true if this container widgets z order index is
+ * higher than the index of the container widget given in Other parameter
+ */
+ bool isInFrontOf(DockContainerWidget *other) const;
+
+ /**
+ * Returns the dock area at the given global position or 0 if there is no
+ * dock area at this position
+ */
+ DockAreaWidget *dockAreaAt(const QPoint &globalPos) const;
+
+ /**
+ * Returns the dock area at the given Index or 0 if the index is out of
+ * range
+ */
+ DockAreaWidget *dockArea(int index) const;
+
+ /**
+ * Returns the list of dock areas that are not closed
+ * If all dock widgets in a dock area are closed, the dock area will be closed
+ */
+ QList<DockAreaWidget *> openedDockAreas() const;
+
+ /**
+ * This function returns true if this dock area has only one single
+ * visible dock widget.
+ * A top level widget is a real floating widget. Only the isFloating()
+ * function of top level widgets may returns true.
+ */
+ bool hasTopLevelDockWidget() const;
+
+ /**
+ * Returns the number of dock areas in this container
+ */
+ int dockAreaCount() const;
+
+ /**
+ * Returns the number of visible dock areas
+ */
+ int visibleDockAreaCount() const;
+
+ /**
+ * This function returns true, if this container is in a floating widget
+ */
+ bool isFloating() const;
+
+ /**
+ * Dumps the layout for debugging purposes
+ */
+ void dumpLayout() const;
+
+ /**
+ * This functions returns the dock widget features of all dock widget in
+ * this container.
+ * A bitwise and is used to combine the flags of all dock widgets. That
+ * means, if only dock widget does not support a certain flag, the whole
+ * dock are does not support the flag.
+ */
+ DockWidget::DockWidgetFeatures features() const;
+
+ /**
+ * If this dock container is in a floating widget, this function returns
+ * the floating widget.
+ * Else, it returns a nullptr.
+ */
+ FloatingDockContainer *floatingWidget() const;
+
+ /**
+ * Call this function to close all dock areas except the KeepOpenArea
+ */
+ void closeOtherAreas(DockAreaWidget *keepOpenArea);
+
+signals:
+ /**
+ * This signal is emitted if one or multiple dock areas has been added to
+ * the internal list of dock areas.
+ * If multiple dock areas are inserted, this signal is emitted only once
+ */
+ void dockAreasAdded();
+
+ /**
+ * This signal is emitted if one or multiple dock areas has been removed
+ */
+ void dockAreasRemoved();
+
+ /**
+ * This signal is emitted if a dock area is opened or closed via
+ * toggleView() function
+ */
+ void dockAreaViewToggled(DockAreaWidget *dockArea, bool open);
+}; // class DockContainerWidget
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockingstatereader.cpp b/src/libs/advanceddockingsystem/dockingstatereader.cpp
new file mode 100644
index 00000000000..3802a608502
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockingstatereader.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockingstatereader.h"
+
+namespace ADS {
+
+void DockingStateReader::setFileVersion(int fileVersion)
+{
+ m_fileVersion = fileVersion;
+}
+
+int DockingStateReader::fileVersion() const
+{
+ return m_fileVersion;
+}
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockingstatereader.h b/src/libs/advanceddockingsystem/dockingstatereader.h
new file mode 100644
index 00000000000..00141496edb
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockingstatereader.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QXmlStreamReader>
+
+namespace ADS {
+
+/**
+ * Extends QXmlStreamReader with file version information
+ */
+class DockingStateReader : public QXmlStreamReader
+{
+private:
+ int m_fileVersion;
+
+public:
+ using QXmlStreamReader::QXmlStreamReader;
+
+ /**
+ * Set the file version for this state reader
+ */
+ void setFileVersion(int fileVersion);
+
+ /**
+ * Returns the file version set via setFileVersion
+ */
+ int fileVersion() const;
+};
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockmanager.cpp b/src/libs/advanceddockingsystem/dockmanager.cpp
new file mode 100644
index 00000000000..4e1554dff22
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockmanager.cpp
@@ -0,0 +1,820 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockmanager.h"
+
+#include "ads_globals.h"
+#include "dockareawidget.h"
+#include "dockingstatereader.h"
+#include "dockoverlay.h"
+#include "dockwidget.h"
+#include "dockwidgettab.h"
+#include "floatingdockcontainer.h"
+#include "iconprovider.h"
+
+#include "workspacedialog.h"
+
+#include <utils/algorithm.h>
+#include <utils/qtcassert.h>
+
+#include <algorithm>
+#include <iostream>
+
+#include <QAction>
+#include <QApplication>
+#include <QDateTime>
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+#include <QList>
+#include <QLoggingCategory>
+#include <QMainWindow>
+#include <QMap>
+#include <QMenu>
+#include <QMessageBox>
+#include <QSettings>
+#include <QVariant>
+#include <QXmlStreamWriter>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ static DockManager::ConfigFlags g_staticConfigFlags = DockManager::DefaultNonOpaqueConfig;
+
+ /**
+ * Private data class of DockManager class (pimpl)
+ */
+ struct DockManagerPrivate
+ {
+ DockManager *q;
+ QList<FloatingDockContainer *> m_floatingWidgets;
+ QList<DockContainerWidget *> m_containers;
+ DockOverlay *m_containerOverlay;
+ DockOverlay *m_dockAreaOverlay;
+ QMap<QString, DockWidget *> m_dockWidgetsMap;
+ bool m_restoringState = false;
+ QVector<FloatingDockContainer *> m_uninitializedFloatingWidgets;
+
+ QString m_workspaceName;
+ bool m_workspaceListDirty = true;
+ QStringList m_workspaces;
+ QHash<QString, QDateTime> m_workspaceDateTimes;
+ QString m_workspaceToRestoreAtStartup;
+ bool m_autorestoreLastWorkspace; // This option is set in the Workspace Manager!
+ QSettings *m_settings;
+
+ /**
+ * Private data constructor
+ */
+ DockManagerPrivate(DockManager *parent);
+
+ /**
+ * Checks if the given data stream is a valid docking system state
+ * file.
+ */
+ bool checkFormat(const QByteArray &state, int version);
+
+ /**
+ * Restores the state
+ */
+ bool restoreStateFromXml(const QByteArray &state,
+ int version,
+ bool testing = internal::restore);
+
+ /**
+ * Restore state
+ */
+ bool restoreState(const QByteArray &state, int version);
+
+ void restoreDockWidgetsOpenState();
+ void restoreDockAreasIndices();
+ void emitTopLevelEvents();
+
+ void hideFloatingWidgets()
+ {
+ // Hide updates of floating widgets from user
+ for (auto floatingWidget : m_floatingWidgets) { // TODO qAsConst()
+ floatingWidget->hide();
+ }
+ }
+
+ void markDockWidgetsDirty()
+ {
+ for (auto dockWidget : m_dockWidgetsMap) { // TODO qAsConst()
+ dockWidget->setProperty("dirty", true);
+ }
+ }
+
+ /**
+ * Restores the container with the given index
+ */
+ bool restoreContainer(int index, DockingStateReader &stream, bool testing);
+
+ void workspaceLoadingProgress();
+ };
+ // struct DockManagerPrivate
+
+ DockManagerPrivate::DockManagerPrivate(DockManager *parent)
+ : q(parent)
+ {}
+
+ bool DockManagerPrivate::restoreContainer(int index, DockingStateReader &stream, bool testing)
+ {
+ if (testing) {
+ index = 0;
+ }
+
+ bool result = false;
+ if (index >= m_containers.count()) {
+ FloatingDockContainer *floatingWidget = new FloatingDockContainer(q);
+ result = floatingWidget->restoreState(stream, testing);
+ } else {
+ qCInfo(adsLog) << "d->m_containers[i]->restoreState ";
+ auto container = m_containers[index];
+ if (container->isFloating()) {
+ result = container->floatingWidget()->restoreState(stream, testing);
+ } else {
+ result = container->restoreState(stream, testing);
+ }
+ }
+
+ return result;
+ }
+
+ bool DockManagerPrivate::checkFormat(const QByteArray &state, int version)
+ {
+ return restoreStateFromXml(state, version, internal::restoreTesting);
+ }
+
+ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int version, bool testing)
+ {
+ Q_UNUSED(version) // TODO version is not needed, why is it in here in the first place?
+
+ if (state.isEmpty()) {
+ return false;
+ }
+ DockingStateReader stateReader(state);
+ stateReader.readNextStartElement();
+ if (stateReader.name() != "QtAdvancedDockingSystem") {
+ return false;
+ }
+ qCInfo(adsLog) << stateReader.attributes().value("version");
+ bool ok;
+ int v = stateReader.attributes().value("version").toInt(&ok);
+ if (!ok || v > CurrentVersion) {
+ return false;
+ }
+
+ stateReader.setFileVersion(v);
+ bool result = true;
+#ifdef ADS_DEBUG_PRINT
+ int dockContainers = stateReader.attributes().value("containers").toInt();
+ qCInfo(adsLog) << dockContainers;
+#endif
+ int dockContainerCount = 0;
+ while (stateReader.readNextStartElement()) {
+ if (stateReader.name() == "container") {
+ result = restoreContainer(dockContainerCount, stateReader, testing);
+ if (!result) {
+ break;
+ }
+ dockContainerCount++;
+ }
+ }
+
+ if (!testing) {
+ // Delete remaining empty floating widgets
+ int floatingWidgetIndex = dockContainerCount - 1;
+ int deleteCount = m_floatingWidgets.count() - floatingWidgetIndex;
+ for (int i = 0; i < deleteCount; ++i) {
+ m_floatingWidgets[floatingWidgetIndex + i]->deleteLater();
+ q->removeDockContainer(m_floatingWidgets[floatingWidgetIndex + i]->dockContainer());
+ }
+ }
+
+ return result;
+ }
+
+ void DockManagerPrivate::restoreDockWidgetsOpenState()
+ {
+ // All dock widgets, that have not been processed in the restore state
+ // function are invisible to the user now and have no assigned dock area
+ // They do not belong to any dock container, until the user toggles the
+ // toggle view action the next time
+ for (auto dockWidget : m_dockWidgetsMap) {
+ if (dockWidget->property(internal::dirtyProperty).toBool()) {
+ dockWidget->flagAsUnassigned();
+ emit dockWidget->viewToggled(false);
+ } else {
+ dockWidget->toggleViewInternal(
+ !dockWidget->property(internal::closedProperty).toBool());
+ }
+ }
+ }
+
+ void DockManagerPrivate::restoreDockAreasIndices()
+ {
+ // Now all dock areas are properly restored and we setup the index of
+ // The dock areas because the previous toggleView() action has changed
+ // the dock area index
+ int count = 0;
+ for (auto dockContainer : m_containers) {
+ count++;
+ for (int i = 0; i < dockContainer->dockAreaCount(); ++i) {
+ DockAreaWidget *dockArea = dockContainer->dockArea(i);
+ QString dockWidgetName = dockArea->property("currentDockWidget").toString();
+ DockWidget *dockWidget = nullptr;
+ if (!dockWidgetName.isEmpty()) {
+ dockWidget = q->findDockWidget(dockWidgetName);
+ }
+
+ if (!dockWidget || dockWidget->isClosed()) {
+ int index = dockArea->indexOfFirstOpenDockWidget();
+ if (index < 0) {
+ continue;
+ }
+ dockArea->setCurrentIndex(index);
+ } else {
+ dockArea->internalSetCurrentDockWidget(dockWidget);
+ }
+ }
+ }
+ }
+
+ void DockManagerPrivate::emitTopLevelEvents()
+ {
+ // Finally we need to send the topLevelChanged() signals for all dock
+ // widgets if top level changed
+ for (auto dockContainer : m_containers) {
+ DockWidget *topLevelDockWidget = dockContainer->topLevelDockWidget();
+ if (topLevelDockWidget) {
+ topLevelDockWidget->emitTopLevelChanged(true);
+ } else {
+ for (int i = 0; i < dockContainer->dockAreaCount(); ++i) {
+ auto dockArea = dockContainer->dockArea(i);
+ for (auto dockWidget : dockArea->dockWidgets()) {
+ dockWidget->emitTopLevelChanged(false);
+ }
+ }
+ }
+ }
+ }
+
+ bool DockManagerPrivate::restoreState(const QByteArray &state, int version)
+ {
+ QByteArray currentState = state.startsWith("<?xml") ? state : qUncompress(state);
+ if (!checkFormat(currentState, version)) {
+ qCInfo(adsLog) << "checkFormat: Error checking format!!!";
+ return false;
+ }
+
+ // Hide updates of floating widgets from use
+ hideFloatingWidgets();
+ markDockWidgetsDirty();
+
+ if (!restoreStateFromXml(currentState, version)) {
+ qCInfo(adsLog) << "restoreState: Error restoring state!!!";
+ return false;
+ }
+
+ restoreDockWidgetsOpenState();
+ restoreDockAreasIndices();
+ emitTopLevelEvents();
+
+ return true;
+ }
+
+ DockManager::DockManager(QWidget *parent)
+ : DockContainerWidget(this, parent)
+ , d(new DockManagerPrivate(this))
+ {
+ connect(this, &DockManager::workspaceListChanged, this, [=] {
+ d->m_workspaceListDirty = true;
+ });
+
+ createRootSplitter();
+ QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parent);
+ if (mainWindow) {
+ mainWindow->setCentralWidget(this);
+ }
+
+ d->m_dockAreaOverlay = new DockOverlay(this, DockOverlay::ModeDockAreaOverlay);
+ d->m_containerOverlay = new DockOverlay(this, DockOverlay::ModeContainerOverlay);
+ d->m_containers.append(this);
+ //d->loadStylesheet();
+ }
+
+ DockManager::~DockManager()
+ {
+ // If the factory default workspace is still loaded, create a default workspace just in case
+ // the layout changed as there is no tracking of layout changes.
+ if (isFactoryDefaultWorkspace(d->m_workspaceName)
+ && !isDefaultWorkspace(d->m_workspaceName)) {
+ createWorkspace(Constants::DEFAULT_NAME);
+ openWorkspace(Constants::DEFAULT_NAME);
+ }
+
+ emit aboutToUnloadWorkspace(d->m_workspaceName);
+ save();
+
+ for (auto floatingWidget : d->m_floatingWidgets) {
+ delete floatingWidget;
+ }
+ delete d;
+ }
+
+ DockManager::ConfigFlags DockManager::configFlags() { return g_staticConfigFlags; }
+
+ void DockManager::setConfigFlags(const ConfigFlags flags) { g_staticConfigFlags = flags; }
+
+ void DockManager::setConfigFlag(eConfigFlag flag, bool on)
+ {
+ internal::setFlag(g_staticConfigFlags, flag, on);
+ }
+
+ bool DockManager::testConfigFlag(eConfigFlag flag)
+ {
+ return configFlags().testFlag(flag);
+ }
+
+ IconProvider &DockManager::iconProvider()
+ {
+ static IconProvider instance;
+ return instance;
+ }
+
+ int DockManager::startDragDistance()
+ {
+ return static_cast<int>(QApplication::startDragDistance() * 1.5);
+ }
+
+ void DockManager::setSettings(QSettings *settings) { d->m_settings = settings; }
+
+ DockAreaWidget *DockManager::addDockWidget(DockWidgetArea area,
+ DockWidget *dockWidget,
+ DockAreaWidget *dockAreaWidget)
+ {
+ d->m_dockWidgetsMap.insert(dockWidget->objectName(), dockWidget);
+ return DockContainerWidget::addDockWidget(area, dockWidget, dockAreaWidget);
+ }
+
+ DockAreaWidget *DockManager::addDockWidgetTab(DockWidgetArea area, DockWidget *dockWidget)
+ {
+ DockAreaWidget *areaWidget = lastAddedDockAreaWidget(area);
+ if (areaWidget) {
+ return addDockWidget(ADS::CenterDockWidgetArea, dockWidget, areaWidget);
+ } else if (!openedDockAreas().isEmpty()) {
+ return addDockWidget(area, dockWidget, openedDockAreas().last());
+ } else {
+ return addDockWidget(area, dockWidget, nullptr);
+ }
+ }
+
+ DockAreaWidget *DockManager::addDockWidgetTabToArea(DockWidget *dockWidget,
+ DockAreaWidget *dockAreaWidget)
+ {
+ return addDockWidget(ADS::CenterDockWidgetArea, dockWidget, dockAreaWidget);
+ }
+
+ FloatingDockContainer *DockManager::addDockWidgetFloating(DockWidget *dockWidget)
+ {
+ d->m_dockWidgetsMap.insert(dockWidget->objectName(), dockWidget);
+ DockAreaWidget *oldDockArea = dockWidget->dockAreaWidget();
+ if (oldDockArea) {
+ oldDockArea->removeDockWidget(dockWidget);
+ }
+
+ dockWidget->setDockManager(this);
+ FloatingDockContainer *floatingWidget = new FloatingDockContainer(dockWidget);
+ floatingWidget->resize(dockWidget->size());
+ if (isVisible()) {
+ floatingWidget->show();
+ } else {
+ d->m_uninitializedFloatingWidgets.append(floatingWidget);
+ }
+ return floatingWidget;
+ }
+
+ void DockManager::registerFloatingWidget(FloatingDockContainer *floatingWidget)
+ {
+ d->m_floatingWidgets.append(floatingWidget);
+ emit floatingWidgetCreated(floatingWidget);
+ qCInfo(adsLog) << "d->FloatingWidgets.count() " << d->m_floatingWidgets.count();
+ }
+
+ void DockManager::removeFloatingWidget(FloatingDockContainer *floatingWidget)
+ {
+ d->m_floatingWidgets.removeAll(floatingWidget);
+ }
+
+ void DockManager::registerDockContainer(DockContainerWidget *dockContainer)
+ {
+ d->m_containers.append(dockContainer);
+ }
+
+ void DockManager::removeDockContainer(DockContainerWidget *dockContainer)
+ {
+ if (this != dockContainer) {
+ d->m_containers.removeAll(dockContainer);
+ }
+ }
+
+ DockOverlay *DockManager::containerOverlay() const { return d->m_containerOverlay; }
+
+ DockOverlay *DockManager::dockAreaOverlay() const { return d->m_dockAreaOverlay; }
+
+ const QList<DockContainerWidget *> DockManager::dockContainers() const
+ {
+ return d->m_containers;
+ }
+
+ const QList<FloatingDockContainer *> DockManager::floatingWidgets() const
+ {
+ return d->m_floatingWidgets;
+ }
+
+ unsigned int DockManager::zOrderIndex() const { return 0; }
+
+ QByteArray DockManager::saveState(int version) const
+ {
+ QByteArray xmlData;
+ QXmlStreamWriter stream(&xmlData);
+ auto configFlags = DockManager::configFlags();
+ stream.setAutoFormatting(configFlags.testFlag(XmlAutoFormattingEnabled));
+ stream.writeStartDocument();
+ stream.writeStartElement("QtAdvancedDockingSystem");
+ stream.writeAttribute("version", QString::number(version));
+ stream.writeAttribute("containers", QString::number(d->m_containers.count()));
+ for (auto container : d->m_containers) {
+ container->saveState(stream);
+ }
+
+ stream.writeEndElement();
+ stream.writeEndDocument();
+ return xmlData;
+ }
+
+ bool DockManager::restoreState(const QByteArray &state, int version)
+ {
+ // Prevent multiple calls as long as state is not restore. This may
+ // happen, if QApplication::processEvents() is called somewhere
+ if (d->m_restoringState) {
+ return false;
+ }
+
+ // We hide the complete dock manager here. Restoring the state means
+ // that DockWidgets are removed from the DockArea internal stack layout
+ // which in turn means, that each time a widget is removed the stack
+ // will show and raise the next available widget which in turn
+ // triggers show events for the dock widgets. To avoid this we hide the
+ // dock manager. Because there will be no processing of application
+ // events until this function is finished, the user will not see this
+ // hiding
+ bool isHidden = this->isHidden();
+ if (!isHidden) {
+ hide();
+ }
+ d->m_restoringState = true;
+ emit restoringState();
+ bool result = d->restoreState(state, version);
+ d->m_restoringState = false;
+ emit stateRestored();
+ if (!isHidden) {
+ show();
+ }
+
+ return result;
+ }
+
+ void DockManager::showEvent(QShowEvent *event)
+ {
+ Super::showEvent(event);
+ if (d->m_uninitializedFloatingWidgets.empty()) {
+ return;
+ }
+
+ for (auto floatingWidget : d->m_uninitializedFloatingWidgets) {
+ floatingWidget->show();
+ }
+ d->m_uninitializedFloatingWidgets.clear();
+ }
+
+ DockWidget *DockManager::findDockWidget(const QString &objectName) const
+ {
+ return d->m_dockWidgetsMap.value(objectName, nullptr);
+ }
+
+ void DockManager::removeDockWidget(DockWidget *dockWidget)
+ {
+ emit dockWidgetAboutToBeRemoved(dockWidget);
+ d->m_dockWidgetsMap.remove(dockWidget->objectName());
+ DockContainerWidget::removeDockWidget(dockWidget);
+ emit dockWidgetRemoved(dockWidget);
+ }
+
+ QMap<QString, DockWidget *> DockManager::dockWidgetsMap() const { return d->m_dockWidgetsMap; }
+
+ bool DockManager::isRestoringState() const { return d->m_restoringState; }
+
+ void DockManager::showWorkspaceMananger()
+ {
+ // Save current workspace
+ save();
+
+ WorkspaceDialog workspaceDialog(this, parentWidget());
+ workspaceDialog.setAutoLoadWorkspace(autoRestorLastWorkspace());
+ workspaceDialog.exec();
+
+ QTC_ASSERT(d->m_settings, return );
+ d->m_settings->setValue(Constants::AUTO_RESTORE_WORKSPACE_SETTINGS_KEY,
+ workspaceDialog.autoLoadWorkspace());
+ }
+
+ bool DockManager::isFactoryDefaultWorkspace(const QString &workspace) const
+ {
+ return workspace == QLatin1String(Constants::FACTORY_DEFAULT_NAME);
+ }
+
+ bool DockManager::isDefaultWorkspace(const QString &workspace) const
+ {
+ return workspace == QLatin1String(Constants::DEFAULT_NAME);
+ }
+
+ bool DockManager::save()
+ {
+ if (isFactoryDefaultWorkspace(activeWorkspace()))
+ return true;
+
+ emit aboutToSaveWorkspace();
+
+ bool result = write(saveState(), parentWidget());
+ if (result) {
+ d->m_workspaceDateTimes.insert(activeWorkspace(), QDateTime::currentDateTime());
+ } else {
+ QMessageBox::warning(parentWidget(),
+ tr("Cannot Save Session"),
+ tr("Could not save session to file %1")
+ .arg(workspaceNameToFileName(d->m_workspaceName)
+ .toUserOutput()));
+ }
+
+ return result;
+ }
+
+ QString DockManager::activeWorkspace() const { return d->m_workspaceName; }
+
+ QString DockManager::lastWorkspace() const
+ {
+ QTC_ASSERT(d->m_settings, return {});
+ return d->m_settings->value(Constants::STARTUP_WORKSPACE_SETTINGS_KEY).toString();
+ }
+
+ bool DockManager::autoRestorLastWorkspace() const
+ {
+ QTC_ASSERT(d->m_settings, return false);
+ return d->m_settings->value(Constants::AUTO_RESTORE_WORKSPACE_SETTINGS_KEY).toBool();
+ }
+
+ const QString m_dirName = QLatin1String("workspaces");
+ const QString m_fileExt = QLatin1String(".wrk"); // TODO
+
+ QStringList DockManager::workspaces()
+ {
+ if (d->m_workspaces.isEmpty() || d->m_workspaceListDirty) {
+ auto tmp = Utils::toSet(d->m_workspaces);
+
+ QTC_ASSERT(d->m_settings, return {});
+ QDir workspaceDir(QFileInfo(d->m_settings->fileName()).path() + QLatin1Char('/')
+ + m_dirName);
+ QFileInfoList workspaceFiles
+ = workspaceDir.entryInfoList(QStringList() << QLatin1String("*.wrk"),
+ QDir::NoFilter,
+ QDir::Time); // TODO Choose different extension
+ for (const QFileInfo &fileInfo : workspaceFiles) {
+ QString filename = fileInfo.completeBaseName();
+ filename.replace("_", " ");
+ d->m_workspaceDateTimes.insert(filename, fileInfo.lastModified());
+ //if (name != QLatin1String(Constants::DEFAULT_NAME))
+ tmp.insert(filename);
+ }
+ //d->m_workspaces.prepend(QLatin1String(Constants::DEFAULT_NAME));
+
+ d->m_workspaceListDirty = false;
+ d->m_workspaces = Utils::toList(tmp);
+ }
+ return d->m_workspaces;
+ }
+
+ QDateTime DockManager::workspaceDateTime(const QString &workspace) const
+ {
+ return d->m_workspaceDateTimes.value(workspace);
+ }
+
+ Utils::FilePath DockManager::workspaceNameToFileName(const QString &workspaceName) const
+ {
+ QTC_ASSERT(d->m_settings, return {});
+ QString workspaceNameCopy = workspaceName;
+ return Utils::FilePath::fromString(
+ QFileInfo(d->m_settings->fileName()).path() + QLatin1Char('/') + m_dirName
+ + QLatin1Char('/') + workspaceNameCopy.replace(" ", "_") + QLatin1String(".wrk"));
+ }
+
+ /**
+ * Creates \a workspace, but does not actually create the file.
+ */
+ bool DockManager::createWorkspace(const QString &workspace)
+ {
+ if (workspaces().contains(workspace))
+ return false;
+ d->m_workspaces.insert(1, workspace);
+ d->m_workspaceDateTimes.insert(workspace, QDateTime::currentDateTime());
+
+ emit workspaceListChanged();
+
+ return true;
+ }
+
+ bool DockManager::openWorkspace(const QString &workspace)
+ {
+ // Do nothing if we have that workspace already loaded, exception if the
+ // workspace is the default virgin workspace we still want to be able to
+ // load the default workspace.
+ if (workspace == d->m_workspaceName) // && !isFactoryDefaultWorkspace(workspace))
+ return true;
+
+ if (!workspaces().contains(workspace))
+ return false;
+
+ // Check if the currently active workspace isn't empty and try to save it
+ if (!d->m_workspaceName.isEmpty()) {
+ // Allow everyone to set something in the workspace and before saving
+ emit aboutToUnloadWorkspace(d->m_workspaceName);
+ if (!save()) {
+ return false;
+ }
+ }
+
+ // Try loading the file
+ QByteArray data;
+ Utils::FilePath fileName = workspaceNameToFileName(workspace);
+ if (fileName.exists()) {
+ QFile file(fileName.toString());
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QMessageBox::warning(parentWidget(),
+ tr("Cannot Restore Workspace"),
+ tr("Could not restore workspace %1")
+ .arg(fileName.toUserOutput()));
+ return false;
+ }
+ data = file.readAll();
+ file.close();
+ }
+
+ emit openingWorkspace(workspace);
+ // If data was loaded from file try to restore its state
+ if (!data.isNull() && !restoreState(data)) {
+ return false;
+ }
+ d->m_workspaceName = workspace;
+ emit workspaceLoaded(workspace);
+
+ return true;
+ }
+
+ /**
+ * \brief Shows a dialog asking the user to confirm deleting the workspace \p workspace
+ */
+ bool DockManager::confirmWorkspaceDelete(const QStringList &workspace)
+ {
+ const QString title = workspace.size() == 1 ? tr("Delete Workspace")
+ : tr("Delete Workspaces");
+ const QString question = workspace.size() == 1
+ ? tr("Delete workspace %1?").arg(workspace.first())
+ : tr("Delete these workspaces?\n %1")
+ .arg(workspace.join("\n "));
+ return QMessageBox::question(parentWidget(),
+ title,
+ question,
+ QMessageBox::Yes | QMessageBox::No)
+ == QMessageBox::Yes;
+ }
+
+ /**
+ * Deletes \a workspace name from workspace list and the file from disk.
+ */
+ bool DockManager::deleteWorkspace(const QString &workspace)
+ {
+ // Remove workspace from internal list
+ if (!d->m_workspaces.contains(workspace))
+ return false;
+ d->m_workspaces.removeOne(workspace);
+
+ emit workspacesRemoved();
+ emit workspaceListChanged();
+
+ // Remove corresponding workspace file
+ QFile fi(workspaceNameToFileName(workspace).toString());
+ if (fi.exists())
+ return fi.remove();
+
+ return false; // TODO If we allow temporary workspaces without writing them to file
+ // directly, this needs to be true otherwise in all those cases it will return false.
+ }
+
+ void DockManager::deleteWorkspaces(const QStringList &workspaces)
+ {
+ for (const QString &workspace : workspaces)
+ deleteWorkspace(workspace);
+ }
+
+ bool DockManager::cloneWorkspace(const QString &original, const QString &clone)
+ {
+ if (!d->m_workspaces.contains(original))
+ return false;
+
+ QFile fi(workspaceNameToFileName(original).toString());
+ // If the file does not exist, we can still clone
+ if (!fi.exists() || fi.copy(workspaceNameToFileName(clone).toString())) {
+ d->m_workspaces.insert(1, clone);
+ d->m_workspaceDateTimes
+ .insert(clone, workspaceNameToFileName(clone).toFileInfo().lastModified());
+ return true;
+ }
+ return false;
+ }
+
+ bool DockManager::renameWorkspace(const QString &original, const QString &newName)
+ {
+ if (!cloneWorkspace(original, newName))
+ return false;
+ if (original == activeWorkspace())
+ openWorkspace(newName);
+ return deleteWorkspace(original);
+ }
+
+ bool DockManager::write(const QByteArray &data, QString *errorString) const
+ {
+ Utils::FilePath fileName = workspaceNameToFileName(activeWorkspace());
+
+ QDir tmp;
+ tmp.mkpath(fileName.toFileInfo().path());
+ Utils::FileSaver fileSaver(fileName.toString(), QIODevice::Text);
+ if (!fileSaver.hasError()) {
+ fileSaver.write(data);
+ }
+ bool ok = fileSaver.finalize();
+
+ if (!ok && errorString) {
+ *errorString = fileSaver.errorString();
+ }
+
+ return ok;
+ }
+
+#ifdef QT_GUI_LIB
+ bool DockManager::write(const QByteArray &data, QWidget *parent) const
+ {
+ QString errorString;
+ const bool success = write(data, &errorString);
+ if (!success)
+ QMessageBox::critical(parent,
+ QCoreApplication::translate("Utils::FileSaverBase", "File Error"),
+ errorString);
+ return success;
+ }
+#endif // QT_GUI_LIB
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockmanager.h b/src/libs/advanceddockingsystem/dockmanager.h
new file mode 100644
index 00000000000..a788e82d6a1
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockmanager.h
@@ -0,0 +1,480 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+#include "dockcontainerwidget.h"
+#include "dockwidget.h"
+#include "floatingdockcontainer.h"
+
+#include <utils/persistentsettings.h>
+
+#include <QByteArray>
+#include <QDateTime>
+#include <QFlags>
+#include <QList>
+#include <QMap>
+#include <QString>
+#include <QStringList>
+#include <QtGui/QIcon>
+#include <qobjectdefs.h>
+
+QT_BEGIN_NAMESPACE
+class QMenu;
+class QSettings;
+QT_END_NAMESPACE
+
+namespace ADS {
+
+namespace Constants {
+const char FACTORY_DEFAULT_NAME[] = "factorydefault";
+const char DEFAULT_NAME[] = "default";
+const char STARTUP_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/StartupWorkspace";
+const char AUTO_RESTORE_WORKSPACE_SETTINGS_KEY[] = "QML/Designer/AutoRestoreLastWorkspace";
+} // namespace Constants
+
+struct DockManagerPrivate;
+class FloatingDockContainer;
+struct FloatingDockContainerPrivate;
+class DockComponentsFactory;
+class DockContainerWidget;
+class DockContainerWidgetPrivate;
+class DockOverlay;
+class DockAreaTabBar;
+class DockWidgetTab;
+struct DockWidgetTabPrivate;
+struct DockAreaWidgetPrivate;
+class IconProvider;
+
+/**
+ * The central dock manager that maintains the complete docking system.
+ * With the configuration flags you can globally control the functionality
+ * of the docking system. The dock manager uses an internal stylesheet to
+ * style its components like splitters, tabs and buttons. If you want to
+ * disable this stylesheet because your application uses its own,
+ * just call the function for settings the stylesheet with an empty
+ * string.
+ * \code
+ * dockManager->setStyleSheet("");
+ * \endcode
+ **/
+class ADS_EXPORT DockManager : public DockContainerWidget
+{
+ Q_OBJECT
+private:
+ DockManagerPrivate *d; ///< private data (pimpl)
+ friend struct DockManagerPrivate;
+ friend class FloatingDockContainer;
+ friend struct FloatingDockContainerPrivate;
+ friend class DockContainerWidget;
+ friend class DockContainerWidgetPrivate;
+ friend class DockAreaTabBar;
+ friend class DockWidgetTab;
+ friend struct DockAreaWidgetPrivate;
+ friend struct DockWidgetTabPrivate;
+ friend class FloatingDragPreview;
+ friend struct FloatingDragPreviewPrivate;
+ friend class DockAreaTitleBar;
+
+protected:
+ /**
+ * Registers the given floating widget in the internal list of
+ * floating widgets
+ */
+ void registerFloatingWidget(FloatingDockContainer *floatingWidget);
+
+ /**
+ * Remove the given floating widget from the list of registered floating
+ * widgets
+ */
+ void removeFloatingWidget(FloatingDockContainer *floatingWidget);
+
+ /**
+ * Registers the given dock container widget
+ */
+ void registerDockContainer(DockContainerWidget *dockContainer);
+
+ /**
+ * Remove dock container from the internal list of registered dock
+ * containers
+ */
+ void removeDockContainer(DockContainerWidget *dockContainer);
+
+ /**
+ * Overlay for containers
+ */
+ DockOverlay *containerOverlay() const;
+
+ /**
+ * Overlay for dock areas
+ */
+ DockOverlay *dockAreaOverlay() const;
+
+ /**
+ * Show the floating widgets that has been created floating
+ */
+ virtual void showEvent(QShowEvent *event) override;
+
+public:
+ using Super = DockContainerWidget;
+
+ /**
+ * These global configuration flags configure some global dock manager
+ * settings.
+ */
+ enum eConfigFlag {
+ ActiveTabHasCloseButton
+ = 0x0001, //!< If this flag is set, the active tab in a tab area has a close button
+ DockAreaHasCloseButton
+ = 0x0002, //!< If the flag is set each dock area has a close button
+ DockAreaCloseButtonClosesTab
+ = 0x0004, //!< If the flag is set, the dock area close button closes the active tab, if not set, it closes the complete dock area
+ OpaqueSplitterResize
+ = 0x0008, //!< See QSplitter::setOpaqueResize() documentation
+ XmlAutoFormattingEnabled
+ = 0x0010, //!< If enabled, the XML writer automatically adds line-breaks and indentation to empty sections between elements (ignorable whitespace).
+ XmlCompressionEnabled
+ = 0x0020, //!< If enabled, the XML output will be compressed and is not human readable anymore
+ TabCloseButtonIsToolButton
+ = 0x0040, //! If enabled the tab close buttons will be QToolButtons instead of QPushButtons - disabled by default
+ AllTabsHaveCloseButton
+ = 0x0080, //!< if this flag is set, then all tabs that are closable show a close button
+ RetainTabSizeWhenCloseButtonHidden
+ = 0x0100, //!< if this flag is set, the space for the close button is reserved even if the close button is not visible
+ OpaqueUndocking
+ = 0x0200, ///< If enabled, the widgets are immediately undocked into floating widgets, if disabled, only a draw preview is undocked and the real undocking is deferred until the mouse is released
+ DragPreviewIsDynamic
+ = 0x0400, ///< If opaque undocking is disabled, this flag defines the behavior of the drag preview window, if this flag is enabled, the preview will be adjusted dynamically to the drop area
+ DragPreviewShowsContentPixmap
+ = 0x0800, ///< If opaque undocking is disabled, the created drag preview window shows a copy of the content of the dock widget / dock are that is dragged
+ DragPreviewHasWindowFrame
+ = 0x1000, ///< If opaque undocking is disabled, then this flag configures if the drag preview is frameless or looks like a real window
+ AlwaysShowTabs
+ = 0x2000, ///< If this option is enabled, the tab of a dock widget is always displayed - even if it is the only visible dock widget in a floating widget.
+ DockAreaHasUndockButton
+ = 0x4000, //!< If the flag is set each dock area has an undock button
+ DockAreaHasTabsMenuButton
+ = 0x8000, //!< If the flag is set each dock area has a tabs menu button
+ DockAreaHideDisabledButtons
+ = 0x10000, //!< If the flag is set disabled dock area buttons will not appear on the tollbar at all (enabling them will bring them back)
+ DockAreaDynamicTabsMenuButtonVisibility
+ = 0x20000, //!< If the flag is set dock area will disable a tabs menu button when there is only one tab in the area
+ FloatingContainerHasWidgetTitle
+ = 0x40000,
+ FloatingContainerHasWidgetIcon
+ = 0x80000,
+
+ DefaultDockAreaButtons = DockAreaHasCloseButton
+ | DockAreaHasUndockButton
+ | DockAreaHasTabsMenuButton,///< default configuration of dock area title bar buttons
+
+ DefaultBaseConfig = DefaultDockAreaButtons
+ | ActiveTabHasCloseButton
+ | XmlCompressionEnabled
+ | FloatingContainerHasWidgetTitle,///< default base configuration settings
+
+ DefaultOpaqueConfig = DefaultBaseConfig
+ | OpaqueSplitterResize
+ | OpaqueUndocking, ///< the default configuration with opaque operations - this may cause issues if ActiveX or Qt 3D windows are involved
+
+ DefaultNonOpaqueConfig = DefaultBaseConfig
+ | DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations
+
+ NonOpaqueWithWindowFrame = DefaultNonOpaqueConfig
+ | DragPreviewHasWindowFrame ///< the default configuration for non opaque operations that show a real window with frame
+ };
+ Q_DECLARE_FLAGS(ConfigFlags, eConfigFlag)
+
+ /**
+ * Default Constructor.
+ * If the given parent is a QMainWindow, the dock manager sets itself as the
+ * central widget.
+ * Before you create any dock widgets, you should properly setup the
+ * configuration flags via setConfigFlags().
+ */
+ DockManager(QWidget *parent = nullptr);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~DockManager() override;
+
+ /**
+ * This function returns the global configuration flags
+ */
+ static ConfigFlags configFlags();
+
+ /**
+ * Sets the global configuration flags for the whole docking system.
+ * Call this function before you create your first dock widget.
+ */
+ static void setConfigFlags(const ConfigFlags flags);
+
+ /**
+ * Set a certain config flag
+ */
+ static void setConfigFlag(eConfigFlag flag, bool on = true);
+
+ /**
+ * Returns true if the given config flag is set
+ */
+ static bool testConfigFlag(eConfigFlag flag);
+
+ /**
+ * Returns the global icon provider.
+ * The icon provider enables the use of custom icons in case using
+ * styleheets for icons is not an option.
+ */
+ static IconProvider &iconProvider();
+
+ /**
+ * The distance the user needs to move the mouse with the left button
+ * hold down before a dock widget start floating
+ */
+ static int startDragDistance();
+
+ /**
+ * Set the QtCreator settings.
+ */
+ void setSettings(QSettings *settings);
+
+ /**
+ * Adds dockwidget into the given area.
+ * If DockAreaWidget is not null, then the area parameter indicates the area
+ * into the DockAreaWidget. If DockAreaWidget is null, the Dockwidget will
+ * be dropped into the container. If you would like to add a dock widget
+ * tabified, then you need to add it to an existing dock area object
+ * into the CenterDockWidgetArea. The following code shows this:
+ * \code
+ * DockManager->addDockWidget(ads::CenterDockWidgetArea, NewDockWidget,
+ * ExisitingDockArea);
+ * \endcode
+ * \return Returns the dock area widget that contains the new DockWidget
+ */
+ DockAreaWidget *addDockWidget(DockWidgetArea area,
+ DockWidget *dockWidget,
+ DockAreaWidget *dockAreaWidget = nullptr);
+
+ /**
+ * This function will add the given Dockwidget to the given dock area as
+ * a new tab.
+ * If no dock area widget exists for the given area identifier, a new
+ * dock area widget is created.
+ */
+ DockAreaWidget *addDockWidgetTab(DockWidgetArea area, DockWidget *dockWidget);
+
+ /**
+ * This function will add the given Dockwidget to the given DockAreaWidget
+ * as a new tab.
+ */
+ DockAreaWidget *addDockWidgetTabToArea(DockWidget *dockWidget, DockAreaWidget *dockAreaWidget);
+
+ /**
+ * Adds the given DockWidget floating and returns the created
+ * CFloatingDockContainer instance.
+ */
+ FloatingDockContainer *addDockWidgetFloating(DockWidget *dockWidget);
+
+ /**
+ * Searches for a registered doc widget with the given ObjectName
+ * \return Return the found dock widget or nullptr if a dock widget with the
+ * given name is not registered
+ */
+ DockWidget *findDockWidget(const QString &objectName) const;
+
+ /**
+ * Remove the given Dock from the dock manager
+ */
+ void removeDockWidget(DockWidget *dockWidget);
+
+ /**
+ * This function returns a readable reference to the internal dock
+ * widgets map so that it is possible to iterate over all dock widgets
+ */
+ QMap<QString, DockWidget *> dockWidgetsMap() const;
+
+ /**
+ * Returns the list of all active and visible dock containers
+ * Dock containers are the main dock manager and all floating widgets
+ */
+ const QList<DockContainerWidget *> dockContainers() const;
+
+ /**
+ * Returns the list of all floating widgets
+ */
+ const QList<FloatingDockContainer *> floatingWidgets() const;
+
+ /**
+ * This function always return 0 because the main window is always behind
+ * any floating widget
+ */
+ virtual unsigned int zOrderIndex() const override;
+
+ /**
+ * Saves the current state of the dockmanger and all its dock widgets
+ * into the returned QByteArray.
+ * The XmlMode enables / disables the auto formatting for the XmlStreamWriter.
+ * If auto formatting is enabled, the output is intended and line wrapped.
+ * The XmlMode XmlAutoFormattingDisabled is better if you would like to have
+ * a more compact XML output - i.e. for storage in ini files.
+ */
+ QByteArray saveState(int version = Version1) const;
+
+ /**
+ * Restores the state of this dockmanagers dockwidgets.
+ * The version number is compared with that stored in state. If they do
+ * not match, the dockmanager's state is left unchanged, and this function
+ * returns false; otherwise, the state is restored, and this function
+ * returns true.
+ */
+ bool restoreState(const QByteArray &state, int version = Version1);
+
+ /**
+ * This function returns true between the restoringState() and
+ * stateRestored() signals.
+ */
+ bool isRestoringState() const;
+
+signals:
+ /**
+ * This signal is emitted if the list of perspectives changed
+ */
+ void workspaceListChanged();
+
+ /**
+ * This signal is emitted if perspectives have been removed
+ */
+ void workspacesRemoved();
+
+ /**
+ * This signal is emitted, if the restore function is called, just before
+ * the dock manager starts restoring the state.
+ * If this function is called, nothing has changed yet
+ */
+ void restoringState();
+
+ /**
+ * This signal is emitted if the state changed in restoreState.
+ * The signal is emitted if the restoreState() function is called or
+ * if the openWorkspace() function is called
+ */
+ void stateRestored();
+
+ /**
+ * This signal is emitted, if the dock manager starts opening a
+ * perspective.
+ * Opening a perspective may take more than a second if there are
+ * many complex widgets. The application may use this signal
+ * to show some progress indicator or to change the mouse cursor
+ * into a busy cursor.
+ */
+ void openingWorkspace(const QString &workspaceName);
+
+ /**
+ * This signal is emitted if the dock manager finished opening a
+ * perspective
+ */
+ void workspaceOpened(const QString &workspaceName);
+
+ /**
+ * This signal is emitted, if a new floating widget has been created.
+ * An application can use this signal to e.g. subscribe to events of
+ * the newly created window.
+ */
+ void floatingWidgetCreated(FloatingDockContainer *floatingWidget);
+
+ /**
+ * This signal is emitted, if a new DockArea has been created.
+ * An application can use this signal to set custom icons or custom
+ * tooltips for the DockArea buttons.
+ */
+ void dockAreaCreated(DockAreaWidget *dockArea);
+
+ /**
+ * This signal is emitted just before the given dock widget is removed
+ * from the
+ */
+ void dockWidgetAboutToBeRemoved(DockWidget *dockWidget);
+
+ /**
+ * This signal is emitted if a dock widget has been removed with the remove
+ * removeDockWidget() function.
+ * If this signal is emitted, the dock widget has been removed from the
+ * docking system but it is not deleted yet.
+ */
+ void dockWidgetRemoved(DockWidget *dockWidget);
+
+public:
+ void showWorkspaceMananger();
+
+ // higher level workspace management
+ QString activeWorkspace() const;
+ QString lastWorkspace() const;
+ bool autoRestorLastWorkspace() const;
+ QStringList workspaces();
+ QDateTime workspaceDateTime(const QString &workspace) const;
+ Utils::FilePath workspaceNameToFileName(const QString &workspaceName) const;
+
+ bool createWorkspace(const QString &workspace);
+
+ bool openWorkspace(const QString &workspace);
+
+ bool confirmWorkspaceDelete(const QStringList &workspaces);
+ bool deleteWorkspace(const QString &workspace);
+ void deleteWorkspaces(const QStringList &workspaces);
+
+ bool cloneWorkspace(const QString &original, const QString &clone);
+ bool renameWorkspace(const QString &original, const QString &newName);
+
+ bool save();
+
+ bool isFactoryDefaultWorkspace(const QString &workspace) const;
+ bool isDefaultWorkspace(const QString &workspace) const;
+
+signals:
+ void aboutToUnloadWorkspace(QString workspaceName);
+ void aboutToLoadWorkspace(QString workspaceName);
+ void workspaceLoaded(QString workspaceName);
+ void aboutToSaveWorkspace();
+
+private:
+ bool write(const QByteArray &data, QString *errorString) const;
+#ifdef QT_GUI_LIB
+ bool write(const QByteArray &data, QWidget *parent) const;
+#endif
+}; // class DockManager
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockoverlay.cpp b/src/libs/advanceddockingsystem/dockoverlay.cpp
new file mode 100644
index 00000000000..a42962a5f56
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockoverlay.cpp
@@ -0,0 +1,773 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockoverlay.h"
+
+#include "dockareawidget.h"
+
+#include <utils/hostosinfo.h>
+
+#include <QCursor>
+#include <QGridLayout>
+#include <QIcon>
+#include <QLabel>
+#include <QMap>
+#include <QMoveEvent>
+#include <QPaintEvent>
+#include <QPainter>
+#include <QPointer>
+#include <QResizeEvent>
+#include <QWindow>
+#include <QtGlobal>
+
+#include <iostream>
+
+namespace ADS {
+
+ /**
+ * Private data class of DockOverlay
+ */
+ struct DockOverlayPrivate
+ {
+ DockOverlay *q;
+ DockWidgetAreas m_allowedAreas = InvalidDockWidgetArea;
+ DockOverlayCross *m_cross;
+ QPointer<QWidget> m_targetWidget;
+ DockWidgetArea m_lastLocation = InvalidDockWidgetArea;
+ bool m_dropPreviewEnabled = true;
+ DockOverlay::eMode m_mode = DockOverlay::ModeDockAreaOverlay;
+ QRect m_dropAreaRect;
+
+ /**
+ * Private data constructor
+ */
+ DockOverlayPrivate(DockOverlay *parent)
+ : q(parent)
+ {}
+ };
+
+ /**
+ * Private data of DockOverlayCross class
+ */
+ struct DockOverlayCrossPrivate
+ {
+ DockOverlayCross *q;
+ DockOverlay::eMode m_mode = DockOverlay::ModeDockAreaOverlay;
+ DockOverlay *m_dockOverlay;
+ QHash<DockWidgetArea, QWidget *> m_dropIndicatorWidgets;
+ QGridLayout *m_gridLayout;
+ QColor m_iconColors[5];
+ bool m_updateRequired = false;
+ double m_lastDevicePixelRatio = 0.1;
+
+ /**
+ * Private data constructor
+ */
+ DockOverlayCrossPrivate(DockOverlayCross *parent)
+ : q(parent)
+ {}
+
+ /**
+ * @param area
+ * @return
+ */
+ QPoint areaGridPosition(const DockWidgetArea area);
+
+ /**
+ * Palette based default icon colors
+ */
+ QColor defaultIconColor(DockOverlayCross::eIconColor colorIndex)
+ {
+ QPalette palette = q->palette();
+ switch (colorIndex) {
+ case DockOverlayCross::FrameColor:
+ return palette.color(QPalette::Active, QPalette::Highlight);
+ case DockOverlayCross::WindowBackgroundColor:
+ return palette.color(QPalette::Active, QPalette::Base);
+ case DockOverlayCross::OverlayColor: {
+ QColor color = palette.color(QPalette::Active, QPalette::Highlight);
+ color.setAlpha(64);
+ return color;
+ }
+ case DockOverlayCross::ArrowColor:
+ return palette.color(QPalette::Active, QPalette::Base);
+ case DockOverlayCross::ShadowColor:
+ return QColor(0, 0, 0, 64);
+ }
+
+ return QColor();
+ }
+
+ /**
+ * Stylehseet based icon colors
+ */
+ QColor iconColor(DockOverlayCross::eIconColor colorIndex)
+ {
+ QColor color = m_iconColors[colorIndex];
+ if (!color.isValid()) {
+ color = defaultIconColor(colorIndex);
+ m_iconColors[colorIndex] = color;
+ }
+ return color;
+ }
+
+ /**
+ * Helper function that returns the drop indicator width depending on the
+ * operating system
+ */
+ qreal dropIndicatiorWidth(QLabel *label) const
+ {
+#ifdef Q_OS_LINUX
+ Q_UNUSED(label)
+ return 40;
+#else
+ return static_cast<qreal>(label->fontMetrics().height()) * 3.f;
+#endif
+ }
+
+ QWidget *createDropIndicatorWidget(DockWidgetArea dockWidgetArea, DockOverlay::eMode mode)
+ {
+ QLabel *label = new QLabel();
+ label->setObjectName("DockWidgetAreaLabel");
+
+ const qreal metric = dropIndicatiorWidth(label);
+ const QSizeF size(metric, metric);
+
+ label->setPixmap(createHighDpiDropIndicatorPixmap(size, dockWidgetArea, mode));
+ label->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
+ label->setAttribute(Qt::WA_TranslucentBackground);
+ label->setProperty("dockWidgetArea", dockWidgetArea);
+ return label;
+ }
+
+ void updateDropIndicatorIcon(QWidget *dropIndicatorWidget)
+ {
+ QLabel *label = qobject_cast<QLabel *>(dropIndicatorWidget);
+ const qreal metric = dropIndicatiorWidth(label);
+ const QSizeF size(metric, metric);
+
+ int area = label->property("dockWidgetArea").toInt();
+ label->setPixmap(createHighDpiDropIndicatorPixmap(size,
+ static_cast<DockWidgetArea>(area),
+ m_mode)); // TODO
+ }
+
+ QPixmap createHighDpiDropIndicatorPixmap(const QSizeF &size,
+ DockWidgetArea dockWidgetArea,
+ DockOverlay::eMode mode)
+ {
+ QColor borderColor = iconColor(DockOverlayCross::FrameColor);
+ QColor backgroundColor = iconColor(DockOverlayCross::WindowBackgroundColor);
+ double devicePixelRatio = q->window()->devicePixelRatioF();
+ QSizeF pixmapSize = size * devicePixelRatio;
+ QPixmap pixmap(pixmapSize.toSize());
+ pixmap.fill(QColor(0, 0, 0, 0));
+
+ QPainter painter(&pixmap);
+ QPen pen = painter.pen();
+ QRectF shadowRect(pixmap.rect());
+ QRectF baseRect;
+ baseRect.setSize(shadowRect.size() * 0.7);
+ baseRect.moveCenter(shadowRect.center());
+
+ // Fill
+ QColor shadowColor = iconColor(DockOverlayCross::ShadowColor);
+ if (shadowColor.alpha() == 255) {
+ shadowColor.setAlpha(64);
+ }
+ painter.fillRect(shadowRect, shadowColor);
+
+ // Drop area rect.
+ painter.save();
+ QRectF areaRect;
+ QLineF areaLine;
+ QRectF nonAreaRect;
+ switch (dockWidgetArea) {
+ case TopDockWidgetArea:
+ areaRect = QRectF(baseRect.x(), baseRect.y(), baseRect.width(), baseRect.height() * 0.5);
+ nonAreaRect = QRectF(baseRect.x(),
+ shadowRect.height() * 0.5,
+ baseRect.width(),
+ baseRect.height() * 0.5);
+ areaLine = QLineF(areaRect.bottomLeft(), areaRect.bottomRight());
+ break;
+ case RightDockWidgetArea:
+ areaRect = QRectF(shadowRect.width() * 0.5,
+ baseRect.y(),
+ baseRect.width() * 0.5,
+ baseRect.height());
+ nonAreaRect = QRectF(baseRect.x(),
+ baseRect.y(),
+ baseRect.width() * 0.5,
+ baseRect.height());
+ areaLine = QLineF(areaRect.topLeft(), areaRect.bottomLeft());
+ break;
+ case BottomDockWidgetArea:
+ areaRect = QRectF(baseRect.x(),
+ shadowRect.height() * 0.5,
+ baseRect.width(),
+ baseRect.height() * 0.5);
+ nonAreaRect = QRectF(baseRect.x(),
+ baseRect.y(),
+ baseRect.width(),
+ baseRect.height() * 0.5);
+ areaLine = QLineF(areaRect.topLeft(), areaRect.topRight());
+ break;
+ case LeftDockWidgetArea:
+ areaRect = QRectF(baseRect.x(), baseRect.y(), baseRect.width() * 0.5, baseRect.height());
+ nonAreaRect = QRectF(shadowRect.width() * 0.5,
+ baseRect.y(),
+ baseRect.width() * 0.5,
+ baseRect.height());
+ areaLine = QLineF(areaRect.topRight(), areaRect.bottomRight());
+ break;
+ default:
+ break;
+ }
+
+ QSizeF baseSize = baseRect.size();
+ if (DockOverlay::ModeContainerOverlay == mode && dockWidgetArea != CenterDockWidgetArea) {
+ baseRect = areaRect;
+ }
+
+ painter.fillRect(baseRect, backgroundColor);
+ if (areaRect.isValid()) {
+ pen = painter.pen();
+ pen.setColor(borderColor);
+ QColor color = iconColor(DockOverlayCross::OverlayColor);
+ if (color.alpha() == 255) {
+ color.setAlpha(64);
+ }
+ painter.setBrush(color);
+ painter.setPen(Qt::NoPen);
+ painter.drawRect(areaRect);
+
+ pen = painter.pen();
+ pen.setWidth(1);
+ pen.setColor(borderColor);
+ pen.setStyle(Qt::DashLine);
+ painter.setPen(pen);
+ painter.drawLine(areaLine);
+ }
+ painter.restore();
+
+ painter.save();
+ // Draw outer border
+ pen = painter.pen();
+ pen.setColor(borderColor);
+ pen.setWidth(1);
+ painter.setBrush(Qt::NoBrush);
+ painter.setPen(pen);
+ painter.drawRect(baseRect);
+
+ // draw window title bar
+ painter.setBrush(borderColor);
+ QRectF frameRect(baseRect.topLeft(), QSizeF(baseRect.width(), baseSize.height() / 10));
+ painter.drawRect(frameRect);
+ painter.restore();
+
+ // Draw arrow for outer container drop indicators
+ if (DockOverlay::ModeContainerOverlay == mode && dockWidgetArea != CenterDockWidgetArea) {
+ QRectF arrowRect;
+ arrowRect.setSize(baseSize);
+ arrowRect.setWidth(arrowRect.width() / 4.6);
+ arrowRect.setHeight(arrowRect.height() / 2);
+ arrowRect.moveCenter(QPointF(0, 0));
+ QPolygonF arrow;
+ arrow << arrowRect.topLeft() << QPointF(arrowRect.right(), arrowRect.center().y())
+ << arrowRect.bottomLeft();
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(iconColor(DockOverlayCross::ArrowColor));
+ painter.setRenderHint(QPainter::Antialiasing, true);
+ painter.translate(nonAreaRect.center().x(), nonAreaRect.center().y());
+
+ switch (dockWidgetArea) {
+ case TopDockWidgetArea:
+ painter.rotate(-90);
+ break;
+ case RightDockWidgetArea:
+ break;
+ case BottomDockWidgetArea:
+ painter.rotate(90);
+ break;
+ case LeftDockWidgetArea:
+ painter.rotate(180);
+ break;
+ default:
+ break;
+ }
+
+ painter.drawPolygon(arrow);
+ }
+
+ pixmap.setDevicePixelRatio(devicePixelRatio);
+ return pixmap;
+ }
+ };
+
+ DockOverlay::DockOverlay(QWidget *parent, eMode mode)
+ : QFrame(parent)
+ , d(new DockOverlayPrivate(this))
+ {
+ d->m_mode = mode;
+ d->m_cross = new DockOverlayCross(this);
+
+ if (Utils::HostOsInfo::isLinuxHost())
+ setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint
+ | Qt::X11BypassWindowManagerHint);
+ else
+ setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
+
+ setWindowOpacity(1);
+ setWindowTitle("DockOverlay");
+ setAttribute(Qt::WA_NoSystemBackground);
+ setAttribute(Qt::WA_TranslucentBackground);
+
+ d->m_cross->setVisible(false);
+ setVisible(false);
+ }
+
+ DockOverlay::~DockOverlay()
+ {
+ delete d;
+ }
+
+ void DockOverlay::setAllowedAreas(DockWidgetAreas areas)
+ {
+ if (areas == d->m_allowedAreas)
+ return;
+ d->m_allowedAreas = areas;
+ d->m_cross->reset();
+ }
+
+ DockWidgetAreas DockOverlay::allowedAreas() const
+ {
+ return d->m_allowedAreas;
+ }
+
+ DockWidgetArea DockOverlay::dropAreaUnderCursor() const
+ {
+ DockWidgetArea result = d->m_cross->cursorLocation();
+ if (result != InvalidDockWidgetArea) {
+ return result;
+ }
+
+ DockAreaWidget *dockArea = qobject_cast<DockAreaWidget *>(d->m_targetWidget.data());
+ if (!dockArea) {
+ return result;
+ }
+
+ if (dockArea->allowedAreas().testFlag(CenterDockWidgetArea)
+ && dockArea->titleBarGeometry().contains(dockArea->mapFromGlobal(QCursor::pos()))) {
+ return CenterDockWidgetArea;
+ }
+
+ return result;
+ }
+
+ DockWidgetArea DockOverlay::showOverlay(QWidget *target)
+ {
+ if (d->m_targetWidget == target) {
+ // Hint: We could update geometry of overlay here.
+ DockWidgetArea dockWidgetArea = dropAreaUnderCursor();
+ if (dockWidgetArea != d->m_lastLocation) {
+ repaint();
+ d->m_lastLocation = dockWidgetArea;
+ }
+ return dockWidgetArea;
+ }
+
+ d->m_targetWidget = target;
+ d->m_lastLocation = InvalidDockWidgetArea;
+
+ // Move it over the target.
+ resize(target->size());
+ QPoint topLeft = target->mapToGlobal(target->rect().topLeft());
+ move(topLeft);
+ show();
+ d->m_cross->updatePosition();
+ d->m_cross->updateOverlayIcons();
+ return dropAreaUnderCursor();
+ }
+
+ void DockOverlay::hideOverlay()
+ {
+ hide();
+ d->m_targetWidget.clear();
+ d->m_lastLocation = InvalidDockWidgetArea;
+ d->m_dropAreaRect = QRect();
+ }
+
+ void DockOverlay::enableDropPreview(bool enable)
+ {
+ d->m_dropPreviewEnabled = enable;
+ update();
+ }
+
+ bool DockOverlay::dropPreviewEnabled() const
+ {
+ return d->m_dropPreviewEnabled;
+ }
+
+ void DockOverlay::paintEvent(QPaintEvent *event)
+ {
+ Q_UNUSED(event)
+ // Draw rect based on location
+ if (!d->m_dropPreviewEnabled) {
+ d->m_dropAreaRect = QRect();
+ return;
+ }
+
+ QRect rectangle = rect();
+ const DockWidgetArea dockWidgetArea = dropAreaUnderCursor();
+ double factor = (DockOverlay::ModeContainerOverlay == d->m_mode) ? 3 : 2;
+
+ switch (dockWidgetArea) {
+ case TopDockWidgetArea:
+ rectangle.setHeight(static_cast<int>(rectangle.height() / factor));
+ break;
+ case RightDockWidgetArea:
+ rectangle.setX(static_cast<int>(rectangle.width() * (1 - 1 / factor)));
+ break;
+ case BottomDockWidgetArea:
+ rectangle.setY(static_cast<int>(rectangle.height() * (1 - 1 / factor)));
+ break;
+ case LeftDockWidgetArea:
+ rectangle.setWidth(static_cast<int>(rectangle.width() / factor));
+ break;
+ case CenterDockWidgetArea:
+ rectangle = rect();
+ break;
+ default:
+ return;
+ }
+ QPainter painter(this);
+ QColor color = palette().color(QPalette::Active, QPalette::Highlight);
+ QPen pen = painter.pen();
+ pen.setColor(color.darker(120));
+ pen.setStyle(Qt::SolidLine);
+ pen.setWidth(1);
+ pen.setCosmetic(true);
+ painter.setPen(pen);
+ color = color.lighter(130);
+ color.setAlpha(64);
+ painter.setBrush(color);
+ painter.drawRect(rectangle.adjusted(0, 0, -1, -1));
+ d->m_dropAreaRect = rectangle;
+ }
+
+ QRect DockOverlay::dropOverlayRect() const
+ {
+ return d->m_dropAreaRect;
+ }
+
+ void DockOverlay::showEvent(QShowEvent *event)
+ {
+ d->m_cross->show();
+ QFrame::showEvent(event);
+ }
+
+ void DockOverlay::hideEvent(QHideEvent *event)
+ {
+ d->m_cross->hide();
+ QFrame::hideEvent(event);
+ }
+
+ bool DockOverlay::event(QEvent *event)
+ {
+ bool result = Super::event(event);
+ if (event->type() == QEvent::Polish) {
+ d->m_cross->setupOverlayCross(d->m_mode);
+ }
+ return result;
+ }
+
+ static int areaAlignment(const DockWidgetArea area)
+ {
+ switch (area) {
+ case TopDockWidgetArea:
+ return Qt::AlignHCenter | Qt::AlignBottom;
+ case RightDockWidgetArea:
+ return Qt::AlignLeft | Qt::AlignVCenter;
+ case BottomDockWidgetArea:
+ return Qt::AlignHCenter | Qt::AlignTop;
+ case LeftDockWidgetArea:
+ return Qt::AlignRight | Qt::AlignVCenter;
+ case CenterDockWidgetArea:
+ return Qt::AlignCenter;
+ default:
+ return Qt::AlignCenter;
+ }
+ }
+
+ // DockOverlayCrossPrivate
+ QPoint DockOverlayCrossPrivate::areaGridPosition(const DockWidgetArea area)
+ {
+ if (DockOverlay::ModeDockAreaOverlay == m_mode) {
+ switch (area) {
+ case TopDockWidgetArea:
+ return QPoint(1, 2);
+ case RightDockWidgetArea:
+ return QPoint(2, 3);
+ case BottomDockWidgetArea:
+ return QPoint(3, 2);
+ case LeftDockWidgetArea:
+ return QPoint(2, 1);
+ case CenterDockWidgetArea:
+ return QPoint(2, 2);
+ default:
+ return QPoint();
+ }
+ } else {
+ switch (area) {
+ case TopDockWidgetArea:
+ return QPoint(0, 2);
+ case RightDockWidgetArea:
+ return QPoint(2, 4);
+ case BottomDockWidgetArea:
+ return QPoint(4, 2);
+ case LeftDockWidgetArea:
+ return QPoint(2, 0);
+ case CenterDockWidgetArea:
+ return QPoint(2, 2);
+ default:
+ return QPoint();
+ }
+ }
+ }
+
+ DockOverlayCross::DockOverlayCross(DockOverlay *overlay)
+ : QWidget(overlay->parentWidget())
+ , d(new DockOverlayCrossPrivate(this))
+ {
+ d->m_dockOverlay = overlay;
+
+ if (Utils::HostOsInfo::isLinuxHost())
+ setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint
+ | Qt::X11BypassWindowManagerHint);
+ else
+ setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
+
+ setWindowTitle("DockOverlayCross");
+ setAttribute(Qt::WA_TranslucentBackground);
+
+ d->m_gridLayout = new QGridLayout();
+ d->m_gridLayout->setSpacing(0);
+ setLayout(d->m_gridLayout);
+ }
+
+ DockOverlayCross::~DockOverlayCross()
+ {
+ delete d;
+ }
+
+ void DockOverlayCross::setupOverlayCross(DockOverlay::eMode mode)
+ {
+ d->m_mode = mode;
+
+ QHash<DockWidgetArea, QWidget *> areaWidgets;
+ areaWidgets.insert(TopDockWidgetArea, d->createDropIndicatorWidget(TopDockWidgetArea, mode));
+ areaWidgets.insert(RightDockWidgetArea, d->createDropIndicatorWidget(RightDockWidgetArea, mode));
+ areaWidgets.insert(BottomDockWidgetArea,
+ d->createDropIndicatorWidget(BottomDockWidgetArea, mode));
+ areaWidgets.insert(LeftDockWidgetArea, d->createDropIndicatorWidget(LeftDockWidgetArea, mode));
+ areaWidgets.insert(CenterDockWidgetArea,
+ d->createDropIndicatorWidget(CenterDockWidgetArea, mode));
+ d->m_lastDevicePixelRatio = devicePixelRatioF();
+ setAreaWidgets(areaWidgets);
+ d->m_updateRequired = false;
+ }
+
+ void DockOverlayCross::updateOverlayIcons()
+ {
+ if (windowHandle()->devicePixelRatio() == d->m_lastDevicePixelRatio) { // TODO
+ return;
+ }
+
+ for (auto Widget : d->m_dropIndicatorWidgets) {
+ d->updateDropIndicatorIcon(Widget);
+ }
+ d->m_lastDevicePixelRatio = devicePixelRatioF();
+ }
+
+ void DockOverlayCross::setIconColor(eIconColor colorIndex, const QColor &color)
+ {
+ d->m_iconColors[colorIndex] = color;
+ d->m_updateRequired = true;
+ }
+
+ QColor DockOverlayCross::iconColor(eIconColor colorIndex) const
+ {
+ return d->m_iconColors[colorIndex];
+ }
+
+ void DockOverlayCross::setAreaWidgets(const QHash<DockWidgetArea, QWidget *> &widgets)
+ {
+ // Delete old widgets.
+ const auto values = d->m_dropIndicatorWidgets.values();
+ for (auto widget : values) {
+ d->m_gridLayout->removeWidget(widget);
+ delete widget;
+ }
+ d->m_dropIndicatorWidgets.clear();
+
+ // Insert new widgets into grid.
+ d->m_dropIndicatorWidgets = widgets;
+
+ const QHash<DockWidgetArea, QWidget *> areas = d->m_dropIndicatorWidgets;
+ QHash<DockWidgetArea, QWidget *>::const_iterator constIt;
+ for (constIt = areas.begin(); constIt != areas.end(); ++constIt) {
+ const DockWidgetArea area = constIt.key();
+ QWidget *widget = constIt.value();
+ QPoint position = d->areaGridPosition(area);
+ d->m_gridLayout->addWidget(widget,
+ position.x(),
+ position.y(),
+ static_cast<Qt::Alignment>(areaAlignment(area)));
+ }
+
+ if (DockOverlay::ModeDockAreaOverlay == d->m_mode) {
+ d->m_gridLayout->setContentsMargins(0, 0, 0, 0);
+ d->m_gridLayout->setRowStretch(0, 1);
+ d->m_gridLayout->setRowStretch(1, 0);
+ d->m_gridLayout->setRowStretch(2, 0);
+ d->m_gridLayout->setRowStretch(3, 0);
+ d->m_gridLayout->setRowStretch(4, 1);
+
+ d->m_gridLayout->setColumnStretch(0, 1);
+ d->m_gridLayout->setColumnStretch(1, 0);
+ d->m_gridLayout->setColumnStretch(2, 0);
+ d->m_gridLayout->setColumnStretch(3, 0);
+ d->m_gridLayout->setColumnStretch(4, 1);
+ } else {
+ d->m_gridLayout->setContentsMargins(4, 4, 4, 4);
+ d->m_gridLayout->setRowStretch(0, 0);
+ d->m_gridLayout->setRowStretch(1, 1);
+ d->m_gridLayout->setRowStretch(2, 1);
+ d->m_gridLayout->setRowStretch(3, 1);
+ d->m_gridLayout->setRowStretch(4, 0);
+
+ d->m_gridLayout->setColumnStretch(0, 0);
+ d->m_gridLayout->setColumnStretch(1, 1);
+ d->m_gridLayout->setColumnStretch(2, 1);
+ d->m_gridLayout->setColumnStretch(3, 1);
+ d->m_gridLayout->setColumnStretch(4, 0);
+ }
+ reset();
+ }
+
+ DockWidgetArea DockOverlayCross::cursorLocation() const
+ {
+ const QPoint position = mapFromGlobal(QCursor::pos());
+
+ const QHash<DockWidgetArea, QWidget *> areas = d->m_dropIndicatorWidgets;
+ QHash<DockWidgetArea, QWidget *>::const_iterator constIt;
+ for (constIt = areas.begin(); constIt != areas.end(); ++constIt)
+ {
+ if (d->m_dockOverlay->allowedAreas().testFlag(constIt.key()) && constIt.value()
+ && constIt.value()->isVisible() && constIt.value()->geometry().contains(position)) {
+ return constIt.key();
+ }
+ }
+
+ return InvalidDockWidgetArea;
+ }
+
+ void DockOverlayCross::showEvent(QShowEvent *)
+ {
+ if (d->m_updateRequired) {
+ setupOverlayCross(d->m_mode);
+ }
+ this->updatePosition();
+ }
+
+ void DockOverlayCross::updatePosition()
+ {
+ resize(d->m_dockOverlay->size());
+ QPoint topLeft = d->m_dockOverlay->pos();
+ QPoint offest((this->width() - d->m_dockOverlay->width()) / 2,
+ (this->height() - d->m_dockOverlay->height()) / 2);
+ QPoint crossTopLeft = topLeft - offest;
+ move(crossTopLeft);
+ }
+
+ void DockOverlayCross::reset()
+ {
+ const QList<DockWidgetArea> allAreas{TopDockWidgetArea,
+ RightDockWidgetArea,
+ BottomDockWidgetArea,
+ LeftDockWidgetArea,
+ CenterDockWidgetArea};
+ const DockWidgetAreas allowedAreas = d->m_dockOverlay->allowedAreas();
+
+ // Update visibility of area widgets based on allowedAreas.
+ for (auto area : allAreas) {
+ QPoint position = d->areaGridPosition(area);
+ QLayoutItem *item = d->m_gridLayout->itemAtPosition(position.x(), position.y());
+ QWidget *widget = nullptr;
+ if (item && (widget = item->widget()) != nullptr) {
+ widget->setVisible(allowedAreas.testFlag(area));
+ }
+ }
+ }
+
+ void DockOverlayCross::setIconColors(const QString &colors)
+ {
+ static const QMap<QString, int>
+ colorCompenentStringMap{{"Frame", DockOverlayCross::FrameColor},
+ {"Background", DockOverlayCross::WindowBackgroundColor},
+ {"Overlay", DockOverlayCross::OverlayColor},
+ {"Arrow", DockOverlayCross::ArrowColor},
+ {"Shadow", DockOverlayCross::ShadowColor}};
+
+ auto colorList = colors.split(' ', QString::SkipEmptyParts);
+ for (const auto &colorListEntry : colorList) {
+ auto componentColor = colorListEntry.split('=', QString::SkipEmptyParts);
+ int component = colorCompenentStringMap.value(componentColor[0], -1);
+ if (component < 0) {
+ continue;
+ }
+ d->m_iconColors[component] = QColor(componentColor[1]);
+ }
+
+ d->m_updateRequired = true;
+ }
+
+ QString DockOverlayCross::iconColors() const
+ {
+ return QString();
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockoverlay.h b/src/libs/advanceddockingsystem/dockoverlay.h
new file mode 100644
index 00000000000..b7243c29a63
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockoverlay.h
@@ -0,0 +1,265 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QFrame>
+#include <QHash>
+#include <QPointer>
+#include <QRect>
+
+QT_BEGIN_NAMESPACE
+class QGridLayout;
+QT_END_NAMESPACE
+
+namespace ADS {
+
+struct DockOverlayPrivate;
+class DockOverlayCross;
+
+/**
+ * DockOverlay paints a translucent rectangle over another widget. The geometry
+ * of the rectangle is based on the mouse location.
+ */
+class ADS_EXPORT DockOverlay : public QFrame
+{
+ Q_OBJECT
+private:
+ DockOverlayPrivate *d; //< private data class
+ friend struct DockOverlayPrivate;
+ friend class DockOverlayCross;
+
+public:
+ using Super = QFrame;
+
+ enum eMode { ModeDockAreaOverlay, ModeContainerOverlay };
+
+ /**
+ * Creates a dock overlay
+ */
+ DockOverlay(QWidget *parent, eMode Mode = ModeDockAreaOverlay);
+
+ /**
+ * Virtual destructor
+ */
+ virtual ~DockOverlay() override;
+
+ /**
+ * Configures the areas that are allowed for docking
+ */
+ void setAllowedAreas(DockWidgetAreas areas);
+
+ /**
+ * Returns flags with all allowed drop areas
+ */
+ DockWidgetAreas allowedAreas() const;
+
+ /**
+ * Returns the drop area under the current cursor location
+ */
+ DockWidgetArea dropAreaUnderCursor() const;
+
+ /**
+ * Show the drop overly for the given target widget
+ */
+ DockWidgetArea showOverlay(QWidget *target);
+
+ /**
+ * Hides the overlay
+ */
+ void hideOverlay();
+
+ /**
+ * Enables / disables the semi transparent overlay rectangle that represents
+ * the future area of the dropped widget
+ */
+ void enableDropPreview(bool enable);
+
+ /**
+ * Returns true if drop preview is enabled
+ */
+ bool dropPreviewEnabled() const;
+
+ /**
+ * The drop overlay rectangle for the target area
+ */
+ QRect dropOverlayRect() const;
+
+ /**
+ * Handle polish events
+ */
+ virtual bool event(QEvent *event) override;
+
+protected:
+ virtual void paintEvent(QPaintEvent *event) override;
+ virtual void showEvent(QShowEvent *event) override;
+ virtual void hideEvent(QHideEvent *event) override;
+};
+
+struct DockOverlayCrossPrivate;
+/**
+ * DockOverlayCross shows a cross with 5 different drop area possibilities.
+ * I could have handled everything inside DockOverlay, but because of some
+ * styling issues it's better to have a separate class for the cross.
+ * You can style the cross icon using the property system.
+ * \code
+ * ADS--DockOverlayCross
+ {
+ qproperty-iconFrameColor: palette(highlight);
+ qproperty-iconBackgroundColor: palette(base);
+ qproperty-iconOverlayColor: palette(highlight);
+ qproperty-iconArrowColor: rgb(227, 227, 227);
+ qproperty-iconShadowColor: rgb(0, 0, 0);
+ }
+ * \endcode
+ * Or you can use the iconColors property to pass in AARRGGBB values as
+ * hex string like shown in the example below.
+ * \code
+ * ADS--DockOverlayCross
+ * {
+ * qproperty-iconColors: "Frame=#ff3d3d3d Background=#ff929292 Overlay=#1f3d3d3d Arrow=#ffb4b4b4 Shadow=#40474747";
+ * }
+ * \endcode
+ */
+class DockOverlayCross : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(QString iconColors READ iconColors WRITE setIconColors)
+ Q_PROPERTY(QColor iconFrameColor READ iconColor WRITE setIconFrameColor)
+ Q_PROPERTY(QColor iconBackgroundColor READ iconColor WRITE setIconBackgroundColor)
+ Q_PROPERTY(QColor iconOverlayColor READ iconColor WRITE setIconOverlayColor)
+ Q_PROPERTY(QColor iconArrowColor READ iconColor WRITE setIconArrowColor)
+ Q_PROPERTY(QColor iconShadowColor READ iconColor WRITE setIconShadowColor)
+
+public:
+ enum eIconColor {
+ FrameColor, ///< the color of the frame of the small window icon
+ WindowBackgroundColor, ///< the background color of the small window in the icon
+ OverlayColor, ///< the color that shows the overlay (the dock side) in the icon
+ ArrowColor, ///< the arrow that points into the direction
+ ShadowColor ///< the color of the shadow rectangle that is painted below the icons
+ };
+
+private:
+ DockOverlayCrossPrivate *d;
+ friend struct DockOverlayCrossPrivate;
+ friend class DockOverlay;
+
+protected:
+ /**
+ * This function returns an empty string and is only here to silence
+ * moc
+ */
+ QString iconColors() const;
+
+ /**
+ * This is a dummy function for the property system
+ */
+ QColor iconColor() const { return QColor(); }
+ void setIconFrameColor(const QColor &color) { setIconColor(FrameColor, color); }
+ void setIconBackgroundColor(const QColor &color) { setIconColor(WindowBackgroundColor, color); }
+ void setIconOverlayColor(const QColor &color) { setIconColor(OverlayColor, color); }
+ void setIconArrowColor(const QColor &color) { setIconColor(ArrowColor, color); }
+ void setIconShadowColor(const QColor &color) { setIconColor(ShadowColor, color); }
+
+public:
+ /**
+ * Creates an overlay cross for the given overlay
+ */
+ DockOverlayCross(DockOverlay *overlay);
+
+ /**
+ * Virtual destructor
+ */
+ virtual ~DockOverlayCross() override;
+
+ /**
+ * Sets a certain icon color
+ */
+ void setIconColor(eIconColor colorIndex, const QColor &color);
+
+ /**
+ * Returns the icon color given by ColorIndex
+ */
+ QColor iconColor(eIconColor colorIndex) const;
+
+ /**
+ * Returns the dock widget area depending on the current cursor location.
+ * The function checks, if the mouse cursor is inside of any drop indicator
+ * widget and returns the corresponding DockWidgetArea.
+ */
+ DockWidgetArea cursorLocation() const;
+
+ /**
+ * Sets up the overlay cross for the given overlay mode
+ */
+ void setupOverlayCross(DockOverlay::eMode mode);
+
+ /**
+ * Recreates the overlay icons.
+ */
+ void updateOverlayIcons();
+
+ /**
+ * Resets and updates the
+ */
+ void reset();
+
+ /**
+ * Updates the current position
+ */
+ void updatePosition();
+
+ /**
+ * A string with all icon colors to set.
+ * You can use this property to style the overly icon via CSS stylesheet
+ * file. The colors are set via a color identifier and a hex AARRGGBB value like
+ * in the example below.
+ * \code
+ * ADS--DockOverlayCross
+ * {
+ * qproperty-iconColors: "Frame=#ff3d3d3d Background=#ff929292 Overlay=#1f3d3d3d Arrow=#ffb4b4b4 Shadow=#40474747";
+ * }
+ */
+ void setIconColors(const QString &colors);
+
+protected:
+ virtual void showEvent(QShowEvent *event) override;
+ void setAreaWidgets(const QHash<DockWidgetArea, QWidget *> &widgets);
+}; // DockOverlayCross
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/docksplitter.cpp b/src/libs/advanceddockingsystem/docksplitter.cpp
new file mode 100644
index 00000000000..ec6d8915df5
--- /dev/null
+++ b/src/libs/advanceddockingsystem/docksplitter.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "docksplitter.h"
+
+#include "dockareawidget.h"
+
+#include <QChildEvent>
+#include <QLoggingCategory>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ /**
+ * Private dock splitter data
+ */
+ struct DockSplitterPrivate
+ {
+ DockSplitter *q;
+ int m_visibleContentCount = 0;
+
+ DockSplitterPrivate(DockSplitter *parent)
+ : q(parent)
+ {}
+ };
+
+ DockSplitter::DockSplitter(QWidget *parent)
+ : QSplitter(parent)
+ , d(new DockSplitterPrivate(this))
+ {
+ //setProperty("ads-splitter", true); // TODO
+ setProperty("minisplitter", true);
+ setChildrenCollapsible(false);
+ }
+
+ DockSplitter::DockSplitter(Qt::Orientation orientation, QWidget *parent)
+ : QSplitter(orientation, parent)
+ , d(new DockSplitterPrivate(this))
+ {}
+
+ DockSplitter::~DockSplitter()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ delete d;
+ }
+
+ bool DockSplitter::hasVisibleContent() const
+ {
+ // TODO Cache or precalculate this to speed up
+ for (int i = 0; i < count(); ++i) {
+ if (!widget(i)->isHidden()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/docksplitter.h b/src/libs/advanceddockingsystem/docksplitter.h
new file mode 100644
index 00000000000..45351a34e22
--- /dev/null
+++ b/src/libs/advanceddockingsystem/docksplitter.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QSplitter>
+
+namespace ADS {
+
+struct DockSplitterPrivate;
+
+/**
+ * Splitter used internally instead of QSplitter with some additional
+ * fuctionality.
+ */
+class ADS_EXPORT DockSplitter : public QSplitter
+{
+ Q_OBJECT
+private:
+ DockSplitterPrivate *d;
+ friend struct DockSplitterPrivate;
+
+public:
+ DockSplitter(QWidget *parent = nullptr);
+ DockSplitter(Qt::Orientation orientation, QWidget *parent = nullptr);
+
+ /**
+ * Prints debug info
+ */
+ virtual ~DockSplitter() override;
+
+ /**
+ * Returns true, if any of the internal widgets is visible
+ */
+ bool hasVisibleContent() const;
+}; // class DockSplitter
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockwidget.cpp b/src/libs/advanceddockingsystem/dockwidget.cpp
new file mode 100644
index 00000000000..08857994b5e
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockwidget.cpp
@@ -0,0 +1,625 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockwidget.h"
+
+#include "ads_globals.h"
+#include "dockareawidget.h"
+#include "dockcomponentsfactory.h"
+#include "dockcontainerwidget.h"
+#include "dockmanager.h"
+#include "docksplitter.h"
+#include "dockwidgettab.h"
+#include "floatingdockcontainer.h"
+
+#include <QAction>
+#include <QBoxLayout>
+#include <QEvent>
+#include <QLoggingCategory>
+#include <QPointer>
+#include <QScrollArea>
+#include <QSplitter>
+#include <QStack>
+#include <QTextStream>
+#include <QToolBar>
+#include <QXmlStreamWriter>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ /**
+ * Private data class of DockWidget class (pimpl)
+ */
+ struct DockWidgetPrivate
+ {
+ DockWidget *q = nullptr;
+ QBoxLayout *m_layout = nullptr;
+ QWidget *m_widget = nullptr;
+ DockWidgetTab *m_tabWidget = nullptr;
+ DockWidget::DockWidgetFeatures m_features = DockWidget::DefaultDockWidgetFeatures;
+ DockManager *m_dockManager = nullptr;
+ DockAreaWidget *m_dockArea = nullptr;
+ QAction *m_toggleViewAction = nullptr;
+ bool m_closed = false;
+ QScrollArea *m_scrollArea = nullptr;
+ QToolBar *m_toolBar = nullptr;
+ Qt::ToolButtonStyle m_toolBarStyleDocked = Qt::ToolButtonIconOnly;
+ Qt::ToolButtonStyle m_toolBarStyleFloating = Qt::ToolButtonTextUnderIcon;
+ QSize m_toolBarIconSizeDocked = QSize(16, 16);
+ QSize m_toolBarIconSizeFloating = QSize(24, 24);
+ bool m_isFloatingTopLevel = false;
+ QList<QAction *> m_titleBarActions;
+
+ /**
+ * Private data constructor
+ */
+ DockWidgetPrivate(DockWidget *parent);
+
+ /**
+ * Show dock widget
+ */
+ void showDockWidget();
+
+ /**
+ * Hide dock widget.
+ */
+ void hideDockWidget();
+
+ /**
+ * Hides a dock area if all dock widgets in the area are closed.
+ * This function updates the current selected tab and hides the parent
+ * dock area if it is empty
+ */
+ void updateParentDockArea();
+
+ /**
+ * Setup the top tool bar
+ */
+ void setupToolBar();
+
+ /**
+ * Setup the main scroll area
+ */
+ void setupScrollArea();
+ };
+ // struct DockWidgetPrivate
+
+ DockWidgetPrivate::DockWidgetPrivate(DockWidget *parent)
+ : q(parent)
+ {}
+
+ void DockWidgetPrivate::showDockWidget()
+ {
+ if (!m_dockArea) {
+ FloatingDockContainer *floatingWidget = new FloatingDockContainer(q);
+ floatingWidget->resize(q->size());
+ floatingWidget->show();
+ } else {
+ m_dockArea->setCurrentDockWidget(q);
+ m_dockArea->toggleView(true);
+ m_tabWidget->show();
+ QSplitter *splitter = internal::findParent<QSplitter *>(m_dockArea);
+ while (splitter && !splitter->isVisible()) {
+ splitter->show();
+ splitter = internal::findParent<QSplitter *>(splitter);
+ }
+
+ DockContainerWidget *container = m_dockArea->dockContainer();
+ if (container->isFloating()) {
+ FloatingDockContainer *floatingWidget
+ = internal::findParent<FloatingDockContainer *>(container);
+ floatingWidget->show();
+ }
+ }
+ }
+
+ void DockWidgetPrivate::hideDockWidget()
+ {
+ m_tabWidget->hide();
+ updateParentDockArea();
+ }
+
+ void DockWidgetPrivate::updateParentDockArea()
+ {
+ if (!m_dockArea) {
+ return;
+ }
+
+ auto nextDockWidget = m_dockArea->nextOpenDockWidget(q);
+ if (nextDockWidget) {
+ m_dockArea->setCurrentDockWidget(nextDockWidget);
+ } else {
+ m_dockArea->hideAreaWithNoVisibleContent();
+ }
+ }
+
+ void DockWidgetPrivate::setupToolBar()
+ {
+ m_toolBar = new QToolBar(q);
+ m_toolBar->setObjectName("dockWidgetToolBar");
+ m_layout->insertWidget(0, m_toolBar);
+ m_toolBar->setIconSize(QSize(16, 16));
+ m_toolBar->toggleViewAction()->setEnabled(false);
+ m_toolBar->toggleViewAction()->setVisible(false);
+ QObject::connect(q, &DockWidget::topLevelChanged, q, &DockWidget::setToolbarFloatingStyle);
+ }
+
+ void DockWidgetPrivate::setupScrollArea()
+ {
+ m_scrollArea = new QScrollArea(q);
+ m_scrollArea->setObjectName("dockWidgetScrollArea");
+ m_scrollArea->setWidgetResizable(true);
+ m_layout->addWidget(m_scrollArea);
+ }
+
+ DockWidget::DockWidget(const QString &uniqueId, QWidget *parent)
+ : QFrame(parent)
+ , d(new DockWidgetPrivate(this))
+ {
+ d->m_layout = new QBoxLayout(QBoxLayout::TopToBottom);
+ d->m_layout->setContentsMargins(0, 0, 0, 0);
+ d->m_layout->setSpacing(0);
+ setLayout(d->m_layout);
+ setWindowTitle(uniqueId); // temporarily use unique id as title
+ setObjectName(uniqueId);
+
+ d->m_tabWidget = componentsFactory()->createDockWidgetTab(this);
+ d->m_toggleViewAction = new QAction(uniqueId, this);
+ d->m_toggleViewAction->setCheckable(true);
+ connect(d->m_toggleViewAction, &QAction::triggered, this, &DockWidget::toggleView);
+ setToolbarFloatingStyle(false);
+ }
+
+ DockWidget::~DockWidget()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ delete d;
+ }
+
+ void DockWidget::setToggleViewActionChecked(bool checked)
+ {
+ QAction *action = d->m_toggleViewAction;
+ //action->blockSignals(true);
+ action->setChecked(checked);
+ //action->blockSignals(false);
+ }
+
+ void DockWidget::setWidget(QWidget *widget, eInsertMode insertMode)
+ {
+ QScrollArea *scrollAreaWidget = qobject_cast<QScrollArea *>(widget);
+ if (scrollAreaWidget || ForceNoScrollArea == insertMode) {
+ d->m_layout->addWidget(widget);
+ if (scrollAreaWidget && scrollAreaWidget->viewport()) {
+ scrollAreaWidget->viewport()->setProperty("dockWidgetContent", true);
+ }
+ } else {
+ d->setupScrollArea();
+ d->m_scrollArea->setWidget(widget);
+ }
+
+ d->m_widget = widget;
+ d->m_widget->setProperty("dockWidgetContent", true);
+ }
+
+ QWidget *DockWidget::takeWidget()
+ {
+ // TODO Shouldn't m_widget being set to nullptr?!
+ d->m_scrollArea->takeWidget();
+ d->m_layout->removeWidget(d->m_widget);
+ d->m_widget->setParent(nullptr);
+ return d->m_widget;
+ }
+
+ QWidget *DockWidget::widget() const { return d->m_widget; }
+
+ DockWidgetTab *DockWidget::tabWidget() const { return d->m_tabWidget; }
+
+ void DockWidget::setFeatures(DockWidgetFeatures features)
+ {
+ if (d->m_features == features) {
+ return;
+ }
+ d->m_features = features;
+ emit featuresChanged(d->m_features);
+ d->m_tabWidget->onDockWidgetFeaturesChanged();
+ }
+
+ void DockWidget::setFeature(DockWidgetFeature flag, bool on)
+ {
+ auto currentFeatures = features();
+ internal::setFlag(currentFeatures, flag, on);
+ setFeatures(currentFeatures);
+ }
+
+ DockWidget::DockWidgetFeatures DockWidget::features() const { return d->m_features; }
+
+ DockManager *DockWidget::dockManager() const { return d->m_dockManager; }
+
+ void DockWidget::setDockManager(DockManager *dockManager) { d->m_dockManager = dockManager; }
+
+ DockContainerWidget *DockWidget::dockContainer() const
+ {
+ if (d->m_dockArea) {
+ return d->m_dockArea->dockContainer();
+ } else {
+ return nullptr;
+ }
+ }
+
+ DockAreaWidget *DockWidget::dockAreaWidget() const { return d->m_dockArea; }
+
+ bool DockWidget::isFloating() const
+ {
+ if (!isInFloatingContainer()) {
+ return false;
+ }
+
+ return dockContainer()->topLevelDockWidget() == this;
+ }
+
+ bool DockWidget::isInFloatingContainer() const
+ {
+ auto container = dockContainer();
+ if (!container) {
+ return false;
+ }
+
+ if (!container->isFloating()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ bool DockWidget::isClosed() const { return d->m_closed; }
+
+ QAction *DockWidget::toggleViewAction() const { return d->m_toggleViewAction; }
+
+ void DockWidget::setToggleViewActionMode(eToggleViewActionMode mode)
+ {
+ if (ActionModeToggle == mode) {
+ d->m_toggleViewAction->setCheckable(true);
+ d->m_toggleViewAction->setIcon(QIcon());
+ } else {
+ d->m_toggleViewAction->setCheckable(false);
+ d->m_toggleViewAction->setIcon(d->m_tabWidget->icon());
+ }
+ }
+
+ void DockWidget::toggleView(bool open)
+ {
+ // If the toggle view action mode is ActionModeShow, then Open is always
+ // true if the sender is the toggle view action
+ QAction *action = qobject_cast<QAction *>(sender());
+ if (action == d->m_toggleViewAction && !d->m_toggleViewAction->isCheckable()) {
+ open = true;
+ }
+ // If the dock widget state is different, then we really need to toggle
+ // the state. If we are in the right state, then we simply make this
+ // dock widget the current dock widget
+ if (d->m_closed != !open) {
+ toggleViewInternal(open);
+ } else if (open && d->m_dockArea) {
+ d->m_dockArea->setCurrentDockWidget(this);
+ }
+ }
+
+ void DockWidget::toggleViewInternal(bool open)
+ {
+ DockContainerWidget *dockContainerWidget = dockContainer();
+ DockWidget *topLevelDockWidgetBefore = dockContainerWidget
+ ? dockContainerWidget->topLevelDockWidget()
+ : nullptr;
+
+ if (open) {
+ d->showDockWidget();
+ } else {
+ d->hideDockWidget();
+ }
+ d->m_closed = !open;
+ //d->m_toggleViewAction->blockSignals(true);
+ d->m_toggleViewAction->setChecked(open);
+ //d->m_toggleViewAction->blockSignals(false);
+ if (d->m_dockArea) {
+ d->m_dockArea->toggleDockWidgetView(this, open);
+ }
+
+ if (open && topLevelDockWidgetBefore) {
+ DockWidget::emitTopLevelEventForWidget(topLevelDockWidgetBefore, false);
+ }
+
+ // Here we need to call the dockContainer() function again, because if
+ // this dock widget was unassigned before the call to showDockWidget() then
+ // it has a dock container now
+ dockContainerWidget = dockContainer();
+ DockWidget *topLevelDockWidgetAfter = dockContainerWidget
+ ? dockContainerWidget->topLevelDockWidget()
+ : nullptr;
+ DockWidget::emitTopLevelEventForWidget(topLevelDockWidgetAfter, true);
+ FloatingDockContainer *floatingContainer = dockContainerWidget->floatingWidget();
+ if (floatingContainer) {
+ floatingContainer->updateWindowTitle();
+ }
+
+ if (!open) {
+ emit closed();
+ }
+ emit viewToggled(open);
+ }
+
+ void DockWidget::setDockArea(DockAreaWidget *dockArea)
+ {
+ d->m_dockArea = dockArea;
+ d->m_toggleViewAction->setChecked(dockArea != nullptr && !this->isClosed());
+ }
+
+ void DockWidget::saveState(QXmlStreamWriter &stream) const
+ {
+ stream.writeStartElement("widget");
+ stream.writeAttribute("name", objectName());
+ stream.writeAttribute("closed", QVariant::fromValue(d->m_closed).toString());
+ stream.writeEndElement();
+ }
+
+ void DockWidget::flagAsUnassigned()
+ {
+ d->m_closed = true;
+ setParent(d->m_dockManager);
+ setVisible(false);
+ setDockArea(nullptr);
+ tabWidget()->setParent(this);
+ }
+
+ bool DockWidget::event(QEvent *event)
+ {
+ switch (event->type()) {
+ case QEvent::Hide:
+ emit visibilityChanged(false);
+ break;
+
+ case QEvent::Show:
+ emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
+ break;
+
+ case QEvent::WindowTitleChange :
+ {
+ const auto title = windowTitle();
+ if (d->m_tabWidget) {
+ d->m_tabWidget->setText(title);
+ }
+ if (d->m_toggleViewAction) {
+ d->m_toggleViewAction->setText(title);
+ }
+ if (d->m_dockArea) {
+ d->m_dockArea->markTitleBarMenuOutdated(); // update tabs menu
+ }
+ emit titleChanged(title);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return Super::event(event);
+ }
+
+#ifndef QT_NO_TOOLTIP
+ void DockWidget::setTabToolTip(const QString &text)
+ {
+ if (d->m_tabWidget) {
+ d->m_tabWidget->setToolTip(text);
+ }
+ if (d->m_toggleViewAction) {
+ d->m_toggleViewAction->setToolTip(text);
+ }
+ if (d->m_dockArea) {
+ d->m_dockArea->markTitleBarMenuOutdated(); //update tabs menu
+ }
+ }
+#endif
+
+ void DockWidget::setIcon(const QIcon &icon)
+ {
+ d->m_tabWidget->setIcon(icon);
+ if (!d->m_toggleViewAction->isCheckable()) {
+ d->m_toggleViewAction->setIcon(icon);
+ }
+ }
+
+ QIcon DockWidget::icon() const { return d->m_tabWidget->icon(); }
+
+ QToolBar *DockWidget::toolBar() const { return d->m_toolBar; }
+
+ QToolBar *DockWidget::createDefaultToolBar()
+ {
+ if (!d->m_toolBar) {
+ d->setupToolBar();
+ }
+
+ return d->m_toolBar;
+ }
+
+ void DockWidget::setToolBar(QToolBar *toolBar)
+ {
+ if (d->m_toolBar) {
+ delete d->m_toolBar;
+ }
+
+ d->m_toolBar = toolBar;
+ d->m_layout->insertWidget(0, d->m_toolBar);
+ connect(this, &DockWidget::topLevelChanged, this, &DockWidget::setToolbarFloatingStyle);
+ setToolbarFloatingStyle(isFloating());
+ }
+
+ void DockWidget::setToolBarStyle(Qt::ToolButtonStyle style, eState state)
+ {
+ if (StateFloating == state) {
+ d->m_toolBarStyleFloating = style;
+ } else {
+ d->m_toolBarStyleDocked = style;
+ }
+
+ setToolbarFloatingStyle(isFloating());
+ }
+
+ Qt::ToolButtonStyle DockWidget::toolBarStyle(eState state) const
+ {
+ if (StateFloating == state) {
+ return d->m_toolBarStyleFloating;
+ } else {
+ return d->m_toolBarStyleDocked;
+ }
+ }
+
+ void DockWidget::setToolBarIconSize(const QSize &iconSize, eState state)
+ {
+ if (StateFloating == state) {
+ d->m_toolBarIconSizeFloating = iconSize;
+ } else {
+ d->m_toolBarIconSizeDocked = iconSize;
+ }
+
+ setToolbarFloatingStyle(isFloating());
+ }
+
+ QSize DockWidget::toolBarIconSize(eState state) const
+ {
+ if (StateFloating == state) {
+ return d->m_toolBarIconSizeFloating;
+ } else {
+ return d->m_toolBarIconSizeDocked;
+ }
+ }
+
+ void DockWidget::setToolbarFloatingStyle(bool floating)
+ {
+ if (!d->m_toolBar) {
+ return;
+ }
+
+ auto iconSize = floating ? d->m_toolBarIconSizeFloating : d->m_toolBarIconSizeDocked;
+ if (iconSize != d->m_toolBar->iconSize()) {
+ d->m_toolBar->setIconSize(iconSize);
+ }
+
+ auto buttonStyle = floating ? d->m_toolBarStyleFloating : d->m_toolBarStyleDocked;
+ if (buttonStyle != d->m_toolBar->toolButtonStyle()) {
+ d->m_toolBar->setToolButtonStyle(buttonStyle);
+ }
+ }
+
+ void DockWidget::emitTopLevelEventForWidget(DockWidget *topLevelDockWidget, bool floating)
+ {
+ if (topLevelDockWidget) {
+ topLevelDockWidget->dockAreaWidget()->updateTitleBarVisibility();
+ topLevelDockWidget->emitTopLevelChanged(floating);
+ }
+ }
+
+ void DockWidget::emitTopLevelChanged(bool floating)
+ {
+ if (floating != d->m_isFloatingTopLevel) {
+ d->m_isFloatingTopLevel = floating;
+ emit topLevelChanged(d->m_isFloatingTopLevel);
+ }
+ }
+
+ void DockWidget::setClosedState(bool closed) { d->m_closed = closed; }
+
+ QSize DockWidget::minimumSizeHint() const { return QSize(60, 40); }
+
+ void DockWidget::setFloating()
+ {
+ if (isClosed()) {
+ return;
+ }
+ d->m_tabWidget->detachDockWidget();
+ }
+
+ void DockWidget::deleteDockWidget()
+ {
+ dockManager()->removeDockWidget(this);
+ deleteLater();
+ d->m_closed = true;
+ }
+
+ void DockWidget::closeDockWidget()
+ {
+ closeDockWidgetInternal(true);
+ }
+
+ bool DockWidget::closeDockWidgetInternal(bool forceClose)
+ {
+ if (!forceClose) {
+ emit closeRequested();
+ }
+
+ if (!forceClose && features().testFlag(DockWidget::CustomCloseHandling)) {
+ return false;
+ }
+
+ if (features().testFlag(DockWidget::DockWidgetDeleteOnClose)) {
+ // If the dock widget is floating, then we check if we also need to
+ // delete the floating widget
+ if (isFloating()) {
+ FloatingDockContainer* floatingWidget = internal::findParent<
+ FloatingDockContainer *>(this);
+ if (floatingWidget->dockWidgets().count() == 1) {
+ floatingWidget->deleteLater();
+ } else {
+ floatingWidget->hide();
+ }
+ }
+ deleteDockWidget();
+ } else {
+ toggleView(false);
+ }
+
+ return true;
+ }
+
+ void DockWidget::setTitleBarActions(QList<QAction *> actions)
+ {
+ d->m_titleBarActions = actions;
+ }
+
+ QList<QAction *> DockWidget::titleBarActions() const
+ {
+ return d->m_titleBarActions;
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockwidget.h b/src/libs/advanceddockingsystem/dockwidget.h
new file mode 100644
index 00000000000..56fbe4431f0
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockwidget.h
@@ -0,0 +1,493 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QFrame>
+
+QT_BEGIN_NAMESPACE
+class QToolBar;
+class QXmlStreamWriter;
+QT_END_NAMESPACE
+
+namespace ADS {
+
+struct DockWidgetPrivate;
+class DockWidgetTab;
+class DockManager;
+class DockContainerWidget;
+class DockAreaWidget;
+class DockContainerWidgetPrivate;
+class FloatingDockContainer;
+
+/**
+ * The QDockWidget class provides a widget that can be docked inside a
+ * DockManager or floated as a top-level window on the desktop.
+ */
+class ADS_EXPORT DockWidget : public QFrame
+{
+ Q_OBJECT
+private:
+ DockWidgetPrivate *d; ///< private data (pimpl)
+ friend struct DockWidgetPrivate;
+
+ /**
+ * Adjusts the toolbar icon sizes according to the floating state
+ */
+ void setToolbarFloatingStyle(bool topLevel);
+
+protected:
+ friend class DockContainerWidget;
+ friend class DockAreaWidget;
+ friend class FloatingDockContainer;
+ friend class DockManager;
+ friend struct DockManagerPrivate;
+ friend class DockContainerWidgetPrivate;
+ friend class DockAreaTabBar;
+ friend class DockWidgetTab;
+ friend struct DockWidgetTabPrivate;
+ friend struct DockAreaTitleBarPrivate;
+
+ /**
+ * Assigns the dock manager that manages this dock widget
+ */
+ void setDockManager(DockManager *dockManager);
+
+ /**
+ * If this dock widget is inserted into a dock area, the dock area will
+ * be registered on this widget via this function. If a dock widget is
+ * removed from a dock area, this function will be called with nullptr
+ * value.
+ */
+ void setDockArea(DockAreaWidget *dockArea);
+
+ /**
+ * This function changes the toggle view action without emitting any
+ * signal
+ */
+ void setToggleViewActionChecked(bool checked);
+
+ /**
+ * Saves the state into the given stream
+ */
+ void saveState(QXmlStreamWriter &stream) const;
+
+ /**
+ * This is a helper function for the dock manager to flag this widget
+ * as unassigned.
+ * When calling the restore function, it may happen, that the saved state
+ * contains less dock widgets then currently available. All widgets whose
+ * data is not contained in the saved state, are flagged as unassigned
+ * after the restore process. If the user shows an unassigned dock widget,
+ * a floating widget will be created to take up the dock widget.
+ */
+ void flagAsUnassigned();
+
+ /**
+ * Call this function to emit a topLevelChanged() signal and to update
+ * the dock area tool bar visibility
+ */
+ static void emitTopLevelEventForWidget(DockWidget *topLevelDockWidget, bool floating);
+
+ /**
+ * Use this function to emit a top level changed event.
+ * Do never use emit topLevelChanged(). Always use this function because
+ * it only emits a signal if the floating state has really changed
+ */
+ void emitTopLevelChanged(bool floating);
+
+ /**
+ * Internal function for modifying the closed state when restoring
+ * a saved docking state
+ */
+ void setClosedState(bool closed);
+
+ /**
+ * Internal toggle view function that does not check if the widget
+ * already is in the given state
+ */
+ void toggleViewInternal(bool open);
+
+ /**
+ * Internal close dock widget implementation.
+ * The function returns true if the dock widget has been closed or hidden
+ */
+ bool closeDockWidgetInternal(bool forceClose = false);
+
+public:
+ using Super = QFrame;
+
+ enum DockWidgetFeature {
+ DockWidgetClosable = 0x01,
+ DockWidgetMovable = 0x02,///< this feature is not properly implemented yet and is ignored
+ DockWidgetFloatable = 0x04,
+ DockWidgetDeleteOnClose = 0x08, ///< deletes the dock widget when it is closed
+ CustomCloseHandling = 0x10,
+ DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable,
+ AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
+ NoDockWidgetFeatures = 0x00
+ };
+ Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
+
+ enum eState { StateHidden, StateDocked, StateFloating };
+
+ /**
+ * Sets the widget for the dock widget to widget.
+ * The InsertMode defines how the widget is inserted into the dock widget.
+ * The content of a dock widget should be resizable do a very small size to
+ * prevent the dock widget from blocking the resizing. To ensure, that a
+ * dock widget can be resized very well, it is better to insert the content+
+ * widget into a scroll area or to provide a widget that is already a scroll
+ * area or that contains a scroll area.
+ * If the InsertMode is AutoScrollArea, the DockWidget tries to automatically
+ * detect how to insert the given widget. If the widget is derived from
+ * QScrollArea (i.e. an QAbstractItemView), then the widget is inserted
+ * directly. If the given widget is not a scroll area, the widget will be
+ * inserted into a scroll area.
+ * To force insertion into a scroll area, you can also provide the InsertMode
+ * ForceScrollArea. To prevent insertion into a scroll area, you can
+ * provide the InsertMode ForceNoScrollArea
+ */
+ enum eInsertMode { AutoScrollArea, ForceScrollArea, ForceNoScrollArea };
+
+ /**
+ * This mode configures the behavior of the toggle view action.
+ * If the mode if ActionModeToggle, then the toggle view action is
+ * a checkable action to show / hide the dock widget. If the mode
+ * is ActionModeShow, then the action is not checkable an it will
+ * always show the dock widget if clicked. If the mode is ActionModeShow,
+ * the user can only close the DockWidget with the close button.
+ */
+ enum eToggleViewActionMode {
+ ActionModeToggle, //!< ActionModeToggle
+ ActionModeShow //!< ActionModeShow
+ };
+
+ /**
+ * This constructor creates a dock widget with the given title.
+ * The title is the text that is shown in the window title when the dock
+ * widget is floating and it is the title that is shown in the titlebar
+ * or the tab of this dock widget if it is tabified.
+ * The object name of the dock widget is also set to the title. The
+ * object name is required by the dock manager to properly save and restore
+ * the state of the dock widget. That means, the title needs to be unique.
+ * If your title is not unique or if you would like to change the title
+ * during runtime, you need to set a unique object name explicitly
+ * by calling setObjectName() after construction.
+ * Use the layoutFlags to configure the layout of the dock widget.
+ */
+ DockWidget(const QString &uniqueId, QWidget *parent = nullptr);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~DockWidget() override;
+
+ /**
+ * We return a fixed minimum size hint for all dock widgets
+ */
+ virtual QSize minimumSizeHint() const override;
+
+ /**
+ * Sets the widget for the dock widget to widget.
+ * The InsertMode defines how the widget is inserted into the dock widget.
+ * The content of a dock widget should be resizable do a very small size to
+ * prevent the dock widget from blocking the resizing. To ensure, that a
+ * dock widget can be resized very well, it is better to insert the content+
+ * widget into a scroll area or to provide a widget that is already a scroll
+ * area or that contains a scroll area.
+ * If the InsertMode is AutoScrollArea, the DockWidget tries to automatically
+ * detect how to insert the given widget. If the widget is derived from
+ * QScrollArea (i.e. an QAbstractItemView), then the widget is inserted
+ * directly. If the given widget is not a scroll area, the widget will be
+ * inserted into a scroll area.
+ * To force insertion into a scroll area, you can also provide the InsertMode
+ * ForceScrollArea. To prevent insertion into a scroll area, you can
+ * provide the InsertMode ForceNoScrollArea
+ */
+ void setWidget(QWidget *widget, eInsertMode insertMode = AutoScrollArea);
+
+ /**
+ * Remove the widget from the dock and give ownership back to the caller
+ */
+ QWidget *takeWidget();
+
+ /**
+ * Returns the widget for the dock widget. This function returns zero if
+ * the widget has not been set.
+ */
+ QWidget *widget() const;
+
+ /**
+ * Returns the tab widget of this dock widget that is shown in the dock
+ * area title bar
+ */
+ DockWidgetTab *tabWidget() const;
+
+ /**
+ * Sets, whether the dock widget is movable, closable, and floatable.
+ */
+ void setFeatures(DockWidgetFeatures features);
+
+ /**
+ * Sets the feature flag for this dock widget if on is true; otherwise
+ * clears the flag.
+ */
+ void setFeature(DockWidgetFeature flag, bool on);
+
+ /**
+ * This property holds whether the dock widget is movable, closable, and
+ * floatable.
+ * By default, this property is set to a combination of DockWidgetClosable,
+ * DockWidgetMovable and DockWidgetFloatable.
+ */
+ DockWidgetFeatures features() const;
+
+ /**
+ * Returns the dock manager that manages the dock widget or 0 if the widget
+ * has not been assigned to any dock manager yet
+ */
+ DockManager *dockManager() const;
+
+ /**
+ * Returns the dock container widget this dock area widget belongs to or 0
+ * if this dock widget has not been docked yet
+ */
+ DockContainerWidget *dockContainer() const;
+
+ /**
+ * Returns the dock area widget this dock widget belongs to or 0
+ * if this dock widget has not been docked yet
+ */
+ DockAreaWidget *dockAreaWidget() const;
+
+ /**
+ * This property holds whether the dock widget is floating.
+ * A dock widget is only floating, if it is the one and only widget inside
+ * of a floating container. If there are more than one dock widget in a
+ * floating container, the all dock widgets are docked and not floating.
+ */
+ bool isFloating() const;
+
+ /**
+ * This function returns true, if this dock widget is in a floating.
+ * The function returns true, if the dock widget is floating and it also
+ * returns true if it is docked inside of a floating container.
+ */
+ bool isInFloatingContainer() const;
+
+ /**
+ * Returns true, if this dock widget is closed.
+ */
+ bool isClosed() const;
+
+ /**
+ * Returns a checkable action that can be used to show or close this dock widget.
+ * The action's text is set to the dock widget's window title.
+ */
+ QAction *toggleViewAction() const;
+
+ /**
+ * Configures the behavior of the toggle view action.
+ * \see eToggleViewActionMode for a detailed description
+ */
+ void setToggleViewActionMode(eToggleViewActionMode mode);
+
+ /**
+ * Sets the dock widget icon that is shown in tabs and in toggle view
+ * actions
+ */
+ void setIcon(const QIcon &icon);
+
+ /**
+ * Returns the icon that has been assigned to the dock widget
+ */
+ QIcon icon() const;
+
+ /**
+ * If the WithToolBar layout flag is enabled, then this function returns
+ * the dock widget toolbar. If the flag is disabled, the function returns
+ * a nullptr.
+ * This function returns the dock widget top tool bar.
+ * If no toolbar is assigned, this function returns nullptr. To get a valid
+ * toolbar you either need to create a default empty toolbar via
+ * createDefaultToolBar() function or you need to assign you custom
+ * toolbar via setToolBar().
+ */
+ QToolBar *toolBar() const;
+
+ /**
+ * If you would like to use the default top tool bar, then call this
+ * function to create the default tool bar.
+ * After this function the toolBar() function will return a valid toolBar()
+ * object.
+ */
+ QToolBar *createDefaultToolBar();
+
+ /**
+ * Assign a new tool bar that is shown above the content widget.
+ * The dock widget will become the owner of the tool bar and deletes it
+ * on destruction
+ */
+ void setToolBar(QToolBar *toolBar);
+
+ /**
+ * This function sets the tool button style for the given dock widget state.
+ * It is possible to switch the tool button style depending on the state.
+ * If a dock widget is floating, then here are more space and it is
+ * possible to select a style that requires more space like
+ * Qt::ToolButtonTextUnderIcon. For the docked state Qt::ToolButtonIconOnly
+ * might be better.
+ */
+ void setToolBarStyle(Qt::ToolButtonStyle style, eState state);
+
+ /**
+ * Returns the tool button style for the given docking state.
+ * \see setToolBarStyle()
+ */
+ Qt::ToolButtonStyle toolBarStyle(eState state) const;
+
+ /**
+ * This function sets the tool button icon size for the given state.
+ * If a dock widget is floating, there is more space an increasing the
+ * icon size is possible. For docked widgets, small icon sizes, eg. 16 x 16
+ * might be better.
+ */
+ void setToolBarIconSize(const QSize &iconSize, eState state);
+
+ /**
+ * Returns the icon size for a given docking state.
+ * \see setToolBarIconSize()
+ */
+ QSize toolBarIconSize(eState state) const;
+
+ /**
+ * Set the actions that will be shown in the dock area title bar
+ * if this dock widget is the active tab.
+ * You should not add to many actions to the title bar, because this
+ * will remove the available space for the tabs. If you have a number
+ * of actions, just add an action with a menu to show a popup menu
+ * button in the title bar.
+ */
+ void setTitleBarActions(QList<QAction *> actions);
+
+ /**
+ * Returns a list of actions that will be inserted into the dock area title
+ * bar if this dock widget becomes the current widget
+ */
+ virtual QList<QAction *> titleBarActions() const;
+
+#ifndef QT_NO_TOOLTIP
+ /**
+ * This is function sets text tooltip for title bar widget
+ * and tooltip for toggle view action
+ */
+ void setTabToolTip(const QString &text);
+#endif
+
+public: // reimplements QFrame
+ /**
+ * Emits titleChanged signal if title change event occurs
+ */
+ virtual bool event(QEvent *event) override;
+
+ /**
+ * This property controls whether the dock widget is open or closed.
+ * The toogleViewAction triggers this slot
+ */
+ void toggleView(bool open = true);
+
+ /**
+ * This function will make a docked widget floating
+ */
+ void setFloating();
+
+ /**
+ * This function will delete the dock widget and its content from the
+ * docking system
+ */
+ void deleteDockWidget();
+
+ /**
+ * Closes the dock widget
+ */
+ void closeDockWidget();
+
+signals:
+ /**
+ * This signal is emitted if the dock widget is opened or closed
+ */
+ void viewToggled(bool open);
+
+ /**
+ * This signal is emitted if the dock widget is closed
+ */
+ void closed();
+
+ /**
+ * This signal is emitted if the window title of this dock widget
+ * changed
+ */
+ void titleChanged(const QString &title);
+
+ /**
+ * This signal is emitted when the floating property changes.
+ * The topLevel parameter is true if the dock widget is now floating;
+ * otherwise it is false.
+ */
+ void topLevelChanged(bool topLevel);
+
+ /**
+ * This signal is emitted, if close is requested
+ */
+ void closeRequested();
+
+ /**
+ * This signal is emitted when the dock widget becomes visible (or invisible).
+ * This happens when the widget is hidden or shown, as well as when it is
+ * docked in a tabbed dock area and its tab becomes selected or unselected.
+ */
+ void visibilityChanged(bool visible);
+
+ /**
+ * This signal is emitted when the features property changes.
+ * The features parameter gives the new value of the property.
+ */
+ void featuresChanged(DockWidgetFeatures features);
+}; // class DockWidget
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockwidgettab.cpp b/src/libs/advanceddockingsystem/dockwidgettab.cpp
new file mode 100644
index 00000000000..c82fc877c5b
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockwidgettab.cpp
@@ -0,0 +1,525 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "dockwidgettab.h"
+
+#include "ads_globals.h"
+#include "dockareawidget.h"
+#include "dockmanager.h"
+#include "dockoverlay.h"
+#include "dockwidget.h"
+#include "elidinglabel.h"
+#include "floatingdockcontainer.h"
+#include "floatingdragpreview.h"
+#include "iconprovider.h"
+
+#include <QApplication>
+#include <QBoxLayout>
+#include <QLabel>
+#include <QLoggingCategory>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QPushButton>
+#include <QSplitter>
+#include <QStyle>
+#include <QToolButton>
+
+#include <iostream>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ using TabLabelType = ElidingLabel;
+
+ /**
+ * Private data class of DockWidgetTab class (pimpl)
+ */
+ struct DockWidgetTabPrivate
+ {
+ DockWidgetTab *q;
+ DockWidget *m_dockWidget;
+ QLabel *m_iconLabel = nullptr;
+ TabLabelType *m_titleLabel;
+ QPoint m_globalDragStartMousePosition;
+ QPoint m_dragStartMousePosition;
+ bool m_isActiveTab = false;
+ DockAreaWidget *m_dockArea = nullptr;
+ eDragState m_dragState = DraggingInactive;
+ AbstractFloatingWidget *m_floatingWidget = nullptr;
+ QIcon m_icon;
+ QAbstractButton *m_closeButton = nullptr;
+ QSpacerItem *m_iconTextSpacer;
+ QPoint m_tabDragStartPosition;
+
+ /**
+ * Private data constructor
+ */
+ DockWidgetTabPrivate(DockWidgetTab *parent);
+
+ /**
+ * Creates the complete layout including all controls
+ */
+ void createLayout();
+
+ /**
+ * Moves the tab depending on the position in the given mouse event
+ */
+ void moveTab(QMouseEvent *event);
+
+ /**
+ * Test function for current drag state
+ */
+ bool isDraggingState(eDragState dragState) const { return this->m_dragState == dragState; }
+
+ /**
+ * Starts floating of the dock widget that belongs to this title bar
+ * Returns true, if floating has been started and false if floating
+ * is not possible for any reason
+ */
+ bool startFloating(eDragState draggingState = DraggingFloatingWidget);
+
+ /**
+ * Returns true if the given config flag is set
+ */
+ bool testConfigFlag(DockManager::eConfigFlag flag) const
+ {
+ return DockManager::configFlags().testFlag(flag);
+ }
+
+ /**
+ * Creates the close button as QPushButton or as QToolButton
+ */
+ QAbstractButton *createCloseButton() const
+ {
+ if (testConfigFlag(DockManager::TabCloseButtonIsToolButton)) {
+ auto button = new QToolButton();
+ button->setAutoRaise(true);
+ return button;
+ } else {
+ return new QPushButton();
+ }
+ }
+
+ template<typename T>
+ AbstractFloatingWidget *createFloatingWidget(T *widget, bool opaqueUndocking)
+ {
+ if (opaqueUndocking) {
+ return new FloatingDockContainer(widget);
+ } else {
+ auto w = new FloatingDragPreview(widget);
+ QObject::connect(w, &FloatingDragPreview::draggingCanceled, q, [=]() {
+ m_dragState = DraggingInactive;
+ });
+ return w;
+ }
+ }
+
+ /**
+ * Saves the drag start position in global and local coordinates
+ */
+ void saveDragStartMousePosition(const QPoint &globalPos)
+ {
+ m_globalDragStartMousePosition = globalPos;
+ m_dragStartMousePosition = q->mapFromGlobal(globalPos);
+ }
+ };
+ // struct DockWidgetTabPrivate
+
+ DockWidgetTabPrivate::DockWidgetTabPrivate(DockWidgetTab *parent)
+ : q(parent)
+ {}
+
+ void DockWidgetTabPrivate::createLayout()
+ {
+ m_titleLabel = new TabLabelType();
+ m_titleLabel->setElideMode(Qt::ElideRight);
+ m_titleLabel->setText(m_dockWidget->windowTitle());
+ m_titleLabel->setObjectName("dockWidgetTabLabel");
+ m_titleLabel->setAlignment(Qt::AlignCenter);
+ QObject::connect(m_titleLabel, &ElidingLabel::elidedChanged, q, &DockWidgetTab::elidedChanged);
+
+ m_closeButton = createCloseButton();
+ m_closeButton->setObjectName("tabCloseButton");
+ internal::setButtonIcon(m_closeButton, QStyle::SP_TitleBarCloseButton, TabCloseIcon);
+ m_closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ q->onDockWidgetFeaturesChanged();
+ internal::setToolTip(m_closeButton, QObject::tr("Close Tab"));
+ QObject::connect(m_closeButton,
+ &QAbstractButton::clicked,
+ q,
+ &DockWidgetTab::closeRequested);
+
+ QFontMetrics fontMetrics(m_titleLabel->font());
+ int spacing = qRound(fontMetrics.height() / 4.0);
+
+ // Fill the layout
+ QBoxLayout *boxLayout = new QBoxLayout(QBoxLayout::LeftToRight);
+ boxLayout->setContentsMargins(2 * spacing, 0, 0, 0);
+ boxLayout->setSpacing(0);
+ q->setLayout(boxLayout);
+ boxLayout->addWidget(m_titleLabel, 1);
+ boxLayout->addSpacing(spacing);
+ boxLayout->addWidget(m_closeButton);
+ boxLayout->addSpacing(qRound(spacing * 4.0 / 3.0));
+ boxLayout->setAlignment(Qt::AlignCenter);
+
+ m_titleLabel->setVisible(true);
+ }
+
+ void DockWidgetTabPrivate::moveTab(QMouseEvent *event)
+ {
+ event->accept();
+ QPoint distance = event->globalPos() - m_globalDragStartMousePosition;
+ distance.setY(0);
+ auto targetPos = distance + m_tabDragStartPosition;
+ targetPos.rx() = qMax(targetPos.x(), 0);
+ targetPos.rx() = qMin(q->parentWidget()->rect().right() - q->width() + 1, targetPos.rx());
+ q->move(targetPos);
+ q->raise();
+ }
+
+ bool DockWidgetTabPrivate::startFloating(eDragState draggingState)
+ {
+ auto dockContainer = m_dockWidget->dockContainer();
+ qCInfo(adsLog) << "isFloating " << dockContainer->isFloating();
+ qCInfo(adsLog) << "areaCount " << dockContainer->dockAreaCount();
+ qCInfo(adsLog) << "widgetCount " << m_dockWidget->dockAreaWidget()->dockWidgetsCount();
+ // if this is the last dock widget inside of this floating widget,
+ // then it does not make any sense, to make it floating because
+ // it is already floating
+ if (dockContainer->isFloating() && (dockContainer->visibleDockAreaCount() == 1)
+ && (m_dockWidget->dockAreaWidget()->dockWidgetsCount() == 1)) {
+ return false;
+ }
+
+ qCInfo(adsLog) << "startFloating";
+ m_dragState = draggingState;
+ QSize size = m_dockArea->size();
+ AbstractFloatingWidget *floatingWidget = nullptr;
+ bool opaqueUndocking = DockManager::configFlags().testFlag(DockManager::OpaqueUndocking)
+ || (DraggingFloatingWidget != draggingState);
+
+ // If section widget has multiple tabs, we take only one tab
+ // If it has only one single tab, we can move the complete
+ // dock area into floating widget
+ if (m_dockArea->dockWidgetsCount() > 1) {
+ floatingWidget = createFloatingWidget(m_dockWidget, opaqueUndocking);
+ } else {
+ floatingWidget = createFloatingWidget(m_dockArea, opaqueUndocking);
+ }
+
+ if (DraggingFloatingWidget == draggingState) {
+ floatingWidget->startFloating(m_dragStartMousePosition, size, DraggingFloatingWidget, q);
+ auto Overlay = m_dockWidget->dockManager()->containerOverlay();
+ Overlay->setAllowedAreas(OuterDockAreas);
+ this->m_floatingWidget = floatingWidget;
+ } else {
+ floatingWidget->startFloating(m_dragStartMousePosition, size, DraggingInactive, nullptr);
+ }
+
+ return true;
+ }
+
+ DockWidgetTab::DockWidgetTab(DockWidget *dockWidget, QWidget *parent)
+ : QFrame(parent)
+ , d(new DockWidgetTabPrivate(this))
+ {
+ setAttribute(Qt::WA_NoMousePropagation, true);
+ d->m_dockWidget = dockWidget;
+ d->createLayout();
+ }
+
+ DockWidgetTab::~DockWidgetTab()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ delete d;
+ }
+
+ void DockWidgetTab::mousePressEvent(QMouseEvent *event)
+ {
+ if (event->button() == Qt::LeftButton) {
+ event->accept();
+ d->saveDragStartMousePosition(event->globalPos());
+ d->m_dragState = DraggingMousePressed;
+ emit clicked();
+ return;
+ }
+ Super::mousePressEvent(event);
+ }
+
+ void DockWidgetTab::mouseReleaseEvent(QMouseEvent *event)
+ {
+ if (event->button() == Qt::LeftButton) {
+ auto currentDragState = d->m_dragState;
+ d->m_globalDragStartMousePosition = QPoint();
+ d->m_dragStartMousePosition = QPoint();
+ d->m_dragState = DraggingInactive;
+
+ switch (currentDragState) {
+ case DraggingTab:
+ // End of tab moving, emit signal
+ if (d->m_dockArea) {
+ emit moved(event->globalPos());
+ }
+ break;
+
+ case DraggingFloatingWidget:
+ d->m_floatingWidget->finishDragging();
+ break;
+
+ default:; // do nothing
+ }
+ }
+
+ Super::mouseReleaseEvent(event);
+ }
+
+ void DockWidgetTab::mouseMoveEvent(QMouseEvent *event)
+ {
+ if (!(event->buttons() & Qt::LeftButton) || d->isDraggingState(DraggingInactive)) {
+ d->m_dragState = DraggingInactive;
+ Super::mouseMoveEvent(event);
+ return;
+ }
+
+ // move floating window
+ if (d->isDraggingState(DraggingFloatingWidget)) {
+ d->m_floatingWidget->moveFloating();
+ Super::mouseMoveEvent(event);
+ return;
+ }
+
+ // move tab
+ if (d->isDraggingState(DraggingTab)) {
+ // Moving the tab is always allowed because it does not mean moving the
+ // dock widget around
+ d->moveTab(event);
+ }
+
+ auto mappedPos = mapToParent(event->pos());
+ bool mouseOutsideBar = (mappedPos.x() < 0) || (mappedPos.x() > parentWidget()->rect().right());
+ // Maybe a fixed drag distance is better here ?
+ int dragDistanceY = qAbs(d->m_globalDragStartMousePosition.y() - event->globalPos().y());
+ if (dragDistanceY >= DockManager::startDragDistance() || mouseOutsideBar) {
+ // If this is the last dock area in a dock container with only
+ // one single dock widget it does not make sense to move it to a new
+ // floating widget and leave this one empty
+ if (d->m_dockArea->dockContainer()->isFloating()
+ && d->m_dockArea->openDockWidgetsCount() == 1
+ && d->m_dockArea->dockContainer()->visibleDockAreaCount() == 1) {
+ return;
+ }
+
+ // Floating is only allowed for widgets that are floatable
+ // If we do non opaque undocking, then can create the drag preview
+ // if the widget is movable.
+ auto features = d->m_dockWidget->features();
+ if (features.testFlag(DockWidget::DockWidgetFloatable)
+ || (features.testFlag(DockWidget::DockWidgetMovable)
+ && !DockManager::testConfigFlag(DockManager::OpaqueUndocking))) {
+ // If we undock, we need to restore the initial position of this
+ // tab because it looks strange if it remains on its dragged position
+ if (d->isDraggingState(DraggingTab)
+ && !DockManager::configFlags().testFlag(DockManager::OpaqueUndocking)) {
+ parentWidget()->layout()->update();
+ }
+ d->startFloating();
+ }
+ return;
+ } else if (d->m_dockArea->openDockWidgetsCount() > 1
+ && (event->globalPos() - d->m_globalDragStartMousePosition).manhattanLength()
+ >= QApplication::startDragDistance()) // Wait a few pixels before start moving
+ {
+ // If we start dragging the tab, we save its initial position to
+ // restore it later
+ if (DraggingTab != d->m_dragState) {
+ d->m_tabDragStartPosition = this->pos();
+ }
+ d->m_dragState = DraggingTab;
+ return;
+ }
+
+ Super::mouseMoveEvent(event);
+ }
+
+ void DockWidgetTab::contextMenuEvent(QContextMenuEvent *event)
+ {
+ event->accept();
+ if (d->isDraggingState(DraggingFloatingWidget)) {
+ return;
+ }
+
+ d->saveDragStartMousePosition(event->globalPos());
+ QMenu menu(this);
+
+ const bool isFloatable = d->m_dockWidget->features().testFlag(DockWidget::DockWidgetFloatable);
+ const bool isNotOnlyTabInContainer = !d->m_dockArea->dockContainer()->hasTopLevelDockWidget();
+ const bool isDetachable = isFloatable && isNotOnlyTabInContainer;
+
+ auto action = menu.addAction(tr("Detach"), this, &DockWidgetTab::detachDockWidget);
+ action->setEnabled(isDetachable);
+ menu.addSeparator();
+ action = menu.addAction(tr("Close"), this, &DockWidgetTab::closeRequested);
+ action->setEnabled(isClosable());
+ menu.addAction(tr("Close Others"), this, &DockWidgetTab::closeOtherTabsRequested);
+ menu.exec(event->globalPos());
+ }
+
+ bool DockWidgetTab::isActiveTab() const { return d->m_isActiveTab; }
+
+ void DockWidgetTab::setActiveTab(bool active)
+ {
+ bool dockWidgetClosable = d->m_dockWidget->features().testFlag(
+ DockWidget::DockWidgetClosable);
+ bool activeTabHasCloseButton = d->testConfigFlag(DockManager::ActiveTabHasCloseButton);
+ bool allTabsHaveCloseButton = d->testConfigFlag(DockManager::AllTabsHaveCloseButton);
+ bool tabHasCloseButton = (activeTabHasCloseButton && active) | allTabsHaveCloseButton;
+ d->m_closeButton->setVisible(dockWidgetClosable && tabHasCloseButton);
+ if (d->m_isActiveTab == active) {
+ return;
+ }
+
+ d->m_isActiveTab = active;
+
+ style()->unpolish(this);
+ style()->polish(this);
+ d->m_titleLabel->style()->unpolish(d->m_titleLabel);
+ d->m_titleLabel->style()->polish(d->m_titleLabel);
+ update();
+ updateGeometry();
+
+ emit activeTabChanged();
+ }
+
+ DockWidget *DockWidgetTab::dockWidget() const { return d->m_dockWidget; }
+
+ void DockWidgetTab::setDockAreaWidget(DockAreaWidget *dockArea) { d->m_dockArea = dockArea; }
+
+ DockAreaWidget *DockWidgetTab::dockAreaWidget() const { return d->m_dockArea; }
+
+ void DockWidgetTab::setIcon(const QIcon &icon)
+ {
+ QBoxLayout *boxLayout = qobject_cast<QBoxLayout *>(layout());
+ if (!d->m_iconLabel && icon.isNull()) {
+ return;
+ }
+
+ if (!d->m_iconLabel) {
+ d->m_iconLabel = new QLabel();
+ d->m_iconLabel->setAlignment(Qt::AlignVCenter);
+ d->m_iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
+ internal::setToolTip(d->m_iconLabel, d->m_titleLabel->toolTip());
+ boxLayout->insertWidget(0, d->m_iconLabel, Qt::AlignVCenter);
+ boxLayout->insertSpacing(1, qRound(1.5 * boxLayout->contentsMargins().left() / 2.0));
+ } else if (icon.isNull()) {
+ // Remove icon label and spacer item
+ boxLayout->removeWidget(d->m_iconLabel);
+ boxLayout->removeItem(boxLayout->itemAt(0));
+ delete d->m_iconLabel;
+ d->m_iconLabel = nullptr;
+ }
+
+ d->m_icon = icon;
+ if (d->m_iconLabel) {
+ d->m_iconLabel->setPixmap(
+ icon.pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this)));
+ d->m_iconLabel->setVisible(true);
+ }
+ }
+
+ const QIcon &DockWidgetTab::icon() const { return d->m_icon; }
+
+ QString DockWidgetTab::text() const { return d->m_titleLabel->text(); }
+
+ void DockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
+ {
+ // If this is the last dock area in a dock container it does not make
+ // sense to move it to a new floating widget and leave this one empty
+ if ((!d->m_dockArea->dockContainer()->isFloating() || d->m_dockArea->dockWidgetsCount() > 1)
+ && d->m_dockWidget->features().testFlag(DockWidget::DockWidgetFloatable)) {
+ d->saveDragStartMousePosition(event->globalPos());
+ d->startFloating(DraggingInactive);
+ }
+
+ Super::mouseDoubleClickEvent(event);
+ }
+
+ void DockWidgetTab::setVisible(bool visible)
+ {
+ // Just here for debugging to insert debug output
+ Super::setVisible(visible);
+ }
+
+ void DockWidgetTab::setText(const QString &title) { d->m_titleLabel->setText(title); }
+ bool DockWidgetTab::isTitleElided() const { return d->m_titleLabel->isElided(); }
+
+ bool DockWidgetTab::isClosable() const
+ {
+ return d->m_dockWidget
+ && d->m_dockWidget->features().testFlag(DockWidget::DockWidgetClosable);
+ }
+
+ void DockWidgetTab::detachDockWidget()
+ {
+ if (!d->m_dockWidget->features().testFlag(DockWidget::DockWidgetFloatable)) {
+ return;
+ }
+ d->saveDragStartMousePosition(QCursor::pos());
+ d->startFloating(DraggingInactive);
+ }
+
+ bool DockWidgetTab::event(QEvent *event)
+ {
+#ifndef QT_NO_TOOLTIP
+ if (event->type() == QEvent::ToolTipChange) {
+ const auto text = toolTip();
+ d->m_titleLabel->setToolTip(text);
+ }
+#endif
+ return Super::event(event);
+ }
+
+ void DockWidgetTab::onDockWidgetFeaturesChanged()
+ {
+ auto features = d->m_dockWidget->features();
+ auto sizePolicy = d->m_closeButton->sizePolicy();
+ sizePolicy.setRetainSizeWhenHidden(
+ features.testFlag(DockWidget::DockWidgetClosable)
+ && d->testConfigFlag(DockManager::RetainTabSizeWhenCloseButtonHidden));
+ d->m_closeButton->setSizePolicy(sizePolicy);
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/dockwidgettab.h b/src/libs/advanceddockingsystem/dockwidgettab.h
new file mode 100644
index 00000000000..95e973fc4f1
--- /dev/null
+++ b/src/libs/advanceddockingsystem/dockwidgettab.h
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QFrame>
+
+namespace ADS {
+
+class DockWidget;
+class DockAreaWidget;
+struct DockWidgetTabPrivate;
+
+/**
+ * A dock widget tab that shows a title and an icon.
+ * The dock widget tab is shown in the dock area title bar to switch between
+ * tabbed dock widgets
+ */
+class ADS_EXPORT DockWidgetTab : public QFrame
+{
+ Q_OBJECT
+ Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged)
+
+private:
+ DockWidgetTabPrivate *d; ///< private data (pimpl)
+ friend struct DockWidgetTabPrivate;
+ friend class DockWidget;
+ void onDockWidgetFeaturesChanged();
+ void detachDockWidget();
+
+protected:
+ virtual void mousePressEvent(QMouseEvent *event) override;
+ virtual void mouseReleaseEvent(QMouseEvent *event) override;
+ virtual void mouseMoveEvent(QMouseEvent *event) override;
+ virtual void contextMenuEvent(QContextMenuEvent *event) override;
+
+ /**
+ * Double clicking the tab widget makes the assigned dock widget floating
+ */
+ virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
+
+public:
+ using Super = QFrame;
+ /**
+ * Default Constructor
+ * param[in] DockWidget The dock widget this title bar belongs to
+ * param[in] parent The parent widget of this title bar
+ */
+ DockWidgetTab(DockWidget *DockWidget, QWidget *parent = nullptr);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~DockWidgetTab() override;
+
+ /**
+ * Returns true, if this is the active tab
+ */
+ bool isActiveTab() const;
+
+ /**
+ * Set this true to make this tab the active tab
+ */
+ void setActiveTab(bool active);
+
+ /**
+ * Returns the dock widget this title widget belongs to
+ */
+ DockWidget *dockWidget() const;
+
+ /**
+ * Sets the dock area widget the dockWidget returned by dockWidget()
+ * function belongs to.
+ */
+ void setDockAreaWidget(DockAreaWidget *dockArea);
+
+ /**
+ * Returns the dock area widget this title bar belongs to.
+ * \return This function returns 0 if the dock widget that owns this title
+ * bar widget has not been added to any dock area yet.
+ */
+ DockAreaWidget *dockAreaWidget() const;
+
+ /**
+ * Sets the icon to show in title bar
+ */
+ void setIcon(const QIcon &icon);
+
+ /**
+ * Returns the icon
+ */
+ const QIcon &icon() const;
+
+ /**
+ * Returns the tab text
+ */
+ QString text() const;
+
+ /**
+ * Sets the tab text
+ */
+ void setText(const QString &title);
+
+ /**
+ * Returns true if text is elided on the tab's title
+ */
+ bool isTitleElided() const;
+
+ /**
+ * This function returns true if the assigned dock widget is closable
+ */
+ bool isClosable() const;
+
+ /**
+ * Track event ToolTipChange and set child ToolTip
+ */
+ virtual bool event(QEvent *event) override;
+
+ virtual void setVisible(bool visible) override;
+
+signals:
+ void activeTabChanged();
+ void clicked();
+ void closeRequested();
+ void closeOtherTabsRequested();
+ void moved(const QPoint &globalPosition);
+ void elidedChanged(bool elided);
+}; // class DockWidgetTab
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/elidinglabel.cpp b/src/libs/advanceddockingsystem/elidinglabel.cpp
new file mode 100644
index 00000000000..dfd812bae2a
--- /dev/null
+++ b/src/libs/advanceddockingsystem/elidinglabel.cpp
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "elidinglabel.h"
+
+#include <QMouseEvent>
+
+namespace ADS {
+ /**
+ * Private data of public ClickableLabel
+ */
+ struct ElidingLabelPrivate
+ {
+ ElidingLabel *q;
+ Qt::TextElideMode m_elideMode = Qt::ElideNone;
+ QString m_text;
+ bool m_isElided = false;
+
+ ElidingLabelPrivate(ElidingLabel *parent)
+ : q(parent)
+ {}
+
+ void elideText(int width);
+
+ /**
+ * Convenience function to check if the
+ */
+ bool isModeElideNone() const { return Qt::ElideNone == m_elideMode; }
+ };
+
+ void ElidingLabelPrivate::elideText(int width)
+ {
+ if (isModeElideNone())
+ return;
+
+ QFontMetrics fm = q->fontMetrics();
+ QString str = fm.elidedText(m_text, m_elideMode, width - q->margin() * 2 - q->indent());
+ if (str == QChar(0x2026))
+ str = m_text.at(0);
+
+ bool wasElided = m_isElided;
+ m_isElided = str != m_text;
+ if (m_isElided != wasElided)
+ emit q->elidedChanged(m_isElided);
+
+ q->QLabel::setText(str);
+ }
+
+ ElidingLabel::ElidingLabel(QWidget *parent, Qt::WindowFlags flags)
+ : QLabel(parent, flags)
+ , d(new ElidingLabelPrivate(this))
+ {}
+
+ ElidingLabel::ElidingLabel(const QString &text, QWidget *parent, Qt::WindowFlags flags)
+ : QLabel(text, parent, flags)
+ , d(new ElidingLabelPrivate(this))
+ {
+ d->m_text = text;
+ internal::setToolTip(this, text);
+ }
+
+ ElidingLabel::~ElidingLabel()
+ {
+ delete d;
+ }
+
+ Qt::TextElideMode ElidingLabel::elideMode() const
+ {
+ return d->m_elideMode;
+ }
+
+ void ElidingLabel::setElideMode(Qt::TextElideMode mode)
+ {
+ d->m_elideMode = mode;
+ d->elideText(size().width());
+ }
+
+ bool ElidingLabel::isElided() const
+ {
+ return d->m_isElided;
+ }
+
+ void ElidingLabel::mouseReleaseEvent(QMouseEvent *event)
+ {
+ Super::mouseReleaseEvent(event);
+ if (event->button() != Qt::LeftButton) {
+ return;
+ }
+
+ emit clicked();
+ }
+
+ void ElidingLabel::mouseDoubleClickEvent(QMouseEvent *event)
+ {
+ Q_UNUSED(event)
+ emit doubleClicked();
+ Super::mouseDoubleClickEvent(event);
+ }
+
+ void ElidingLabel::resizeEvent(QResizeEvent *event)
+ {
+ if (!d->isModeElideNone()) {
+ d->elideText(event->size().width());
+ }
+ Super::resizeEvent(event);
+ }
+
+ QSize ElidingLabel::minimumSizeHint() const
+ {
+ if (pixmap() != nullptr || d->isModeElideNone()) {
+ return QLabel::minimumSizeHint();
+ }
+ const QFontMetrics &fm = fontMetrics();
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
+ QSize size(fm.horizontalAdvance(d->m_text.left(2) + "…"), fm.height());
+#else
+ QSize size(fm.width(d->m_text.left(2) + "…"), fm.height());
+#endif
+ return size;
+ }
+
+ QSize ElidingLabel::sizeHint() const
+ {
+ if (pixmap() != nullptr || d->isModeElideNone()) {
+ return QLabel::sizeHint();
+ }
+ const QFontMetrics &fm = fontMetrics();
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
+ QSize size(fm.horizontalAdvance(d->m_text), QLabel::sizeHint().height());
+#else
+ QSize size(fm.width(d->m_text), QLabel::sizeHint().height());
+#endif
+ return size;
+ }
+
+ void ElidingLabel::setText(const QString &text)
+ {
+ if (d->isModeElideNone()) {
+ Super::setText(text);
+ } else {
+ d->m_text = text;
+ internal::setToolTip(this, text);
+ d->elideText(this->size().width());
+ }
+ }
+
+ QString ElidingLabel::text() const
+ {
+ return d->m_text;
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/elidinglabel.h b/src/libs/advanceddockingsystem/elidinglabel.h
new file mode 100644
index 00000000000..5bfeb28b06b
--- /dev/null
+++ b/src/libs/advanceddockingsystem/elidinglabel.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QLabel>
+
+namespace ADS {
+
+struct ElidingLabelPrivate;
+
+/**
+ * A QLabel that supports eliding text.
+ * Because the functions setText() and text() are no virtual functions setting
+ * and reading the text via a pointer to the base class QLabel does not work
+ * properly
+ */
+class ADS_EXPORT ElidingLabel : public QLabel
+{
+ Q_OBJECT
+private:
+ ElidingLabelPrivate *d;
+ friend struct ElidingLabelPrivate;
+
+protected:
+ virtual void mouseReleaseEvent(QMouseEvent *event) override;
+ virtual void resizeEvent(QResizeEvent *event) override;
+ virtual void mouseDoubleClickEvent(QMouseEvent *ev) override;
+
+public:
+ using Super = QLabel;
+
+ ElidingLabel(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Widget);
+ ElidingLabel(const QString &text, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Widget);
+ virtual ~ElidingLabel() override;
+
+ /**
+ * Returns the text elide mode.
+ * The default mode is ElideNone
+ */
+ Qt::TextElideMode elideMode() const;
+
+ /**
+ * Sets the text elide mode
+ */
+ void setElideMode(Qt::TextElideMode mode);
+
+ /**
+ * This function indicates whether the text on this label is currently elided
+ */
+ bool isElided() const;
+
+public: // reimplements QLabel
+ virtual QSize minimumSizeHint() const override;
+ virtual QSize sizeHint() const override;
+ void setText(const QString &text);
+ QString text() const;
+
+signals:
+ /**
+ * This signal is emitted if the user clicks on the label (i.e. pressed
+ * down then released while the mouse cursor is inside the label)
+ */
+ void clicked();
+
+ /**
+ * This signal is emitted if the user does a double click on the label
+ */
+ void doubleClicked();
+
+ /**
+ * This signal is emitted when isElided() state of this label is changed
+ */
+ void elidedChanged(bool elided);
+}; //class ElidingLabel
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/floatingdockcontainer.cpp b/src/libs/advanceddockingsystem/floatingdockcontainer.cpp
new file mode 100644
index 00000000000..2fbe879f471
--- /dev/null
+++ b/src/libs/advanceddockingsystem/floatingdockcontainer.cpp
@@ -0,0 +1,563 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "floatingdockcontainer.h"
+
+#include "dockareawidget.h"
+#include "dockcontainerwidget.h"
+#include "dockmanager.h"
+#include "dockoverlay.h"
+#include "dockwidget.h"
+#include "linux/floatingwidgettitlebar.h"
+
+#include <QAbstractButton>
+#include <QAction>
+#include <QApplication>
+#include <QBoxLayout>
+#include <QDebug>
+#include <QElapsedTimer>
+#include <QLoggingCategory>
+#include <QMouseEvent>
+#include <QPointer>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ AbstractFloatingWidget::~AbstractFloatingWidget() = default;
+
+ static unsigned int zOrderCounter = 0;
+ /**
+ * Private data class of FloatingDockContainer class (pimpl)
+ */
+ struct FloatingDockContainerPrivate
+ {
+ FloatingDockContainer *q;
+ DockContainerWidget *m_dockContainer;
+ unsigned int m_zOrderIndex = ++zOrderCounter;
+ QPointer<DockManager> m_dockManager;
+ eDragState m_draggingState = DraggingInactive;
+ QPoint m_dragStartMousePosition;
+ DockContainerWidget *m_dropContainer = nullptr;
+ DockAreaWidget *m_singleDockArea = nullptr;
+ QWidget *m_mouseEventHandler = nullptr;
+ FloatingWidgetTitleBar *m_titleBar = nullptr;
+
+ /**
+ * Private data constructor
+ */
+ FloatingDockContainerPrivate(FloatingDockContainer *parent);
+
+ void titleMouseReleaseEvent();
+ void updateDropOverlays(const QPoint &globalPosition);
+
+ /**
+ * Returns true if the given config flag is set
+ */
+ static bool testConfigFlag(DockManager::eConfigFlag flag)
+ {
+ return DockManager::configFlags().testFlag(flag);
+ }
+
+ /**
+ * Tests is a certain state is active
+ */
+ bool isState(eDragState stateId) const { return stateId == m_draggingState; }
+
+ void setState(eDragState stateId) { m_draggingState = stateId; }
+
+ void setWindowTitle(const QString &text)
+ {
+ if (Utils::HostOsInfo::isLinuxHost())
+ m_titleBar->setTitle(text);
+ else
+ q->setWindowTitle(text);
+ }
+
+ void reflectCurrentWidget(DockWidget *currentWidget)
+ {
+ // reflect CurrentWidget's title if configured to do so, otherwise display application name as window title
+ if (testConfigFlag(DockManager::FloatingContainerHasWidgetTitle)) {
+ setWindowTitle(currentWidget->windowTitle());
+ } else {
+ setWindowTitle(qApp->applicationDisplayName());
+ }
+
+ // reflect CurrentWidget's icon if configured to do so, otherwise display application icon as window icon
+ QIcon CurrentWidgetIcon = currentWidget->icon();
+ if (testConfigFlag(DockManager::FloatingContainerHasWidgetIcon)
+ && !CurrentWidgetIcon.isNull())
+ {
+ q->setWindowIcon(currentWidget->icon());
+ } else {
+ q->setWindowIcon(QApplication::windowIcon());
+ }
+ }
+ };
+ // struct FloatingDockContainerPrivate
+
+ FloatingDockContainerPrivate::FloatingDockContainerPrivate(FloatingDockContainer *parent)
+ : q(parent)
+ {}
+
+ void FloatingDockContainerPrivate::titleMouseReleaseEvent()
+ {
+ setState(DraggingInactive);
+ if (!m_dropContainer) {
+ return;
+ }
+
+ if (m_dockManager->dockAreaOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea
+ || m_dockManager->containerOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea) {
+ // Resize the floating widget to the size of the highlighted drop area rectangle
+ DockOverlay *overlay = m_dockManager->containerOverlay();
+ if (!overlay->dropOverlayRect().isValid()) {
+ overlay = m_dockManager->dockAreaOverlay();
+ }
+
+ QRect rect = overlay->dropOverlayRect();
+ int frameWidth = (q->frameSize().width() - q->rect().width()) / 2;
+ int titleBarHeight = q->frameSize().height() - q->rect().height() - frameWidth;
+ if (rect.isValid()) {
+ QPoint topLeft = overlay->mapToGlobal(rect.topLeft());
+ topLeft.ry() += titleBarHeight;
+ q->setGeometry(QRect(topLeft, QSize(rect.width(), rect.height() - titleBarHeight)));
+ QApplication::processEvents();
+ }
+ m_dropContainer->dropFloatingWidget(q, QCursor::pos());
+ }
+
+ m_dockManager->containerOverlay()->hideOverlay();
+ m_dockManager->dockAreaOverlay()->hideOverlay();
+ }
+
+ void FloatingDockContainerPrivate::updateDropOverlays(const QPoint &globalPosition)
+ {
+ if (!q->isVisible() || !m_dockManager) {
+ return;
+ }
+
+ auto containers = m_dockManager->dockContainers();
+ DockContainerWidget *topContainer = nullptr;
+ for (auto containerWidget : containers) {
+ if (!containerWidget->isVisible()) {
+ continue;
+ }
+
+ if (m_dockContainer == containerWidget) {
+ continue;
+ }
+
+ QPoint mappedPos = containerWidget->mapFromGlobal(globalPosition);
+ if (containerWidget->rect().contains(mappedPos)) {
+ if (!topContainer || containerWidget->isInFrontOf(topContainer)) {
+ topContainer = containerWidget;
+ }
+ }
+ }
+
+ m_dropContainer = topContainer;
+ auto containerOverlay = m_dockManager->containerOverlay();
+ auto dockAreaOverlay = m_dockManager->dockAreaOverlay();
+
+ if (!topContainer) {
+ containerOverlay->hideOverlay();
+ dockAreaOverlay->hideOverlay();
+ return;
+ }
+
+ int visibleDockAreas = topContainer->visibleDockAreaCount();
+ containerOverlay->setAllowedAreas(visibleDockAreas > 1 ? OuterDockAreas : AllDockAreas);
+ DockWidgetArea containerArea = containerOverlay->showOverlay(topContainer);
+ containerOverlay->enableDropPreview(containerArea != InvalidDockWidgetArea);
+ auto dockArea = topContainer->dockAreaAt(globalPosition);
+ if (dockArea && dockArea->isVisible() && visibleDockAreas > 0) {
+ dockAreaOverlay->enableDropPreview(true);
+ dockAreaOverlay->setAllowedAreas((visibleDockAreas == 1) ? NoDockWidgetArea
+ : dockArea->allowedAreas());
+ DockWidgetArea area = dockAreaOverlay->showOverlay(dockArea);
+
+ // A CenterDockWidgetArea for the dockAreaOverlay() indicates that the mouse is in
+ // the title bar. If the ContainerArea is valid then we ignore the dock area of the
+ // dockAreaOverlay() and disable the drop preview
+ if ((area == CenterDockWidgetArea) && (containerArea != InvalidDockWidgetArea)) {
+ dockAreaOverlay->enableDropPreview(false);
+ containerOverlay->enableDropPreview(true);
+ } else {
+ containerOverlay->enableDropPreview(InvalidDockWidgetArea == area);
+ }
+ } else {
+ dockAreaOverlay->hideOverlay();
+ }
+ }
+
+ FloatingDockContainer::FloatingDockContainer(DockManager *dockManager)
+ : FloatingWidgetBaseType(dockManager)
+ , d(new FloatingDockContainerPrivate(this))
+ {
+ d->m_dockManager = dockManager;
+ d->m_dockContainer = new DockContainerWidget(dockManager, this);
+ connect(d->m_dockContainer,
+ &DockContainerWidget::dockAreasAdded,
+ this,
+ &FloatingDockContainer::onDockAreasAddedOrRemoved);
+ connect(d->m_dockContainer,
+ &DockContainerWidget::dockAreasRemoved,
+ this,
+ &FloatingDockContainer::onDockAreasAddedOrRemoved);
+
+#ifdef Q_OS_LINUX
+ d->m_titleBar = new FloatingWidgetTitleBar(this);
+ setWindowFlags(windowFlags() | Qt::Tool);
+ QDockWidget::setWidget(d->m_dockContainer);
+ QDockWidget::setFloating(true);
+ QDockWidget::setFeatures(QDockWidget::AllDockWidgetFeatures);
+ setTitleBarWidget(d->m_titleBar);
+ connect(d->m_titleBar,
+ &FloatingWidgetTitleBar::closeRequested,
+ this,
+ &FloatingDockContainer::close);
+#else
+ setWindowFlags(Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
+ QBoxLayout *boxLayout = new QBoxLayout(QBoxLayout::TopToBottom);
+ boxLayout->setContentsMargins(0, 0, 0, 0);
+ boxLayout->setSpacing(0);
+ setLayout(boxLayout);
+ boxLayout->addWidget(d->m_dockContainer);
+#endif
+ dockManager->registerFloatingWidget(this);
+ }
+
+ FloatingDockContainer::FloatingDockContainer(DockAreaWidget *dockArea)
+ : FloatingDockContainer(dockArea->dockManager())
+ {
+ d->m_dockContainer->addDockArea(dockArea);
+ if (Utils::HostOsInfo::isLinuxHost())
+ d->m_titleBar->enableCloseButton(isClosable());
+
+ auto dw = topLevelDockWidget();
+ if (dw) {
+ dw->emitTopLevelChanged(true);
+ }
+ }
+
+ FloatingDockContainer::FloatingDockContainer(DockWidget *dockWidget)
+ : FloatingDockContainer(dockWidget->dockManager())
+ {
+ d->m_dockContainer->addDockWidget(CenterDockWidgetArea, dockWidget);
+ if (Utils::HostOsInfo::isLinuxHost())
+ d->m_titleBar->enableCloseButton(isClosable());
+
+ auto dw = topLevelDockWidget();
+ if (dw) {
+ dw->emitTopLevelChanged(true);
+ }
+ }
+
+ FloatingDockContainer::~FloatingDockContainer()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ if (d->m_dockManager) {
+ d->m_dockManager->removeFloatingWidget(this);
+ }
+ delete d;
+ }
+
+ DockContainerWidget *FloatingDockContainer::dockContainer() const { return d->m_dockContainer; }
+
+ void FloatingDockContainer::changeEvent(QEvent *event)
+ {
+ QWidget::changeEvent(event);
+ if ((event->type() == QEvent::ActivationChange) && isActiveWindow()) {
+ qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::ActivationChange";
+ d->m_zOrderIndex = ++zOrderCounter;
+ return;
+ }
+ }
+
+ void FloatingDockContainer::moveEvent(QMoveEvent *event)
+ {
+ QWidget::moveEvent(event);
+ switch (d->m_draggingState) {
+ case DraggingMousePressed:
+ d->setState(DraggingFloatingWidget);
+ d->updateDropOverlays(QCursor::pos());
+ break;
+
+ case DraggingFloatingWidget:
+ d->updateDropOverlays(QCursor::pos());
+ if (Utils::HostOsInfo::isMacHost()) {
+ // In macOS when hiding the DockAreaOverlay the application would set
+ // the main window as the active window for some reason. This fixes
+ // that by resetting the active window to the floating widget after
+ // updating the overlays.
+ QApplication::setActiveWindow(this);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ void FloatingDockContainer::closeEvent(QCloseEvent *event)
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ d->setState(DraggingInactive);
+ event->ignore();
+
+ if (isClosable()) {
+ auto dw = topLevelDockWidget();
+ if (dw && dw->features().testFlag(DockWidget::DockWidgetDeleteOnClose)) {
+ if (!dw->closeDockWidgetInternal()) {
+ return;
+ }
+ }
+
+ this->hide();
+ }
+ }
+
+ void FloatingDockContainer::hideEvent(QHideEvent *event)
+ {
+ Super::hideEvent(event);
+ if (event->spontaneous()) {
+ return;
+ }
+
+ // Prevent toogleView() events during restore state
+ if (d->m_dockManager->isRestoringState()) {
+ return;
+ }
+
+ for (auto dockArea : d->m_dockContainer->openedDockAreas()) {
+ for (auto dockWidget : dockArea->openedDockWidgets()) {
+ dockWidget->toggleView(false);
+ }
+ }
+ }
+
+ void FloatingDockContainer::showEvent(QShowEvent *event) { Super::showEvent(event); }
+
+ bool FloatingDockContainer::event(QEvent *event)
+ {
+ switch (d->m_draggingState) {
+ case DraggingInactive: {
+ // Normally we would check here, if the left mouse button is pressed.
+ // But from QT version 5.12.2 on the mouse events from
+ // QEvent::NonClientAreaMouseButtonPress return the wrong mouse button
+ // The event always returns Qt::RightButton even if the left button is clicked.
+ // It is really great to work around the whole NonClientMouseArea bugs
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 2))
+ if (event->type()
+ == QEvent::
+ NonClientAreaMouseButtonPress /*&& QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)*/) {
+ qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::NonClientAreaMouseButtonPress"
+ << event->type();
+ d->setState(DraggingMousePressed);
+ }
+#else
+ if (event->type() == QEvent::NonClientAreaMouseButtonPress
+ && QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)) {
+ qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::NonClientAreaMouseButtonPress"
+ << event->type();
+ d->setState(DraggingMousePressed);
+ }
+#endif
+ } break;
+
+ case DraggingMousePressed:
+ switch (event->type()) {
+ case QEvent::NonClientAreaMouseButtonDblClick:
+ qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::NonClientAreaMouseButtonDblClick";
+ d->setState(DraggingInactive);
+ break;
+
+ case QEvent::Resize:
+ // If the first event after the mouse press is a resize event, then
+ // the user resizes the window instead of dragging it around.
+ // But there is one exception. If the window is maximized,
+ // then dragging the window via title bar will cause the widget to
+ // leave the maximized state. This in turn will trigger a resize event.
+ // To know, if the resize event was triggered by user via moving a
+ // corner of the window frame or if it was caused by a windows state
+ // change, we check, if we are not in maximized state.
+ if (!isMaximized()) {
+ d->setState(DraggingInactive);
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case DraggingFloatingWidget:
+ if (event->type() == QEvent::NonClientAreaMouseButtonRelease) {
+ qCInfo(adsLog) << Q_FUNC_INFO << "QEvent::NonClientAreaMouseButtonRelease";
+ d->titleMouseReleaseEvent();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+#if (ADS_DEBUG_LEVEL > 0)
+ qDebug() << "FloatingDockContainer::event " << event->type();
+#endif
+ return QWidget::event(event);
+ }
+
+ void FloatingDockContainer::startFloating(const QPoint &dragStartMousePos,
+ const QSize &size,
+ eDragState dragState,
+ QWidget *mouseEventHandler)
+ {
+ resize(size);
+ d->setState(dragState);
+ d->m_dragStartMousePosition = dragStartMousePos;
+
+ if (Utils::HostOsInfo::isLinuxHost()) {
+ if (DraggingFloatingWidget == dragState) {
+ setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);
+ d->m_mouseEventHandler = mouseEventHandler;
+ if (d->m_mouseEventHandler) {
+ d->m_mouseEventHandler->grabMouse();
+ }
+ }
+ }
+ moveFloating();
+ show();
+ }
+
+ void FloatingDockContainer::moveFloating()
+ {
+ int borderSize = (frameSize().width() - size().width()) / 2;
+ const QPoint moveToPos = QCursor::pos() - d->m_dragStartMousePosition
+ - QPoint(borderSize, 0);
+ move(moveToPos);
+ }
+
+ bool FloatingDockContainer::isClosable() const
+ {
+ return d->m_dockContainer->features().testFlag(DockWidget::DockWidgetClosable);
+ }
+
+ void FloatingDockContainer::onDockAreasAddedOrRemoved()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ auto topLevelDockArea = d->m_dockContainer->topLevelDockArea();
+ if (topLevelDockArea) {
+ d->m_singleDockArea = topLevelDockArea;
+ DockWidget *currentWidget = d->m_singleDockArea->currentDockWidget();
+ d->reflectCurrentWidget(currentWidget);
+ connect(d->m_singleDockArea,
+ &DockAreaWidget::currentChanged,
+ this,
+ &FloatingDockContainer::onDockAreaCurrentChanged);
+ } else {
+ if (d->m_singleDockArea) {
+ disconnect(d->m_singleDockArea,
+ &DockAreaWidget::currentChanged,
+ this,
+ &FloatingDockContainer::onDockAreaCurrentChanged);
+ d->m_singleDockArea = nullptr;
+ }
+ d->setWindowTitle(qApp->applicationDisplayName());
+ setWindowIcon(QApplication::windowIcon());
+ }
+ }
+
+ void FloatingDockContainer::updateWindowTitle()
+ {
+ auto topLevelDockArea = d->m_dockContainer->topLevelDockArea();
+ if (topLevelDockArea) {
+ DockWidget *currentWidget = topLevelDockArea->currentDockWidget();
+ d->reflectCurrentWidget(currentWidget);
+ } else {
+ d->setWindowTitle(qApp->applicationDisplayName());
+ setWindowIcon(QApplication::windowIcon());
+ }
+ }
+
+ void FloatingDockContainer::onDockAreaCurrentChanged(int index)
+ {
+ Q_UNUSED(index)
+ DockWidget *currentWidget = d->m_singleDockArea->currentDockWidget();
+ d->reflectCurrentWidget(currentWidget);
+ }
+
+ bool FloatingDockContainer::restoreState(DockingStateReader &stream, bool testing)
+ {
+ if (!d->m_dockContainer->restoreState(stream, testing)) {
+ return false;
+ }
+
+ onDockAreasAddedOrRemoved();
+ return true;
+ }
+
+ bool FloatingDockContainer::hasTopLevelDockWidget() const
+ {
+ return d->m_dockContainer->hasTopLevelDockWidget();
+ }
+
+ DockWidget *FloatingDockContainer::topLevelDockWidget() const
+ {
+ return d->m_dockContainer->topLevelDockWidget();
+ }
+
+ QList<DockWidget *> FloatingDockContainer::dockWidgets() const
+ {
+ return d->m_dockContainer->dockWidgets();
+ }
+
+ void FloatingDockContainer::finishDragging()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+
+ if (Utils::HostOsInfo::isLinuxHost()) {
+ setAttribute(Qt::WA_X11NetWmWindowTypeDock, false);
+ setWindowOpacity(1);
+ activateWindow();
+ if (d->m_mouseEventHandler) {
+ d->m_mouseEventHandler->releaseMouse();
+ d->m_mouseEventHandler = nullptr;
+ }
+ }
+ d->titleMouseReleaseEvent();
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/floatingdockcontainer.h b/src/libs/advanceddockingsystem/floatingdockcontainer.h
new file mode 100644
index 00000000000..83be9c2662f
--- /dev/null
+++ b/src/libs/advanceddockingsystem/floatingdockcontainer.h
@@ -0,0 +1,249 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QDockWidget>
+#include <QRubberBand>
+
+#ifdef Q_OS_LINUX
+using FloatingWidgetBaseType = QDockWidget;
+#else
+using FloatingWidgetBaseType = QWidget;
+#endif
+
+namespace ADS {
+
+struct FloatingDockContainerPrivate;
+class DockManager;
+struct DockManagerPrivate;
+class DockAreaWidget;
+class DockContainerWidget;
+class DockWidget;
+class DockManager;
+class DockAreaTabBar;
+class DockWidgetTab;
+struct DockWidgetTabPrivate;
+class DockAreaTitleBar;
+struct DockAreaTitleBarPrivate;
+class FloatingWidgetTitleBar;
+class DockingStateReader;
+
+/**
+ * Pure virtual interface for floating widgets.
+ * This interface is used for opaque and non-opaque undocking. If opaque
+ * undocking is used, the a real FloatingDockContainer widget will be created
+ */
+class AbstractFloatingWidget
+{
+public:
+ virtual ~AbstractFloatingWidget() = 0;
+ /**
+ * Starts floating.
+ * This function should get called typically from a mouse press event
+ * handler
+ */
+ virtual void startFloating(const QPoint &dragStartMousePos,
+ const QSize &size,
+ eDragState dragState,
+ QWidget *mouseEventHandler)
+ = 0;
+
+ /**
+ * Moves the widget to a new position relative to the position given when
+ * startFloating() was called.
+ * This function should be called from a mouse mouve event handler to
+ * move the floating widget on mouse move events.
+ */
+ virtual void moveFloating() = 0;
+
+ /**
+ * Tells the widget that to finish dragging if the mouse is released.
+ * This function should be called from a mouse release event handler
+ * to finish the dragging
+ */
+ virtual void finishDragging() = 0;
+};
+
+/**
+ * This implements a floating widget that is a dock container that accepts
+ * docking of dock widgets like the main window and that can be docked into
+ * another dock container.
+ * Every floating window of the docking system is a FloatingDockContainer.
+ */
+class ADS_EXPORT FloatingDockContainer : public FloatingWidgetBaseType,
+ public AbstractFloatingWidget
+{
+ Q_OBJECT
+private:
+ FloatingDockContainerPrivate *d; ///< private data (pimpl)
+ friend struct FloatingDockContainerPrivate;
+ friend class DockManager;
+ friend struct DockManagerPrivate;
+ friend class DockAreaTabBar;
+ friend struct DockWidgetTabPrivate;
+ friend class DockWidgetTab;
+ friend class DockAreaTitleBar;
+ friend struct DockAreaTitleBarPrivate;
+ friend class DockWidget;
+ friend class DockAreaWidget;
+ friend class FloatingWidgetTitleBar;
+
+ void onDockAreasAddedOrRemoved();
+ void onDockAreaCurrentChanged(int Index);
+
+protected:
+ /**
+ * Starts floating at the given global position.
+ * Use moveToGlobalPos() to move the widget to a new position
+ * depending on the start position given in Pos parameter
+ */
+ virtual void startFloating(const QPoint &dragStartMousePos,
+ const QSize &size,
+ eDragState dragState,
+ QWidget *mouseEventHandler) override;
+
+ /**
+ * Call this function to start dragging the floating widget
+ */
+ void startDragging(const QPoint &dragStartMousePos,
+ const QSize &size,
+ QWidget *mouseEventHandler)
+ {
+ startFloating(dragStartMousePos, size, DraggingFloatingWidget, mouseEventHandler);
+ }
+
+ /**
+ * Call this function if you explicitly want to signal that dragging has
+ * finished
+ */
+ virtual void finishDragging() override;
+
+ /**
+ * Call this function if you just want to initialize the position
+ * and size of the floating widget
+ */
+ void initFloatingGeometry(const QPoint &dragStartMousePos, const QSize &size)
+ {
+ startFloating(dragStartMousePos, size, DraggingInactive, nullptr);
+ }
+
+ /**
+ * Moves the widget to a new position relative to the position given when
+ * startFloating() was called
+ */
+ void moveFloating() override;
+
+ /**
+ * Restores the state from given stream.
+ * If Testing is true, the function only parses the data from the given
+ * stream but does not restore anything. You can use this check for
+ * faulty files before you start restoring the state
+ */
+ bool restoreState(DockingStateReader &stream, bool testing);
+
+ /**
+ * Call this function to update the window title
+ */
+ void updateWindowTitle();
+
+protected: // reimplements QWidget
+ virtual void changeEvent(QEvent *event) override;
+ virtual void moveEvent(QMoveEvent *event) override;
+ virtual bool event(QEvent *event) override;
+ virtual void closeEvent(QCloseEvent *event) override;
+ virtual void hideEvent(QHideEvent *event) override;
+ virtual void showEvent(QShowEvent *event) override;
+
+public:
+ using Super = QWidget;
+
+ /**
+ * Create empty floating widget - required for restore state
+ */
+ FloatingDockContainer(DockManager *dockManager);
+
+ /**
+ * Create floating widget with the given dock area
+ */
+ FloatingDockContainer(DockAreaWidget *dockArea);
+
+ /**
+ * Create floating widget with the given dock widget
+ */
+ FloatingDockContainer(DockWidget *dockWidget);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~FloatingDockContainer() override;
+
+ /**
+ * Access function for the internal dock container
+ */
+ DockContainerWidget *dockContainer() const;
+
+ /**
+ * This function returns true, if it can be closed.
+ * It can be closed, if all dock widgets in all dock areas can be closed
+ */
+ bool isClosable() const;
+
+ /**
+ * This function returns true, if this floating widget has only one single
+ * visible dock widget in a single visible dock area.
+ * The single dock widget is a real top level floating widget because no
+ * other widgets are docked.
+ */
+ bool hasTopLevelDockWidget() const;
+
+ /**
+ * This function returns the first dock widget in the first dock area.
+ * If the function hasSingleDockWidget() returns true, then this function
+ * returns this single dock widget.
+ */
+ DockWidget *topLevelDockWidget() const;
+
+ /**
+ * This function returns a list of all dock widget in this floating widget.
+ * This is a simple convenience function that simply calls the dockWidgets()
+ * function of the internal container widget.
+ */
+ QList<DockWidget *> dockWidgets() const;
+}; // class FloatingDockContainer
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/floatingdragpreview.cpp b/src/libs/advanceddockingsystem/floatingdragpreview.cpp
new file mode 100644
index 00000000000..41dadfc9790
--- /dev/null
+++ b/src/libs/advanceddockingsystem/floatingdragpreview.cpp
@@ -0,0 +1,355 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "floatingdragpreview.h"
+
+#include "dockareawidget.h"
+#include "dockcontainerwidget.h"
+#include "dockmanager.h"
+#include "dockoverlay.h"
+#include "dockwidget.h"
+
+#include <QApplication>
+#include <QEvent>
+#include <QKeyEvent>
+#include <QLoggingCategory>
+#include <QPainter>
+
+#include <iostream>
+
+static Q_LOGGING_CATEGORY(adsLog, "qtc.qmldesigner.advanceddockingsystem", QtWarningMsg)
+
+namespace ADS
+{
+ /**
+ * Private data class (pimpl)
+ */
+ struct FloatingDragPreviewPrivate
+ {
+ FloatingDragPreview *q;
+ QWidget *m_content;
+ DockAreaWidget *m_contentSourceArea = nullptr;
+ DockContainerWidget *m_contenSourceContainer = nullptr;
+ QPoint m_dragStartMousePosition;
+ DockManager *m_dockManager;
+ DockContainerWidget *m_dropContainer = nullptr;
+ qreal m_windowOpacity;
+ bool m_hidden = false;
+ QPixmap m_contentPreviewPixmap;
+
+ /**
+ * Private data constructor
+ */
+ FloatingDragPreviewPrivate(FloatingDragPreview *parent);
+ void updateDropOverlays(const QPoint &globalPosition);
+
+ void setHidden(bool value)
+ {
+ m_hidden = value;
+ q->update();
+ }
+
+ /**
+ * Cancel dragging and emit the draggingCanceled event
+ */
+ void cancelDragging()
+ {
+ emit q->draggingCanceled();
+ m_dockManager->containerOverlay()->hideOverlay();
+ m_dockManager->dockAreaOverlay()->hideOverlay();
+ q->close();
+ }
+ };
+ // struct FloatingDragPreviewPrivate
+
+ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &globalPosition)
+ {
+ if (!q->isVisible() || !m_dockManager) {
+ return;
+ }
+
+ auto containers = m_dockManager->dockContainers();
+ DockContainerWidget *topContainer = nullptr;
+ for (auto containerWidget : containers) {
+ if (!containerWidget->isVisible()) {
+ continue;
+ }
+
+ QPoint mappedPosition = containerWidget->mapFromGlobal(globalPosition);
+ if (containerWidget->rect().contains(mappedPosition)) {
+ if (!topContainer || containerWidget->isInFrontOf(topContainer)) {
+ topContainer = containerWidget;
+ }
+ }
+ }
+
+ m_dropContainer = topContainer;
+ auto containerOverlay = m_dockManager->containerOverlay();
+ auto dockAreaOverlay = m_dockManager->dockAreaOverlay();
+ auto dockDropArea = dockAreaOverlay->dropAreaUnderCursor();
+ auto containerDropArea = containerOverlay->dropAreaUnderCursor();
+
+ if (!topContainer) {
+ containerOverlay->hideOverlay();
+ dockAreaOverlay->hideOverlay();
+ if (DockManager::configFlags().testFlag(DockManager::DragPreviewIsDynamic)) {
+ setHidden(false);
+ }
+ return;
+ }
+
+ int visibleDockAreas = topContainer->visibleDockAreaCount();
+ containerOverlay->setAllowedAreas(visibleDockAreas > 1 ? OuterDockAreas : AllDockAreas);
+ DockWidgetArea containerArea = containerOverlay->showOverlay(topContainer);
+ containerOverlay->enableDropPreview(containerArea != InvalidDockWidgetArea);
+ auto dockArea = topContainer->dockAreaAt(globalPosition);
+ if (dockArea && dockArea->isVisible() && visibleDockAreas > 0
+ && dockArea != m_contentSourceArea) {
+ dockAreaOverlay->enableDropPreview(true);
+ dockAreaOverlay->setAllowedAreas((visibleDockAreas == 1) ? NoDockWidgetArea
+ : dockArea->allowedAreas());
+ DockWidgetArea area = dockAreaOverlay->showOverlay(dockArea);
+
+ // A CenterDockWidgetArea for the dockAreaOverlay() indicates that the mouse is in the
+ // title bar. If the ContainerArea is valid then we ignore the dock area of the
+ // dockAreaOverlay() and disable the drop preview
+ if ((area == CenterDockWidgetArea) && (containerArea != InvalidDockWidgetArea)) {
+ dockAreaOverlay->enableDropPreview(false);
+ containerOverlay->enableDropPreview(true);
+ } else {
+ containerOverlay->enableDropPreview(InvalidDockWidgetArea == area);
+ }
+ } else {
+ dockAreaOverlay->hideOverlay();
+ if (dockArea == m_contentSourceArea && InvalidDockWidgetArea == containerDropArea) {
+ m_dropContainer = nullptr;
+ }
+ }
+
+ if (DockManager::configFlags().testFlag(DockManager::DragPreviewIsDynamic)) {
+ setHidden(dockDropArea != InvalidDockWidgetArea
+ || containerDropArea != InvalidDockWidgetArea);
+ }
+ }
+
+ FloatingDragPreviewPrivate::FloatingDragPreviewPrivate(FloatingDragPreview *parent)
+ : q(parent)
+ {}
+
+ FloatingDragPreview::FloatingDragPreview(QWidget *content, QWidget *parent)
+ : QWidget(parent)
+ , d(new FloatingDragPreviewPrivate(this))
+ {
+ d->m_content = content;
+ setAttribute(Qt::WA_DeleteOnClose);
+ if (DockManager::configFlags().testFlag(DockManager::DragPreviewHasWindowFrame)) {
+ setWindowFlags(Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
+ } else {
+ setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
+ setAttribute(Qt::WA_NoSystemBackground);
+ setAttribute(Qt::WA_TranslucentBackground);
+ }
+
+ if (Utils::HostOsInfo::isLinuxHost()) {
+ auto flags = windowFlags();
+ flags |= Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint;
+ setWindowFlags(flags);
+ }
+
+ setWindowOpacity(0.6);
+
+ // Create a static image of the widget that should get undocked
+ // This is like some kind preview image like it is uses in drag and drop operations
+ if (DockManager::configFlags().testFlag(DockManager::DragPreviewShowsContentPixmap)) {
+ d->m_contentPreviewPixmap = QPixmap(content->size());
+ content->render(&d->m_contentPreviewPixmap);
+ }
+ connect(qApp,
+ &QApplication::applicationStateChanged,
+ this,
+ &FloatingDragPreview::onApplicationStateChanged); // TODO
+ }
+
+ FloatingDragPreview::FloatingDragPreview(DockWidget *content)
+ : FloatingDragPreview(static_cast<QWidget *>(content),
+ content->dockManager()) // TODO static_cast?
+ {
+ d->m_dockManager = content->dockManager();
+ if (content->dockAreaWidget()->openDockWidgetsCount() == 1) {
+ d->m_contentSourceArea = content->dockAreaWidget();
+ d->m_contenSourceContainer = content->dockContainer();
+ }
+ setWindowTitle(content->windowTitle());
+ // We need to install an event filter for the given content
+ // widget to receive the escape key press
+ content->dockAreaWidget()->installEventFilter(this);
+ }
+
+ FloatingDragPreview::FloatingDragPreview(DockAreaWidget *content)
+ : FloatingDragPreview(static_cast<QWidget *>(content),
+ content->dockManager()) // TODO static_cast?
+ {
+ d->m_dockManager = content->dockManager();
+ d->m_contentSourceArea = content;
+ d->m_contenSourceContainer = content->dockContainer();
+ setWindowTitle(content->currentDockWidget()->windowTitle());
+
+ // We need to install an event filter for the given Content
+ // widget to receive the escape key press
+ content->installEventFilter(this);
+ }
+
+ FloatingDragPreview::~FloatingDragPreview() { delete d; }
+
+ void FloatingDragPreview::moveFloating()
+ {
+ int borderSize = (frameSize().width() - size().width()) / 2;
+ const QPoint moveToPos = QCursor::pos() - d->m_dragStartMousePosition
+ - QPoint(borderSize, 0);
+ move(moveToPos);
+ }
+
+ void FloatingDragPreview::startFloating(const QPoint &dragStartMousePos,
+ const QSize &size,
+ eDragState dragState,
+ QWidget *mouseEventHandler)
+ {
+ Q_UNUSED(mouseEventHandler)
+ Q_UNUSED(dragState)
+ resize(size);
+ d->m_dragStartMousePosition = dragStartMousePos;
+ moveFloating();
+ show();
+ }
+
+ void FloatingDragPreview::moveEvent(QMoveEvent *event)
+ {
+ QWidget::moveEvent(event);
+ d->updateDropOverlays(QCursor::pos());
+ }
+
+ void FloatingDragPreview::finishDragging()
+ {
+ qCInfo(adsLog) << Q_FUNC_INFO;
+ auto dockDropArea = d->m_dockManager->dockAreaOverlay()->dropAreaUnderCursor();
+ auto containerDropArea = d->m_dockManager->containerOverlay()->dropAreaUnderCursor();
+ bool dropPossible = (dockDropArea != InvalidDockWidgetArea)
+ || (containerDropArea != InvalidDockWidgetArea);
+ if (d->m_dropContainer && dropPossible) {
+ d->m_dropContainer->dropWidget(d->m_content, QCursor::pos());
+ } else {
+ DockWidget *dockWidget = qobject_cast<DockWidget *>(d->m_content);
+ FloatingDockContainer *floatingWidget = nullptr;
+
+ if (dockWidget && dockWidget->features().testFlag(DockWidget::DockWidgetFloatable)) {
+ floatingWidget = new FloatingDockContainer(dockWidget);
+ } else {
+ DockAreaWidget *dockArea = qobject_cast<DockAreaWidget *>(d->m_content);
+ if (dockArea->features().testFlag(DockWidget::DockWidgetFloatable)) {
+ floatingWidget = new FloatingDockContainer(dockArea);
+ }
+ }
+
+ if (floatingWidget) {
+ floatingWidget->setGeometry(this->geometry());
+ floatingWidget->show();
+ if (!DockManager::configFlags().testFlag(DockManager::DragPreviewHasWindowFrame)) {
+ QApplication::processEvents();
+ int frameHeight = floatingWidget->frameGeometry().height() - floatingWidget->geometry().height();
+ QRect fixedGeometry = this->geometry();
+ fixedGeometry.adjust(0, frameHeight, 0, 0);
+ floatingWidget->setGeometry(fixedGeometry);
+ }
+ }
+ }
+
+ this->close();
+ d->m_dockManager->containerOverlay()->hideOverlay();
+ d->m_dockManager->dockAreaOverlay()->hideOverlay();
+ }
+
+ void FloatingDragPreview::paintEvent(QPaintEvent *event)
+ {
+ Q_UNUSED(event)
+ if (d->m_hidden) {
+ return;
+ }
+
+ QPainter painter(this);
+ if (DockManager::configFlags().testFlag(DockManager::DragPreviewShowsContentPixmap)) {
+ painter.drawPixmap(QPoint(0, 0), d->m_contentPreviewPixmap);
+ }
+
+ // If we do not have a window frame then we paint a QRubberBand like frameless window
+ if (!DockManager::configFlags().testFlag(DockManager::DragPreviewHasWindowFrame)) {
+ QColor color = palette().color(QPalette::Active, QPalette::Highlight);
+ QPen pen = painter.pen();
+ pen.setColor(color.darker(120));
+ pen.setStyle(Qt::SolidLine);
+ pen.setWidth(1);
+ pen.setCosmetic(true);
+ painter.setPen(pen);
+ color = color.lighter(130);
+ color.setAlpha(64);
+ painter.setBrush(color);
+ painter.drawRect(rect().adjusted(0, 0, -1, -1));
+ }
+ }
+
+ void FloatingDragPreview::onApplicationStateChanged(Qt::ApplicationState state)
+ {
+ if (state != Qt::ApplicationActive) {
+ disconnect(qApp,
+ &QApplication::applicationStateChanged,
+ this,
+ &FloatingDragPreview::onApplicationStateChanged);
+ d->cancelDragging();
+ }
+ }
+
+ bool FloatingDragPreview::eventFilter(QObject *watched, QEvent *event)
+ {
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ if (keyEvent->key() == Qt::Key_Escape) {
+ watched->removeEventFilter(this);
+ d->cancelDragging();
+ }
+ }
+
+ return false;
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/floatingdragpreview.h b/src/libs/advanceddockingsystem/floatingdragpreview.h
new file mode 100644
index 00000000000..2c0defba3b0
--- /dev/null
+++ b/src/libs/advanceddockingsystem/floatingdragpreview.h
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "floatingdockcontainer.h"
+
+#include <QWidget>
+
+namespace ADS {
+
+class DockWidget;
+class DockAreaWidget;
+struct FloatingDragPreviewPrivate;
+
+/**
+ * A floating overlay is a temporary floating widget that is just used to
+ * indicate the floating widget movement.
+ * This widget is used as a placeholder for drag operations for non-opaque
+ * docking
+ */
+class FloatingDragPreview : public QWidget, public AbstractFloatingWidget
+{
+ Q_OBJECT
+private:
+ FloatingDragPreviewPrivate *d;
+ friend struct FloatingDragPreviewPrivate;
+
+ /**
+ * Cancel non opaque undocking if application becomes inactive
+ */
+ void onApplicationStateChanged(Qt::ApplicationState state);
+
+protected:
+ /**
+ * Updates the drop overlays
+ */
+ virtual void moveEvent(QMoveEvent *event) override;
+
+ /**
+ * Cares about painting the
+ */
+ virtual void paintEvent(QPaintEvent *event) override;
+
+ /**
+ * The content is a DockArea or a DockWidget
+ */
+ FloatingDragPreview(QWidget *content, QWidget *parent);
+
+public:
+ using Super = QWidget;
+
+ /**
+ * Creates an instance for undocking the DockWidget in Content parameter
+ */
+ FloatingDragPreview(DockWidget *content);
+
+ /**
+ * Creates an instance for undocking the DockArea given in Content
+ * parameters
+ */
+ FloatingDragPreview(DockAreaWidget *content);
+
+ /**
+ * Delete private data
+ */
+ ~FloatingDragPreview() override;
+
+ /**
+ * We filter the events of the assigned content widget to receive
+ * escape key presses for canceling the drag operation
+ */
+ virtual bool eventFilter(QObject *watched, QEvent *event) override;
+
+public: // implements AbstractFloatingWidget
+ virtual void startFloating(const QPoint &dragStartMousePos,
+ const QSize &size,
+ eDragState dragState,
+ QWidget *mouseEventHandler) override;
+
+ /**
+ * Moves the widget to a new position relative to the position given when
+ * startFloating() was called
+ */
+ virtual void moveFloating() override;
+
+ /**
+ * Finishes dragging.
+ * Hides the dock overlays and executes the real undocking and docking
+ * of the assigned Content widget
+ */
+ virtual void finishDragging() override;
+
+signals:
+ /**
+ * This signal is emitted, if dragging has been canceled by escape key
+ * or by active application switching via task manager
+ */
+ void draggingCanceled();
+}; // class FloatingDragPreview
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/iconprovider.cpp b/src/libs/advanceddockingsystem/iconprovider.cpp
new file mode 100644
index 00000000000..6a6f46752bb
--- /dev/null
+++ b/src/libs/advanceddockingsystem/iconprovider.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "iconprovider.h"
+
+#include <QVector>
+
+namespace ADS {
+ /**
+ * Private data class (pimpl)
+ */
+ struct IconProviderPrivate
+ {
+ IconProvider *q;
+ QVector<QIcon> m_userIcons{IconCount, QIcon()};
+
+ /**
+ * Private data constructor
+ */
+ IconProviderPrivate(IconProvider *parent);
+ };
+ // struct LedArrayPanelPrivate
+
+ IconProviderPrivate::IconProviderPrivate(IconProvider *parent)
+ : q(parent)
+ {}
+
+ IconProvider::IconProvider()
+ : d(new IconProviderPrivate(this))
+ {}
+
+ IconProvider::~IconProvider()
+ {
+ delete d;
+ }
+
+ QIcon IconProvider::customIcon(eIcon iconId) const
+ {
+ Q_ASSERT(iconId < d->m_userIcons.size());
+ return d->m_userIcons[iconId];
+ }
+
+ void IconProvider::registerCustomIcon(eIcon iconId, const QIcon &icon)
+ {
+ Q_ASSERT(iconId < d->m_userIcons.size());
+ d->m_userIcons[iconId] = icon;
+ }
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/iconprovider.h b/src/libs/advanceddockingsystem/iconprovider.h
new file mode 100644
index 00000000000..25c59b220b4
--- /dev/null
+++ b/src/libs/advanceddockingsystem/iconprovider.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ads_globals.h"
+
+#include <QIcon>
+
+namespace ADS {
+
+struct IconProviderPrivate;
+
+/**
+ * This object provides all icons that are required by the advanced docking
+ * system.
+ * The IconProvider enables the user to register custom icons in case using
+ * stylesheets is not an option.
+ */
+class ADS_EXPORT IconProvider
+{
+private:
+ IconProviderPrivate *d; ///< private data (pimpl)
+ friend struct IconProviderPrivate;
+
+public:
+ /**
+ * Default Constructor
+ */
+ IconProvider();
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~IconProvider();
+
+ /**
+ * The function returns a custom icon if one is registered and a null Icon
+ * if no custom icon is registered
+ */
+ QIcon customIcon(eIcon iconId) const;
+
+ /**
+ * Registers a custom icon for the given IconId
+ */
+ void registerCustomIcon(eIcon iconId, const QIcon &icon);
+}; // class IconProvider
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/images/close-button-disabled.svg b/src/libs/advanceddockingsystem/images/close-button-disabled.svg
new file mode 100644
index 00000000000..9c60c74ad82
--- /dev/null
+++ b/src/libs/advanceddockingsystem/images/close-button-disabled.svg
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Capa_1"
+ x="0px"
+ y="0px"
+ width="512"
+ height="512"
+ viewBox="0 0 512 512"
+ xml:space="preserve"
+ sodipodi:docname="close-button-disabled.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
+ id="metadata897"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs895" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1017"
+ id="namedview893"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:zoom="0.85862966"
+ inkscape:cx="345.29142"
+ inkscape:cy="32.731258"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Capa_1" />
+<g
+ id="g860"
+ transform="matrix(0.71708683,0,0,0.71708683,128,128)"
+ style="stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:0.50196081">
+ <g
+ id="close"
+ style="stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:0.50196081">
+ <polygon
+ points="357,321.3 214.2,178.5 357,35.7 321.3,0 178.5,142.8 35.7,0 0,35.7 142.8,178.5 0,321.3 35.7,357 178.5,214.2 321.3,357 "
+ id="polygon857"
+ style="stroke:none;stroke-opacity:1;fill:#000000;fill-opacity:0.50196081" />
+ </g>
+</g>
+<g
+ id="g862"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g864"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g866"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g868"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g870"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g872"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g874"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g876"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g878"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g880"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g882"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g884"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g886"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g888"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g890"
+ transform="translate(0,155)">
+</g>
+</svg> \ No newline at end of file
diff --git a/src/libs/advanceddockingsystem/images/close-button.svg b/src/libs/advanceddockingsystem/images/close-button.svg
new file mode 100644
index 00000000000..679bffcf60a
--- /dev/null
+++ b/src/libs/advanceddockingsystem/images/close-button.svg
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Capa_1"
+ x="0px"
+ y="0px"
+ width="512"
+ height="512"
+ viewBox="0 0 512 512"
+ xml:space="preserve"
+ sodipodi:docname="close-button.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
+ id="metadata897"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs895" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1017"
+ id="namedview893"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:zoom="0.85862966"
+ inkscape:cx="345.29142"
+ inkscape:cy="32.731258"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Capa_1" />
+<g
+ id="g860"
+ transform="matrix(0.71708683,0,0,0.71708683,128,128)">
+ <g
+ id="close">
+ <polygon
+ points="357,321.3 214.2,178.5 357,35.7 321.3,0 178.5,142.8 35.7,0 0,35.7 142.8,178.5 0,321.3 35.7,357 178.5,214.2 321.3,357 "
+ id="polygon857" />
+ </g>
+</g>
+<g
+ id="g862"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g864"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g866"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g868"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g870"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g872"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g874"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g876"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g878"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g880"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g882"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g884"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g886"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g888"
+ transform="translate(0,155)">
+</g>
+<g
+ id="g890"
+ transform="translate(0,155)">
+</g>
+</svg> \ No newline at end of file
diff --git a/src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.cpp b/src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.cpp
new file mode 100644
index 00000000000..52eb6e784b5
--- /dev/null
+++ b/src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.cpp
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "floatingwidgettitlebar.h"
+
+#include "ads_globals.h"
+#include "elidinglabel.h"
+#include "floatingdockcontainer.h"
+
+#include <QHBoxLayout>
+#include <QMouseEvent>
+#include <QPixmap>
+#include <QPushButton>
+#include <QStyle>
+#include <QToolButton>
+
+#include <iostream>
+
+namespace ADS {
+
+using TabLabelType = ElidingLabel;
+using tCloseButton = QPushButton;
+
+/**
+ * @brief Private data class of public interface CFloatingWidgetTitleBar
+ */
+struct FloatingWidgetTitleBarPrivate
+{
+ FloatingWidgetTitleBar *q; ///< public interface class
+ QLabel *m_iconLabel = nullptr;
+ TabLabelType *m_titleLabel;
+ tCloseButton *m_closeButton = nullptr;
+ FloatingDockContainer *m_floatingWidget = nullptr;
+ eDragState m_dragState = DraggingInactive;
+
+ FloatingWidgetTitleBarPrivate(FloatingWidgetTitleBar *parent)
+ : q(parent)
+ {}
+
+ /**
+ * Creates the complete layout including all controls
+ */
+ void createLayout();
+};
+
+void FloatingWidgetTitleBarPrivate::createLayout()
+{
+ m_titleLabel = new TabLabelType();
+ m_titleLabel->setElideMode(Qt::ElideRight);
+ m_titleLabel->setText("DockWidget->windowTitle()");
+ m_titleLabel->setObjectName("floatingTitleLabel");
+ m_titleLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+
+ m_closeButton = new tCloseButton();
+ m_closeButton->setObjectName("floatingTitleCloseButton");
+ m_closeButton->setFlat(true);
+
+ // The standard icons do does not look good on high DPI screens
+ QIcon closeIcon;
+ QPixmap normalPixmap = q->style()->standardPixmap(QStyle::SP_TitleBarCloseButton,
+ nullptr,
+ m_closeButton);
+ closeIcon.addPixmap(normalPixmap, QIcon::Normal);
+ closeIcon.addPixmap(internal::createTransparentPixmap(normalPixmap, 0.25), QIcon::Disabled);
+ m_closeButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton));
+ m_closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ m_closeButton->setVisible(true);
+ m_closeButton->setFocusPolicy(Qt::NoFocus);
+ q->connect(m_closeButton, &QPushButton::clicked, q, &FloatingWidgetTitleBar::closeRequested);
+
+ QFontMetrics fontMetrics(m_titleLabel->font());
+ int spacing = qRound(fontMetrics.height() / 4.0);
+
+ // Fill the layout
+ QBoxLayout *layout = new QBoxLayout(QBoxLayout::LeftToRight);
+ layout->setContentsMargins(6, 0, 0, 0);
+ layout->setSpacing(0);
+ q->setLayout(layout);
+ layout->addWidget(m_titleLabel, 1);
+ layout->addSpacing(spacing);
+ layout->addWidget(m_closeButton);
+ layout->setAlignment(Qt::AlignCenter);
+
+ m_titleLabel->setVisible(true);
+}
+
+FloatingWidgetTitleBar::FloatingWidgetTitleBar(FloatingDockContainer *parent)
+ : QWidget(parent)
+ , d(new FloatingWidgetTitleBarPrivate(this))
+{
+ d->m_floatingWidget = parent;
+ d->createLayout();
+}
+
+FloatingWidgetTitleBar::~FloatingWidgetTitleBar()
+{
+ delete d;
+}
+
+void FloatingWidgetTitleBar::mousePressEvent(QMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ d->m_dragState = DraggingFloatingWidget;
+ d->m_floatingWidget->startDragging(event->pos(), d->m_floatingWidget->size(), this);
+ return;
+ }
+ Super::mousePressEvent(event);
+}
+
+void FloatingWidgetTitleBar::mouseReleaseEvent(QMouseEvent *event)
+{
+ d->m_dragState = DraggingInactive;
+ if (d->m_floatingWidget) {
+ d->m_floatingWidget->finishDragging();
+ }
+ Super::mouseReleaseEvent(event);
+}
+
+void FloatingWidgetTitleBar::mouseMoveEvent(QMouseEvent *event)
+{
+ if (!(event->buttons() & Qt::LeftButton) || DraggingInactive == d->m_dragState) {
+ d->m_dragState = DraggingInactive;
+ Super::mouseMoveEvent(event);
+ return;
+ }
+
+ // move floating window
+ if (DraggingFloatingWidget == d->m_dragState) {
+ d->m_floatingWidget->moveFloating();
+ Super::mouseMoveEvent(event);
+ return;
+ }
+ Super::mouseMoveEvent(event);
+}
+
+void FloatingWidgetTitleBar::enableCloseButton(bool enable)
+{
+ d->m_closeButton->setEnabled(enable);
+}
+
+void FloatingWidgetTitleBar::setTitle(const QString &text)
+{
+ d->m_titleLabel->setText(text);
+}
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.h b/src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.h
new file mode 100644
index 00000000000..f35e096a68f
--- /dev/null
+++ b/src/libs/advanceddockingsystem/linux/floatingwidgettitlebar.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Uwe Kindler
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QWidget>
+
+namespace ADS {
+
+class FloatingDockContainer;
+struct FloatingWidgetTitleBarPrivate;
+
+/**
+ * Titlebar for floating widgets to capture non client are mouse events.
+ * Linux does not support NonClieantArea mouse events like
+ * QEvent::NonClientAreaMouseButtonPress. Because these events are required
+ * for the docking system to work properly, we use our own titlebar here to
+ * capture the required mouse events.
+ */
+class FloatingWidgetTitleBar : public QWidget
+{
+ Q_OBJECT
+private:
+ FloatingWidgetTitleBarPrivate *d; ///< private data (pimpl)
+
+protected:
+ virtual void mousePressEvent(QMouseEvent *event) override;
+ virtual void mouseReleaseEvent(QMouseEvent *event) override;
+ virtual void mouseMoveEvent(QMouseEvent *event) override;
+
+public:
+ using Super = QWidget;
+ explicit FloatingWidgetTitleBar(FloatingDockContainer *parent = nullptr);
+
+ /**
+ * Virtual Destructor
+ */
+ virtual ~FloatingWidgetTitleBar() override;
+
+ /**
+ * Enables / disables the window close button.
+ */
+ void enableCloseButton(bool enable);
+
+ /**
+ * Sets the window title, that means, the text of the internal tile label.
+ */
+ void setTitle(const QString &text);
+
+signals:
+ /**
+ * This signal is emitted, if the close button is clicked.
+ */
+ void closeRequested();
+};
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/linux/linux.pri b/src/libs/advanceddockingsystem/linux/linux.pri
new file mode 100644
index 00000000000..bc22027a088
--- /dev/null
+++ b/src/libs/advanceddockingsystem/linux/linux.pri
@@ -0,0 +1,4 @@
+VPATH += $$PWD
+SOURCES += $$PWD/floatingwidgettitlebar.cpp
+
+HEADERS += $$PWD/floatingwidgettitlebar.h
diff --git a/src/libs/advanceddockingsystem/resources.qrc b/src/libs/advanceddockingsystem/resources.qrc
new file mode 100644
index 00000000000..facf3347516
--- /dev/null
+++ b/src/libs/advanceddockingsystem/resources.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/ads">
+ <file>images/close-button.svg</file>
+ <file>images/close-button-disabled.svg</file>
+ </qresource>
+</RCC>
diff --git a/src/libs/advanceddockingsystem/workspacedialog.cpp b/src/libs/advanceddockingsystem/workspacedialog.cpp
new file mode 100644
index 00000000000..ec4d6a23e7e
--- /dev/null
+++ b/src/libs/advanceddockingsystem/workspacedialog.cpp
@@ -0,0 +1,206 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "workspacedialog.h"
+
+#include "dockmanager.h"
+
+#include <utils/algorithm.h>
+
+#include <QInputDialog>
+#include <QValidator>
+
+namespace ADS {
+
+class WorkspaceValidator : public QValidator
+{
+public:
+ WorkspaceValidator(QObject *parent, const QStringList &workspaces);
+ void fixup(QString &input) const override;
+ QValidator::State validate(QString &input, int &pos) const override;
+
+private:
+ QStringList m_workspaces;
+};
+
+WorkspaceValidator::WorkspaceValidator(QObject *parent, const QStringList &workspaces)
+ : QValidator(parent)
+ , m_workspaces(workspaces)
+{}
+
+QValidator::State WorkspaceValidator::validate(QString &input, int &pos) const
+{
+ Q_UNUSED(pos)
+
+ if (input.contains(QLatin1Char('/')) || input.contains(QLatin1Char(':'))
+ || input.contains(QLatin1Char('\\')) || input.contains(QLatin1Char('?'))
+ || input.contains(QLatin1Char('*')) || input.contains(QLatin1Char('_')))
+ return QValidator::Invalid;
+
+ if (m_workspaces.contains(input))
+ return QValidator::Intermediate;
+ else
+ return QValidator::Acceptable;
+}
+
+void WorkspaceValidator::fixup(QString &input) const
+{
+ int i = 2;
+ QString copy;
+ do {
+ copy = input + QLatin1String(" (") + QString::number(i) + QLatin1Char(')');
+ ++i;
+ } while (m_workspaces.contains(copy));
+ input = copy;
+}
+
+WorkspaceNameInputDialog::WorkspaceNameInputDialog(DockManager *manager, QWidget *parent)
+ : QDialog(parent)
+ , m_manager(manager)
+{
+ auto hlayout = new QVBoxLayout(this);
+ auto label = new QLabel(tr("Enter the name of the workspace:"), this);
+ hlayout->addWidget(label);
+ m_newWorkspaceLineEdit = new QLineEdit(this);
+ m_newWorkspaceLineEdit->setValidator(new WorkspaceValidator(this, m_manager->workspaces()));
+ hlayout->addWidget(m_newWorkspaceLineEdit);
+ auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
+ Qt::Horizontal,
+ this);
+ m_okButton = buttons->button(QDialogButtonBox::Ok);
+ m_switchToButton = new QPushButton;
+ buttons->addButton(m_switchToButton, QDialogButtonBox::AcceptRole);
+ connect(m_switchToButton, &QPushButton::clicked, [this]() { m_usedSwitchTo = true; });
+ connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
+ hlayout->addWidget(buttons);
+ setLayout(hlayout);
+}
+
+void WorkspaceNameInputDialog::setActionText(const QString &actionText,
+ const QString &openActionText)
+{
+ m_okButton->setText(actionText);
+ m_switchToButton->setText(openActionText);
+}
+
+void WorkspaceNameInputDialog::setValue(const QString &value)
+{
+ m_newWorkspaceLineEdit->setText(value);
+}
+
+QString WorkspaceNameInputDialog::value() const
+{
+ return m_newWorkspaceLineEdit->text();
+}
+
+bool WorkspaceNameInputDialog::isSwitchToRequested() const
+{
+ return m_usedSwitchTo;
+}
+
+WorkspaceDialog::WorkspaceDialog(DockManager *manager, QWidget *parent)
+ : QDialog(parent)
+ , m_manager(manager)
+{
+ m_ui.setupUi(this);
+ m_ui.workspaceView->setActivationMode(Utils::DoubleClickActivation);
+
+ connect(m_ui.btCreateNew,
+ &QAbstractButton::clicked,
+ m_ui.workspaceView,
+ &WorkspaceView::createNewWorkspace);
+ connect(m_ui.btClone,
+ &QAbstractButton::clicked,
+ m_ui.workspaceView,
+ &WorkspaceView::cloneCurrentWorkspace);
+ connect(m_ui.btDelete,
+ &QAbstractButton::clicked,
+ m_ui.workspaceView,
+ &WorkspaceView::deleteSelectedWorkspaces);
+ connect(m_ui.btSwitch,
+ &QAbstractButton::clicked,
+ m_ui.workspaceView,
+ &WorkspaceView::switchToCurrentWorkspace);
+ connect(m_ui.btRename,
+ &QAbstractButton::clicked,
+ m_ui.workspaceView,
+ &WorkspaceView::renameCurrentWorkspace);
+ connect(m_ui.workspaceView,
+ &WorkspaceView::activated,
+ m_ui.workspaceView,
+ &WorkspaceView::switchToCurrentWorkspace);
+
+ connect(m_ui.workspaceView, &WorkspaceView::selected, this, &WorkspaceDialog::updateActions);
+ connect(m_ui.workspaceView, &WorkspaceView::workspaceSwitched, this, &QDialog::reject);
+
+ m_ui.whatsAWorkspaceLabel->setOpenExternalLinks(true);
+}
+
+void WorkspaceDialog::setAutoLoadWorkspace(bool check)
+{
+ m_ui.autoLoadCheckBox->setChecked(check);
+}
+
+bool WorkspaceDialog::autoLoadWorkspace() const
+{
+ return m_ui.autoLoadCheckBox->checkState() == Qt::Checked;
+}
+
+DockManager *WorkspaceDialog::dockManager() const
+{
+ return m_manager;
+}
+
+void WorkspaceDialog::updateActions(const QStringList &workspaces)
+{
+ if (workspaces.isEmpty()) {
+ m_ui.btDelete->setEnabled(false);
+ m_ui.btRename->setEnabled(false);
+ m_ui.btClone->setEnabled(false);
+ m_ui.btSwitch->setEnabled(false);
+ return;
+ }
+ const bool defaultIsSelected = workspaces.contains("default"); // TODO use const var
+ const bool activeIsSelected = Utils::anyOf(workspaces, [this](const QString &workspace) {
+ return workspace == m_manager->activeWorkspace();
+ });
+ m_ui.btDelete->setEnabled(!defaultIsSelected && !activeIsSelected);
+ m_ui.btRename->setEnabled(workspaces.size() == 1 && !defaultIsSelected);
+ m_ui.btClone->setEnabled(workspaces.size() == 1);
+ m_ui.btSwitch->setEnabled(workspaces.size() == 1);
+}
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/workspacedialog.h b/src/libs/advanceddockingsystem/workspacedialog.h
new file mode 100644
index 00000000000..fb3d6240030
--- /dev/null
+++ b/src/libs/advanceddockingsystem/workspacedialog.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "ui_workspacedialog.h"
+
+#include <QDialog>
+#include <QString>
+
+QT_BEGIN_NAMESPACE
+class QLineEdit;
+class QPushButton;
+QT_END_NAMESPACE
+
+namespace ADS {
+
+class DockManager;
+
+class WorkspaceDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit WorkspaceDialog(DockManager *manager, QWidget *parent = nullptr);
+
+ void setAutoLoadWorkspace(bool);
+ bool autoLoadWorkspace() const;
+
+ DockManager *dockManager() const;
+
+private:
+ void updateActions(const QStringList &workspaces);
+
+ Ui::WorkspaceDialog m_ui;
+
+ DockManager *m_manager = nullptr;
+};
+
+class WorkspaceNameInputDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit WorkspaceNameInputDialog(DockManager *manager, QWidget *parent);
+
+ void setActionText(const QString &actionText, const QString &openActionText);
+ void setValue(const QString &value);
+ QString value() const;
+ bool isSwitchToRequested() const;
+
+private:
+ QLineEdit *m_newWorkspaceLineEdit = nullptr;
+ QPushButton *m_switchToButton = nullptr;
+ QPushButton *m_okButton = nullptr;
+ bool m_usedSwitchTo = false;
+
+ DockManager *m_manager;
+};
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/workspacedialog.ui b/src/libs/advanceddockingsystem/workspacedialog.ui
new file mode 100644
index 00000000000..db38f9fa925
--- /dev/null
+++ b/src/libs/advanceddockingsystem/workspacedialog.ui
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ADS::WorkspaceDialog</class>
+ <widget class="QDialog" name="ADS::WorkspaceDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>373</width>
+ <height>282</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Workspace Manager</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="WorkspaceView" name="workspaceView">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" rowspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="btCreateNew">
+ <property name="text">
+ <string>&amp;New</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btRename">
+ <property name="text">
+ <string>&amp;Rename</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btClone">
+ <property name="text">
+ <string>C&amp;lone</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btDelete">
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btSwitch">
+ <property name="text">
+ <string>&amp;Switch To</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>85</width>
+ <height>48</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="autoLoadCheckBox">
+ <property name="text">
+ <string>Restore last workspace on startup</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="whatsAWorkspaceLabel">
+ <property name="text">
+ <string>&lt;a href=&quot;qthelp://org.qt-project.qtcreator/doc/creator-project-managing-workspaces.html&quot;&gt;What is a Workspace?&lt;/a&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ <property name="centerButtons">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>WorkspaceView</class>
+ <extends>QTreeView</extends>
+ <header>workspaceview.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ADS::WorkspaceDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>191</x>
+ <y>244</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>114</x>
+ <y>237</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ADS::WorkspaceDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>246</x>
+ <y>237</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>78</x>
+ <y>216</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/libs/advanceddockingsystem/workspacemodel.cpp b/src/libs/advanceddockingsystem/workspacemodel.cpp
new file mode 100644
index 00000000000..4a0b20b7466
--- /dev/null
+++ b/src/libs/advanceddockingsystem/workspacemodel.cpp
@@ -0,0 +1,269 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "workspacemodel.h"
+
+#include "dockmanager.h"
+#include "workspacedialog.h"
+
+#include <utils/algorithm.h>
+#include <utils/fileutils.h>
+#include <utils/stringutils.h>
+
+#include <QDir>
+#include <QFileInfo>
+
+namespace ADS {
+
+WorkspaceModel::WorkspaceModel(DockManager *manager, QObject *parent)
+ : QAbstractTableModel(parent)
+ , m_manager(manager)
+{
+ m_sortedWorkspaces = m_manager->workspaces();
+ connect(m_manager, &DockManager::workspaceLoaded, this, &WorkspaceModel::resetWorkspaces);
+}
+
+int WorkspaceModel::indexOfWorkspace(const QString &workspace)
+{
+ return m_sortedWorkspaces.indexOf(workspace);
+}
+
+QString WorkspaceModel::workspaceAt(int row) const
+{
+ return m_sortedWorkspaces.value(row, QString());
+}
+
+QVariant WorkspaceModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ QVariant result;
+ if (orientation == Qt::Horizontal) {
+ switch (role) {
+ case Qt::DisplayRole:
+ switch (section) {
+ case 0:
+ result = tr("Workspace");
+ break;
+ case 1:
+ result = tr("Last Modified");
+ break;
+ } // switch (section)
+ break;
+ } // switch (role)
+ }
+ return result;
+}
+
+int WorkspaceModel::columnCount(const QModelIndex &) const
+{
+ static int sectionCount = 0;
+ if (sectionCount == 0) {
+ // headers sections defining possible columns
+ while (!headerData(sectionCount, Qt::Horizontal, Qt::DisplayRole).isNull())
+ sectionCount++;
+ }
+
+ return sectionCount;
+}
+
+int WorkspaceModel::rowCount(const QModelIndex &) const
+{
+ return m_sortedWorkspaces.count();
+}
+
+QStringList pathsToBaseNames(const QStringList &paths)
+{
+ return Utils::transform(paths,
+ [](const QString &path) { return QFileInfo(path).completeBaseName(); });
+}
+
+QStringList pathsWithTildeHomePath(const QStringList &paths)
+{
+ return Utils::transform(paths, [](const QString &path) {
+ return Utils::withTildeHomePath(QDir::toNativeSeparators(path));
+ });
+}
+
+QVariant WorkspaceModel::data(const QModelIndex &index, int role) const
+{
+ QVariant result;
+ if (index.isValid()) {
+ QString workspaceName = m_sortedWorkspaces.at(index.row());
+
+ switch (role) {
+ case Qt::DisplayRole:
+ switch (index.column()) {
+ case 0:
+ result = workspaceName;
+ break;
+ case 1:
+ result = m_manager->workspaceDateTime(workspaceName);
+ break;
+ } // switch (section)
+ break;
+ case Qt::FontRole: {
+ QFont font;
+ if (m_manager->isDefaultWorkspace(workspaceName))
+ font.setItalic(true);
+ else
+ font.setItalic(false);
+ if (m_manager->activeWorkspace() == workspaceName
+ && !m_manager->isFactoryDefaultWorkspace(workspaceName))
+ font.setBold(true);
+ else
+ font.setBold(false);
+ result = font;
+ } break;
+ case DefaultWorkspaceRole:
+ result = m_manager->isDefaultWorkspace(workspaceName);
+ break;
+ case LastWorkspaceRole:
+ result = m_manager->lastWorkspace() == workspaceName;
+ break;
+ case ActiveWorkspaceRole:
+ result = m_manager->activeWorkspace() == workspaceName;
+ break;
+ } // switch (role)
+ }
+
+ return result;
+}
+
+QHash<int, QByteArray> WorkspaceModel::roleNames() const
+{
+ static QHash<int, QByteArray> extraRoles{{Qt::DisplayRole, "workspaceName"},
+ {DefaultWorkspaceRole, "defaultWorkspace"},
+ {LastWorkspaceRole, "activeWorkspace"},
+ {ActiveWorkspaceRole, "lastWorkspace"}};
+ return QAbstractTableModel::roleNames().unite(extraRoles);
+}
+
+void WorkspaceModel::sort(int column, Qt::SortOrder order)
+{
+ beginResetModel();
+ const auto cmp = [this, column, order](const QString &s1, const QString &s2) {
+ bool isLess;
+ if (column == 0)
+ isLess = s1 < s2;
+ else
+ isLess = m_manager->workspaceDateTime(s1) < m_manager->workspaceDateTime(s2);
+ if (order == Qt::DescendingOrder)
+ isLess = !isLess;
+ return isLess;
+ };
+ Utils::sort(m_sortedWorkspaces, cmp);
+ endResetModel();
+}
+
+bool WorkspaceModel::isDefaultVirgin() const
+{
+ return false; //m_manager->isFactoryDefaultWorkspace(); // TODO
+}
+
+void WorkspaceModel::resetWorkspaces()
+{
+ beginResetModel();
+ m_sortedWorkspaces = m_manager->workspaces();
+ endResetModel();
+}
+
+void WorkspaceModel::newWorkspace(QWidget *parent)
+{
+ WorkspaceNameInputDialog workspaceInputDialog(m_manager, parent);
+ workspaceInputDialog.setWindowTitle(tr("New Workspace Name"));
+ workspaceInputDialog.setActionText(tr("&Create"), tr("Create and &Open"));
+
+ runWorkspaceNameInputDialog(&workspaceInputDialog, [this](const QString &newName) {
+ m_manager->createWorkspace(newName);
+ });
+}
+
+void WorkspaceModel::cloneWorkspace(QWidget *parent, const QString &workspace)
+{
+ WorkspaceNameInputDialog workspaceInputDialog(m_manager, parent);
+ workspaceInputDialog.setWindowTitle(tr("New Workspace Name"));
+ workspaceInputDialog.setActionText(tr("&Clone"), tr("Clone and &Open"));
+ workspaceInputDialog.setValue(workspace + " (2)");
+
+ runWorkspaceNameInputDialog(&workspaceInputDialog, [this, workspace](const QString &newName) {
+ m_manager->cloneWorkspace(workspace, newName);
+ });
+}
+
+void WorkspaceModel::deleteWorkspaces(const QStringList &workspaces)
+{
+ if (!m_manager->confirmWorkspaceDelete(workspaces))
+ return;
+ beginResetModel();
+ m_manager->deleteWorkspaces(workspaces);
+ endResetModel();
+}
+
+void WorkspaceModel::renameWorkspace(QWidget *parent, const QString &workspace)
+{
+ WorkspaceNameInputDialog workspaceInputDialog(m_manager, parent);
+ workspaceInputDialog.setWindowTitle(tr("Rename Workspace"));
+ workspaceInputDialog.setActionText(tr("&Rename"), tr("Rename and &Open"));
+ workspaceInputDialog.setValue(workspace);
+
+ runWorkspaceNameInputDialog(&workspaceInputDialog, [this, workspace](const QString &newName) {
+ m_manager->renameWorkspace(workspace, newName);
+ });
+}
+
+void WorkspaceModel::switchToWorkspace(const QString &workspace)
+{
+ m_manager->openWorkspace(workspace);
+ emit workspaceSwitched();
+}
+
+void WorkspaceModel::runWorkspaceNameInputDialog(WorkspaceNameInputDialog *workspaceInputDialog,
+ std::function<void(const QString &)> createWorkspace)
+{
+ if (workspaceInputDialog->exec() == QDialog::Accepted) {
+ QString newWorkspace = workspaceInputDialog->value();
+ if (newWorkspace.isEmpty() || m_manager->workspaces().contains(newWorkspace))
+ return;
+ beginResetModel();
+ createWorkspace(newWorkspace);
+ m_sortedWorkspaces = m_manager->workspaces();
+ endResetModel();
+
+ if (workspaceInputDialog->isSwitchToRequested())
+ switchToWorkspace(newWorkspace);
+ emit workspaceCreated(newWorkspace);
+ }
+}
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/workspacemodel.h b/src/libs/advanceddockingsystem/workspacemodel.h
new file mode 100644
index 00000000000..ac4abae37fe
--- /dev/null
+++ b/src/libs/advanceddockingsystem/workspacemodel.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QAbstractTableModel>
+
+#include <functional>
+
+namespace ADS {
+
+class DockManager;
+class WorkspaceNameInputDialog;
+
+class WorkspaceModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ enum { DefaultWorkspaceRole = Qt::UserRole + 1, LastWorkspaceRole, ActiveWorkspaceRole };
+
+ explicit WorkspaceModel(DockManager *manager, QObject *parent = nullptr);
+
+ int indexOfWorkspace(const QString &workspace);
+ QString workspaceAt(int row) const;
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ QHash<int, QByteArray> roleNames() const override;
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
+
+ Q_SCRIPTABLE bool isDefaultVirgin() const;
+
+signals:
+ void workspaceSwitched();
+ void workspaceCreated(const QString &workspaceName);
+
+public:
+ void resetWorkspaces();
+ void newWorkspace(QWidget *parent);
+ void cloneWorkspace(QWidget *parent, const QString &workspace);
+ void deleteWorkspaces(const QStringList &workspaces);
+ void renameWorkspace(QWidget *parent, const QString &workspace);
+ void switchToWorkspace(const QString &workspace);
+
+private:
+ void runWorkspaceNameInputDialog(WorkspaceNameInputDialog *workspaceInputDialog,
+ std::function<void(const QString &)> createWorkspace);
+
+ QStringList m_sortedWorkspaces;
+ DockManager *m_manager;
+};
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/workspaceview.cpp b/src/libs/advanceddockingsystem/workspaceview.cpp
new file mode 100644
index 00000000000..3a5182011ba
--- /dev/null
+++ b/src/libs/advanceddockingsystem/workspaceview.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "workspaceview.h"
+
+#include "dockmanager.h"
+#include "workspacedialog.h"
+
+#include <utils/algorithm.h>
+
+#include <QHeaderView>
+#include <QItemSelection>
+#include <QStringList>
+#include <QStyledItemDelegate>
+
+namespace ADS {
+
+// custom item delegate class
+class RemoveItemFocusDelegate : public QStyledItemDelegate
+{
+public:
+ RemoveItemFocusDelegate(QObject *parent = nullptr)
+ : QStyledItemDelegate(parent)
+ {}
+
+protected:
+ void paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const override;
+};
+
+void RemoveItemFocusDelegate::paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+{
+ QStyleOptionViewItem opt = option;
+ opt.state &= ~QStyle::State_HasFocus;
+ QStyledItemDelegate::paint(painter, opt, index);
+}
+
+WorkspaceDialog *WorkspaceView::castToWorkspaceDialog(QWidget *widget)
+{
+ auto dialog = qobject_cast<WorkspaceDialog *>(widget);
+ Q_ASSERT(dialog);
+ return dialog;
+}
+
+WorkspaceView::WorkspaceView(QWidget *parent)
+ : Utils::TreeView(parent)
+ , m_manager(WorkspaceView::castToWorkspaceDialog(parent)->dockManager())
+ , m_workspaceModel(m_manager)
+{
+ setItemDelegate(new RemoveItemFocusDelegate(this));
+ setSelectionBehavior(QAbstractItemView::SelectRows);
+ setSelectionMode(QAbstractItemView::ExtendedSelection);
+ setWordWrap(false);
+ setRootIsDecorated(false);
+ setSortingEnabled(true);
+
+ setModel(&m_workspaceModel);
+ sortByColumn(0, Qt::AscendingOrder);
+
+ // Ensure that the full workspace name is visible.
+ header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
+
+ QItemSelection firstRow(m_workspaceModel.index(0, 0),
+ m_workspaceModel.index(0, m_workspaceModel.columnCount() - 1));
+ selectionModel()->select(firstRow, QItemSelectionModel::QItemSelectionModel::SelectCurrent);
+
+ connect(this, &Utils::TreeView::activated, [this](const QModelIndex &index) {
+ emit activated(m_workspaceModel.workspaceAt(index.row()));
+ });
+ connect(selectionModel(), &QItemSelectionModel::selectionChanged, [this] {
+ emit selected(selectedWorkspaces());
+ });
+
+ connect(&m_workspaceModel,
+ &WorkspaceModel::workspaceSwitched,
+ this,
+ &WorkspaceView::workspaceSwitched);
+ connect(&m_workspaceModel,
+ &WorkspaceModel::modelReset,
+ this,
+ &WorkspaceView::selectActiveWorkspace);
+ connect(&m_workspaceModel,
+ &WorkspaceModel::workspaceCreated,
+ this,
+ &WorkspaceView::selectWorkspace);
+}
+
+void WorkspaceView::createNewWorkspace()
+{
+ m_workspaceModel.newWorkspace(this);
+}
+
+void WorkspaceView::deleteSelectedWorkspaces()
+{
+ deleteWorkspaces(selectedWorkspaces());
+}
+
+void WorkspaceView::deleteWorkspaces(const QStringList &workspaces)
+{
+ m_workspaceModel.deleteWorkspaces(workspaces);
+}
+
+void WorkspaceView::cloneCurrentWorkspace()
+{
+ m_workspaceModel.cloneWorkspace(this, currentWorkspace());
+}
+
+void WorkspaceView::renameCurrentWorkspace()
+{
+ m_workspaceModel.renameWorkspace(this, currentWorkspace());
+}
+
+void WorkspaceView::switchToCurrentWorkspace()
+{
+ m_workspaceModel.switchToWorkspace(currentWorkspace());
+}
+
+QString WorkspaceView::currentWorkspace()
+{
+ return m_workspaceModel.workspaceAt(selectionModel()->currentIndex().row());
+}
+
+WorkspaceModel *WorkspaceView::workspaceModel()
+{
+ return &m_workspaceModel;
+}
+
+void WorkspaceView::selectActiveWorkspace()
+{
+ selectWorkspace(m_manager->activeWorkspace());
+}
+
+void WorkspaceView::selectWorkspace(const QString &workspaceName)
+{
+ int row = m_workspaceModel.indexOfWorkspace(workspaceName);
+ selectionModel()->setCurrentIndex(model()->index(row, 0),
+ QItemSelectionModel::ClearAndSelect
+ | QItemSelectionModel::Rows);
+}
+
+void WorkspaceView::showEvent(QShowEvent *event)
+{
+ Utils::TreeView::showEvent(event);
+ selectActiveWorkspace();
+ setFocus();
+}
+
+void WorkspaceView::keyPressEvent(QKeyEvent *event)
+{
+ if (event->key() != Qt::Key_Delete) {
+ TreeView::keyPressEvent(event);
+ return;
+ }
+ const QStringList workspaces = selectedWorkspaces();
+ if (!workspaces.contains("default")
+ && !Utils::anyOf(workspaces, [this](const QString &workspace) {
+ return workspace == m_manager->activeWorkspace();
+ })) {
+ deleteWorkspaces(workspaces);
+ }
+}
+
+QStringList WorkspaceView::selectedWorkspaces() const
+{
+ return Utils::transform(selectionModel()->selectedRows(), [this](const QModelIndex &index) {
+ return m_workspaceModel.workspaceAt(index.row());
+ });
+}
+
+} // namespace ADS
diff --git a/src/libs/advanceddockingsystem/workspaceview.h b/src/libs/advanceddockingsystem/workspaceview.h
new file mode 100644
index 00000000000..7edde4d62eb
--- /dev/null
+++ b/src/libs/advanceddockingsystem/workspaceview.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or (at your option) any later version.
+** The licenses are as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPLv21 included in the packaging
+** of this file. Please review the following information to ensure
+** the GNU Lesser General Public License version 2.1 requirements
+** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "workspacemodel.h"
+
+#include <utils/itemviews.h>
+
+#include <QAbstractTableModel>
+
+namespace ADS {
+
+class DockManager;
+class WorkspaceDialog;
+
+class WorkspaceView : public Utils::TreeView
+{
+ Q_OBJECT
+
+public:
+ explicit WorkspaceView(QWidget *parent = nullptr);
+
+ void createNewWorkspace();
+ void deleteSelectedWorkspaces();
+ void cloneCurrentWorkspace();
+ void renameCurrentWorkspace();
+ void switchToCurrentWorkspace();
+
+ QString currentWorkspace();
+ WorkspaceModel *workspaceModel();
+ void selectActiveWorkspace();
+ void selectWorkspace(const QString &workspaceName);
+
+signals:
+ void activated(const QString &workspace);
+ void selected(const QStringList &workspaces);
+ void workspaceSwitched();
+
+private:
+ void showEvent(QShowEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+
+ void deleteWorkspaces(const QStringList &workspaces);
+ QStringList selectedWorkspaces() const;
+
+ static WorkspaceDialog *castToWorkspaceDialog(QWidget *widget);
+
+ DockManager *m_manager;
+ WorkspaceModel m_workspaceModel;
+};
+
+} // namespace ADS
diff --git a/src/libs/clangsupport/connectionclient.cpp b/src/libs/clangsupport/connectionclient.cpp
index b3025baeea2..fe74c6ca1dc 100644
--- a/src/libs/clangsupport/connectionclient.cpp
+++ b/src/libs/clangsupport/connectionclient.cpp
@@ -324,8 +324,15 @@ void ConnectionClient::connectStandardOutputAndError(QProcess *process) const
void ConnectionClient::connectLocalSocketError() const
{
+ constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ = &QLocalSocket::error;
+#else
+ = &QLocalSocket::errorOccurred;
+#endif
+
connect(m_localSocket,
- QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
+ LocalSocketErrorFunction,
this,
&ConnectionClient::printLocalSocketError);
}
diff --git a/src/libs/clangsupport/connectionserver.h b/src/libs/clangsupport/connectionserver.h
index b60083c4f80..1196459c565 100644
--- a/src/libs/clangsupport/connectionserver.h
+++ b/src/libs/clangsupport/connectionserver.h
@@ -81,8 +81,15 @@ public:
private:
void connectToLocalServer(const QString &connectionName)
{
+ constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ = &QLocalSocket::error;
+#else
+ = &QLocalSocket::errorOccurred;
+#endif
+
QObject::connect(&m_localSocket,
- QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
+ LocalSocketErrorFunction,
[&] (QLocalSocket::LocalSocketError) {
qWarning() << "ConnectionServer error:" << m_localSocket.errorString() << connectionName;
});
diff --git a/src/libs/extensionsystem/invoker.cpp b/src/libs/extensionsystem/invoker.cpp
index 150dabdaa8c..a881bafa9d5 100644
--- a/src/libs/extensionsystem/invoker.cpp
+++ b/src/libs/extensionsystem/invoker.cpp
@@ -38,28 +38,28 @@ namespace ExtensionSystem {
*/
/*!
- \fn Result invoke(QObject *target, const char *slot)
+ \fn template <class Result> Result ExtensionSystem::invoke(QObject *target, const char *slot)
Invokes \a slot on \a target by name via Qt's meta method system.
Returns the result of the meta call.
*/
/*!
- \fn Result invoke(QObject *target, const char *slot, const T0 &t0)
+ \fn template <class Result, class T0> Result ExtensionSystem::invoke(QObject *target, const char *slot, const T0 &t0)
Invokes \a slot on \a target with argument \a t0 by name via Qt's meta method system.
Returns the result of the meta call.
*/
/*!
- \fn Result invoke(QObject *target, const char *slot, const T0 &t0, const T1 &t1)
+ \fn template <class Result, class T0, class T1> Result ExtensionSystem::invoke(QObject *target, const char *slot, const T0 &t0, const T1 &t1)
Invokes \a slot on \a target with arguments \a t0 and \a t1 by name via Qt's meta method system.
Returns the result of the meta call.
*/
/*!
- \fn Result invoke(QObject *target, const char *slot, const T0 &t0, const T1 &t1, const T2 &t2)
+ \fn template <class Result, class T0, class T1, class T2> Result ExtensionSystem::invoke(QObject *target, const char *slot, const T0 &t0, const T1 &t1, const T2 &t2)
Invokes \a slot on \a target with arguments \a t0, \a t1 and \a t2 by name
via Qt's meta method system.
diff --git a/src/libs/extensionsystem/iplugin.cpp b/src/libs/extensionsystem/iplugin.cpp
index ede65b0c5d4..4062b8b3527 100644
--- a/src/libs/extensionsystem/iplugin.cpp
+++ b/src/libs/extensionsystem/iplugin.cpp
@@ -62,7 +62,7 @@
*/
/*!
- \fn bool IPlugin::initialize(const QStringList &arguments, QString *errorString)
+ \fn bool ExtensionSystem::IPlugin::initialize(const QStringList &arguments, QString *errorString)
Called after the plugin has been loaded and the IPlugin instance
has been created.
@@ -79,7 +79,7 @@
*/
/*!
- \fn void IPlugin::extensionsInitialized()
+ \fn void ExtensionSystem::IPlugin::extensionsInitialized()
Called after the initialize() function has been called,
and after both the initialize() and \c extensionsInitialized()
functions of plugins that depend on this plugin have been called.
@@ -94,7 +94,7 @@
*/
/*!
- \fn bool IPlugin::delayedInitialize()
+ \fn bool ExtensionSystem::IPlugin::delayedInitialize()
Called after all plugins' extensionsInitialized() function has been called,
and after the \c delayedInitialize() function of plugins that depend on this
plugin have been called.
@@ -117,7 +117,7 @@
*/
/*!
- \fn IPlugin::ShutdownFlag IPlugin::aboutToShutdown()
+ \fn ExtensionSystem::IPlugin::ShutdownFlag ExtensionSystem::IPlugin::aboutToShutdown()
Called during a shutdown sequence in the same order as initialization
before the plugins get deleted in reverse order.
@@ -140,9 +140,9 @@
*/
/*!
- \fn QObject *IPlugin::remoteCommand(const QStringList &options,
- const QString &workingDirectory,
- const QStringList &arguments)
+ \fn QObject *ExtensionSystem::IPlugin::remoteCommand(const QStringList &options,
+ const QString &workingDirectory,
+ const QStringList &arguments)
When \QC is executed with the \c -client argument while another \QC instance
is running, this function of the plugin is called in the running instance.
@@ -161,7 +161,7 @@
*/
/*!
- \fn void IPlugin::asynchronousShutdownFinished()
+ \fn void ExtensionSystem::IPlugin::asynchronousShutdownFinished()
Sent by the plugin implementation after an asynchronous shutdown
is ready to proceed with the shutdown sequence.
diff --git a/src/libs/extensionsystem/pluginerroroverview.cpp b/src/libs/extensionsystem/pluginerroroverview.cpp
index acf4d6f25b5..25b3f70aaa5 100644
--- a/src/libs/extensionsystem/pluginerroroverview.cpp
+++ b/src/libs/extensionsystem/pluginerroroverview.cpp
@@ -41,8 +41,6 @@ PluginErrorOverview::PluginErrorOverview(QWidget *parent) :
QDialog(parent),
m_ui(new Internal::Ui::PluginErrorOverview)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
m_ui->setupUi(this);
m_ui->buttonBox->addButton(tr("Continue"), QDialogButtonBox::AcceptRole);
diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp
index bec97e69a7c..2bd012b495f 100644
--- a/src/libs/extensionsystem/pluginmanager.cpp
+++ b/src/libs/extensionsystem/pluginmanager.cpp
@@ -213,7 +213,7 @@ enum { debugLeaks = 0 };
*/
/*!
- \fn T *PluginManager::getObject()
+ \fn template <typename T> *ExtensionSystem::PluginManager::getObject()
Retrieves the object of a given type from the object pool.
@@ -225,7 +225,7 @@ enum { debugLeaks = 0 };
*/
/*!
- \fn T *PluginManager::getObject(Predicate predicate)
+ \fn template <typename T, typename Predicate> *ExtensionSystem::PluginManager::getObject(Predicate predicate)
Retrieves the object of a given type from the object pool that matches
the \a predicate.
@@ -618,7 +618,7 @@ static QStringList subList(const QStringList &in, const QString &key)
}
/*!
- Parses the options encoded by serializedArguments() const
+ Parses the options encoded in \a serializedArgument
and passes them on to the respective plugins along with the arguments.
\a socket is passed for disconnecting the peer when the operation is done (for example,
@@ -704,7 +704,9 @@ static inline void formatOption(QTextStream &str,
}
/*!
- Formats the startup options of the plugin manager for command line help.
+ Formats the startup options of the plugin manager for command line help with the specified
+ \a optionIndentation and \a descriptionIndentation.
+ Adds the result to \a str.
*/
void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int descriptionIndentation)
@@ -741,7 +743,9 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d
}
/*!
- Formats the plugin options of the plugin specs for command line help.
+ Formats the plugin options of the plugin specs for command line help with the specified
+ \a optionIndentation and \a descriptionIndentation.
+ Adds the result to \a str.
*/
void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation)
@@ -758,7 +762,7 @@ void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation,
}
/*!
- Formats the version of the plugin specs for command line help.
+ Formats the version of the plugin specs for command line help and adds it to \a str.
*/
void PluginManager::formatPluginVersions(QTextStream &str)
{
@@ -767,7 +771,7 @@ void PluginManager::formatPluginVersions(QTextStream &str)
}
/*!
- * \internal
+ \internal
*/
bool PluginManager::testRunRequested()
{
@@ -775,8 +779,7 @@ bool PluginManager::testRunRequested()
}
/*!
- Creates a profiling entry showing the elapsed time if profiling is
- activated.
+ \internal
*/
void PluginManager::profilingReport(const char *what, const PluginSpec *spec)
@@ -1121,7 +1124,7 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin,
<< "\".\nAvailable functions:\n";
for (const QString &f : testFunctionsOfPluginObject)
out << " " << f << '\n';
- out << endl;
+ out << '\n';
}
}
diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp
index 09103676315..5c789413f58 100644
--- a/src/libs/extensionsystem/pluginview.cpp
+++ b/src/libs/extensionsystem/pluginview.cpp
@@ -57,19 +57,19 @@
*/
/*!
- \fn void PluginView::currentPluginChanged(ExtensionSystem::PluginSpec *spec)
+ \fn void ExtensionSystem::PluginView::currentPluginChanged(ExtensionSystem::PluginSpec *spec)
The current selection in the plugin list has changed to the
plugin corresponding to \a spec.
*/
/*!
- \fn void PluginView::pluginActivated(ExtensionSystem::PluginSpec *spec)
+ \fn void ExtensionSystem::PluginView::pluginActivated(ExtensionSystem::PluginSpec *spec)
The plugin list entry corresponding to \a spec has been activated,
for example by a double-click.
*/
/*!
- \fn void PluginView::pluginSettingsChanged(ExtensionSystem::PluginSpec *spec)
+ \fn void ExtensionSystem::PluginView::pluginSettingsChanged(ExtensionSystem::PluginSpec *spec)
The settings for the plugin list entry corresponding to \a spec changed.
*/
diff --git a/src/libs/libs.pro b/src/libs/libs.pro
index 550a6b0b97f..7213fa66312 100644
--- a/src/libs/libs.pro
+++ b/src/libs/libs.pro
@@ -23,6 +23,13 @@ qtHaveModule(quick) {
tracing
}
+QTC_DO_NOT_BUILD_QMLDESIGNER = $$(QTC_DO_NOT_BUILD_QMLDESIGNER)
+isEmpty(QTC_DO_NOT_BUILD_QMLDESIGNER):qtHaveModule(quick-private) {
+ exists($$[QT_INSTALL_QML]/QtQuick/Controls/qmldir) {
+ SUBDIRS += advanceddockingsystem
+ }
+}
+
for(l, SUBDIRS) {
QTC_LIB_DEPENDS =
include($$l/$${l}_dependencies.pri)
diff --git a/src/libs/libs.qbs b/src/libs/libs.qbs
index 84fc626501b..0c3c8733706 100644
--- a/src/libs/libs.qbs
+++ b/src/libs/libs.qbs
@@ -3,6 +3,7 @@ import qbs
Project {
name: "Libs"
references: [
+ "advanceddockingsystem/advanceddockingsystem.qbs",
"aggregation/aggregation.qbs",
"clangsupport/clangsupport.qbs",
"cplusplus/cplusplus.qbs",
diff --git a/src/libs/modelinglib/qmt/infrastructure/handle.h b/src/libs/modelinglib/qmt/infrastructure/handle.h
index 0c28c3f2287..b7333a11464 100644
--- a/src/libs/modelinglib/qmt/infrastructure/handle.h
+++ b/src/libs/modelinglib/qmt/infrastructure/handle.h
@@ -41,6 +41,8 @@ public:
template<class U>
Handle(const Handle<U> &rhs) : m_uid(rhs.uid()), m_target(rhs.target()) { }
+ Handle &operator=(const Handle &) = default;
+
bool isNull() const { return !m_uid.isValid(); }
bool hasTarget() const { return m_target != nullptr; }
Uid uid() const { return m_uid; }
diff --git a/src/libs/qmldebug/qmldebugconnection.cpp b/src/libs/qmldebug/qmldebugconnection.cpp
index b06a88f9479..33b050efb37 100644
--- a/src/libs/qmldebug/qmldebugconnection.cpp
+++ b/src/libs/qmldebug/qmldebugconnection.cpp
@@ -387,8 +387,14 @@ void QmlDebugConnection::newConnection()
connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected,
Qt::QueuedConnection);
- connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
- this, [this](QLocalSocket::LocalSocketError error) {
+ constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ = &QLocalSocket::error;
+#else
+ = &QLocalSocket::errorOccurred;
+#endif
+
+ connect(socket, LocalSocketErrorFunction, this, [this](QLocalSocket::LocalSocketError error) {
emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error)));
socketDisconnected();
}, Qt::QueuedConnection);
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp
index 292f063b2b4..64cb19f2edb 100644
--- a/src/libs/qmljs/qmljscheck.cpp
+++ b/src/libs/qmljs/qmljscheck.cpp
@@ -603,16 +603,9 @@ public:
class UnsupportedTypesByQmlUi : public QStringList
{
public:
- UnsupportedTypesByQmlUi() : QStringList({"Binding",
- "ShaderEffect",
- "ShaderEffectSource",
+ UnsupportedTypesByQmlUi() : QStringList({"ShaderEffect",
"Component",
"Transition",
- "PropertyAnimation",
- "SequentialAnimation",
- "PropertyAnimation",
- "SequentialAnimation",
- "ParallelAnimation",
"Drawer"})
{
append(UnsupportedTypesByVisualDesigner());
diff --git a/src/libs/qtcreatorcdbext/CMakeLists.txt b/src/libs/qtcreatorcdbext/CMakeLists.txt
index 1fdf656e9e1..b08a833b7a6 100644
--- a/src/libs/qtcreatorcdbext/CMakeLists.txt
+++ b/src/libs/qtcreatorcdbext/CMakeLists.txt
@@ -35,6 +35,7 @@ endif()
add_qtc_library(qtcreatorcdbext
COMPONENT qtcreatorcdbext
BUILD_BY_DEFAULT
+ UNVERSIONED
DEPENDS ${DbgEngLib}
DESTINATION lib/qtcreatorcdbext${ArchSuffix}/
SOURCES
diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h
index 035f5ca6659..ec4d6e90025 100644
--- a/src/libs/utils/algorithm.h
+++ b/src/libs/utils/algorithm.h
@@ -38,6 +38,7 @@
#include <unordered_map>
#include <unordered_set>
+#include <QHash>
#include <QObject>
#include <QSet>
#include <QStringList>
@@ -1298,4 +1299,14 @@ QList<T> toList(const QSet<T> &set)
#endif
}
+template <class Key, class T>
+void addToHash(QHash<Key, T> *result, const QHash<Key, T> &additionalContents)
+{
+#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
+ result->unite(additionalContents);
+#else
+ result->insert(additionalContents);
+#endif
+}
+
} // namespace Utils
diff --git a/src/libs/utils/checkablemessagebox.cpp b/src/libs/utils/checkablemessagebox.cpp
index ccf773cb99d..0cded34acd7 100644
--- a/src/libs/utils/checkablemessagebox.cpp
+++ b/src/libs/utils/checkablemessagebox.cpp
@@ -118,7 +118,6 @@ CheckableMessageBox::CheckableMessageBox(QWidget *parent) :
d(new CheckableMessageBoxPrivate(this))
{
setModal(true);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(d->buttonBox, &QDialogButtonBox::clicked,
diff --git a/src/libs/utils/namevaluesdialog.cpp b/src/libs/utils/namevaluesdialog.cpp
index 4f92a79680d..2b78dc76610 100644
--- a/src/libs/utils/namevaluesdialog.cpp
+++ b/src/libs/utils/namevaluesdialog.cpp
@@ -89,7 +89,6 @@ void NameValueItemsWidget::setPlaceholderText(const QString &text)
NameValuesDialog::NameValuesDialog(const QString &windowTitle, const QString &helpText, QWidget *parent)
: QDialog(parent)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
resize(640, 480);
m_editor = new Internal::NameValueItemsWidget(this);
auto box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 3b92f649975..2088ae408fc 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -39,6 +39,7 @@
#include <qt_windows.h>
#else
#include <errno.h>
+#include <stdio.h>
#include <unistd.h>
#endif
@@ -1226,7 +1227,7 @@ void QtcProcess::setupChildProcess()
if (m_lowPriority) {
errno = 0;
if (::nice(5) == -1 && errno != 0)
- qWarning("Failed to set nice value. Error: %d", errno);
+ perror("Failed to set nice value");
}
#endif
QProcess::setupChildProcess();
diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp
index 4efd1495b73..c3a850b28b6 100644
--- a/src/libs/utils/wizard.cpp
+++ b/src/libs/utils/wizard.cpp
@@ -320,7 +320,6 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags) :
setOption(QWizard::NoBackButtonOnStartPage, true);
if (!Utils::creatorTheme()->preferredStyles().isEmpty())
setWizardStyle(QWizard::ModernStyle);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
if (HostOsInfo::isMacHost()) {
setButtonLayout(QList<QWizard::WizardButton>()
diff --git a/src/plugins/android/androiddevicedialog.cpp b/src/plugins/android/androiddevicedialog.cpp
index 4fb41262126..a2783d4d514 100644
--- a/src/plugins/android/androiddevicedialog.cpp
+++ b/src/plugins/android/androiddevicedialog.cpp
@@ -472,8 +472,6 @@ AndroidDeviceDialog::AndroidDeviceDialog(int apiLevel, const QStringList &abis,
connect(m_ui->lookingForDeviceCancel, &QPushButton::clicked,
this, &AndroidDeviceDialog::defaultDeviceClear);
-
- m_connectedDevices = AndroidConfig::connectedDevices(AndroidConfigurations::currentConfig().adbToolPath());
}
AndroidDeviceDialog::~AndroidDeviceDialog()
diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp
index 3027495dfc1..d4bc98d6bb9 100644
--- a/src/plugins/android/androidmanager.cpp
+++ b/src/plugins/android/androidmanager.cpp
@@ -539,6 +539,8 @@ QString AndroidManager::androidNameForApiLevel(int x)
return QLatin1String("Android 9");
case 29:
return QLatin1String("Android 10");
+ case 30:
+ return QLatin1String("Android 11");
default:
return tr("Unknown Android version. API Level: %1").arg(QString::number(x));
}
diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp
index 6f0bff08bcb..bc80a84ba75 100644
--- a/src/plugins/android/androidmanifesteditorwidget.cpp
+++ b/src/plugins/android/androidmanifesteditorwidget.cpp
@@ -49,32 +49,39 @@
#include <texteditor/texteditor.h>
#include <utils/algorithm.h>
+#include <utils/fileutils.h>
+#include <utils/stylehelper.h>
#include <utils/utilsicons.h>
-#include <QLineEdit>
-#include <QFileInfo>
-#include <QDomDocument>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QDebug>
#include <QDir>
+#include <QDomDocument>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
+#include <QImage>
#include <QLabel>
-#include <QFormLayout>
-#include <QComboBox>
-#include <QSpinBox>
-#include <QDebug>
-#include <QToolButton>
-#include <utils/fileutils.h>
-#include <utils/stylehelper.h>
+#include <QLineEdit>
#include <QListView>
+#include <QLoggingCategory>
#include <QPushButton>
-#include <QFileDialog>
-#include <QTimer>
-#include <QCheckBox>
#include <QScrollArea>
+#include <QSpinBox>
+#include <QTimer>
+#include <QToolButton>
#include <algorithm>
#include <limits>
+
+namespace {
+static Q_LOGGING_CATEGORY(androidManifestEditorLog, "qtc.android.manifestEditor", QtWarningMsg)
+}
+
using namespace ProjectExplorer;
using namespace Android;
using namespace Android::Internal;
@@ -237,22 +244,44 @@ void AndroidManifestEditorWidget::initializePage()
createDPIButton(iconLayout,
applicationGroupBox,
- m_lIconButton, m_lIconClearButton,
- tr("Low DPI icon"), tr("Select low DPI icon."));
+ m_masterIconButton, iconSize(LowDPI),
+ tr("Master icon"), tr("Select master icon."));
+
+ m_masterIconButton->setIcon(QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon()));
+
+ iconLayout->addStretch(1);
+
+ QFrame* line = new QFrame();
+ line->setFrameShape(QFrame::VLine);
+ line->setFrameShadow(QFrame::Sunken);
+ iconLayout->addWidget(line);
+
+ iconLayout->addStretch(1);
+
+ createDPIButton(iconLayout,
+ applicationGroupBox,
+ m_lIconButton, iconSize(LowDPI),
+ tr("Low DPI icon"), tr("Select low DPI icon."),
+ &m_lIconClearButton,
+ &m_lIconScaleWarningLabel);
iconLayout->addStretch(1);
createDPIButton(iconLayout,
applicationGroupBox,
- m_mIconButton, m_mIconClearButton,
- tr("Medium DPI icon"), tr("Select medium DPI icon."));
+ m_mIconButton, iconSize(MediumDPI),
+ tr("Medium DPI icon"), tr("Select medium DPI icon."),
+ &m_mIconClearButton,
+ &m_mIconScaleWarningLabel);
iconLayout->addStretch(1);
createDPIButton(iconLayout,
applicationGroupBox,
- m_hIconButton, m_hIconClearButton,
- tr("High DPI icon"), tr("Select high DPI icon."));
+ m_hIconButton, iconSize(HighDPI),
+ tr("High DPI icon"), tr("Select high DPI icon."),
+ &m_hIconClearButton,
+ &m_hIconScaleWarningLabel);
iconLayout->addStretch(6);
@@ -269,6 +298,8 @@ void AndroidManifestEditorWidget::initializePage()
connect(m_targetLineEdit, &QComboBox::currentTextChanged,
this, setDirtyFunc);
+ connect(m_masterIconButton, &QAbstractButton::clicked,
+ this, &AndroidManifestEditorWidget::setMasterIcon);
connect(m_lIconButton, &QAbstractButton::clicked,
this, &AndroidManifestEditorWidget::setLDPIIcon);
connect(m_mIconButton, &QAbstractButton::clicked,
@@ -549,10 +580,7 @@ void AndroidManifestEditorWidget::setDirty(bool dirty)
bool AndroidManifestEditorWidget::isModified() const
{
- return m_dirty
- || !m_hIconPath.isEmpty()
- || !m_mIconPath.isEmpty()
- || !m_lIconPath.isEmpty();
+ return m_dirty;
}
AndroidManifestEditorWidget::EditorPage AndroidManifestEditorWidget::activePage() const
@@ -592,18 +620,10 @@ void AndroidManifestEditorWidget::preSave()
syncToEditor();
QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
- if (!m_lIconPath.isEmpty()) {
- copyIcon(LowDPI, baseDir, m_lIconPath);
- m_lIconPath.clear();
- }
- if (!m_mIconPath.isEmpty()) {
- copyIcon(MediumDPI, baseDir, m_mIconPath);
- m_mIconPath.clear();
- }
- if (!m_hIconPath.isEmpty()) {
- copyIcon(HighDPI, baseDir, m_hIconPath);
- m_hIconPath.clear();
- }
+ copyIcon(LowDPI, baseDir, m_lIconPath);
+ copyIcon(MediumDPI, baseDir, m_mIconPath);
+ copyIcon(HighDPI, baseDir, m_hIconPath);
+
// no need to emit changed() since this is called as part of saving
updateInfoBar();
@@ -795,9 +815,9 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
m_lIconButton->setIcon(icon(baseDir, LowDPI));
m_mIconButton->setIcon(icon(baseDir, MediumDPI));
m_hIconButton->setIcon(icon(baseDir, HighDPI));
- m_lIconPath.clear();
- m_mIconPath.clear();
- m_hIconPath.clear();
+ m_lIconPath = baseDir + iconPath(LowDPI);
+ m_mIconPath = baseDir + iconPath(MediumDPI);
+ m_hIconPath = baseDir + iconPath(HighDPI);
disconnect(m_defaultPermissonsCheckBox, &QCheckBox::stateChanged,
this, &AndroidManifestEditorWidget::defaultPermissionOrFeatureCheckBoxClicked);
@@ -999,15 +1019,17 @@ void AndroidManifestEditorWidget::parseApplication(QXmlStreamReader &reader, QXm
QXmlStreamAttributes attributes = reader.attributes();
QStringList keys = {QLatin1String("android:label")};
QStringList values = {m_appNameLineEdit->text()};
+ QStringList remove;
bool ensureIconAttribute = !m_lIconPath.isEmpty()
|| !m_mIconPath.isEmpty()
|| !m_hIconPath.isEmpty();
if (ensureIconAttribute) {
keys << QLatin1String("android:icon");
values << QLatin1String("@drawable/icon");
- }
+ } else
+ remove << QLatin1String("android:icon");
- QXmlStreamAttributes result = modifyXmlStreamAttributes(attributes, keys, values);
+ QXmlStreamAttributes result = modifyXmlStreamAttributes(attributes, keys, values, remove);
writer.writeAttributes(result);
reader.readNext();
@@ -1230,6 +1252,34 @@ QString AndroidManifestEditorWidget::iconPath(IconDPI dpi)
return {};
}
+QSize AndroidManifestEditorWidget::iconSize(IconDPI dpi)
+{
+ switch (dpi) {
+ case HighDPI:
+ return QSize(72, 72);
+ case MediumDPI:
+ return QSize(48, 48);
+ case LowDPI:
+ return QSize(32, 32);
+ }
+ return QSize(72, 72);
+}
+
+void AndroidManifestEditorWidget::updateIconPath(const QString &newPath, IconDPI dpi)
+{
+ switch (dpi) {
+ case HighDPI:
+ m_hIconPath = newPath;
+ break;
+ case MediumDPI:
+ m_mIconPath = newPath;
+ break;
+ case LowDPI:
+ m_lIconPath = newPath;
+ break;
+ }
+}
+
QIcon AndroidManifestEditorWidget::icon(const QString &baseDir, IconDPI dpi)
{
@@ -1250,90 +1300,177 @@ QIcon AndroidManifestEditorWidget::icon(const QString &baseDir, IconDPI dpi)
void AndroidManifestEditorWidget::copyIcon(IconDPI dpi, const QString &baseDir, const QString &filePath)
{
- if (!QFileInfo::exists(filePath))
+ const QString targetPath = baseDir + iconPath(dpi);
+ if (targetPath.isEmpty()) {
+ qCDebug(androidManifestEditorLog) << "Icon target path empty, cannot copy icon.";
+ return;
+ }
+ QFileInfo targetFile(targetPath);
+ if (filePath == targetPath)
return;
+ removeIcon(dpi, baseDir);
+ QImage original(filePath);
+ if (!targetPath.isEmpty() && !original.isNull()) {
+ QDir dir;
+ dir.mkpath(QFileInfo(targetPath).absolutePath());
+ QSize targetSize = iconSize(dpi);
+ QImage scaled = original.scaled(targetSize.width(), targetSize.height(),
+ Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ toggleIconScaleWarning(dpi, scaled.width() > original.width() || scaled.height() > original.height());
+ scaled.save(targetPath);
+ updateIconPath(targetPath, dpi);
+ }
+}
+void AndroidManifestEditorWidget::removeIcon(IconDPI dpi, const QString &baseDir)
+{
const QString targetPath = baseDir + iconPath(dpi);
- QFile::remove(targetPath);
- QDir dir;
- dir.mkpath(QFileInfo(targetPath).absolutePath());
- QFile::copy(filePath, targetPath);
+ if (targetPath.isEmpty()) {
+ qCDebug(androidManifestEditorLog) << "Icon target path empty, cannot remove icon.";
+ return;
+ }
+ QFileInfo targetFile(targetPath);
+ if (targetFile.exists()) {
+ QDir rmRf(targetFile.absoluteDir());
+ rmRf.removeRecursively();
+ }
+ toggleIconScaleWarning(dpi, false);
+}
+
+void AndroidManifestEditorWidget::toggleIconScaleWarning(IconDPI dpi, bool visible)
+{
+ switch (dpi) {
+ case HighDPI:
+ m_hIconScaleWarningLabel->setVisible(visible);
+ break;
+ case MediumDPI:
+ m_mIconScaleWarningLabel->setVisible(visible);
+ break;
+ case LowDPI:
+ m_lIconScaleWarningLabel->setVisible(visible);
+ break;
+ }
+}
+
+const auto fileDialogIconFiles = QWidget::tr("Images (*.png *.jpg *.webp *.svg)");
+
+void AndroidManifestEditorWidget::setMasterIcon()
+{
+ QString file = QFileDialog::getOpenFileName(this, tr("Choose Master Icon"), QDir::homePath(), fileDialogIconFiles);
+ if (file.isEmpty())
+ return;
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
+ copyIcon(LowDPI, baseDir, file);
+ copyIcon(MediumDPI, baseDir, file);
+ copyIcon(HighDPI, baseDir, file);
+ m_lIconButton->setIcon(icon(baseDir, LowDPI));
+ m_mIconButton->setIcon(icon(baseDir, MediumDPI));
+ m_hIconButton->setIcon(icon(baseDir, HighDPI));
}
void AndroidManifestEditorWidget::setLDPIIcon()
{
- QString file = QFileDialog::getOpenFileName(this, tr("Choose Low DPI Icon"), QDir::homePath(), tr("PNG images (*.png)"));
+ QString file = QFileDialog::getOpenFileName(this, tr("Choose Low DPI Icon"), QDir::homePath(), fileDialogIconFiles);
if (file.isEmpty())
return;
m_lIconPath = file;
- m_lIconButton->setIcon(QIcon(file));
- setDirty(true);
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
+ copyIcon(LowDPI, baseDir, m_lIconPath);
+ m_lIconButton->setIcon(icon(baseDir, LowDPI));
}
void AndroidManifestEditorWidget::setMDPIIcon()
{
- QString file = QFileDialog::getOpenFileName(this, tr("Choose Medium DPI Icon"), QDir::homePath(), tr("PNG images (*.png)"));
+ QString file = QFileDialog::getOpenFileName(this, tr("Choose Medium DPI Icon"), QDir::homePath(), fileDialogIconFiles);
if (file.isEmpty())
return;
m_mIconPath = file;
- m_mIconButton->setIcon(QIcon(file));
- setDirty(true);
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
+ copyIcon(MediumDPI, baseDir, m_mIconPath);
+ m_mIconButton->setIcon(icon(baseDir, MediumDPI));
}
void AndroidManifestEditorWidget::setHDPIIcon()
{
- QString file = QFileDialog::getOpenFileName(this, tr("Choose High DPI Icon"), QDir::homePath(), tr("PNG images (*.png)"));
+ QString file = QFileDialog::getOpenFileName(this, tr("Choose High DPI Icon"), QDir::homePath(), fileDialogIconFiles);
if (file.isEmpty())
return;
m_hIconPath = file;
- m_hIconButton->setIcon(QIcon(file));
- setDirty(true);
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
+ copyIcon(HighDPI, baseDir, m_hIconPath);
+ m_hIconButton->setIcon(icon(baseDir, HighDPI));
}
void AndroidManifestEditorWidget::clearLDPIIcon()
{
m_lIconPath.clear();
m_lIconButton->setIcon(QIcon());
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
+ removeIcon(LowDPI, baseDir);
}
void AndroidManifestEditorWidget::clearMDPIIcon()
{
m_mIconPath.clear();
m_mIconButton->setIcon(QIcon());
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
+ removeIcon(MediumDPI, baseDir);
}
void AndroidManifestEditorWidget::clearHDPIIcon()
{
m_hIconPath.clear();
m_hIconButton->setIcon(QIcon());
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
+ removeIcon(HighDPI, baseDir);
}
void AndroidManifestEditorWidget::createDPIButton(QHBoxLayout *layout,
QWidget *parent,
QToolButton *&button,
- QToolButton *&clearButton,
+ const QSize &buttonSize,
const QString &title,
- const QString &tooltip)
+ const QString &tooltip,
+ QToolButton **clearButton,
+ QLabel **scaleWarningLabel)
{
auto iconLayout = new QVBoxLayout();
auto iconTitle = new QLabel(title, parent);
auto iconButtonLayout = new QGridLayout();
button = new QToolButton(parent);
- button->setMinimumSize(QSize(48, 48));
- button->setMaximumSize(QSize(48, 48));
+ button->setMinimumSize(buttonSize);
+ button->setMaximumSize(buttonSize);
button->setToolTip(tooltip);
- clearButton = new QToolButton(parent);
- clearButton->setMinimumSize(QSize(16, 16));
- clearButton->setMaximumSize(QSize(16, 16));
- clearButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
+ button->setIconSize(buttonSize);
+ QSize clearAndWarningSize(16, 16);
+ if (clearButton) {
+ *clearButton = new QToolButton(parent);
+ (*clearButton)->setMinimumSize(clearAndWarningSize);
+ (*clearButton)->setMaximumSize(clearAndWarningSize);
+ (*clearButton)->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
+ }
+ if (scaleWarningLabel) {
+ *scaleWarningLabel = new QLabel(parent);
+ (*scaleWarningLabel)->setMinimumSize(clearAndWarningSize);
+ (*scaleWarningLabel)->setMaximumSize(clearAndWarningSize);
+ (*scaleWarningLabel)->setPixmap(Utils::Icons::WARNING.icon().pixmap(clearAndWarningSize));
+ (*scaleWarningLabel)->setToolTip(tr("Icon scaled up"));
+ (*scaleWarningLabel)->setVisible(false);
+ }
auto label = new QLabel(tr("Click to select"), parent);
iconLayout->addWidget(iconTitle);
iconLayout->setAlignment(iconTitle, Qt::AlignHCenter);
iconButtonLayout->setColumnMinimumWidth(0, 16);
iconButtonLayout->addWidget(button, 0, 1, 1, 3);
iconButtonLayout->setAlignment(button, Qt::AlignVCenter);
- iconButtonLayout->addWidget(clearButton, 0, 4, 1, 1);
- iconButtonLayout->setAlignment(clearButton, Qt::AlignTop);
+ if (clearButton) {
+ iconButtonLayout->addWidget(*clearButton, 0, 4, 1, 1);
+ iconButtonLayout->setAlignment(*clearButton, Qt::AlignTop);
+ }
+ if (scaleWarningLabel) {
+ iconButtonLayout->addWidget(*scaleWarningLabel, 0, 0, 1, 1);
+ iconButtonLayout->setAlignment(*scaleWarningLabel, Qt::AlignTop);
+ }
iconLayout->addLayout(iconButtonLayout);
iconLayout->setAlignment(iconButtonLayout, Qt::AlignHCenter);
iconLayout->addWidget(label);
diff --git a/src/plugins/android/androidmanifesteditorwidget.h b/src/plugins/android/androidmanifesteditorwidget.h
index 48349cd8684..efbc2b529a4 100644
--- a/src/plugins/android/androidmanifesteditorwidget.h
+++ b/src/plugins/android/androidmanifesteditorwidget.h
@@ -116,6 +116,8 @@ protected:
void focusInEvent(QFocusEvent *event) override;
private:
+ void setMasterIcon();
+ void clearMasterIcon();
void setLDPIIcon();
void setMDPIIcon();
void setHDPIIcon();
@@ -124,8 +126,11 @@ private:
void clearHDPIIcon();
void createDPIButton(QHBoxLayout *layout,
QWidget *parent,
- QToolButton *&button, QToolButton *&clearButton,
- const QString &title, const QString &tooltip);
+ QToolButton *&button, const QSize &buttonSize,
+ const QString &title, const QString &tooltip,
+ QToolButton **clearButton = nullptr,
+ QLabel **scaleWarningLabel = nullptr
+ );
void defaultPermissionOrFeatureCheckBoxClicked();
void addPermission();
void removePermission();
@@ -146,7 +151,11 @@ private:
enum IconDPI { LowDPI, MediumDPI, HighDPI };
QIcon icon(const QString &baseDir, IconDPI dpi);
QString iconPath(IconDPI dpi);
+ QSize iconSize(IconDPI dpi);
+ void updateIconPath(const QString &newPath, IconDPI dpi);
void copyIcon(IconDPI dpi, const QString &baseDir, const QString &filePath);
+ void removeIcon(IconDPI dpi, const QString &baseDir);
+ void toggleIconScaleWarning(IconDPI dpi, bool visible);
void updateInfoBar(const QString &errorMessage, int line, int column);
void hideInfoBar();
@@ -180,13 +189,17 @@ private:
QLineEdit *m_appNameLineEdit;
QLineEdit *m_activityNameLineEdit;
QComboBox *m_targetLineEdit;
+ QToolButton *m_masterIconButton;
QToolButton *m_lIconButton;
QToolButton *m_lIconClearButton;
+ QLabel *m_lIconScaleWarningLabel;
QToolButton *m_mIconButton;
QToolButton *m_mIconClearButton;
+ QLabel *m_mIconScaleWarningLabel;
QToolButton *m_hIconButton;
QToolButton *m_hIconClearButton;
- QString m_lIconPath; // only set if the user changed the icon
+ QLabel *m_hIconScaleWarningLabel;
+ QString m_lIconPath;
QString m_mIconPath;
QString m_hIconPath;
diff --git a/src/plugins/android/androidsdkdownloader.cpp b/src/plugins/android/androidsdkdownloader.cpp
index 48d8bf9e840..fdefe3ea35d 100644
--- a/src/plugins/android/androidsdkdownloader.cpp
+++ b/src/plugins/android/androidsdkdownloader.cpp
@@ -149,7 +149,7 @@ void AndroidSdkDownloader::cancel()
m_reply->deleteLater();
}
if (m_progressDialog)
- m_progressDialog->hide();
+ m_progressDialog->cancel();
}
void AndroidSdkDownloader::cancelWithError(const QString &error)
diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp
index 1987a284ffb..e3ea6860890 100644
--- a/src/plugins/android/androidsdkmanager.cpp
+++ b/src/plugins/android/androidsdkmanager.cpp
@@ -69,15 +69,19 @@ using SdkCmdFutureInterface = QFutureInterface<AndroidSdkManager::OperationOutpu
int platformNameToApiLevel(const QString &platformName)
{
int apiLevel = -1;
- QRegularExpression re("(android-)(?<apiLevel>[0-9Q]{1,})",
+ QRegularExpression re("(android-)(?<apiLevel>[0-9A-Z]{1,})",
QRegularExpression::CaseInsensitiveOption);
QRegularExpressionMatch match = re.match(platformName);
if (match.hasMatch()) {
QString apiLevelStr = match.captured("apiLevel");
- if (apiLevelStr == 'Q')
- apiLevel = 29;
- else
- apiLevel = apiLevelStr.toInt();
+ bool isUInt;
+ apiLevel = apiLevelStr.toUInt(&isUInt);
+ if (!isUInt) {
+ if (apiLevelStr == 'Q')
+ apiLevel = 29;
+ else if (apiLevelStr == 'R')
+ apiLevel = 30;
+ }
}
return apiLevel;
}
diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp
index e70a7ce34fb..5cb44faeb5d 100644
--- a/src/plugins/android/androidsettingswidget.cpp
+++ b/src/plugins/android/androidsettingswidget.cpp
@@ -132,6 +132,7 @@ private:
bool allEssentialsInstalled();
bool sdkToolsOk() const;
Utils::FilePath getDefaultSdkPath();
+ void showEvent(QShowEvent *event) override;
Ui_AndroidSettingsWidget *m_ui;
AndroidSdkManagerWidget *m_sdkManagerWidget = nullptr;
@@ -143,6 +144,7 @@ private:
QString m_lastAddedAvd;
std::unique_ptr<AndroidAvdManager> m_avdManager;
std::unique_ptr<AndroidSdkManager> m_sdkManager;
+ bool m_isInitialReloadDone = false;
};
enum JavaValidation {
@@ -330,7 +332,19 @@ Utils::FilePath AndroidSettingsWidget::getDefaultSdkPath()
}
return Utils::FilePath::fromString(
- QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Android/Sdk");
+ QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Android/Sdk");
+}
+
+void AndroidSettingsWidget::showEvent(QShowEvent *event)
+{
+ Q_UNUSED(event)
+ if (!m_isInitialReloadDone) {
+ // Reloading SDK packages (force) is still synchronous. Use zero timer
+ // to let settings dialog open first.
+ QTimer::singleShot(0, std::bind(&AndroidSdkManager::reloadPackages,
+ m_sdkManager.get(), true));
+ m_isInitialReloadDone = true;
+ }
}
void AndroidSettingsWidget::updateNdkList()
@@ -398,8 +412,6 @@ AndroidSettingsWidget::AndroidSettingsWidget()
m_ui->OpenJDKLocationPathChooser->setFileName(currentJdkPath);
m_ui->OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path"));
- connect(m_ui->SDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
- this, &AndroidSettingsWidget::onSdkPathChanged);
Utils::FilePath currentSDKPath = m_androidConfig.sdkLocation();
if (currentSDKPath.isEmpty())
currentSDKPath = getDefaultSdkPath();
@@ -421,6 +433,8 @@ AndroidSettingsWidget::AndroidSettingsWidget()
m_ui->downloadOpenJDKToolButton->setIcon(downloadIcon);
m_ui->sdkToolsAutoDownloadButton->setIcon(Utils::Icons::RELOAD.icon());
+ connect(m_ui->SDKLocationPathChooser, &Utils::PathChooser::rawPathChanged,
+ this, &AndroidSettingsWidget::onSdkPathChanged);
connect(m_ui->ndkListComboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
[this](const QString) { validateNdk(); });
connect(&m_virtualDevicesWatcher, &QFutureWatcherBase::finished,
@@ -464,20 +478,6 @@ AndroidSettingsWidget::AndroidSettingsWidget()
}
downloadSdk();
});
-
- auto startOneShot = QSharedPointer<QMetaObject::Connection>::create();
- *startOneShot = connect(m_sdkManager.get(),
- &AndroidSdkManager::packageReloadFinished, [this, startOneShot] {
- QObject::disconnect(*startOneShot);
- if (!sdkToolsOk())
- downloadSdk();
- });
-
- // Reloading SDK packages (force) is still synchronous. Use zero timer to let settings dialog open
- // first.
- QTimer::singleShot(0, std::bind(&AndroidSdkManager::reloadPackages, m_sdkManager.get(), true));
-
- startUpdateAvd();
}
AndroidSettingsWidget::~AndroidSettingsWidget()
@@ -648,6 +648,7 @@ void AndroidSettingsWidget::validateSdk()
}
}
+ startUpdateAvd();
updateNdkList();
validateNdk();
}
@@ -769,9 +770,8 @@ void AndroidSettingsWidget::manageAVD()
void AndroidSettingsWidget::downloadSdk()
{
- QString message(tr("Android SDK Tools package is not installed. Do you want to download it?\n"
- "The final location: ")
- + QDir::toNativeSeparators(m_ui->SDKLocationPathChooser->rawPath()));
+ QString message(tr("Do you want to download and install Android SDK Tools to: %1?")
+ .arg(QDir::toNativeSeparators(m_ui->SDKLocationPathChooser->rawPath())));
auto userInput = QMessageBox::information(this, AndroidSdkDownloader::dialogTitle(),
message, QMessageBox::Yes | QMessageBox::No);
if (userInput == QMessageBox::Yes) {
@@ -786,6 +786,7 @@ void AndroidSettingsWidget::downloadSdk()
connect(sdkDownloader, &AndroidSdkDownloader::sdkExtracted, this, [this]() {
m_sdkManager->reloadPackages(true);
+ updateUI();
apply();
});
diff --git a/src/plugins/autotest/boost/boosttestsettingspage.cpp b/src/plugins/autotest/boost/boosttestsettingspage.cpp
index 64cd4cc91df..28afad5c159 100644
--- a/src/plugins/autotest/boost/boosttestsettingspage.cpp
+++ b/src/plugins/autotest/boost/boosttestsettingspage.cpp
@@ -36,7 +36,7 @@ namespace Internal {
class BoostTestSettingsWidget : public Core::IOptionsPageWidget
{
- QT_DECLARE_DEPRECATED_TR_FUNCTIONS(Autotest::Internal::BoostTestSettingsWidget)
+ Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::BoostTestSettingsWidget)
public:
explicit BoostTestSettingsWidget(QSharedPointer<BoostTestSettings> settings);
diff --git a/src/plugins/autotest/qtest/qttestparser.cpp b/src/plugins/autotest/qtest/qttestparser.cpp
index 162fed7ec35..564be5df267 100644
--- a/src/plugins/autotest/qtest/qttestparser.cpp
+++ b/src/plugins/autotest/qtest/qttestparser.cpp
@@ -319,7 +319,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
QHash<QString, QtTestCodeLocationList> dataTags;
for (const QString &file : files)
- dataTags.unite(checkForDataTags(file, snapshot));
+ Utils::addToHash(&dataTags, checkForDataTags(file, snapshot));
QtTestParseResult *parseResult = new QtTestParseResult(id);
parseResult->itemType = TestTreeItem::TestCase;
diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp
index c1632b5c20b..fa529a902b0 100644
--- a/src/plugins/autotest/testrunner.cpp
+++ b/src/plugins/autotest/testrunner.cpp
@@ -746,7 +746,6 @@ RunConfigurationSelectionDialog::RunConfigurationSelectionDialog(const QString &
QWidget *parent)
: QDialog(parent)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Select Run Configuration"));
QString details = tr("Could not determine which run configuration to choose for running tests");
diff --git a/src/plugins/bazaar/bazaareditor.cpp b/src/plugins/bazaar/bazaareditor.cpp
index 4087bd987c7..ac811b16aa0 100644
--- a/src/plugins/bazaar/bazaareditor.cpp
+++ b/src/plugins/bazaar/bazaareditor.cpp
@@ -29,7 +29,6 @@
#include <utils/qtcassert.h>
-#include <QRegExp>
#include <QString>
#include <QTextCursor>
@@ -46,30 +45,9 @@ BazaarEditorWidget::BazaarEditorWidget() :
setAnnotatePreviousRevisionTextFormat(tr("Annotate &parent revision %1"));
// Diff format:
// === <change> <file|dir> 'mainwindow.cpp'
- setDiffFilePattern(QRegExp(QLatin1String("^=== [a-z]+ [a-z]+ '(.+)'\\s*")));
- setLogEntryPattern(QRegExp(QLatin1String("^revno: (\\d+)")));
-}
-
-QSet<QString> BazaarEditorWidget::annotationChanges() const
-{
- QSet<QString> changes;
- const QString txt = toPlainText();
- if (txt.isEmpty())
- return changes;
-
- QRegExp changeNumRx(QLatin1String("^(" BZR_CHANGE_PATTERN ") "));
- QTC_ASSERT(changeNumRx.isValid(), return changes);
- if (changeNumRx.indexIn(txt) != -1) {
- changes.insert(changeNumRx.cap(1));
- changeNumRx.setPattern(QLatin1String("\n(" BZR_CHANGE_PATTERN ") "));
- QTC_ASSERT(changeNumRx.isValid(), return changes);
- int pos = 0;
- while ((pos = changeNumRx.indexIn(txt, pos)) != -1) {
- pos += changeNumRx.matchedLength();
- changes.insert(changeNumRx.cap(1));
- }
- }
- return changes;
+ setDiffFilePattern("^=== [a-z]+ [a-z]+ '(.+)'\\s*");
+ setLogEntryPattern("^revno: (\\d+)");
+ setAnnotationEntryPattern("^(" BZR_CHANGE_PATTERN ") ");
}
QString BazaarEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const
diff --git a/src/plugins/bazaar/bazaareditor.h b/src/plugins/bazaar/bazaareditor.h
index 09584462a15..96a9f1610f9 100644
--- a/src/plugins/bazaar/bazaareditor.h
+++ b/src/plugins/bazaar/bazaareditor.h
@@ -40,7 +40,6 @@ public:
BazaarEditorWidget();
private:
- QSet<QString> annotationChanges() const override;
QString changeUnderCursor(const QTextCursor &cursor) const override;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(
const QSet<QString> &changes) const override;
diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp
index 06506cd8bc1..c21f530ade1 100644
--- a/src/plugins/bineditor/bineditorplugin.cpp
+++ b/src/plugins/bineditor/bineditorplugin.cpp
@@ -472,7 +472,7 @@ BinEditorFactory::BinEditorFactory()
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME));
addMimeType(Constants::C_BINEDITOR_MIMETYPE);
- setEditorCreator([] {
+ setEditorCreator([this] {
auto widget = new BinEditorWidget();
auto editor = new BinEditor(widget);
diff --git a/src/plugins/boot2qt/device-detection/qdbwatcher.cpp b/src/plugins/boot2qt/device-detection/qdbwatcher.cpp
index ee2b091fd35..2435dbaea7f 100644
--- a/src/plugins/boot2qt/device-detection/qdbwatcher.cpp
+++ b/src/plugins/boot2qt/device-detection/qdbwatcher.cpp
@@ -62,11 +62,17 @@ void QdbWatcher::start(RequestType requestType)
void QdbWatcher::startPrivate()
{
+ constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ = &QLocalSocket::error;
+#else
+ = &QLocalSocket::errorOccurred;
+#endif
+
m_socket = std::unique_ptr<QLocalSocket>(new QLocalSocket());
connect(m_socket.get(), &QLocalSocket::connected,
this, &QdbWatcher::handleWatchConnection);
- connect(m_socket.get(), static_cast<void (QLocalSocket::*)
- (QLocalSocket::LocalSocketError)>(&QLocalSocket::error),
+ connect(m_socket.get(), LocalSocketErrorFunction,
this, &QdbWatcher::handleWatchError);
m_socket->connectToServer(qdbSocketName);
}
diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp
index 08ce4785d5b..49aebc378df 100644
--- a/src/plugins/boot2qt/qdbplugin.cpp
+++ b/src/plugins/boot2qt/qdbplugin.cpp
@@ -72,7 +72,7 @@ static void startFlashingWizard()
if (Utils::HostOsInfo::isWindowsHost()) {
if (QProcess::startDetached(QLatin1String("explorer.exe"), {filePath}))
return;
- } else if (QProcess::startDetached(filePath)) {
+ } else if (QProcess::startDetached(filePath, {})) {
return;
}
const QString message =
diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp
index f087f77a948..0a32d3a9297 100644
--- a/src/plugins/clangformat/clangformatutils.cpp
+++ b/src/plugins/clangformat/clangformatutils.cpp
@@ -57,7 +57,11 @@ static clang::format::FormatStyle qtcStyle()
style.AlignOperands = true;
style.AlignTrailingComments = true;
style.AllowAllParametersOfDeclarationOnNextLine = true;
+#if LLVM_VERSION_MAJOR >= 10
+ style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never;
+#else
style.AllowShortBlocksOnASingleLine = false;
+#endif
style.AllowShortCaseLabelsOnASingleLine = false;
style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
#if LLVM_VERSION_MAJOR >= 9
@@ -72,7 +76,11 @@ static clang::format::FormatStyle qtcStyle()
style.BinPackArguments = false;
style.BinPackParameters = false;
style.BraceWrapping.AfterClass = true;
+#if LLVM_VERSION_MAJOR >= 10
+ style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Never;
+#else
style.BraceWrapping.AfterControlStatement = false;
+#endif
style.BraceWrapping.AfterEnum = false;
style.BraceWrapping.AfterFunction = true;
style.BraceWrapping.AfterNamespace = false;
diff --git a/src/plugins/clearcase/clearcaseeditor.cpp b/src/plugins/clearcase/clearcaseeditor.cpp
index bcac505c484..3996d616177 100644
--- a/src/plugins/clearcase/clearcaseeditor.cpp
+++ b/src/plugins/clearcase/clearcaseeditor.cpp
@@ -47,29 +47,11 @@ ClearCaseEditorWidget::ClearCaseEditorWidget() :
// Diff formats:
// "+++ D:\depot\...\mainwindow.cpp@@\main\3" (versioned)
// "+++ D:\depot\...\mainwindow.cpp[TAB]Sun May 01 14:22:37 2011" (local)
- QRegExp diffFilePattern(QLatin1String("^[-+]{3} ([^\\t]+)(?:@@|\\t)"));
- diffFilePattern.setMinimal(true);
- setDiffFilePattern(diffFilePattern);
- setLogEntryPattern(QRegExp(QLatin1String("version \"([^\"]+)\"")));
+ setDiffFilePattern("^[-+]{3} ([^\\t]+?)(?:@@|\\t)");
+ setLogEntryPattern("version \"([^\"]+)\"");
setAnnotateRevisionTextFormat(tr("Annotate version \"%1\""));
-}
-
-QSet<QString> ClearCaseEditorWidget::annotationChanges() const
-{
- QSet<QString> changes;
- QString txt = toPlainText();
- if (txt.isEmpty())
- return changes;
- // search until header
- int separator = txt.indexOf(QRegExp(QLatin1String("\n-{30}")));
- QRegExp r(QLatin1String("([^|]*)\\|[^\n]*\n"));
- QTC_ASSERT(r.isValid(), return changes);
- int pos = r.indexIn(txt, 0);
- while (pos != -1 && pos < separator) {
- changes.insert(r.cap(1));
- pos = r.indexIn(txt, pos + r.matchedLength());
- }
- return changes;
+ setAnnotationEntryPattern("([^|]*)\\|[^\\n]*\\n");
+ setAnnotationSeparatorPattern("\\n-{30}");
}
QString ClearCaseEditorWidget::changeUnderCursor(const QTextCursor &c) const
@@ -82,8 +64,9 @@ QString ClearCaseEditorWidget::changeUnderCursor(const QTextCursor &c) const
QString change = cursor.selectedText();
// Annotation output has number, log output has revision numbers
// as r1, r2...
- if (m_versionNumberPattern.indexIn(change) != -1)
- return m_versionNumberPattern.cap();
+ const QRegularExpressionMatch match = m_versionNumberPattern.match(change);
+ if (match.hasMatch())
+ return match.captured();
return QString();
}
diff --git a/src/plugins/clearcase/clearcaseeditor.h b/src/plugins/clearcase/clearcaseeditor.h
index 3c9d95fa095..3bab6b13a0a 100644
--- a/src/plugins/clearcase/clearcaseeditor.h
+++ b/src/plugins/clearcase/clearcaseeditor.h
@@ -28,7 +28,7 @@
#include <vcsbase/vcsbaseeditor.h>
-#include <QRegExp>
+#include <QRegularExpression>
namespace ClearCase {
namespace Internal {
@@ -41,12 +41,11 @@ public:
ClearCaseEditorWidget();
private:
- QSet<QString> annotationChanges() const override;
QString changeUnderCursor(const QTextCursor &) const override;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(
const QSet<QString> &changes) const override;
- QRegExp m_versionNumberPattern;
+ const QRegularExpression m_versionNumberPattern;
};
} // namespace Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp
index cc8f4a2cf5b..6a7e5196e15 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp
@@ -158,7 +158,7 @@ bool CMakeBuildStep::init()
QTC_ASSERT(bc, return false);
if (!bc->isEnabled()) {
emit addTask(BuildSystemTask(Task::Error,
- tr("CMakeProjectManager::CMakeBuildStep")));
+ tr("The build configuration is currently disabled.")));
canInit = false;
}
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index 9f175a635fb..493939dd89a 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -26,6 +26,7 @@
#include "cmakebuildsystem.h"
#include "cmakebuildconfiguration.h"
+#include "cmakekitinformation.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
@@ -204,10 +205,13 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
connect(project(), &Project::projectFileIsDirty, this, [this]() {
if (m_buildConfiguration->isActive()) {
- qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
- m_buildDirManager
- .setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration),
- BuildDirManager::REPARSE_DEFAULT);
+ const auto cmake = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit());
+ if (cmake && cmake->isAutoRun()) {
+ qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
+ m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(
+ m_buildConfiguration),
+ BuildDirManager::REPARSE_DEFAULT);
+ }
}
});
@@ -269,7 +273,7 @@ QStringList CMakeBuildSystem::filesGeneratedFrom(const QString &sourceFile) cons
QDir srcDirRoot = QDir(project.toString());
QString relativePath = srcDirRoot.relativeFilePath(baseDirectory.toString());
- QDir buildDir = QDir(target()->activeBuildConfiguration()->buildDirectory().toString());
+ QDir buildDir = QDir(buildConfiguration()->buildDirectory().toString());
QString generatedFilePath = buildDir.absoluteFilePath(relativePath);
if (fi.suffix() == "ui") {
diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp
index 38cffc30331..dc14c647194 100644
--- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp
@@ -368,7 +368,6 @@ private:
// Disable help button in titlebar on windows:
Qt::WindowFlags flags = changeDialog->windowFlags();
- flags &= ~Qt::WindowContextHelpButtonHint;
flags |= Qt::MSWindowsFixedSizeDialogHint;
changeDialog->setWindowFlags(flags);
diff --git a/src/plugins/cmakeprojectmanager/fileapireader.cpp b/src/plugins/cmakeprojectmanager/fileapireader.cpp
index 13c90abf7c2..83a81f2a70e 100644
--- a/src/plugins/cmakeprojectmanager/fileapireader.cpp
+++ b/src/plugins/cmakeprojectmanager/fileapireader.cpp
@@ -63,18 +63,7 @@ using namespace FileApiDetails;
// FileApiReader:
// --------------------------------------------------------------------
-FileApiReader::FileApiReader()
-{
- connect(Core::EditorManager::instance(),
- &Core::EditorManager::aboutToSave,
- this,
- [this](const Core::IDocument *document) {
- if (m_cmakeFiles.contains(document->filePath())) {
- qCDebug(cmakeFileApiMode) << "FileApiReader: DIRTY SIGNAL";
- emit dirty();
- }
- });
-}
+FileApiReader::FileApiReader() {}
FileApiReader::~FileApiReader()
{
diff --git a/src/plugins/cmakeprojectmanager/servermode.cpp b/src/plugins/cmakeprojectmanager/servermode.cpp
index f9d3c4566e6..ce57e9d9790 100644
--- a/src/plugins/cmakeprojectmanager/servermode.cpp
+++ b/src/plugins/cmakeprojectmanager/servermode.cpp
@@ -207,8 +207,15 @@ void ServerMode::connectToServer()
auto socket = new QLocalSocket(m_cmakeProcess.get());
connect(socket, &QLocalSocket::readyRead, this, &ServerMode::handleRawCMakeServerData);
- connect(socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error),
- this, [this, socket]() {
+
+ constexpr void (QLocalSocket::*LocalSocketErrorFunction)(QLocalSocket::LocalSocketError)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ = &QLocalSocket::error;
+#else
+ = &QLocalSocket::errorOccurred;
+#endif
+
+ connect(socket, LocalSocketErrorFunction, this, [this, socket]() {
reportError(socket->errorString());
m_cmakeSocket = nullptr;
socket->disconnect();
diff --git a/src/plugins/cmakeprojectmanager/servermodereader.cpp b/src/plugins/cmakeprojectmanager/servermodereader.cpp
index 72c85bf271c..f86081bd382 100644
--- a/src/plugins/cmakeprojectmanager/servermodereader.cpp
+++ b/src/plugins/cmakeprojectmanager/servermodereader.cpp
@@ -73,12 +73,6 @@ const int MAX_PROGRESS = 1400;
ServerModeReader::ServerModeReader()
{
- connect(Core::EditorManager::instance(), &Core::EditorManager::aboutToSave,
- this, [this](const Core::IDocument *document) {
- if (m_cmakeFiles.contains(document->filePath()))
- emit dirty();
- });
-
connect(&m_parser, &CMakeParser::addOutput,
this, [](const QString &m) { Core::MessageManager::write(m); });
connect(&m_parser, &CMakeParser::addTask, this, [this](const Task &t) {
@@ -466,10 +460,9 @@ void ServerModeReader::handleProgress(int min, int cur, int max, const QString &
void ServerModeReader::handleSignal(const QString &signal, const QVariantMap &data)
{
+ Q_UNUSED(signal)
Q_UNUSED(data)
- // CMake on Windows sends false dirty signals on each edit (QTCREATORBUG-17944)
- if (!HostOsInfo::isWindowsHost() && signal == "dirty")
- emit dirty();
+ // We do not need to act on fileChanged signals nor on dirty signals!
}
void ServerModeReader::handleServerConnected()
diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
index 7737128f46e..63ea5a66e5b 100644
--- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
+++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
@@ -64,13 +64,13 @@ namespace Core {
You can specify whether the menu represented by this action container should
be automatically disabled or hidden whenever it only contains disabled items
- and submenus by setting the corresponding
- \l{ActionContainer::setOnAllDisabledBehavior()}{OnAllDisabledBehavior}. The default is
- ActionContainer::Disable for menus, and ActionContainer::Show for menu bars.
+ and submenus by setting the corresponding \l setOnAllDisabledBehavior(). The
+ default is ActionContainer::Disable for menus, and ActionContainer::Show for
+ menu bars.
*/
/*!
- \enum ActionContainer::OnAllDisabledBehavior
+ \enum Core::ActionContainer::OnAllDisabledBehavior
Defines what happens when the represented menu is empty or contains only
disabled or invisible items.
\value Disable
@@ -82,7 +82,7 @@ namespace Core {
*/
/*!
- \fn ActionContainer::setOnAllDisabledBehavior(OnAllDisabledBehavior behavior)
+ \fn Core::ActionContainer::setOnAllDisabledBehavior(OnAllDisabledBehavior behavior)
Defines the \a behavior of the menu represented by this action container for the case
whenever it only contains disabled items and submenus.
The default is ActionContainer::Disable for menus, and ActionContainer::Show for menu bars.
@@ -91,39 +91,39 @@ namespace Core {
*/
/*!
- \fn ActionContainer::onAllDisabledBehavior() const
+ \fn Core::ActionContainer::onAllDisabledBehavior() const
Returns the behavior of the menu represented by this action container for the case
whenever it only contains disabled items and submenus.
The default is ActionContainer::Disable for menus, and ActionContainer::Show for menu bars.
- \sa ActionContainer::OnAllDisabledBehavior
- \sa ActionContainer::setOnAllDisabledBehavior()
+ \sa OnAllDisabledBehavior
+ \sa setOnAllDisabledBehavior()
*/
/*!
- \fn int ActionContainer::id() const
+ \fn int Core::ActionContainer::id() const
\internal
*/
/*!
- \fn QMenu *ActionContainer::menu() const
+ \fn QMenu *Core::ActionContainer::menu() const
Returns the QMenu instance that is represented by this action container, or
0 if this action container represents a menu bar.
*/
/*!
- \fn QMenuBar *ActionContainer::menuBar() const
+ \fn QMenuBar *Core::ActionContainer::menuBar() const
Returns the QMenuBar instance that is represented by this action container, or
0 if this action container represents a menu.
*/
/*!
- \fn QAction *ActionContainer::insertLocation(Id group) const
+ \fn QAction *Core::ActionContainer::insertLocation(Core::Id group) const
Returns an action representing the \a group,
that could be used with \c{QWidget::insertAction}.
*/
/*!
- \fn void ActionContainer::appendGroup(Id group)
+ \fn void Core::ActionContainer::appendGroup(Core::Id group)
Adds \a group to the action container.
Use groups to segment your action container into logical parts. You can add
@@ -133,7 +133,7 @@ namespace Core {
*/
/*!
- \fn void ActionContainer::addAction(Command *action, Id group = Id())
+ \fn void Core::ActionContainer::addAction(Core::Command *action, Core::Id group = Id())
Add the \a action as a menu item to this action container. The action is added as the
last item of the specified \a group.
\sa appendGroup()
@@ -141,7 +141,7 @@ namespace Core {
*/
/*!
- \fn void ActionContainer::addMenu(ActionContainer *menu, Id group = Id())
+ \fn void Core::ActionContainer::addMenu(Core::ActionContainer *menu, Core::Id group = Core::Id())
Add the \a menu as a submenu to this action container. The menu is added as the
last item of the specified \a group.
\sa appendGroup()
@@ -149,7 +149,7 @@ namespace Core {
*/
/*!
- \fn void ActionContainer::addMenu(ActionContainer *before, ActionContainer *menu)
+ \fn void Core::ActionContainer::addMenu(Core::ActionContainer *before, Core::ActionContainer *menu)
Add \a menu as a submenu to this action container before the menu specified
by \a before.
\sa appendGroup()
@@ -157,7 +157,7 @@ namespace Core {
*/
/*!
- \fn ActionContainer::clear()
+ \fn Core::ActionContainer::clear()
Clears this menu and submenus from all actions and submenus. However, does
does not destroy the submenus and commands, just removes them from their
@@ -165,20 +165,20 @@ namespace Core {
*/
/*!
- \fn ActionContainer::insertGroup(Id before, Id group)
+ \fn Core::ActionContainer::insertGroup(Core::Id before, Core::Id group)
Inserts \a group to the action container before the group specified by
\a before.
*/
/*!
- \fn virtual Utils::TouchBar *ActionContainer::touchBar() const
+ \fn virtual Utils::TouchBar *Core::ActionContainer::touchBar() const
Returns the touch bar that is represented by this action container.
*/
/*!
- \fn ActionContainer::addSeparator(const Context &context, Id group, QAction **outSeparator)
+ \fn Core::ActionContainer::addSeparator(const Core::Context &context, Core::Id group, QAction **outSeparator)
Adds a separator to the end of the given \a group to the action container,
which is enabled for a given \a context. Returns the created separator
diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
index 0f25fc4a192..449a0040bcb 100644
--- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp
+++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp
@@ -70,7 +70,7 @@ using namespace Core::Internal;
All actions that are registered with the same Id (but different context lists)
are considered to be overloads of the same command, represented by an instance
- of the Command class.
+ of the Core::Command class.
Exactly only one of the registered actions with the same ID is active at any time.
Which action this is, is defined by the context list that the actions were registered
with:
@@ -141,13 +141,13 @@ using namespace Core::Internal;
*/
/*!
- \fn void ActionManager::commandListChanged()
+ \fn void Core::ActionManager::commandListChanged()
Emitted when the command list has changed.
*/
/*!
- \fn void ActionManager::commandAdded(Core::Id id)
+ \fn void Core::ActionManager::commandAdded(Core::Id id)
Emitted when a command (with the \a id) is added.
*/
diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp
index 2d2eba652db..cd801c1ec2f 100644
--- a/src/plugins/coreplugin/actionmanager/command.cpp
+++ b/src/plugins/coreplugin/actionmanager/command.cpp
@@ -67,7 +67,7 @@
*/
/*!
- \enum Command::CommandAttribute
+ \enum Core::Command::CommandAttribute
This enum defines how the user visible action is updated when the active action changes.
The default is to update the enabled and visible state, and to disable the
user visible action when there is no active action.
@@ -84,37 +84,37 @@
*/
/*!
- \fn void Command::setDefaultKeySequence(const QKeySequence &key)
+ \fn void Core::Command::setDefaultKeySequence(const QKeySequence &key)
Sets the default keyboard shortcut that can be used to activate this command to \a key.
This is used if the user didn't customize the shortcut, or resets the shortcut
to the default one.
*/
/*!
- \fn void Command::defaultKeySequence() const
+ \fn void Core::Command::defaultKeySequence() const
Returns the default keyboard shortcut that can be used to activate this command.
\sa setDefaultKeySequence()
*/
/*!
- \fn void Command::keySequenceChanged()
+ \fn void Core::Command::keySequenceChanged()
Sent when the keyboard shortcut assigned to this Command changes, e.g.
when the user sets it in the keyboard shortcut settings dialog.
*/
/*!
- \fn QKeySequence Command::keySequence() const
+ \fn QKeySequence Core::Command::keySequence() const
Returns the current keyboard shortcut assigned to this Command.
\sa defaultKeySequence()
*/
/*!
- \fn void Command::setKeySequence(const QKeySequence &key)
+ \fn void Core::Command::setKeySequence(const QKeySequence &key)
\internal
*/
/*!
- \fn void Command::setDescription(const QString &text)
+ \fn void Core::Command::setDescription(const QString &text)
Sets the \a text that is used to represent the Command in the
keyboard shortcut settings dialog. If you do not set this,
the current text from the user visible action is taken (which
@@ -122,24 +122,24 @@
*/
/*!
- \fn QString Command::description() const
+ \fn QString Core::Command::description() const
Returns the text that is used to present this Command to the user.
\sa setDescription()
*/
/*!
- \fn int Command::id() const
+ \fn int Core::Command::id() const
\internal
*/
/*!
- \fn QString Command::stringWithAppendedShortcut(const QString &string) const
+ \fn QString Core::Command::stringWithAppendedShortcut(const QString &string) const
Returns the \a string with an appended representation of the keyboard shortcut
that is currently assigned to this Command.
*/
/*!
- \fn QAction *Command::action() const
+ \fn QAction *Core::Command::action() const
Returns the user visible action for this Command.
If the Command represents a shortcut, it returns null.
Use this action to put it on e.g. tool buttons. The action
@@ -152,13 +152,13 @@
*/
/*!
- \fn Context Command::context() const
+ \fn Core::Context Core::Command::context() const
Returns the context for this command.
*/
/*!
- \fn void Command::setAttribute(CommandAttribute attribute)
+ \fn void Core::Command::setAttribute(Core::Command::CommandAttribute attribute)
Adds \a attribute to the attributes of this Command.
\sa CommandAttribute
\sa removeAttribute()
@@ -166,14 +166,14 @@
*/
/*!
- \fn void Command::removeAttribute(CommandAttribute attribute)
+ \fn void Core::Command::removeAttribute(Core::Command::CommandAttribute attribute)
Removes \a attribute from the attributes of this Command.
\sa CommandAttribute
\sa setAttribute()
*/
/*!
- \fn bool Command::hasAttribute(CommandAttribute attribute) const
+ \fn bool Core::Command::hasAttribute(Core::Command::CommandAttribute attribute) const
Returns whether the Command has the \a attribute set.
\sa CommandAttribute
\sa removeAttribute()
@@ -181,54 +181,54 @@
*/
/*!
- \fn bool Command::isActive() const
+ \fn bool Core::Command::isActive() const
Returns whether the Command has an active action or shortcut for the current
context.
*/
/*!
- \fn bool Command::isScriptable() const
+ \fn bool Core::Command::isScriptable() const
Returns whether the Command is scriptable. A scriptable command can be called
from a script without the need for the user to interact with it.
*/
/*!
- \fn bool Command::isScriptable(const Context &) const
+ \fn bool Core::Command::isScriptable(const Core::Context &) const
\internal
Returns whether the Command is scriptable.
*/
/*!
- \fn void Command::activeStateChanged()
+ \fn void Core::Command::activeStateChanged()
This signal is emitted when the active state of the command changes.
*/
/*!
- \fn virtual void Command::setTouchBarText(const QString &text)
+ \fn virtual void Core::Command::setTouchBarText(const QString &text)
Sets the text for the action on the touch bar to \a text.
*/
/*!
- \fn virtual QString Command::touchBarText() const
+ \fn virtual QString Core::Command::touchBarText() const
Returns the text for the action on the touch bar.
*/
/*!
- \fn virtual void Command::setTouchBarIcon(const QIcon &icon)
+ \fn virtual void Core::Command::setTouchBarIcon(const QIcon &icon)
Sets the icon for the action on the touch bar to \a icon.
*/
-/*! \fn virtual QIcon Command::touchBarIcon() const
+/*! \fn virtual QIcon Core::Command::touchBarIcon() const
Returns the icon for the action on the touch bar.
*/
-/*! \fn virtual QAction *Command::touchBarAction() const
+/*! \fn virtual QAction *Core::Command::touchBarAction() const
Adds an action to the touch bar.
*/
diff --git a/src/plugins/coreplugin/basefilewizardfactory.cpp b/src/plugins/coreplugin/basefilewizardfactory.cpp
index 633980bf39c..1abef7c06ff 100644
--- a/src/plugins/coreplugin/basefilewizardfactory.cpp
+++ b/src/plugins/coreplugin/basefilewizardfactory.cpp
@@ -58,20 +58,11 @@ static int indexOfFile(const GeneratedFiles &f, const QString &path)
/*!
\class Core::BaseFileWizard
- \brief The BaseFileWizard class implements a generic wizard for
+ \inmodule QtCreator
+ \brief The BaseFileWizard class implements a is a convenience class for
creating files.
- The following abstract functions must be implemented:
- \list
- \li create(): Called to create the QWizard dialog to be shown.
- \li generateFiles(): Generates file content.
- \endlist
-
- The behaviour can be further customized by overwriting the virtual function \c postGenerateFiles(),
- which is called after generating the files.
-
- \sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::StandardFileWizard
- \sa Core::Internal::WizardEventLoop
+ \sa Core::BaseFileWizardFactory
*/
Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget *parent,
@@ -98,25 +89,54 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
}
/*!
- \fn virtual QWizard *Core::BaseFileWizard::create(QWidget *parent,
- const WizardDialogParameters &parameters) const
+ \class Core::BaseFileWizardFactory
+ \inmodule QtCreator
+ \brief The BaseFileWizardFactory class implements a generic wizard for
+ creating files.
+
+ The following abstract functions must be implemented:
+ \list
+ \li create(): Called to create the QWizard dialog to be shown.
+ \li generateFiles(): Generates file content.
+ \endlist
+
+ The behavior can be further customized by overwriting the virtual function
+ postGenerateFiles(), which is called after generating the files.
+
+ \note Instead of using this class, we recommend that you create JSON-based
+ wizards, as instructed in \l{https://doc.qt.io/qtcreator/creator-project-wizards.html}
+ {Adding New Custom Wizards}.
+
+ \sa Core::GeneratedFile, Core::WizardDialogParameters, Core::BaseFileWizard
+*/
+
+/*!
+ \fn Core::BaseFileWizard *Core::BaseFileWizardFactory::create(QWidget *parent,
+ const Core::WizardDialogParameters &parameters) const
Creates the wizard on the \a parent with the \a parameters.
*/
/*!
- \fn virtual Core::GeneratedFiles Core::BaseFileWizard::generateFiles(const QWizard *w,
- QString *errorMessage) const = 0
- Overwrite to query the parameters from the dialog and generate the files.
+ \fn virtual Core::GeneratedFiles Core::BaseFileWizardFactory::generateFiles(const QWizard *w,
+ QString *errorMessage) const
+ Overwrite to query the parameters from the wizard \a w and generate the
+ files.
+
+ Possible errors are held in \a errorMessage.
\note This does not generate physical files, but merely the list of
Core::GeneratedFile.
*/
/*!
- Physically writes files.
+ Physically writes \a files.
- Re-implement (calling the base implementation) to create files with CustomGeneratorAttribute set.
+ If the files cannot be written, returns \c false and sets \a errorMessage
+ to the message that is displayed to users.
+
+ Re-implement (calling the base implementation) to create files with
+ GeneratedFile::CustomGeneratorAttribute set.
*/
bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *errorMessage) const
@@ -131,9 +151,13 @@ bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *err
}
/*!
- Overwrite to perform steps to be done after files are actually created.
+ Overwrite to perform steps to be done by the wizard \a w after the files
+ specified by \a l are actually created.
+
+ The default implementation opens editors with the newly generated files
+ that have GeneratedFile::OpenEditorAttribute set.
- The default implementation opens editors with the newly generated files.
+ Returns \a errorMessage if errors occur.
*/
bool BaseFileWizardFactory::postGenerateFiles(const QWizard *, const GeneratedFiles &l,
@@ -143,7 +167,12 @@ bool BaseFileWizardFactory::postGenerateFiles(const QWizard *, const GeneratedFi
}
/*!
- Opens the editors for the files whose attribute is set accordingly.
+ Opens the editors for the files \a l if their
+ GeneratedFile::OpenEditorAttribute attribute
+ is set accordingly.
+
+ If the editorrs cannot be opened, returns \c false and dand sets
+ \a errorMessage to the message that is displayed to users.
*/
bool BaseFileWizardFactory::postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage)
@@ -163,6 +192,8 @@ bool BaseFileWizardFactory::postGenerateOpenEditors(const GeneratedFiles &l, QSt
/*!
Performs an overwrite check on a set of \a files. Checks if the file exists and
can be overwritten at all, and then prompts the user with a summary.
+
+ Returns \a errorMessage if the file cannot be overwritten.
*/
BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(GeneratedFiles *files,
@@ -243,8 +274,8 @@ BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(Ge
}
/*!
- Constructs a file name, adding the \a extension unless \a baseName already has
- one.
+ Constructs a file name including \a path, adding the \a extension unless
+ \a baseName already has one.
*/
QString BaseFileWizardFactory::buildFileName(const QString &path,
@@ -285,14 +316,18 @@ QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
}
/*!
- \class Core::StandardFileWizard
- \brief The StandardFileWizard class is a convenience class for
- creating one file.
+ \class Core::WizardDialogParameters
+ \inmodule QtCreator
+ \brief The WizardDialogParameters class holds parameters for the new file
+ wizard dialog.
- It uses Utils::FileWizardDialog and introduces a new virtual to generate the
- files from path and name.
+ \sa Core::GeneratedFile, Core::BaseFileWizardFactory
+*/
- \sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::BaseFileWizard
+/*!
+ \enum Core::WizardDialogParameters::DialogParameterEnum
+ This enum type holds whether to force capital letters for file names.
+ \value ForceCapitalLetterForFileName Forces capital letters for file names.
*/
} // namespace Core
diff --git a/src/plugins/coreplugin/dialogs/ioptionspage.cpp b/src/plugins/coreplugin/dialogs/ioptionspage.cpp
index e2d2ea5e9ce..be700875ad4 100644
--- a/src/plugins/coreplugin/dialogs/ioptionspage.cpp
+++ b/src/plugins/coreplugin/dialogs/ioptionspage.cpp
@@ -62,26 +62,26 @@ using namespace Utils;
/*!
- \fn Id IOptionsPage::id() const
+ \fn Core::Id Core::IOptionsPage::id() const
Returns a unique identifier for referencing the options page.
*/
/*!
- \fn QString IOptionsPage::displayName() const
+ \fn QString Core::IOptionsPage::displayName() const
Returns the translated display name of the options page.
*/
/*!
- \fn Id IOptionsPage::category() const
+ \fn Core::Id Core::IOptionsPage::category() const
Returns the unique id for the category that the options page should be displayed in. This id is
used for sorting the list on the left side of the \uicontrol Options dialog.
*/
/*!
- \fn QString IOptionsPage::displayCategory() const
+ \fn QString Core::IOptionsPage::displayCategory() const
Returns the translated category name of the options page. This name is displayed in the list on
the left side of the \uicontrol Options dialog.
@@ -168,31 +168,31 @@ void Core::IOptionsPage::setCategoryIconPath(const QString &categoryIconPath)
}
/*!
- \fn void IOptionsPage::setId(Id id)
+ \fn void Core::IOptionsPage::setId(Core::Id id)
Sets the \a id of the options page.
*/
/*!
- \fn void IOptionsPage::setDisplayName(const QString &displayName)
+ \fn void Core::IOptionsPage::setDisplayName(const QString &displayName)
Sets \a displayName as the display name of the options page.
*/
/*!
- \fn void IOptionsPage::setCategory(Id category)
+ \fn void Core::IOptionsPage::setCategory(Core::Id category)
Uses \a category to sort the options pages.
*/
/*!
- \fn void IOptionsPage::setDisplayCategory(const QString &displayCategory)
+ \fn void Core::IOptionsPage::setDisplayCategory(const QString &displayCategory)
Sets \a displayCategory as the display category of the options page.
*/
/*!
- \fn void IOptionsPage::setCategoryIcon(const Utils::Icon &categoryIcon)
+ \fn void Core::IOptionsPage::setCategoryIcon(const Utils::Icon &categoryIcon)
Sets \a categoryIcon as the category icon of the options page.
*/
diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp
index 261f975cc40..8cb8f1770e8 100644
--- a/src/plugins/coreplugin/dialogs/newdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/newdialog.cpp
@@ -181,8 +181,6 @@ NewDialog::NewDialog(QWidget *parent) :
m_currentDialog = this;
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- setWindowFlags(windowFlags());
setAttribute(Qt::WA_DeleteOnClose);
ICore::registerWindow(this, Context("Core.NewDialog"));
m_ui->setupUi(this);
diff --git a/src/plugins/coreplugin/dialogs/openwithdialog.cpp b/src/plugins/coreplugin/dialogs/openwithdialog.cpp
index 526a32f7e59..bd3e700a56e 100644
--- a/src/plugins/coreplugin/dialogs/openwithdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/openwithdialog.cpp
@@ -36,7 +36,6 @@ OpenWithDialog::OpenWithDialog(const QString &fileName, QWidget *parent)
: QDialog(parent)
{
setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
label->setText(tr("Open file \"%1\" with:").arg(Utils::FilePath::fromString(fileName).fileName()));
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
diff --git a/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp b/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp
index d29c56aef01..ef696df28b6 100644
--- a/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp
+++ b/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp
@@ -64,7 +64,6 @@ PromptOverwriteDialog::PromptOverwriteDialog(QWidget *parent) :
{
setWindowTitle(tr("Overwrite Existing Files"));
setModal(true);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
auto mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(m_label);
m_view->setRootIsDecorated(false);
diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
index d41445d8f79..697e0a33c2f 100644
--- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
@@ -163,7 +163,6 @@ ReadOnlyFilesDialog::ReadOnlyFilesDialog(const Utils::FilePaths &filePaths, QWid
: QDialog(parent)
, d(new ReadOnlyFilesDialogPrivate(this))
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
d->initDialog(filePaths);
}
diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
index 94c0bbddc16..efeca722731 100644
--- a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
@@ -49,7 +49,6 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
: QDialog(parent)
{
m_ui.setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
// QDialogButtonBox's behavior for "destructive" is wrong, the "do not save" should be left-aligned
const QDialogButtonBox::ButtonRole discardButtonRole = Utils::HostOsInfo::isMacHost()
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index 302a5042170..459af08a4ae 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -450,7 +450,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
m_filterLineEdit->setFiltering(true);
createGui();
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
if (Utils::HostOsInfo::isMacHost())
setWindowTitle(QCoreApplication::translate("Core::Internal::SettingsDialog", "Preferences"));
else
diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp
index c51dc81a674..aa18827b049 100644
--- a/src/plugins/coreplugin/editormanager/documentmodel.cpp
+++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp
@@ -414,6 +414,18 @@ void DocumentModelPrivate::addEditor(IEditor *editor, bool *isNewDocument)
}
}
+/*!
+ \class Core::DocumentModel
+ \inmodule QtCreator
+ \internal
+*/
+
+/*!
+ \class Core::DocumentModel::Entry
+ \inmodule QtCreator
+ \internal
+*/
+
DocumentModel::Entry *DocumentModelPrivate::addSuspendedDocument(const QString &fileName,
const QString &displayName,
Id id)
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index bae2df0e392..ac4296aea2a 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -133,6 +133,12 @@ using namespace Utils;
//===================EditorManager=====================
+/*!
+ \class Core::EditorManagerPlaceHolder
+ \inmodule QtCreator
+ \internal
+*/
+
EditorManagerPlaceHolder::EditorManagerPlaceHolder(QWidget *parent)
: QWidget(parent)
{
@@ -165,6 +171,68 @@ void EditorManagerPlaceHolder::showEvent(QShowEvent *)
// ---------------- EditorManager
+/*!
+ \class Core::EditorManager
+ \inmodule QtCreator
+ \brief The EditorManager class manages the editors created for files
+ according to their MIME type.
+
+ Whenever a user wants to edit or create a file, the EditorManager scans all
+ IEditorFactory interfaces for suitable editors. The selected IEditorFactory
+ is then asked to create an editor, as determined by the MIME type of the
+ file.
+
+ Users can split the editor view or open the editor in a new window when
+ to work on and view multiple files on the same screen or on multiple
+ screens. For more information, see
+ \l{https://doc.qt.io/qtcreator/creator-coding-navigating.html#splitting-the-editor-view}
+ {Splitting the Editor View}.
+*/
+
+/*!
+ \enum Core::MakeWritableResult
+ \internal
+
+ This enum holds whether the document has successfully been made writable.
+
+ \value OpenedWithVersionControl
+ The document was opened under version control.
+ \value MadeWritable
+ The document was made writable.
+ \value SavedAs
+ The document was saved under another name.
+ \value Failed
+ The document cannot be made writable.
+*/
+
+/*!
+ \enum EditorManager::OpenEditorFlag
+
+ This enum holds settings for opening a file in an editor.
+
+ \value NoFlags
+ Does not use any settings.
+ \value DoNotChangeCurrentEditor
+ Does not switch focus to the newly opened editor.
+ \value IgnoreNavigationHistory
+ Does not add an entry to the navigation history for the
+ opened editor.
+ \value DoNotMakeVisible
+ Does not force the editor to become visible.
+ \value CanContainLineAndColumnNumber
+ If the file path contains line and column numbers, opens
+ the file in an editor and jumps to the line and column.
+ \value OpenInOtherSplit
+ Opens the document in another split of the window.
+ \value DoNotSwitchToDesignMode
+ Opens the document in the current mode.
+ \value DoNotSwitchToEditMode
+ Opens the document in the current mode.
+ \value SwitchSplitIfAlreadyVisible
+ Switches to another split if the document is already
+ visible there.
+*/
+
static EditorManager *m_instance = nullptr;
static EditorManagerPrivate *d;
@@ -1634,7 +1702,7 @@ void EditorManagerPrivate::closeView(EditorView *view)
Removes all editors from the view and from the document model, taking care of
the handling of editors that are the last ones for the document.
Returns the list of editors that were actually removed from the document model and
- need to be deleted with EditorManagerPrivate::deleteEditors.
+ need to be deleted with \c EditorManagerPrivate::deleteEditors.
\internal
*/
const QList<IEditor *> EditorManagerPrivate::emptyView(EditorView *view)
@@ -1664,7 +1732,7 @@ const QList<IEditor *> EditorManagerPrivate::emptyView(EditorView *view)
}
/*!
- Signals editorsClosed and deletes the editors.
+ Signals editorsClosed() and deletes the editors.
\internal
*/
void EditorManagerPrivate::deleteEditors(const QList<IEditor *> &editors)
@@ -2412,6 +2480,9 @@ EditorView *EditorManagerPrivate::currentEditorView()
EditorManager *EditorManager::instance() { return m_instance; }
+/*!
+ \internal
+*/
EditorManager::EditorManager(QObject *parent) :
QObject(parent)
{
@@ -2420,28 +2491,46 @@ EditorManager::EditorManager(QObject *parent) :
d->init();
}
+/*!
+ \internal
+*/
EditorManager::~EditorManager()
{
delete d;
m_instance = nullptr;
}
+/*!
+ Returns the document of the currently active editor.
+*/
IDocument *EditorManager::currentDocument()
{
return d->m_currentEditor ? d->m_currentEditor->document() : nullptr;
}
+/*!
+ Returns the currently active editor.
+*/
IEditor *EditorManager::currentEditor()
{
return d->m_currentEditor;
}
+/*!
+ Closes all open editors. If \a askAboutModifiedEditors is \c true, prompts
+ users to save their changes before closing the editors.
+
+ Returns whether all editors were closed.
+*/
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
{
DocumentModelPrivate::removeAllSuspendedEntries();
return closeDocuments(DocumentModel::openedDocuments(), askAboutModifiedEditors);
}
+/*!
+ Closes all open documents except \a document and pinned files.
+*/
void EditorManager::closeOtherDocuments(IDocument *document)
{
DocumentModelPrivate::removeAllSuspendedEntries(DocumentModelPrivate::DoNotRemovePinnedFiles);
@@ -2455,6 +2544,11 @@ void EditorManager::closeOtherDocuments(IDocument *document)
closeDocuments(documentsToClose, true);
}
+/*!
+ Closes all open documents except pinned files.
+
+ Returns whether all editors were closed.
+*/
bool EditorManager::closeAllDocuments()
{
// Only close the files that aren't pinned.
@@ -2472,6 +2566,9 @@ void EditorManager::slotCloseCurrentEditorOrDocument()
d->closeEditorOrDocument(d->m_currentEditor);
}
+/*!
+ Closes all open documents except the current document.
+*/
void EditorManager::closeOtherDocuments()
{
closeOtherDocuments(currentDocument());
@@ -2486,6 +2583,10 @@ static void assignAction(QAction *self, QAction *other)
self->setIconVisibleInMenu(other->isIconVisibleInMenu());
}
+/*!
+ Adds save, close and other editor context menu items for the document
+ \a entry and editor \a editor to the context menu \a contextMenu.
+*/
void EditorManager::addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry,
IEditor *editor)
{
@@ -2544,6 +2645,10 @@ void EditorManager::addSaveAndCloseEditorActions(QMenu *contextMenu, DocumentMod
contextMenu->addAction(d->m_closeAllEditorsExceptVisibleContextAction);
}
+/*!
+ Adds the pin editor menu items for the document \a entry to the context menu
+ \a contextMenu.
+*/
void EditorManager::addPinEditorActions(QMenu *contextMenu, DocumentModel::Entry *entry)
{
const QString quotedDisplayName = entry ? Utils::quoteAmpersands(entry->displayName()) : QString();
@@ -2558,6 +2663,10 @@ void EditorManager::addPinEditorActions(QMenu *contextMenu, DocumentModel::Entry
contextMenu->addAction(d->m_pinAction);
}
+/*!
+ Adds the native directory handling and open with menu items for the document
+ \a entry to the context menu \a contextMenu.
+*/
void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentModel::Entry *entry)
{
QTC_ASSERT(contextMenu, return);
@@ -2577,6 +2686,10 @@ void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentM
populateOpenWithMenu(openWith, entry->fileName().toString());
}
+/*!
+ Populates the \uicontrol {Open With} menu \a menu with editors that are
+ suitable for opening the document \a fileName.
+*/
void EditorManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
{
using EditorFactoryList = QList<IEditorFactory*>;
@@ -2616,37 +2729,59 @@ void EditorManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
menu->setEnabled(anyMatches);
}
+/*!
+ Returns reload behavior settings.
+*/
IDocument::ReloadSetting EditorManager::reloadSetting()
{
return d->m_reloadSetting;
}
+/*!
+ Sets editor reaload behavior settings to \a behavior.
+*/
void EditorManager::setReloadSetting(IDocument::ReloadSetting behavior)
{
d->m_reloadSetting = behavior;
}
+/*!
+ Saves the current document.
+*/
void EditorManager::saveDocument()
{
EditorManagerPrivate::saveDocument(currentDocument());
}
+/*!
+ Saves the current document under a different file name.
+*/
void EditorManager::saveDocumentAs()
{
EditorManagerPrivate::saveDocumentAs(currentDocument());
}
+/*!
+ Reverts the current document to its last saved state.
+*/
void EditorManager::revertToSaved()
{
EditorManagerPrivate::revertToSaved(currentDocument());
}
+/*!
+ Closes \a editor. If \a askAboutModifiedEditors is \c true, prompts
+ users to save their changes before closing the editor.
+*/
void EditorManager::closeEditor(IEditor *editor, bool askAboutModifiedEditors)
{
if (editor)
closeEditors({editor}, askAboutModifiedEditors);
}
+/*!
+ Closes the document specified by \a entry.
+*/
void EditorManager::closeDocument(DocumentModel::Entry *entry)
{
if (!entry)
@@ -2657,6 +2792,11 @@ void EditorManager::closeDocument(DocumentModel::Entry *entry)
closeDocuments({entry->document});
}
+/*!
+ Closes the documents specified by \a entries.
+
+ Returns whether all documents were closed.
+*/
bool EditorManager::closeDocuments(const QList<DocumentModel::Entry *> &entries)
{
QList<IDocument *> documentsToClose;
@@ -2671,6 +2811,13 @@ bool EditorManager::closeDocuments(const QList<DocumentModel::Entry *> &entries)
return closeDocuments(documentsToClose);
}
+/*!
+ Closes the editors specified by \a editorsToClose. If
+ \a askAboutModifiedEditors is \c true, prompts users
+ to save their changes before closing the editor.
+
+ Returns whether all editors were closed.
+*/
bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool askAboutModifiedEditors)
{
return EditorManagerPrivate::closeEditors(editorsToClose,
@@ -2678,12 +2825,20 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
: EditorManagerPrivate::CloseFlag::CloseWithoutAsking);
}
+/*!
+ Activates the editor for the document specified by \a entry using the editor
+ settings specified by \a flags.
+*/
void EditorManager::activateEditorForEntry(DocumentModel::Entry *entry, OpenEditorFlags flags)
{
EditorManagerPrivate::activateEditorForEntry(EditorManagerPrivate::currentEditorView(),
entry, flags);
}
+/*!
+ Activates the editor \a editor using the editor settings specified by
+ \a flags.
+*/
void EditorManager::activateEditor(IEditor *editor, OpenEditorFlags flags)
{
QTC_ASSERT(editor, return);
@@ -2694,11 +2849,23 @@ void EditorManager::activateEditor(IEditor *editor, OpenEditorFlags flags)
EditorManagerPrivate::activateEditor(view, editor, flags);
}
+/*!
+ Activates the editor for the document specified by \a document in the
+ current view using the editor settings specified by \a flags.
+*/
IEditor *EditorManager::activateEditorForDocument(IDocument *document, OpenEditorFlags flags)
{
return EditorManagerPrivate::activateEditorForDocument(EditorManagerPrivate::currentEditorView(), document, flags);
}
+/*!
+ Opens the document specified by \a fileName using the editor type specified
+ by \a editorId and the settings specified by \a flags.
+
+ If \a newEditor is not \c nullptr, and a new editor instance was created,
+ it is set to \c true. If an existing editor instance was used, it is set
+ to \c false.
+*/
IEditor *EditorManager::openEditor(const QString &fileName, Id editorId,
OpenEditorFlags flags, bool *newEditor)
{
@@ -2709,6 +2876,15 @@ IEditor *EditorManager::openEditor(const QString &fileName, Id editorId,
fileName, editorId, flags, newEditor);
}
+/*!
+ Opens the document specified by \a fileName to \a line and \a column using
+ the editor type specified by \a editorId and the settings specified by
+ \a flags.
+
+ If \a newEditor is not \c nullptr, and a new editor instance was created,
+ it is set to \c true. If an existing editor instance was used, it is set
+ to \c false.
+*/
IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column,
Id editorId, OpenEditorFlags flags, bool *newEditor)
{
@@ -2719,6 +2895,10 @@ IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int colu
fileName, line, column, editorId, flags, newEditor);
}
+/*!
+ Opens the document at the position of the search hit \a item in the editor
+ using the settings specified by \a flags.
+*/
void EditorManager::openEditorAtSearchResult(const SearchResultItem &item, OpenEditorFlags flags)
{
if (item.path.empty()) {
@@ -2730,6 +2910,14 @@ void EditorManager::openEditorAtSearchResult(const SearchResultItem &item, OpenE
item.mainRange.begin.column, Id(), flags);
}
+/*!
+ Returns the file path \a fullFilePath with appended line and column
+ information split into file path, line, and column components.
+
+ The following patterns are supported: \c {filepath.txt:19},
+ \c{filepath.txt:19:12}, \c {filepath.txt+19},
+ \c {filepath.txt+19+12}, and \c {filepath.txt(19)}.
+*/
EditorManager::FilePathInfo EditorManager::splitLineAndColumnNumber(const QString &fullFilePath)
{
// :10:2 GCC/Clang-style
@@ -2760,11 +2948,21 @@ EditorManager::FilePathInfo EditorManager::splitLineAndColumnNumber(const QStrin
return {filePath, postfix, line, column};
}
+/*!
+ Returns whether \a fileName is an auto-save file created by \QC.
+*/
bool EditorManager::isAutoSaveFile(const QString &fileName)
{
return fileName.endsWith(".autosave");
}
+/*!
+ Opens the document specified by \a fileName in the external editor specified
+ by \a editorId.
+
+ If \a editorId is not the ID of an external editor or the external editor
+ cannot be opened, returns \c false and displays an error message.
+*/
bool EditorManager::openExternalEditor(const QString &fileName, Id editorId)
{
IExternalEditor *ee = Utils::findOrDefault(IExternalEditor::allExternalEditors(),
@@ -2781,21 +2979,23 @@ bool EditorManager::openExternalEditor(const QString &fileName, Id editorId)
}
/*!
- \fn EditorManager::addCloseEditorListener
-
- \brief The \c EditorManager::addCloseEditorListener function provides
- a hook for plugins to veto on closing editors.
+ Provides a hook for plugins to veto on closing editors.
- When an editor requests a close, all listeners are called. If one of these
- calls returns \c false, the process is aborted and the event is ignored.
- If all calls return \c true, \c EditorManager::editorAboutToClose()
- is emitted and the event is accepted.
+ When an editor requests a close, all listeners are called. If one of the
+ \a listener calls returns \c false, the process is aborted and the event is ignored.
+ If all calls return \c true, editorAboutToClose() is emitted and the event
+ is accepted.
*/
void EditorManager::addCloseEditorListener(const std::function<bool (IEditor *)> &listener)
{
d->m_closeEditorListeners.append(listener);
}
+/*!
+ Asks the user for a list of files to open and returns the choice.
+
+ \sa QFileDialog::getOpenFileNames()
+*/
QStringList EditorManager::getOpenFileNames()
{
QString selectedFilter;
@@ -2836,6 +3036,17 @@ static QString makeTitleUnique(QString *titlePattern)
return title;
}
+/*!
+ Opens \a contents in an editor of the type \a editorId using the settings
+ specified by \a flags.
+
+ The editor is given a display name based on \a titlePattern. If a
+ non-empty \a uniqueId is specified and an editor with that unique
+ ID is found, it is re-used. Otherwise, a new editor with that
+ unique ID is created.
+
+ Returns the new or re-used editor.
+*/
IEditor *EditorManager::openEditorWithContents(Id editorId,
QString *titlePattern,
const QByteArray &contents,
@@ -2894,21 +3105,41 @@ IEditor *EditorManager::openEditorWithContents(Id editorId,
return edt;
}
+/*!
+ Returns whether the document specified by \a filePath should be opened even
+ though it is big. Depending on the settings, might ask the user to decide
+ whether the file should be opened.
+
+ Returns the path to the file that was skipped.
+*/
bool EditorManager::skipOpeningBigTextFile(const QString &filePath)
{
return EditorManagerPrivate::skipOpeningBigTextFile(filePath);
}
+/*!
+ Clears the unique ID of \a document.
+
+ \sa openEditorWithContents()
+*/
void EditorManager::clearUniqueId(IDocument *document)
{
document->setProperty(scratchBufferKey, QVariant());
}
+/*!
+ Saves the changes in \a document.
+
+ Returns whether the operation was successful.
+*/
bool EditorManager::saveDocument(IDocument *document)
{
return EditorManagerPrivate::saveDocument(document);
}
+/*!
+ \internal
+*/
bool EditorManager::hasSplitter()
{
EditorView *view = EditorManagerPrivate::currentEditorView();
@@ -2918,6 +3149,9 @@ bool EditorManager::hasSplitter()
return area->isSplitter();
}
+/*!
+ Returns the list of visible editors.
+*/
QList<IEditor*> EditorManager::visibleEditors()
{
QList<IEditor *> editors;
@@ -2941,22 +3175,41 @@ QList<IEditor*> EditorManager::visibleEditors()
return editors;
}
+/*!
+ Closes \a document. If \a askAboutModifiedEditors is \c true, prompts
+ users to save their changes before closing the document.
+
+ Returns whether the document was closed.
+*/
bool EditorManager::closeDocument(IDocument *document, bool askAboutModifiedEditors)
{
return closeDocuments({document}, askAboutModifiedEditors);
}
+/*!
+ Closes \a documents. If \a askAboutModifiedEditors is \c true, prompts
+ users to save their changes before closing the documents.
+
+ Returns whether the documents were closed.
+*/
bool EditorManager::closeDocuments(const QList<IDocument *> &documents, bool askAboutModifiedEditors)
{
return m_instance->closeEditors(DocumentModel::editorsForDocuments(documents), askAboutModifiedEditors);
}
+/*!
+ Adds the current cursor position to the navigation history specified by
+ \a saveState.
+*/
void EditorManager::addCurrentPositionToNavigationHistory(const QByteArray &saveState)
{
EditorManagerPrivate::currentEditorView()->addCurrentPositionToNavigationHistory(saveState);
EditorManagerPrivate::updateActions();
}
+/*!
+ Sets the location that was last modified to \a editor.
+*/
void EditorManager::setLastEditLocation(const IEditor* editor)
{
IDocument *document = editor->document();
@@ -2973,12 +3226,18 @@ void EditorManager::setLastEditLocation(const IEditor* editor)
d->m_globalLastEditLocation = location;
}
+/*!
+ Cuts forward in the navigation history.
+*/
void EditorManager::cutForwardNavigationHistory()
{
EditorManagerPrivate::currentEditorView()->cutForwardNavigationHistory();
EditorManagerPrivate::updateActions();
}
+/*!
+ Goes back in the navigation history.
+*/
void EditorManager::goBackInNavigationHistory()
{
EditorManagerPrivate::currentEditorView()->goBackInNavigationHistory();
@@ -2986,6 +3245,9 @@ void EditorManager::goBackInNavigationHistory()
return;
}
+/*!
+ Goes forward in the navigation history.
+*/
void EditorManager::goForwardInNavigationHistory()
{
EditorManagerPrivate::currentEditorView()->goForwardInNavigationHistory();
@@ -3006,7 +3268,9 @@ QVector<EditorWindow *> editorWindows(const QList<EditorArea *> &areas)
return result;
}
-// Save state of all non-temporary editors.
+/*!
+ Returns the serialized state of all non-temporary editors.
+*/
QByteArray EditorManager::saveState()
{
QByteArray bytes;
@@ -3053,6 +3317,11 @@ QByteArray EditorManager::saveState()
return bytes;
}
+/*!
+ Restores the editor to \a state.
+
+ Returns \c true if the editor state can be restored.
+*/
bool EditorManager::restoreState(const QByteArray &state)
{
closeAllEditors(true);
@@ -3132,6 +3401,10 @@ bool EditorManager::restoreState(const QByteArray &state)
return true;
}
+/*!
+ Shows the editor status bar \a object with the \a id, \a infoText,
+ \a buttonText, and \a function.
+*/
void EditorManager::showEditorStatusBar(const QString &id,
const QString &infoText,
const QString &buttonText,
@@ -3143,12 +3416,18 @@ void EditorManager::showEditorStatusBar(const QString &id,
id, infoText, buttonText, object, function);
}
+/*!
+ Hides the editor status bar specified by \a id.
+*/
void EditorManager::hideEditorStatusBar(const QString &id)
{
// TODO: what if the current editor view betwenn show and hideEditorStatusBar changed?
EditorManagerPrivate::currentEditorView()->hideEditorStatusBar(id);
}
+/*!
+ Returns the default text codec for the locale.
+*/
QTextCodec *EditorManager::defaultTextCodec()
{
QSettings *settings = ICore::settings();
@@ -3167,6 +3446,9 @@ QTextCodec *EditorManager::defaultTextCodec()
return QTextCodec::codecForLocale();
}
+/*!
+ Returns the default line ending as the user specified in the settings.
+*/
TextFileFormat::LineTerminationMode EditorManager::defaultLineEnding()
{
QSettings *settings = ICore::settings();
@@ -3176,13 +3458,16 @@ TextFileFormat::LineTerminationMode EditorManager::defaultLineEnding()
return static_cast<TextFileFormat::LineTerminationMode>(defaultLineTerminator);
}
+/*!
+ Splits the editor view horizontally into adjacent views.
+*/
void EditorManager::splitSideBySide()
{
EditorManagerPrivate::split(Qt::Horizontal);
}
/*!
- * Moves focus to "other" split, possibly creating a split if necessary.
+ * Moves focus to another split, creating it if necessary.
* If there's no split and no other window, a side-by-side split is created.
* If the current window is split, focus is moved to the next split within this window, cycling.
* If the current window is not split, focus is moved to the next window.
@@ -3227,16 +3512,25 @@ void EditorManager::gotoOtherSplit()
EditorManagerPrivate::activateView(nextView);
}
+/*!
+ Returns the maximum file size.
+*/
qint64 EditorManager::maxTextFileSize()
{
return qint64(3) << 24;
}
+/*!
+ Sets the window title addition handler to \a handler.
+*/
void EditorManager::setWindowTitleAdditionHandler(WindowTitleHandler handler)
{
d->m_titleAdditionHandler = handler;
}
+/*!
+ Sets the session title addition handler to \a handler.
+*/
void EditorManager::setSessionTitleHandler(WindowTitleHandler handler)
{
d->m_sessionTitleHandler = handler;
diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h
index 205bd7a82d3..0cf3412442f 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.h
+++ b/src/plugins/coreplugin/editormanager/editormanager.h
@@ -149,7 +149,7 @@ public:
const QString &infoText,
const QString &buttonText = QString(),
QObject *object = nullptr,
- const std::function<void()> &function = nullptr);
+ const std::function<void()> &function = {});
static void hideEditorStatusBar(const QString &id);
static bool isAutoSaveFile(const QString &fileName);
diff --git a/src/plugins/coreplugin/editormanager/ieditor.cpp b/src/plugins/coreplugin/editormanager/ieditor.cpp
index 6df855ad517..c79fa6ade09 100644
--- a/src/plugins/coreplugin/editormanager/ieditor.cpp
+++ b/src/plugins/coreplugin/editormanager/ieditor.cpp
@@ -27,43 +27,95 @@
/*!
\class Core::IEditor
- \brief The IEditor class is an interface for providing different editors for
- different file types.
+ \inmodule QtCreator
+ \brief The IEditor class is an interface for providing suitable editors for
+ documents according to their MIME type.
Classes that implement this interface are for example the editors for
- C++ files, UI files and resource files.
-
- Whenever a user wants to edit or create a file, the EditorManager scans all
- EditorFactoryInterfaces for suitable editors. The selected EditorFactory
- is then asked to create an editor, which must implement this interface.
-
- Guidelines for implementing:
- \list
- \li \c displayName() is used as a user visible description of the document
- (usually filename w/o path).
- \li \c kind() must be the same value as the \c kind() of the corresponding
- EditorFactory.
- \li If duplication is supported, you need to ensure that all duplicates
- return the same \c file().
- \li QString \c preferredMode() const is the mode the editor manager should
- activate. Some editors use a special mode (such as \gui Design mode).
- \endlist
-
- \sa Core::EditorFactoryInterface Core::IContext
+ C++ files, UI files, and resource files.
+ Whenever a user wants to edit or create a document, the EditorManager
+ scans all IEditorFactory interfaces for suitable editors. The selected
+ IEditorFactory is then asked to create an editor, which must implement
+ this interface.
+
+ \sa Core::IEditorFactory, Core::EditorManager
+*/
+
+/*!
+ \fn Core::IDocument *Core::IEditor::document() const
+ Returns the document to open in an editor.
+*/
+
+/*!
+ \fn Core::IEditor *Core::IEditor::duplicate()
+ Duplicates the editor.
+
+ \sa duplicateSupported()
+*/
+
+/*!
+ \fn QByteArray Core::IEditor::saveState() const
+ Saves the state of the document.
+*/
+
+/*!
+ \fn bool Core::IEditor::restoreState(const QByteArray &state)
+ Restores the \a state of the document.
+
+ Returns \c true on success.
+*/
+
+/*!
+ \fn int Core::IEditor::currentLine() const
+ Returns the current line in the document.
+*/
+
+/*!
+ \fn int Core::IEditor::currentColumn() const
+ Returns the current column in the document.
+*/
+
+/*!
+ \fn void Core::IEditor::gotoLine(int line, int column = 0, bool centerLine = true)
+ Goes to \a line and \a column in the document. If \a centerLine is
+ \c true, centers the line in the editor.
+*/
+
+/*!
+ \fn QWidget Core::IEditor::toolBar()
+ Returns the toolbar for the editor.
+
+ The editor toolbar is located at the top of the editor view. The editor
+ toolbar is context sensitive and shows items relevant to the document
+ currently open in the editor.
+*/
+
+/*! \fn bool Core::IEditor::isDesignModePreferred() const
+ Indicates whether the document should be opened in the Design mode.
+ Returns \c false unless Design mode is preferred.
*/
namespace Core {
+/*!
+ \internal
+*/
IEditor::IEditor(QObject *parent)
: IContext(parent), m_duplicateSupported(false)
{}
+/*!
+ Returns whether duplication is supported.
+*/
bool IEditor::duplicateSupported() const
{
return m_duplicateSupported;
}
+/*!
+ Sets whether duplication is supported to \a duplicatesSupported.
+*/
void IEditor::setDuplicateSupported(bool duplicatesSupported)
{
m_duplicateSupported = duplicatesSupported;
diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
index 85cceacc03b..69704527952 100644
--- a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
+++ b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp
@@ -34,19 +34,86 @@
namespace Core {
+/*!
+ \class Core::IEditorFactory
+ \inmodule QtCreator
+ \brief The IEditorFactory class creates suitable editors for documents
+ according to their MIME type.
+
+ Whenever a user wants to edit or create a document, the EditorManager
+ scans all IEditorFactory interfaces for suitable editors. The selected
+ IEditorFactory is then asked to create an editor.
+
+ Guidelines for the implementation:
+
+ \list
+ \li displayName() is used as a user visible description of the editor
+ type that is created. For example, the name displayed in the
+ \uicontrol {Open With} menu.
+ \li If duplication is supported (IEditor::duplicateSupported()), you
+ need to ensure that all duplicates return the same document().
+ \endlist
+
+ \sa Core::IEditor, Core::EditorManager
+*/
+
+/*!
+ \fn void Core::IEditorFactory::addMimeType(const QString &mimeType)
+ Adds \a mimeType to the list of MIME types supported by this editor type.
+*/
+
+/*!
+ \fn QString Core::IEditorFactory::displayName() const
+ Returns a user-visible description of the editor type.
+*/
+
+/*!
+ \fn Core::Id Core::IEditorFactory::id() const
+ Returns the ID of the factory or editor type.
+*/
+
+/*!
+ \fn QString Core::IEditorFactory::mimeTypes() const
+ Returns a list of MIME types that the editor supports.
+*/
+
+/*!
+ \fn void Core::IEditorFactory::setDisplayName(const QString &displayName)
+ Sets the \a displayName of the factory or editor type.
+*/
+
+/*!
+ \fn void Core::IEditorFactory::setId(Id id)
+ Sets the \a id of the factory or editor type.
+*/
+
+/*!
+ \fn void Core::IEditorFactory::setMimeTypes(const QStringList &mimeTypes)
+ Sets the MIME types supported by the editor to \a mimeTypes.
+*/
+
static QList<IEditorFactory *> g_editorFactories;
static QHash<Utils::MimeType, IEditorFactory *> g_userPreferredEditorFactories;
+/*!
+ \internal
+*/
IEditorFactory::IEditorFactory()
{
g_editorFactories.append(this);
}
+/*!
+ \internal
+*/
IEditorFactory::~IEditorFactory()
{
g_editorFactories.removeOne(this);
}
+/*!
+ \internal
+*/
const EditorFactoryList IEditorFactory::allEditorFactories()
{
return g_editorFactories;
@@ -54,7 +121,7 @@ const EditorFactoryList IEditorFactory::allEditorFactories()
/*!
Returns all available editors for this \a mimeType in the default order
- (editors ordered by mime type hierarchy).
+ (editors ordered by MIME type hierarchy).
*/
const EditorFactoryList IEditorFactory::defaultEditorFactories(const Utils::MimeType &mimeType)
{
@@ -66,9 +133,9 @@ const EditorFactoryList IEditorFactory::defaultEditorFactories(const Utils::Mime
/*!
Returns the available editors for \a fileName in order of preference.
- That is the default order for the file's MIME type but with a user overridden default
- editor first, and if the file is a too large text file, with the binary editor as the
- very first.
+ That is the default order for the document's MIME type but with a user
+ overridden default editor first, and if the document is a too large
+ text file, with the binary editor as the very first.
*/
const EditorFactoryList IEditorFactory::preferredEditorFactories(const QString &fileName)
{
@@ -95,22 +162,38 @@ const EditorFactoryList IEditorFactory::preferredEditorFactories(const QString &
return factories;
}
+/*!
+ Creates an editor.
+
+ Either override this in a subclass, or set the function to use for
+ creating an editor instance with setEditorCreator().
+*/
IEditor *IEditorFactory::createEditor() const
{
QTC_ASSERT(m_creator, return nullptr);
return m_creator();
}
+/*!
+ Sets the function that is used to create an editor instance in
+ createEditor() by default to \a creator.
+*/
void IEditorFactory::setEditorCreator(const std::function<IEditor *()> &creator)
{
m_creator = creator;
}
+/*!
+ \internal
+*/
QHash<Utils::MimeType, Core::IEditorFactory *> Core::Internal::userPreferredEditorFactories()
{
return g_userPreferredEditorFactories;
}
+/*!
+ \internal
+*/
void Internal::setUserPreferredEditorFactories(const QHash<Utils::MimeType, IEditorFactory *> &factories)
{
g_userPreferredEditorFactories = factories;
diff --git a/src/plugins/coreplugin/editormanager/iexternaleditor.cpp b/src/plugins/coreplugin/editormanager/iexternaleditor.cpp
index 9fdb561587f..dd9ef3c309e 100644
--- a/src/plugins/coreplugin/editormanager/iexternaleditor.cpp
+++ b/src/plugins/coreplugin/editormanager/iexternaleditor.cpp
@@ -31,25 +31,31 @@ namespace Core {
/*!
\class Core::IExternalEditor
- \mainclass
+ \inmodule QtCreator
+ \ingroup mainclasses
\brief The IExternalEditor class enables registering an external
- editor in the \gui{Open With} dialog.
+ editor in the \uicontrol{Open With} dialog.
*/
/*!
- \fn IExternalEditor::IExternalEditor(QObject *parent)
- \internal
+ \fn QString Core::IExternalEditor::displayName() const
+ Returns a user-visible description of the editor type.
+*/
+
+/*!
+ \fn Core::Id Core::IExternalEditor::id() const
+ Returns the ID of the factory or editor type.
*/
/*!
- \fn QStringList IExternalEditor::mimeTypes() const
- Returns the mime type the editor supports
+ \fn QStringList Core::IExternalEditor::mimeTypes() const
+ Returns a list of MIME types that the editor supports
*/
/*!
- \fn bool IExternalEditor::startEditor(const QString &fileName, QString *errorMessage) = 0;
+ \fn bool Core::IExternalEditor::startEditor(const QString &fileName, QString *errorMessage) = 0;
Opens the editor with \a fileName. Returns \c true on success or \c false
on failure along with the error in \a errorMessage.
@@ -57,22 +63,35 @@ namespace Core {
static QList<IExternalEditor *> g_externalEditors;
+/*!
+ \internal
+*/
IExternalEditor::IExternalEditor(QObject *parent)
: QObject(parent)
{
g_externalEditors.append(this);
}
+/*!
+ \internal
+*/
IExternalEditor::~IExternalEditor()
{
g_externalEditors.removeOne(this);
}
+/*!
+ Returns all available external editors.
+*/
const ExternalEditorList IExternalEditor::allExternalEditors()
{
return g_externalEditors;
}
+/*!
+ Returns all external editors available for this \a mimeType in the default
+ order (editors ordered by MIME type hierarchy).
+*/
const ExternalEditorList IExternalEditor::externalEditors(const Utils::MimeType &mimeType)
{
ExternalEditorList rc;
diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp
index 97e0e003be1..f6e8b039787 100644
--- a/src/plugins/coreplugin/externaltool.cpp
+++ b/src/plugins/coreplugin/externaltool.cpp
@@ -666,8 +666,8 @@ void ExternalToolRunner::run()
const CommandLine cmd{m_resolvedExecutable, m_resolvedArguments, CommandLine::Raw};
m_process->setCommand(cmd);
m_process->setEnvironment(m_resolvedEnvironment);
- MessageManager::write(tr("Starting external tool \"%1\"")
- .arg(cmd.toUserOutput()), MessageManager::Silent);
+ MessageManager::writeWithTime(tr("Starting external tool \"%1\"")
+ .arg(cmd.toUserOutput()), MessageManager::Silent);
m_process->start();
}
@@ -687,8 +687,8 @@ void ExternalToolRunner::finished(int exitCode, QProcess::ExitStatus status)
}
if (m_tool->modifiesCurrentDocument())
DocumentManager::unexpectFileChange(m_expectedFileName);
- MessageManager::write(tr("\"%1\" finished")
- .arg(m_resolvedExecutable.toUserOutput()), MessageManager::Silent);
+ MessageManager::writeWithTime(tr("\"%1\" finished")
+ .arg(m_resolvedExecutable.toUserOutput()), MessageManager::Silent);
deleteLater();
}
diff --git a/src/plugins/coreplugin/find/basetextfind.cpp b/src/plugins/coreplugin/find/basetextfind.cpp
index 2d3cb7de0b5..71bc7687e8a 100644
--- a/src/plugins/coreplugin/find/basetextfind.cpp
+++ b/src/plugins/coreplugin/find/basetextfind.cpp
@@ -92,7 +92,7 @@ BaseTextFindPrivate::BaseTextFindPrivate(QPlainTextEdit *editor)
*/
/*!
- \fn void BaseTextFind::findScopeChanged(const QTextCursor &start,
+ \fn void Core::BaseTextFind::findScopeChanged(const QTextCursor &start,
const QTextCursor &end,
int verticalBlockSelectionFirstColumn,
int verticalBlockSelectionLastColumn)
@@ -104,7 +104,7 @@ BaseTextFindPrivate::BaseTextFindPrivate(QPlainTextEdit *editor)
*/
/*!
- \fn void BaseTextFind::highlightAllRequested(const QString &txt, Core::FindFlags findFlags)
+ \fn void Core::BaseTextFind::highlightAllRequested(const QString &txt, Core::FindFlags findFlags)
This signal is emitted when the search results for \a txt using the given
\a findFlags should be highlighted in the editor widget.
diff --git a/src/plugins/coreplugin/find/ifindfilter.cpp b/src/plugins/coreplugin/find/ifindfilter.cpp
index fef203a1f8c..b61d935e607 100644
--- a/src/plugins/coreplugin/find/ifindfilter.cpp
+++ b/src/plugins/coreplugin/find/ifindfilter.cpp
@@ -99,14 +99,14 @@
/*!
- \fn QString IFindFilter::id() const
+ \fn QString Core::IFindFilter::id() const
Returns the unique string identifier for this find filter.
Usually should be something like "MyPlugin.MyFindFilter".
*/
/*!
- \fn QString IFindFilter::displayName() const
+ \fn QString Core::IFindFilter::displayName() const
Returns the name of the find filter or scope as presented to the user.
This is the name that appears in the scope selection combo box, for example.
@@ -115,7 +115,7 @@
*/
/*!
- \fn bool IFindFilter::isEnabled() const
+ \fn bool Core::IFindFilter::isEnabled() const
Returns whether the user should be able to select this find filter
at the moment.
@@ -127,14 +127,14 @@
*/
/*!
- \fn bool IFindFilter::isValid() const
+ \fn bool Core::IFindFilter::isValid() const
Returns whether the find filter is valid.
\sa validChanged()
*/
/*!
- \fn bool IFindFilter::isReplaceSupported() const
+ \fn bool Core::IFindFilter::isReplaceSupported() const
Returns whether the find filter supports search and replace.
The default value is false, override this function to return \c true, if
@@ -142,7 +142,7 @@
*/
/*!
- \fn bool IFindFilter::showSearchTermInput() const
+ \fn bool Core::IFindFilter::showSearchTermInput() const
Returns whether the find filter wants to show the search term line edit.
The default value is \c true, override this function to return \c false, if
@@ -150,7 +150,7 @@
*/
/*!
- \fn void IFindFilter::findAll(const QString &txt, FindFlags findFlags)
+ \fn void Core::IFindFilter::findAll(const QString &txt, Core::FindFlags findFlags)
This function is called when the user selected this find scope and
initiated a search.
@@ -167,7 +167,7 @@
*/
/*!
- \fn void IFindFilter::replaceAll(const QString &txt, FindFlags findFlags)
+ \fn void Core::IFindFilter::replaceAll(const QString &txt, Core::FindFlags findFlags)
Override this function if you want to support search and replace.
This function is called when the user selected this find scope and
@@ -187,7 +187,7 @@
*/
/*!
- \fn QWidget *IFindFilter::createConfigWidget()
+ \fn QWidget *Core::IFindFilter::createConfigWidget()
Returns a widget that contains additional controls for options
for this find filter.
@@ -196,32 +196,32 @@
*/
/*!
- \fn void IFindFilter::writeSettings(QSettings *settings)
+ \fn void Core::IFindFilter::writeSettings(QSettings *settings)
Called at shutdown to write the state of the additional options
for this find filter to the \a settings.
*/
/*!
- \fn void IFindFilter::readSettings(QSettings *settings)
+ \fn void Core::IFindFilter::readSettings(QSettings *settings)
Called at startup to read the state of the additional options
for this find filter from the \a settings.
*/
/*!
- \fn void IFindFilter::enabledChanged(bool enabled)
+ \fn void Core::IFindFilter::enabledChanged(bool enabled)
This signal is emitted when the \a enabled state of this find filter
changes.
*/
/*!
- \fn void IFindFilter::validChanged(bool valid)
+ \fn void Core::IFindFilter::validChanged(bool valid)
This signal is emitted when the \a valid state of this find filter changes.
*/
/*!
- \fn void IFindFilter::displayNameChanged()
+ \fn void Core::IFindFilter::displayNameChanged()
This signal is emitted when the display name of this find filter changes.
*/
diff --git a/src/plugins/coreplugin/find/ifindsupport.cpp b/src/plugins/coreplugin/find/ifindsupport.cpp
index f36bea2146d..ffd671e94be 100644
--- a/src/plugins/coreplugin/find/ifindsupport.cpp
+++ b/src/plugins/coreplugin/find/ifindsupport.cpp
@@ -40,7 +40,7 @@ using namespace Core;
*/
/*!
- \enum IFindSupport::Result
+ \enum Core::IFindSupport::Result
This enum holds whether the search term was found within the search scope
using the find flags.
@@ -50,22 +50,22 @@ using namespace Core;
*/
/*!
- \fn IFindSupport::IFindSupport()
+ \fn Core::IFindSupport::IFindSupport()
\internal
*/
/*!
- \fn IFindSupport::~IFindSupport()
+ \fn Core::IFindSupport::~IFindSupport()
\internal
*/
/*!
- \fn bool IFindSupport::supportsReplace() const
+ \fn bool Core::IFindSupport::supportsReplace() const
Returns whether the find filter supports search and replace.
*/
/*!
- \fn FindFlags IFindSupport::supportedFindFlags() const
+ \fn Core::FindFlags Core::IFindSupport::supportedFindFlags() const
Returns the find flags, such as whole words or regular expressions,
that this find filter supports.
@@ -78,52 +78,52 @@ using namespace Core;
*/
/*!
- \fn void IFindSupport::resetIncrementalSearch()
+ \fn void Core::IFindSupport::resetIncrementalSearch()
Resets incremental search to start position.
*/
/*!
- \fn void IFindSupport::clearHighlights()
+ \fn void Core::IFindSupport::clearHighlights()
Clears highlighting of search results in the searched widget.
*/
/*!
- \fn QString IFindSupport::currentFindString() const
+ \fn QString Core::IFindSupport::currentFindString() const
Returns the current search string.
*/
/*!
- \fn QString IFindSupport::completedFindString() const
+ \fn QString Core::IFindSupport::completedFindString() const
Returns the complete search string.
*/
/*!
- \fn void IFindSupport::highlightAll(const QString &txt, FindFlags findFlags)
+ \fn void Core::IFindSupport::highlightAll(const QString &txt, Core::FindFlags findFlags)
Highlights all search hits for \a txt when using \a findFlags.
*/
/*!
- \fn Result IFindSupport::findIncremental(const QString &txt, FindFlags findFlags)
+ \fn Core::IFindSupport::Result Core::IFindSupport::findIncremental(const QString &txt, Core::FindFlags findFlags)
Performs an incremental search of the search term \a txt using \a findFlags.
*/
/*!
- \fn Result IFindSupport::findStep(const QString &txt, FindFlags findFlags)
+ \fn Core::IFindSupport::Result Core::IFindSupport::findStep(const QString &txt, Core::FindFlags findFlags)
Searches for \a txt using \a findFlags.
*/
/*!
- \fn void IFindSupport::defineFindScope()
+ \fn void Core::IFindSupport::defineFindScope()
Defines the find scope.
*/
/*!
- \fn void IFindSupport::clearFindScope()
+ \fn void Core::IFindSupport::clearFindScope()
Clears the find scope.
*/
/*!
- \fn void IFindSupport::changed()
+ \fn void Core::IFindSupport::changed()
This signal is emitted when the search changes.
*/
diff --git a/src/plugins/coreplugin/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp
index a9895f720c8..8f973dbe4c4 100644
--- a/src/plugins/coreplugin/find/searchresultwindow.cpp
+++ b/src/plugins/coreplugin/find/searchresultwindow.cpp
@@ -270,13 +270,13 @@ using namespace Core::Internal;
*/
/*!
- \fn void SearchResult::activated(const Core::SearchResultItem &item)
+ \fn void Core::SearchResult::activated(const Core::SearchResultItem &item)
Indicates that the user activated the search result \a item by
double-clicking it, for example.
*/
/*!
- \fn void SearchResult::replaceButtonClicked(const QString &replaceText,
+ \fn void Core::SearchResult::replaceButtonClicked(const QString &replaceText,
const QList<Core::SearchResultItem> &checkedItems,
bool preserveCase)
@@ -303,36 +303,36 @@ using namespace Core::Internal;
*/
/*!
- \fn void SearchResult::cancelled()
+ \fn void Core::SearchResult::cancelled()
This signal is emitted if the user cancels the search.
*/
/*!
- \fn void SearchResult::countChanged(int count)
+ \fn void Core::SearchResult::countChanged(int count)
This signal is emitted when the number of search hits changes to \a count.
*/
/*!
- \fn void SearchResult::paused(bool paused)
+ \fn void Core::SearchResult::paused(bool paused)
This signal is emitted when the search status is set to \a paused.
*/
/*!
- \fn void SearchResult::requestEnabledCheck()
+ \fn void Core::SearchResult::requestEnabledCheck()
This signal is emitted when the enabled status of search results is
requested.
*/
/*!
- \fn void SearchResult::searchAgainRequested()
+ \fn void Core::SearchResult::searchAgainRequested()
This signal is emitted when the \uicontrol {Search Again} button is
selected.
*/
/*!
- \fn void SearchResult::visibilityChanged(bool visible)
+ \fn void Core::SearchResult::visibilityChanged(bool visible)
This signal is emitted when the visibility of the search results changes
to \a visible.
@@ -372,12 +372,12 @@ using namespace Core::Internal;
*/
/*!
- \fn QString SearchResultWindow::displayName() const
+ \fn QString Core::SearchResultWindow::displayName() const
\internal
*/
/*!
- \enum SearchResultWindow::PreserveCaseMode
+ \enum Core::SearchResultWindow::PreserveCaseMode
This enum type specifies whether a search and replace should preserve the
case of the replaced strings:
diff --git a/src/plugins/coreplugin/iwizardfactory.cpp b/src/plugins/coreplugin/iwizardfactory.cpp
index ce784e9e797..cecbec3f511 100644
--- a/src/plugins/coreplugin/iwizardfactory.cpp
+++ b/src/plugins/coreplugin/iwizardfactory.cpp
@@ -41,18 +41,23 @@
/*!
\class Core::IWizardFactory
- \mainclass
+ \inmodule QtCreator
+ \ingroup mainclasses
- \brief The class IWizardFactory is the base class for all wizard factories
- (for example shown in \gui {File | New}).
+ \brief The IWizardFactory class is the base class for all wizard factories.
- The wizard interface is a very thin abstraction for the \gui{New...} wizards.
- Basically it defines what to show to the user in the wizard selection dialogs,
+ \note Instead of using this class, we recommend that you create JSON-based
+ wizards, as instructed in \l{https://doc.qt.io/qtcreator/creator-project-wizards.html}
+ {Adding New Custom Wizards}.
+
+ The wizard interface is a very thin abstraction for the wizards in
+ \uicontrol File > \uicontrol {New File or Project}.
+ Basically, it defines what to show to the user in the wizard selection dialogs,
and a hook that is called if the user selects the wizard.
Wizards can then perform any operations they like, including showing dialogs and
- creating files. Often it is not necessary to create your own wizard from scratch,
- instead use one of the predefined wizards and adapt it to your needs.
+ creating files. Often it is not necessary to create your own wizard from scratch.
+ Use one of the predefined wizards and adapt it to your needs.
To make your wizard known to the system, add your IWizardFactory instance to the
plugin manager's object pool in your plugin's initialize function:
@@ -64,86 +69,60 @@
// ... do more setup
}
\endcode
- \sa Core::BaseFileWizard
- \sa Core::StandardFileWizard
+
+ \sa Core::BaseFileWizardFactory, Core::BaseFileWizard
*/
/*!
\enum Core::IWizardFactory::WizardKind
Used to specify what kind of objects the wizard creates. This information is used
- to show e.g. only wizards that create projects when selecting a \gui{New Project}
+ to show e.g. only wizards that create projects when selecting a \uicontrol{New Project}
menu item.
\value FileWizard
The wizard creates one or more files.
- \value ClassWizard
- The wizard creates a new class (e.g. source+header files).
\value ProjectWizard
The wizard creates a new project.
*/
/*!
- \fn IWizardFactory::IWizardFactory(QObject *parent)
- \internal
-*/
-
-/*!
- \fn IWizardFactory::~IWizardFactory()
- \internal
-*/
-
-/*!
- \fn Kind IWizardFactory::kind() const
+ \fn Core::IWizardFactory::WizardKind Core::IWizardFactory::kind() const
Returns what kind of objects are created by the wizard.
- \sa Kind
*/
/*!
- \fn QIcon IWizardFactory::icon() const
+ \fn QIcon Core::IWizardFactory::icon() const
Returns an icon to show in the wizard selection dialog.
*/
/*!
- \fn QString IWizardFactory::description() const
+ \fn QString Core::IWizardFactory::description() const
Returns a translated description to show when this wizard is selected
in the dialog.
*/
/*!
- \fn QString IWizardFactory::displayName() const
+ \fn QString Core::IWizardFactory::displayName() const
Returns the translated name of the wizard, how it should appear in the
dialog.
*/
/*!
- \fn QString IWizardFactory::id() const
+ \fn QString Core::IWizardFactory::id() const
Returns an arbitrary id that is used for sorting within the category.
*/
/*!
- \fn QString IWizardFactory::category() const
+ \fn QString Core::IWizardFactory::category() const
Returns a category ID to add the wizard to.
*/
/*!
- \fn QString IWizardFactory::displayCategory() const
+ \fn QString Core::IWizardFactory::displayCategory() const
Returns the translated string of the category, how it should appear
in the dialog.
*/
-/*!
- \fn void IWizardFactory::runWizard(const QString &path,
- QWidget *parent,
- const QString &platform,
- const QVariantMap &variables)
-
- This function is executed when the wizard has been selected by the user
- for execution. Any dialogs the wizard opens should use the given \a parent.
- The \a path argument is a suggestion for the location where files should be
- created. The wizard should fill this in its path selection elements as a
- default path.
-*/
-
using namespace Core;
@@ -268,6 +247,15 @@ QString IWizardFactory::runPath(const QString &defaultPath)
return path;
}
+/*!
+ Creates the wizard that the user selected for execution on the operating
+ system \a platform with \a variables.
+
+ Any dialogs the wizard opens should use the given \a parent.
+ The \a path argument is a suggestion for the location where files should be
+ created. The wizard should fill this in its path selection elements as a
+ default path.
+*/
Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, Id platform, const QVariantMap &variables)
{
QTC_ASSERT(!s_isWizardRunning, return nullptr);
diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp
index f98beae687c..ea983a34f56 100644
--- a/src/plugins/coreplugin/locator/executefilter.cpp
+++ b/src/plugins/coreplugin/locator/executefilter.cpp
@@ -134,7 +134,7 @@ void ExecuteFilter::finished(int exitCode, QProcess::ExitStatus status)
message = tr("Command \"%1\" finished.").arg(commandName);
else
message = tr("Command \"%1\" failed.").arg(commandName);
- MessageManager::write(message);
+ MessageManager::writeWithTime(message);
m_taskQueue.dequeue();
if (!m_taskQueue.isEmpty())
@@ -162,18 +162,18 @@ void ExecuteFilter::runHeadCommand()
const ExecuteData &d = m_taskQueue.head();
const Utils::FilePath fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable);
if (fullPath.isEmpty()) {
- MessageManager::write(tr("Could not find executable for \"%1\".").arg(d.executable));
+ MessageManager::writeWithTime(tr("Could not find executable for \"%1\".").arg(d.executable));
m_taskQueue.dequeue();
runHeadCommand();
return;
}
- MessageManager::write(tr("Starting command \"%1\".").arg(headCommand()));
+ MessageManager::writeWithTime(tr("Starting command \"%1\".").arg(headCommand()));
m_process->setWorkingDirectory(d.workingDirectory);
m_process->setCommand({fullPath, d.arguments, Utils::CommandLine::Raw});
m_process->start();
m_process->closeWriteChannel();
if (!m_process->waitForStarted(1000)) {
- MessageManager::write(tr("Could not start process: %1.").arg(m_process->errorString()));
+ MessageManager::writeWithTime(tr("Could not start process: %1.").arg(m_process->errorString()));
m_taskQueue.dequeue();
runHeadCommand();
}
diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp
index 1d1b8213f8d..e0df3e242d9 100644
--- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp
+++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp
@@ -455,7 +455,7 @@ void ILocatorFilter::setConfigurable(bool configurable)
}
/*!
- \fn QList<LocatorFilterEntry> ILocatorFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry)
+ \fn QList<Core::LocatorFilterEntry> Core::ILocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry)
Returns the list of results of this filter for the search term \a entry.
This is run in a separate thread, but is guaranteed to only run in a single
@@ -471,7 +471,7 @@ void ILocatorFilter::setConfigurable(bool configurable)
*/
/*!
- \fn void ILocatorFilter::accept(LocatorFilterEntry selection, QString *newText, int *selectionStart, int *selectionLength) const
+ \fn void Core::ILocatorFilter::accept(Core::LocatorFilterEntry selection, QString *newText, int *selectionStart, int *selectionLength) const
Called with the entry specified by \a selection when the user activates it
in the result list.
@@ -480,7 +480,7 @@ void ILocatorFilter::setConfigurable(bool configurable)
*/
/*!
- \fn void ILocatorFilter::refresh(QFutureInterface<void> &future)
+ \fn void Core::ILocatorFilter::refresh(QFutureInterface<void> &future)
Refreshes cached data asynchronously.
@@ -488,7 +488,7 @@ void ILocatorFilter::setConfigurable(bool configurable)
*/
/*!
- \enum ILocatorFilter::Priority
+ \enum Core::ILocatorFilter::Priority
This enum value holds the priority that is used for ordering the results
when multiple filters are used.
@@ -505,7 +505,7 @@ void ILocatorFilter::setConfigurable(bool configurable)
*/
/*!
- \enum ILocatorFilter::MatchLevel
+ \enum Core::ILocatorFilter::MatchLevel
This enum value holds the level for ordering the results based on how well
they match the search criteria.
diff --git a/src/plugins/coreplugin/messagemanager.cpp b/src/plugins/coreplugin/messagemanager.cpp
index 75b2e81531c..e5eadc40ec8 100644
--- a/src/plugins/coreplugin/messagemanager.cpp
+++ b/src/plugins/coreplugin/messagemanager.cpp
@@ -32,6 +32,7 @@
#include <QFont>
#include <QThread>
+#include <QTime>
#include <QTimer>
using namespace Core;
@@ -106,6 +107,12 @@ void MessageManager::write(const QString &text, PrintToOutputPaneFlags flags)
QTimer::singleShot(0, instance(), [text, flags] { doWrite(text, flags); });
}
+void MessageManager::writeWithTime(const QString &text, PrintToOutputPaneFlags flags)
+{
+ const QString timeStamp = QTime::currentTime().toString("HH:mm:ss ");
+ write(timeStamp + text, flags);
+}
+
void MessageManager::doWrite(const QString &text, PrintToOutputPaneFlags flags)
{
QTC_ASSERT(m_messageOutputWindow, return);
diff --git a/src/plugins/coreplugin/messagemanager.h b/src/plugins/coreplugin/messagemanager.h
index 386001bc43c..b3efc99e86d 100644
--- a/src/plugins/coreplugin/messagemanager.h
+++ b/src/plugins/coreplugin/messagemanager.h
@@ -65,6 +65,7 @@ public:
static void writeMessages(const QStringList &messages,
PrintToOutputPaneFlags flags = NoModeSwitch);
static void write(const QString &text, PrintToOutputPaneFlags flags = NoModeSwitch);
+ static void writeWithTime(const QString &text, PrintToOutputPaneFlags flags = NoModeSwitch);
private:
MessageManager();
diff --git a/src/plugins/coreplugin/plugindialog.cpp b/src/plugins/coreplugin/plugindialog.cpp
index fa523fa318b..f3dceb73a8e 100644
--- a/src/plugins/coreplugin/plugindialog.cpp
+++ b/src/plugins/coreplugin/plugindialog.cpp
@@ -55,8 +55,6 @@ PluginDialog::PluginDialog(QWidget *parent)
: QDialog(parent),
m_view(new ExtensionSystem::PluginView(this))
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
auto vl = new QVBoxLayout(this);
auto filterLayout = new QHBoxLayout;
diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.cpp b/src/plugins/coreplugin/progressmanager/futureprogress.cpp
index b39738bed47..9803ad86860 100644
--- a/src/plugins/coreplugin/progressmanager/futureprogress.cpp
+++ b/src/plugins/coreplugin/progressmanager/futureprogress.cpp
@@ -83,8 +83,9 @@ FutureProgressPrivate::FutureProgressPrivate(FutureProgress *q) :
}
/*!
- \mainclass
+ \ingroup mainclasses
\class Core::FutureProgress
+ \inmodule QtCreator
\brief The FutureProgress class is used to adapt the appearance of
progress indicators that were created through the ProgressManager class.
@@ -98,28 +99,27 @@ FutureProgressPrivate::FutureProgressPrivate(FutureProgress *q) :
*/
/*!
- \fn void FutureProgress::clicked()
+ \fn void Core::FutureProgress::clicked()
Connect to this signal to get informed when the user clicks on the
progress indicator.
*/
/*!
- \fn void FutureProgress::canceled()
+ \fn void Core::FutureProgress::canceled()
Connect to this signal to get informed when the operation is canceled.
*/
/*!
- \fn void FutureProgress::finished()
+ \fn void Core::FutureProgress::finished()
Another way to get informed when the task has finished.
*/
/*!
- \fn QWidget FutureProgress::widget() const
+ \fn QWidget Core::FutureProgress::widget() const
Returns the custom widget that is shown below the progress indicator.
*/
/*!
- \fn FutureProgress::FutureProgress(QWidget *parent)
\internal
*/
FutureProgress::FutureProgress(QWidget *parent) :
diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
index 84ca73cc306..ef4458969f3 100644
--- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp
+++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
@@ -63,13 +63,14 @@ using namespace Core::Internal;
using namespace Utils;
/*!
- \mainclass
+ \ingroup mainclasses
+ \inmodule QtCreator
\class Core::ProgressManager
\brief The ProgressManager class is used to show a user interface
for running tasks in Qt Creator.
- It tracks the progress of a task that it is told
- about, and shows a progress indicator in the lower right
+ The progress manager tracks the progress of a task that it is told
+ about, and shows a progress indicator in the lower right corner
of Qt Creator's main window to the user.
The progress indicator also allows the user to cancel the task.
@@ -88,7 +89,7 @@ using namespace Utils;
\row
\li Task abstraction
\li \c QFuture<void>
- \li A \c QFuture object that represents the task which is
+ \li A \l QFuture object that represents the task which is
responsible for reporting the state of the task. See below
for coding patterns how to create this object for your
specific task.
@@ -132,7 +133,7 @@ using namespace Utils;
ProgressManager in the addTask() function.
Have a look at e.g Core::ILocatorFilter. Locator filters implement
- a function \c refresh which takes a \c QFutureInterface object
+ a function \c refresh() which takes a \c QFutureInterface object
as a parameter. These functions look something like:
\code
void Filter::refresh(QFutureInterface<void> &future) {
@@ -209,50 +210,6 @@ using namespace Utils;
*/
/*!
- \fn Core::ProgressManager::ProgressManager(QObject *parent = 0)
- \internal
-*/
-
-/*!
- \fn Core::ProgressManager::~ProgressManager()
- \internal
-*/
-
-/*!
- \fn FutureProgress *Core::ProgressManager::addTask(const QFuture<void> &future, const QString &title, const QString &type, ProgressFlags flags = 0)
-
- Shows a progress indicator for task given by the QFuture object \a future.
- The progress indicator shows the specified \a title along with the progress bar.
- The \a type of a task will specify a logical grouping with other
- running tasks. Via the \a flags parameter you can e.g. let the
- progress indicator stay visible after the task has finished.
- Returns an object that represents the created progress indicator,
- which can be used to further customize. The FutureProgress object's
- life is managed by the ProgressManager and is guaranteed to live only until
- the next event loop cycle, or until the next call of addTask.
- If you want to use the returned FutureProgress later than directly after calling this function,
- you will need to use protective functions (like wrapping the returned object in QPointer and
- checking for 0 whenever you use it).
-*/
-
-/*!
- \fn void Core::ProgressManager::setApplicationLabel(const QString &text)
-
- Shows the given \a text in a platform dependent way in the application
- icon in the system's task bar or dock. This is used
- to show the number of build errors on Windows 7 and Mac OS X.
-*/
-
-/*!
- \fn void Core::ProgressManager::cancelTasks(Core::Id type)
-
- Schedules a cancel for all running tasks of the given \a type.
- Please note that the cancel functionality depends on the
- running task to actually check the \c QFutureInterface::isCanceled
- property.
-*/
-
-/*!
\fn void Core::ProgressManager::taskStarted(Core::Id type)
Sent whenever a task of a given \a type is started.
@@ -708,27 +665,59 @@ void ProgressManagerPrivate::progressDetailsToggled(bool checked)
settings->endGroup();
}
+/*!
+ \internal
+*/
ProgressManager::ProgressManager() = default;
+/*!
+ \internal
+*/
ProgressManager::~ProgressManager() = default;
+/*!
+ Returns a single progress manager instance.
+*/
ProgressManager *ProgressManager::instance()
{
return m_instance;
}
+/*!
+ Shows a progress indicator for the task given by the QFuture object
+ \a future.
+
+ The progress indicator shows the specified \a title along with the progress
+ bar. The \a type of a task will specify a logical grouping with other
+ running tasks. Via the \a flags parameter you can e.g. let the progress
+ indicator stay visible after the task has finished.
+
+ Returns an object that represents the created progress indicator, which
+ can be used to further customize. The FutureProgress object's life is
+ managed by the ProgressManager and is guaranteed to live only until
+ the next event loop cycle, or until the next call of addTask.
+
+ If you want to use the returned FutureProgress later than directly after
+ calling this function, you will need to use protective functions (like
+ wrapping the returned object in QPointer and checking for 0 whenever you
+ use it).
+*/
FutureProgress *ProgressManager::addTask(const QFuture<void> &future, const QString &title, Id type, ProgressFlags flags)
{
return m_instance->doAddTask(future, title, type, flags);
}
/*!
- Shows a progress indicator for task given by the QFuture given by
- the QFutureInterface \a futureInterface.
+ Shows a progress indicator for task given by the QFutureInterface object
+ \a futureInterface.
The progress indicator shows the specified \a title along with the progress bar.
The progress indicator will increase monotonically with time, at \a expectedSeconds
it will reach about 80%, and continue to increase with a decreasingly slower rate.
+ The \a type of a task will specify a logical grouping with other
+ running tasks. Via the \a flags parameter you can e.g. let the
+ progress indicator stay visible after the task has finished.
+
\sa addTask
*/
@@ -741,11 +730,22 @@ FutureProgress *ProgressManager::addTimedTask(const QFutureInterface<void> &futu
return fp;
}
+/*!
+ Shows the given \a text in a platform dependent way in the application
+ icon in the system's task bar or dock. This is used to show the number
+ of build errors on Windows 7 and \macos.
+*/
void ProgressManager::setApplicationLabel(const QString &text)
{
m_instance->doSetApplicationLabel(text);
}
+/*!
+ Schedules the cancellation of all running tasks of the given \a type.
+ The cancellation functionality depends on the running task actually
+ checking the \l QFuture::isCanceled property.
+*/
+
void ProgressManager::cancelTasks(Id type)
{
if (m_instance)
diff --git a/src/plugins/coreplugin/systemsettings.cpp b/src/plugins/coreplugin/systemsettings.cpp
index 3917db7f7fd..a0627359d83 100644
--- a/src/plugins/coreplugin/systemsettings.cpp
+++ b/src/plugins/coreplugin/systemsettings.cpp
@@ -52,7 +52,7 @@ namespace Internal {
class SystemSettingsWidget : public IOptionsPageWidget
{
- QT_DECLARE_DEPRECATED_TR_FUNCTIONS(Core::Internal::SystemSettingsWidget)
+ Q_DECLARE_TR_FUNCTIONS(Core::Internal::SystemSettingsWidget)
public:
SystemSettingsWidget()
diff --git a/src/plugins/coreplugin/versiondialog.cpp b/src/plugins/coreplugin/versiondialog.cpp
index b1ef2edb10c..3ef40cb8199 100644
--- a/src/plugins/coreplugin/versiondialog.cpp
+++ b/src/plugins/coreplugin/versiondialog.cpp
@@ -52,7 +52,6 @@ VersionDialog::VersionDialog(QWidget *parent)
setWindowIcon(Icons::QTCREATORLOGO_BIG.icon());
setWindowTitle(tr("About %1").arg(Core::Constants::IDE_DISPLAY_NAME));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
auto layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
diff --git a/src/plugins/cppeditor/cpppreprocessordialog.cpp b/src/plugins/cppeditor/cpppreprocessordialog.cpp
index b0edff0fc0f..03b01a05b27 100644
--- a/src/plugins/cppeditor/cpppreprocessordialog.cpp
+++ b/src/plugins/cppeditor/cpppreprocessordialog.cpp
@@ -39,8 +39,6 @@ CppPreProcessorDialog::CppPreProcessorDialog(const QString &filePath, QWidget *p
, m_ui(new Ui::CppPreProcessorDialog())
, m_filePath(filePath)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
m_ui->setupUi(this);
m_ui->editorLabel->setText(m_ui->editorLabel->text().arg(Utils::FilePath::fromString(m_filePath).fileName()));
m_ui->editWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index e836fba5905..a4523a6065f 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -971,8 +971,6 @@ void CppModelManager::recalculateProjectPartMappings()
void CppModelManager::watchForCanceledProjectIndexer(const QVector<QFuture<void>> &futures,
ProjectExplorer::Project *project)
{
- d->m_projectToIndexerCanceled.insert(project, false);
-
for (const QFuture<void> &future : futures) {
if (future.isCanceled() || future.isFinished())
continue;
@@ -983,7 +981,8 @@ void CppModelManager::watchForCanceledProjectIndexer(const QVector<QFuture<void>
d->m_projectToIndexerCanceled.insert(project, true);
watcher->deleteLater();
});
- connect(watcher, &QFutureWatcher<void>::finished, this, [watcher]() {
+ connect(watcher, &QFutureWatcher<void>::finished, this, [this, project, watcher]() {
+ d->m_projectToIndexerCanceled.remove(project);
watcher->deleteLater();
});
watcher->setFuture(future);
@@ -1114,6 +1113,9 @@ QFuture<void> CppModelManager::updateProjectInfo(QFutureInterface<void> &futureI
// Trigger reindexing
const QFuture<void> indexingFuture = updateSourceFiles(futureInterface, filesToReindex,
ForcedProgressNotification);
+ if (!filesToReindex.isEmpty()) {
+ d->m_projectToIndexerCanceled.insert(project, false);
+ }
watchForCanceledProjectIndexer({futureInterface.future(), indexingFuture}, project);
return indexingFuture;
}
diff --git a/src/plugins/cpptools/symbolsearcher_test.cpp b/src/plugins/cpptools/symbolsearcher_test.cpp
index 0e9f5a5804c..65228f39025 100644
--- a/src/plugins/cpptools/symbolsearcher_test.cpp
+++ b/src/plugins/cpptools/symbolsearcher_test.cpp
@@ -63,7 +63,7 @@ public:
static ResultDataList fromSearchResultList(const QList<Core::SearchResultItem> &entries)
{
ResultDataList result;
- foreach (const Core::SearchResultItem &entry, entries)
+ for (const Core::SearchResultItem &entry : entries)
result << ResultData(entry.text, entry.path.join(QLatin1String("::")));
return result;
}
@@ -72,9 +72,9 @@ public:
static void printFilterEntries(const ResultDataList &entries)
{
QTextStream out(stdout);
- foreach (const ResultData entry, entries) {
+ for (const ResultData &entry : entries) {
out << "<< ResultData(_(\"" << entry.m_symbolName << "\"), _(\""
- << entry.m_scope << "\"))" << endl;
+ << entry.m_scope << "\"))" << '\n';
}
}
diff --git a/src/plugins/cvs/cvseditor.cpp b/src/plugins/cvs/cvseditor.cpp
index 8e0b0bbb2ca..8cdcd1e2f0d 100644
--- a/src/plugins/cvs/cvseditor.cpp
+++ b/src/plugins/cvs/cvseditor.cpp
@@ -43,8 +43,8 @@ namespace Internal {
#define CVS_REVISION_AT_START_PATTERN "^(" CVS_REVISION_PATTERN ") "
CvsEditorWidget::CvsEditorWidget() :
- m_revisionAnnotationPattern(QLatin1String(CVS_REVISION_AT_START_PATTERN ".*$")),
- m_revisionLogPattern(QLatin1String("^revision *(" CVS_REVISION_PATTERN ")$"))
+ m_revisionAnnotationPattern(CVS_REVISION_AT_START_PATTERN),
+ m_revisionLogPattern("^revision *(" CVS_REVISION_PATTERN ")$")
{
QTC_ASSERT(m_revisionAnnotationPattern.isValid(), return);
QTC_ASSERT(m_revisionLogPattern.isValid(), return);
@@ -56,31 +56,10 @@ CvsEditorWidget::CvsEditorWidget() :
@@ -6,6 +6,5 @@
\endcode
*/
- setDiffFilePattern(QRegExp(QLatin1String("^[-+]{3} ([^\\t]+)")));
- setLogEntryPattern(QRegExp(QLatin1String("^revision (.+)$")));
+ setDiffFilePattern("^[-+]{3} ([^\\t]+)");
+ setLogEntryPattern("^revision (.+)$");
setAnnotateRevisionTextFormat(tr("Annotate revision \"%1\""));
-}
-
-QSet<QString> CvsEditorWidget::annotationChanges() const
-{
- QSet<QString> changes;
- const QString txt = toPlainText();
- if (txt.isEmpty())
- return changes;
- // Hunt for first change number in annotation: "1.1 (author)"
- QRegExp r(QLatin1String(CVS_REVISION_AT_START_PATTERN));
- QTC_ASSERT(r.isValid(), return changes);
- if (r.indexIn(txt) != -1) {
- changes.insert(r.cap(1));
- r.setPattern(QLatin1String("\n(" CVS_REVISION_PATTERN ") "));
- QTC_ASSERT(r.isValid(), return changes);
- int pos = 0;
- while ((pos = r.indexIn(txt, pos)) != -1) {
- pos += r.matchedLength();
- changes.insert(r.cap(1));
- }
- }
- return changes;
+ setAnnotationEntryPattern("^(" CVS_REVISION_PATTERN ") ");
}
QString CvsEditorWidget::changeUnderCursor(const QTextCursor &c) const
@@ -99,15 +78,19 @@ QString CvsEditorWidget::changeUnderCursor(const QTextCursor &c) const
const QTextBlock block = c.block();
if (c.atBlockStart() || (c.position() - block.position() < 3)) {
const QString line = block.text();
- if (m_revisionAnnotationPattern.exactMatch(line))
- return m_revisionAnnotationPattern.cap(1);
+ const QRegularExpressionMatch match = m_revisionAnnotationPattern.match(line);
+ if (match.hasMatch())
+ return match.captured(1);
}
}
break;
case VcsBase::LogOutput: {
const QTextBlock block = c.block();
- if (c.position() - block.position() > 8 && m_revisionLogPattern.exactMatch(block.text()))
- return m_revisionLogPattern.cap(1);
+ if (c.position() - block.position() > 8) {
+ const QRegularExpressionMatch match = m_revisionLogPattern.match(block.text());
+ if (match.hasMatch())
+ return match.captured(1);
+ }
}
break;
}
diff --git a/src/plugins/cvs/cvseditor.h b/src/plugins/cvs/cvseditor.h
index f7ce08fd0b0..b92ebeae325 100644
--- a/src/plugins/cvs/cvseditor.h
+++ b/src/plugins/cvs/cvseditor.h
@@ -27,7 +27,7 @@
#include <vcsbase/vcsbaseeditor.h>
-#include <QRegExp>
+#include <QRegularExpression>
namespace Cvs {
namespace Internal {
@@ -40,14 +40,13 @@ public:
CvsEditorWidget();
private:
- QSet<QString> annotationChanges() const override;
QString changeUnderCursor(const QTextCursor &) const override;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(
const QSet<QString> &changes) const override;
QStringList annotationPreviousVersions(const QString &revision) const override;
- mutable QRegExp m_revisionAnnotationPattern;
- mutable QRegExp m_revisionLogPattern;
+ const QRegularExpression m_revisionAnnotationPattern;
+ const QRegularExpression m_revisionLogPattern;
QString m_diffBaseDir;
};
diff --git a/src/plugins/debugger/analyzer/startremotedialog.cpp b/src/plugins/debugger/analyzer/startremotedialog.cpp
index 084ab82bee5..e34d0df38df 100644
--- a/src/plugins/debugger/analyzer/startremotedialog.cpp
+++ b/src/plugins/debugger/analyzer/startremotedialog.cpp
@@ -58,7 +58,6 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent)
: QDialog(parent)
, d(new Internal::StartRemoteDialogPrivate)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Remote Analysis"));
d->kitChooser = new KitChooser(this);
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index df2f62dd847..ae840e772c6 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -874,7 +874,6 @@ private:
MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned int enabledParts, QWidget *parent) :
QDialog(parent)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Edit Breakpoint Properties"));
m_lineEditCondition = new QLineEdit(this);
diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp
index 49ebc219e50..f47dc289370 100644
--- a/src/plugins/debugger/debuggeractions.cpp
+++ b/src/plugins/debugger/debuggeractions.cpp
@@ -498,12 +498,6 @@ DebuggerSettings::DebuggerSettings()
insertItem(IntelFlavor, item);
item = new SavedAction;
- item->setSettingsKey(debugModeGroup, "IdentifyDebugInfoPackages");
- item->setCheckable(true);
- item->setDefaultValue(false);
- insertItem(IdentifyDebugInfoPackages, item);
-
- item = new SavedAction;
item->setSettingsKey(debugModeGroup, "UseToolTips");
item->setText(tr("Use tooltips in main editor when debugging"));
item->setToolTip(tr("<p>Checking this will enable tooltips for variable "
diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h
index 05d9855b34d..61f5df39aa9 100644
--- a/src/plugins/debugger/debuggeractions.h
+++ b/src/plugins/debugger/debuggeractions.h
@@ -133,7 +133,6 @@ enum DebuggerActionCode
WarnOnReleaseBuilds,
MultiInferior,
IntelFlavor,
- IdentifyDebugInfoPackages,
// Stack
MaximalStackDepth,
diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h
index dcb36f0fb9c..03c2b16224d 100644
--- a/src/plugins/debugger/debuggercore.h
+++ b/src/plugins/debugger/debuggercore.h
@@ -80,7 +80,6 @@ void addHideColumnActions(QMenu *menu, QWidget *widget);
// Qt's various build paths for unpatched versions
QStringList qtBuildPaths();
-void addDebugInfoTask(unsigned id, const QString &cmd);
QWidget *addSearch(Utils::BaseTreeView *treeView);
} // namespace Internal
diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp
index 599d2382a9b..226026f99ca 100644
--- a/src/plugins/debugger/debuggerdialogs.cpp
+++ b/src/plugins/debugger/debuggerdialogs.cpp
@@ -49,6 +49,7 @@
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
+#include <QPlainTextEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QRegExp>
@@ -85,6 +86,10 @@ public:
PathChooser *debuginfoPathChooser;
QLabel *serverStartScriptLabel;
PathChooser *serverStartScriptPathChooser;
+ QLabel *serverInitCommandsLabel;
+ QPlainTextEdit *serverInitCommandsTextEdit;
+ QLabel *serverResetCommandsLabel;
+ QPlainTextEdit *serverResetCommandsTextEdit;
QComboBox *historyComboBox;
QDialogButtonBox *buttonBox;
};
@@ -121,6 +126,8 @@ public:
bool breakAtMain = false;
bool runInTerminal = false;
FilePath serverStartScript;
+ QString serverInitCommands;
+ QString serverResetCommands;
QString debugInfoLocation;
};
@@ -133,6 +140,8 @@ bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) c
&& breakAtMain == rhs.breakAtMain
&& runInTerminal == rhs.runInTerminal
&& serverStartScript == rhs.serverStartScript
+ && serverInitCommands == rhs.serverInitCommands
+ && serverResetCommands == rhs.serverResetCommands
&& kitId == rhs.kitId
&& debugInfoLocation == rhs.debugInfoLocation
&& serverAddress == rhs.serverAddress;
@@ -169,6 +178,8 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
settings->setValue("LastExternalBreakAtMain", breakAtMain);
settings->setValue("LastExternalRunInTerminal", runInTerminal);
settings->setValue("LastServerStartScript", serverStartScript.toVariant());
+ settings->setValue("LastServerInitCommands", serverInitCommands);
+ settings->setValue("LastServerResetCommands", serverResetCommands);
settings->setValue("LastDebugInfoLocation", debugInfoLocation);
}
@@ -183,6 +194,8 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
breakAtMain = settings->value("LastExternalBreakAtMain").toBool();
runInTerminal = settings->value("LastExternalRunInTerminal").toBool();
serverStartScript = FilePath::fromVariant(settings->value("LastServerStartScript"));
+ serverInitCommands = settings->value("LastServerInitCommands").toString();
+ serverResetCommands = settings->value("LastServerResetCommands").toString();
debugInfoLocation = settings->value("LastDebugInfoLocation").toString();
}
@@ -195,7 +208,6 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
StartApplicationDialog::StartApplicationDialog(QWidget *parent)
: QDialog(parent), d(new StartApplicationDialogPrivate)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Debugger"));
d->kitChooser = new KitChooser(this);
@@ -247,6 +259,22 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
d->serverStartScriptLabel->setBuddy(d->serverStartScriptPathChooser);
d->serverStartScriptLabel->setToolTip(d->serverStartScriptPathChooser->toolTip());
+ d->serverInitCommandsTextEdit = new QPlainTextEdit(this);
+ d->serverInitCommandsTextEdit->setToolTip(tr(
+ "This option can be used to send the target init commands."));
+
+ d->serverInitCommandsLabel = new QLabel(tr("&Init commands:"), this);
+ d->serverInitCommandsLabel->setBuddy(d->serverInitCommandsTextEdit);
+ d->serverInitCommandsLabel->setToolTip(d->serverInitCommandsTextEdit->toolTip());
+
+ d->serverResetCommandsTextEdit = new QPlainTextEdit(this);
+ d->serverResetCommandsTextEdit->setToolTip(tr(
+ "This option can be used to send the target reset commands."));
+
+ d->serverResetCommandsLabel = new QLabel(tr("&Reset commands:"), this);
+ d->serverResetCommandsLabel->setBuddy(d->serverResetCommandsTextEdit);
+ d->serverResetCommandsLabel->setToolTip(d->serverResetCommandsTextEdit->toolTip());
+
d->debuginfoPathChooser = new PathChooser(this);
d->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information"));
d->debuginfoPathChooser->setToolTip(tr(
@@ -278,6 +306,8 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
formLayout->addRow(tr("Run in &terminal:"), d->runInTerminalCheckBox);
formLayout->addRow(tr("Break at \"&main\":"), d->breakAtMainCheckBox);
formLayout->addRow(d->serverStartScriptLabel, d->serverStartScriptPathChooser);
+ formLayout->addRow(d->serverInitCommandsLabel, d->serverInitCommandsTextEdit);
+ formLayout->addRow(d->serverResetCommandsLabel, d->serverResetCommandsTextEdit);
formLayout->addRow(tr("Debug &information:"), d->debuginfoPathChooser);
formLayout->addRow(d->channelOverrideHintLabel);
formLayout->addRow(d->channelOverrideLabel, d->channelOverrideEdit);
@@ -366,6 +396,10 @@ void StartApplicationDialog::run(bool attachRemote)
if (!attachRemote) {
dialog.d->serverStartScriptPathChooser->setVisible(false);
dialog.d->serverStartScriptLabel->setVisible(false);
+ dialog.d->serverInitCommandsTextEdit->setVisible(false);
+ dialog.d->serverInitCommandsLabel->setVisible(false);
+ dialog.d->serverResetCommandsTextEdit->setVisible(false);
+ dialog.d->serverResetCommandsLabel->setVisible(false);
dialog.d->serverPortSpinBox->setVisible(false);
dialog.d->serverPortLabel->setVisible(false);
dialog.d->channelOverrideHintLabel->setVisible(false);
@@ -408,6 +442,8 @@ void StartApplicationDialog::run(bool attachRemote)
debugger->setDebugInfoLocation(newParameters.debugInfoLocation);
debugger->setInferior(inferior);
debugger->setServerStartScript(newParameters.serverStartScript); // Note: This requires inferior.
+ debugger->setCommandsAfterConnect(newParameters.serverInitCommands);
+ debugger->setCommandsForReset(newParameters.serverResetCommands);
debugger->setUseTerminal(newParameters.runInTerminal);
bool isLocal = !dev || (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
@@ -445,6 +481,8 @@ StartApplicationParameters StartApplicationDialog::parameters() const
result.serverAddress = d->channelOverrideEdit->text();
result.runnable.executable = d->localExecutablePathChooser->fileName();
result.serverStartScript = d->serverStartScriptPathChooser->fileName();
+ result.serverInitCommands = d->serverInitCommandsTextEdit->toPlainText();
+ result.serverResetCommands = d->serverResetCommandsTextEdit->toPlainText();
result.kitId = d->kitChooser->currentKitId();
result.debugInfoLocation = d->debuginfoPathChooser->path();
result.runnable.commandLineArguments = d->arguments->text();
@@ -461,6 +499,8 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p)
d->channelOverrideEdit->setText(p.serverAddress);
d->localExecutablePathChooser->setFileName(p.runnable.executable);
d->serverStartScriptPathChooser->setFileName(p.serverStartScript);
+ d->serverInitCommandsTextEdit->setPlainText(p.serverInitCommands);
+ d->serverResetCommandsTextEdit->setPlainText(p.serverResetCommands);
d->debuginfoPathChooser->setPath(p.debugInfoLocation);
d->arguments->setText(p.runnable.commandLineArguments);
d->workingDirectory->setPath(p.runnable.workingDirectory);
@@ -486,7 +526,6 @@ AttachToQmlPortDialog::AttachToQmlPortDialog(QWidget *parent)
: QDialog(parent),
d(new AttachToQmlPortDialogPrivate)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Debugger"));
d->kitChooser = new KitChooser(this);
@@ -570,7 +609,6 @@ StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) :
QDialog(parent), m_lineEdit(new QLineEdit)
{
setWindowTitle(tr("Start a CDB Remote Session"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
auto groupBox = new QGroupBox;
@@ -642,7 +680,6 @@ AddressDialog::AddressDialog(QWidget *parent) :
m_box(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel))
{
setWindowTitle(tr("Select Start Address"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
auto hLayout = new QHBoxLayout;
hLayout->addWidget(new QLabel(tr("Enter an address:") + ' '));
@@ -720,7 +757,6 @@ public:
StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent)
: QDialog(parent), d(new StartRemoteEngineDialogPrivate)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start Remote Engine"));
d->host = new FancyLineEdit(this);
@@ -874,7 +910,6 @@ TypeFormatsDialog::TypeFormatsDialog(QWidget *parent)
: QDialog(parent), m_ui(new TypeFormatsDialogUi(this))
{
setWindowTitle(tr("Type Formats"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->addPage(tr("Qt Types"));
m_ui->addPage(tr("Standard Types"));
m_ui->addPage(tr("Misc Types"));
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 69573db219a..a1c2aad6aba 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -2138,6 +2138,10 @@ void DebuggerEngine::createSnapshot()
void DebuggerEngine::updateLocals()
{
+ // if the engine is not running - do nothing
+ if (state() == DebuggerState::DebuggerFinished || state() == DebuggerState::DebuggerNotReady)
+ return;
+
watchHandler()->resetValueCache();
doUpdateLocals(UpdateParameters());
}
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 0d8a61695c0..bc7df160af9 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -392,9 +392,8 @@ public:
void handleReverseDirection(bool);
// Convenience
- Q_SLOT virtual void showMessage(const QString &msg, int channel = LogDebug,
- int timeout = -1) const;
- Q_SLOT void showStatusMessage(const QString &msg, int timeout = -1) const;
+ void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1) const;
+ void showStatusMessage(const QString &msg, int timeout = -1) const;
virtual void resetLocation();
virtual void gotoLocation(const Internal::Location &location);
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index bb84ac2a853..5fdf0015e1b 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -585,43 +585,6 @@ static Kit *findUniversalCdbKit()
///////////////////////////////////////////////////////////////////////
//
-// Debuginfo Taskhandler
-//
-///////////////////////////////////////////////////////////////////////
-
-class DebugInfoTaskHandler : public ITaskHandler
-{
-public:
- bool canHandle(const Task &task) const final
- {
- return m_debugInfoTasks.contains(task.taskId);
- }
-
- void handle(const Task &task) final
- {
- QString cmd = m_debugInfoTasks.value(task.taskId);
- QProcess::startDetached(cmd);
- }
-
- void addTask(unsigned id, const QString &cmd)
- {
- m_debugInfoTasks[id] = cmd;
- }
-
- QAction *createAction(QObject *parent) const final
- {
- QAction *action = new QAction(DebuggerPlugin::tr("Install &Debug Information"), parent);
- action->setToolTip(DebuggerPlugin::tr("Tries to install missing debug information."));
- return action;
- }
-
-private:
- QHash<unsigned, QString> m_debugInfoTasks;
-};
-
-
-///////////////////////////////////////////////////////////////////////
-//
// DebuggerPluginPrivate
//
///////////////////////////////////////////////////////////////////////
@@ -677,7 +640,7 @@ public:
}
QInputDialog dialog; // Create wide input dialog.
dialog.setWindowFlags(dialog.windowFlags()
- & ~(Qt::WindowContextHelpButtonHint|Qt::MSWindowsFixedSizeDialogHint));
+ & ~(Qt::MSWindowsFixedSizeDialogHint));
dialog.resize(600, dialog.height());
dialog.setWindowTitle(tr("Add Message Tracepoint"));
dialog.setLabelText (tr("Message:"));
@@ -765,7 +728,6 @@ public:
QList<IOptionsPage *> m_optionPages;
IContext m_debugModeContext;
- DebugInfoTaskHandler m_debugInfoTaskHandler;
Perspective m_perspective{Constants::PRESET_PERSPECTIVE_ID, tr("Debugger")};
DebuggerKitAspect debuggerKitAspect;
@@ -2048,11 +2010,6 @@ void DebuggerPluginPrivate::remoteCommand(const QStringList &options)
runScheduled();
}
-void addDebugInfoTask(unsigned id, const QString &cmd)
-{
- dd->m_debugInfoTaskHandler.addTask(id, cmd);
-}
-
void DebuggerPluginPrivate::extensionsInitialized()
{
// If the CppEditor or QmlJS editor plugin is there, we want to add something to
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 8d87cfde054..9c67a651a60 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -356,24 +356,6 @@ void GdbEngine::handleResponse(const QString &buff)
break;
}
- if (boolSetting(IdentifyDebugInfoPackages)) {
- // From SuSE's gdb: >&"Missing separate debuginfo for ...\n"
- // ">&"Try: zypper install -C \"debuginfo(build-id)=c084ee5876ed1ac12730181c9f07c3e027d8e943\"\n"
- if (data.startsWith("Missing separate debuginfo for ")) {
- m_lastMissingDebugInfo = data.mid(32);
- } else if (data.startsWith("Try: zypper")) {
- QString cmd = data.mid(4);
-
- Task task(Task::Warning,
- tr("Missing debug information for %1\nTry: %2")
- .arg(m_lastMissingDebugInfo).arg(cmd),
- FilePath(), 0, Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
-
- TaskHub::addTask(task);
- Internal::addDebugInfoTask(task.taskId, cmd);
- }
- }
-
break;
}
@@ -3302,6 +3284,10 @@ void GdbEngine::handlePeripheralRegisterListValues(
void GdbEngine::reloadLocals()
{
+ // if the engine is not running - do nothing
+ if (state() == DebuggerState::DebuggerFinished || state() == DebuggerState::DebuggerNotReady)
+ return;
+
setTokenBarrier();
updateLocals();
}
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index 0f8495ddda8..76ca8ea1d93 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -366,7 +366,6 @@ private: ////////// General Interface //////////
// HACK:
QString m_currentThread;
QString m_lastWinException;
- QString m_lastMissingDebugInfo;
bool m_expectTerminalTrap = false;
bool usesExecInterrupt() const;
bool usesTargetAsync() const;
diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp
index 2fd3c8de87f..ff4b503e2fb 100644
--- a/src/plugins/debugger/gdb/gdboptionspage.cpp
+++ b/src/plugins/debugger/gdb/gdboptionspage.cpp
@@ -153,14 +153,6 @@ GdbOptionsPageWidget::GdbOptionsPageWidget()
"<html><head/><body>GDB shows by default AT&&T style disassembly."
"</body></html>"));
- auto checkBoxIdentifyDebugInfoPackages = new QCheckBox(groupBoxGeneral);
- checkBoxIdentifyDebugInfoPackages->setText(GdbOptionsPage::tr("Create tasks from missing packages"));
- checkBoxIdentifyDebugInfoPackages->setToolTip(GdbOptionsPage::tr(
- "<html><head/><body><p>Attempts to identify missing debug info packages "
- "and lists them in the Issues output pane.</p><p>"
- "<b>Note:</b> This feature needs special support from the Linux "
- "distribution and GDB build and is not available everywhere.</p></body></html>"));
-
QString howToUsePython = GdbOptionsPage::tr(
"<p>To execute simple Python commands, prefix them with \"python\".</p>"
"<p>To execute sequences of Python commands spanning multiple lines "
@@ -233,7 +225,6 @@ GdbOptionsPageWidget::GdbOptionsPageWidget()
formLayout->addRow(checkBoxLoadGdbInit);
formLayout->addRow(checkBoxLoadGdbDumpers);
formLayout->addRow(checkBoxIntelFlavor);
- formLayout->addRow(checkBoxIdentifyDebugInfoPackages);
auto startLayout = new QGridLayout(groupBoxStartupCommands);
startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);
@@ -255,7 +246,6 @@ GdbOptionsPageWidget::GdbOptionsPageWidget()
group.insert(action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations);
group.insert(action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout);
group.insert(action(IntelFlavor), checkBoxIntelFlavor);
- group.insert(action(IdentifyDebugInfoPackages), checkBoxIdentifyDebugInfoPackages);
group.insert(action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals);
group.insert(action(SkipKnownFrames), checkBoxSkipKnownFrames);
diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp
index e2646146110..d4af42714d2 100644
--- a/src/plugins/debugger/loadcoredialog.cpp
+++ b/src/plugins/debugger/loadcoredialog.cpp
@@ -251,7 +251,6 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
: QDialog(parent), d(new AttachCoreDialogPrivate)
{
setWindowTitle(tr("Load Core File"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
d->buttonBox = new QDialogButtonBox(this);
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
index 0c86728f214..0bd667f4576 100644
--- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
+++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
@@ -51,7 +51,6 @@ CacheDirectoryDialog::CacheDirectoryDialog(QWidget *parent) :
{
setWindowTitle(tr("Select Local Cache Folder"));
setModal(true);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
auto formLayout = new QFormLayout;
m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp
index 7f20afaeef3..51d27228d18 100644
--- a/src/plugins/debugger/stackhandler.cpp
+++ b/src/plugins/debugger/stackhandler.cpp
@@ -337,7 +337,6 @@ static StackFrame inputFunctionForDisassembly()
dialog.setInputMode(QInputDialog::TextInput);
dialog.setLabelText(StackHandler::tr("Function:"));
dialog.setWindowTitle(StackHandler::tr("Disassemble Function"));
- dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
if (dialog.exec() != QDialog::Accepted)
return frame;
const QString function = dialog.textValue();
diff --git a/src/plugins/debugger/unstartedappwatcherdialog.cpp b/src/plugins/debugger/unstartedappwatcherdialog.cpp
index 423bcf46995..c27ff5f72ef 100644
--- a/src/plugins/debugger/unstartedappwatcherdialog.cpp
+++ b/src/plugins/debugger/unstartedappwatcherdialog.cpp
@@ -87,7 +87,6 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(tr("Attach to Process Not Yet Started"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_kitChooser = new KitChooser(this);
m_kitChooser->setKitPredicate([](const Kit *k) {
diff --git a/src/plugins/debugger/uvsc/uvscclient.cpp b/src/plugins/debugger/uvsc/uvscclient.cpp
index b7bb035c524..57de522689a 100644
--- a/src/plugins/debugger/uvsc/uvscclient.cpp
+++ b/src/plugins/debugger/uvsc/uvscclient.cpp
@@ -321,7 +321,7 @@ bool UvscClient::fetchThreads(bool showNames, GdbMi &data)
return false;
std::vector<TASKENUM> taskenums(kMaximumTaskEnumsCount);
- qint32 taskenumsCount = taskenums.size();
+ qint32 taskenumsCount = qint32(taskenums.size());
const UVSC_STATUS st = ::UVSC_DBG_ENUM_TASKS(m_descriptor, taskenums.data(),
&taskenumsCount);
if (st != UVSC_STATUS_SUCCESS) {
@@ -432,7 +432,7 @@ bool UvscClient::fetchRegisters(Registers &registers)
// Enumerate the register groups names.
std::vector<SSTR> sstrs(kMaximumRegisterGroupsCount);
- qint32 sstrsCount = sstrs.size();
+ qint32 sstrsCount = qint32(sstrs.size());
UVSC_STATUS st = ::UVSC_DBG_ENUM_REGISTER_GROUPS(m_descriptor, sstrs.data(),
&sstrsCount);
if (st != UVSC_STATUS_SUCCESS) {
@@ -449,7 +449,7 @@ bool UvscClient::fetchRegisters(Registers &registers)
// Enumerate the registers.
std::vector<REGENUM> regenums(kMaximumRegisterEnumsCount);
- qint32 regenumsCount = regenums.size();
+ qint32 regenumsCount = qint32(regenums.size());
st = ::UVSC_DBG_ENUM_REGISTERS(m_descriptor, regenums.data(), &regenumsCount);
if (st != UVSC_STATUS_SUCCESS) {
setError(RuntimeError);
@@ -471,7 +471,7 @@ bool UvscClient::fetchRegisters(Registers &registers)
// Read the register values.
std::vector<qint8> values(kMaximumRegisterEnumsCount * kMaximumValueBitsSize);
- qint32 length = values.size();
+ qint32 length = qint32(values.size());
st = ::UVSC_DBG_READ_REGISTERS( m_descriptor, values.data(), &length);
if (st != UVSC_STATUS_SUCCESS) {
setError(RuntimeError);
@@ -529,7 +529,7 @@ bool UvscClient::inspectLocal(const QStringList &expandedLocalINames,
ivarenum.frame = frameId;
ivarenum.count = kMaximumVarinfosCount / 2;
std::vector<VARINFO> varinfos(kMaximumVarinfosCount);
- qint32 varinfosCount = varinfos.size();
+ qint32 varinfosCount = qint32(varinfos.size());
const UVSC_STATUS st = ::UVSC_DBG_ENUM_VARIABLES(m_descriptor, &ivarenum,
varinfos.data(), &varinfosCount);
if (st != UVSC_STATUS_SUCCESS) {
@@ -647,7 +647,7 @@ bool UvscClient::inspectWatcher(const QStringList &expandedWatcherINames,
ivarenum.id = watcherId;
ivarenum.count = kMaximumVarinfosCount / 2;
std::vector<VARINFO> varinfos(kMaximumVarinfosCount);
- qint32 varinfosCount = varinfos.size();
+ qint32 varinfosCount = qint32(varinfos.size());
const UVSC_STATUS st = ::UVSC_DBG_ENUM_VARIABLES(m_descriptor, &ivarenum,
varinfos.data(), &varinfosCount);
if (st != UVSC_STATUS_SUCCESS) {
@@ -1027,7 +1027,7 @@ bool UvscClient::enumerateStack(quint32 taskId, std::vector<STACKENUM> &stackenu
istkenum.isFull = true;
istkenum.hasExtended = true;
stackenums.resize(kMaximumStackEnumsCount);
- qint32 stackenumsCount = stackenums.size();
+ qint32 stackenumsCount = qint32(stackenums.size());
const UVSC_STATUS st = ::UVSC_DBG_ENUM_STACK(m_descriptor, &istkenum,
stackenums.data(), &stackenumsCount);
if (st != UVSC_STATUS_SUCCESS)
diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp
index 0751a46e7ca..3cac8265f18 100644
--- a/src/plugins/git/branchview.cpp
+++ b/src/plugins/git/branchview.cpp
@@ -223,8 +223,9 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
});
contextMenu.addSeparator();
}
- QAction *act = contextMenu.addAction(tr("Manage &Remotes..."));
- connect(act, &QAction::triggered, [this] { GitPlugin::manageRemotes(); });
+ contextMenu.addAction(tr("Manage &Remotes..."), this, [] {
+ GitPlugin::manageRemotes();
+ });
}
if (hasActions) {
if (!currentSelected && (isLocal || isTag))
@@ -240,6 +241,7 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
GitPlugin::client()->diffBranch(m_repository, fullName);
});
contextMenu.addAction(tr("&Log"), this, [this] { log(selectedIndex()); });
+ contextMenu.addAction(tr("Reflo&g"), this, [this] { reflog(selectedIndex()); });
contextMenu.addSeparator();
if (!currentSelected) {
auto resetMenu = new QMenu(tr("Re&set"), &contextMenu);
@@ -559,6 +561,13 @@ void BranchView::log(const QModelIndex &idx)
GitPlugin::client()->log(m_repository, QString(), false, {branchName});
}
+void BranchView::reflog(const QModelIndex &idx)
+{
+ const QString branchName = m_model->fullName(idx, true);
+ if (!branchName.isEmpty())
+ GitPlugin::client()->reflog(m_repository, branchName);
+}
+
void BranchView::push()
{
const QModelIndex selected = selectedIndex();
diff --git a/src/plugins/git/branchview.h b/src/plugins/git/branchview.h
index 9e4dfc0fd75..faceea2ef57 100644
--- a/src/plugins/git/branchview.h
+++ b/src/plugins/git/branchview.h
@@ -83,6 +83,7 @@ private:
void rebase();
bool cherryPick();
void log(const QModelIndex &idx);
+ void reflog(const QModelIndex &idx);
void push();
QToolButton *m_addButton = nullptr;
diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp
index 47a55be5c56..c1cc46ce984 100644
--- a/src/plugins/git/changeselectiondialog.cpp
+++ b/src/plugins/git/changeselectiondialog.cpp
@@ -57,7 +57,6 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co
QWidget *parent) :
QDialog(parent), m_ui(new Ui::ChangeSelectionDialog)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_gitExecutable = GitPlugin::client()->vcsBinary();
m_ui->setupUi(this);
m_ui->workingDirectoryChooser->setExpectedKind(PathChooser::ExistingDirectory);
diff --git a/src/plugins/git/gerrit/gerritdialog.cpp b/src/plugins/git/gerrit/gerritdialog.cpp
index 402c29763a1..875ca8b44fe 100644
--- a/src/plugins/git/gerrit/gerritdialog.cpp
+++ b/src/plugins/git/gerrit/gerritdialog.cpp
@@ -63,8 +63,6 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
, m_model(new GerritModel(p, this))
, m_queryModel(new QStringListModel(this))
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
m_ui->setupUi(this);
m_ui->remoteComboBox->setParameters(m_parameters);
m_ui->remoteComboBox->setFallbackEnabled(true);
diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp
index 9a251b5eda1..08c280fc90f 100644
--- a/src/plugins/git/gerrit/gerritpushdialog.cpp
+++ b/src/plugins/git/gerrit/gerritpushdialog.cpp
@@ -128,7 +128,6 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
m_workingDir(workingDir),
m_ui(new Ui::GerritPushDialog)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
m_ui->repositoryLabel->setText(QDir::toNativeSeparators(workingDir));
m_ui->remoteComboBox->setRepository(workingDir);
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 7ba46935dba..005e0e66f86 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -560,14 +560,15 @@ public:
}
};
-class GitLogArgumentsWidget : public BaseGitDiffArgumentsWidget
+class BaseGitLogArgumentsWidget : public BaseGitDiffArgumentsWidget
{
Q_OBJECT
public:
- GitLogArgumentsWidget(VcsBaseClientSettings &settings, bool fileRelated, QToolBar *toolBar) :
- BaseGitDiffArgumentsWidget(settings, toolBar)
+ BaseGitLogArgumentsWidget(VcsBaseClientSettings &settings, GitEditorWidget *editor) :
+ BaseGitDiffArgumentsWidget(settings, editor->toolBar())
{
+ QToolBar *toolBar = editor->toolBar();
QAction *diffButton = addToggleButton("--patch", tr("Diff"),
tr("Show difference."));
mapSetting(diffButton, settings.boolPointer(GitSettings::logDiffKey));
@@ -575,6 +576,22 @@ public:
connect(diffButton, &QAction::toggled, m_ignoreWSButton, &QAction::setVisible);
m_patienceButton->setVisible(diffButton->isChecked());
m_ignoreWSButton->setVisible(diffButton->isChecked());
+ auto filterAction = new QAction(tr("Filter"), toolBar);
+ filterAction->setToolTip(tr("Filter commits by message or content."));
+ filterAction->setCheckable(true);
+ connect(filterAction, &QAction::toggled, editor, &GitEditorWidget::toggleFilters);
+ toolBar->addAction(filterAction);
+ }
+};
+
+class GitLogArgumentsWidget : public BaseGitLogArgumentsWidget
+{
+ Q_OBJECT
+
+public:
+ GitLogArgumentsWidget(VcsBaseClientSettings &settings, bool fileRelated, GitEditorWidget *editor) :
+ BaseGitLogArgumentsWidget(settings, editor)
+ {
QAction *firstParentButton =
addToggleButton({"-m", "--first-parent"},
tr("First Parent"),
@@ -599,6 +616,24 @@ public:
}
};
+class GitRefLogArgumentsWidget : public BaseGitLogArgumentsWidget
+{
+ Q_OBJECT
+
+public:
+ GitRefLogArgumentsWidget(VcsBaseClientSettings &settings, GitEditorWidget *editor) :
+ BaseGitLogArgumentsWidget(settings, editor)
+ {
+ QAction *showDateButton =
+ addToggleButton("--date=iso",
+ tr("Show Date"),
+ tr("Show date instead of sequence"));
+ mapSetting(showDateButton, settings.boolPointer(GitSettings::refLogShowDateKey));
+
+ addReloadButton();
+ }
+};
+
class ConflictHandler final : public QObject
{
Q_OBJECT
@@ -1004,7 +1039,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
codecFor(CodecLogOutput), "logTitle", msgArg));
VcsBaseEditorConfig *argWidget = editor->editorConfig();
if (!argWidget) {
- argWidget = new GitLogArgumentsWidget(settings(), !fileName.isEmpty(), editor->toolBar());
+ argWidget = new GitLogArgumentsWidget(settings(), !fileName.isEmpty(), editor);
argWidget->setBaseArguments(args);
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
@@ -1027,26 +1062,42 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
if (!pickaxeValue.isEmpty())
arguments << "-S" << pickaxeValue;
+ if ((!grepValue.isEmpty() || !pickaxeValue.isEmpty()) && !editor->caseSensitive())
+ arguments << "-i";
+
if (!fileName.isEmpty())
arguments << "--" << fileName;
vcsExec(workingDir, arguments, editor);
}
-void GitClient::reflog(const QString &workingDirectory)
+void GitClient::reflog(const QString &workingDirectory, const QString &ref)
{
const QString title = tr("Git Reflog \"%1\"").arg(workingDirectory);
- const Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
- VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, workingDirectory, codecFor(CodecLogOutput),
- "reflogRepository", workingDirectory);
- editor->setWorkingDirectory(workingDirectory);
+ const Id editorId = Git::Constants::GIT_REFLOG_EDITOR_ID;
+ // Creating document might change the referenced workingDirectory. Store a copy and use it.
+ const QString workingDir = workingDirectory;
+ GitEditorWidget *editor = static_cast<GitEditorWidget *>(
+ createVcsEditor(editorId, title, workingDir, codecFor(CodecLogOutput),
+ "reflogRepository", workingDir));
+ VcsBaseEditorConfig *argWidget = editor->editorConfig();
+ if (!argWidget) {
+ argWidget = new GitRefLogArgumentsWidget(settings(), editor);
+ if (!ref.isEmpty())
+ argWidget->setBaseArguments({ref});
+ connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
+ [=] { this->reflog(workingDir, ref); });
+ editor->setEditorConfig(argWidget);
+ }
+ editor->setWorkingDirectory(workingDir);
QStringList arguments = {"reflog", noColorOption, decorateOption};
+ arguments << argWidget->arguments();
int logCount = settings().intValue(GitSettings::logCountKey);
if (logCount > 0)
arguments << "-n" << QString::number(logCount);
- vcsExec(workingDirectory, arguments, editor);
+ vcsExec(workingDir, arguments, editor);
}
// Do not show "0000" or "^32ae4"
@@ -3076,7 +3127,7 @@ void GitClient::subversionLog(const QString &workingDirectory)
// Create a command editor, no highlighting or interaction.
const QString title = tr("Git SVN Log");
- const Id editorId = Git::Constants::GIT_COMMAND_LOG_EDITOR_ID;
+ const Id editorId = Git::Constants::GIT_SVN_LOG_EDITOR_ID;
const QString sourceFile = VcsBaseEditor::getSource(workingDirectory, QStringList());
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile, codecFor(CodecNone),
"svnLog", sourceFile);
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index f605bca767d..447238888aa 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -167,7 +167,7 @@ public:
void status(const QString &workingDirectory);
void log(const QString &workingDirectory, const QString &fileName = QString(),
bool enableAnnotationContextMenu = false, const QStringList &args = QStringList());
- void reflog(const QString &workingDirectory);
+ void reflog(const QString &workingDirectory, const QString &branch = {});
VcsBase::VcsBaseEditorWidget *annotate(
const QString &workingDir, const QString &file, const QString &revision = QString(),
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
diff --git a/src/plugins/git/gitconstants.h b/src/plugins/git/gitconstants.h
index 9cb9ddada1f..38a8a104abe 100644
--- a/src/plugins/git/gitconstants.h
+++ b/src/plugins/git/gitconstants.h
@@ -32,10 +32,12 @@ namespace Constants {
const char GIT_PLUGIN[] = "GitPlugin";
-const char GIT_COMMAND_LOG_EDITOR_ID[] = "Git Command Log Editor";
-const char GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Command Log Editor");
-const char GIT_LOG_EDITOR_ID[] = "Git File Log Editor";
-const char GIT_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git File Log Editor");
+const char GIT_SVN_LOG_EDITOR_ID[] = "Git SVN Log Editor";
+const char GIT_SVN_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git SVN Log Editor");
+const char GIT_LOG_EDITOR_ID[] = "Git Log Editor";
+const char GIT_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Log Editor");
+const char GIT_REFLOG_EDITOR_ID[] = "Git Reflog Editor";
+const char GIT_REFLOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Reflog Editor");
const char GIT_BLAME_EDITOR_ID[] = "Git Annotation Editor";
const char GIT_BLAME_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Annotation Editor");
const char GIT_COMMIT_TEXT_EDITOR_ID[] = "Git Commit Editor";
diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp
index d9c29afebf4..47546d0df61 100644
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
@@ -42,17 +42,15 @@
#include <utils/qtcassert.h>
#include <utils/temporaryfile.h>
-#include <QMenu>
-
+#include <QDir>
#include <QFileInfo>
+#include <QHBoxLayout>
+#include <QMenu>
#include <QRegExp>
#include <QSet>
+#include <QTextBlock>
#include <QTextCodec>
-#include <QDir>
-
#include <QTextCursor>
-#include <QTextBlock>
-#include <QMessageBox>
#define CHANGE_PATTERN "[a-f0-9]{7,40}"
@@ -61,6 +59,54 @@ using namespace VcsBase;
namespace Git {
namespace Internal {
+class GitLogFilterWidget : public QToolBar
+{
+ Q_DECLARE_TR_FUNCTIONS(Git::Internal::GitLogFilterWidget);
+
+public:
+ GitLogFilterWidget(GitEditorWidget *editor)
+ {
+ auto addLineEdit = [this](const QString &placeholder,
+ const QString &tooltip,
+ GitEditorWidget *editor)
+ {
+ auto lineEdit = new Utils::FancyLineEdit;
+ lineEdit->setFiltering(true);
+ lineEdit->setToolTip(tooltip);
+ lineEdit->setPlaceholderText(placeholder);
+ lineEdit->setMaximumWidth(200);
+ connect(lineEdit, &QLineEdit::returnPressed,
+ editor, &GitEditorWidget::refresh);
+ connect(lineEdit, &Utils::FancyLineEdit::rightButtonClicked,
+ editor, &GitEditorWidget::refresh);
+ return lineEdit;
+ };
+ grepLineEdit = addLineEdit(tr("Filter by message"),
+ tr("Filter log entries by text in the commit message."),
+ editor);
+ pickaxeLineEdit = addLineEdit(tr("Filter by content"),
+ tr("Filter log entries by added or removed string."),
+ editor);
+ addWidget(new QLabel(tr("Filter:")));
+ addSeparator();
+ addWidget(grepLineEdit);
+ addSeparator();
+ addWidget(pickaxeLineEdit);
+ addSeparator();
+ caseAction = new QAction(tr("Case sensitive"), this);
+ caseAction->setCheckable(true);
+ caseAction->setChecked(true);
+ connect(caseAction, &QAction::toggled, editor, &GitEditorWidget::refresh);
+ addAction(caseAction);
+ hide();
+ connect(editor, &GitEditorWidget::toggleFilters, this, &QWidget::setVisible);
+ }
+
+ Utils::FancyLineEdit *grepLineEdit;
+ Utils::FancyLineEdit *pickaxeLineEdit;
+ QAction *caseAction;
+};
+
GitEditorWidget::GitEditorWidget() :
m_changeNumberPattern(CHANGE_PATTERN)
{
@@ -71,32 +117,11 @@ GitEditorWidget::GitEditorWidget() :
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
*/
- setDiffFilePattern(QRegExp("^(?:diff --git a/|index |[+-]{3} (?:/dev/null|[ab]/(.+$)))"));
- setLogEntryPattern(QRegExp("^commit ([0-9a-f]{8})[0-9a-f]{32}"));
+ setDiffFilePattern("^(?:diff --git a/|index |[+-]{3} (?:/dev/null|[ab]/(.+$)))");
+ setLogEntryPattern("^commit ([0-9a-f]{8})[0-9a-f]{32}");
setAnnotateRevisionTextFormat(tr("&Blame %1"));
setAnnotatePreviousRevisionTextFormat(tr("Blame &Parent Revision %1"));
-}
-
-QSet<QString> GitEditorWidget::annotationChanges() const
-{
- QSet<QString> changes;
- const QString txt = toPlainText();
- if (txt.isEmpty())
- return changes;
- // Hunt for first change number in annotation: "<change>:"
- QRegExp r("^(" CHANGE_PATTERN ") ");
- QTC_ASSERT(r.isValid(), return changes);
- if (r.indexIn(txt) != -1) {
- changes.insert(r.cap(1));
- r.setPattern("\n(" CHANGE_PATTERN ") ");
- QTC_ASSERT(r.isValid(), return changes);
- int pos = 0;
- while ((pos = r.indexIn(txt, pos)) != -1) {
- pos += r.matchedLength();
- changes.insert(r.cap(1));
- }
- }
- return changes;
+ setAnnotationEntryPattern("^(" CHANGE_PATTERN ") ");
}
QString GitEditorWidget::changeUnderCursor(const QTextCursor &c) const
@@ -381,44 +406,36 @@ QString GitEditorWidget::sourceWorkingDirectory() const
return path.toString();
}
-void GitEditorWidget::lineEditChanged()
+void GitEditorWidget::refresh()
{
if (VcsBaseEditorConfig *config = editorConfig())
config->handleArgumentsChanged();
}
-void GitEditorWidget::refreshOnLineEdit(Utils::FancyLineEdit *lineEdit)
-{
- connect(lineEdit, &QLineEdit::returnPressed,
- this, &GitEditorWidget::lineEditChanged);
- connect(lineEdit, &Utils::FancyLineEdit::rightButtonClicked,
- this, &GitEditorWidget::lineEditChanged);
-}
-
-void GitEditorWidget::setGrepLineEdit(Utils::FancyLineEdit *lineEdit)
-{
- m_grepLineEdit = lineEdit;
- refreshOnLineEdit(lineEdit);
-}
-
-void GitEditorWidget::setPickaxeLineEdit(Utils::FancyLineEdit *lineEdit)
+QWidget *GitEditorWidget::addFilterWidget()
{
- m_pickaxeLineEdit = lineEdit;
- refreshOnLineEdit(lineEdit);
+ if (!m_logFilterWidget)
+ m_logFilterWidget = new GitLogFilterWidget(this);
+ return m_logFilterWidget;
}
QString GitEditorWidget::grepValue() const
{
- if (!m_grepLineEdit)
+ if (!m_logFilterWidget)
return QString();
- return m_grepLineEdit->text();
+ return m_logFilterWidget->grepLineEdit->text();
}
QString GitEditorWidget::pickaxeValue() const
{
- if (!m_pickaxeLineEdit)
+ if (!m_logFilterWidget)
return QString();
- return m_pickaxeLineEdit->text();
+ return m_logFilterWidget->pickaxeLineEdit->text();
+}
+
+bool GitEditorWidget::caseSensitive() const
+{
+ return m_logFilterWidget && m_logFilterWidget->caseAction->isChecked();
}
} // namespace Internal
diff --git a/src/plugins/git/giteditor.h b/src/plugins/git/giteditor.h
index bc7df7fe9e6..18397d94975 100644
--- a/src/plugins/git/giteditor.h
+++ b/src/plugins/git/giteditor.h
@@ -34,6 +34,8 @@ namespace Utils { class FancyLineEdit; }
namespace Git {
namespace Internal {
+class GitLogFilterWidget;
+
class GitEditorWidget : public VcsBase::VcsBaseEditorWidget
{
Q_OBJECT
@@ -42,10 +44,15 @@ public:
GitEditorWidget();
void setPlainText(const QString &text) override;
- void setGrepLineEdit(Utils::FancyLineEdit *lineEdit);
+ QWidget *addFilterWidget();
void setPickaxeLineEdit(Utils::FancyLineEdit *lineEdit);
QString grepValue() const;
QString pickaxeValue() const;
+ bool caseSensitive() const;
+ void refresh();
+
+signals:
+ void toggleFilters(bool value);
private:
void applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert);
@@ -54,7 +61,6 @@ private:
void resetChange(const QByteArray &resetType);
void addDiffActions(QMenu *menu, const VcsBase::DiffChunk &chunk) override;
void aboutToOpen(const QString &fileName, const QString &realFileName) override;
- QSet<QString> annotationChanges() const override;
QString changeUnderCursor(const QTextCursor &) const override;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const override;
QString decorateVersion(const QString &revision) const override;
@@ -65,13 +71,10 @@ private:
bool supportChangeLinks() const override;
QString fileNameForLine(int line) const override;
QString sourceWorkingDirectory() const;
- void refreshOnLineEdit(Utils::FancyLineEdit *lineEdit);
- void lineEditChanged();
mutable QRegExp m_changeNumberPattern;
QString m_currentChange;
- Utils::FancyLineEdit *m_grepLineEdit = nullptr;
- Utils::FancyLineEdit *m_pickaxeLineEdit = nullptr;
+ GitLogFilterWidget *m_logFilterWidget = nullptr;
};
} // namespace Git
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index b04db69e94f..55f71643c42 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -60,7 +60,6 @@
#include <coreplugin/vcsmanager.h>
#include <aggregation/aggregate.h>
-#include <utils/fancylineedit.h>
#include <utils/parameteraction.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
@@ -85,7 +84,6 @@
#include <QAction>
#include <QApplication>
#include <QFileDialog>
-#include <QHBoxLayout>
#include <QMenu>
#include <QVBoxLayout>
@@ -129,32 +127,32 @@ private:
GitClient *m_client;
};
+class GitReflogEditorWidget : public GitEditorWidget
+{
+public:
+ GitReflogEditorWidget()
+ {
+ setLogEntryPattern("^([0-9a-f]{8,}) [^}]*\\}: .*$");
+ }
+
+ QString revisionSubject(const QTextBlock &inBlock) const override
+ {
+ const QString text = inBlock.text();
+ return text.mid(text.indexOf(' ') + 1);
+ }
+};
+
class GitLogEditorWidget : public QWidget
{
- Q_DECLARE_TR_FUNCTIONS(Git::Internal::GitLogEditorWidget);
public:
- GitLogEditorWidget()
+ GitLogEditorWidget(GitEditorWidget *gitEditor)
{
- auto gitEditor = new GitEditorWidget;
auto vlayout = new QVBoxLayout;
- auto hlayout = new QHBoxLayout;
vlayout->setSpacing(0);
vlayout->setContentsMargins(0, 0, 0, 0);
- auto grepLineEdit = addLineEdit(tr("Filter by message"),
- tr("Filter log entries by text in the commit message."));
- auto pickaxeLineEdit = addLineEdit(tr("Filter by content"),
- tr("Filter log entries by added or removed string."));
- hlayout->setSpacing(20);
- hlayout->setContentsMargins(0, 0, 0, 0);
- hlayout->addWidget(new QLabel(tr("Filter:")));
- hlayout->addWidget(grepLineEdit);
- hlayout->addWidget(pickaxeLineEdit);
- hlayout->addStretch();
- vlayout->addLayout(hlayout);
+ vlayout->addWidget(gitEditor->addFilterWidget());
vlayout->addWidget(gitEditor);
setLayout(vlayout);
- gitEditor->setGrepLineEdit(grepLineEdit);
- gitEditor->setPickaxeLineEdit(pickaxeLineEdit);
auto textAgg = Aggregation::Aggregate::parentAggregate(gitEditor);
auto agg = textAgg ? textAgg : new Aggregation::Aggregate;
@@ -162,17 +160,13 @@ public:
agg->add(gitEditor);
setFocusProxy(gitEditor);
}
+};
-private:
- FancyLineEdit *addLineEdit(const QString &placeholder, const QString &tooltip)
- {
- auto lineEdit = new FancyLineEdit;
- lineEdit->setFiltering(true);
- lineEdit->setToolTip(tooltip);
- lineEdit->setPlaceholderText(placeholder);
- lineEdit->setMaximumWidth(200);
- return lineEdit;
- }
+template<class Editor>
+class GitLogEditorWidgetT : public GitLogEditorWidget
+{
+public:
+ GitLogEditorWidgetT() : GitLogEditorWidget(new Editor) {}
};
const unsigned minimumRequiredVersion = 0x010900;
@@ -184,11 +178,11 @@ const VcsBaseSubmitEditorParameters submitParameters {
VcsBaseSubmitEditorParameters::DiffRows
};
-const VcsBaseEditorParameters commandLogEditorParameters {
+const VcsBaseEditorParameters svnLogEditorParameters {
OtherContent,
- Git::Constants::GIT_COMMAND_LOG_EDITOR_ID,
- Git::Constants::GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME,
- "text/vnd.qtcreator.git.commandlog"
+ Git::Constants::GIT_SVN_LOG_EDITOR_ID,
+ Git::Constants::GIT_SVN_LOG_EDITOR_DISPLAY_NAME,
+ "text/vnd.qtcreator.git.svnlog"
};
const VcsBaseEditorParameters logEditorParameters {
@@ -198,6 +192,13 @@ const VcsBaseEditorParameters logEditorParameters {
"text/vnd.qtcreator.git.log"
};
+const VcsBaseEditorParameters reflogEditorParameters {
+ LogOutput,
+ Git::Constants::GIT_REFLOG_EDITOR_ID,
+ Git::Constants::GIT_REFLOG_EDITOR_DISPLAY_NAME,
+ "text/vnd.qtcreator.git.reflog"
+};
+
const VcsBaseEditorParameters blameEditorParameters {
AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_ID,
@@ -278,6 +279,7 @@ public:
void blameFile();
void logProject();
void logRepository();
+ void reflogRepository();
void undoFileChanges(bool revertStaging);
void resetRepository();
void recoverDeletedFiles();
@@ -388,15 +390,21 @@ public:
GitGrep gitGrep{&m_gitClient};
- VcsEditorFactory commandLogEditorFactory {
- &commandLogEditorParameters,
+ VcsEditorFactory svnLogEditorFactory {
+ &svnLogEditorParameters,
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
};
VcsEditorFactory logEditorFactory {
&logEditorParameters,
- [] { return new GitLogEditorWidget; },
+ [] { return new GitLogEditorWidgetT<GitEditorWidget>; },
+ std::bind(&GitPluginPrivate::describe, this, _1, _2)
+ };
+
+ VcsEditorFactory reflogEditorFactory {
+ &reflogEditorParameters,
+ [] { return new GitLogEditorWidgetT<GitReflogEditorWidget>; },
std::bind(&GitPluginPrivate::describe, this, _1, _2)
};
@@ -707,7 +715,7 @@ GitPluginPrivate::GitPluginPrivate()
context, true, std::bind(&GitPluginPrivate::logRepository, this));
createRepositoryAction(localRepositoryMenu, tr("Reflog"), "Git.ReflogRepository",
- context, true, &GitClient::reflog);
+ context, true, std::bind(&GitPluginPrivate::reflogRepository, this));
createRepositoryAction(localRepositoryMenu, tr("Clean..."), "Git.CleanRepository",
context, true, [this] { cleanRepository(); });
@@ -974,7 +982,10 @@ GitPluginPrivate::GitPluginPrivate()
this, [this](const QString &name) {
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- m_gitClient.show(state.topLevel(), name);
+ if (name.contains(".."))
+ m_gitClient.log(state.topLevel(), {}, false, {name});
+ else
+ m_gitClient.show(state.topLevel(), name);
});
}
@@ -1057,6 +1068,13 @@ void GitPluginPrivate::logRepository()
m_gitClient.log(state.topLevel());
}
+void GitPluginPrivate::reflogRepository()
+{
+ const VcsBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+ m_gitClient.reflog(state.topLevel());
+}
+
void GitPluginPrivate::undoFileChanges(bool revertStaging)
{
if (IDocument *document = EditorManager::currentDocument()) {
diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp
index 097dd276f3f..030fe848cc5 100644
--- a/src/plugins/git/gitsettings.cpp
+++ b/src/plugins/git/gitsettings.cpp
@@ -47,6 +47,7 @@ const QLatin1String GitSettings::graphLogKey("GraphLog");
const QLatin1String GitSettings::firstParentKey("FirstParent");
const QLatin1String GitSettings::followRenamesKey("FollowRenames");
const QLatin1String GitSettings::lastResetIndexKey("LastResetIndex");
+const QLatin1String GitSettings::refLogShowDateKey("RefLogShowDate");
GitSettings::GitSettings()
{
@@ -69,6 +70,7 @@ GitSettings::GitSettings()
declareKey(firstParentKey, false);
declareKey(followRenamesKey, true);
declareKey(lastResetIndexKey, 0);
+ declareKey(refLogShowDateKey, false);
}
Utils::FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h
index 73e42a3c724..8117011b2da 100644
--- a/src/plugins/git/gitsettings.h
+++ b/src/plugins/git/gitsettings.h
@@ -58,6 +58,7 @@ public:
static const QLatin1String firstParentKey;
static const QLatin1String followRenamesKey;
static const QLatin1String lastResetIndexKey;
+ static const QLatin1String refLogShowDateKey;
Utils::FilePath gitExecutable(bool *ok = nullptr, QString *errorMessage = nullptr) const;
diff --git a/src/plugins/git/gitutils.cpp b/src/plugins/git/gitutils.cpp
index c0f5ffd7544..1161d2cfcd9 100644
--- a/src/plugins/git/gitutils.cpp
+++ b/src/plugins/git/gitutils.cpp
@@ -69,7 +69,6 @@ bool Stash::parseStashLine(const QString &l)
bool inputText(QWidget *parent, const QString &title, const QString &prompt, QString *s)
{
QInputDialog dialog(parent);
- dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
dialog.setWindowTitle(title);
dialog.setLabelText(prompt);
dialog.setTextValue(*s);
diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp
index e57dda49e0f..25c59bbcb7f 100644
--- a/src/plugins/git/logchangedialog.cpp
+++ b/src/plugins/git/logchangedialog.cpp
@@ -227,7 +227,6 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
connect(m_widget, &LogChangeWidget::activated, okButton, [okButton] { okButton->animateClick(); });
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
resize(600, 400);
}
diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp
index 50b7a994f24..b0e629f0643 100644
--- a/src/plugins/git/remotedialog.cpp
+++ b/src/plugins/git/remotedialog.cpp
@@ -53,7 +53,6 @@ public:
m_remoteNames(remoteNames)
{
m_ui.setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui.nameEdit->setValidationFunction([this](Utils::FancyLineEdit *edit, QString *errorMessage) {
if (!edit)
return false;
@@ -127,7 +126,6 @@ RemoteDialog::RemoteDialog(QWidget *parent) :
m_remoteModel(new RemoteModel(this))
{
setModal(false);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAttribute(Qt::WA_DeleteOnClose, true); // Do not update unnecessarily
m_ui->setupUi(this);
diff --git a/src/plugins/git/stashdialog.cpp b/src/plugins/git/stashdialog.cpp
index e20cb6dcc89..ef1b324f58f 100644
--- a/src/plugins/git/stashdialog.cpp
+++ b/src/plugins/git/stashdialog.cpp
@@ -102,7 +102,6 @@ StashDialog::StashDialog(QWidget *parent) : QDialog(parent),
m_restoreCurrentInBranchButton(new QPushButton(tr("Restore to &Branch..."))),
m_refreshButton(new QPushButton(tr("Re&fresh")))
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAttribute(Qt::WA_DeleteOnClose, true); // Do not update unnecessarily
ui->setupUi(this);
diff --git a/src/plugins/help/openpageswidget.cpp b/src/plugins/help/openpageswidget.cpp
index 48e2ce223f5..0704627a973 100644
--- a/src/plugins/help/openpageswidget.cpp
+++ b/src/plugins/help/openpageswidget.cpp
@@ -111,7 +111,7 @@ void OpenPagesWidget::handleActivated(const QModelIndex &index)
// work around a bug in itemviews where the delegate wouldn't get the QStyle::State_MouseOver
QWidget *vp = viewport();
const QPoint &cursorPos = QCursor::pos();
- QMouseEvent e(QEvent::MouseMove, vp->mapFromGlobal(cursorPos), cursorPos, Qt::NoButton, nullptr, nullptr);
+ QMouseEvent e(QEvent::MouseMove, vp->mapFromGlobal(cursorPos), cursorPos, Qt::NoButton, {}, {});
QCoreApplication::sendEvent(vp, &e);
}
}
diff --git a/src/plugins/imageviewer/exportdialog.cpp b/src/plugins/imageviewer/exportdialog.cpp
index 682a7dfd30f..37a59b96259 100644
--- a/src/plugins/imageviewer/exportdialog.cpp
+++ b/src/plugins/imageviewer/exportdialog.cpp
@@ -88,8 +88,6 @@ ExportDialog::ExportDialog(QWidget *parent)
, m_heightSpinBox(new QSpinBox(this))
, m_aspectRatio(1)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
auto formLayout = new QFormLayout(this);
m_pathChooser->setMinimumWidth(QApplication::desktop()->availableGeometry(this).width() / 5);
diff --git a/src/plugins/imageviewer/multiexportdialog.cpp b/src/plugins/imageviewer/multiexportdialog.cpp
index b47c52aaeba..b377cc72436 100644
--- a/src/plugins/imageviewer/multiexportdialog.cpp
+++ b/src/plugins/imageviewer/multiexportdialog.cpp
@@ -184,8 +184,6 @@ MultiExportDialog::MultiExportDialog(QWidget *parent)
, m_pathChooser(new Utils::PathChooser(this))
, m_sizesLineEdit(new QLineEdit)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
auto formLayout = new QFormLayout(this);
m_pathChooser->setMinimumWidth(QApplication::desktop()->availableGeometry(this).width() / 5);
diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp
index 5d62cdfeb9a..bb74a7bcab3 100644
--- a/src/plugins/languageclient/client.cpp
+++ b/src/plugins/languageclient/client.cpp
@@ -247,8 +247,8 @@ void Client::initialize()
QTC_ASSERT(m_clientInterface, return);
QTC_ASSERT(m_state == Uninitialized, return);
qCDebug(LOGLSPCLIENT) << "initializing language server " << m_displayName;
- auto initRequest = new InitializeRequest();
- auto params = initRequest->params().value_or(InitializeParams());
+ InitializeRequest initRequest;
+ auto params = initRequest.params().value_or(InitializeParams());
params.setCapabilities(generateClientCapabilities());
if (m_project) {
params.setRootUri(DocumentUri::fromFilePath(m_project->projectDirectory()));
@@ -256,13 +256,13 @@ void Client::initialize()
return WorkSpaceFolder(pro->projectDirectory().toString(), pro->displayName());
}));
}
- initRequest->setParams(params);
- initRequest->setResponseCallback([this](const InitializeRequest::Response &initResponse){
+ initRequest.setParams(params);
+ initRequest.setResponseCallback([this](const InitializeRequest::Response &initResponse){
initializeCallback(initResponse);
});
// directly send data otherwise the state check would fail;
- initRequest->registerResponseHandler(&m_responseHandlers);
- m_clientInterface->sendMessage(initRequest->toBaseMessage());
+ initRequest.registerResponseHandler(&m_responseHandlers);
+ m_clientInterface->sendMessage(initRequest.toBaseMessage());
m_state = InitializeRequested;
}
@@ -357,7 +357,7 @@ void Client::closeDocument(TextEditor::TextDocument *document)
deactivateDocument(document);
const DocumentUri &uri = DocumentUri::fromFilePath(document->filePath());
m_highlights[uri].clear();
- if (m_openedDocument.remove(document) != 0) {
+ if (m_openedDocument.remove(document) != 0 && m_state == Initialized) {
DidCloseTextDocumentParams params(TextDocumentIdentifier{uri});
sendContent(DidCloseTextDocumentNotification(params));
}
@@ -475,7 +475,7 @@ void Client::documentContentsChanged(TextEditor::TextDocument *document,
int charsRemoved,
int charsAdded)
{
- if (!m_openedDocument.contains(document))
+ if (!m_openedDocument.contains(document) || !reachable())
return;
const QString method(DidChangeTextDocumentNotification::methodName);
TextDocumentSyncKind syncKind = m_serverCapabilities.textDocumentSyncKindHelper();
@@ -912,11 +912,12 @@ bool Client::reset()
m_responseHandlers.clear();
m_clientInterface->resetBuffer();
updateEditorToolBar(m_openedDocument.keys());
- m_openedDocument.clear();
m_serverCapabilities = ServerCapabilities();
m_dynamicCapabilities.reset();
for (const DocumentUri &uri : m_diagnostics.keys())
removeDiagnostics(uri);
+ for (TextEditor::TextDocument *document : m_openedDocument.keys())
+ document->disconnect(this);
for (TextEditor::TextDocument *document : m_resetAssistProvider.keys())
resetAssistProviders(document);
return true;
diff --git a/src/plugins/languageclient/languageclientcompletionassist.cpp b/src/plugins/languageclient/languageclientcompletionassist.cpp
index a88af2666a2..ae2eca2ff63 100644
--- a/src/plugins/languageclient/languageclientcompletionassist.cpp
+++ b/src/plugins/languageclient/languageclientcompletionassist.cpp
@@ -278,13 +278,14 @@ public:
IAssistProposal *perform(const AssistInterface *interface) override;
bool running() override;
bool needsRestart() const override { return true; }
+ void cancel() override;
private:
void handleCompletionResponse(const CompletionRequest::Response &response);
QPointer<QTextDocument> m_document;
QPointer<Client> m_client;
- bool m_running = false;
+ MessageId m_currentRequest;
int m_pos = -1;
};
@@ -336,7 +337,7 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn
});
completionRequest.setParams(params);
m_client->sendContent(completionRequest);
- m_running = true;
+ m_currentRequest = completionRequest.id();
m_document = interface->textDocument();
qCDebug(LOGLSPCOMPLETION) << QTime::currentTime()
<< " : request completions at " << m_pos
@@ -346,14 +347,22 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn
bool LanguageClientCompletionAssistProcessor::running()
{
- return m_running;
+ return m_currentRequest.isValid();
+}
+
+void LanguageClientCompletionAssistProcessor::cancel()
+{
+ if (running()) {
+ m_client->cancelRequest(m_currentRequest);
+ m_currentRequest = MessageId();
+ }
}
void LanguageClientCompletionAssistProcessor::handleCompletionResponse(
const CompletionRequest::Response &response)
{
qCDebug(LOGLSPCOMPLETION) << QTime::currentTime() << " : got completions";
- m_running = false;
+ m_currentRequest = MessageId();
QTC_ASSERT(m_client, return);
if (auto error = response.error()) {
m_client->log(error.value());
diff --git a/src/plugins/languageclient/languageclientfunctionhint.cpp b/src/plugins/languageclient/languageclientfunctionhint.cpp
index 5e711adec67..33618649735 100644
--- a/src/plugins/languageclient/languageclientfunctionhint.cpp
+++ b/src/plugins/languageclient/languageclientfunctionhint.cpp
@@ -65,14 +65,15 @@ class FunctionHintProcessor : public IAssistProcessor
public:
explicit FunctionHintProcessor(Client *client) : m_client(client) {}
IAssistProposal *perform(const AssistInterface *interface) override;
- bool running() override { return m_running; }
+ bool running() override { return m_currentRequest.isValid(); }
bool needsRestart() const override { return true; }
+ void cancel() override;
private:
void handleSignatureResponse(const SignatureHelpRequest::Response &response);
QPointer<Client> m_client;
- bool m_running = false;
+ MessageId m_currentRequest;
int m_pos = -1;
};
@@ -87,13 +88,21 @@ IAssistProposal *FunctionHintProcessor::perform(const AssistInterface *interface
request.setParams(TextDocumentPositionParams(TextDocumentIdentifier(uri), Position(cursor)));
request.setResponseCallback([this](auto response) { this->handleSignatureResponse(response); });
m_client->sendContent(request);
- m_running = true;
+ m_currentRequest = request.id();
return nullptr;
}
+void FunctionHintProcessor::cancel()
+{
+ if (running()) {
+ m_client->cancelRequest(m_currentRequest);
+ m_currentRequest = MessageId();
+ }
+}
+
void FunctionHintProcessor::handleSignatureResponse(const SignatureHelpRequest::Response &response)
{
- m_running = false;
+ m_currentRequest = MessageId();
if (auto error = response.error())
m_client->log(error.value());
FunctionHintProposalModelPtr model(
diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp
index 4e2f3710247..27e74683132 100644
--- a/src/plugins/languageclient/languageclientmanager.cpp
+++ b/src/plugins/languageclient/languageclientmanager.cpp
@@ -366,6 +366,8 @@ void LanguageClientManager::clientFinished(Client *client)
client->log(tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS),
Core::MessageManager::Flash);
QTimer::singleShot(restartTimeoutS * 1000, client, [client]() { startClient(client); });
+ for (TextEditor::TextDocument *document : m_clientForDocument.keys(client))
+ client->deactivateDocument(document);
} else {
if (unexpectedFinish && !m_shuttingDown)
client->log(tr("Unexpectedly finished."), Core::MessageManager::Flash);
@@ -397,7 +399,8 @@ void LanguageClientManager::editorOpened(Core::IEditor *editor)
if (!widget)
return;
if (Client *client = clientForDocument(widget->textDocument()))
- client->cursorPositionChanged(widget);
+ if (client->reachable())
+ client->cursorPositionChanged(widget);
});
});
updateEditorToolBar(editor);
diff --git a/src/plugins/languageclient/languageclientquickfix.cpp b/src/plugins/languageclient/languageclientquickfix.cpp
index 90e9b23de69..f3b86377aee 100644
--- a/src/plugins/languageclient/languageclientquickfix.cpp
+++ b/src/plugins/languageclient/languageclientquickfix.cpp
@@ -84,15 +84,16 @@ class LanguageClientQuickFixAssistProcessor : public IAssistProcessor
{
public:
explicit LanguageClientQuickFixAssistProcessor(Client *client) : m_client(client) {}
- bool running() override { return m_running; }
+ bool running() override { return m_currentRequest.isValid(); }
IAssistProposal *perform(const AssistInterface *interface) override;
+ void cancel() override;
private:
void handleCodeActionResponse(const CodeActionRequest::Response &response);
QSharedPointer<const AssistInterface> m_assistInterface;
Client *m_client = nullptr; // not owned
- bool m_running = false;
+ MessageId m_currentRequest;
};
IAssistProposal *LanguageClientQuickFixAssistProcessor::perform(const AssistInterface *interface)
@@ -123,14 +124,22 @@ IAssistProposal *LanguageClientQuickFixAssistProcessor::perform(const AssistInte
});
m_client->requestCodeActions(request);
- m_running = true;
+ m_currentRequest = request.id();
return nullptr;
}
+void LanguageClientQuickFixAssistProcessor::cancel()
+{
+ if (running()) {
+ m_client->cancelRequest(m_currentRequest);
+ m_currentRequest = MessageId();
+ }
+}
+
void LanguageClientQuickFixAssistProcessor::handleCodeActionResponse(
const CodeActionRequest::Response &response)
{
- m_running = false;
+ m_currentRequest = MessageId();
if (const Utils::optional<CodeActionRequest::Response::Error> &error = response.error())
m_client->log(*error);
QuickFixOperations ops;
diff --git a/src/plugins/languageclient/languageclientsettings.cpp b/src/plugins/languageclient/languageclientsettings.cpp
index cfafd86cbb7..c27a8f599a6 100644
--- a/src/plugins/languageclient/languageclientsettings.cpp
+++ b/src/plugins/languageclient/languageclientsettings.cpp
@@ -842,7 +842,6 @@ public:
connect(filter, &QLineEdit::textChanged, proxy, &QSortFilterProxyModel::setFilterWildcard);
listView->setModel(proxy);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setModal(true);
}
diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp
index 5ea78779eb3..1f9b4dbe67e 100644
--- a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp
+++ b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp
@@ -54,10 +54,7 @@ static QStringList flashAndRunArgs(const Target *target)
const QString projectName = target->project()->displayName();
// TODO: Hack! Implement flash target name handling, properly
- const QString targetName =
- target->kit()->value(Constants::KIT_MCUTARGET_VENDOR_KEY).toString() == "NXP"
- ? QString("flash_%1").arg(projectName)
- : QString("flash_%1_and_bootloader").arg(projectName);
+ const QString targetName = "flash_" + projectName;
return {"--build", ".", "--target", targetName};
}
diff --git a/src/plugins/mercurial/constants.h b/src/plugins/mercurial/constants.h
index 1813d16723b..7f8982d49ee 100644
--- a/src/plugins/mercurial/constants.h
+++ b/src/plugins/mercurial/constants.h
@@ -37,10 +37,10 @@ const char MERCURIALDEFAULT[] = "hg";
const char MERCURIAL_CONTEXT[] = "Mercurial Context";
// Changeset identifiers
-const char CHANGESETID12[] = " ([a-f0-9]{12,12}) "; //match 12 hex chars and capture
-const char CHANGESETID40[] = " ([a-f0-9]{40,40}) ";
-const char CHANGEIDEXACT12[] = "[a-f0-9]{12,12}"; //match 12 hex chars a
-const char CHANGEIDEXACT40[] = "[a-f0-9]{40,40}";
+const char CHANGESETID12[] = " ([a-f0-9]{12}) "; //match 12 hex chars and capture
+const char CHANGESETID40[] = " ([a-f0-9]{40}) ";
+const char CHANGEIDEXACT12[] = "[a-f0-9]{12}"; //match 12 hex chars
+const char CHANGEIDEXACT40[] = "[a-f0-9]{40}";
// match diff header. e.g. +++ b/filename
const char DIFFIDENTIFIER[] = "^(?:diff --git a/|[+-]{3} (?:/dev/null|[ab]/(.+$)))";
diff --git a/src/plugins/mercurial/mercurialeditor.cpp b/src/plugins/mercurial/mercurialeditor.cpp
index e4c313e11ab..3523d72efc1 100644
--- a/src/plugins/mercurial/mercurialeditor.cpp
+++ b/src/plugins/mercurial/mercurialeditor.cpp
@@ -42,33 +42,18 @@
namespace Mercurial {
namespace Internal {
+// use QRegularExpression::anchoredPattern() when minimum Qt is raised to 5.12+
MercurialEditorWidget::MercurialEditorWidget(MercurialClient *client) :
- exactIdentifier12(QLatin1String(Constants::CHANGEIDEXACT12)),
- exactIdentifier40(QLatin1String(Constants::CHANGEIDEXACT40)),
- changesetIdentifier12(QLatin1String(Constants::CHANGESETID12)),
- changesetIdentifier40(QLatin1String(Constants::CHANGESETID40)),
+ exactIdentifier12(QString("\\A(?:") + Constants::CHANGEIDEXACT12 + QString(")\\z")),
+ exactIdentifier40(QString("\\A(?:") + Constants::CHANGEIDEXACT40 + QString(")\\z")),
+ changesetIdentifier40(Constants::CHANGESETID40),
m_client(client)
{
- setDiffFilePattern(QRegExp(QLatin1String(Constants::DIFFIDENTIFIER)));
- setLogEntryPattern(QRegExp(QLatin1String("^changeset:\\s+(\\S+)$")));
+ setDiffFilePattern(Constants::DIFFIDENTIFIER);
+ setLogEntryPattern("^changeset:\\s+(\\S+)$");
setAnnotateRevisionTextFormat(tr("&Annotate %1"));
setAnnotatePreviousRevisionTextFormat(tr("Annotate &parent revision %1"));
-}
-
-QSet<QString> MercurialEditorWidget::annotationChanges() const
-{
- QSet<QString> changes;
- const QString data = toPlainText();
- if (data.isEmpty())
- return changes;
-
- int position = 0;
- while ((position = changesetIdentifier12.indexIn(data, position)) != -1) {
- changes.insert(changesetIdentifier12.cap(1));
- position += changesetIdentifier12.matchedLength();
- }
-
- return changes;
+ setAnnotationEntryPattern(Constants::CHANGESETID12);
}
QString MercurialEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) const
@@ -77,9 +62,9 @@ QString MercurialEditorWidget::changeUnderCursor(const QTextCursor &cursorIn) co
cursor.select(QTextCursor::WordUnderCursor);
if (cursor.hasSelection()) {
const QString change = cursor.selectedText();
- if (exactIdentifier12.exactMatch(change))
+ if (exactIdentifier12.match(change).hasMatch())
return change;
- if (exactIdentifier40.exactMatch(change))
+ if (exactIdentifier40.match(change).hasMatch())
return change;
}
return QString();
diff --git a/src/plugins/mercurial/mercurialeditor.h b/src/plugins/mercurial/mercurialeditor.h
index 12976a3d779..40bf68854d5 100644
--- a/src/plugins/mercurial/mercurialeditor.h
+++ b/src/plugins/mercurial/mercurialeditor.h
@@ -27,7 +27,7 @@
#include <vcsbase/vcsbaseeditor.h>
-#include <QRegExp>
+#include <QRegularExpression>
namespace Mercurial {
namespace Internal {
@@ -41,17 +41,15 @@ public:
explicit MercurialEditorWidget(MercurialClient *client);
private:
- QSet<QString> annotationChanges() const override;
QString changeUnderCursor(const QTextCursor &cursor) const override;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(
const QSet<QString> &changes) const override;
QString decorateVersion(const QString &revision) const override;
QStringList annotationPreviousVersions(const QString &revision) const override;
- mutable QRegExp exactIdentifier12;
- mutable QRegExp exactIdentifier40;
- mutable QRegExp changesetIdentifier12;
- const QRegExp changesetIdentifier40;
+ const QRegularExpression exactIdentifier12;
+ const QRegularExpression exactIdentifier40;
+ const QRegularExpression changesetIdentifier40;
MercurialClient *m_client;
};
diff --git a/src/plugins/perforce/perforceeditor.cpp b/src/plugins/perforce/perforceeditor.cpp
index e686d4e427b..4566efc3572 100644
--- a/src/plugins/perforce/perforceeditor.cpp
+++ b/src/plugins/perforce/perforceeditor.cpp
@@ -35,7 +35,6 @@
#include <QDebug>
#include <QFileInfo>
#include <QProcess>
-#include <QRegExp>
#include <QSet>
#include <QTextStream>
@@ -52,7 +51,7 @@ namespace Internal {
// ------------ PerforceEditor
PerforceEditorWidget::PerforceEditorWidget() :
- m_changeNumberPattern(QLatin1String("^\\d+$"))
+ m_changeNumberPattern("^\\d+$")
{
QTC_CHECK(m_changeNumberPattern.isValid());
// Diff format:
@@ -60,31 +59,10 @@ PerforceEditorWidget::PerforceEditorWidget() :
// 2) "==== //depot/.../mainwindow.cpp#15 (text) ====" (created by p4 describe)
// 3) --- //depot/XXX/closingkit/trunk/source/cui/src/cui_core.cpp<tab>2012-02-08 13:54:01.000000000 0100
// +++ P:/XXX\closingkit\trunk\source\cui\src\cui_core.cpp<tab>2012-02-08 13:54:01.000000000 0100
- setDiffFilePattern(QRegExp(QLatin1String("^(?:={4}|\\+{3}) (.+)(?:\\t|#\\d)")));
- setLogEntryPattern(QRegExp(QLatin1String("^... #\\d change (\\d+) ")));
+ setDiffFilePattern("^(?:={4}|\\+{3}) (.+)(?:\\t|#\\d)");
+ setLogEntryPattern("^... #\\d change (\\d+) ");
setAnnotateRevisionTextFormat(tr("Annotate change list \"%1\""));
-}
-
-QSet<QString> PerforceEditorWidget::annotationChanges() const
-{
- QSet<QString> changes;
- const QString txt = toPlainText();
- if (txt.isEmpty())
- return changes;
- // Hunt for first change number in annotation: "<change>:"
- QRegExp r(QLatin1String("^(\\d+):"));
- QTC_ASSERT(r.isValid(), return changes);
- if (r.indexIn(txt) != -1) {
- changes.insert(r.cap(1));
- r.setPattern(QLatin1String("\n(\\d+):"));
- QTC_ASSERT(r.isValid(), return changes);
- int pos = 0;
- while ((pos = r.indexIn(txt, pos)) != -1) {
- pos += r.matchedLength();
- changes.insert(r.cap(1));
- }
- }
- return changes;
+ setAnnotationEntryPattern("^(\\d+):");
}
QString PerforceEditorWidget::changeUnderCursor(const QTextCursor &c) const
@@ -95,7 +73,7 @@ QString PerforceEditorWidget::changeUnderCursor(const QTextCursor &c) const
if (!cursor.hasSelection())
return QString();
const QString change = cursor.selectedText();
- return m_changeNumberPattern.exactMatch(change) ? change : QString();
+ return m_changeNumberPattern.match(change).hasMatch() ? change : QString();
}
VcsBase::BaseAnnotationHighlighter *PerforceEditorWidget::createAnnotationHighlighter(const QSet<QString> &changes) const
diff --git a/src/plugins/perforce/perforceeditor.h b/src/plugins/perforce/perforceeditor.h
index 2a91373aacd..67e939f6e5d 100644
--- a/src/plugins/perforce/perforceeditor.h
+++ b/src/plugins/perforce/perforceeditor.h
@@ -27,7 +27,7 @@
#include <vcsbase/vcsbaseeditor.h>
-#include <QRegExp>
+#include <QRegularExpression>
namespace Perforce {
namespace Internal {
@@ -40,14 +40,13 @@ public:
PerforceEditorWidget();
private:
- QSet<QString> annotationChanges() const override;
QString changeUnderCursor(const QTextCursor &) const override;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(
const QSet<QString> &changes) const override;
QString findDiffFile(const QString &f) const override;
QStringList annotationPreviousVersions(const QString &v) const override;
- mutable QRegExp m_changeNumberPattern;
+ const QRegularExpression m_changeNumberPattern;
};
} // namespace Perforce
diff --git a/src/plugins/perfprofiler/perfprofilerflamegraphmodel.cpp b/src/plugins/perfprofiler/perfprofilerflamegraphmodel.cpp
index 49385fbaa9c..d8ed9082b1c 100644
--- a/src/plugins/perfprofiler/perfprofilerflamegraphmodel.cpp
+++ b/src/plugins/perfprofiler/perfprofilerflamegraphmodel.cpp
@@ -152,9 +152,9 @@ int PerfProfilerFlameGraphModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid()) {
Data *parentData = static_cast<Data *>(parent.internalPointer());
- return parentData->children.size();
+ return int(parentData->children.size());
}
- return m_stackBottom->children.size();
+ return int(m_stackBottom->children.size());
}
int PerfProfilerFlameGraphModel::columnCount(const QModelIndex &parent) const
diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h
index 3d125f5bb36..35730eccc78 100644
--- a/src/plugins/projectexplorer/buildconfiguration.h
+++ b/src/plugins/projectexplorer/buildconfiguration.h
@@ -105,7 +105,7 @@ public:
static QString buildTypeName(BuildType type);
- bool isActive() const override;
+ bool isActive() const;
static void prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env);
void updateCacheAndEmitEnvironmentChanged();
diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp
index 663cf22f8e4..720b501681d 100644
--- a/src/plugins/projectexplorer/buildmanager.cpp
+++ b/src/plugins/projectexplorer/buildmanager.cpp
@@ -791,6 +791,7 @@ bool BuildManager::buildLists(const QList<BuildStepList *> bsls, const QStringLi
bool success = buildQueueAppend(steps, names, preambelMessage);
if (!success) {
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
+ d->m_isDeploying = false;
return false;
}
diff --git a/src/plugins/projectexplorer/buildstep.cpp b/src/plugins/projectexplorer/buildstep.cpp
index 67d45fbcd54..275d9fdcfbf 100644
--- a/src/plugins/projectexplorer/buildstep.cpp
+++ b/src/plugins/projectexplorer/buildstep.cpp
@@ -260,11 +260,6 @@ void BuildStep::reportRunResult(QFutureInterface<bool> &fi, bool success)
fi.reportFinished();
}
-bool BuildStep::isActive() const
-{
- return projectConfiguration()->isActive();
-}
-
bool BuildStep::widgetExpandedByDefault() const
{
return m_widgetExpandedByDefault;
diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h
index 9a1e3120f6a..b8dd6b67181 100644
--- a/src/plugins/projectexplorer/buildstep.h
+++ b/src/plugins/projectexplorer/buildstep.h
@@ -100,8 +100,6 @@ public:
static void reportRunResult(QFutureInterface<bool> &fi, bool success);
- bool isActive() const override;
-
bool widgetExpandedByDefault() const;
void setWidgetExpandedByDefault(bool widgetExpandedByDefault);
diff --git a/src/plugins/projectexplorer/deployconfiguration.h b/src/plugins/projectexplorer/deployconfiguration.h
index 156fb526749..6cd85b62a3e 100644
--- a/src/plugins/projectexplorer/deployconfiguration.h
+++ b/src/plugins/projectexplorer/deployconfiguration.h
@@ -56,7 +56,7 @@ public:
bool fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override;
- bool isActive() const override;
+ bool isActive() const;
bool usesCustomDeploymentData() const { return m_usesCustomDeploymentData; }
void setUseCustomDeploymentData(bool enabled) { m_usesCustomDeploymentData = enabled; }
diff --git a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp
index 2e0cf6a6606..3734977c4b3 100644
--- a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp
+++ b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp
@@ -124,7 +124,6 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser,
, buttonBox(new QDialogButtonBox(parent))
{
q->setWindowTitle(DeviceProcessesDialog::tr("List of Processes"));
- q->setWindowFlags(q->windowFlags() & ~Qt::WindowContextHelpButtonHint);
q->setMinimumHeight(500);
processList = nullptr;
diff --git a/src/plugins/projectexplorer/projectconfiguration.h b/src/plugins/projectexplorer/projectconfiguration.h
index a87a264c420..0aa0e9f85ee 100644
--- a/src/plugins/projectexplorer/projectconfiguration.h
+++ b/src/plugins/projectexplorer/projectconfiguration.h
@@ -190,8 +190,6 @@ public:
Target *target() const;
Project *project() const;
- virtual bool isActive() const = 0;
-
static QString settingsIdKey();
template<class Aspect, typename ...Args>
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 75de3f5cc24..575543d77bd 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -2859,8 +2859,7 @@ static bool hasDeploySettings(Project *pro)
{
return Utils::anyOf(SessionManager::projectOrder(pro), [](Project *project) {
return project->activeTarget()
- && project->activeTarget()->activeDeployConfiguration()
- && !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty();
+ && project->activeTarget()->activeDeployConfiguration();
});
}
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index de54858abc6..f79001a571c 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -128,7 +128,7 @@ class PROJECTEXPLORER_EXPORT RunConfiguration : public ProjectConfiguration
public:
~RunConfiguration() override;
- bool isActive() const override;
+ bool isActive() const;
virtual QString disabledReason() const;
virtual bool isEnabled() const;
diff --git a/src/plugins/projectexplorer/sessionmodel.cpp b/src/plugins/projectexplorer/sessionmodel.cpp
index 9e926941166..a535294f91d 100644
--- a/src/plugins/projectexplorer/sessionmodel.cpp
+++ b/src/plugins/projectexplorer/sessionmodel.cpp
@@ -165,7 +165,7 @@ QVariant SessionModel::data(const QModelIndex &index, int role) const
QHash<int, QByteArray> SessionModel::roleNames() const
{
- static QHash<int, QByteArray> extraRoles{
+ static const QHash<int, QByteArray> extraRoles{
{Qt::DisplayRole, "sessionName"},
{DefaultSessionRole, "defaultSession"},
{ActiveSessionRole, "activeSession"},
@@ -173,7 +173,9 @@ QHash<int, QByteArray> SessionModel::roleNames() const
{ProjectsPathRole, "projectsPath"},
{ProjectsDisplayRole, "projectsName"}
};
- return QAbstractTableModel::roleNames().unite(extraRoles);
+ QHash<int, QByteArray> roles = QAbstractTableModel::roleNames();
+ Utils::addToHash(&roles, extraRoles);
+ return roles;
}
void SessionModel::sort(int column, Qt::SortOrder order)
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.h b/src/plugins/projectexplorer/toolchainoptionspage.h
index 1cb067e5607..9bcf90cab1b 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.h
+++ b/src/plugins/projectexplorer/toolchainoptionspage.h
@@ -27,11 +27,15 @@
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QCoreApplication>
+
namespace ProjectExplorer {
namespace Internal {
class ToolChainOptionsPage final : public Core::IOptionsPage
{
+ Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::ToolChainOptionsPage)
+
public:
ToolChainOptionsPage();
};
diff --git a/src/plugins/projectexplorer/waitforstopdialog.cpp b/src/plugins/projectexplorer/waitforstopdialog.cpp
index 1a7852989d9..f2d3abb1521 100644
--- a/src/plugins/projectexplorer/waitforstopdialog.cpp
+++ b/src/plugins/projectexplorer/waitforstopdialog.cpp
@@ -39,7 +39,6 @@ WaitForStopDialog::WaitForStopDialog(QList<ProjectExplorer::RunControl *> runCon
m_runControls(runControls)
{
setWindowTitle(tr("Waiting for Applications to Stop"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
auto layout = new QVBoxLayout();
setLayout(layout);
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp
index bc0309a3028..e584a90e4d3 100644
--- a/src/plugins/python/pythonutils.cpp
+++ b/src/plugins/python/pythonutils.cpp
@@ -44,6 +44,7 @@
#include <texteditor/textdocument.h>
#include <utils/qtcassert.h>
+#include <utils/runextensions.h>
#include <utils/synchronousprocess.h>
#include <QDir>
@@ -144,19 +145,18 @@ static PythonLanguageServerState checkPythonLanguageServer(const FilePath &pytho
using namespace LanguageClient;
SynchronousProcess pythonProcess;
const CommandLine pythonLShelpCommand(python, {"-m", "pyls", "-h"});
- SynchronousProcessResponse response = pythonProcess.runBlocking(pythonLShelpCommand);
- if (response.allOutput().contains("Python Language Server")) {
- const FilePath &modulePath = getPylsModulePath(pythonLShelpCommand);
- for (const StdIOSettings *serverSetting : configuredPythonLanguageServer()) {
- if (modulePath == getPylsModulePath(serverSetting->command())) {
- return {serverSetting->m_enabled ? PythonLanguageServerState::AlreadyConfigured
- : PythonLanguageServerState::ConfiguredButDisabled,
- FilePath()};
- }
+ const FilePath &modulePath = getPylsModulePath(pythonLShelpCommand);
+ for (const StdIOSettings *serverSetting : configuredPythonLanguageServer()) {
+ if (modulePath == getPylsModulePath(serverSetting->command())) {
+ return {serverSetting->m_enabled ? PythonLanguageServerState::AlreadyConfigured
+ : PythonLanguageServerState::ConfiguredButDisabled,
+ FilePath()};
}
+ }
+ SynchronousProcessResponse response = pythonProcess.runBlocking(pythonLShelpCommand);
+ if (response.allOutput().contains("Python Language Server"))
return {PythonLanguageServerState::AlreadyInstalled, modulePath};
- }
const CommandLine pythonPipVersionCommand(python, {"-m", "pip", "-V"});
response = pythonProcess.runBlocking(pythonPipVersionCommand);
@@ -368,11 +368,38 @@ void PyLSConfigureAssistant::documentOpened(Core::IDocument *document)
void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python,
TextEditor::TextDocument *document)
{
- const PythonLanguageServerState &lsState = checkPythonLanguageServer(python);
+ using CheckPylsWatcher = QFutureWatcher<PythonLanguageServerState>;
+
+ QPointer<CheckPylsWatcher> watcher = new CheckPylsWatcher();
+ watcher->setFuture(Utils::runAsync(&checkPythonLanguageServer, python));
- if (lsState.state == PythonLanguageServerState::CanNotBeInstalled)
+ // cancel and delete watcher after a 10 second timeout
+ QTimer::singleShot(10000, this, [watcher]() {
+ if (watcher) {
+ watcher->cancel();
+ watcher->deleteLater();
+ }
+ });
+
+ connect(
+ watcher,
+ &CheckPylsWatcher::resultReadyAt,
+ this,
+ [=, document = QPointer<TextEditor::TextDocument>(document)]() {
+ if (!document || !watcher)
+ return;
+ handlePyLSState(python, watcher->result(), document);
+ watcher->deleteLater();
+ });
+}
+
+void PyLSConfigureAssistant::handlePyLSState(const FilePath &python,
+ const PythonLanguageServerState &state,
+ TextEditor::TextDocument *document)
+{
+ if (state.state == PythonLanguageServerState::CanNotBeInstalled)
return;
- if (lsState.state == PythonLanguageServerState::AlreadyConfigured) {
+ if (state.state == PythonLanguageServerState::AlreadyConfigured) {
if (const StdIOSettings *setting = languageServerForPython(python)) {
if (Client *client = LanguageClientManager::clientForSetting(setting).value(0))
LanguageClientManager::reOpenDocumentWithClient(document, client);
@@ -382,12 +409,11 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python,
resetEditorInfoBar(document);
Core::InfoBar *infoBar = document->infoBar();
- if (lsState.state == PythonLanguageServerState::CanBeInstalled
+ if (state.state == PythonLanguageServerState::CanBeInstalled
&& infoBar->canInfoBeAdded(installPylsInfoBarId)) {
- auto message
- = tr("Install and set up Python language server (PyLS) for %1 (%2). "
- "The language server provides Python specific completion and annotation.")
- .arg(pythonName(python), python.toUserOutput());
+ auto message = tr("Install and set up Python language server (PyLS) for %1 (%2). "
+ "The language server provides Python specific completion and annotation.")
+ .arg(pythonName(python), python.toUserOutput());
Core::InfoBarEntry info(installPylsInfoBarId,
message,
Core::InfoBarEntry::GlobalSuppression::Enabled);
@@ -395,7 +421,7 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python,
[=]() { installPythonLanguageServer(python, document); });
infoBar->addInfo(info);
m_infoBarEntries[python] << document;
- } else if (lsState.state == PythonLanguageServerState::AlreadyInstalled
+ } else if (state.state == PythonLanguageServerState::AlreadyInstalled
&& infoBar->canInfoBeAdded(startPylsInfoBarId)) {
auto message = tr("Found a Python language server for %1 (%2). "
"Set it up for this document?")
@@ -407,7 +433,7 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python,
[=]() { setupPythonLanguageServer(python, document); });
infoBar->addInfo(info);
m_infoBarEntries[python] << document;
- } else if (lsState.state == PythonLanguageServerState::ConfiguredButDisabled
+ } else if (state.state == PythonLanguageServerState::ConfiguredButDisabled
&& infoBar->canInfoBeAdded(enablePylsInfoBarId)) {
auto message = tr("Enable Python language server for %1 (%2)?")
.arg(pythonName(python), python.toUserOutput());
diff --git a/src/plugins/python/pythonutils.h b/src/plugins/python/pythonutils.h
index 20cb674ddb9..28d1faf6074 100644
--- a/src/plugins/python/pythonutils.h
+++ b/src/plugins/python/pythonutils.h
@@ -40,6 +40,8 @@ namespace TextEditor { class TextDocument; }
namespace Python {
namespace Internal {
+struct PythonLanguageServerState;
+
class PyLSConfigureAssistant : public QObject
{
Q_OBJECT
@@ -56,6 +58,9 @@ public:
private:
explicit PyLSConfigureAssistant(QObject *parent);
+ void handlePyLSState(const Utils::FilePath &python,
+ const PythonLanguageServerState &state,
+ TextEditor::TextDocument *document);
void resetEditorInfoBar(TextEditor::TextDocument *document);
void installPythonLanguageServer(const Utils::FilePath &python,
QPointer<TextEditor::TextDocument> document);
diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
index c8cabd87b4a..a47c1c972f7 100644
--- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
+++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp
@@ -669,6 +669,7 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) :
connect(forceProbesCheckBox, &QCheckBox::toggled, this,
&QbsBuildStepConfigWidget::changeForceProbes);
updateState();
+ setSummaryText(tr("<b>Qbs:</b> %1").arg("build"));
}
void QbsBuildStepConfigWidget::updateState()
@@ -714,8 +715,6 @@ void QbsBuildStepConfigWidget::updateState()
Constants::QBS_CONFIG_QUICK_COMPILER_KEY);
commandLineTextEdit->setPlainText(command);
-
- setSummaryText(tr("<b>Qbs:</b> %1").arg(command));
}
diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.cpp b/src/plugins/qbsprojectmanager/qbscleanstep.cpp
index ddecb793dcd..f6753fa411f 100644
--- a/src/plugins/qbsprojectmanager/qbscleanstep.cpp
+++ b/src/plugins/qbsprojectmanager/qbscleanstep.cpp
@@ -74,7 +74,7 @@ QbsCleanStep::QbsCleanStep(BuildStepList *bsl, Core::Id id)
QString command = static_cast<QbsBuildConfiguration *>(buildConfiguration())
->equivalentCommandLine(data);
effectiveCommandAspect->setValue(command);
- return tr("<b>Qbs:</b> %1").arg(command);
+ return tr("<b>Qbs:</b> %1").arg("clean");
});
}
diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
index ca78e2f5f0d..f3e3164e1e3 100644
--- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
+++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
@@ -324,6 +324,7 @@ QbsInstallStepConfigWidget::QbsInstallStepConfigWidget(QbsInstallStep *step) :
this, &QbsInstallStepConfigWidget::updateState);
updateState();
+ setSummaryText(QbsInstallStep::tr("<b>Qbs:</b> %1").arg("install"));
}
void QbsInstallStepConfigWidget::updateState()
@@ -338,8 +339,6 @@ void QbsInstallStepConfigWidget::updateState()
QString command = m_step->buildConfig()->equivalentCommandLine(m_step->stepData());
m_commandLineTextEdit->setPlainText(command);
-
- setSummaryText(QbsInstallStep::tr("<b>Qbs:</b> %1").arg(command));
}
// --------------------------------------------------------------------
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index 8ce7c8bfb99..0bd173a742f 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -1067,12 +1067,13 @@ void QbsBuildSystem::updateApplicationTargets()
}
}
BuildTargetInfo bti;
- bti.buildKey = productData.value("full-display-name").toString();
+ bti.buildKey = productData.value("name").toString() + '.'
+ + productData.value("multiplex-configuration-id").toString();
bti.targetFilePath = FilePath::fromString(targetFile);
bti.projectFilePath = FilePath::fromString(projectFile);
bti.isQtcRunnable = isQtcRunnable; // Fixed up below.
bti.usesTerminal = usesTerminal;
- bti.displayName = bti.buildKey;
+ bti.displayName = productData.value("full-display-name").toString();
bti.runEnvModifier = [targetFile, productData, this](Utils::Environment &env, bool usingLibraryPaths) {
const QString productName = productData.value("full-display-name").toString();
if (session()->projectData().isEmpty())
diff --git a/src/plugins/qbsprojectmanager/qbssettings.cpp b/src/plugins/qbsprojectmanager/qbssettings.cpp
index 22d5059f4b3..34831b6cbe1 100644
--- a/src/plugins/qbsprojectmanager/qbssettings.cpp
+++ b/src/plugins/qbsprojectmanager/qbssettings.cpp
@@ -103,6 +103,11 @@ void QbsSettings::setSettingsData(const QbsSettingsData &settings)
}
}
+QbsSettingsData QbsSettings::rawSettingsData()
+{
+ return instance().m_settings;
+}
+
QbsSettings::QbsSettings()
{
loadSettings();
@@ -148,8 +153,8 @@ public:
void apply()
{
- QbsSettingsData settings;
- if (m_qbsExePathChooser.isValid())
+ QbsSettingsData settings = QbsSettings::rawSettingsData();
+ if (m_qbsExePathChooser.fileName() != QbsSettings::qbsExecutableFilePath())
settings.qbsExecutableFilePath = m_qbsExePathChooser.fileName();
settings.defaultInstallDirTemplate = m_defaultInstallDirLineEdit.text();
settings.useCreatorSettings = m_settingsDirCheckBox.isChecked();
diff --git a/src/plugins/qbsprojectmanager/qbssettings.h b/src/plugins/qbsprojectmanager/qbssettings.h
index f5e2bd343c3..490c9c57433 100644
--- a/src/plugins/qbsprojectmanager/qbssettings.h
+++ b/src/plugins/qbsprojectmanager/qbssettings.h
@@ -54,6 +54,7 @@ public:
static QString qbsSettingsBaseDir();
static void setSettingsData(const QbsSettingsData &settings);
+ static QbsSettingsData rawSettingsData();
signals:
void settingsChanged();
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index 35141a58e18..d28b390d54d 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -1232,15 +1232,11 @@ void QmakeBuildSystem::testToolChain(ToolChain *tc, const FilePath &path) const
const Utils::FilePath expected = tc->compilerCommand();
- Environment env = Environment::systemEnvironment();
Target *t = target();
QTC_ASSERT(t, return);
- Kit *k = t->kit();
- if (BuildConfiguration *bc = t->activeBuildConfiguration())
- env = bc->environment();
- else
- k->addToEnvironment(env);
+ QTC_ASSERT(m_buildConfiguration, return);
+ Environment env = m_buildConfiguration->environment();
if (env.isSameExecutable(path.toString(), expected.toString()))
return;
@@ -1261,7 +1257,9 @@ void QmakeBuildSystem::testToolChain(ToolChain *tc, const FilePath &path) const
"\"%1\" is used by qmake, but \"%2\" is configured in the kit.\n"
"Please update your kit (%3) or choose a mkspec for qmake that matches "
"your target environment better.")
- .arg(path.toUserOutput()).arg(expected.toUserOutput()).arg(k->displayName())));
+ .arg(path.toUserOutput())
+ .arg(expected.toUserOutput())
+ .arg(t->kit()->displayName())));
m_toolChainWarnings.insert(pair);
}
diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp
index 1f2ba590de0..f4df59dd89d 100644
--- a/src/plugins/qmakeprojectmanager/qmakestep.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp
@@ -736,14 +736,9 @@ void QMakeStepConfigWidget::updateSummaryLabel()
abisChanged();
}
- // We don't want the full path to the .pro file
- const QString args = m_step->allArguments(
- qtVersion,
- QMakeStep::ArgumentFlag::OmitProjectPath
- | QMakeStep::ArgumentFlag::Expand);
- // And we only use the .pro filename not the full path
const QString program = qtVersion->qmakeCommand().fileName();
- setSummaryText(tr("<b>qmake:</b> %1 %2").arg(program, args));
+ setSummaryText(tr("<b>qmake:</b> %1 %2").arg(program,
+ m_step->project()->projectFilePath().fileName()));
}
void QMakeStepConfigWidget::updateEffectiveQMakeCall()
diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt
index 1e8fcdc48aa..82c26c43adc 100644
--- a/src/plugins/qmldesigner/CMakeLists.txt
+++ b/src/plugins/qmldesigner/CMakeLists.txt
@@ -1,6 +1,6 @@
add_qtc_plugin(QmlDesigner
DEPENDS
- QmlJS LanguageUtils QmlEditorWidgets
+ QmlJS LanguageUtils QmlEditorWidgets AdvancedDockingSystem
Qt5::QuickWidgets Qt5::CorePrivate
DEFINES
DESIGNER_CORE_LIBRARY
@@ -141,9 +141,10 @@ extend_qtc_plugin(QmlDesigner
changeselectioncommand.cpp changeselectioncommand.h
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
update3dviewstatecommand.cpp update3dviewstatecommand.h
- enable3dviewcommand.cpp enable3dviewcommand.h
view3dclosedcommand.cpp view3dclosedcommand.h
puppettocreatorcommand.cpp puppettocreatorcommand.h
+ inputeventcommand.cpp inputeventcommand.h
+ view3dactioncommand.cpp view3dactioncommand.h
)
extend_qtc_plugin(QmlDesigner
@@ -195,6 +196,16 @@ extend_qtc_plugin(QmlDesigner
)
extend_qtc_plugin(QmlDesigner
+ SOURCES_PREFIX components/edit3d
+ SOURCES
+ edit3dview.cpp edit3dview.h
+ edit3dwidget.cpp edit3dwidget.h
+ edit3dcanvas.cpp edit3dcanvas.h
+ edit3dactions.cpp edit3dactions.h
+ edit3d.qrc
+)
+
+extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX components/formeditor
SOURCES
abstractcustomtool.cpp abstractcustomtool.h
diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp
index cd32560d444..c119dfdca1e 100644
--- a/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp
+++ b/src/plugins/qmldesigner/components/annotationeditor/annotationeditor.cpp
@@ -66,7 +66,8 @@ void AnnotationEditor::showWidget()
m_dialog->setAttribute(Qt::WA_DeleteOnClose);
- m_dialog->open();
+ m_dialog->show();
+ m_dialog->raise();
}
void AnnotationEditor::showWidget(int x, int y)
diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp
index ca91f308ea9..dd234a074cb 100644
--- a/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp
+++ b/src/plugins/qmldesigner/components/annotationeditor/annotationeditordialog.cpp
@@ -30,7 +30,8 @@
#include "ui_annotationcommenttab.h"
-#include <timelineicons.h> //replace timeline icons with our own?
+#include <timelineicons.h>
+#include <utils/qtcassert.h>
#include <QObject>
#include <QToolBar>
@@ -47,9 +48,9 @@ AnnotationEditorDialog::AnnotationEditorDialog(QWidget *parent, const QString &t
{
ui->setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowFlag(Qt::Tool, true);
setWindowTitle(titleString);
+ setModal(true);
connect(this, &QDialog::accepted, this, &AnnotationEditorDialog::acceptedClicked);
@@ -67,8 +68,10 @@ AnnotationEditorDialog::AnnotationEditorDialog(QWidget *parent, const QString &t
connect(commentRemoveAction, &QAction::triggered, this, [this]() {
- if (ui->tabWidget->count() == 0) //it is not even supposed to happen but lets be sure
+ if (ui->tabWidget->count() == 0) { //it is not even supposed to happen but lets be sure
+ QTC_ASSERT(true, return);
return;
+ }
int currentIndex = ui->tabWidget->currentIndex();
QString currentTitle = ui->tabWidget->tabText(currentIndex);
@@ -202,11 +205,18 @@ void AnnotationEditorDialog::addCommentTab(const Comment &comment)
{
auto commentTab = new AnnotationCommentTab();
commentTab->setComment(comment);
- int tabIndex = ui->tabWidget->addTab(commentTab, comment.title());
- if (comment.title().isEmpty())
- ui->tabWidget->setTabText(tabIndex,
- (defaultTabName + " " + QString::number(tabIndex+1)));
+ QString tabTitle(comment.title());
+ int tabIndex = ui->tabWidget->addTab(commentTab, tabTitle);
+ ui->tabWidget->setCurrentIndex(tabIndex);
+
+ if (tabTitle.isEmpty()) {
+ const QString appendix = ((tabIndex > 0) ? QString::number(tabIndex+1) : "");
+
+ tabTitle = QString("%1 %2").arg(defaultTabName).arg(appendix);
+
+ ui->tabWidget->setTabText(tabIndex, tabTitle);
+ }
connect(commentTab, &AnnotationCommentTab::titleChanged,
this, &AnnotationEditorDialog::commentTitleChanged);
@@ -230,18 +240,7 @@ void AnnotationEditorDialog::deleteAllTabs()
void AnnotationEditorDialog::tabChanged(int index)
{
- QWidget *w = ui->tabWidget->widget(index);
- AnnotationCommentTab *tab = nullptr;
- if (w)
- tab = reinterpret_cast<AnnotationCommentTab*>(w);
-
- if (tab) {
- //this tab order resetting doesn't work
- QWidget::setTabOrder(ui->targetIdEdit, ui->customIdEdit);
- QWidget::setTabOrder(ui->customIdEdit, ui->tabWidget);
- QWidget::setTabOrder(ui->tabWidget, tab);
- QWidget::setTabOrder(tab, ui->buttonBox);
- }
+ (void) index;
}
} //namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationtool.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationtool.cpp
index 522505dd9ca..7cb0bdfa19f 100644
--- a/src/plugins/qmldesigner/components/annotationeditor/annotationtool.cpp
+++ b/src/plugins/qmldesigner/components/annotationeditor/annotationtool.cpp
@@ -163,19 +163,20 @@ void AnnotationTool::selectedItemsChanged(const QList<FormEditorItem*> &itemList
if (!itemList.isEmpty()) {
m_formEditorItem = itemList.constFirst();
- m_oldCustomId = m_formEditorItem->qmlItemNode().modelNode().customId();
- m_oldAnnotation = m_formEditorItem->qmlItemNode().modelNode().annotation();
+ ModelNode itemModelNode = m_formEditorItem->qmlItemNode().modelNode();
+ m_oldCustomId = itemModelNode.customId();
+ m_oldAnnotation = itemModelNode.annotation();
if (m_annotationEditor.isNull()) {
m_annotationEditor = new AnnotationEditorDialog(view()->formEditorWidget()->parentWidget(),
- m_formEditorItem->qmlItemNode().modelNode().displayName(),
+ itemModelNode.displayName(),
m_oldCustomId, m_oldAnnotation);
connect(m_annotationEditor, &AnnotationEditorDialog::accepted, this, &AnnotationTool::annotationDialogAccepted);
connect(m_annotationEditor, &QDialog::rejected, this, &AnnotationTool::annotationDialogRejected);
-// connect(m_colorDialog.data(), &QColorDialog::currentColorChanged, this, &ColorTool::currentColorChanged);
- m_annotationEditor->exec();
+ m_annotationEditor->show();
+ m_annotationEditor->raise();
}
} else {
view()->changeToSelectionTool();
diff --git a/src/plugins/qmldesigner/components/bindingeditor/bindingeditordialog.cpp b/src/plugins/qmldesigner/components/bindingeditor/bindingeditordialog.cpp
index f368aee38b9..3e6d8389903 100644
--- a/src/plugins/qmldesigner/components/bindingeditor/bindingeditordialog.cpp
+++ b/src/plugins/qmldesigner/components/bindingeditor/bindingeditordialog.cpp
@@ -45,7 +45,6 @@ BindingEditorDialog::BindingEditorDialog(QWidget *parent, DialogType type)
: QDialog(parent)
, m_dialogType(type)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowFlag(Qt::Tool, true);
setWindowTitle(defaultTitle());
setModal(false);
diff --git a/src/plugins/qmldesigner/components/componentcore/actioninterface.h b/src/plugins/qmldesigner/components/componentcore/actioninterface.h
index ee120131f79..026bb707a9d 100644
--- a/src/plugins/qmldesigner/components/componentcore/actioninterface.h
+++ b/src/plugins/qmldesigner/components/componentcore/actioninterface.h
@@ -42,7 +42,8 @@ public:
ContextMenuAction,
ToolBarAction,
Action,
- FormEditorAction
+ FormEditorAction,
+ Edit3DAction
};
enum Priorities {
diff --git a/src/plugins/qmldesigner/components/componentcore/addimagesdialog.cpp b/src/plugins/qmldesigner/components/componentcore/addimagesdialog.cpp
index 10a992ae1b7..062403d39f7 100644
--- a/src/plugins/qmldesigner/components/componentcore/addimagesdialog.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/addimagesdialog.cpp
@@ -95,7 +95,6 @@ QString AddImagesDialog::getDirectory(const QStringList &fileNames, const QStrin
QString directory = defaultDirectory;
dialog->setModal(true);
- dialog->setWindowFlags(dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint);
dialog->setWindowTitle(QCoreApplication::translate("AddImageToResources","Add Resources"));
QTableWidget *table = createFilesTable(fileNames);
table->setParent(dialog);
diff --git a/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp b/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp
index 6d724d12ef2..2f809712107 100644
--- a/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/zoomaction.cpp
@@ -30,10 +30,12 @@
namespace QmlDesigner {
+const int defaultZoomIndex = 11;
+
ZoomAction::ZoomAction(QObject *parent)
: QWidgetAction(parent),
m_zoomLevel(1.0),
- m_currentComboBoxIndex(8)
+ m_currentComboBoxIndex(defaultZoomIndex)
{
}
@@ -58,7 +60,7 @@ void ZoomAction::zoomOut()
void ZoomAction::resetZoomLevel()
{
m_zoomLevel = 1.0;
- m_currentComboBoxIndex = 8;
+ m_currentComboBoxIndex = defaultZoomIndex;
emit reseted();
}
@@ -72,6 +74,9 @@ QWidget *ZoomAction::createWidget(QWidget *parent)
{
auto comboBox = new QComboBox(parent);
+ /*
+ * When add zoom levels do not forget to update defaultZoomIndex
+ */
if (m_comboBoxModel.isNull()) {
m_comboBoxModel = comboBox->model();
comboBox->addItem(QLatin1String("1 %"), 0.01);
diff --git a/src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.cpp b/src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.cpp
index 9de928ae906..49f47dfef27 100644
--- a/src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.cpp
+++ b/src/plugins/qmldesigner/components/connectioneditor/addnewbackenddialog.cpp
@@ -34,7 +34,6 @@ AddNewBackendDialog::AddNewBackendDialog(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::AddNewBackendDialog)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
connect(m_ui->comboBox, &QComboBox::currentTextChanged, this, &AddNewBackendDialog::invalidate);
diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp
index 3777de72910..30aaf2b0045 100644
--- a/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp
+++ b/src/plugins/qmldesigner/components/connectioneditor/connectionviewwidget.cpp
@@ -87,8 +87,6 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) :
QStyle *style = QStyleFactory::create("fusion");
setStyle(style);
- setStyleSheet(Theme::replaceCssColors(QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/connectionview/stylesheet.css")))));
-
//ui->tabWidget->tabBar()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
ui->tabBar->setUsesScrollButtons(true);
@@ -105,13 +103,9 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) :
ui->tabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
- const QString themedScrollBarCss = Theme::replaceCssColors(
- QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))));
-
- ui->connectionView->setStyleSheet(themedScrollBarCss);
- ui->bindingView->setStyleSheet(themedScrollBarCss);
- ui->dynamicPropertiesView->setStyleSheet(themedScrollBarCss);
- ui->backendView->setStyleSheet(themedScrollBarCss);
+ QByteArray sheet = Utils::FileReader::fetchQrc(":/connectionview/stylesheet.css");
+ sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css");
+ setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(sheet)));
connect(ui->tabBar, &QTabBar::currentChanged,
ui->stackedWidget, &QStackedWidget::setCurrentIndex);
diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp
index d0467db251d..2351793f8d5 100644
--- a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp
+++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.cpp
@@ -121,7 +121,7 @@ void GraphicsScene::handleMoved(KeyframeItem *frame,
}
}
-void GraphicsScene::setPinned(int id, bool pinned)
+void GraphicsScene::setPinned(uint id, bool pinned)
{
const auto itemList = items();
for (auto *item : itemList) {
diff --git a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h
index 088f86e4e1f..4569ace37ab 100644
--- a/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h
+++ b/src/plugins/qmldesigner/components/curveeditor/detail/graphicsscene.h
@@ -69,7 +69,7 @@ public:
void handleMoved(KeyframeItem *frame, HandleSlot handle, double angle, double deltaLength);
- void setPinned(int id, bool pinned);
+ void setPinned(uint id, bool pinned);
std::vector<CurveItem *> takePinnedItems();
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3d.pri b/src/plugins/qmldesigner/components/edit3d/edit3d.pri
new file mode 100644
index 00000000000..fbef3175286
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3d.pri
@@ -0,0 +1,12 @@
+VPATH += $$PWD
+SOURCES += edit3dwidget.cpp \
+ edit3dview.cpp \
+ edit3dcanvas.cpp \
+ edit3dactions.cpp
+
+HEADERS += edit3dwidget.h \
+ edit3dview.h \
+ edit3dcanvas.h \
+ edit3dactions.h
+
+RESOURCES += edit3d.qrc
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3d.qrc b/src/plugins/qmldesigner/components/edit3d/edit3d.qrc
new file mode 100644
index 00000000000..1719b8ed63a
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3d.qrc
@@ -0,0 +1,34 @@
+<RCC>
+ <qresource prefix="/edit3d">
+ <file>images/edit_light_off.png</file>
+ <file>images/edit_light_off@2x.png</file>
+ <file>images/edit_light_on.png</file>
+ <file>images/edit_light_on@2x.png</file>
+ <file>images/fit_active.png</file>
+ <file>images/fit_active@2x.png</file>
+ <file>images/global.png</file>
+ <file>images/global@2x.png</file>
+ <file>images/group_selection_selected.png</file>
+ <file>images/group_selection_selected@2x.png</file>
+ <file>images/item_selection_selected.png</file>
+ <file>images/item_selection_selected@2x.png</file>
+ <file>images/local.png</file>
+ <file>images/local@2x.png</file>
+ <file>images/move_active.png</file>
+ <file>images/move_active@2x.png</file>
+ <file>images/move_selected.png</file>
+ <file>images/move_selected@2x.png</file>
+ <file>images/ortho.png</file>
+ <file>images/ortho@2x.png</file>
+ <file>images/persp.png</file>
+ <file>images/persp@2x.png</file>
+ <file>images/rotate_active.png</file>
+ <file>images/rotate_active@2x.png</file>
+ <file>images/rotate_selected.png</file>
+ <file>images/rotate_selected@2x.png</file>
+ <file>images/scale_active.png</file>
+ <file>images/scale_active@2x.png</file>
+ <file>images/scale_selected.png</file>
+ <file>images/scale_selected@2x.png</file>
+ </qresource>
+</RCC>
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dactions.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dactions.cpp
new file mode 100644
index 00000000000..a249f78a126
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dactions.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "edit3dactions.h"
+#include "edit3dview.h"
+#include "edit3dwidget.h"
+
+#include <viewmanager.h>
+#include <nodeinstanceview.h>
+#include <qmldesignerplugin.h>
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+Edit3DActionTemplate::Edit3DActionTemplate(const QString &description,
+ SelectionContextOperation action,
+ View3DActionCommand::Type type)
+ : DefaultAction(description),
+ m_action(action),
+ m_type(type)
+{ }
+
+void Edit3DActionTemplate::actionTriggered(bool b)
+{
+ if (m_type != View3DActionCommand::Empty) {
+ QmlDesignerPlugin::instance()->viewManager().nodeInstanceView()
+ ->view3DAction(View3DActionCommand(m_type, b));
+ }
+
+ if (m_action)
+ m_action(m_selectionContext);
+}
+
+Edit3DAction::Edit3DAction(const QByteArray &menuId, View3DActionCommand::Type type,
+ const QString &description, const QKeySequence &key, bool checkable,
+ bool checked, const QIcon &iconOff, const QIcon &iconOn,
+ SelectionContextOperation selectionAction)
+ : AbstractAction(new Edit3DActionTemplate(description, selectionAction, type))
+ , m_menuId(menuId)
+{
+ action()->setShortcut(key);
+ action()->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ action()->setCheckable(checkable);
+ action()->setChecked(checked);
+ if (checkable) {
+ QIcon onOffIcon;
+ const auto onAvail = iconOn.availableSizes(); // Assume both icons have same sizes available
+ for (const auto &size : onAvail) {
+ onOffIcon.addPixmap(iconOn.pixmap(size), QIcon::Normal, QIcon::On);
+ onOffIcon.addPixmap(iconOff.pixmap(size), QIcon::Normal, QIcon::Off);
+ }
+ action()->setIcon(onOffIcon);
+ } else {
+ action()->setIcon(iconOff);
+ }
+}
+
+QByteArray Edit3DAction::category() const
+{
+ return QByteArray();
+}
+
+bool Edit3DAction::isVisible(const SelectionContext &selectionContext) const
+{
+ return true;
+}
+
+bool Edit3DAction::isEnabled(const SelectionContext &selectionContext) const
+{
+ return isVisible(selectionContext);
+}
+
+}
+
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dactions.h b/src/plugins/qmldesigner/components/edit3d/edit3dactions.h
new file mode 100644
index 00000000000..1973e22491d
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dactions.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+
+#include "view3dactioncommand.h"
+
+#include <abstractaction.h>
+
+#include <QtWidgets/qaction.h>
+#include <QtGui/qicon.h>
+
+namespace QmlDesigner {
+
+using SelectionContextOperation = std::function<void(const SelectionContext &)>;
+
+class Edit3DActionTemplate : public DefaultAction
+{
+
+public:
+ Edit3DActionTemplate(const QString &description, SelectionContextOperation action,
+ View3DActionCommand::Type type);
+
+ void actionTriggered(bool b) override;
+
+ SelectionContextOperation m_action;
+ View3DActionCommand::Type m_type;
+};
+
+class Edit3DAction : public AbstractAction
+{
+public:
+ Edit3DAction(const QByteArray &menuId, View3DActionCommand::Type type,
+ const QString &description, const QKeySequence &key, bool checkable, bool checked,
+ const QIcon &iconOff, const QIcon &iconOn,
+ SelectionContextOperation selectionAction = nullptr);
+
+ QByteArray category() const override;
+
+ int priority() const override
+ {
+ return CustomActionsPriority;
+ }
+
+ Type type() const override
+ {
+ return ActionInterface::Edit3DAction;
+ }
+
+ QByteArray menuId() const override
+ {
+ return m_menuId;
+ }
+
+protected:
+ bool isVisible(const SelectionContext &selectionContext) const override;
+ bool isEnabled(const SelectionContext &selectionContext) const override;
+
+private:
+ QByteArray m_menuId;
+};
+
+} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp
new file mode 100644
index 00000000000..8a1c049907b
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "edit3dcanvas.h"
+#include "edit3dview.h"
+#include "edit3dwidget.h"
+
+#include "nodehints.h"
+#include "qmlvisualnode.h"
+
+#include <QtCore/qmimedata.h>
+#include <QPainter>
+
+namespace QmlDesigner {
+
+Edit3DCanvas::Edit3DCanvas(Edit3DWidget *parent)
+ : QWidget(parent),
+ m_parent(parent)
+{
+ setMouseTracking(true);
+ setAcceptDrops(true);
+}
+
+void Edit3DCanvas::updateRenderImage(const QImage &img)
+{
+ m_image = img;
+ update();
+}
+
+void Edit3DCanvas::updateActiveScene(qint32 activeScene)
+{
+ m_activeScene = activeScene;
+}
+
+void Edit3DCanvas::mousePressEvent(QMouseEvent *e)
+{
+ m_parent->view()->sendInputEvent(e);
+ QWidget::mousePressEvent(e);
+}
+
+void Edit3DCanvas::mouseReleaseEvent(QMouseEvent *e)
+{
+ m_parent->view()->sendInputEvent(e);
+ QWidget::mouseReleaseEvent(e);
+}
+
+void Edit3DCanvas::mouseDoubleClickEvent(QMouseEvent *e)
+{
+ m_parent->view()->sendInputEvent(e);
+ QWidget::mouseDoubleClickEvent(e);
+}
+
+void Edit3DCanvas::mouseMoveEvent(QMouseEvent *e)
+{
+ m_parent->view()->sendInputEvent(e);
+ QWidget::mouseMoveEvent(e);
+}
+
+void Edit3DCanvas::wheelEvent(QWheelEvent *e)
+{
+ m_parent->view()->sendInputEvent(e);
+ QWidget::wheelEvent(e);
+}
+
+void Edit3DCanvas::paintEvent(QPaintEvent *e)
+{
+ Q_UNUSED(e)
+
+ QWidget::paintEvent(e);
+
+ QPainter painter(this);
+
+ painter.drawImage(rect(), m_image, rect());
+}
+
+void Edit3DCanvas::resizeEvent(QResizeEvent *e)
+{
+ m_parent->view()->edit3DViewResized(e->size());
+}
+
+void Edit3DCanvas::dragEnterEvent(QDragEnterEvent *e)
+{
+ QByteArray data = e->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"));
+ if (!data.isEmpty()) {
+ QDataStream stream(data);
+ stream >> m_itemLibraryEntry;
+ bool canDrop = NodeHints::fromItemLibraryEntry(m_itemLibraryEntry).canBeDroppedInView3D();
+
+ if (canDrop)
+ e->accept();
+ }
+}
+
+void Edit3DCanvas::dropEvent(QDropEvent *e)
+{
+ Q_UNUSED(e)
+
+ QmlVisualNode::createQmlVisualNode(m_parent->view(), m_itemLibraryEntry, m_activeScene, {});
+}
+
+}
+
+
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.h b/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.h
new file mode 100644
index 00000000000..48b05789476
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dcanvas.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+
+#include "itemlibraryinfo.h"
+
+#include <QtWidgets/qwidget.h>
+#include <QtGui/qimage.h>
+#include <QtGui/qevent.h>
+#include <QtCore/qpointer.h>
+
+namespace QmlDesigner {
+
+class Edit3DWidget;
+
+class Edit3DCanvas : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Edit3DCanvas(Edit3DWidget *parent);
+
+ void updateRenderImage(const QImage &img);
+ void updateActiveScene(qint32 activeScene);
+
+protected:
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void mouseDoubleClickEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void wheelEvent(QWheelEvent *e) override;
+ void paintEvent(QPaintEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
+ void dragEnterEvent(QDragEnterEvent *e) override;
+ void dropEvent(QDropEvent *e) override;
+
+private:
+ QPointer<Edit3DWidget> m_parent;
+ QImage m_image;
+ qint32 m_activeScene;
+ ItemLibraryEntry m_itemLibraryEntry;
+};
+
+} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp
new file mode 100644
index 00000000000..8aefce79403
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.cpp
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "edit3dview.h"
+#include "edit3dwidget.h"
+#include "edit3dcanvas.h"
+#include "edit3dactions.h"
+#include "designmodewidget.h"
+
+#include <nodeinstanceview.h>
+#include <designeractionmanager.h>
+#include <qmldesignerplugin.h>
+#include <designersettings.h>
+#include <qmldesignerconstants.h>
+#include <viewmanager.h>
+#include <qmldesignericons.h>
+#include <utils/utilsicons.h>
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+Edit3DView::Edit3DView(QObject *parent)
+ : AbstractView(parent)
+{
+}
+
+Edit3DView::~Edit3DView()
+{
+}
+
+void Edit3DView::createEdit3DWidget()
+{
+ createEdit3DActions();
+ m_edit3DWidget = new Edit3DWidget(this);
+}
+
+WidgetInfo Edit3DView::widgetInfo()
+{
+ if (!m_edit3DWidget)
+ createEdit3DWidget();
+
+ return createWidgetInfo(m_edit3DWidget.data(), nullptr, "Editor3D", WidgetInfo::CentralPane, 0, tr("3D Editor"), DesignerWidgetFlags::IgnoreErrors);
+}
+
+Edit3DWidget *Edit3DView::edit3DWidget() const
+{
+ return m_edit3DWidget.data();
+}
+
+void Edit3DView::renderImage3DChanged(const QImage &img)
+{
+ edit3DWidget()->canvas()->updateRenderImage(img);
+}
+
+void Edit3DView::updateActiveScene3D(const QVariantMap &sceneState)
+{
+ const QString sceneKey = QStringLiteral("sceneInstanceId");
+ const QString selectKey = QStringLiteral("groupSelect");
+ const QString transformKey = QStringLiteral("groupTransform");
+ const QString perspectiveKey = QStringLiteral("usePerspective");
+ const QString orientationKey = QStringLiteral("globalOrientation");
+ const QString editLightKey = QStringLiteral("showEditLight");
+
+ if (sceneState.contains(sceneKey))
+ edit3DWidget()->canvas()->updateActiveScene(sceneState[sceneKey].value<qint32>());
+
+ if (sceneState.contains(selectKey))
+ m_selectionModeAction->action()->setChecked(sceneState[selectKey].toInt() == 0);
+ else
+ m_selectionModeAction->action()->setChecked(false);
+
+ if (sceneState.contains(transformKey)) {
+ const int tool = sceneState[transformKey].toInt();
+ if (tool == 0)
+ m_moveToolAction->action()->setChecked(true);
+ else if (tool == 1)
+ m_rotateToolAction->action()->setChecked(true);
+ else
+ m_scaleToolAction->action()->setChecked(true);
+ } else {
+ m_moveToolAction->action()->setChecked(true);
+ }
+
+ if (sceneState.contains(perspectiveKey))
+ m_cameraModeAction->action()->setChecked(sceneState[perspectiveKey].toBool());
+ else
+ m_cameraModeAction->action()->setChecked(false);
+ if (sceneState.contains(orientationKey))
+ m_orientationModeAction->action()->setChecked(sceneState[orientationKey].toBool());
+ else
+ m_orientationModeAction->action()->setChecked(false);
+ if (sceneState.contains(editLightKey))
+ m_editLightAction->action()->setChecked(sceneState[editLightKey].toBool());
+ else
+ m_editLightAction->action()->setChecked(false);
+}
+
+void Edit3DView::sendInputEvent(QInputEvent *e) const
+{
+ nodeInstanceView()->sendInputEvent(e);
+}
+
+void Edit3DView::edit3DViewResized(const QSize &size) const
+{
+ nodeInstanceView()->edit3DViewResized(size);
+}
+
+QSize Edit3DView::canvasSize() const
+{
+ if (!m_edit3DWidget.isNull() && m_edit3DWidget->canvas())
+ return m_edit3DWidget->canvas()->size();
+
+ return {};
+}
+
+void Edit3DView::createEdit3DActions()
+{
+ m_selectionModeAction
+ = new Edit3DAction(
+ "Edit3DSelectionModeToggle", View3DActionCommand::SelectionModeToggle,
+ QCoreApplication::translate("SelectionModeToggleAction", "Toggle Group / Single Selection Mode"),
+ QKeySequence(Qt::Key_Q), true, false, Icons::EDIT3D_SELECTION_MODE_OFF.icon(),
+ Icons::EDIT3D_SELECTION_MODE_ON.icon());
+
+ m_moveToolAction
+ = new Edit3DAction(
+ "Edit3DMoveTool", View3DActionCommand::MoveTool,
+ QCoreApplication::translate("MoveToolAction", "Activate Move Tool"),
+ QKeySequence(Qt::Key_W), true, true, Icons::EDIT3D_MOVE_TOOL_OFF.icon(),
+ Icons::EDIT3D_MOVE_TOOL_ON.icon());
+
+ m_rotateToolAction
+ = new Edit3DAction(
+ "Edit3DRotateTool", View3DActionCommand::RotateTool,
+ QCoreApplication::translate("RotateToolAction", "Activate Rotate Tool"),
+ QKeySequence(Qt::Key_E), true, false, Icons::EDIT3D_ROTATE_TOOL_OFF.icon(),
+ Icons::EDIT3D_ROTATE_TOOL_ON.icon());
+
+ m_scaleToolAction
+ = new Edit3DAction(
+ "Edit3DScaleTool", View3DActionCommand::ScaleTool,
+ QCoreApplication::translate("ScaleToolAction", "Activate Scale Tool"),
+ QKeySequence(Qt::Key_R), true, false, Icons::EDIT3D_SCALE_TOOL_OFF.icon(),
+ Icons::EDIT3D_SCALE_TOOL_ON.icon());
+
+ m_fitAction = new Edit3DAction(
+ "Edit3DFitToView", View3DActionCommand::FitToView,
+ QCoreApplication::translate("FitToViewAction", "Fit Selected Object To View"),
+ QKeySequence(Qt::Key_F), false, false, Icons::EDIT3D_FIT_SELECTED_OFF.icon(), {});
+
+ m_cameraModeAction
+ = new Edit3DAction(
+ "Edit3DCameraToggle", View3DActionCommand::CameraToggle,
+ QCoreApplication::translate("CameraToggleAction", "Toggle Perspective / Orthographic Edit Camera"),
+ QKeySequence(Qt::Key_T), true, false, Icons::EDIT3D_EDIT_CAMERA_OFF.icon(),
+ Icons::EDIT3D_EDIT_CAMERA_ON.icon());
+
+ m_orientationModeAction
+ = new Edit3DAction(
+ "Edit3DOrientationToggle", View3DActionCommand::OrientationToggle,
+ QCoreApplication::translate("OrientationToggleAction", "Toggle Global / Local Orientation"),
+ QKeySequence(Qt::Key_Y), true, false, Icons::EDIT3D_ORIENTATION_OFF.icon(),
+ Icons::EDIT3D_ORIENTATION_ON.icon());
+
+ m_editLightAction
+ = new Edit3DAction(
+ "Edit3DEditLightToggle", View3DActionCommand::EditLightToggle,
+ QCoreApplication::translate("EditLightToggleAction", "Toggle Edit Light On / Off"),
+ QKeySequence(Qt::Key_U), true, false, Icons::EDIT3D_LIGHT_OFF.icon(),
+ Icons::EDIT3D_LIGHT_ON.icon());
+
+ SelectionContextOperation resetTrigger = [this](const SelectionContext &) {
+ setCurrentStateNode(rootModelNode());
+ resetPuppet();
+ };
+ m_resetAction
+ = new Edit3DAction(
+ "Edit3DResetView", View3DActionCommand::Empty,
+ QCoreApplication::translate("ResetView", "Reset View"),
+ QKeySequence(Qt::Key_P), false, false, Utils::Icons::RESET_TOOLBAR.icon(), {},
+ resetTrigger);
+
+ m_leftActions << m_selectionModeAction;
+ m_leftActions << nullptr; // Null indicates separator
+ m_leftActions << nullptr; // Second null after separator indicates an exclusive group
+ m_leftActions << m_moveToolAction;
+ m_leftActions << m_rotateToolAction;
+ m_leftActions << m_scaleToolAction;
+ m_leftActions << nullptr;
+ m_leftActions << m_fitAction;
+ m_leftActions << nullptr;
+ m_leftActions << m_cameraModeAction;
+ m_leftActions << m_orientationModeAction;
+ m_leftActions << m_editLightAction;
+
+ m_rightActions << m_resetAction;
+
+ // TODO: Registering actions to action manager causes conflicting shortcuts in form editor.
+ // Registration commented out until UX defines non-conflicting shortcuts.
+ // Also, actions creation needs to be somehow triggered before action manager registers
+ // actions to creator.
+// DesignerActionManager &actionManager = QmlDesignerPlugin::instance()->designerActionManager();
+// for (auto action : qAsConst(m_leftActions)) {
+// if (action)
+// actionManager.addDesignerAction(action);
+// }
+// for (auto action : qAsConst(m_rightActions)) {
+// if (action)
+// actionManager.addDesignerAction(action);
+// }
+}
+
+QVector<Edit3DAction *> Edit3DView::leftActions() const
+{
+ return m_leftActions;
+}
+
+QVector<Edit3DAction *> Edit3DView::rightActions() const
+{
+ return m_rightActions;
+}
+
+}
+
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dview.h b/src/plugins/qmldesigner/components/edit3d/edit3dview.h
new file mode 100644
index 00000000000..64ffedb1540
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dview.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+
+#include "view3dactioncommand.h"
+
+#include <abstractview.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qimage.h>
+#include <QtCore/qvector.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qsize.h>
+
+QT_BEGIN_NAMESPACE
+QT_END_NAMESPACE
+
+namespace QmlDesigner {
+
+class Edit3DWidget;
+class Edit3DAction;
+
+class QMLDESIGNERCORE_EXPORT Edit3DView : public AbstractView
+{
+ Q_OBJECT
+
+public:
+ Edit3DView(QObject *parent = nullptr);
+ ~Edit3DView() override;
+
+ WidgetInfo widgetInfo() override;
+
+ Edit3DWidget *edit3DWidget() const;
+
+ void renderImage3DChanged(const QImage &img) override;
+ void updateActiveScene3D(const QVariantMap &sceneState) override;
+
+ void sendInputEvent(QInputEvent *e) const;
+ void edit3DViewResized(const QSize &size) const;
+
+ QSize canvasSize() const;
+
+ void createEdit3DActions();
+ QVector<Edit3DAction *> leftActions() const;
+ QVector<Edit3DAction *> rightActions() const;
+
+protected:
+
+private:
+ void createEdit3DWidget();
+
+ QPointer<Edit3DWidget> m_edit3DWidget;
+ QVector<Edit3DAction *> m_leftActions;
+ QVector<Edit3DAction *> m_rightActions;
+ Edit3DAction *m_selectionModeAction;
+ Edit3DAction *m_moveToolAction;
+ Edit3DAction *m_rotateToolAction;
+ Edit3DAction *m_scaleToolAction;
+ Edit3DAction *m_fitAction;
+ Edit3DAction *m_cameraModeAction;
+ Edit3DAction *m_orientationModeAction;
+ Edit3DAction *m_editLightAction;
+ Edit3DAction *m_resetAction;
+};
+
+} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
new file mode 100644
index 00000000000..b21bb3d46ec
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "edit3dwidget.h"
+#include "edit3dview.h"
+#include "edit3dcanvas.h"
+#include "edit3dactions.h"
+
+#include "qmldesignerplugin.h"
+#include "designersettings.h"
+#include "qmldesignerconstants.h"
+#include "viewmanager.h"
+
+#include <toolbox.h>
+#include <utils/utilsicons.h>
+#include <QVBoxLayout>
+
+namespace QmlDesigner {
+
+Edit3DWidget::Edit3DWidget(Edit3DView *view) :
+ m_view(view)
+{
+ setMouseTracking(true);
+ setFocusPolicy(Qt::WheelFocus);
+
+ auto fillLayout = new QVBoxLayout(this);
+ fillLayout->setContentsMargins(0, 0, 0, 0);
+ fillLayout->setSpacing(0);
+ setLayout(fillLayout);
+
+ // Initialize toolbar
+ m_toolBox = new ToolBox(this);
+ fillLayout->addWidget(m_toolBox.data());
+
+ // Iterate through view actions. A null action indicates a separator and a second null action
+ // after separator indicates an exclusive group.
+ auto addActionsToToolBox = [this](const QVector<Edit3DAction *> &actions, bool left) {
+ bool previousWasSeparator = true;
+ QActionGroup *group = nullptr;
+ for (auto action : actions) {
+ if (action) {
+ if (group)
+ group->addAction(action->action());
+ addAction(action->action());
+ if (left)
+ m_toolBox->addLeftSideAction(action->action());
+ else
+ m_toolBox->addRightSideAction(action->action());
+ previousWasSeparator = false;
+ } else {
+ if (previousWasSeparator) {
+ group = new QActionGroup(this);
+ previousWasSeparator = false;
+ } else {
+ group = nullptr;
+ auto separator = new QAction(this);
+ separator->setSeparator(true);
+ addAction(separator);
+ m_toolBox->addLeftSideAction(separator);
+ previousWasSeparator = true;
+ }
+ }
+ }
+
+ };
+ addActionsToToolBox(view->leftActions(), true);
+ addActionsToToolBox(view->rightActions(), false);
+
+ // Canvas is used to render the actual edit 3d view
+ m_canvas = new Edit3DCanvas(this);
+ fillLayout->addWidget(m_canvas.data());
+}
+
+Edit3DCanvas *Edit3DWidget::canvas() const
+{
+ return m_canvas.data();
+}
+
+Edit3DView *Edit3DWidget::view() const
+{
+ return m_view.data();
+}
+
+}
diff --git a/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h
index cd9529fbb5a..967713930e4 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/enable3dviewcommand.h
+++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -22,33 +22,32 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
-
#pragma once
-#include <QMetaType>
+#include <QtWidgets/qwidget.h>
+#include <QtCore/qpointer.h>
namespace QmlDesigner {
-class Enable3DViewCommand
+class Edit3DView;
+class Edit3DCanvas;
+class ToolBox;
+
+class Edit3DWidget : public QWidget
{
- friend QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command);
- friend QDebug operator<<(QDebug debug, const Enable3DViewCommand &command);
+ Q_OBJECT
public:
- explicit Enable3DViewCommand(bool enable);
- Enable3DViewCommand() = default;
+ Edit3DWidget(Edit3DView *view);
- bool isEnable() const;
+ Edit3DCanvas *canvas() const;
+ Edit3DView *view() const;
private:
- bool m_enable = true;
+ QPointer<Edit3DView> m_edit3DView;
+ QPointer<Edit3DView> m_view;
+ QPointer<Edit3DCanvas> m_canvas;
+ QPointer<ToolBox> m_toolBox;
};
-QDataStream &operator<<(QDataStream &out, const Enable3DViewCommand &command);
-QDataStream &operator>>(QDataStream &in, Enable3DViewCommand &command);
-
-QDebug operator<<(QDebug debug, const Enable3DViewCommand &command);
-
} // namespace QmlDesigner
-
-Q_DECLARE_METATYPE(QmlDesigner::Enable3DViewCommand)
diff --git a/src/plugins/qmldesigner/components/edit3d/images/edit_light_off.png b/src/plugins/qmldesigner/components/edit3d/images/edit_light_off.png
new file mode 100644
index 00000000000..73e6e92374b
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/edit_light_off.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/edit_light_off@2x.png b/src/plugins/qmldesigner/components/edit3d/images/edit_light_off@2x.png
new file mode 100644
index 00000000000..5166264e16d
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/edit_light_off@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/edit_light_on.png b/src/plugins/qmldesigner/components/edit3d/images/edit_light_on.png
new file mode 100644
index 00000000000..7660c285460
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/edit_light_on.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/edit_light_on@2x.png b/src/plugins/qmldesigner/components/edit3d/images/edit_light_on@2x.png
new file mode 100644
index 00000000000..836bd2a0d59
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/edit_light_on@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/fit_active.png b/src/plugins/qmldesigner/components/edit3d/images/fit_active.png
new file mode 100644
index 00000000000..056e9ec3c8b
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/fit_active.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/fit_active@2x.png b/src/plugins/qmldesigner/components/edit3d/images/fit_active@2x.png
new file mode 100644
index 00000000000..4b05f83d460
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/fit_active@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/global.png b/src/plugins/qmldesigner/components/edit3d/images/global.png
new file mode 100644
index 00000000000..1bd09c680ac
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/global.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/global@2x.png b/src/plugins/qmldesigner/components/edit3d/images/global@2x.png
new file mode 100644
index 00000000000..a2a857fb10c
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/global@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/group_selection_selected.png b/src/plugins/qmldesigner/components/edit3d/images/group_selection_selected.png
new file mode 100644
index 00000000000..bfb848aa384
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/group_selection_selected.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/group_selection_selected@2x.png b/src/plugins/qmldesigner/components/edit3d/images/group_selection_selected@2x.png
new file mode 100644
index 00000000000..f18895dc440
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/group_selection_selected@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/item_selection_selected.png b/src/plugins/qmldesigner/components/edit3d/images/item_selection_selected.png
new file mode 100644
index 00000000000..2b685d3d00a
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/item_selection_selected.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/item_selection_selected@2x.png b/src/plugins/qmldesigner/components/edit3d/images/item_selection_selected@2x.png
new file mode 100644
index 00000000000..eb0051a606e
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/item_selection_selected@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/local.png b/src/plugins/qmldesigner/components/edit3d/images/local.png
new file mode 100644
index 00000000000..0a608f6816e
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/local.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/local@2x.png b/src/plugins/qmldesigner/components/edit3d/images/local@2x.png
new file mode 100644
index 00000000000..a5c931e750f
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/local@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/move_active.png b/src/plugins/qmldesigner/components/edit3d/images/move_active.png
new file mode 100644
index 00000000000..d21d290349c
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/move_active.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/move_active@2x.png b/src/plugins/qmldesigner/components/edit3d/images/move_active@2x.png
new file mode 100644
index 00000000000..bd0827f918c
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/move_active@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/move_selected.png b/src/plugins/qmldesigner/components/edit3d/images/move_selected.png
new file mode 100644
index 00000000000..5c8ce42a758
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/move_selected.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/move_selected@2x.png b/src/plugins/qmldesigner/components/edit3d/images/move_selected@2x.png
new file mode 100644
index 00000000000..fad362a3e6a
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/move_selected@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/ortho.png b/src/plugins/qmldesigner/components/edit3d/images/ortho.png
new file mode 100644
index 00000000000..35b36203fa2
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/ortho.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/ortho@2x.png b/src/plugins/qmldesigner/components/edit3d/images/ortho@2x.png
new file mode 100644
index 00000000000..443c73e444b
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/ortho@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/persp.png b/src/plugins/qmldesigner/components/edit3d/images/persp.png
new file mode 100644
index 00000000000..9a48e763996
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/persp.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/persp@2x.png b/src/plugins/qmldesigner/components/edit3d/images/persp@2x.png
new file mode 100644
index 00000000000..88a4eab9c6a
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/persp@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/rotate_active.png b/src/plugins/qmldesigner/components/edit3d/images/rotate_active.png
new file mode 100644
index 00000000000..bdabaf30285
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/rotate_active.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/rotate_active@2x.png b/src/plugins/qmldesigner/components/edit3d/images/rotate_active@2x.png
new file mode 100644
index 00000000000..8c81f409d32
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/rotate_active@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/rotate_selected.png b/src/plugins/qmldesigner/components/edit3d/images/rotate_selected.png
new file mode 100644
index 00000000000..42dc2763ce4
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/rotate_selected.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/rotate_selected@2x.png b/src/plugins/qmldesigner/components/edit3d/images/rotate_selected@2x.png
new file mode 100644
index 00000000000..b6cc48c0533
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/rotate_selected@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/scale_active.png b/src/plugins/qmldesigner/components/edit3d/images/scale_active.png
new file mode 100644
index 00000000000..cd63c1d03bc
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/scale_active.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/scale_active@2x.png b/src/plugins/qmldesigner/components/edit3d/images/scale_active@2x.png
new file mode 100644
index 00000000000..0d95e8e8913
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/scale_active@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/scale_selected.png b/src/plugins/qmldesigner/components/edit3d/images/scale_selected.png
new file mode 100644
index 00000000000..4cca7726170
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/scale_selected.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/edit3d/images/scale_selected@2x.png b/src/plugins/qmldesigner/components/edit3d/images/scale_selected@2x.png
new file mode 100644
index 00000000000..690cf5f924f
--- /dev/null
+++ b/src/plugins/qmldesigner/components/edit3d/images/scale_selected@2x.png
Binary files differ
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp
index 7bd4573aafc..4ad03468bba 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorannotationicon.cpp
@@ -96,7 +96,7 @@ void FormEditorAnnotationIcon::paint(QPainter *painter, const QStyleOptionGraphi
if (scene)
m_readerIsActive = scene->annotationVisibility();
- QPixmap icon( (m_readerIsActive ? m_activeIconStr : m_normalIconStr) );
+ QPixmap icon(m_readerIsActive ? m_activeIconStr : m_normalIconStr);
painter->drawPixmap(0, 0,
static_cast<int>(m_iconW), static_cast<int>(m_iconH),
@@ -261,7 +261,6 @@ void FormEditorAnnotationIcon::drawReader()
++currentColumn;
newPos = commentsStartPosition + QPointF(currentColumn * (offset + width), 0);
-
} else {
//few normal comments, lets stack them
}
@@ -277,11 +276,8 @@ void FormEditorAnnotationIcon::drawReader()
void FormEditorAnnotationIcon::hideReader()
{
- if (!childItems().isEmpty()) {
- for (QGraphicsItem *item : childItems()) {
- delete item;
- }
- }
+ if (!childItems().isEmpty())
+ qDeleteAll(childItems());
}
QGraphicsItem *FormEditorAnnotationIcon::createCommentBubble(const QRectF &rect, const QString &title,
@@ -398,7 +394,8 @@ void FormEditorAnnotationIcon::createAnnotationEditor()
connect(m_annotationEditor, &QDialog::rejected,
this, &FormEditorAnnotationIcon::annotationDialogRejected);
- m_annotationEditor->open();
+ m_annotationEditor->show();
+ m_annotationEditor->raise();
}
void FormEditorAnnotationIcon::removeAnnotationDialog()
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
index dd01029c036..65c59a6954a 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
@@ -236,7 +236,7 @@ QTransform FormEditorItem::instanceSceneContentItemTransform() const
return qmlItemNode().instanceSceneContentItemTransform();
}
-bool FormEditorItem::flowHitTest(const QPointF &point) const
+bool FormEditorItem::flowHitTest(const QPointF & ) const
{
return false;
}
@@ -564,7 +564,7 @@ QPointF FormEditorFlowItem::instancePosition() const
return qmlItemNode().flowPosition();
}
-void FormEditorFlowActionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+void FormEditorFlowActionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
if (!painter->isActive())
return;
@@ -646,7 +646,6 @@ void FormEditorTransitionItem::setDataModelPositionInBaseState(const QPointF &)
void FormEditorTransitionItem::updateGeometry()
{
FormEditorItem::updateGeometry();
- const QPointF pos = qmlItemNode().flowPosition();
const ModelNode from = qmlItemNode().modelNode().bindingProperty("from").resolveToModelNode();
const ModelNode to = qmlItemNode().modelNode().bindingProperty("to").resolveToModelNode();
@@ -901,7 +900,7 @@ static void paintConnection(QPainter *painter,
painter->restore();
}
-void FormEditorTransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+void FormEditorTransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
if (!painter->isActive())
return;
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
index 44e514641a5..37c0efc9d7f 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
@@ -369,6 +369,7 @@ void FormEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNodeLi
void FormEditorView::bindingPropertiesChanged(const QList<BindingProperty> &propertyList, AbstractView::PropertyChangeFlags propertyChange)
{
+ Q_UNUSED(propertyChange)
for (const BindingProperty &property : propertyList) {
QmlVisualNode node(property.parentModelNode());
if (node.isFlowTransition()) {
@@ -675,9 +676,6 @@ void FormEditorView::toggle3DViewEnabled(bool enabled)
rootModelNode().removeAuxiliaryData("3d-view");
resetNodeInstanceView();
-
- // TODO: the line below is not in use. It should replace the resetNodeInstanceView(); to have a clean API
-// nodeInstanceView()->enable3DView(enabled);
}
QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
index bf4f1f0454f..ec7e1d782d8 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
@@ -59,8 +59,6 @@ namespace QmlDesigner {
FormEditorWidget::FormEditorWidget(FormEditorView *view) :
m_formEditorView(view)
{
- setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/formeditorstylesheet.css")))));
-
auto fillLayout = new QVBoxLayout(this);
fillLayout->setContentsMargins(0, 0, 0, 0);
fillLayout->setSpacing(0);
@@ -74,7 +72,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
layoutActionGroup->setExclusive(true);
m_noSnappingAction = layoutActionGroup->addAction(tr("No snapping (T)."));
- m_noSnappingAction->setShortcut(Qt::Key_W);
+ m_noSnappingAction->setShortcut(Qt::Key_T);
m_noSnappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_noSnappingAction->setCheckable(true);
m_noSnappingAction->setChecked(true);
@@ -135,7 +133,6 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
m_toolBox = new ToolBox(this);
fillLayout->addWidget(m_toolBox.data());
-
m_toolBox->setLeftSideActions(upperActions);
m_backgroundAction = new BackgroundAction(m_toolActionGroup.data());
@@ -145,9 +142,11 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
m_toolBox->addRightSideAction(m_backgroundAction.data());
m_option3DAction = new Option3DAction(m_toolActionGroup.data());
- addAction(m_option3DAction.data());
- upperActions.append(m_option3DAction.data());
- m_toolBox->addRightSideAction(m_option3DAction.data());
+ if (qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")) {
+ addAction(m_option3DAction.data());
+ upperActions.append(m_option3DAction.data());
+ m_toolBox->addRightSideAction(m_option3DAction.data());
+ }
m_zoomAction = new ZoomAction(m_toolActionGroup.data());
connect(m_zoomAction.data(), &ZoomAction::zoomLevelChanged,
@@ -168,7 +167,10 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
m_graphicsView = new FormEditorGraphicsView(this);
fillLayout->addWidget(m_graphicsView.data());
- m_graphicsView.data()->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))));
+
+ QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css");
+ sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css");
+ setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(sheet)));
}
void FormEditorWidget::changeTransformTool(bool checked)
diff --git a/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp b/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp
index 7253d3b6153..02f3ce9ee66 100644
--- a/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/selectionindicator.cpp
@@ -215,17 +215,18 @@ void SelectionIndicator::adjustAnnotationPosition(const QRectF &itemRect, const
{
if (!m_annotationItem) return;
- const qreal iconW = 40 * 0.5; //*0.5 for a shift of an icon outide the item
+ const qreal iconWShift = m_annotationItem->iconWidth() * 0.5;
+ const qreal iconHShift = (m_annotationItem->iconHeight() * 0.45)/scaleFactor;
qreal iconX = 0.0;
- qreal iconY = -15.0/scaleFactor; //small offset
+ qreal iconY = -(iconHShift);
- if (((labelRect.width() + iconW)/scaleFactor) > itemRect.width())
+ if (((labelRect.width() + iconWShift)/scaleFactor) > itemRect.width())
iconY -= labelRect.height()/scaleFactor;
- if ((iconW/scaleFactor) > itemRect.width())
+ if ((iconWShift/scaleFactor) > itemRect.width())
iconX = 0.0;
else
- iconX = (itemRect.width()) - (iconW/scaleFactor);
+ iconX = (itemRect.width()) - (iconWShift/scaleFactor);
m_annotationItem->setPos(iconX*scaleFactor, iconY*scaleFactor);
}
diff --git a/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp b/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp
index 6e1c6a50156..3a13f524119 100644
--- a/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp
+++ b/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp
@@ -56,7 +56,7 @@ WidgetInfo ImportManagerView::widgetInfo()
m_importsWidget->setImports(model()->imports());
}
- return createWidgetInfo(m_importsWidget, nullptr, QLatin1String("ImportManager"), WidgetInfo::LeftPane, 1);
+ return createWidgetInfo(m_importsWidget, nullptr, QLatin1String("ImportManager"), WidgetInfo::LeftPane, 1, tr("Import Manager"));
}
void ImportManagerView::modelAttached(Model *model)
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp
index 99ceb2fff37..90c0a2f28f1 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp
@@ -58,7 +58,8 @@ WidgetInfo ItemLibraryView::widgetInfo()
new WidgetInfo::ToolBarWidgetDefaultFactory<ItemLibraryWidget>(m_widget.data()),
QStringLiteral("Library"),
WidgetInfo::LeftPane,
- 0);
+ 0,
+ tr("Library"));
}
void ItemLibraryView::modelAttached(Model *model)
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
index 445d342d7fd..69d431582a0 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
@@ -83,7 +83,7 @@ static QString propertyEditorResourcesPath() {
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
QFrame(parent),
m_itemIconSize(24, 24),
- m_itemViewQuickWidget(new QQuickWidget),
+ m_itemViewQuickWidget(new QQuickWidget(this)),
m_resourcesView(new ItemLibraryResourceView(this)),
m_importTagsWidget(new QWidget(this)),
m_addResourcesWidget(new QWidget(this)),
@@ -121,7 +121,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
auto tabBar = new QTabBar(this);
tabBar->addTab(tr("QML Types", "Title of library QML types view"));
tabBar->addTab(tr("Assets", "Title of library assets view"));
- tabBar->addTab(tr("Imports", "Title of library imports view"));
+ tabBar->addTab(tr("QML Imports", "Title of QML imports view"));
tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(tabBar, &QTabBar::currentChanged, this, &ItemLibraryWidget::setCurrentIndexOfStackedWidget);
connect(tabBar, &QTabBar::currentChanged, this, &ItemLibraryWidget::updateSearch);
@@ -147,6 +147,8 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
m_stackedWidget = new QStackedWidget(this);
m_stackedWidget->addWidget(m_itemViewQuickWidget.data());
m_stackedWidget->addWidget(m_resourcesView.data());
+ m_stackedWidget->setMinimumHeight(30);
+ m_stackedWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
QWidget *spacer = new QWidget(this);
spacer->setObjectName(QStringLiteral("itemLibrarySearchInputSpacer"));
diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
index 98735e51206..93b1997707c 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
@@ -75,8 +75,10 @@ static QList<ModelNode> modelNodesFromMimeData(const QMimeData *mineData, Abstra
bool fitsToTargetProperty(const NodeAbstractProperty &targetProperty,
const QList<ModelNode> &modelNodeList)
{
+ bool const canBeContainer =
+ NodeHints::fromModelNode(targetProperty.parentModelNode()).canBeContainerFor(modelNodeList.first());
return !(targetProperty.isNodeProperty() &&
- modelNodeList.count() > 1);
+ modelNodeList.count() > 1) && canBeContainer;
}
static inline QString msgUnknownItem(const QString &t)
diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
index 4918f88a8bf..8da3cc9bba0 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
@@ -142,7 +142,8 @@ WidgetInfo NavigatorView::widgetInfo()
new WidgetInfo::ToolBarWidgetDefaultFactory<NavigatorWidget>(m_widget.data()),
QStringLiteral("Navigator"),
WidgetInfo::LeftPane,
- 0);
+ 0,
+ tr("Navigator"));
}
void NavigatorView::modelAttached(Model *model)
diff --git a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp
index 12103b048ba..0d2417e3944 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp
@@ -61,39 +61,15 @@ NavigatorWidget::NavigatorWidget(NavigatorView *view)
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
- auto tabBar = new QTabBar(this);
- tabBar->addTab(tr("Navigator"));
- tabBar->addTab(tr("Project"));
- tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-
- QWidget *spacer = new QWidget(this);
- spacer->setObjectName(QStringLiteral("itemLibrarySearchInputSpacer"));
- spacer->setFixedHeight(4);
-
- layout->addWidget(tabBar);
- layout->addWidget(spacer);
-
- auto stackedWidget = new QStackedWidget(this);
- stackedWidget->addWidget(m_treeView);
-
-#ifndef QMLDESIGNER_TEST
- auto projectManager = QmlDesignerPlugin::instance()->createProjectExplorerWidget(this);
-
- QTC_ASSERT(projectManager, ;);
- if (projectManager)
- stackedWidget->addWidget(projectManager);
-#endif
-
- connect(tabBar, &QTabBar::currentChanged, stackedWidget, &QStackedWidget::setCurrentIndex);
-
- layout->addWidget(stackedWidget);
+ layout->addWidget(m_treeView);
setLayout(layout);
setWindowTitle(tr("Navigator", "Title of navigator view"));
#ifndef QMLDESIGNER_TEST
- setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css"))));
- m_treeView->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css"))));
+ QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css");
+ sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css");
+ setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(sheet)));
#endif
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetdefaultlistmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetdefaultlistmodel.cpp
index 8237390de90..3977eff168a 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetdefaultlistmodel.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetdefaultlistmodel.cpp
@@ -56,6 +56,8 @@ void GradientPresetDefaultListModel::addAllPresets()
return;
for (int i = 0; i < metaEnum.keyCount(); i++) {
- addItem(GradientPresetItem(GradientPresetItem::Preset(metaEnum.value(i))));
+ auto preset = GradientPresetItem::Preset(metaEnum.value(i));
+ if (preset < GradientPresetItem::Preset::NumPresets)
+ addItem(GradientPresetItem(preset));
}
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetitem.h b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetitem.h
index cd0f0017e0e..4cb5a519fbf 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/gradientpresetitem.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/gradientpresetitem.h
@@ -42,7 +42,7 @@ public:
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
using Preset = QGradient::Preset;
#else
- enum Preset {};
+ enum Preset { NumPresets = 0 };
#endif
explicit GradientPresetItem();
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
index 7497879ecb5..da3c331d5c3 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
@@ -277,7 +277,7 @@ void PropertyEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qm
}
}
-void PropertyEditorQmlBackend::setValue(const QmlObjectNode & qmlObjectNode, const PropertyName &name, const QVariant &value)
+void PropertyEditorQmlBackend::setValue(const QmlObjectNode & , const PropertyName &name, const QVariant &value)
{
PropertyName propertyName = name;
propertyName.replace('.', '_');
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
index 7fa264a121c..1f2440b56f0 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
@@ -760,7 +760,7 @@ bool PropertyEditorView::hasWidget() const
WidgetInfo PropertyEditorView::widgetInfo()
{
- return createWidgetInfo(m_stackedWidget, nullptr, QStringLiteral("Properties"), WidgetInfo::RightPane, 0);
+ return createWidgetInfo(m_stackedWidget, nullptr, QStringLiteral("Properties"), WidgetInfo::RightPane, 0, tr("Properties"));
}
void PropertyEditorView::currentStateChanged(const ModelNode &node)
diff --git a/src/plugins/qmldesigner/components/resources/centerwidget.css b/src/plugins/qmldesigner/components/resources/centerwidget.css
index 41855e5d770..ba659f61c4d 100644
--- a/src/plugins/qmldesigner/components/resources/centerwidget.css
+++ b/src/plugins/qmldesigner/components/resources/centerwidget.css
@@ -28,6 +28,10 @@ QTabBar#centralTabBar::tab:selected {
color: creatorTheme.QmlDesigner_TabDark;
}
+QTabBar#centralTabBar::tab:disabled {
+ color: creatorTheme.QmlDesigner_ScrollBarHandleColor;
+}
+
QToolButton#centralTabBar {
background-color: creatorTheme.QmlDesigner_BackgroundColorDarkAlternate;
width: 08px;
diff --git a/src/plugins/qmldesigner/components/resources/dockwidgets.css b/src/plugins/qmldesigner/components/resources/dockwidgets.css
new file mode 100644
index 00000000000..b878e5c6ebd
--- /dev/null
+++ b/src/plugins/qmldesigner/components/resources/dockwidgets.css
@@ -0,0 +1,128 @@
+ADS--DockContainerWidget
+{
+ background-color: creatorTheme.QmlDesigner_BackgroundColorDarkAlternate;
+}
+
+ADS--DockContainerWidget QSplitter::handle
+{
+ background-color: creatorTheme.QmlDesigner_BackgroundColorDarkAlternate;
+}
+
+ADS--DockAreaWidget
+{
+ background-color: creatorTheme.BackgroundColorNormal;
+}
+
+ADS--DockAreaWidget #tabsMenuButton::menu-indicator
+{
+ image: none;
+}
+
+ADS--DockSplitter::handle:horizontal {
+ width: 1px;
+ background-color: creatorTheme.SplitterColor;
+}
+
+ADS--DockSplitter::handle:vertical {
+ height: 1px;
+ background-color: creatorTheme.SplitterColor;
+}
+
+ADS--DockWidgetTab
+{
+ background-color: creatorTheme.BackgroundColorDark;
+ border-color: creatorTheme.SplitterColor;
+ border-style: solid;
+ border-width: 0 1px 0 0;
+}
+
+ADS--DockWidgetTab[activeTab="true"]
+{
+ background-color: creatorTheme.QmlDesigner_TabLight;
+}
+
+ADS--DockWidgetTab QLabel
+{
+ color: creatorTheme.QmlDesigner_TabLight;
+}
+
+ADS--DockWidgetTab[activeTab="true"] QLabel
+{
+ color: creatorTheme.QmlDesigner_TabDark;
+}
+
+ADS--DockWidget
+{
+ background-color: palette(light);
+ border-color: red;
+ border-style: solid;
+ border-width: 0;
+}
+
+ADS--DockAreaTitleBar{ background-color: creatorTheme.BackgroundColorDark; }
+
+QWidget#tabsContainerWidget { background-color: creatorTheme.BackgroundColorDark; }
+
+ADS--TitleBarButton
+{
+ padding: 0px 0px;
+}
+
+QScrollArea#dockWidgetScrollArea
+{
+ padding: 0px;
+ border: none;
+}
+
+#tabCloseButton
+{
+ margin-top: 2px;
+ background: none;
+ border: none;
+ padding: 0px -2px;
+}
+
+#tabCloseButton:hover
+{
+ border: 1px solid rgba(0, 0, 0, 32);
+ background: rgba(0, 0, 0, 16);
+}
+
+#tabCloseButton:pressed
+{
+ background: rgba(0, 0, 0, 32);
+}
+
+QScrollBar {
+ background-color: creatorTheme.BackgroundColorDark;
+}
+
+QScrollBar:vertical {
+ width: 10px;
+}
+
+QScrollBar:horizontal {
+ height: 10px;
+}
+
+QScrollBar::handle {
+ background-color: creatorTheme.QmlDesigner_ScrollBarHandleColor;
+}
+
+QScrollBar::handle:vertical {
+ min-height: 30px;
+}
+
+QScrollBar::handle:horizontal {
+ min-width: 30px;
+}
+
+QScrollBar::add-line,
+QScrollBar::sub-line,
+QScrollBar::left-arrow,
+QScrollBar::right-arrow,
+QScrollBar::add-page,
+QScrollBar::sub-page {
+ height: 0px;
+ width: 0px;
+}
diff --git a/src/plugins/qmldesigner/components/resources/resources.qrc b/src/plugins/qmldesigner/components/resources/resources.qrc
index 4100b9da6bc..40a1595d24f 100644
--- a/src/plugins/qmldesigner/components/resources/resources.qrc
+++ b/src/plugins/qmldesigner/components/resources/resources.qrc
@@ -4,6 +4,7 @@
<file>scrollbar.css</file>
<file>formeditorstylesheet.css</file>
<file>centerwidget.css</file>
+ <file>dockwidgets.css</file>
<file>images/spliteditorhorizontally.png</file>
<file>images/spliteditorhorizontally@2x.png</file>
<file>images/spliteditorvertically.png</file>
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp
index 956b0d32a63..dafe5f3ff26 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp
@@ -127,6 +127,12 @@ void StatesEditorWidget::toggleStatesViewExpanded()
rootObject()->setProperty("expanded", !expanded);
}
+void StatesEditorWidget::showEvent(QShowEvent *event)
+{
+ Q_UNUSED(event)
+ update();
+}
+
void StatesEditorWidget::reloadQmlSource()
{
QString statesListQmlFilePath = qmlSourcesPath() + QStringLiteral("/StatesList.qml");
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h
index ce636201f69..e4e9668abb0 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h
@@ -59,6 +59,9 @@ public:
void toggleStatesViewExpanded();
+protected:
+ void showEvent(QShowEvent *) override;
+
private:
void reloadQmlSource();
Q_SLOT void handleExpandedChanged();
diff --git a/src/plugins/qmldesigner/components/timelineeditor/animationcurvedialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/animationcurvedialog.cpp
index 2c4fb147b04..71fcb1a260e 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/animationcurvedialog.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/animationcurvedialog.cpp
@@ -33,14 +33,12 @@ AnimationCurveDialog::AnimationCurveDialog(QWidget *parent)
: QDialog(parent)
, m_editor(nullptr)
{
- setWindowFlag(Qt::WindowContextHelpButtonHint, false);
}
AnimationCurveDialog::AnimationCurveDialog(DesignTools::CurveEditorModel *model, QWidget *parent)
: QDialog(parent)
, m_editor(nullptr)
{
- setWindowFlag(Qt::WindowContextHelpButtonHint, false);
setModel(model);
}
diff --git a/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp
index 938cc0dce1f..91ab2339008 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/easingcurvedialog.cpp
@@ -61,7 +61,6 @@ EasingCurveDialog::EasingCurveDialog(const QList<ModelNode> &frames, QWidget *pa
, m_label(new QLabel)
, m_frames(frames)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowFlag(Qt::Tool, true);
auto tw = new QTabWidget;
diff --git a/src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.cpp
index dbb70ca07a5..70f382e859b 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/setframevaluedialog.cpp
@@ -36,7 +36,6 @@ SetFrameValueDialog::SetFrameValueDialog(qreal frame, const QVariant &value,
, ui(new Ui::SetFrameValueDialog)
{
ui->setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Edit Keyframe"));
setFixedSize(size());
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp
index 3af73cd8233..7549e741bd3 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelinesectionitem.cpp
@@ -530,7 +530,7 @@ static void drawCenteredText(QPainter *p, int x, int y, const QString &text)
p->drawText(rect, Qt::AlignCenter, text);
}
-TimelineRulerSectionItem *TimelineRulerSectionItem::create(QGraphicsScene *parentScene,
+TimelineRulerSectionItem *TimelineRulerSectionItem::create(QGraphicsScene * ,
TimelineItem *parent)
{
auto item = new TimelineRulerSectionItem(parent);
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.cpp
index 960c409553a..8b098e92ba1 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelinesettingsdialog.cpp
@@ -102,7 +102,6 @@ TimelineSettingsDialog::TimelineSettingsDialog(QWidget *parent, TimelineView *vi
{
m_timelineSettingsModel = new TimelineSettingsModel(this, view);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
ui->setupUi(this);
auto *timelineCornerWidget = new QToolBar;
diff --git a/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs b/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs
index 51d8ccbd636..a49c475f800 100644
--- a/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs
+++ b/src/plugins/qmldesigner/componentsplugin/componentsplugin.qbs
@@ -16,6 +16,7 @@ QtcProduct {
"..",
"../components/componentcore",
"../components/debugview",
+ "../components/edit3d",
"../components/formeditor",
"../components/importmanager",
"../components/integration",
diff --git a/src/plugins/qmldesigner/designercore/include/abstractview.h b/src/plugins/qmldesigner/designercore/include/abstractview.h
index 2e549b52b1e..08e5d954749 100644
--- a/src/plugins/qmldesigner/designercore/include/abstractview.h
+++ b/src/plugins/qmldesigner/designercore/include/abstractview.h
@@ -44,6 +44,7 @@
QT_BEGIN_NAMESPACE
class QStyle;
class QToolButton;
+class QImage;
QT_END_NAMESPACE
namespace QmlDesigner {
@@ -182,6 +183,8 @@ public:
void emitRewriterBeginTransaction();
void emitRewriterEndTransaction();
void emitInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
+ void emitRenderImage3DChanged(const QImage &image);
+ void emitUpdateActiveScene3D(const QVariantMap &sceneState);
void sendTokenToInstances(const QString &token, int number, const QVector<ModelNode> &nodeVector);
@@ -237,6 +240,9 @@ public:
virtual void currentTimelineChanged(const ModelNode &node);
+ virtual void renderImage3DChanged(const QImage &image);
+ virtual void updateActiveScene3D(const QVariantMap &sceneState);
+
void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion);
NodeInstanceView *nodeInstanceView() const;
diff --git a/src/plugins/qmldesigner/designercore/include/nodehints.h b/src/plugins/qmldesigner/designercore/include/nodehints.h
index 7fed390ee0a..9b9f52721ac 100644
--- a/src/plugins/qmldesigner/designercore/include/nodehints.h
+++ b/src/plugins/qmldesigner/designercore/include/nodehints.h
@@ -59,6 +59,7 @@ public:
bool doesLayoutChildren() const;
bool canBeDroppedInFormEditor() const;
bool canBeDroppedInNavigator() const;
+ bool canBeDroppedInView3D() const;
bool isMovable() const;
bool isResizable() const;
bool isStackedContainer() const;
diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
index 33c436aa100..6087997332c 100644
--- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
+++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
@@ -39,6 +39,7 @@
#include <QPointer>
#include <QRectF>
#include <QTime>
+#include <QtGui/qevent.h>
namespace ProjectExplorer {
class Target;
@@ -94,7 +95,6 @@ public:
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) override;
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource) override;
-
void currentStateChanged(const ModelNode &node) override;
QList<NodeInstance> instances() const;
@@ -136,7 +136,9 @@ public:
void mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
void mainWindowActiveChanged(bool active, bool hasPopup);
- void enable3DView(bool enable);
+ void sendInputEvent(QInputEvent *e) const;
+ void view3DAction(const View3DActionCommand &command);
+ void edit3DViewResized(const QSize &size) const;
void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) override;
diff --git a/src/plugins/qmldesigner/designercore/include/viewmanager.h b/src/plugins/qmldesigner/designercore/include/viewmanager.h
index 8f1ccbfe083..3491a7c33a3 100644
--- a/src/plugins/qmldesigner/designercore/include/viewmanager.h
+++ b/src/plugins/qmldesigner/designercore/include/viewmanager.h
@@ -42,6 +42,7 @@ class AbstractCustomTool;
class DesignerActionManager;
class NodeInstanceView;
class RewriterView;
+class Edit3DView;
namespace Internal { class DesignModeWidget; }
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
index 706d62b2cfc..480f1e4472a 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
@@ -30,7 +30,6 @@
#include <createinstancescommand.h>
#include <createscenecommand.h>
#include <update3dviewstatecommand.h>
-#include <enable3dviewcommand.h>
#include <changevaluescommand.h>
#include <changebindingscommand.h>
#include <changeauxiliarycommand.h>
@@ -47,6 +46,8 @@
#include <drop3dlibraryitemcommand.h>
#include <puppettocreatorcommand.h>
#include <view3dclosedcommand.h>
+#include <inputeventcommand.h>
+#include <view3dactioncommand.h>
#include <informationchangedcommand.h>
#include <pixmapchangedcommand.h>
@@ -665,11 +666,6 @@ void NodeInstanceServerProxy::update3DViewState(const Update3dViewStateCommand &
writeCommand(QVariant::fromValue(command));
}
-void NodeInstanceServerProxy::enable3DView(const Enable3DViewCommand &command)
-{
- writeCommand(QVariant::fromValue(command));
-}
-
void NodeInstanceServerProxy::removeInstances(const RemoveInstancesCommand &command)
{
writeCommand(QVariant::fromValue(command));
@@ -732,7 +728,7 @@ void NodeInstanceServerProxy::token(const TokenCommand &command)
void NodeInstanceServerProxy::removeSharedMemory(const RemoveSharedMemoryCommand &command)
{
- writeCommand(QVariant::fromValue(command));
+ writeCommand(QVariant::fromValue(command));
}
void NodeInstanceServerProxy::benchmark(const QString &message)
@@ -740,4 +736,14 @@ void NodeInstanceServerProxy::benchmark(const QString &message)
qCInfo(instanceViewBenchmark) << message << m_benchmarkTimer.elapsed();
}
+void NodeInstanceServerProxy::inputEvent(const InputEventCommand &command)
+{
+ writeCommand(QVariant::fromValue(command));
+}
+
+void NodeInstanceServerProxy::view3DAction(const View3DActionCommand &command)
+{
+ writeCommand(QVariant::fromValue(command));
+}
+
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
index 5affc3fe448..77a86199a60 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
@@ -68,7 +68,6 @@ public:
void changeFileUrl(const ChangeFileUrlCommand &command) override;
void createScene(const CreateSceneCommand &command) override;
void update3DViewState(const Update3dViewStateCommand &command) override;
- void enable3DView(const Enable3DViewCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void removeInstances(const RemoveInstancesCommand &command) override;
void changeSelection(const ChangeSelectionCommand &command) override;
@@ -84,6 +83,8 @@ public:
void token(const TokenCommand &command) override;
void removeSharedMemory(const RemoveSharedMemoryCommand &command) override;
void benchmark(const QString &message) override;
+ void inputEvent(const InputEventCommand &command) override;
+ void view3DAction(const View3DActionCommand &command) override;
protected:
void writeCommand(const QVariant &command);
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
index a7cf6a64e14..e361b742058 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
@@ -48,7 +48,6 @@
#include "changefileurlcommand.h"
#include "reparentinstancescommand.h"
#include "update3dviewstatecommand.h"
-#include "enable3dviewcommand.h"
#include "changevaluescommand.h"
#include "changeauxiliarycommand.h"
#include "changebindingscommand.h"
@@ -71,6 +70,8 @@
#include "debugoutputcommand.h"
#include "nodeinstanceserverproxy.h"
#include "puppettocreatorcommand.h"
+#include "inputeventcommand.h"
+#include "view3dactioncommand.h"
#ifndef QMLDESIGNER_TEST
#include <qmldesignerplugin.h>
@@ -1470,6 +1471,13 @@ void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand
m_edit3DToolStates[qmlId].insert(data[1].toString(), data[2]);
}
}
+ } else if (command.type() == PuppetToCreatorCommand::Render3DView) {
+ ImageContainer container = qvariant_cast<ImageContainer>(command.data());
+ if (!container.image().isNull())
+ emitRenderImage3DChanged(container.image());
+ } else if (command.type() == PuppetToCreatorCommand::ActiveSceneChanged) {
+ const auto sceneState = qvariant_cast<QVariantMap>(command.data());
+ emitUpdateActiveScene3D(sceneState);
}
}
@@ -1526,10 +1534,19 @@ void NodeInstanceView::mainWindowActiveChanged(bool active, bool hasPopup)
nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(active, hasPopup));
}
-// enable / disable 3D edit View
-void NodeInstanceView::enable3DView(bool enable)
+void NodeInstanceView::sendInputEvent(QInputEvent *e) const
{
- nodeInstanceServer()->enable3DView(Enable3DViewCommand(enable));
+ nodeInstanceServer()->inputEvent(InputEventCommand(e));
+}
+
+void NodeInstanceView::view3DAction(const View3DActionCommand &command)
+{
+ nodeInstanceServer()->view3DAction(command);
+}
+
+void NodeInstanceView::edit3DViewResized(const QSize &size) const
+{
+ nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(size));
}
void NodeInstanceView::timerEvent(QTimerEvent *event)
diff --git a/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
index f72513c84db..abd64928527 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
@@ -28,6 +28,7 @@
#include <QSharedData>
+#include <utils/algorithm.h>
#include <utils/fileutils.h>
namespace QmlDesigner {
@@ -193,7 +194,7 @@ void ItemLibraryEntry::setRequiredImport(const QString &requiredImport)
void ItemLibraryEntry::addHints(const QHash<QString, QString> &hints)
{
- m_data->hints.unite(hints);
+ Utils::addToHash(&m_data->hints, hints);
}
void ItemLibraryEntry::addProperty(PropertyName &name, QString &type, QVariant &value)
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp
index 4862b59c048..1e34e197bbe 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodehints.cpp
@@ -165,6 +165,11 @@ bool NodeHints::canBeDroppedInNavigator() const
return evaluateBooleanExpression("canBeDroppedInNavigator", true);
}
+bool NodeHints::canBeDroppedInView3D() const
+{
+ return evaluateBooleanExpression("canBeDroppedInView3D", false);
+}
+
bool NodeHints::isMovable() const
{
if (!isValid())
diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp
index f5e07d9f834..de0c8882a1a 100644
--- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp
@@ -42,6 +42,7 @@
#include <utils/algorithm.h>
#include <QRegExp>
+#include <QtGui/qimage.h>
namespace QmlDesigner {
@@ -362,7 +363,14 @@ void AbstractView::documentMessagesChanged(const QList<DocumentMessage> &/*error
void AbstractView::currentTimelineChanged(const ModelNode & /*node*/)
{
+}
+void AbstractView::renderImage3DChanged(const QImage & /*image*/)
+{
+}
+
+void AbstractView::updateActiveScene3D(const QVariantMap & /*sceneState*/)
+{
}
QList<ModelNode> AbstractView::toModelNodeList(const QList<Internal::InternalNode::Pointer> &nodeList) const
@@ -729,6 +737,18 @@ void AbstractView::emitInstanceToken(const QString &token, int number, const QVe
model()->d->notifyInstanceToken(token, number, nodeVector);
}
+void AbstractView::emitRenderImage3DChanged(const QImage &image)
+{
+ if (model())
+ model()->d->notifyRenderImage3DChanged(image);
+}
+
+void AbstractView::emitUpdateActiveScene3D(const QVariantMap &sceneState)
+{
+ if (model())
+ model()->d->notifyUpdateActiveScene3D(sceneState);
+}
+
void AbstractView::emitRewriterEndTransaction()
{
if (model())
diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp
index 45d6f872eda..871c04aeb17 100644
--- a/src/plugins/qmldesigner/designercore/model/model.cpp
+++ b/src/plugins/qmldesigner/designercore/model/model.cpp
@@ -668,6 +668,22 @@ void ModelPrivate::notifyCurrentTimelineChanged(const ModelNode &node)
resetModelByRewriter(description);
}
+void ModelPrivate::notifyRenderImage3DChanged(const QImage &image)
+{
+ for (const QPointer<AbstractView> &view : qAsConst(m_viewList)) {
+ Q_ASSERT(view != nullptr);
+ view->renderImage3DChanged(image);
+ }
+}
+
+void ModelPrivate::notifyUpdateActiveScene3D(const QVariantMap &sceneState)
+{
+ for (const QPointer<AbstractView> &view : qAsConst(m_viewList)) {
+ Q_ASSERT(view != nullptr);
+ view->updateActiveScene3D(sceneState);
+ }
+}
+
void ModelPrivate::notifyRewriterBeginTransaction()
{
bool resetModel = false;
diff --git a/src/plugins/qmldesigner/designercore/model/model_p.h b/src/plugins/qmldesigner/designercore/model/model_p.h
index dd29d25e510..6990610b374 100644
--- a/src/plugins/qmldesigner/designercore/model/model_p.h
+++ b/src/plugins/qmldesigner/designercore/model/model_p.h
@@ -158,6 +158,9 @@ public:
void notifyCurrentStateChanged(const ModelNode &node);
void notifyCurrentTimelineChanged(const ModelNode &node);
+ void notifyRenderImage3DChanged(const QImage &image);
+ void notifyUpdateActiveScene3D(const QVariantMap &sceneState);
+
void setDocumentMessages(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings);
void notifyRewriterBeginTransaction();
diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
index c09895ad918..de07ef230fe 100644
--- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
+++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
@@ -80,7 +80,7 @@ QStringList supportedVersionsList()
{
static const QStringList list = {
"2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9",
- "2.10", "2.11", "2.12", "2.13", "2.14"
+ "2.10", "2.11", "2.12", "2.13", "2.14", "2.15"
};
return list;
}
diff --git a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp
index 65d76164844..b2873816af7 100644
--- a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp
+++ b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp
@@ -36,6 +36,7 @@
#include <itemlibraryview.h>
#include <navigatorview.h>
#include <stateseditorview.h>
+#include <edit3dview.h>
#include <formeditorview.h>
#include <texteditorview.h>
#include <propertyeditorview.h>
@@ -63,6 +64,7 @@ public:
DesignerActionManagerView designerActionManagerView;
NodeInstanceView nodeInstanceView;
ComponentView componentView;
+ Edit3DView edit3DView;
FormEditorView formEditorView;
TextEditorView textEditorView;
ItemLibraryView itemLibraryView;
@@ -73,7 +75,6 @@ public:
QList<QPointer<AbstractView> > additionalViews;
};
-
static CrumbleBar *crumbleBar() {
return QmlDesignerPlugin::instance()->mainWidget()->crumbleBar();
}
@@ -165,6 +166,7 @@ QList<QPointer<AbstractView> > ViewManager::views() const
{
auto list = d->additionalViews;
list.append({
+ &d->edit3DView,
&d->formEditorView,
&d->textEditorView,
&d->itemLibraryView,
@@ -195,6 +197,7 @@ void ViewManager::detachViewsExceptRewriterAndComponetView()
switchStateEditorViewToBaseState();
detachAdditionalViews();
currentModel()->detachView(&d->designerActionManagerView);
+ currentModel()->detachView(&d->edit3DView);
currentModel()->detachView(&d->formEditorView);
currentModel()->detachView(&d->textEditorView);
currentModel()->detachView(&d->navigatorView);
@@ -264,9 +267,15 @@ void ViewManager::attachViewsExceptRewriterAndComponetView()
int last = time.elapsed();
qCInfo(viewBenchmark) << "ActionManagerView:" << last << time.elapsed();
- currentModel()->attachView(&d->formEditorView);
+ currentModel()->attachView(&d->edit3DView);
int currentTime = time.elapsed();
+ qCInfo(viewBenchmark) << "Edit3DView:" << currentTime - last;
+ last = currentTime;
+
+ currentModel()->attachView(&d->formEditorView);
+
+ currentTime = time.elapsed();
qCInfo(viewBenchmark) << "FormEditorView:" << currentTime - last;
last = currentTime;
@@ -337,6 +346,7 @@ QList<WidgetInfo> ViewManager::widgetInfos() const
{
QList<WidgetInfo> widgetInfoList;
+ widgetInfoList.append(d->edit3DView.widgetInfo());
widgetInfoList.append(d->formEditorView.widgetInfo());
widgetInfoList.append(d->textEditorView.widgetInfo());
widgetInfoList.append(d->itemLibraryView.widgetInfo());
diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp
index 759789d7ce2..091f1d5e459 100644
--- a/src/plugins/qmldesigner/designmodewidget.cpp
+++ b/src/plugins/qmldesigner/designmodewidget.cpp
@@ -31,12 +31,19 @@
#include "qmldesignerplugin.h"
#include "crumblebar.h"
#include "documentwarningwidget.h"
+#include "edit3dview.h"
#include <texteditor/textdocument.h>
#include <nodeinstanceview.h>
#include <itemlibrarywidget.h>
#include <theme.h>
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/actionmanager/actionmanager_p.h>
+#include <coreplugin/actionmanager/command.h>
+#include <qmldesigner/qmldesignerconstants.h>
+
#include <coreplugin/outputpane.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/coreconstants.h>
@@ -56,6 +63,10 @@
#include <QToolBar>
#include <QLayout>
#include <QBoxLayout>
+#include <QDir>
+
+#include <advanceddockingsystem/dockareawidget.h>
+#include <advanceddockingsystem/docksplitter.h>
using Core::MiniSplitter;
using Core::IEditor;
@@ -67,13 +78,9 @@ enum {
debug = false
};
-const char SB_PROJECTS[] = "Projects";
-const char SB_FILESYSTEM[] = "FileSystem";
-const char SB_OPENDOCUMENTS[] = "OpenDocuments";
-
static void hideToolButtons(QList<QToolButton*> &buttons)
{
- foreach (QToolButton *button, buttons)
+ for (QToolButton *button : buttons)
button->hide();
}
@@ -138,36 +145,12 @@ DesignModeWidget::DesignModeWidget()
DesignModeWidget::~DesignModeWidget()
{
- m_leftSideBar.reset();
- m_rightSideBar.reset();
-
- foreach (QPointer<QWidget> widget, m_viewWidgets) {
+ for (QPointer<QWidget> widget : m_viewWidgets) {
if (widget)
widget.clear();
}
-}
-void DesignModeWidget::restoreDefaultView()
-{
- QSettings *settings = Core::ICore::settings();
- m_leftSideBar->closeAllWidgets();
- m_rightSideBar->closeAllWidgets();
- m_leftSideBar->readSettings(settings, "none.LeftSideBar");
- m_rightSideBar->readSettings(settings, "none.RightSideBar");
- m_leftSideBar->show();
- m_rightSideBar->show();
-}
-
-void DesignModeWidget::toggleLeftSidebar()
-{
- if (m_leftSideBar)
- m_leftSideBar->setVisible(!m_leftSideBar->isVisible());
-}
-
-void DesignModeWidget::toggleRightSidebar()
-{
- if (m_rightSideBar)
- m_rightSideBar->setVisible(!m_rightSideBar->isVisible());
+ delete m_dockManager;
}
QWidget *DesignModeWidget::createProjectExplorerWidget(QWidget *parent)
@@ -178,7 +161,7 @@ QWidget *DesignModeWidget::createProjectExplorerWidget(QWidget *parent)
Core::NavigationView navigationView;
navigationView.widget = nullptr;
- foreach (Core::INavigationWidgetFactory *factory, factories) {
+ for (Core::INavigationWidgetFactory *factory : factories) {
if (factory->id() == "Projects") {
navigationView = factory->createWidget();
hideToolButtons(navigationView.dockToolBarWidgets);
@@ -196,29 +179,23 @@ QWidget *DesignModeWidget::createProjectExplorerWidget(QWidget *parent)
return navigationView.widget;
}
-void DesignModeWidget::readSettings()
+void DesignModeWidget::readSettings() // readPerspectives
{
+ return;
+
QSettings *settings = Core::ICore::settings();
settings->beginGroup("Bauhaus");
- m_leftSideBar->readSettings(settings, QStringLiteral("LeftSideBar"));
- m_rightSideBar->readSettings(settings, QStringLiteral("RightSideBar"));
- if (settings->contains("MainSplitter")) {
- const QByteArray splitterState = settings->value("MainSplitter").toByteArray();
- m_mainSplitter->restoreState(splitterState);
- m_mainSplitter->setOpaqueResize(); // force opaque resize since it used to be off
- }
settings->endGroup();
}
-void DesignModeWidget::saveSettings()
+void DesignModeWidget::saveSettings() // savePerspectives
{
+ return;
+
QSettings *settings = Core::ICore::settings();
settings->beginGroup("Bauhaus");
- m_leftSideBar->saveSettings(settings, QStringLiteral("LeftSideBar"));
- m_rightSideBar->saveSettings(settings, QStringLiteral("RightSideBar"));
- settings->setValue("MainSplitter", m_mainSplitter->saveState());
settings->endGroup();
}
@@ -240,12 +217,20 @@ void DesignModeWidget::disableWidgets()
m_isDisabled = true;
}
-void DesignModeWidget::switchTextOrForm()
+bool DesignModeWidget::eventFilter(QObject *obj, QEvent *event) // TODO
{
- if (m_centralTabWidget->currentWidget() == viewManager().widget("TextEditor"))
- m_centralTabWidget->switchTo(viewManager().widget("FormEditor"));
- else
- m_centralTabWidget->switchTo(viewManager().widget("TextEditor"));
+ if (event->type() == QEvent::Hide) {
+ qDebug() << ">>> HIDE";
+ m_outputPaneDockWidget->toggleView(false);
+ return true;
+ } else if (event->type() == QEvent::Show) {
+ qDebug() << ">>> SHOW";
+ m_outputPaneDockWidget->toggleView(true);
+ return true;
+ } else {
+ // standard event processing
+ return QObject::eventFilter(obj, event);
+ }
}
void DesignModeWidget::setup()
@@ -255,42 +240,122 @@ void DesignModeWidget::setup()
actionManager.createDefaultAddResourceHandler();
actionManager.polishActions();
- QList<Core::INavigationWidgetFactory *> factories =
- Core::INavigationWidgetFactory::allNavigationFactories();
+ m_dockManager = new ADS::DockManager(this);
+ m_dockManager->setConfigFlags(ADS::DockManager::DefaultNonOpaqueConfig);
+ m_dockManager->setSettings(Core::ICore::settings(QSettings::UserScope));
+
+ QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/dockwidgets.css"));
+ m_dockManager->setStyleSheet(Theme::replaceCssColors(sheet));
+
+ // Setup Actions and Menus
+ Core::ActionContainer *mwindow = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW);
+ // Window > Views
+ Core::ActionContainer *mviews = Core::ActionManager::createMenu(Core::Constants::M_WINDOW_VIEWS);
+ mviews->menu()->addSeparator();
+ // Window > Workspaces
+ Core::ActionContainer *mworkspaces = Core::ActionManager::createMenu(QmlDesigner::Constants::M_WINDOW_WORKSPACES);
+ mwindow->addMenu(mworkspaces, Core::Constants::G_WINDOW_VIEWS);
+ mworkspaces->menu()->setTitle(tr("&Workspaces"));
+ mworkspaces->setOnAllDisabledBehavior(Core::ActionContainer::Show); // TODO what does it exactly do?!
+
+ // Connect opening of the 'window' menu with creation of the workspaces menu
+ connect(mwindow->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowWorkspaces);
- QWidget *openDocumentsWidget = nullptr;
- QWidget *projectsExplorer = nullptr;
- QWidget *fileSystemExplorer = nullptr;
+ // Create a DockWidget for each QWidget and add them to the DockManager
+ const Core::Context designContext(Core::Constants::C_DESIGN_MODE);
+ static const Core::Id actionToggle("QmlDesigner.Toggle");
- foreach (Core::INavigationWidgetFactory *factory, factories) {
+ // First get all navigation views
+ QList<Core::INavigationWidgetFactory *> factories = Core::INavigationWidgetFactory::allNavigationFactories();
+
+ for (Core::INavigationWidgetFactory *factory : factories) {
Core::NavigationView navigationView;
navigationView.widget = nullptr;
+ QString uniqueId;
+ QString title;
+
if (factory->id() == "Projects") {
navigationView = factory->createWidget();
- projectsExplorer = navigationView.widget;
hideToolButtons(navigationView.dockToolBarWidgets);
- projectsExplorer->setWindowTitle(tr("Projects"));
- } else if (factory->id() == "File System") {
+ navigationView.widget->setWindowTitle(tr(factory->id().name()));
+ uniqueId = "Projects";
+ title = "Projects";
+ }
+ if (factory->id() == "File System") {
navigationView = factory->createWidget();
- fileSystemExplorer = navigationView.widget;
hideToolButtons(navigationView.dockToolBarWidgets);
- fileSystemExplorer->setWindowTitle(tr("File System"));
- } else if (factory->id() == "Open Documents") {
+ navigationView.widget->setWindowTitle(tr(factory->id().name()));
+ uniqueId = "FileSystem";
+ title = "File System";
+ }
+ if (factory->id() == "Open Documents") {
navigationView = factory->createWidget();
- openDocumentsWidget = navigationView.widget;
hideToolButtons(navigationView.dockToolBarWidgets);
- openDocumentsWidget->setWindowTitle(tr("Open Documents"));
+ navigationView.widget->setWindowTitle(tr(factory->id().name()));
+ uniqueId = "OpenDocuments";
+ title = "Open Documents";
}
if (navigationView.widget) {
+ // Apply stylesheet to QWidget
QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css");
sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css");
sheet += "QLabel { background-color: #4f4f4f; }";
navigationView.widget->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(sheet)));
+
+ // Create DockWidget
+ ADS::DockWidget *dockWidget = new ADS::DockWidget(uniqueId);
+ dockWidget->setWidget(navigationView.widget);
+ dockWidget->setWindowTitle(title);
+ m_dockManager->addDockWidget(ADS::NoDockWidgetArea, dockWidget);
+
+ // Create menu action
+ auto command = Core::ActionManager::registerAction(dockWidget->toggleViewAction(),
+ actionToggle.withSuffix(uniqueId + "Widget"),
+ designContext);
+ command->setAttribute(Core::Command::CA_Hide);
+ mviews->addAction(command);
}
}
- auto toolBar = new QToolBar;
+ // Afterwards get all the other widgets
+ for (const WidgetInfo &widgetInfo : viewManager().widgetInfos()) {
+ // Create DockWidget
+ ADS::DockWidget *dockWidget = new ADS::DockWidget(widgetInfo.uniqueId);
+ dockWidget->setWidget(widgetInfo.widget);
+ dockWidget->setWindowTitle(widgetInfo.tabName);
+ m_dockManager->addDockWidget(ADS::NoDockWidgetArea, dockWidget);
+
+ // Add to view widgets
+ m_viewWidgets.append(widgetInfo.widget);
+
+ // Create menu action
+ auto command = Core::ActionManager::registerAction(dockWidget->toggleViewAction(),
+ actionToggle.withSuffix(widgetInfo.uniqueId + "Widget"),
+ designContext);
+ command->setAttribute(Core::Command::CA_Hide);
+ mviews->addAction(command);
+ }
+
+ // Finally the output pane
+ {
+ auto outputPanePlaceholder = new Core::OutputPanePlaceHolder(Core::Constants::MODE_DESIGN);
+ m_outputPaneDockWidget = new ADS::DockWidget("OutputPane");
+ m_outputPaneDockWidget->setWidget(outputPanePlaceholder);
+ m_outputPaneDockWidget->setWindowTitle("Output Pane");
+ m_dockManager->addDockWidget(ADS::NoDockWidgetArea, m_outputPaneDockWidget);
+ // Create menu action
+ auto command = Core::ActionManager::registerAction(m_outputPaneDockWidget->toggleViewAction(),
+ actionToggle.withSuffix("OutputPaneWidget"),
+ designContext);
+ command->setAttribute(Core::Command::CA_Hide);
+ mviews->addAction(command);
+
+ //outputPanePlaceholder->installEventFilter(this);
+ }
+
+ // Create toolbars
+ auto toolBar = new QToolBar();
toolBar->addAction(viewManager().componentViewAction());
toolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
DesignerActionToolBar *designerToolBar = QmlDesignerPlugin::instance()->viewManager().designerActionManager().createToolBar(m_toolBar);
@@ -298,97 +363,162 @@ void DesignModeWidget::setup()
designerToolBar->layout()->addWidget(toolBar);
m_toolBar->addCenterToolBar(designerToolBar);
-
m_toolBar->setMinimumWidth(320);
+ m_toolBar->setToolbarCreationFlags(Core::EditorToolBar::FlagsStandalone);
+ m_toolBar->setNavigationVisible(true);
- m_mainSplitter = new MiniSplitter(this);
- m_mainSplitter->setObjectName("mainSplitter");
+ connect(m_toolBar, &Core::EditorToolBar::goForwardClicked, this, &DesignModeWidget::toolBarOnGoForwardClicked);
+ connect(m_toolBar, &Core::EditorToolBar::goBackClicked, this, &DesignModeWidget::toolBarOnGoBackClicked);
- QList<Core::SideBarItem*> sideBarItems;
- QList<Core::SideBarItem*> leftSideBarItems;
- QList<Core::SideBarItem*> rightSideBarItems;
+ QToolBar* toolBarWrapper = new QToolBar();
+ toolBarWrapper->addWidget(m_toolBar);
+ toolBarWrapper->addWidget(createCrumbleBarFrame());
+ toolBarWrapper->setMovable(false);
+ addToolBar(Qt::TopToolBarArea, toolBarWrapper);
- foreach (const WidgetInfo &widgetInfo, viewManager().widgetInfos()) {
- if (widgetInfo.placementHint == widgetInfo.LeftPane) {
- Core::SideBarItem *sideBarItem = new DesignerSideBarItem(widgetInfo.widget, widgetInfo.toolBarWidgetFactory, widgetInfo.uniqueId);
- sideBarItems.append(sideBarItem);
- leftSideBarItems.append(sideBarItem);
- }
+ if (currentDesignDocument())
+ setupNavigatorHistory(currentDesignDocument()->textEditor());
- if (widgetInfo.placementHint == widgetInfo.RightPane) {
- Core::SideBarItem *sideBarItem = new DesignerSideBarItem(widgetInfo.widget, widgetInfo.toolBarWidgetFactory, widgetInfo.uniqueId);
- sideBarItems.append(sideBarItem);
- rightSideBarItems.append(sideBarItem);
+ // Get a list of all available workspaces
+ QStringList workspaces = m_dockManager->workspaces();
+ QString workspace = ADS::Constants::FACTORY_DEFAULT_NAME;
- }
- m_viewWidgets.append(widgetInfo.widget);
+ // If there is no factory default workspace create one and write the xml file
+ if (!workspaces.contains(ADS::Constants::FACTORY_DEFAULT_NAME)) {
+ createFactoryDefaultWorkspace();
+ // List of workspaces needs to be updated
+ workspaces = m_dockManager->workspaces();
}
- if (projectsExplorer) {
- Core::SideBarItem *projectExplorerItem = new Core::SideBarItem(projectsExplorer, QLatin1String(SB_PROJECTS));
- sideBarItems.append(projectExplorerItem);
+ // Determine workspace to restore at startup
+ if (m_dockManager->autoRestorLastWorkspace()) {
+ QString lastWorkspace = m_dockManager->lastWorkspace();
+ if (!lastWorkspace.isEmpty() && workspaces.contains(lastWorkspace))
+ workspace = lastWorkspace;
+ else
+ qDebug() << "Couldn't restore last workspace!";
}
- if (fileSystemExplorer) {
- Core::SideBarItem *fileSystemExplorerItem = new Core::SideBarItem(fileSystemExplorer, QLatin1String(SB_FILESYSTEM));
- sideBarItems.append(fileSystemExplorerItem);
+ if (workspace.isNull() && workspaces.contains(ADS::Constants::DEFAULT_NAME)) {
+ workspace = ADS::Constants::DEFAULT_NAME;
}
- if (openDocumentsWidget) {
- Core::SideBarItem *openDocumentsItem = new Core::SideBarItem(openDocumentsWidget, QLatin1String(SB_OPENDOCUMENTS));
- sideBarItems.append(openDocumentsItem);
- }
+ m_dockManager->openWorkspace(workspace);
- m_leftSideBar.reset(new Core::SideBar(sideBarItems, leftSideBarItems));
- m_rightSideBar.reset(new Core::SideBar(sideBarItems, rightSideBarItems));
+ viewManager().enableWidgets();
+ readSettings();
+ show();
+}
- connect(m_leftSideBar.data(), &Core::SideBar::availableItemsChanged, [=](){
- // event comes from m_leftSidebar, so update right side.
- m_rightSideBar->setUnavailableItemIds(m_leftSideBar->unavailableItemIds());
- });
+void DesignModeWidget::aboutToShowWorkspaces()
+{
+ Core::ActionContainer *aci = Core::ActionManager::actionContainer(QmlDesigner::Constants::M_WINDOW_WORKSPACES);
+ QMenu *menu = aci->menu();
+ menu->clear();
- connect(m_rightSideBar.data(), &Core::SideBar::availableItemsChanged, [=](){
- // event comes from m_rightSidebar, so update left side.
- m_leftSideBar->setUnavailableItemIds(m_rightSideBar->unavailableItemIds());
- });
+ auto *ag = new QActionGroup(menu);
- connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose, [=](){
- m_leftSideBar.reset();
- m_rightSideBar.reset();
+ connect(ag, &QActionGroup::triggered, this, [this](QAction *action) {
+ QString workspace = action->data().toString();
+ m_dockManager->openWorkspace(workspace);
});
- m_toolBar->setToolbarCreationFlags(Core::EditorToolBar::FlagsStandalone);
- m_toolBar->setNavigationVisible(true);
+ QAction *action = menu->addAction("Manage...");
+ connect(action, &QAction::triggered,
+ m_dockManager, &ADS::DockManager::showWorkspaceMananger);
- connect(m_toolBar, &Core::EditorToolBar::goForwardClicked, this, &DesignModeWidget::toolBarOnGoForwardClicked);
- connect(m_toolBar, &Core::EditorToolBar::goBackClicked, this, &DesignModeWidget::toolBarOnGoBackClicked);
+ menu->addSeparator();
- if (currentDesignDocument())
- setupNavigatorHistory(currentDesignDocument()->textEditor());
+ for (const auto &workspace : m_dockManager->workspaces())
+ {
+ QAction *action = ag->addAction(workspace);
+ action->setData(workspace);
+ action->setCheckable(true);
+ if (workspace == m_dockManager->activeWorkspace())
+ action->setChecked(true);
+ }
+ menu->addActions(ag->actions());
+}
- // m_mainSplitter area:
- m_mainSplitter->addWidget(m_leftSideBar.data());
- m_mainSplitter->addWidget(createCenterWidget());
- m_mainSplitter->addWidget(m_rightSideBar.data());
+void DesignModeWidget::createFactoryDefaultWorkspace()
+{
+ ADS::DockAreaWidget* centerArea = nullptr;
+ ADS::DockAreaWidget* leftArea = nullptr;
+ ADS::DockAreaWidget* rightArea = nullptr;
+ ADS::DockAreaWidget* bottomArea = nullptr;
- // Finishing touches:
- m_mainSplitter->setStretchFactor(1, 1);
- m_mainSplitter->setSizes({150, 300, 150});
+ // Iterate over all widgets and only get the central once to start with creating the factory
+ // default workspace layout.
+ for (const WidgetInfo &widgetInfo : viewManager().widgetInfos()) {
+ if (widgetInfo.placementHint == widgetInfo.CentralPane) {
+ ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
+ if (centerArea)
+ m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, centerArea);
+ else
+ centerArea = m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget);
+ }
+ }
- QLayout *mainLayout = new QBoxLayout(QBoxLayout::RightToLeft, this);
- mainLayout->setContentsMargins(0, 0, 0, 0);
- mainLayout->setSpacing(0);
- mainLayout->addWidget(m_mainSplitter);
+ // Iterate over all widgets and get the remaining left, right and bottom widgets
+ for (const WidgetInfo &widgetInfo : viewManager().widgetInfos()) {
+ if (widgetInfo.placementHint == widgetInfo.LeftPane) {
+ ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
+ if (leftArea)
+ m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, leftArea);
+ else
+ leftArea = m_dockManager->addDockWidget(ADS::LeftDockWidgetArea, dockWidget, centerArea);
+ }
- viewManager().enableWidgets();
- m_leftSideBar->setEnabled(true);
- m_rightSideBar->setEnabled(true);
- m_leftSideBar->setCloseWhenEmpty(false);
- m_rightSideBar->setCloseWhenEmpty(false);
+ if (widgetInfo.placementHint == widgetInfo.RightPane) {
+ ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
+ if (rightArea)
+ m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, rightArea);
+ else
+ rightArea = m_dockManager->addDockWidget(ADS::RightDockWidgetArea, dockWidget, centerArea);
+ }
- readSettings();
+ if (widgetInfo.placementHint == widgetInfo.BottomPane) {
+ ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(widgetInfo.uniqueId);
+ if (bottomArea)
+ m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, bottomArea);
+ else
+ bottomArea = m_dockManager->addDockWidget(ADS::BottomDockWidgetArea, dockWidget, centerArea);
+ }
+ }
- show();
+ // Iterate over all 'special' widgets
+ QStringList specialWidgets = {"Projects", "FileSystem", "OpenDocuments"};
+ ADS::DockAreaWidget* leftBottomArea = nullptr;
+ for (const QString &uniqueId : specialWidgets) {
+ ADS::DockWidget *dockWidget = m_dockManager->findDockWidget(uniqueId);
+ if (leftBottomArea)
+ m_dockManager->addDockWidget(ADS::CenterDockWidgetArea, dockWidget, leftBottomArea);
+ else
+ leftBottomArea = m_dockManager->addDockWidget(ADS::BottomDockWidgetArea, dockWidget, leftArea);
+ }
+
+ // Add the last widget 'OutputPane' as the bottom bottom area
+ ADS::DockWidget *dockWidget = m_dockManager->findDockWidget("OutputPane");
+ m_dockManager->addDockWidget(ADS::BottomDockWidgetArea, dockWidget, bottomArea);
+
+ // TODO This is just a test
+ auto splitter = centerArea->dockContainer()->rootSplitter();
+ splitter->setSizes({100, 800, 100});
+ // TODO
+
+ m_dockManager->createWorkspace(ADS::Constants::FACTORY_DEFAULT_NAME);
+
+ // Write the xml file
+ Utils::FilePath fileName = m_dockManager->workspaceNameToFileName(ADS::Constants::FACTORY_DEFAULT_NAME);
+ QString errorString;
+ Utils::FileSaver fileSaver(fileName.toString(), QIODevice::Text);
+ QByteArray data = m_dockManager->saveState();
+ if (!fileSaver.hasError()) {
+ fileSaver.write(data);
+ }
+ if (!fileSaver.finalize()) {
+ errorString = fileSaver.errorString();
+ }
}
void DesignModeWidget::toolBarOnGoBackClicked()
@@ -445,93 +575,6 @@ void DesignModeWidget::addNavigatorHistoryEntry(const Utils::FilePath &fileName)
++m_navigatorHistoryCounter;
}
-static QTabWidget *createWidgetsInTabWidget(const QList<WidgetInfo> &widgetInfos)
-{
- auto tabWidget = new QTabWidget;
-
- foreach (const WidgetInfo &widgetInfo, widgetInfos)
- tabWidget->addTab(widgetInfo.widget, widgetInfo.tabName);
-
- return tabWidget;
-}
-
-static QWidget *createbottomSideBarWidget(const QList<WidgetInfo> &widgetInfos)
-{
- //### we now own these here
- QList<WidgetInfo> topWidgetInfos;
- foreach (const WidgetInfo &widgetInfo, widgetInfos) {
- if (widgetInfo.placementHint == widgetInfo.BottomPane)
- topWidgetInfos.append(widgetInfo);
- }
-
- QWidget *widget = topWidgetInfos.constFirst().widget;
- if (topWidgetInfos.count() > 1) {
- QWidget *background = new QWidget();
- background->setProperty("designerBackgroundColor", true);
-
- QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css"));
- sheet.prepend("QWidget[designerBackgroundColor=\"true\"] {background-color: creatorTheme.QmlDesigner_BackgroundColorDarkAlternate;}");
-
- background->setStyleSheet(Theme::replaceCssColors(sheet));
- background->setLayout(new QVBoxLayout);
- background->layout()->setContentsMargins(0, 0, 0, 0);
-
- background->layout()->addWidget(createWidgetsInTabWidget(topWidgetInfos));
- widget = background;
- }
- return widget;
-}
-
-static Core::MiniSplitter *createCentralSplitter(const QList<WidgetInfo> &widgetInfos)
-{
- // editor and output panes
- auto outputPlaceholderSplitter = new Core::MiniSplitter;
- outputPlaceholderSplitter->setOrientation(Qt::Vertical);
-
- auto switchSplitTabWidget = new SwitchSplitTabWidget();
-
- foreach (const WidgetInfo &widgetInfo, widgetInfos) {
- if (widgetInfo.placementHint == widgetInfo.CentralPane)
- switchSplitTabWidget->addTab(widgetInfo.widget, widgetInfo.tabName);
- }
-
- outputPlaceholderSplitter->addWidget(switchSplitTabWidget);
-
- QWidget *bottomSideBar = createbottomSideBarWidget(widgetInfos);
- bottomSideBar->setObjectName("bottomSideBar");
- outputPlaceholderSplitter->addWidget(bottomSideBar);
-
- auto outputPanePlaceholder = new Core::OutputPanePlaceHolder(Core::Constants::MODE_DESIGN, outputPlaceholderSplitter);
- outputPlaceholderSplitter->addWidget(outputPanePlaceholder);
-
- outputPlaceholderSplitter->setStretchFactor(0, 10);
- outputPlaceholderSplitter->setStretchFactor(1, 1);
- return outputPlaceholderSplitter;
-}
-
-QWidget *DesignModeWidget::createCenterWidget()
-{
- QWidget *centerWidget = new QWidget;
-
- auto horizontalLayout = new QVBoxLayout(centerWidget);
- horizontalLayout->setContentsMargins(0, 0, 0, 0);
- horizontalLayout->setSpacing(0);
-
- horizontalLayout->addWidget(m_toolBar);
- horizontalLayout->addWidget(createCrumbleBarFrame());
-
- Core::MiniSplitter *centralSplitter = createCentralSplitter(viewManager().widgetInfos());
- m_centralTabWidget = centralSplitter->findChild<SwitchSplitTabWidget*>();
- Q_ASSERT(m_centralTabWidget);
- m_centralTabWidget->switchTo(viewManager().widget("FormEditor"));
-
- m_bottomSideBar = centralSplitter->findChild<QWidget*>("bottomSideBar");
- Q_ASSERT(m_bottomSideBar);
- horizontalLayout->addWidget(centralSplitter);
-
- return centerWidget;
-}
-
QWidget *DesignModeWidget::createCrumbleBarFrame()
{
auto frame = new Utils::StyledBar(this);
@@ -551,7 +594,9 @@ CrumbleBar *DesignModeWidget::crumbleBar() const
void DesignModeWidget::showInternalTextEditor()
{
- m_centralTabWidget->switchTo(viewManager().widget("TextEditor"));
+ auto dockWidget = m_dockManager->findDockWidget("TextEditor");
+ if (dockWidget)
+ dockWidget->toggleView(true);
}
void DesignModeWidget::contextHelp(const Core::IContext::HelpCallback &callback) const
diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h
index b446cdf2e10..113265368c3 100644
--- a/src/plugins/qmldesigner/designmodewidget.h
+++ b/src/plugins/qmldesigner/designmodewidget.h
@@ -32,8 +32,11 @@
#include <modelnode.h>
#include <QWidget>
+#include <QMainWindow>
#include <QScopedPointer>
+#include <advanceddockingsystem/dockmanager.h>
+
namespace Core {
class SideBar;
class SideBarItem;
@@ -53,7 +56,7 @@ namespace Internal {
class DesignMode;
class DocumentWidget;
-class DesignModeWidget : public QWidget
+class DesignModeWidget : public QMainWindow
{
Q_OBJECT
@@ -75,17 +78,17 @@ public:
void enableWidgets();
void disableWidgets();
- void switchTextOrForm();
CrumbleBar* crumbleBar() const;
void showInternalTextEditor();
- void restoreDefaultView();
- void toggleLeftSidebar();
- void toggleRightSidebar();
+ void determineWorkspaceToRestoreAtStartup();
static QWidget *createProjectExplorerWidget(QWidget *parent);
+protected:
+ bool eventFilter(QObject *obj, QEvent *event) override;
+
private: // functions
enum InitializeStatus { NotInitialized, Initializing, Initialized };
@@ -99,12 +102,13 @@ private: // functions
QWidget *createCenterWidget();
QWidget *createCrumbleBarFrame();
+ void aboutToShowWorkspaces();
+
+ void createFactoryDefaultWorkspace();
+
private: // variables
- QSplitter *m_mainSplitter = nullptr;
SwitchSplitTabWidget* m_centralTabWidget = nullptr;
- QScopedPointer<Core::SideBar> m_leftSideBar;
- QScopedPointer<Core::SideBar> m_rightSideBar;
QPointer<QWidget> m_bottomSideBar;
Core::EditorToolBar *m_toolBar;
CrumbleBar *m_crumbleBar;
@@ -118,6 +122,9 @@ private: // variables
bool m_keepNavigatorHistory = false;
QList<QPointer<QWidget> >m_viewWidgets;
+
+ ADS::DockManager *m_dockManager = nullptr;
+ ADS::DockWidget *m_outputPaneDockWidget = nullptr;
};
} // namespace Internal
diff --git a/src/plugins/qmldesigner/openuiqmlfiledialog.cpp b/src/plugins/qmldesigner/openuiqmlfiledialog.cpp
index 545719623fe..bfb49c25c56 100644
--- a/src/plugins/qmldesigner/openuiqmlfiledialog.cpp
+++ b/src/plugins/qmldesigner/openuiqmlfiledialog.cpp
@@ -36,7 +36,6 @@ OpenUiQmlFileDialog::OpenUiQmlFileDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::OpenUiQmlFileDialog)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
ui->setupUi(this);
connect(ui->cancelButton, &QPushButton::clicked, this, &QDialog::close);
diff --git a/src/plugins/qmldesigner/qmldesigner_dependencies.pri b/src/plugins/qmldesigner/qmldesigner_dependencies.pri
index 68b12dc2635..cba0186ce73 100644
--- a/src/plugins/qmldesigner/qmldesigner_dependencies.pri
+++ b/src/plugins/qmldesigner/qmldesigner_dependencies.pri
@@ -2,7 +2,8 @@ QTC_PLUGIN_NAME = QmlDesigner
QTC_LIB_DEPENDS += \
utils \
qmljs \
- qmleditorwidgets
+ qmleditorwidgets \
+ advanceddockingsystem
QTC_PLUGIN_DEPENDS += \
coreplugin \
texteditor \
@@ -22,6 +23,7 @@ INCLUDEPATH *= \
$$PWD/components/componentcore \
$$PWD/components/importmanager \
$$PWD/components/itemlibrary \
+ $$PWD/components/edit3d \
$$PWD/components/formeditor \
$$PWD/components/navigator \
$$PWD/components/stateseditor \
diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h
index 82445f4e78b..5dcb014e58f 100644
--- a/src/plugins/qmldesigner/qmldesignerconstants.h
+++ b/src/plugins/qmldesigner/qmldesignerconstants.h
@@ -56,6 +56,9 @@ const char QUICK_3D_ASSET_ICON_DIR[] = "_icons";
const char DEFAULT_ASSET_IMPORT_FOLDER[] = "/asset_imports";
const char QT_QUICK_3D_MODULE_NAME[] = "QtQuick3D";
+// Menus
+const char M_WINDOW_WORKSPACES[] = "QmlDesigner.Menu.Window.Workspaces";
+
namespace Internal {
enum { debug = 0 };
}
diff --git a/src/plugins/qmldesigner/qmldesignericons.h b/src/plugins/qmldesigner/qmldesignericons.h
index 9a16ce2b0c0..840f1ea97c7 100644
--- a/src/plugins/qmldesigner/qmldesignericons.h
+++ b/src/plugins/qmldesigner/qmldesignericons.h
@@ -47,5 +47,36 @@ const Utils::Icon NO_SNAPPING({
const Utils::Icon NO_SNAPPING_AND_ANCHORING({
{QLatin1String(":/icon/layout/snapping_and_anchoring.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_LIGHT_ON({
+ {QLatin1String(":/edit3d/images/edit_light_on.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_LIGHT_OFF({
+ {QLatin1String(":/edit3d/images/edit_light_off.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_SELECTION_MODE_ON({
+ {QLatin1String(":/edit3d/images/group_selection_selected.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_SELECTION_MODE_OFF({
+ {QLatin1String(":/edit3d/images/item_selection_selected.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_MOVE_TOOL_ON({
+ {QLatin1String(":/edit3d/images/move_selected.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_MOVE_TOOL_OFF({
+ {QLatin1String(":/edit3d/images/move_active.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_ROTATE_TOOL_ON({
+ {QLatin1String(":/edit3d/images/rotate_selected.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_ROTATE_TOOL_OFF({
+ {QLatin1String(":/edit3d/images/rotate_active.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_SCALE_TOOL_ON({
+ {QLatin1String(":/edit3d/images/scale_selected.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_SCALE_TOOL_OFF({
+ {QLatin1String(":/edit3d/images/scale_active.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_FIT_SELECTED_OFF({
+ {QLatin1String(":/edit3d/images/fit_active.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_EDIT_CAMERA_ON({
+ {QLatin1String(":/edit3d/images/persp.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_EDIT_CAMERA_OFF({
+ {QLatin1String(":/edit3d/images/ortho.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_ORIENTATION_ON({
+ {QLatin1String(":/edit3d/images/global.png"), Utils::Theme::IconsBaseColor}});
+const Utils::Icon EDIT3D_ORIENTATION_OFF({
+ {QLatin1String(":/edit3d/images/local.png"), Utils::Theme::IconsBaseColor}});
+
} // Icons
} // QmlDesigner
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pro b/src/plugins/qmldesigner/qmldesignerplugin.pro
index 30c34209377..ea017e3ceff 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.pro
+++ b/src/plugins/qmldesigner/qmldesignerplugin.pro
@@ -13,6 +13,7 @@ include(designercore/designercore-lib.pri)
include(components/componentcore/componentcore.pri)
include(components/integration/integration.pri)
include(components/propertyeditor/propertyeditor.pri)
+include(components/edit3d/edit3d.pri)
include(components/formeditor/formeditor.pri)
include(components/texteditor/texteditor.pri)
include(components/itemlibrary/itemlibrary.pri)
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs
index 477ebd83888..4bad2b32bed 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.qbs
+++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs
@@ -15,6 +15,7 @@ Project {
"core-private", "quickwidgets"
]
}
+ Depends { name: "AdvancedDockingSystem" }
Depends { name: "Core" }
Depends { name: "QmlJS" }
Depends { name: "QmlEditorWidgets" }
@@ -50,6 +51,7 @@ Project {
"components/importmanager",
"components/integration",
"components/propertyeditor",
+ "components/edit3d",
"components/formeditor",
"components/itemlibrary",
"components/navigator",
@@ -69,6 +71,7 @@ Project {
cpp.includePaths: base.concat([
product.sourceDirectory,
product.sourceDirectory + "/components/componentcore",
+ product.sourceDirectory + "/components/edit3d",
product.sourceDirectory + "/components/formeditor",
product.sourceDirectory + "/components/integration",
product.sourceDirectory + "/designercore",
@@ -174,12 +177,14 @@ Project {
"commands/drop3dlibraryitemcommand.h",
"commands/update3dviewstatecommand.cpp",
"commands/update3dviewstatecommand.h",
- "commands/enable3dviewcommand.cpp",
- "commands/enable3dviewcommand.h",
"commands/view3dclosedcommand.cpp",
"commands/view3dclosedcommand.h",
"commands/puppettocreatorcommand.cpp",
"commands/puppettocreatorcommand.h",
+ "commands/inputeventcommand.cpp",
+ "commands/inputeventcommand.h",
+ "commands/view3dactioncommand.cpp",
+ "commands/view3dactioncommand.h",
"container/addimportcontainer.cpp",
"container/addimportcontainer.h",
"container/idcontainer.cpp",
@@ -443,6 +448,15 @@ Project {
"debugview/debugviewwidget.cpp",
"debugview/debugviewwidget.h",
"debugview/debugviewwidget.ui",
+ "edit3d/edit3dview.cpp",
+ "edit3d/edit3dview.h",
+ "edit3d/edit3dwidget.cpp",
+ "edit3d/edit3dwidget.h",
+ "edit3d/edit3dcanvas.cpp",
+ "edit3d/edit3dcanvas.h",
+ "edit3d/edit3dactions.cpp",
+ "edit3d/edit3dactions.h",
+ "edit3d/edit3d.qrc",
"formeditor/abstractcustomtool.cpp",
"formeditor/abstractcustomtool.h",
"formeditor/abstractformeditortool.cpp",
diff --git a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo
index a8562bf18ff..61e156f9693 100644
--- a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo
+++ b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo
@@ -284,6 +284,7 @@ MetaInfo {
visibleInNavigator: true
canBeDroppedInNavigator: true
canBeDroppedInFormEditor: false
+ canBeContainer: false
}
ItemLibraryEntry {
@@ -302,6 +303,7 @@ MetaInfo {
visibleInNavigator: true
canBeDroppedInNavigator: true
canBeDroppedInFormEditor: false
+ canBeContainer: false
}
ItemLibraryEntry {
@@ -356,6 +358,7 @@ MetaInfo {
visibleInNavigator: true
canBeDroppedInNavigator: true
canBeDroppedInFormEditor: false
+ canBeContainer: false
}
ItemLibraryEntry {
@@ -374,6 +377,7 @@ MetaInfo {
visibleInNavigator: true
canBeDroppedInNavigator: true
canBeDroppedInFormEditor: false
+ canBeContainer: false
}
ItemLibraryEntry {
@@ -392,6 +396,7 @@ MetaInfo {
visibleInNavigator: true
canBeDroppedInNavigator: true
canBeDroppedInFormEditor: false
+ canBeContainer: false
}
ItemLibraryEntry {
@@ -410,6 +415,7 @@ MetaInfo {
visibleInNavigator: true
canBeDroppedInNavigator: true
canBeDroppedInFormEditor: false
+ canBeContainer: false
}
ItemLibraryEntry {
diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp
index 45e75194741..d4dac41cf4a 100644
--- a/src/plugins/qmldesigner/shortcutmanager.cpp
+++ b/src/plugins/qmldesigner/shortcutmanager.cpp
@@ -53,7 +53,6 @@
#include "qmldesignerconstants.h"
#include "qmldesignerplugin.h"
-#include "designmodewidget.h"
#include <QApplication>
#include <QClipboard>
@@ -71,10 +70,6 @@ ShortCutManager::ShortCutManager()
m_pasteAction(tr("&Paste")),
m_selectAllAction(tr("Select &All")),
m_collapseExpandStatesAction(tr("Toggle States")),
- m_restoreDefaultViewAction(tr("&Restore Default View")),
- m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar")),
- m_toggleRightSidebarAction(tr("Toggle &Right Sidebar")),
- m_switchTextFormAction(tr("Switch Text/Design")),
m_escapeAction(this)
{
@@ -101,26 +96,6 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
connect(&m_selectAllAction,&QAction::triggered, this, &ShortCutManager::selectAll);
- connect(&m_restoreDefaultViewAction,
- &QAction::triggered,
- QmlDesignerPlugin::instance()->mainWidget(),
- &Internal::DesignModeWidget::restoreDefaultView);
-
- connect(&m_toggleLeftSidebarAction,
- &QAction::triggered,
- QmlDesignerPlugin::instance()->mainWidget(),
- &Internal::DesignModeWidget::toggleLeftSidebar);
-
- connect(&m_toggleRightSidebarAction,
- &QAction::triggered,
- QmlDesignerPlugin::instance()->mainWidget(),
- &Internal::DesignModeWidget::toggleRightSidebar);
-
- connect(&m_switchTextFormAction,
- &QAction::triggered,
- QmlDesignerPlugin::instance()->mainWidget(),
- &Internal::DesignModeWidget::switchTextOrForm);
-
connect(&m_collapseExpandStatesAction, &QAction::triggered, [] {
QmlDesignerPlugin::instance()->viewManager().toggleStatesViewExpanded();
});
@@ -216,21 +191,11 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
Core::ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS);
- Core::ActionManager::registerAction(&m_toggleLeftSidebarAction, Core::Constants::TOGGLE_LEFT_SIDEBAR, qmlDesignerMainContext);
- Core::ActionManager::registerAction(&m_toggleRightSidebarAction, Core::Constants::TOGGLE_RIGHT_SIDEBAR, qmlDesignerMainContext);
-
command = Core::ActionManager::registerAction(&m_collapseExpandStatesAction, Constants::TOGGLE_STATES_EDITOR, qmlDesignerMainContext);
command->setAttribute(Core::Command::CA_Hide);
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+s"));
viewsMenu->addAction(command);
- command = Core::ActionManager::registerAction(&m_restoreDefaultViewAction, Constants::RESTORE_DEFAULT_VIEW, qmlDesignerMainContext);
- command->setAttribute(Core::Command::CA_Hide);
- viewsMenu->addAction(command);
-
- command = Core::ActionManager::registerAction(&m_switchTextFormAction, QmlDesigner::Constants::SWITCH_TEXT_DESIGN, qmlDesignerMainContext);
- command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
-
/* Registering disabled action for Escape, because Qt Quick does not support shortcut overrides. */
command = Core::ActionManager::registerAction(&m_escapeAction, Core::Constants::S_RETURNTOEDITOR, qmlDesignerMainContext);
command->setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
@@ -326,16 +291,6 @@ void ShortCutManager::selectAll()
currentDesignDocument()->selectAll();
}
-void ShortCutManager::toggleLeftSidebar()
-{
- QmlDesignerPlugin::instance()->mainWidget()->toggleLeftSidebar();
-}
-
-void ShortCutManager::toggleRightSidebar()
-{
- QmlDesignerPlugin::instance()->mainWidget()->toggleRightSidebar();
-}
-
void ShortCutManager::connectUndoActions(DesignDocument *designDocument)
{
if (designDocument) {
diff --git a/src/plugins/qmldesigner/shortcutmanager.h b/src/plugins/qmldesigner/shortcutmanager.h
index 2d80520a4e7..102448f4307 100644
--- a/src/plugins/qmldesigner/shortcutmanager.h
+++ b/src/plugins/qmldesigner/shortcutmanager.h
@@ -63,8 +63,6 @@ private:
void copySelected();
void paste();
void selectAll();
- void toggleLeftSidebar();
- void toggleRightSidebar();
void undoAvailable(bool isAvailable);
void redoAvailable(bool isAvailable);
void goIntoComponent();
@@ -85,10 +83,6 @@ private:
QAction m_pasteAction;
QAction m_selectAllAction;
QAction m_collapseExpandStatesAction;
- QAction m_restoreDefaultViewAction;
- QAction m_toggleLeftSidebarAction;
- QAction m_toggleRightSidebarAction;
- QAction m_switchTextFormAction;
QAction m_escapeAction;
};
diff --git a/src/plugins/qmldesigner/switchsplittabwidget.cpp b/src/plugins/qmldesigner/switchsplittabwidget.cpp
index 7dea80f164f..e30f4180cfe 100644
--- a/src/plugins/qmldesigner/switchsplittabwidget.cpp
+++ b/src/plugins/qmldesigner/switchsplittabwidget.cpp
@@ -121,25 +121,32 @@ QWidget *SwitchSplitTabWidget::currentWidget() const
void SwitchSplitTabWidget::updateSplitterSizes(int index)
{
- if (isHidden()) {
- // we cannot get the sizes if the splitter is hidden
- m_splittSizesAreDirty = true;
- return;
- }
- QVector<int> splitterSizes = m_splitter->sizes().toVector();
+ QVector<int> splitterSizes(m_splitter->count());
int splitterFullSize = 0;
- for (int size : splitterSizes)
- splitterFullSize += size;
+ bool isHorizontal = m_splitter->orientation() == Qt::Horizontal;
+ for (int i = 0; i < m_splitter->count(); ++i) {
+ auto widget = m_splitter->widget(i);
+ splitterFullSize += isHorizontal ? widget->width() : widget->height();
+ }
+
if (index > -1) {
- // collapse all but not the one at index
+ // collapse all but the one at index
splitterSizes.fill(0);
splitterSizes.replace(index, splitterFullSize);
} else {
- // distribute full size
- splitterSizes.fill(splitterFullSize / splitterSizes.count());
+ // distribute full size among enabled tabs
+ int divisor = splitterSizes.count();
+ for (int i = 0; i < m_splitter->count(); ++i) {
+ if (!m_tabBar->isTabEnabled(i + fakeTab))
+ --divisor;
+ }
+
+ int splitSize = splitterFullSize / divisor;
+ for (int i = 0; i < m_splitter->count(); ++i)
+ splitterSizes.replace(i, m_tabBar->isTabEnabled(i + fakeTab) ? splitSize : 0);
}
+
m_splitter->setSizes(splitterSizes.toList());
- m_splittSizesAreDirty = false;
}
int SwitchSplitTabWidget::addTab(QWidget *w, const QString &label)
@@ -178,18 +185,8 @@ void SwitchSplitTabWidget::switchTo(QWidget *widget)
updateSplitterSizes(widgetIndex);
m_tabBar->setCurrentIndex(widgetIndex + fakeTab);
}
- widget->setFocus();
-}
-bool SwitchSplitTabWidget::event(QEvent *event)
-{
- if (event->type() == QEvent::Show && m_splittSizesAreDirty) {
- bool returnValue = QWidget::event(event);
- updateSplitterSizes(m_tabBar->currentIndex() - fakeTab);
- return returnValue;
- }
-
- return QWidget::event(event);
+ widget->setFocus();
}
void SwitchSplitTabWidget::updateSplitButtons()
@@ -203,14 +200,13 @@ void SwitchSplitTabWidget::selectFakeTab()
m_tabBar->setCurrentIndex(0);
}
-SwitchSplitTabWidget::Mode SwitchSplitTabWidget::mode()
+SwitchSplitTabWidget::Mode SwitchSplitTabWidget::mode() const
{
const bool isTabBarNecessary = count() > 1;
const int fakeTabPosition = 0;
const int hasSelectedTab = m_tabBar->currentIndex() > fakeTabPosition;
- if (isTabBarNecessary && !hasSelectedTab)
- return SplitMode;
- return TabMode;
+ // Note: When splitting the view by dragging from the side of the view, SplitMode is not detected
+ return (isTabBarNecessary && !hasSelectedTab) ? SplitMode : TabMode;
}
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/switchsplittabwidget.h b/src/plugins/qmldesigner/switchsplittabwidget.h
index 3bd19f393e9..72c5cc3e5e8 100644
--- a/src/plugins/qmldesigner/switchsplittabwidget.h
+++ b/src/plugins/qmldesigner/switchsplittabwidget.h
@@ -37,10 +37,9 @@ namespace QmlDesigner {
class SwitchSplitTabWidget : public QWidget
{
Q_OBJECT
- enum Mode {
- SplitMode,
- TabMode
- };
+
+ enum Mode { SplitMode, TabMode };
+
public:
explicit SwitchSplitTabWidget(QWidget *parent = nullptr);
int count() const;
@@ -50,19 +49,15 @@ public:
QWidget *takeTabWidget(const int index);
void switchTo(QWidget *widget);
-protected:
- bool event(QEvent* event) override;
-
private:
void updateSplitterSizes(int index = -1);
void updateSplitButtons();
void selectFakeTab();
- Mode mode();
+ Mode mode() const;
QSplitter *m_splitter = nullptr;
QTabBar *m_tabBar = nullptr;
QWidget *m_tabBarBackground = nullptr;
const int fakeTab = 1;
- bool m_splittSizesAreDirty = true;
};
} // namespace QmlDesigner
diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
index 034c1b13017..e3b169f46dd 100644
--- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
+++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
@@ -610,7 +610,7 @@ void SemanticHighlighter::reportMessagesInfo(const QVector<QTextLayout::FormatRa
// but will use them only after a signal sent by that same thread, maybe we should transfer
// them more explicitly
m_extraFormats = formats;
- m_extraFormats.unite(m_formats);
+ Utils::addToHash(&m_extraFormats, m_formats);
m_diagnosticRanges = diagnosticRanges;
}
diff --git a/src/plugins/qmlprofiler/flamegraphmodel.cpp b/src/plugins/qmlprofiler/flamegraphmodel.cpp
index 5673f2fbc3d..590932c1c44 100644
--- a/src/plugins/qmlprofiler/flamegraphmodel.cpp
+++ b/src/plugins/qmlprofiler/flamegraphmodel.cpp
@@ -312,7 +312,7 @@ QVariant FlameGraphModel::data(const QModelIndex &index, int role) const
QHash<int, QByteArray> FlameGraphModel::roleNames() const
{
- static QHash<int, QByteArray> extraRoles{
+ static const QHash<int, QByteArray> extraRoles{
{TypeIdRole, "typeId"},
{TypeRole, "type"},
{DurationRole, "duration"},
@@ -328,7 +328,9 @@ QHash<int, QByteArray> FlameGraphModel::roleNames() const
{AllocationsRole, "allocations" },
{MemoryRole, "memory" }
};
- return QAbstractItemModel::roleNames().unite(extraRoles);
+ QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
+ Utils::addToHash(&roles, extraRoles);
+ return roles;
}
QmlProfilerModelManager *FlameGraphModel::modelManager() const
diff --git a/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp b/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp
index 43b1d500a0b..1762c4a85c6 100644
--- a/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp
@@ -51,7 +51,6 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
QDialog(parent),
d(new QmlProfilerAttachDialogPrivate)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Start QML Profiler"));
d->kitChooser = new KitChooser(this);
diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp
index f62c7c1294e..1ad4bb0590c 100644
--- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp
+++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp
@@ -101,6 +101,10 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FilePath &fi
if (targetDirectoryPropery.isValid())
projectItem->setTargetDirectory(targetDirectoryPropery.toString());
+ const QVariant qtForMCUProperty = rootNode->property("qtForMCUs");
+ if (qtForMCUProperty.isValid() && qtForMCUProperty.toBool())
+ projectItem->setQtForMCUs(targetDirectoryPropery.toBool());
+
if (debug)
qDebug() << "importPath:" << importPathsProperty << "mainFile:" << mainFileProperty;
diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp
index b36938b9f22..34f0591b178 100644
--- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp
+++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp
@@ -55,6 +55,11 @@ void QmlProjectItem::setTargetDirectory(const QString &directoryPath)
m_targetDirectory = directoryPath;
}
+void QmlProjectItem::setQtForMCUs(bool b)
+{
+ m_qtForMCUs = b;
+}
+
void QmlProjectItem::setImportPaths(const QStringList &importPaths)
{
if (m_importPaths != importPaths)
diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h
index 5245e3872cf..68dfe6d55d3 100644
--- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h
+++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h
@@ -51,6 +51,9 @@ public:
QString targetDirectory() const { return m_targetDirectory; }
void setTargetDirectory(const QString &directoryPath);
+ bool qtForMCUs() const { return m_qtForMCUs; }
+ void setQtForMCUs(bool qtForMCUs);
+
QStringList importPaths() const { return m_importPaths; }
void setImportPaths(const QStringList &paths);
@@ -83,6 +86,7 @@ protected:
Utils::EnvironmentItems m_environment;
QVector<QmlProjectContentItem *> m_content; // content property
bool m_forceFreeType = false;
+ bool m_qtForMCUs = false;
};
} // namespace QmlProjectManager
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 6d93305e6d7..fc622179cae 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -205,6 +205,13 @@ QString QmlBuildSystem::mainFile() const
return QString();
}
+bool QmlBuildSystem::qtForMCUs() const
+{
+ if (m_projectItem)
+ return m_projectItem.data()->qtForMCUs();
+ return false;
+}
+
void QmlBuildSystem::setMainFile(const QString &mainFilePath)
{
if (m_projectItem)
@@ -393,6 +400,8 @@ QVariant QmlBuildSystem::additionalData(Id id) const
return customFileSelectors();
if (id == Constants::customForceFreeTypeData)
return forceFreeType();
+ if (id == Constants::customQtForMCUs)
+ return qtForMCUs();
return {};
}
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index b1b4c6bd536..0cff1528984 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -76,6 +76,7 @@ public:
Utils::FilePath canonicalProjectDir() const;
QString mainFile() const;
+ bool qtForMCUs() const;
void setMainFile(const QString &mainFilePath);
Utils::FilePath targetDirectory() const;
Utils::FilePath targetFile(const Utils::FilePath &sourceFile) const;
diff --git a/src/plugins/qmlprojectmanager/qmlprojectconstants.h b/src/plugins/qmlprojectmanager/qmlprojectconstants.h
index ecf39bc32ca..10d3bafc692 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectconstants.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectconstants.h
@@ -33,6 +33,7 @@ namespace Constants {
const char * const QMLPROJECT_MIMETYPE = QmlJSTools::Constants::QMLPROJECT_MIMETYPE;
const char customFileSelectorsData[] = "CustomFileSelectorsData";
const char customForceFreeTypeData[] = "CustomForceFreeType";
+const char customQtForMCUs[] = "CustomQtForMCUs";
} // namespace Constants
} // namespace QmlProjectManager
diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp
index 6b2ecd88683..4643eb9aeb1 100644
--- a/src/plugins/qtsupport/baseqtversion.cpp
+++ b/src/plugins/qtsupport/baseqtversion.cpp
@@ -485,6 +485,12 @@ QSet<Id> BaseQtVersion::availableFeatures() const
if (qtVersion().matches(5, 14))
return features;
+ features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 15));
+ features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_2_PREFIX, 2, 15));
+
+ if (qtVersion().matches(5, 15))
+ return features;
+
return features;
}
diff --git a/src/plugins/studiowelcome/CMakeLists.txt b/src/plugins/studiowelcome/CMakeLists.txt
index 217e5f7de47..c82b4fa2361 100644
--- a/src/plugins/studiowelcome/CMakeLists.txt
+++ b/src/plugins/studiowelcome/CMakeLists.txt
@@ -1,11 +1,20 @@
+set(qmlQrcFile "${CMAKE_CURRENT_BINARY_DIR}/StudioWelcome_qml.qrc")
+
+qtc_glob_resources(
+ QRC_FILE "${qmlQrcFile}"
+ ROOT "${CMAKE_CURRENT_SOURCE_DIR}"
+ GLOB "qml/*"
+)
+
add_qtc_plugin(StudioWelcome
DEPENDS Qt5::QuickWidgets
PLUGIN_DEPENDS Core ProjectExplorer QtSupport
- DEFINES STUDIO_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/qml"
+ DEFINES STUDIO_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/qml/"
SOURCES
studiowelcomeplugin.cpp studiowelcomeplugin.h
studiowelcome_global.h
studiowelcome.qrc
+ ${qmlQrcFile}
"${PROJECT_SOURCE_DIR}/src/share/3rdparty/studiofonts/studiofonts.qrc"
EXTRA_TRANSLATIONS
qml
diff --git a/src/plugins/subversion/subversioneditor.cpp b/src/plugins/subversion/subversioneditor.cpp
index cb48da5daaf..5b6b819615e 100644
--- a/src/plugins/subversion/subversioneditor.cpp
+++ b/src/plugins/subversion/subversioneditor.cpp
@@ -34,7 +34,6 @@
#include <QDebug>
#include <QFileInfo>
-#include <QRegExp>
#include <QTextCursor>
#include <QTextBlock>
@@ -42,8 +41,8 @@ using namespace Subversion;
using namespace Subversion::Internal;
SubversionEditorWidget::SubversionEditorWidget() :
- m_changeNumberPattern(QLatin1String("^\\s*(?<area>(?<rev>\\d+))\\s+.*$")),
- m_revisionNumberPattern(QLatin1String("\\b(?<area>(r|[rR]evision )(?<rev>\\d+))\\b"))
+ m_changeNumberPattern("^\\s*(?<area>(?<rev>\\d+))\\s+.*$"),
+ m_revisionNumberPattern("\\b(?<area>(r|[rR]evision )(?<rev>\\d+))\\b")
{
QTC_ASSERT(m_changeNumberPattern.isValid(), return);
QTC_ASSERT(m_revisionNumberPattern.isValid(), return);
@@ -56,33 +55,10 @@ SubversionEditorWidget::SubversionEditorWidget() :
@@ -6,6 +6,5 @@
\endcode
*/
- setDiffFilePattern(QRegExp(QLatin1String("^[-+]{3} ([^\\t]+)|^Index: .*|^=+$")));
- setLogEntryPattern(QRegExp(QLatin1String("^(r\\d+) \\|")));
+ setDiffFilePattern("^[-+]{3} ([^\\t]+)|^Index: .*|^=+$");
+ setLogEntryPattern("^(r\\d+) \\|");
setAnnotateRevisionTextFormat(tr("Annotate revision \"%1\""));
-}
-
-QSet<QString> SubversionEditorWidget::annotationChanges() const
-{
- QSet<QString> changes;
- const QString txt = toPlainText();
- if (txt.isEmpty())
- return changes;
- // Hunt for first change number in annotation: "<change>:"
- QRegExp r(QLatin1String("^(\\d+):"));
- QTC_ASSERT(r.isValid(), return changes);
- if (r.indexIn(txt) != -1) {
- changes.insert(r.cap(1));
- r.setPattern(QLatin1String("\n(\\d+):"));
- QTC_ASSERT(r.isValid(), return changes);
- int pos = 0;
- while ((pos = r.indexIn(txt, pos)) != -1) {
- pos += r.matchedLength();
- changes.insert(r.cap(1));
- }
- }
- if (Subversion::Constants::debug)
- qDebug() << "SubversionEditor::annotationChanges() returns #" << changes.size();
- return changes;
+ setAnnotationEntryPattern("^(\\d+):");
}
QString SubversionEditorWidget::changeUnderCursor(const QTextCursor &c) const
diff --git a/src/plugins/subversion/subversioneditor.h b/src/plugins/subversion/subversioneditor.h
index 6b2446ffdea..a7b44f66b9a 100644
--- a/src/plugins/subversion/subversioneditor.h
+++ b/src/plugins/subversion/subversioneditor.h
@@ -40,7 +40,6 @@ public:
SubversionEditorWidget();
private:
- QSet<QString> annotationChanges() const override;
QString changeUnderCursor(const QTextCursor &) const override;
VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(
const QSet<QString> &changes) const override;
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 38526b4b7b4..f8a65cb9fe0 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -995,7 +995,6 @@ void SubversionPluginPrivate::slotDescribe()
QTC_ASSERT(state.hasTopLevel(), return);
QInputDialog inputDialog(ICore::dialogParent());
- inputDialog.setWindowFlags(inputDialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
inputDialog.setInputMode(QInputDialog::IntInput);
inputDialog.setIntRange(1, INT_MAX);
inputDialog.setWindowTitle(tr("Describe"));
diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp
index a29019a245d..b1154896745 100644
--- a/src/plugins/texteditor/codeassist/codeassistant.cpp
+++ b/src/plugins/texteditor/codeassist/codeassistant.cpp
@@ -288,6 +288,8 @@ void CodeAssistantPrivate::cancelCurrentRequest()
m_requestRunner->setDiscardProposal(true);
disconnect(m_runnerConnection);
}
+ if (m_asyncProcessor)
+ m_asyncProcessor->cancel();
invalidateCurrentRequestData();
}
diff --git a/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp b/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp
index 50a04ba88fc..8558e9c392f 100644
--- a/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp
+++ b/src/plugins/texteditor/codeassist/documentcontentcompletion.cpp
@@ -43,14 +43,15 @@
using namespace TextEditor;
-class DocumentContentCompletionProcessor : public IAssistProcessor
+class DocumentContentCompletionProcessor final : public IAssistProcessor
{
public:
DocumentContentCompletionProcessor(const QString &snippetGroupId);
- ~DocumentContentCompletionProcessor() override;
+ ~DocumentContentCompletionProcessor() final;
IAssistProposal *perform(const AssistInterface *interface) override;
bool running() final { return m_watcher.isRunning(); }
+ void cancel() final;
private:
QString m_snippetGroup;
@@ -77,8 +78,7 @@ DocumentContentCompletionProcessor::DocumentContentCompletionProcessor(const QSt
DocumentContentCompletionProcessor::~DocumentContentCompletionProcessor()
{
- if (m_watcher.isRunning())
- m_watcher.cancel();
+ cancel();
}
static void createProposal(QFutureInterface<QStringList> &future, const QString &text,
@@ -149,3 +149,9 @@ IAssistProposal *DocumentContentCompletionProcessor::perform(const AssistInterfa
});
return nullptr;
}
+
+void DocumentContentCompletionProcessor::cancel()
+{
+ if (running())
+ m_watcher.cancel();
+}
diff --git a/src/plugins/texteditor/codeassist/iassistprocessor.h b/src/plugins/texteditor/codeassist/iassistprocessor.h
index 6ed29b66f11..3658e97ad0e 100644
--- a/src/plugins/texteditor/codeassist/iassistprocessor.h
+++ b/src/plugins/texteditor/codeassist/iassistprocessor.h
@@ -51,6 +51,7 @@ public:
virtual bool running() { return false; }
virtual bool needsRestart() const { return false; }
+ virtual void cancel() {}
private:
AsyncCompletionsAvailableHandler m_asyncCompletionsAvailableHandler;
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 361419db7fb..e90af4d627f 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -5472,7 +5472,7 @@ void TextEditorWidget::mouseMoveEvent(QMouseEvent *e)
column += (e->pos().x() - cursorRect().center().x()) / QFontMetricsF(font()).horizontalAdvance(QLatin1Char(' '));
d->m_blockSelection.positionBlock = cursor.blockNumber();
- d->m_blockSelection.positionColumn = column;
+ d->m_blockSelection.positionColumn = qMax(0, column);
doSetTextCursor(d->m_blockSelection.selection(d->m_document.data()), true);
viewport()->update();
@@ -7166,7 +7166,7 @@ void TextEditorWidget::rewrapParagraph()
QString currentWord;
for (const QChar &ch : qAsConst(selectedText)) {
- if (ch.isSpace()) {
+ if (ch.isSpace() && ch != QChar::Nbsp) {
if (!currentWord.isEmpty()) {
currentLength += currentWord.length() + 1;
@@ -8055,12 +8055,12 @@ QTextCursor TextBlockSelection::cursor(const TextDocument *baseTextDocument,
}
void TextBlockSelection::fromPostition(int positionBlock, int positionColumn,
- int anchorBlock, int anchorColumn)
+ int anchorBlock, int anchorColumn)
{
- this->positionBlock = positionBlock;
- this->positionColumn = positionColumn;
- this->anchorBlock = anchorBlock;
- this->anchorColumn = anchorColumn;
+ this->positionBlock = QTC_GUARD(positionBlock >= 0) ? positionBlock : 0;
+ this->positionColumn = QTC_GUARD(positionColumn >= 0) ? positionColumn : 0;
+ this->anchorBlock = QTC_GUARD(anchorBlock >= 0) ? anchorBlock : 0;
+ this->anchorColumn = QTC_GUARD(anchorColumn >= 0) ? anchorColumn : 0;
}
bool TextEditorWidget::inFindScope(const QTextCursor &cursor)
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index 713d54187f9..64475eba242 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -1338,9 +1338,6 @@ HeobDialog::HeobDialog(QWidget *parent) :
m_profileDeleteButton->setEnabled(m_profilesCombo->count() > 1);
setWindowTitle(tr("Heob"));
-
- // disable context help button
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
QString HeobDialog::arguments() const
diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp
index 95495d8ba3d..0f358ab1de0 100644
--- a/src/plugins/vcsbase/cleandialog.cpp
+++ b/src/plugins/vcsbase/cleandialog.cpp
@@ -145,7 +145,6 @@ CleanDialog::CleanDialog(QWidget *parent) :
d(new Internal::CleanDialogPrivate)
{
setModal(true);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
d->ui.setupUi(this);
d->ui.buttonBox->addButton(tr("Delete..."), QDialogButtonBox::AcceptRole);
diff --git a/src/plugins/vcsbase/diffandloghighlighter.cpp b/src/plugins/vcsbase/diffandloghighlighter.cpp
index afdc72cc678..a2f0836f35b 100644
--- a/src/plugins/vcsbase/diffandloghighlighter.cpp
+++ b/src/plugins/vcsbase/diffandloghighlighter.cpp
@@ -30,7 +30,7 @@
#include <utils/qtcassert.h>
#include <QDebug>
-#include <QRegExp>
+#include <QRegularExpression>
/*!
\class VcsBase::DiffAndLogHighlighter
@@ -88,8 +88,9 @@ static inline QTextCharFormat invertedColorFormat(const QTextCharFormat &in)
class DiffAndLogHighlighterPrivate
{
public:
- DiffAndLogHighlighterPrivate(DiffAndLogHighlighter *q_, const QRegExp &filePattern,
- const QRegExp &changePattern) :
+ DiffAndLogHighlighterPrivate(DiffAndLogHighlighter *q_,
+ const QRegularExpression &filePattern,
+ const QRegularExpression &changePattern) :
q(q_),
m_filePattern(filePattern),
m_changePattern(changePattern),
@@ -106,8 +107,8 @@ public:
DiffAndLogHighlighter *const q;
- mutable QRegExp m_filePattern;
- mutable QRegExp m_changePattern;
+ const QRegularExpression m_filePattern;
+ const QRegularExpression m_changePattern;
const QString m_locationIndicator;
const QChar m_diffInIndicator;
const QChar m_diffOutIndicator;
@@ -120,9 +121,9 @@ TextEditor::TextStyle DiffAndLogHighlighterPrivate::analyzeLine(const QString &t
{
// Do not match on git "--- a/" as a deleted line, check
// file first
- if (m_filePattern.indexIn(text) == 0)
+ if (m_filePattern.match(text).capturedStart() == 0)
return TextEditor::C_DIFF_FILE;
- if (m_changePattern.indexIn(text) == 0)
+ if (m_changePattern.match(text).capturedStart() == 0)
return TextEditor::C_LOG_CHANGE_LINE;
if (text.startsWith(m_diffInIndicator))
return TextEditor::C_ADDED_LINE;
@@ -141,7 +142,8 @@ void DiffAndLogHighlighterPrivate::updateOtherFormats()
}
// --- DiffAndLogHighlighter
-DiffAndLogHighlighter::DiffAndLogHighlighter(const QRegExp &filePattern, const QRegExp &changePattern) :
+DiffAndLogHighlighter::DiffAndLogHighlighter(const QRegularExpression &filePattern,
+ const QRegularExpression &changePattern) :
TextEditor::SyntaxHighlighter(static_cast<QTextDocument *>(nullptr)),
d(new DiffAndLogHighlighterPrivate(this, filePattern, changePattern))
{
diff --git a/src/plugins/vcsbase/diffandloghighlighter.h b/src/plugins/vcsbase/diffandloghighlighter.h
index 3847f287ba2..c43f4a510d7 100644
--- a/src/plugins/vcsbase/diffandloghighlighter.h
+++ b/src/plugins/vcsbase/diffandloghighlighter.h
@@ -30,7 +30,7 @@
#include <texteditor/syntaxhighlighter.h>
QT_BEGIN_NAMESPACE
-class QRegExp;
+class QRegularExpression;
class QTextCharFormat;
QT_END_NAMESPACE
@@ -45,7 +45,8 @@ class VCSBASE_EXPORT DiffAndLogHighlighter : public TextEditor::SyntaxHighlighte
Q_OBJECT
public:
- explicit DiffAndLogHighlighter(const QRegExp &filePattern, const QRegExp &changePattern);
+ explicit DiffAndLogHighlighter(const QRegularExpression &filePattern,
+ const QRegularExpression &changePattern);
~DiffAndLogHighlighter() override;
void highlightBlock(const QString &text) override;
diff --git a/src/plugins/vcsbase/nicknamedialog.cpp b/src/plugins/vcsbase/nicknamedialog.cpp
index 11737ec08ba..799ef29faf0 100644
--- a/src/plugins/vcsbase/nicknamedialog.cpp
+++ b/src/plugins/vcsbase/nicknamedialog.cpp
@@ -169,7 +169,6 @@ NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
m_model(model),
m_filterModel(new QSortFilterProxyModel(this))
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
okButton()->setEnabled(false);
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index 0471968dcfd..aac8696c0e0 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -50,7 +50,7 @@
#include <QDebug>
#include <QFileInfo>
#include <QFile>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QSet>
#include <QTextCodec>
#include <QUrl>
@@ -402,7 +402,7 @@ private:
};
UrlData m_urlData;
- QRegExp m_pattern;
+ QRegularExpression m_pattern;
};
UrlTextCursorHandler::UrlTextCursorHandler(VcsBaseEditorWidget *editorWidget)
@@ -424,16 +424,17 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor)
const QString line = cursorForUrl.selectedText();
const int cursorCol = cursor.columnNumber();
int urlMatchIndex = -1;
- do {
- urlMatchIndex = m_pattern.indexIn(line, urlMatchIndex + 1);
- if (urlMatchIndex != -1) {
- const QString url = m_pattern.cap(0);
- if (urlMatchIndex <= cursorCol && cursorCol <= urlMatchIndex + url.length()) {
- m_urlData.startColumn = urlMatchIndex;
- m_urlData.url = url;
- }
+ QRegularExpressionMatchIterator i = m_pattern.globalMatch(line);
+ while (i.hasNext()) {
+ const QRegularExpressionMatch match = i.next();
+ urlMatchIndex = match.capturedStart();
+ const QString url = match.captured(0);
+ if (urlMatchIndex <= cursorCol && cursorCol <= urlMatchIndex + url.length()) {
+ m_urlData.startColumn = urlMatchIndex;
+ m_urlData.url = url;
+ break;
}
- } while (urlMatchIndex != -1 && m_urlData.startColumn == -1);
+ };
}
return m_urlData.startColumn != -1;
@@ -474,7 +475,7 @@ QString UrlTextCursorHandler::currentContents() const
void UrlTextCursorHandler::setUrlPattern(const QString &pattern)
{
- m_pattern = QRegExp(pattern);
+ m_pattern = QRegularExpression(pattern);
QTC_ASSERT(m_pattern.isValid(), return);
}
@@ -554,8 +555,10 @@ public:
QString m_workingDirectory;
- QRegExp m_diffFilePattern;
- QRegExp m_logEntryPattern;
+ QRegularExpression m_diffFilePattern;
+ QRegularExpression m_logEntryPattern;
+ QRegularExpression m_annotationEntryPattern;
+ QRegularExpression m_annotationSeparatorPattern;
QList<int> m_entrySections; // line number where this section starts
int m_cursorLine = -1;
int m_firstLineNumber = -1;
@@ -649,16 +652,34 @@ void VcsBaseEditorWidget::setParameters(const VcsBaseEditorParameters *parameter
d->m_parameters = parameters;
}
-void VcsBaseEditorWidget::setDiffFilePattern(const QRegExp &pattern)
+static void regexpFromString(
+ const QString &pattern,
+ QRegularExpression *regexp,
+ QRegularExpression::PatternOptions options = QRegularExpression::NoPatternOption)
+{
+ const QRegularExpression re(pattern, options);
+ QTC_ASSERT(re.isValid() && re.captureCount() >= 1, return);
+ *regexp = re;
+}
+
+void VcsBaseEditorWidget::setDiffFilePattern(const QString &pattern)
{
- QTC_ASSERT(pattern.isValid() && pattern.captureCount() >= 1, return);
- d->m_diffFilePattern = pattern;
+ regexpFromString(pattern, &d->m_diffFilePattern);
}
-void VcsBaseEditorWidget::setLogEntryPattern(const QRegExp &pattern)
+void VcsBaseEditorWidget::setLogEntryPattern(const QString &pattern)
{
- QTC_ASSERT(pattern.isValid() && pattern.captureCount() >= 1, return);
- d->m_logEntryPattern = pattern;
+ regexpFromString(pattern, &d->m_logEntryPattern);
+}
+
+void VcsBaseEditorWidget::setAnnotationEntryPattern(const QString &pattern)
+{
+ regexpFromString(pattern, &d->m_annotationEntryPattern, QRegularExpression::MultilineOption);
+}
+
+void VcsBaseEditorWidget::setAnnotationSeparatorPattern(const QString &pattern)
+{
+ regexpFromString(pattern, &d->m_annotationSeparatorPattern);
}
bool VcsBaseEditorWidget::supportChangeLinks() const
@@ -864,7 +885,7 @@ void VcsBaseEditorWidget::slotPopulateDiffBrowser()
for (QTextBlock it = document()->begin(); it != cend; it = it.next(), lineNumber++) {
const QString text = it.text();
// Check for a new diff section (not repeating the last filename)
- if (d->m_diffFilePattern.indexIn(text) == 0) {
+ if (d->m_diffFilePattern.match(text).capturedStart() == 0) {
const QString file = fileNameFromDiffSpecification(it);
if (!file.isEmpty() && lastFileName != file) {
lastFileName = file;
@@ -888,9 +909,10 @@ void VcsBaseEditorWidget::slotPopulateLogBrowser()
for (QTextBlock it = document()->begin(); it != cend; it = it.next(), lineNumber++) {
const QString text = it.text();
// Check for a new log section (not repeating the last filename)
- if (d->m_logEntryPattern.indexIn(text) != -1) {
+ const QRegularExpressionMatch match = d->m_logEntryPattern.match(text);
+ if (match.hasMatch()) {
d->m_entrySections.push_back(d->m_entrySections.empty() ? 0 : lineNumber);
- QString entry = d->m_logEntryPattern.cap(1);
+ QString entry = match.captured(1);
QString subject = revisionSubject(it);
if (!subject.isEmpty()) {
if (subject.length() > 100) {
@@ -1198,7 +1220,8 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const
unicode.append(QLatin1Char('\n'));
for (block = block.next() ; block.isValid() ; block = block.next()) {
const QString line = block.text();
- if (checkChunkLine(line, &chunkStart) || d->m_diffFilePattern.indexIn(line) == 0) {
+ if (checkChunkLine(line, &chunkStart)
+ || d->m_diffFilePattern.match(line).capturedStart() == 0) {
break;
} else {
unicode += line;
@@ -1518,8 +1541,9 @@ QString VcsBaseEditorWidget::fileNameFromDiffSpecification(const QTextBlock &inB
QString fileName;
for (QTextBlock block = inBlock; block.isValid(); block = block.previous()) {
const QString line = block.text();
- if (d->m_diffFilePattern.indexIn(line) != -1) {
- QString cap = d->m_diffFilePattern.cap(1);
+ const QRegularExpressionMatch match = d->m_diffFilePattern.match(line);
+ if (match.hasMatch()) {
+ QString cap = match.captured(1);
if (header)
header->prepend(line + QLatin1String("\n"));
if (fileName.isEmpty() && !cap.isEmpty())
@@ -1537,6 +1561,26 @@ void VcsBaseEditorWidget::addChangeActions(QMenu *, const QString &)
{
}
+QSet<QString> VcsBaseEditorWidget::annotationChanges() const
+{
+ QSet<QString> changes;
+ QString text = toPlainText();
+ QStringRef txt(&text);
+ if (txt.isEmpty())
+ return changes;
+ if (!d->m_annotationSeparatorPattern.pattern().isEmpty()) {
+ const QRegularExpressionMatch match = d->m_annotationSeparatorPattern.match(txt);
+ if (match.hasMatch())
+ txt.truncate(match.capturedStart());
+ }
+ QRegularExpressionMatchIterator i = d->m_annotationEntryPattern.globalMatch(txt);
+ while (i.hasNext()) {
+ const QRegularExpressionMatch match = i.next();
+ changes.insert(match.captured(1));
+ }
+ return changes;
+}
+
QString VcsBaseEditorWidget::decorateVersion(const QString &revision) const
{
return revision;
diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h
index 863d300d62f..6e32037b680 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.h
+++ b/src/plugins/vcsbase/vcsbaseeditor.h
@@ -32,7 +32,6 @@
#include <QSet>
QT_BEGIN_NAMESPACE
-class QRegExp;
class QTextCodec;
class QTextCursor;
QT_END_NAMESPACE
@@ -145,9 +144,13 @@ protected:
// virtual functions).
VcsBaseEditorWidget();
// Pattern for diff header. File name must be in the first capture group
- void setDiffFilePattern(const QRegExp &pattern);
+ void setDiffFilePattern(const QString &pattern);
// Pattern for log entry. hash/revision number must be in the first capture group
- void setLogEntryPattern(const QRegExp &pattern);
+ void setLogEntryPattern(const QString &pattern);
+ // Pattern for annotation entry. hash/revision number must be in the first capture group
+ void setAnnotationEntryPattern(const QString &pattern);
+ // Pattern for annotation separator. Lookup will stop on match.
+ void setAnnotationSeparatorPattern(const QString &pattern);
virtual bool supportChangeLinks() const;
virtual QString fileNameForLine(int line) const;
@@ -246,7 +249,7 @@ protected:
// Implement to return a set of change identifiers in
// annotation mode
- virtual QSet<QString> annotationChanges() const = 0;
+ QSet<QString> annotationChanges() const;
// Implement to identify a change number at the cursor position
virtual QString changeUnderCursor(const QTextCursor &) const = 0;
// Factory functions for highlighters
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
index 3dec0aeaefe..fa0e19928d7 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
@@ -163,6 +163,7 @@ VcsBaseSubmitEditorPrivate::VcsBaseSubmitEditorPrivate(SubmitEditorWidget *edito
VcsBaseSubmitEditor::VcsBaseSubmitEditor(SubmitEditorWidget *editorWidget)
{
+ setWidget(editorWidget);
d = new VcsBaseSubmitEditorPrivate(editorWidget, this);
}
diff --git a/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h b/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h
index 538f2c7d3fa..88ed3d23448 100644
--- a/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h
+++ b/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h
@@ -60,6 +60,16 @@ public:
diagnosticConsumer);
}
+#if LLVM_VERSION_MAJOR >= 10
+ std::unique_ptr<clang::FrontendAction> create() override
+ {
+ return std::make_unique<CollectBuildDependencyAction>(
+ m_buildDependency,
+ m_filePathCache,
+ m_excludedIncludeUIDs,
+ m_alreadyIncludedFileUIDs);
+ }
+#else
clang::FrontendAction *create() override
{
return new CollectBuildDependencyAction(m_buildDependency,
@@ -67,6 +77,7 @@ public:
m_excludedIncludeUIDs,
m_alreadyIncludedFileUIDs);
}
+#endif
std::vector<uint> generateExcludedIncludeFileUIDs(clang::FileManager &fileManager) const
{
@@ -77,7 +88,11 @@ public:
NativeFilePath nativeFilePath{filePath};
const clang::FileEntry *file = fileManager.getFile({nativeFilePath.path().data(),
nativeFilePath.path().size()},
- true);
+ true)
+#if LLVM_VERSION_MAJOR >= 10
+ .get()
+#endif
+ ;
if (file)
fileUIDs.push_back(file->getUID());
diff --git a/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h b/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h
index 423d5f88764..473b8e7df8a 100644
--- a/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h
+++ b/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h
@@ -61,6 +61,17 @@ public:
diagnosticConsumer);
}
+#if LLVM_VERSION_MAJOR >= 10
+ std::unique_ptr<clang::FrontendAction> create() override
+ {
+ return std::make_unique<CollectUsedMacrosAction>(
+ m_usedMacros,
+ m_filePathCache,
+ m_sourceDependencies,
+ m_sourceFiles,
+ m_fileStatuses);
+ }
+#else
clang::FrontendAction *create() override
{
return new CollectUsedMacrosAction(m_usedMacros,
@@ -69,6 +80,7 @@ public:
m_sourceFiles,
m_fileStatuses);
}
+#endif
private:
UsedMacros &m_usedMacros;
diff --git a/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h b/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h
index c4a8cae0286..f1e4c74457e 100644
--- a/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h
+++ b/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h
@@ -68,10 +68,17 @@ public:
, m_fileContent(fileContent)
{}
+#if LLVM_VERSION_MAJOR >= 10
+ std::unique_ptr<clang::FrontendAction> create() override
+ {
+ return std::make_unique<GeneratePCHAction>(m_filePath, m_fileContent);
+ }
+#else
clang::FrontendAction *create() override
{
return new GeneratePCHAction{m_filePath, m_fileContent};
}
+#endif
private:
llvm::StringRef m_filePath;
diff --git a/src/tools/clangrefactoringbackend/source/clangquery.cpp b/src/tools/clangrefactoringbackend/source/clangquery.cpp
index 21ebeb83674..78f2350d8de 100644
--- a/src/tools/clangrefactoringbackend/source/clangquery.cpp
+++ b/src/tools/clangrefactoringbackend/source/clangquery.cpp
@@ -78,7 +78,8 @@ void ClangQuery::findLocations()
std::make_move_iterator(asts.end()),
[&] (std::unique_ptr<clang::ASTUnit> &&ast) {
Diagnostics diagnostics;
- auto optionalMatcher = Parser::parseMatcherExpression({m_query.data(), m_query.size()},
+ llvm::StringRef query{m_query.data(), m_query.size()};
+ auto optionalMatcher = Parser::parseMatcherExpression(query,
nullptr,
&diagnostics);
parseDiagnostics(diagnostics);
diff --git a/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h b/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h
index a38f1c4f879..4f36adadf5f 100644
--- a/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h
+++ b/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h
@@ -48,7 +48,11 @@ class CollectSymbolsAction : public clang::WrapperFrontendAction
public:
CollectSymbolsAction(std::shared_ptr<IndexDataConsumer> indexDataConsumer)
: clang::WrapperFrontendAction(
- clang::index::createIndexingAction(indexDataConsumer, createIndexingOptions(), nullptr))
+ clang::index::createIndexingAction(indexDataConsumer, createIndexingOptions()
+#if LLVM_VERSION_MAJOR < 10
+ , nullptr
+#endif
+ ))
, m_indexDataConsumer(indexDataConsumer)
{}
diff --git a/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp b/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp
index e2871444625..5d21b30b9c2 100644
--- a/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp
+++ b/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp
@@ -118,11 +118,16 @@ bool IndexDataConsumer::isAlreadyParsed(clang::FileID fileId, SourcesManager &so
return sourcesManager.alreadyParsed(filePathId(fileEntry), fileEntry->getModificationTime());
}
-bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration,
- clang::index::SymbolRoleSet symbolRoles,
- llvm::ArrayRef<clang::index::SymbolRelation> /*symbolRelations*/,
- clang::SourceLocation sourceLocation,
- IndexDataConsumer::ASTNodeInfo /*astNodeInfo*/)
+#if LLVM_VERSION_MAJOR >= 10
+ bool IndexDataConsumer::handleDeclOccurrence(
+#else
+ bool IndexDataConsumer::handleDeclOccurence(
+#endif
+ const clang::Decl *declaration,
+ clang::index::SymbolRoleSet symbolRoles,
+ llvm::ArrayRef<clang::index::SymbolRelation> /*symbolRelations*/,
+ clang::SourceLocation sourceLocation,
+ IndexDataConsumer::ASTNodeInfo /*astNodeInfo*/)
{
const auto *namedDeclaration = clang::dyn_cast<clang::NamedDecl>(declaration);
if (namedDeclaration) {
@@ -175,10 +180,15 @@ SourceLocationKind macroSymbolType(clang::index::SymbolRoleSet roles)
} // namespace
-bool IndexDataConsumer::handleMacroOccurence(const clang::IdentifierInfo *identifierInfo,
- const clang::MacroInfo *macroInfo,
- clang::index::SymbolRoleSet roles,
- clang::SourceLocation sourceLocation)
+#if LLVM_VERSION_MAJOR >= 10
+bool IndexDataConsumer::handleMacroOccurrence(
+#else
+bool IndexDataConsumer::handleMacroOccurence(
+#endif
+ const clang::IdentifierInfo *identifierInfo,
+ const clang::MacroInfo *macroInfo,
+ clang::index::SymbolRoleSet roles,
+ clang::SourceLocation sourceLocation)
{
if (macroInfo && sourceLocation.isFileID()
&& !isAlreadyParsed(m_sourceManager->getFileID(sourceLocation), m_macroSourcesManager)
diff --git a/src/tools/clangrefactoringbackend/source/indexdataconsumer.h b/src/tools/clangrefactoringbackend/source/indexdataconsumer.h
index c80e066b6c1..e1d3529806e 100644
--- a/src/tools/clangrefactoringbackend/source/indexdataconsumer.h
+++ b/src/tools/clangrefactoringbackend/source/indexdataconsumer.h
@@ -57,16 +57,26 @@ public:
IndexDataConsumer(const IndexDataConsumer &) = delete;
IndexDataConsumer &operator=(const IndexDataConsumer &) = delete;
- bool handleDeclOccurence(const clang::Decl *declaration,
- clang::index::SymbolRoleSet symbolRoles,
- llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
- clang::SourceLocation sourceLocation,
- ASTNodeInfo astNodeInfo) override;
+#if LLVM_VERSION_MAJOR >= 10
+ bool handleDeclOccurrence(
+#else
+ bool handleDeclOccurence(
+#endif
+ const clang::Decl *declaration,
+ clang::index::SymbolRoleSet symbolRoles,
+ llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
+ clang::SourceLocation sourceLocation,
+ ASTNodeInfo astNodeInfo) override;
- bool handleMacroOccurence(const clang::IdentifierInfo *identifierInfo,
- const clang::MacroInfo *macroInfo,
- clang::index::SymbolRoleSet roles,
- clang::SourceLocation sourceLocation) override;
+#if LLVM_VERSION_MAJOR >= 10
+ bool handleMacroOccurrence(
+#else
+ bool handleMacroOccurence(
+#endif
+ const clang::IdentifierInfo *identifierInfo,
+ const clang::MacroInfo *macroInfo,
+ clang::index::SymbolRoleSet roles,
+ clang::SourceLocation sourceLocation) override;
void finish() override;
diff --git a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp
index a233f6d8fe5..dffd5838944 100644
--- a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp
+++ b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp
@@ -74,7 +74,11 @@ std::unique_ptr<clang::tooling::FrontendActionFactory> newFrontendActionFactory(
: m_action(consumerFactory)
{}
+#if LLVM_VERSION_MAJOR >= 10
+ std::unique_ptr<clang::FrontendAction> create() override { return std::make_unique<AdaptorAction>(m_action); }
+#else
clang::FrontendAction *create() override { return new AdaptorAction(m_action); }
+#endif
private:
class AdaptorAction : public clang::ASTFrontendAction
diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt
index c3c53cfd813..941951f4982 100644
--- a/src/tools/qml2puppet/CMakeLists.txt
+++ b/src/tools/qml2puppet/CMakeLists.txt
@@ -47,9 +47,10 @@ extend_qtc_executable(qml2puppet
changeselectioncommand.cpp changeselectioncommand.h
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
update3dviewstatecommand.cpp update3dviewstatecommand.h
- enable3dviewcommand.cpp enable3dviewcommand.h
view3dclosedcommand.cpp view3dclosedcommand.h
puppettocreatorcommand.cpp puppettocreatorcommand.h
+ inputeventcommand.cpp inputeventcommand.h
+ view3dactioncommand.cpp view3dactioncommand.h
valueschangedcommand.cpp
)
diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs
index 8cdbbb84d83..bf494c8a7bd 100644
--- a/src/tools/qml2puppet/qml2puppet.qbs
+++ b/src/tools/qml2puppet/qml2puppet.qbs
@@ -99,12 +99,14 @@ QtcTool {
"commands/drop3dlibraryitemcommand.h",
"commands/update3dviewstatecommand.cpp",
"commands/update3dviewstatecommand.h",
- "commands/enable3dviewcommand.cpp",
- "commands/enable3dviewcommand.h",
"commands/view3dclosedcommand.cpp",
"commands/view3dclosedcommand.h",
"commands/puppettocreatorcommand.cpp",
"commands/puppettocreatorcommand.h",
+ "commands/inputeventcommand.cpp",
+ "commands/inputeventcommand.h",
+ "commands/view3dactioncommand.cpp",
+ "commands/view3dactioncommand.h",
"container/addimportcontainer.cpp",
"container/addimportcontainer.h",
"container/idcontainer.cpp",
diff --git a/tests/auto/qml/qmldesigner/coretests/coretests.pro b/tests/auto/qml/qmldesigner/coretests/coretests.pro
index fbc7f4f0e2e..8a86681e62c 100644
--- a/tests/auto/qml/qmldesigner/coretests/coretests.pro
+++ b/tests/auto/qml/qmldesigner/coretests/coretests.pro
@@ -49,6 +49,7 @@ INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/components/stateseditor
INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/components/formeditor
INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/components/propertyeditor
INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/components/debugview
+INCLUDEPATH += $$IDE_SOURCE_TREE/src/plugins/qmldesigner/components/edit3d
INCLUDEPATH *= $$IDE_SOURCE_TREE/src/libs/3rdparty
include($$IDE_SOURCE_TREE/src/plugins/qmldesigner/designercore/designercore-lib.pri)
diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py
index c4be96bed85..90bbe4d7967 100644
--- a/tests/system/shared/classes.py
+++ b/tests/system/shared/classes.py
@@ -85,27 +85,6 @@ class ViewConstants:
# always adjust the following to the highest value of the available ViewConstants when adding new
LAST_AVAILABLE = HELP
- # this function returns a regex of the tooltip of the FancyTabBar elements
- # this is needed because the keyboard shortcut is OS specific
- # if the provided argument does not match any of the ViewConstants it returns None
- @staticmethod
- def getToolTipForViewTab(viewTab):
- if viewTab == ViewConstants.WELCOME:
- toolTip = ur'Switch to <b>Welcome</b> mode <span style="color: gray; font-size: small">(Ctrl\+|\u2303)%d</span>'
- elif viewTab == ViewConstants.EDIT:
- toolTip = ur'Switch to <b>Edit</b> mode <span style="color: gray; font-size: small">(Ctrl\+|\u2303)%d</span>'
- elif viewTab == ViewConstants.DESIGN:
- toolTip = ur'Switch to <b>Design</b> mode <span style="color: gray; font-size: small">(Ctrl\+|\u2303)%d</span>'
- elif viewTab == ViewConstants.DEBUG:
- toolTip = ur'Switch to <b>Debug</b> mode <span style="color: gray; font-size: small">(Ctrl\+|\u2303)%d</span>'
- elif viewTab == ViewConstants.PROJECTS:
- toolTip = ur'Switch to <b>Projects</b> mode <span style="color: gray; font-size: small">(Ctrl\+|\u2303)%d</span>'
- elif viewTab == ViewConstants.HELP:
- toolTip = ur'Switch to <b>Help</b> mode <span style="color: gray; font-size: small">(Ctrl\+|\u2303)%d</span>'
- else:
- return None
- return toolTip % (viewTab + 1)
-
class LibType:
SHARED = 0
STATIC = 1
diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py
index 880b37a64d4..587574ff0a5 100644
--- a/tests/system/shared/project_explorer.py
+++ b/tests/system/shared/project_explorer.py
@@ -30,19 +30,6 @@ def switchViewTo(view):
waitFor("not QToolTip.isVisible()", 15000)
if view < ViewConstants.FIRST_AVAILABLE or view > ViewConstants.LAST_AVAILABLE:
return
- tabBar = waitForObject("{name='ModeSelector' type='Core::Internal::FancyTabBar' visible='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}")
- mouseMove(tabBar, 20, 20 + 52 * view)
- if waitFor("QToolTip.isVisible()", 10000):
- text = str(QToolTip.text())
- else:
- test.warning("Waiting for ToolTip timed out.")
- text = ""
- pattern = ViewConstants.getToolTipForViewTab(view)
- if re.match(pattern, unicode(text), re.UNICODE):
- test.passes("ToolTip verified")
- else:
- test.warning("ToolTip does not match", "Expected pattern: %s\nGot: %s" % (pattern, text))
mouseClick(waitForObject("{name='ModeSelector' type='Core::Internal::FancyTabBar' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"), 20, 20 + 52 * view, 0, Qt.LeftButton)
@@ -159,13 +146,6 @@ def addAndActivateKit(kit):
mouseClick(index)
test.verify(waitFor("not str(index.toolTip).startswith(clickToActivate)", 1500),
"Kit added for this project")
- try:
- findObject(":Projects.ProjectNavigationTreeView")
- except:
- test.warning("Squish issue - QC switches automatically to Edit view after enabling "
- "a new kit when running tst_opencreator_qbs - works as expected when "
- "running without Squish")
- switchViewTo(ViewConstants.PROJECTS)
else:
test.warning("Kit is already added for this project.")
mouseClick(index)