diff --git a/app/view/view.h b/app/view/view.h --- a/app/view/view.h +++ b/app/view/view.h @@ -69,6 +69,9 @@ class View : public PlasmaQuick::ContainmentView { Q_OBJECT + + Q_PROPERTY(Latte::Types::ViewType type READ type WRITE setType NOTIFY typeChanged) + Q_PROPERTY(bool alternativesIsShown READ alternativesIsShown NOTIFY alternativesIsShownChanged) Q_PROPERTY(bool behaveAsPlasmaPanel READ behaveAsPlasmaPanel WRITE setBehaveAsPlasmaPanel NOTIFY behaveAsPlasmaPanelChanged) Q_PROPERTY(bool byPassWM READ byPassWM WRITE setByPassWM NOTIFY byPassWMChanged) @@ -107,6 +110,9 @@ void init(); + Types::ViewType type() const; + void setType(Types::ViewType type); + bool alternativesIsShown() const; void setAlternativesIsShown(bool show); @@ -231,6 +237,7 @@ void onPrimaryChanged(); void positionerChanged(); void screenGeometryChanged(); + void typeChanged(); void visibilityChanged(); void windowsTrackerChanged(); void xChanged(); @@ -270,6 +277,7 @@ float m_maxLength{1}; Types::Alignment m_alignment{Types::Center}; + Types::ViewType m_type{Types::DockView}; QRect m_localGeometry; QRect m_absGeometry; diff --git a/app/view/view.cpp b/app/view/view.cpp --- a/app/view/view.cpp +++ b/app/view/view.cpp @@ -195,8 +195,9 @@ connect(corona(), &Plasma::Corona::availableScreenRectChanged, this, &View::availableScreenRectChanged); connect(this, &View::byPassWMChanged, this, &View::saveConfig); - connect(this, &View::onPrimaryChanged, this, &View::saveConfig); connect(this, &View::isPreferredForShortcutsChanged, this, &View::saveConfig); + connect(this, &View::onPrimaryChanged, this, &View::saveConfig); + connect(this, &View::typeChanged, this, &View::saveConfig); connect(this, SIGNAL(normalThicknessChanged()), corona(), SIGNAL(availableScreenRectChanged())); @@ -433,6 +434,21 @@ } } +Types::ViewType View::type() const +{ + return m_type; +} + +void View::setType(Types::ViewType type) +{ + if (m_type == type) { + return; + } + + m_type = type; + emit typeChanged(); +} + bool View::alternativesIsShown() const { return m_alternativesIsShown; @@ -1075,6 +1091,7 @@ config.writeEntry("onPrimary", onPrimary()); config.writeEntry("byPassWM", byPassWM()); config.writeEntry("isPreferredForShortcuts", isPreferredForShortcuts()); + config.writeEntry("viewType", (int)m_type); config.sync(); } diff --git a/containment/package/contents/ui/VisibilityManager.qml b/containment/package/contents/ui/VisibilityManager.qml --- a/containment/package/contents/ui/VisibilityManager.qml +++ b/containment/package/contents/ui/VisibilityManager.qml @@ -88,6 +88,13 @@ value: thicknessNormalOriginal } + Binding{ + target: latteView + property: "type" + when: latteView + value: root.viewType + } + Binding{ target: latteView property: "behaveAsPlasmaPanel" diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -77,6 +77,17 @@ && (plasmoid.configuration.panelPosition === Latte.Types.Justify) && !(root.solidStylePanel && panelShadowsActive)); } + property int viewType: { + if ((plasmoid.configuration.panelPosition === Latte.Types.Justify) + && (plasmoid.configuration.useThemePanel) + && (plasmoid.configuration.panelSize === 100) + && (plasmoid.configuration.zoomLevel === 0)) { + return Latte.Types.PanelView; + } + + return Latte.Types.DockView; + } + property bool blurEnabled: plasmoid.configuration.blurEnabled && (!root.forceTransparentPanel || root.forcePanelForBusyBackground) //|| (hasExpandedApplet && zoomFactor===1 && plasmoid.configuration.panelSize===100) diff --git a/liblatte2/types.h b/liblatte2/types.h --- a/liblatte2/types.h +++ b/liblatte2/types.h @@ -36,6 +36,13 @@ Types() = delete; ~Types() {} + enum ViewType + { + DockView = 0, + PanelView + }; + Q_ENUM(ViewType); + enum Visibility { None = -1, @@ -168,7 +175,7 @@ TouchingWindowColors }; Q_ENUM(WindowColorsGroup); - + enum LayoutsMemoryUsage { SingleLayout = 0, /* a single Layout is loaded in each time */ diff --git a/shell/package/contents/configuration/LatteDockConfiguration.qml b/shell/package/contents/configuration/LatteDockConfiguration.qml --- a/shell/package/contents/configuration/LatteDockConfiguration.qml +++ b/shell/package/contents/configuration/LatteDockConfiguration.qml @@ -88,7 +88,7 @@ LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true - readonly property bool viewIsPanel: behaviorPage.dockTypeSelection.isPanel + readonly property bool viewIsPanel: latteView.type === Latte.Types.PanelView property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical property int subGroupSpacing: units.largeSpacing + units.smallSpacing * 1.5 diff --git a/shell/package/contents/configuration/pages/BehaviorConfig.qml b/shell/package/contents/configuration/pages/BehaviorConfig.qml --- a/shell/package/contents/configuration/pages/BehaviorConfig.qml +++ b/shell/package/contents/configuration/pages/BehaviorConfig.qml @@ -36,8 +36,6 @@ Layout.maximumWidth: content.width + content.Layout.leftMargin * 2 Layout.maximumHeight: content.height + units.smallSpacing * 2 - property alias dockTypeSelection: _dockTypeSelection - ColumnLayout { id: content @@ -61,7 +59,7 @@ LatteExtraControls.TypeSelection{ - id: _dockTypeSelection + id: viewTypeSelection horizontal: true } } diff --git a/shell/package/contents/controls/TypeSelection.qml b/shell/package/contents/controls/TypeSelection.qml --- a/shell/package/contents/controls/TypeSelection.qml +++ b/shell/package/contents/controls/TypeSelection.qml @@ -54,22 +54,18 @@ property bool horizontal: false - readonly property bool isPanel: (plasmoid.configuration.panelPosition === Latte.Types.Justify) - && (plasmoid.configuration.useThemePanel) && (plasmoid.configuration.panelSize===100) - && (plasmoid.configuration.zoomLevel === 0) - ExclusiveGroup { - id: dockTypeGroup + id: viewTypeGroup } PlasmaComponents.Button { id: dockTypeButton width: horizontal ? (parent.width - parent.spacing)/ 2 : parent.width checkable: true - checked: !typeRow.isPanel + checked: latteView.type === Latte.Types.DockView text: i18nc("dock type","Dock") - exclusiveGroup: dockTypeGroup + exclusiveGroup: viewTypeGroup tooltip: i18n("Change the behavior and appearance to Dock type") onPressedChanged: { @@ -99,9 +95,9 @@ width: dockTypeButton.width checkable: true - checked: typeRow.isPanel + checked: latteView.type === Latte.Types.PanelView text: i18nc("panel type","Panel") - exclusiveGroup: dockTypeGroup + exclusiveGroup: viewTypeGroup tooltip: i18n("Change the behavior and appearance to Panel type") onPressedChanged: {