added audio and apps page in settings
This commit is contained in:
@@ -1,68 +1,121 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Config
|
||||
import Quickshell
|
||||
import qs.Components
|
||||
import qs.Modules.SettingsNew
|
||||
import qs.Config
|
||||
import qs.Drawers
|
||||
|
||||
ConnectedRect {
|
||||
id: root
|
||||
|
||||
property alias checked: switchButton.checked
|
||||
property int horizontalPadding: Appearance.padding.largeIncreased
|
||||
required property Component popup
|
||||
property alias subtext: subtext.text
|
||||
property alias text: text.text
|
||||
property int verticalPadding: Appearance.padding.normal
|
||||
|
||||
signal clicked(checked: bool)
|
||||
default required property Item content
|
||||
property alias icon: icon.text
|
||||
property bool keepPopupAsChild
|
||||
property alias label: label.text
|
||||
readonly property alias popup: popup
|
||||
property alias status: status.text
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: layout.implicitHeight + verticalPadding * 2
|
||||
|
||||
Column {
|
||||
id: layout
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: root.horizontalPadding
|
||||
anchors.right: icon.left
|
||||
anchors.rightMargin: Appearance.padding.normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
CustomText {
|
||||
id: text
|
||||
|
||||
font.pointSize: Appearance.font.size.smaller
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: subtext
|
||||
|
||||
color: DynamicColors.palette.m3outline
|
||||
font.pointSize: Appearance.font.size.small
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
id: icon
|
||||
|
||||
anchors.right: switchButton.left
|
||||
anchors.rightMargin: Appearance.spacing.normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "open_in_new"
|
||||
}
|
||||
implicitHeight: navLayout.implicitHeight + navLayout.anchors.margins * 2
|
||||
|
||||
StateLayer {
|
||||
onClicked: PopupManager.requestOpen(root.popup)
|
||||
id: stateLayer
|
||||
|
||||
manualHoverOverride: popup.hovered && !popup.open
|
||||
|
||||
onClicked: popup.open = true
|
||||
}
|
||||
|
||||
CustomSwitch {
|
||||
id: switchButton
|
||||
RowLayout {
|
||||
id: navLayout
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: root.horizontalPadding
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Appearance.padding.largeIncreased
|
||||
anchors.margins: Appearance.padding.normal
|
||||
anchors.rightMargin: Appearance.padding.largeIncreased
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
onClicked: root.clicked(checked)
|
||||
MaterialIcon {
|
||||
id: icon
|
||||
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Appearance.font.size.medium
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
|
||||
CustomText {
|
||||
id: label
|
||||
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font.pointSize: Appearance.font.size.small
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: status
|
||||
|
||||
Layout.fillWidth: true
|
||||
animate: true
|
||||
color: DynamicColors.palette.m3outline
|
||||
elide: Text.ElideRight
|
||||
font.pointSize: Appearance.font.size.small
|
||||
visible: text
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: triggerArea
|
||||
|
||||
implicitHeight: popup.implicitHeight
|
||||
implicitWidth: popup.implicitWidth
|
||||
|
||||
TransformWatcher {
|
||||
id: tWatcher
|
||||
|
||||
a: area.parent
|
||||
b: triggerArea
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: area
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: undefined
|
||||
enabled: popup.open
|
||||
hoverEnabled: true
|
||||
parent: {
|
||||
if (root.keepPopupAsChild)
|
||||
return triggerArea;
|
||||
|
||||
const win = QsWindow.window;
|
||||
const contentWin = win as Windows; // If inside the drawer content window, put it inside the interaction wrapper so hover works
|
||||
return contentWin ? contentWin.interactionWrapper : (win as QsWindow).contentItem;
|
||||
}
|
||||
z: popup.animDriver > 0 ? 1 : 0
|
||||
|
||||
onClicked: popup.open = false
|
||||
|
||||
BlobPopup {
|
||||
id: popup
|
||||
|
||||
color: open || hovered || stateLayer.containsMouse ? DynamicColors.palette.m3secondaryContainer : DynamicColors.palette.m3surfaceContainerHighest
|
||||
content: root.content
|
||||
hoverOverride: stateLayer.containsMouse
|
||||
padding: Appearance.padding.small
|
||||
pressOverride: stateLayer.pressed
|
||||
x: {
|
||||
tWatcher.transform;
|
||||
return triggerArea.mapToItem(area.parent, 0, 0).x;
|
||||
}
|
||||
y: {
|
||||
tWatcher.transform;
|
||||
return triggerArea.mapToItem(area.parent, 0, 0).y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user