tweaked Volume.qml to support typing the number instead of using the slider or the buttons
This commit is contained in:
@@ -148,6 +148,7 @@ ModuleChip {
|
|||||||
cardColor: t.volPopupBg
|
cardColor: t.volPopupBg
|
||||||
cardBorderColor: t.volPopupBorder
|
cardBorderColor: t.volPopupBorder
|
||||||
cardHeight: popupCol.implicitHeight + 34
|
cardHeight: popupCol.implicitHeight + 34
|
||||||
|
hasKeyboardFocus: true
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: popupCol
|
id: popupCol
|
||||||
@@ -227,6 +228,7 @@ ModuleChip {
|
|||||||
borderColor: root.t.volPopupBorder
|
borderColor: root.t.volPopupBorder
|
||||||
onDecrement: root.outputMaxVolume = Math.max(10, root.outputMaxVolume - 10)
|
onDecrement: root.outputMaxVolume = Math.max(10, root.outputMaxVolume - 10)
|
||||||
onIncrement: root.outputMaxVolume = Math.min(300, root.outputMaxVolume + 10)
|
onIncrement: root.outputMaxVolume = Math.min(300, root.outputMaxVolume + 10)
|
||||||
|
onValueSet: root.outputMaxVolume = Math.max(10, Math.min(300, val))
|
||||||
}
|
}
|
||||||
LimitRow {
|
LimitRow {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -241,6 +243,7 @@ ModuleChip {
|
|||||||
borderColor: root.t.volPopupBorder
|
borderColor: root.t.volPopupBorder
|
||||||
onDecrement: root.inputMaxVolume = Math.max(10, root.inputMaxVolume - 10)
|
onDecrement: root.inputMaxVolume = Math.max(10, root.inputMaxVolume - 10)
|
||||||
onIncrement: root.inputMaxVolume = Math.min(300, root.inputMaxVolume + 10)
|
onIncrement: root.inputMaxVolume = Math.min(300, root.inputMaxVolume + 10)
|
||||||
|
onValueSet: root.inputMaxVolume = Math.max(10, Math.min(300, val))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item { height: 2 }
|
Item { height: 2 }
|
||||||
@@ -291,14 +294,31 @@ ModuleChip {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
Text {
|
TextInput {
|
||||||
text: vs.muted ? "muted" : vs.volume + "%"
|
text: vs.muted ? "muted" : vs.volume + "%"
|
||||||
color: vs.muted ? vs.dimColor : vs.textColor
|
color: vs.muted ? vs.dimColor : vs.textColor
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
font.bold: !vs.muted
|
font.bold: !vs.muted
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
Layout.preferredWidth: 44
|
Layout.preferredWidth: 44
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
readOnly: vs.muted
|
||||||
|
selectByMouse: true
|
||||||
|
activeFocusOnPress: true
|
||||||
|
onAccepted: {
|
||||||
|
if (!vs.muted) {
|
||||||
|
let val = parseInt(text.replace("%", "").trim(), 10)
|
||||||
|
if (!isNaN(val)) vs.sliderMoved(Math.max(0, Math.min(vs.maxVolume, val)))
|
||||||
|
text = vs.volume + "%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if (activeFocus && !vs.muted) {
|
||||||
|
text = vs.volume.toString()
|
||||||
|
selectAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -465,6 +485,7 @@ ModuleChip {
|
|||||||
|
|
||||||
signal decrement()
|
signal decrement()
|
||||||
signal increment()
|
signal increment()
|
||||||
|
signal valueSet(int val)
|
||||||
|
|
||||||
Text { text: lr.icon; color: lr.iconColor; font.pixelSize: 13; font.bold: true; renderType: Text.NativeRendering }
|
Text { text: lr.icon; color: lr.iconColor; font.pixelSize: 13; font.bold: true; renderType: Text.NativeRendering }
|
||||||
Text {
|
Text {
|
||||||
@@ -491,13 +512,31 @@ ModuleChip {
|
|||||||
HoverHandler { id: decHover; cursorShape: Qt.PointingHandCursor }
|
HoverHandler { id: decHover; cursorShape: Qt.PointingHandCursor }
|
||||||
TapHandler { onTapped: { if (lr.value > lr.minValue) lr.decrement() } }
|
TapHandler { onTapped: { if (lr.value > lr.minValue) lr.decrement() } }
|
||||||
}
|
}
|
||||||
Text {
|
TextInput {
|
||||||
text: lr.value + "%"
|
text: lr.value + "%"
|
||||||
color: lr.textColor
|
color: lr.textColor
|
||||||
font.pixelSize: 12; font.bold: true
|
font.pixelSize: 12; font.bold: true
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
Layout.preferredWidth: 44
|
Layout.preferredWidth: 44
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
selectByMouse: true
|
||||||
|
activeFocusOnPress: true
|
||||||
|
onAccepted: {
|
||||||
|
let val = parseInt(text.replace("%", "").trim(), 10)
|
||||||
|
if (!isNaN(val)) lr.valueSet(Math.max(lr.minValue, Math.min(lr.maxValue, val)))
|
||||||
|
text = lr.value + "%"
|
||||||
|
}
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if (activeFocus) {
|
||||||
|
text = lr.value.toString()
|
||||||
|
selectAll()
|
||||||
|
} else {
|
||||||
|
let val = parseInt(text.replace("%", "").trim(), 10)
|
||||||
|
if (!isNaN(val)) lr.valueSet(Math.max(lr.minValue, Math.min(lr.maxValue, val)))
|
||||||
|
text = lr.value + "%"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ QtObject {
|
|||||||
|
|
||||||
// ── Timezone (IANA name, e.g. "America/New_York", "Europe/London") ──────────
|
// ── Timezone (IANA name, e.g. "America/New_York", "Europe/London") ──────────
|
||||||
// Leave empty to use the system timezone.
|
// Leave empty to use the system timezone.
|
||||||
property string timezone: "America/New_York"
|
property string timezone: ""
|
||||||
|
|
||||||
// Date format used in the clock popup and background date widget.
|
// Date format used in the clock popup and background date widget.
|
||||||
// "MDY" → month/day/year (e.g. May 14, 2026)
|
// "MDY" → month/day/year (e.g. May 14, 2026)
|
||||||
@@ -77,7 +77,7 @@ QtObject {
|
|||||||
property int volumeSliderHeight: 2
|
property int volumeSliderHeight: 2
|
||||||
property int volumeHandleSize: 20
|
property int volumeHandleSize: 20
|
||||||
property int volumePopupWidth: 280
|
property int volumePopupWidth: 280
|
||||||
property int volumeOutputMax: 190
|
property int volumeOutputMax: 100
|
||||||
property int volumeInputMax: 200
|
property int volumeInputMax: 200
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user