mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
de-dupe the pills
This commit is contained in:
@@ -12,14 +12,15 @@ Rectangle {
|
|||||||
property var parentScreen: null
|
property var parentScreen: null
|
||||||
property real widgetThickness: 30
|
property real widgetThickness: 30
|
||||||
property real barThickness: 48
|
property real barThickness: 48
|
||||||
|
property bool isVerticalOrientation: false
|
||||||
property alias content: contentLoader.sourceComponent
|
property alias content: contentLoader.sourceComponent
|
||||||
|
|
||||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
width: contentLoader.item ? (contentLoader.item.implicitWidth + horizontalPadding * 2) : 0
|
width: isVerticalOrientation ? widgetThickness : contentLoader.item ? (contentLoader.item.implicitWidth + horizontalPadding * 2) : 0
|
||||||
height: widgetThickness
|
height: isVerticalOrientation ? (contentLoader.item ? (contentLoader.item.implicitHeight + horizontalPadding * 2) : 0) : widgetThickness
|
||||||
radius: SettingsData.dankBarNoBackground ? 0 : Theme.cornerRadius
|
radius: SettingsData.dankBarNoBackground ? 0 : Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
if (SettingsData.dankBarNoBackground) {
|
if (SettingsData.dankBarNoBackground) {
|
||||||
@@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -59,7 +59,7 @@ Item {
|
|||||||
width: isVertical ? (hasVerticalPill ? verticalPill.width : 0) : (hasHorizontalPill ? horizontalPill.width : 0)
|
width: isVertical ? (hasVerticalPill ? verticalPill.width : 0) : (hasHorizontalPill ? horizontalPill.width : 0)
|
||||||
height: isVertical ? (hasVerticalPill ? verticalPill.height : 0) : (hasHorizontalPill ? horizontalPill.height : 0)
|
height: isVertical ? (hasVerticalPill ? verticalPill.height : 0) : (hasHorizontalPill ? horizontalPill.height : 0)
|
||||||
|
|
||||||
BaseHorizontalPill {
|
BasePill {
|
||||||
id: horizontalPill
|
id: horizontalPill
|
||||||
visible: !isVertical && hasHorizontalPill
|
visible: !isVertical && hasHorizontalPill
|
||||||
axis: root.axis
|
axis: root.axis
|
||||||
@@ -76,7 +76,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseVerticalPill {
|
BasePill {
|
||||||
id: verticalPill
|
id: verticalPill
|
||||||
visible: isVertical && hasVerticalPill
|
visible: isVertical && hasVerticalPill
|
||||||
axis: root.axis
|
axis: root.axis
|
||||||
@@ -86,6 +86,7 @@ Item {
|
|||||||
widgetThickness: root.widgetThickness
|
widgetThickness: root.widgetThickness
|
||||||
barThickness: root.barThickness
|
barThickness: root.barThickness
|
||||||
content: root.verticalBarPill
|
content: root.verticalBarPill
|
||||||
|
isVerticalOrientation: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (hasPopout) {
|
if (hasPopout) {
|
||||||
pluginPopout.toggle()
|
pluginPopout.toggle()
|
||||||
|
|||||||
Reference in New Issue
Block a user