1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

i18n: WIP initial RTL support

- notifications
- color picker
- process list
- settings
- control center, dash
- launcher

part of #1059
This commit is contained in:
bbedward
2025-12-17 13:50:06 -05:00
parent 811e89fcfa
commit 523ccc6bf8
41 changed files with 5735 additions and 730 deletions

View File

@@ -5,6 +5,9 @@ import qs.Widgets
Rectangle {
id: root
LayoutMirroring.enabled: I18n.isRtl
LayoutMirroring.childrenInherit: true
required property var model
required property int index
required property var listView
@@ -66,6 +69,7 @@ Rectangle {
color: Theme.surfaceText
font.weight: Font.Medium
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
wrapMode: Text.NoWrap
maximumLineCount: 1
}
@@ -76,6 +80,7 @@ Rectangle {
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
maximumLineCount: 1
visible: root.showDescription && model.comment && model.comment.length > 0
}

View File

@@ -21,7 +21,7 @@ Flow {
property bool userInteracted: false
signal selectionChanged(int index, bool selected)
signal animationCompleted()
signal animationCompleted
spacing: Theme.spacingXS
@@ -36,35 +36,35 @@ Flow {
function isSelected(index) {
if (multiSelect) {
return repeater.itemAt(index)?.selected || false
return repeater.itemAt(index)?.selected || false;
}
return index === currentIndex
return index === currentIndex;
}
function selectItem(index) {
userInteracted = true;
if (multiSelect) {
const modelValue = model[index]
let newSelection = [...currentSelection]
const isCurrentlySelected = newSelection.includes(modelValue)
const modelValue = model[index];
let newSelection = [...currentSelection];
const isCurrentlySelected = newSelection.includes(modelValue);
if (isCurrentlySelected) {
newSelection = newSelection.filter(item => item !== modelValue)
newSelection = newSelection.filter(item => item !== modelValue);
} else {
newSelection.push(modelValue)
newSelection.push(modelValue);
}
currentSelection = newSelection
selectionChanged(index, !isCurrentlySelected)
animationTimer.restart()
currentSelection = newSelection;
selectionChanged(index, !isCurrentlySelected);
animationTimer.restart();
} else {
const oldIndex = currentIndex
currentIndex = index
selectionChanged(index, true)
const oldIndex = currentIndex;
currentIndex = index;
selectionChanged(index, true);
if (oldIndex !== index && oldIndex >= 0) {
selectionChanged(oldIndex, false)
selectionChanged(oldIndex, false);
}
animationTimer.restart()
animationTimer.restart();
}
}
@@ -82,6 +82,8 @@ Flow {
property bool pressed: mouseArea.pressed
property bool isFirst: index === 0
property bool isLast: index === repeater.count - 1
property bool visualFirst: I18n.isRtl ? isLast : isFirst
property bool visualLast: I18n.isRtl ? isFirst : isLast
property bool prevSelected: index > 0 ? root.isSelected(index - 1) : false
property bool nextSelected: index < repeater.count - 1 ? root.isSelected(index + 1) : false
@@ -92,10 +94,10 @@ Flow {
border.color: "transparent"
border.width: 0
topLeftRadius: (isFirst || selected) ? Theme.cornerRadius : 4
bottomLeftRadius: (isFirst || selected) ? Theme.cornerRadius : 4
topRightRadius: (isLast || selected) ? Theme.cornerRadius : 4
bottomRightRadius: (isLast || selected) ? Theme.cornerRadius : 4
topLeftRadius: (visualFirst || selected) ? Theme.cornerRadius : 4
bottomLeftRadius: (visualFirst || selected) ? Theme.cornerRadius : 4
topRightRadius: (visualLast || selected) ? Theme.cornerRadius : 4
bottomRightRadius: (visualLast || selected) ? Theme.cornerRadius : 4
Behavior on width {
enabled: root.userInteracted
@@ -153,9 +155,11 @@ Flow {
topRightRadius: parent.topRightRadius
bottomRightRadius: parent.bottomRightRadius
color: {
if (pressed) return selected ? Theme.primaryPressed : Theme.surfaceTextHover
if (hovered) return selected ? Theme.primaryHover : Theme.surfaceTextHover
return "transparent"
if (pressed)
return selected ? Theme.primaryPressed : Theme.surfaceTextHover;
if (hovered)
return selected ? Theme.primaryHover : Theme.surfaceTextHover;
return "transparent";
}
Behavior on color {

View File

@@ -9,6 +9,9 @@ import qs.Widgets
Item {
id: root
LayoutMirroring.enabled: I18n.isRtl
LayoutMirroring.childrenInherit: true
property string text: ""
property string description: ""
property string currentValue: ""
@@ -63,6 +66,8 @@ Item {
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: Font.Medium
width: parent.width
anchors.left: parent.left
}
StyledText {
@@ -72,6 +77,7 @@ Item {
visible: description.length > 0
wrapMode: Text.WordWrap
width: parent.width
anchors.left: parent.left
}
}

View File

@@ -5,6 +5,9 @@ import qs.Widgets
StyledRect {
id: root
LayoutMirroring.enabled: I18n.isRtl
LayoutMirroring.childrenInherit: true
activeFocusOnTab: true
KeyNavigation.tab: keyNavigationTab
@@ -92,13 +95,17 @@ StyledRect {
TextInput {
id: textInput
anchors.fill: parent
anchors.leftMargin: root.leftPadding
anchors.rightMargin: root.rightPadding
anchors.left: leftIcon.visible ? leftIcon.right : parent.left
anchors.leftMargin: Theme.spacingM
anchors.right: clearButton.visible ? clearButton.left : parent.right
anchors.rightMargin: Theme.spacingM
anchors.top: parent.top
anchors.topMargin: root.topPadding
anchors.bottom: parent.bottom
anchors.bottomMargin: root.bottomPadding
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
horizontalAlignment: I18n.isRtl ? TextInput.AlignRight : TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter
selectByMouse: !root.ignoreLeftRightKeys
clip: true
@@ -182,9 +189,10 @@ StyledRect {
text: root.placeholderText
font: textInput.font
color: placeholderColor
horizontalAlignment: textInput.horizontalAlignment
verticalAlignment: textInput.verticalAlignment
visible: textInput.text.length === 0 && !textInput.activeFocus
elide: Text.ElideRight
elide: I18n.isRtl ? Text.ElideLeft : Text.ElideRight
}
Behavior on border.color {

View File

@@ -5,6 +5,9 @@ import qs.Widgets
Item {
id: toggle
LayoutMirroring.enabled: I18n.isRtl
LayoutMirroring.childrenInherit: true
// API
property bool checked: false
property bool enabled: true
@@ -27,9 +30,10 @@ Item {
height: showText ? (description.length > 0 ? 60 : 44) : trackHeight
function handleClick() {
if (!enabled) return
clicked()
toggled(!checked)
if (!enabled)
return;
clicked();
toggled(!checked);
}
StyledRect {
@@ -58,6 +62,7 @@ Item {
visible: showText
Column {
width: parent.width
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
@@ -66,6 +71,8 @@ Item {
font.pixelSize: Appearance.fontSize.normal
font.weight: Font.Medium
opacity: toggle.enabled ? 1 : 0.4
width: parent.width
anchors.left: parent.left
}
StyledText {
@@ -75,6 +82,7 @@ Item {
wrapMode: Text.WordWrap
width: Math.min(implicitWidth, toggle.width - 120)
visible: toggle.description.length > 0
anchors.left: parent.left
}
}
}
@@ -121,7 +129,7 @@ Item {
}
ScriptAction {
script: {
toggle.toggleCompleted(toggle.checked)
toggle.toggleCompleted(toggle.checked);
}
}
}