| 1 |
// SPDX-FileCopyrightText: Nheko Contributors |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
import QtQuick 2.15 |
| 6 |
import QtQuick.Controls 2.15 |
| 7 |
import im.nheko 1.0 |
| 8 |
|
| 9 |
Slider { |
| 10 |
id: control |
| 11 |
|
| 12 |
property color progressColor: palette.highlight |
| 13 |
property bool alwaysShowSlider: true |
| 14 |
property int sliderRadius: 16 |
| 15 |
|
| 16 |
value: 0 |
| 17 |
implicitHeight: sliderRadius |
| 18 |
padding: 0 |
| 19 |
|
| 20 |
background: Rectangle { |
| 21 |
x: control.leftPadding + handle.width / 2 |
| 22 |
y: control.topPadding + control.availableHeight / 2 - height / 2 |
| 23 |
implicitWidth: 200 |
| 24 |
implicitHeight: control.sliderRadius / 4 |
| 25 |
width: control.availableWidth - handle.width |
| 26 |
height: implicitHeight |
| 27 |
radius: height / 2 |
| 28 |
color: palette.buttonText |
| 29 |
|
| 30 |
Rectangle { |
| 31 |
width: control.visualPosition * parent.width |
| 32 |
height: parent.height |
| 33 |
color: control.progressColor |
| 34 |
radius: 2 |
| 35 |
} |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
handle: Rectangle { |
| 40 |
x: control.leftPadding + control.visualPosition * background.width |
| 41 |
y: control.topPadding + control.availableHeight / 2 - height / 2 |
| 42 |
implicitWidth: control.sliderRadius |
| 43 |
implicitHeight: control.sliderRadius |
| 44 |
radius: control.sliderRadius / 2 |
| 45 |
color: control.progressColor |
| 46 |
visible: Settings.mobileMode || control.alwaysShowSlider || control.hovered || control.pressed |
| 47 |
border.color: control.progressColor |
| 48 |
} |
| 49 |
|
| 50 |
} |