AudioCard: fix issue, change size of slider

This commit is contained in:
lysec
2025-10-10 14:59:12 +02:00
parent 7a403bbdde
commit 2f527dcf61
2 changed files with 24 additions and 41 deletions
+18 -40
View File
@@ -93,27 +93,16 @@ NBox {
} }
// Output Volume Slider // Output Volume Slider
RowLayout { NValueSlider {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Style.marginXS * scaling from: 0
to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0
NSlider { value: localOutputVolume || 0
Layout.fillWidth: true stepSize: 0.01
from: 0 text: Math.round((AudioService.volume || 0) * 100) + "%"
to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0 textSize: Style.fontSizeXS * scaling
value: localOutputVolume customHeightRatio: 0.6
stepSize: 0.01 onMoved: value => localOutputVolume = value
onMoved: value => localOutputVolume = value
}
NText {
text: Math.round(AudioService.volume * 100) + "%"
pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
font.weight: Style.fontWeightMedium
verticalAlignment: Text.AlignVCenter
Layout.alignment: Qt.AlignVCenter
}
} }
} }
@@ -162,27 +151,16 @@ NBox {
} }
// Input Volume Slider // Input Volume Slider
RowLayout { NValueSlider {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Style.marginXS * scaling from: 0
to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0
NSlider { value: AudioService.inputVolume || 0
Layout.fillWidth: true stepSize: 0.01
from: 0 text: Math.round((AudioService.inputVolume || 0) * 100) + "%"
to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0 textSize: Style.fontSizeXS * scaling
value: localInputVolume customHeightRatio: 0.6
stepSize: 0.01 onMoved: value => AudioService.setInputVolume(value)
onMoved: value => AudioService.setInputVolume(value)
}
NText {
text: Math.round(AudioService.inputVolume * 100) + "%"
pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
font.weight: Style.fontWeightMedium
verticalAlignment: Text.AlignVCenter
Layout.alignment: Qt.AlignVCenter
}
} }
} }
} }
+6 -1
View File
@@ -16,12 +16,16 @@ RowLayout {
property bool snapAlways: true property bool snapAlways: true
property real heightRatio: 0.7 property real heightRatio: 0.7
property string text: "" property string text: ""
property real textSize: Style.fontSizeM * scaling
property real customHeight: -1
property real customHeightRatio: -1
// Signals // Signals
signal moved(real value) signal moved(real value)
signal pressedChanged(bool pressed, real value) signal pressedChanged(bool pressed, real value)
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
implicitHeight: root.customHeight > 0 ? root.customHeight : slider.implicitHeight
NSlider { NSlider {
id: slider id: slider
@@ -32,7 +36,7 @@ RowLayout {
stepSize: root.stepSize stepSize: root.stepSize
cutoutColor: root.cutoutColor cutoutColor: root.cutoutColor
snapAlways: root.snapAlways snapAlways: root.snapAlways
heightRatio: root.heightRatio heightRatio: root.customHeightRatio > 0 ? root.customHeightRatio : root.heightRatio
onMoved: root.moved(value) onMoved: root.moved(value)
onPressedChanged: root.pressedChanged(pressed, value) onPressedChanged: root.pressedChanged(pressed, value)
} }
@@ -40,6 +44,7 @@ RowLayout {
NText { NText {
visible: root.text !== "" visible: root.text !== ""
text: root.text text: root.text
pointSize: root.textSize
family: Settings.data.ui.fontFixed family: Settings.data.ui.fontFixed
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 45 * scaling Layout.preferredWidth: 45 * scaling