mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
settings: mecha re-organization
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string tab: ""
|
||||
property var tags: []
|
||||
property string settingKey: ""
|
||||
|
||||
property string text: ""
|
||||
property string description: ""
|
||||
property alias model: buttonGroup.model
|
||||
property alias currentIndex: buttonGroup.currentIndex
|
||||
property alias selectionMode: buttonGroup.selectionMode
|
||||
property alias buttonHeight: buttonGroup.buttonHeight
|
||||
property alias minButtonWidth: buttonGroup.minButtonWidth
|
||||
property alias buttonPadding: buttonGroup.buttonPadding
|
||||
property alias checkIconSize: buttonGroup.checkIconSize
|
||||
property alias textSize: buttonGroup.textSize
|
||||
property alias spacing: buttonGroup.spacing
|
||||
property alias checkEnabled: buttonGroup.checkEnabled
|
||||
|
||||
signal selectionChanged(int index, bool selected)
|
||||
|
||||
width: parent?.width ?? 0
|
||||
height: 60
|
||||
|
||||
Row {
|
||||
id: contentRow
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
x: Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Column {
|
||||
width: parent.width - buttonGroup.width - Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: root.text
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
visible: root.text !== ""
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: root.description
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
visible: root.description !== ""
|
||||
}
|
||||
}
|
||||
|
||||
DankButtonGroup {
|
||||
id: buttonGroup
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
selectionMode: "single"
|
||||
onSelectionChanged: (index, selected) => root.selectionChanged(index, selected)
|
||||
}
|
||||
}
|
||||
}
|
||||
121
quickshell/Modules/Settings/Widgets/SettingsCard.qml
Normal file
121
quickshell/Modules/Settings/Widgets/SettingsCard.qml
Normal file
@@ -0,0 +1,121 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
StyledRect {
|
||||
id: root
|
||||
|
||||
property string tab: ""
|
||||
property var tags: []
|
||||
|
||||
property string title: ""
|
||||
property string iconName: ""
|
||||
property bool collapsible: false
|
||||
property bool expanded: true
|
||||
|
||||
default property alias content: contentColumn.children
|
||||
|
||||
width: parent?.width ?? 0
|
||||
height: {
|
||||
var hasHeader = root.title !== "" || root.iconName !== "";
|
||||
if (collapsed)
|
||||
return headerRow.height + Theme.spacingL * 2;
|
||||
var h = Theme.spacingL * 2 + contentColumn.height;
|
||||
if (hasHeader)
|
||||
h += headerRow.height + Theme.spacingM;
|
||||
return h;
|
||||
}
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
|
||||
readonly property bool collapsed: collapsible && !expanded
|
||||
readonly property bool hasHeader: root.title !== "" || root.iconName !== ""
|
||||
property bool animationsEnabled: false
|
||||
|
||||
Component.onCompleted: Qt.callLater(() => animationsEnabled = true)
|
||||
|
||||
Behavior on height {
|
||||
enabled: root.animationsEnabled
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: mainColumn
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: root.hasHeader ? Theme.spacingM : 0
|
||||
clip: true
|
||||
|
||||
Item {
|
||||
id: headerRow
|
||||
width: parent.width
|
||||
height: root.hasHeader ? Math.max(headerIcon.height, headerText.height) : 0
|
||||
visible: root.hasHeader
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingM
|
||||
|
||||
DankIcon {
|
||||
id: headerIcon
|
||||
name: root.iconName
|
||||
size: Theme.iconSize
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: root.iconName !== ""
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: headerText
|
||||
text: root.title
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: root.title !== ""
|
||||
}
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: root.expanded ? "expand_less" : "expand_more"
|
||||
size: Theme.iconSize - 2
|
||||
color: Theme.surfaceVariantText
|
||||
visible: root.collapsible
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: root.collapsible
|
||||
cursorShape: root.collapsible ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
if (!root.collapsible)
|
||||
return;
|
||||
root.expanded = !root.expanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: contentColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
visible: !root.collapsed
|
||||
opacity: root.collapsed ? 0 : 1
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
quickshell/Modules/Settings/Widgets/SettingsDropdownRow.qml
Normal file
15
quickshell/Modules/Settings/Widgets/SettingsDropdownRow.qml
Normal file
@@ -0,0 +1,15 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Widgets
|
||||
|
||||
DankDropdown {
|
||||
id: root
|
||||
|
||||
property string tab: ""
|
||||
property var tags: []
|
||||
property string settingKey: ""
|
||||
|
||||
width: parent?.width ?? 0
|
||||
addHorizontalPadding: true
|
||||
}
|
||||
99
quickshell/Modules/Settings/Widgets/SettingsSliderRow.qml
Normal file
99
quickshell/Modules/Settings/Widgets/SettingsSliderRow.qml
Normal file
@@ -0,0 +1,99 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string tab: ""
|
||||
property var tags: []
|
||||
property string settingKey: ""
|
||||
|
||||
property string text: ""
|
||||
property string description: ""
|
||||
property alias value: slider.value
|
||||
property alias minimum: slider.minimum
|
||||
property alias maximum: slider.maximum
|
||||
property alias unit: slider.unit
|
||||
property alias wheelEnabled: slider.wheelEnabled
|
||||
property alias thumbOutlineColor: slider.thumbOutlineColor
|
||||
property int defaultValue: -1
|
||||
|
||||
signal sliderValueChanged(int newValue)
|
||||
|
||||
width: parent?.width ?? 0
|
||||
height: headerRow.height + Theme.spacingXS + slider.height
|
||||
|
||||
Column {
|
||||
id: contentColumn
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
x: Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Row {
|
||||
id: headerRow
|
||||
width: parent.width
|
||||
height: labelColumn.height
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Column {
|
||||
id: labelColumn
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
width: parent.width - resetButtonContainer.width - Theme.spacingS
|
||||
|
||||
StyledText {
|
||||
text: root.text
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
visible: root.text !== ""
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: root.description
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
visible: root.description !== ""
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: resetButtonContainer
|
||||
width: root.defaultValue >= 0 ? 36 : 0
|
||||
height: 36
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
DankActionButton {
|
||||
id: resetButton
|
||||
anchors.centerIn: parent
|
||||
buttonSize: 36
|
||||
iconName: "restart_alt"
|
||||
iconSize: 20
|
||||
visible: root.defaultValue >= 0 && slider.value !== root.defaultValue
|
||||
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
iconColor: Theme.surfaceVariantText
|
||||
onClicked: {
|
||||
slider.value = root.defaultValue;
|
||||
root.sliderValueChanged(root.defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankSlider {
|
||||
id: slider
|
||||
width: parent.width
|
||||
height: 32
|
||||
showValue: true
|
||||
wheelEnabled: false
|
||||
thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||
onSliderValueChanged: newValue => root.sliderValueChanged(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
14
quickshell/Modules/Settings/Widgets/SettingsToggleRow.qml
Normal file
14
quickshell/Modules/Settings/Widgets/SettingsToggleRow.qml
Normal file
@@ -0,0 +1,14 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Widgets
|
||||
|
||||
DankToggle {
|
||||
id: root
|
||||
|
||||
property string tab: ""
|
||||
property var tags: []
|
||||
property string settingKey: ""
|
||||
|
||||
width: parent?.width ?? 0
|
||||
}
|
||||
Reference in New Issue
Block a user