diff --git a/Modules/Plugins/BaseHorizontalPill.qml b/Modules/Plugins/BasePill.qml similarity index 83% rename from Modules/Plugins/BaseHorizontalPill.qml rename to Modules/Plugins/BasePill.qml index 85b6109c..19d2f989 100644 --- a/Modules/Plugins/BaseHorizontalPill.qml +++ b/Modules/Plugins/BasePill.qml @@ -12,14 +12,15 @@ Rectangle { property var parentScreen: null property real widgetThickness: 30 property real barThickness: 48 + property bool isVerticalOrientation: false property alias content: contentLoader.sourceComponent readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30)) signal clicked() - width: contentLoader.item ? (contentLoader.item.implicitWidth + horizontalPadding * 2) : 0 - height: widgetThickness + width: isVerticalOrientation ? widgetThickness : contentLoader.item ? (contentLoader.item.implicitWidth + horizontalPadding * 2) : 0 + height: isVerticalOrientation ? (contentLoader.item ? (contentLoader.item.implicitHeight + horizontalPadding * 2) : 0) : widgetThickness radius: SettingsData.dankBarNoBackground ? 0 : Theme.cornerRadius color: { if (SettingsData.dankBarNoBackground) { diff --git a/Modules/Plugins/BaseVerticalPill.qml b/Modules/Plugins/BaseVerticalPill.qml deleted file mode 100644 index 2fcf9d20..00000000 --- a/Modules/Plugins/BaseVerticalPill.qml +++ /dev/null @@ -1,53 +0,0 @@ -import QtQuick -import qs.Common -import qs.Services -import qs.Widgets - -Rectangle { - id: root - - property var axis: null - property string section: "center" - property var popoutTarget: null - property var parentScreen: null - property real widgetThickness: 30 - property real barThickness: 48 - property alias content: contentLoader.sourceComponent - - readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30)) - - signal clicked() - - width: widgetThickness - height: contentLoader.item ? (contentLoader.item.implicitHeight + horizontalPadding * 2) : 0 - radius: SettingsData.dankBarNoBackground ? 0 : Theme.cornerRadius - color: { - if (SettingsData.dankBarNoBackground) { - return "transparent" - } - - const baseColor = mouseArea.containsMouse ? Theme.widgetBaseHoverColor : Theme.widgetBaseBackgroundColor - return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency) - } - - Loader { - id: contentLoader - anchors.centerIn: parent - } - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onPressed: { - if (popoutTarget && popoutTarget.setTriggerPosition) { - const globalPos = mapToGlobal(0, 0) - const currentScreen = parentScreen || Screen - const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, height) - popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen) - } - root.clicked() - } - } -} diff --git a/Modules/Plugins/PluginComponent.qml b/Modules/Plugins/PluginComponent.qml index 4e1a4f0b..51ca65c0 100644 --- a/Modules/Plugins/PluginComponent.qml +++ b/Modules/Plugins/PluginComponent.qml @@ -59,7 +59,7 @@ Item { width: isVertical ? (hasVerticalPill ? verticalPill.width : 0) : (hasHorizontalPill ? horizontalPill.width : 0) height: isVertical ? (hasVerticalPill ? verticalPill.height : 0) : (hasHorizontalPill ? horizontalPill.height : 0) - BaseHorizontalPill { + BasePill { id: horizontalPill visible: !isVertical && hasHorizontalPill axis: root.axis @@ -76,7 +76,7 @@ Item { } } - BaseVerticalPill { + BasePill { id: verticalPill visible: isVertical && hasVerticalPill axis: root.axis @@ -86,6 +86,7 @@ Item { widgetThickness: root.widgetThickness barThickness: root.barThickness content: root.verticalBarPill + isVerticalOrientation: true onClicked: { if (hasPopout) { pluginPopout.toggle()