Skip to content

Commit

Permalink
Fix slider vertical style
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulh committed Dec 15, 2024
1 parent a4a6fff commit 3fc10e1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 25 deletions.
58 changes: 34 additions & 24 deletions qml/SharedComponents/CalaosSlider.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,33 @@ Controls.Slider {
property color color: "#3AB4D7"

background: Item {
x: control.leftPadding
y: control.topPadding + control.availableHeight / 2 - height / 2
implicitWidth: Units.dp(200)
implicitHeight: Units.dp(4)
width: control.availableWidth
height: implicitHeight
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}

Rectangle {
visible: customBackground? false: true
width: orientation === Qt.Horizontal ? control.availableWidth : Units.dp(4)
height: orientation === Qt.Horizontal ? Units.dp(4) : control.availableHeight

Rectangle {
visible: customBackground ? false : true
anchors.fill: parent

radius: 2
color: Qt.rgba(255, 255, 255, 0.3)

Rectangle {
width: control.visualPosition * parent.width
height: parent.height
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
}
width: orientation === Qt.Horizontal ?
control.visualPosition * parent.width :
parent.width
height: orientation === Qt.Horizontal ?
parent.height :
control.visualPosition * parent.height

color: control.color
radius: 2
}
Expand All @@ -44,29 +53,30 @@ Controls.Slider {
}

handle: Item {
implicitHeight: Units.dp(8)
implicitWidth: Units.dp(8)
width: Units.dp(8)
height: Units.dp(8)

x: control.leftPadding + control.visualPosition * (control.availableWidth - width)
y: control.topPadding + control.availableHeight / 2 - height / 2
anchors {
horizontalCenter: orientation === Qt.Vertical ? parent.horizontalCenter : undefined
verticalCenter: orientation === Qt.Horizontal ? parent.verticalCenter : undefined
}

x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))

Rectangle {
anchors.centerIn: parent
implicitHeight: Units.dp(32)
implicitWidth: Units.dp(32)
color: control.focus ?
Theme.colorAlpha(control.color, 0.20) : "transparent"
color: control.focus ? Theme.colorAlpha(control.color, 0.20) : "transparent"
radius: implicitHeight / 2

Rectangle {
property var diameter: control.enabled ? Units.dp(18):
Units.dp(12)
property var diameter: control.enabled ? Units.dp(18) : Units.dp(12)
anchors.centerIn: parent
color: control.value === control.minimumValue ?
"#e7e7e7" : control.color

border.color: control.value === control.from? Theme.colorAlpha("#FFFFFF", 0.3): control.color

border.color: control.value === control.from ? Theme.colorAlpha("#FFFFFF", 0.3) : control.color
border.width: Units.dp(2)

implicitHeight: control.pressed && !control.focus ?
Expand All @@ -79,8 +89,8 @@ Controls.Slider {

radius: implicitWidth / 2

Behavior on implicitHeight { NumberAnimation { duration: 200} }
Behavior on implicitWidth { NumberAnimation { duration: 200} }
Behavior on implicitHeight { NumberAnimation { duration: 200 } }
Behavior on implicitWidth { NumberAnimation { duration: 200 } }
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions qml/desktop/AudioPlayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
color: "#848484"
visible: hasModel
anchors {
left: sliderVolume.left; right: sliderVolume.right
bottom: sliderVolume.top; bottomMargin: Units.dp(5)
Expand All @@ -360,6 +361,7 @@ Item {
from: 0; to: 100
value: playerModel.volume
onValueChanged: playerModel.sendVolume(value)
visible: hasModel
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/HardwareUtils_desktop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void HardwareUtilsDesktop::showNetworkActivity(bool en)
{
if (qmlEngine->rootObjects().isEmpty()) return;

qInfo() << "showNetworkActivity(" << en << ")";
//qInfo() << "showNetworkActivity(" << en << ")";

QVariant ret;
QObject *root = qmlEngine->rootObjects().at(0);
Expand Down

0 comments on commit 3fc10e1

Please sign in to comment.