Merge remote-tracking branch 'origin/main' into addon-i18n

This commit is contained in:
月月
2025-06-27 18:40:06 +08:00
21 changed files with 654 additions and 200 deletions
@@ -1,7 +1,7 @@
import QtQuick
import Quickshell
pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
Singleton {
property QtObject policies: QtObject {
@@ -21,8 +21,10 @@ Singleton {
}
}
property QtObject audio: QtObject { // Values in %
property QtObject protection: QtObject { // Prevent sudden bangs
property QtObject audio: QtObject {
// Values in %
property QtObject protection: QtObject {
// Prevent sudden bangs
property bool enable: true
property real maxAllowedIncrease: 10
property real maxAllowed: 90 // Realistically should already provide some protection when it's 99...
@@ -59,6 +61,7 @@ Singleton {
property bool showColorPicker: false
property bool showMicToggle: false
property bool showKeyboardToggle: true
property bool showDarkModeToggle: true
}
property QtObject tray: QtObject {
property bool monochromeIcons: true
@@ -74,7 +77,8 @@ Singleton {
property QtObject battery: QtObject {
property int low: 20
property int critical: 5
property int suspend: 2
property bool automaticSuspend: true
property int suspend: 3
}
property QtObject dock: QtObject {
@@ -83,9 +87,7 @@ Singleton {
property bool pinnedOnStartup: false
property bool hoverToReveal: false // When false, only reveals on empty workspace
property list<string> pinnedApps: [ // IDs of pinned entries
"org.kde.dolphin",
"kitty",
]
"org.kde.dolphin", "kitty",]
}
property QtObject language: QtObject {
@@ -112,9 +114,8 @@ Singleton {
property QtObject overview: QtObject {
property real scale: 0.18 // Relative to screen size
property real numOfRows: 2
property real numOfCols: 5
property bool showXwaylandIndicator: true
property real rows: 2
property real columns: 5
}
property QtObject resources: QtObject {
@@ -124,7 +125,7 @@ Singleton {
property QtObject search: QtObject {
property int nonAppResultDelay: 30 // This prevents lagging when typing
property string engineBaseUrl: "https://www.google.com/search?q="
property list<string> excludedSites: [ "quora.com" ]
property list<string> excludedSites: ["quora.com"]
property bool sloppy: false // Uses levenshtein distance based scoring instead of fuzzy sort. Very weird.
property QtObject prefix: QtObject {
property string action: "/"
@@ -161,5 +162,4 @@ Singleton {
property QtObject hacks: QtObject {
property int arbitraryRaceConditionDelay: 20 // milliseconds
}
}
@@ -0,0 +1,31 @@
import "root:/modules/common/widgets/"
import "root:/modules/common/"
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
RowLayout {
id: root
property string text: ""
property alias value: spinBoxWidget.value
property alias stepSize: spinBoxWidget.stepSize
property alias from: spinBoxWidget.from
property alias to: spinBoxWidget.to
spacing: 10
Layout.leftMargin: 8
Layout.rightMargin: 8
StyledText {
id: labelWidget
Layout.fillWidth: true
text: root.text
font.pixelSize: Appearance.font.pixelSize.small
color: Appearance.colors.colOnSecondaryContainer
}
StyledSpinBox {
id: spinBoxWidget
Layout.fillWidth: false
value: root.value
}
}
@@ -6,7 +6,7 @@ import "root:/modules/common/widgets/"
Flickable {
id: root
property real baseWidth: 500
property real baseWidth: 550
property bool forceWidth: false
property real bottomContentPadding: 100
@@ -14,6 +14,7 @@ ColumnLayout {
StyledText {
text: root.title
font.pixelSize: Appearance.font.pixelSize.larger
font.weight: Font.Medium
}
ColumnLayout {
id: sectionContent
@@ -7,16 +7,37 @@ import "root:/modules/common/widgets/"
ColumnLayout {
id: root
property string title: ""
property string tooltip: ""
default property alias data: sectionContent.data
Layout.fillWidth: true
Layout.topMargin: 4
spacing: 2
ContentSubsectionLabel {
Layout.fillWidth: true
visible: root.title && root.title.length > 0
text: root.title
RowLayout {
ContentSubsectionLabel {
visible: root.title && root.title.length > 0
text: root.title
}
MaterialSymbol {
visible: root.tooltip && root.tooltip.length > 0
text: "info"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colSubtext
MouseArea {
id: infoMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.WhatsThisCursor
StyledToolTip {
extraVisibleCondition: false
alternativeVisibleCondition: infoMouseArea.containsMouse
content: root.tooltip
}
}
}
Item { Layout.fillWidth: true }
}
ColumnLayout {
id: sectionContent
@@ -32,10 +32,8 @@ ProgressBar {
animation: Appearance?.animation.elementMoveEnter.numberAnimation.createObject(this)
}
background: Rectangle {
background: Item {
anchors.fill: parent
color: "transparent"
radius: Appearance?.rounding.full ?? 9999
implicitHeight: valueBarHeight
implicitWidth: valueBarWidth
}
@@ -0,0 +1,92 @@
import "root:/modules/common"
import "root:/modules/common/functions/color_utils.js" as ColorUtils
import QtQuick
import QtQuick.Controls
/**
* Material 3 styled SpinBox component.
*/
SpinBox {
id: root
property real baseHeight: 35
property real radius: Appearance.rounding.small
property real innerButtonRadius: Appearance.rounding.unsharpen
editable: true
background: Rectangle {
color: Appearance.colors.colLayer2
radius: root.radius
}
contentItem: Item {
implicitHeight: root.baseHeight
implicitWidth: Math.max(labelText.implicitWidth, 40)
StyledTextInput {
id: labelText
anchors.centerIn: parent
text: root.value // displayText would make the numbers weird like 1,000 instead of 1000
color: Appearance.colors.colOnLayer2
font.pixelSize: Appearance.font.pixelSize.small
validator: root.validator
onTextChanged: {
root.value = parseFloat(text);
}
}
}
down.indicator: Rectangle {
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
}
implicitHeight: root.baseHeight
implicitWidth: root.baseHeight
topLeftRadius: root.radius
bottomLeftRadius: root.radius
topRightRadius: root.innerButtonRadius
bottomRightRadius: root.innerButtonRadius
color: root.down.pressed ? Appearance.colors.colLayer2Active :
root.down.hovered ? Appearance.colors.colLayer2Hover :
ColorUtils.transparentize(Appearance.colors.colLayer2)
Behavior on color {
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
}
MaterialSymbol {
anchors.centerIn: parent
text: "remove"
iconSize: 20
color: Appearance.colors.colOnLayer2
}
}
up.indicator: Rectangle {
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
}
implicitHeight: root.baseHeight
implicitWidth: root.baseHeight
topRightRadius: root.radius
bottomRightRadius: root.radius
topLeftRadius: root.innerButtonRadius
bottomLeftRadius: root.innerButtonRadius
color: root.up.pressed ? Appearance.colors.colLayer2Active :
root.up.hovered ? Appearance.colors.colLayer2Hover :
ColorUtils.transparentize(Appearance.colors.colLayer2)
Behavior on color {
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
}
MaterialSymbol {
anchors.centerIn: parent
text: "add"
iconSize: 20
color: Appearance.colors.colOnLayer2
}
}
}
@@ -0,0 +1,17 @@
import "root:/modules/common"
import QtQuick
import QtQuick.Controls
/**
* Does not include visual layout, but includes the easily neglected colors.
*/
TextInput {
renderType: Text.NativeRendering
selectedTextColor: Appearance.m3colors.m3onSecondaryContainer
selectionColor: Appearance.colors.colSecondaryContainer
font {
family: Appearance?.font.family.main ?? "sans-serif"
pixelSize: Appearance?.font.pixelSize.small ?? 15
hintingPreference: Font.PreferFullHinting
}
}