diff --git a/share/qtcreator/qmldesigner/toolbar/Main.qml b/share/qtcreator/qmldesigner/toolbar/Main.qml index 88a9bd744a2..5cdc2f4d516 100644 --- a/share/qtcreator/qmldesigner/toolbar/Main.qml +++ b/share/qtcreator/qmldesigner/toolbar/Main.qml @@ -282,7 +282,7 @@ Rectangle { ToolbarButton { id: enterComponent anchors.verticalCenter: parent.verticalCenter - anchors.right: lockWorkspace.left + anchors.right: backend.isLiteModeEnabled ? shareButton.left : lockWorkspace.left anchors.rightMargin: 10 enabled: goIntoComponentBackend.available tooltip: goIntoComponentBackend.tooltip @@ -305,7 +305,7 @@ Rectangle { tooltip: qsTr("Sets the visible Views to immovable across the Workspaces.") buttonIcon: backend.lockWorkspace ? StudioTheme.Constants.lockOn : StudioTheme.Constants.lockOff - visible: !root.flyoutEnabled + visible: !root.flyoutEnabled && !backend.isLiteModeEnabled checkable: true checked: backend.lockWorkspace checkedInverted: true @@ -318,9 +318,9 @@ Rectangle { style: StudioTheme.Values.toolbarStyle width: 210 anchors.verticalCenter: parent.verticalCenter - anchors.right: annotations.left + anchors.right: shareButton.left anchors.rightMargin: 10 - visible: !root.flyoutEnabled + visible: !root.flyoutEnabled && !backend.isLiteModeEnabled model: WorkspaceModel { id: workspaceModel } textRole: "displayName" valueRole: "fileName" @@ -333,20 +333,6 @@ Rectangle { onCountChanged: workspaces.currentIndex = workspaces.indexOfValue(backend.currentWorkspace) } - ToolbarButton { - id: annotations - visible: false - enabled: backend.isInDesignMode - anchors.verticalCenter: parent.verticalCenter - anchors.right: shareButton.left - anchors.rightMargin: 10 - width: 0 - tooltip: qsTr("Edit Annotations") - buttonIcon: StudioTheme.Constants.annotations_large - - onClicked: backend.editGlobalAnnoation() - } - ToolbarButton { id: shareButton style: StudioTheme.Values.primaryToolbarStyle @@ -394,7 +380,8 @@ Rectangle { readonly property int padding: 6 width: row.width + window.padding * 2 - height: row.height + workspacesFlyout.height + 3 * window.padding + height: row.height + (backend.isLiteModeEnabled ? 0 : workspacesFlyout.height) + + (backend.isLiteModeEnabled ? 2 : 3) * window.padding + (workspacesFlyout.popup.opened ? workspacesFlyout.popup.height : 0) visible: false flags: Qt.FramelessWindowHint | Qt.Dialog | Qt.NoDropShadowWindowHint @@ -470,6 +457,7 @@ Rectangle { : StudioTheme.Constants.lockOff checkable: true checked: backend.lockWorkspace + visible: !backend.isLiteModeEnabled onClicked: backend.setLockWorkspace(lockWorkspaceFlyout.checked) } @@ -498,6 +486,7 @@ Rectangle { textRole: "displayName" valueRole: "fileName" currentIndex: workspacesFlyout.indexOfValue(backend.currentWorkspace) + visible: !backend.isLiteModeEnabled onCompressedActivated: backend.setCurrentWorkspace(workspacesFlyout.currentValue) onCountChanged: workspacesFlyout.currentIndex = workspacesFlyout.indexOfValue(backend.currentWorkspace) diff --git a/src/libs/advanceddockingsystem/dockmanager.cpp b/src/libs/advanceddockingsystem/dockmanager.cpp index b718302f4cc..d88ef8002ea 100644 --- a/src/libs/advanceddockingsystem/dockmanager.cpp +++ b/src/libs/advanceddockingsystem/dockmanager.cpp @@ -102,6 +102,9 @@ public: bool m_wasShown = false; bool m_workspaceOrderDirty = false; + bool m_mcusProject = false; + bool m_liteModeEnabled = false; + /** * Private data constructor */ @@ -498,7 +501,10 @@ void DockManager::initialize() openWorkspace(workspace); - lockWorkspace(d->m_settings->value(Constants::LOCK_WORKSPACE_SETTINGS_KEY, false).toBool()); + if (d->m_liteModeEnabled) + lockWorkspace(true); + else + lockWorkspace(d->m_settings->value(Constants::LOCK_WORKSPACE_SETTINGS_KEY, false).toBool()); } DockAreaWidget *DockManager::addDockWidget(DockWidgetArea area, @@ -1749,11 +1755,21 @@ void DockManager::saveLockWorkspace() } void DockManager::setMcusProject(bool value) { - m_mcusProject = value; + d->m_mcusProject = value; } bool DockManager::mcusProject() const { - return m_mcusProject; + return d->m_mcusProject; +} + +void DockManager::setLiteMode(bool value) +{ + d->m_liteModeEnabled = value; +} + +bool DockManager::isLiteModeEnabled() const +{ + return d->m_liteModeEnabled; } } // namespace ADS diff --git a/src/libs/advanceddockingsystem/dockmanager.h b/src/libs/advanceddockingsystem/dockmanager.h index 23aa21a5781..7cff32085a4 100644 --- a/src/libs/advanceddockingsystem/dockmanager.h +++ b/src/libs/advanceddockingsystem/dockmanager.h @@ -126,7 +126,7 @@ public: = 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 + = 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 toolbar at all (enabling them will bring them back) DockAreaDynamicTabsMenuButtonVisibility @@ -144,6 +144,8 @@ public: EqualSplitOnInsertion = 0x400000, ///!< if enabled, the space is equally distributed to all widgets in a splitter + HideContextMenuDockWidgetTab = 0x800000, + MiddleMouseButtonClosesTab = 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse @@ -182,15 +184,15 @@ public: AutoHideButtonCheckable = 0x08, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes. AutoHideSideBarsIconOnly - = 0x10, ///< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown + = 0x10, //!< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown AutoHideShowOnMouseOver - = 0x20, ///< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container + = 0x20, //!< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container AutoHideCloseButtonCollapsesDock - = 0x40, ///< Close button of an auto hide container collapses the dock instead of hiding it completely + = 0x40, //!< Close button of an auto hide container collapses the dock instead of hiding it completely AutoHideHasCloseButton - = 0x80, //< If the flag is set an auto hide title bar has a close button + = 0x80, //!< If the flag is set an auto hide title bar has a close button AutoHideHasMinimizeButton - = 0x100, ///< if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget + = 0x100, //!< if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget DefaultAutoHideConfig = AutoHideFeatureEnabled | DockAreaHasAutoHideButton | AutoHideCloseButtonCollapsesDock | AutoHideHasCloseButton @@ -774,6 +776,9 @@ public: void setMcusProject(bool value); bool mcusProject() const; + void setLiteMode(bool value); + bool isLiteModeEnabled() const; + signals: void aboutToUnloadWorkspace(QString fileName); void aboutToLoadWorkspace(QString fileName); @@ -795,8 +800,6 @@ private: void saveStartupWorkspace(); void saveLockWorkspace(); - - bool m_mcusProject = false; }; // class DockManager } // namespace ADS diff --git a/src/libs/advanceddockingsystem/dockwidgettab.cpp b/src/libs/advanceddockingsystem/dockwidgettab.cpp index 3d1ef7d4905..bcf8540d357 100644 --- a/src/libs/advanceddockingsystem/dockwidgettab.cpp +++ b/src/libs/advanceddockingsystem/dockwidgettab.cpp @@ -461,6 +461,9 @@ void DockWidgetTab::mouseMoveEvent(QMouseEvent *event) void DockWidgetTab::contextMenuEvent(QContextMenuEvent *event) { + if (DockManager::testConfigFlag(DockManager::HideContextMenuDockWidgetTab)) + return; + event->accept(); if (d->isDraggingState(DraggingFloatingWidget)) return; diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp index cb84183f927..47465ebe7bf 100644 --- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp +++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.cpp @@ -763,6 +763,11 @@ bool ToolBarBackend::isDocumentDirty() const && Core::EditorManager::currentDocument()->isModified(); } +bool ToolBarBackend::isLiteModeEnabled() const +{ + return QmlDesignerBasePlugin::isLiteModeEnabled(); +} + void ToolBarBackend::launchGlobalAnnotations() { QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_TOOLBAR_EDIT_GLOBAL_ANNOTATION); diff --git a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h index 02bdae17170..1ffc28aec9d 100644 --- a/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h +++ b/src/plugins/qmldesigner/components/toolbar/toolbarbackend.h @@ -99,6 +99,8 @@ class ToolBarBackend : public QObject Q_PROPERTY(bool isSharingEnabled READ isSharingEnabled NOTIFY isSharingEnabledChanged) Q_PROPERTY(bool isDocumentDirty READ isDocumentDirty NOTIFY isDocumentDirtyChanged) + Q_PROPERTY(bool isLiteModeEnabled READ isLiteModeEnabled CONSTANT) + public: ToolBarBackend(QObject *parent = nullptr); static void registerDeclarativeType(); @@ -150,6 +152,8 @@ public: bool isDocumentDirty() const; + bool isLiteModeEnabled() const; + static void launchGlobalAnnotations(); signals: diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index a1f75b6205f..e879b114deb 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -205,14 +205,20 @@ void DesignModeWidget::setup() ADS::DockManager::setConfigFlag(ADS::DockManager::OpaqueSplitterResize, true); ADS::DockManager::setConfigFlag(ADS::DockManager::AllTabsHaveCloseButton, false); ADS::DockManager::setConfigFlag(ADS::DockManager::RetainTabSizeWhenCloseButtonHidden, true); - //ADS::DockManager::setAutoHideConfigFlags(ADS::DockManager::DefaultAutoHideConfig); + if (QmlDesignerBasePlugin::isLiteModeEnabled()) { + ADS::DockManager::setConfigFlag(ADS::DockManager::ActiveTabHasCloseButton, false); + ADS::DockManager::setConfigFlag(ADS::DockManager::MiddleMouseButtonClosesTab, false); + ADS::DockManager::setConfigFlag(ADS::DockManager::HideContextMenuDockWidgetTab, true); + } + auto designerSettings = DesignerSettings(settings); if (designerSettings.value(DesignerSettingsKey::ENABLE_DOCKWIDGET_CONTENT_MIN_SIZE).toBool()) m_minimumSizeHintMode = ADS::DockWidget::MinimumSizeHintFromContentMinimumSize; m_dockManager = new ADS::DockManager(this); + m_dockManager->setLiteMode(QmlDesignerBasePlugin::isLiteModeEnabled()); m_dockManager->setSettings(settings); m_dockManager->setWorkspacePresetsPath( Core::ICore::resourcePath("qmldesigner/workspacePresets/").toString()); @@ -277,35 +283,6 @@ void DesignModeWidget::setup() ADS::DockManager::iconProvider().registerCustomIcon(ADS::FloatingWidgetNormalIcon, floatingWidgetNormalIcon); - // Setup Actions and Menus - Core::ActionContainer *mview = Core::ActionManager::actionContainer(Core::Constants::M_VIEW); - // View > Views - Core::ActionContainer *mviews = Core::ActionManager::createMenu(Core::Constants::M_VIEW_VIEWS); - connect(mviews->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowViews); - mviews->menu()->addSeparator(); - // View > Workspaces - Core::ActionContainer *mworkspaces = Core::ActionManager::createMenu(QmlDesigner::Constants::M_VIEW_WORKSPACES); - mview->addMenu(mworkspaces, Core::Constants::G_VIEW_VIEWS); - mworkspaces->menu()->setTitle(tr("&Workspaces")); - mworkspaces->setOnAllDisabledBehavior(Core::ActionContainer::Show); - // Connect opening of the 'workspaces' menu with creation of the workspaces menu - connect(mworkspaces->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowWorkspaces); - - // Initially disable menus - mworkspaces->menu()->setEnabled(false); - - // Enable/disable menus when mode is different to MODE_DESIGN - connect(Core::ModeManager::instance(), - &Core::ModeManager::currentModeChanged, - this, - [mworkspaces](Utils::Id mode, Utils::Id) { - if (mode == Core::Constants::MODE_DESIGN) { - mworkspaces->menu()->setEnabled(true); - } else { - mworkspaces->menu()->setEnabled(false); - } - }); - // Create a DockWidget for each QWidget and add them to the DockManager const Core::Context designContext(Core::Constants::C_DESIGN_MODE); static const Utils::Id actionToggle("QmlDesigner.Toggle"); @@ -403,8 +380,40 @@ void DesignModeWidget::setup() return first->description() < second->description(); }); - for (Core::Command *command : viewCommands) - mviews->addAction(command); + if (!QmlDesignerBasePlugin::isLiteModeEnabled()) { + // Setup Actions and Menus + Core::ActionContainer *mview = Core::ActionManager::actionContainer(Core::Constants::M_VIEW); + // View > Views + Core::ActionContainer *mviews = Core::ActionManager::createMenu(Core::Constants::M_VIEW_VIEWS); + connect(mviews->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowViews); + mviews->menu()->addSeparator(); + // View > Workspaces + Core::ActionContainer *mworkspaces = Core::ActionManager::createMenu( + QmlDesigner::Constants::M_VIEW_WORKSPACES); + mview->addMenu(mworkspaces, Core::Constants::G_VIEW_VIEWS); + mworkspaces->menu()->setTitle(tr("&Workspaces")); + mworkspaces->setOnAllDisabledBehavior(Core::ActionContainer::Show); + // Connect opening of the 'workspaces' menu with creation of the workspaces menu + connect(mworkspaces->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowWorkspaces); + + // Initially disable menus + mworkspaces->menu()->setEnabled(false); + + // Enable/disable menus when mode is different to MODE_DESIGN + connect(Core::ModeManager::instance(), + &Core::ModeManager::currentModeChanged, + this, + [mworkspaces](Utils::Id mode, Utils::Id) { + if (mode == Core::Constants::MODE_DESIGN) { + mworkspaces->menu()->setEnabled(true); + } else { + mworkspaces->menu()->setEnabled(false); + } + }); + + for (Core::Command *command : viewCommands) + mviews->addAction(command); + } // Create toolbars if (!ToolBar::isVisible()) {