controlcenter: revamped and added more sliders
This commit is contained in:
parent
4ada7ea608
commit
ec8da25d19
3 changed files with 1199 additions and 104 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -336,11 +336,74 @@ RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
Layout.preferredWidth: 70
|
||||||
|
implicitHeight: outputVolumeInput.implicitHeight + Appearance.padding.small * 2
|
||||||
|
color: outputVolumeInputHover.containsMouse || outputVolumeInput.activeFocus
|
||||||
|
? Colours.layer(Colours.palette.m3surfaceContainer, 3)
|
||||||
|
: Colours.layer(Colours.palette.m3surfaceContainer, 2)
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
border.width: 1
|
||||||
|
border.color: outputVolumeInput.activeFocus
|
||||||
|
? Colours.palette.m3primary
|
||||||
|
: Qt.alpha(Colours.palette.m3outline, 0.3)
|
||||||
|
enabled: !Audio.muted
|
||||||
|
opacity: enabled ? 1 : 0.5
|
||||||
|
|
||||||
|
Behavior on color { CAnim {} }
|
||||||
|
Behavior on border.color { CAnim {} }
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: outputVolumeInputHover
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledTextField {
|
||||||
|
id: outputVolumeInput
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.width - Appearance.padding.normal
|
||||||
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
|
validator: IntValidator { bottom: 0; top: 100 }
|
||||||
|
enabled: !Audio.muted
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
text = Math.round(Audio.volume * 100).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Audio
|
||||||
|
function onVolumeChanged() {
|
||||||
|
if (!outputVolumeInput.activeFocus) {
|
||||||
|
outputVolumeInput.text = Math.round(Audio.volume * 100).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
if (activeFocus) {
|
||||||
|
const val = parseInt(text);
|
||||||
|
if (!isNaN(val) && val >= 0 && val <= 100) {
|
||||||
|
Audio.setVolume(val / 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onEditingFinished: {
|
||||||
|
const val = parseInt(text);
|
||||||
|
if (isNaN(val) || val < 0 || val > 100) {
|
||||||
|
text = Math.round(Audio.volume * 100).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: Audio.muted ? qsTr("Muted") : qsTr("%1%").arg(Math.round(Audio.volume * 100))
|
text: "%"
|
||||||
color: Audio.muted ? Colours.palette.m3primary : Colours.palette.m3outline
|
color: Colours.palette.m3outline
|
||||||
font.pointSize: Appearance.font.size.normal
|
font.pointSize: Appearance.font.size.normal
|
||||||
font.weight: 500
|
opacity: Audio.muted ? 0.5 : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
|
|
@ -362,20 +425,26 @@ RowLayout {
|
||||||
id: muteIcon
|
id: muteIcon
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: Audio.muted ? "volume_off" : "volume_mute"
|
text: Audio.muted ? "volume_off" : "volume_up"
|
||||||
color: Audio.muted ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer
|
color: Audio.muted ? Colours.palette.m3onSecondary : Colours.palette.m3onSecondaryContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledSlider {
|
StyledSlider {
|
||||||
|
id: outputVolumeSlider
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: Appearance.padding.normal * 3
|
implicitHeight: Appearance.padding.normal * 3
|
||||||
|
|
||||||
value: Audio.volume
|
value: Audio.volume
|
||||||
enabled: !Audio.muted
|
enabled: !Audio.muted
|
||||||
opacity: enabled ? 1 : 0.5
|
opacity: enabled ? 1 : 0.5
|
||||||
onMoved: Audio.setVolume(value)
|
onMoved: {
|
||||||
|
Audio.setVolume(value);
|
||||||
|
if (!outputVolumeInput.activeFocus) {
|
||||||
|
outputVolumeInput.text = Math.round(value * 100).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -406,11 +475,74 @@ RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
Layout.preferredWidth: 70
|
||||||
|
implicitHeight: inputVolumeInput.implicitHeight + Appearance.padding.small * 2
|
||||||
|
color: inputVolumeInputHover.containsMouse || inputVolumeInput.activeFocus
|
||||||
|
? Colours.layer(Colours.palette.m3surfaceContainer, 3)
|
||||||
|
: Colours.layer(Colours.palette.m3surfaceContainer, 2)
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
border.width: 1
|
||||||
|
border.color: inputVolumeInput.activeFocus
|
||||||
|
? Colours.palette.m3primary
|
||||||
|
: Qt.alpha(Colours.palette.m3outline, 0.3)
|
||||||
|
enabled: !Audio.sourceMuted
|
||||||
|
opacity: enabled ? 1 : 0.5
|
||||||
|
|
||||||
|
Behavior on color { CAnim {} }
|
||||||
|
Behavior on border.color { CAnim {} }
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: inputVolumeInputHover
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledTextField {
|
||||||
|
id: inputVolumeInput
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.width - Appearance.padding.normal
|
||||||
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
|
validator: IntValidator { bottom: 0; top: 100 }
|
||||||
|
enabled: !Audio.sourceMuted
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
text = Math.round(Audio.sourceVolume * 100).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Audio
|
||||||
|
function onSourceVolumeChanged() {
|
||||||
|
if (!inputVolumeInput.activeFocus) {
|
||||||
|
inputVolumeInput.text = Math.round(Audio.sourceVolume * 100).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
if (activeFocus) {
|
||||||
|
const val = parseInt(text);
|
||||||
|
if (!isNaN(val) && val >= 0 && val <= 100) {
|
||||||
|
Audio.setSourceVolume(val / 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onEditingFinished: {
|
||||||
|
const val = parseInt(text);
|
||||||
|
if (isNaN(val) || val < 0 || val > 100) {
|
||||||
|
text = Math.round(Audio.sourceVolume * 100).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: Audio.sourceMuted ? qsTr("Muted") : qsTr("%1%").arg(Math.round(Audio.sourceVolume * 100))
|
text: "%"
|
||||||
color: Audio.sourceMuted ? Colours.palette.m3primary : Colours.palette.m3outline
|
color: Colours.palette.m3outline
|
||||||
font.pointSize: Appearance.font.size.normal
|
font.pointSize: Appearance.font.size.normal
|
||||||
font.weight: 500
|
opacity: Audio.sourceMuted ? 0.5 : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
|
|
@ -439,13 +571,19 @@ RowLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledSlider {
|
StyledSlider {
|
||||||
|
id: inputVolumeSlider
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: Appearance.padding.normal * 3
|
implicitHeight: Appearance.padding.normal * 3
|
||||||
|
|
||||||
value: Audio.sourceVolume
|
value: Audio.sourceVolume
|
||||||
enabled: !Audio.sourceMuted
|
enabled: !Audio.sourceMuted
|
||||||
opacity: enabled ? 1 : 0.5
|
opacity: enabled ? 1 : 0.5
|
||||||
onMoved: Audio.setSourceVolume(value)
|
onMoved: {
|
||||||
|
Audio.setSourceVolume(value);
|
||||||
|
if (!inputVolumeInput.activeFocus) {
|
||||||
|
inputVolumeInput.text = Math.round(value * 100).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,17 +239,105 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SpinBoxRow {
|
SectionContainer {
|
||||||
label: qsTr("Drag threshold")
|
contentSpacing: Appearance.spacing.normal
|
||||||
min: 0
|
|
||||||
max: 100
|
ColumnLayout {
|
||||||
value: root.dragThreshold
|
Layout.fillWidth: true
|
||||||
onValueModified: value => {
|
spacing: Appearance.spacing.small
|
||||||
root.dragThreshold = value;
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Drag threshold")
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
Layout.preferredWidth: 70
|
||||||
|
implicitHeight: dragThresholdInput.implicitHeight + Appearance.padding.small * 2
|
||||||
|
color: dragThresholdInputHover.containsMouse || dragThresholdInput.activeFocus
|
||||||
|
? Colours.layer(Colours.palette.m3surfaceContainer, 3)
|
||||||
|
: Colours.layer(Colours.palette.m3surfaceContainer, 2)
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
border.width: 1
|
||||||
|
border.color: dragThresholdInput.activeFocus
|
||||||
|
? Colours.palette.m3primary
|
||||||
|
: Qt.alpha(Colours.palette.m3outline, 0.3)
|
||||||
|
|
||||||
|
Behavior on color { CAnim {} }
|
||||||
|
Behavior on border.color { CAnim {} }
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: dragThresholdInputHover
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledTextField {
|
||||||
|
id: dragThresholdInput
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.width - Appearance.padding.normal
|
||||||
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
|
validator: IntValidator { bottom: 0; top: 100 }
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
text = root.dragThreshold.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
if (activeFocus) {
|
||||||
|
const val = parseInt(text);
|
||||||
|
if (!isNaN(val) && val >= 0 && val <= 100) {
|
||||||
|
root.dragThreshold = val;
|
||||||
root.saveConfig();
|
root.saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onEditingFinished: {
|
||||||
|
const val = parseInt(text);
|
||||||
|
if (isNaN(val) || val < 0 || val > 100) {
|
||||||
|
text = root.dragThreshold.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "px"
|
||||||
|
color: Colours.palette.m3outline
|
||||||
|
font.pointSize: Appearance.font.size.normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledSlider {
|
||||||
|
id: dragThresholdSlider
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
implicitHeight: Appearance.padding.normal * 3
|
||||||
|
|
||||||
|
from: 0
|
||||||
|
to: 100
|
||||||
|
value: root.dragThreshold
|
||||||
|
onMoved: {
|
||||||
|
root.dragThreshold = Math.round(dragThresholdSlider.value);
|
||||||
|
if (!dragThresholdInput.activeFocus) {
|
||||||
|
dragThresholdInput.text = Math.round(dragThresholdSlider.value).toString();
|
||||||
|
}
|
||||||
|
root.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CollapsibleSection {
|
CollapsibleSection {
|
||||||
id: statusIconsSection
|
id: statusIconsSection
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue