2021-11-11 08:16:25 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2021-11-11 08:16:25 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import im.nheko 1.0
|
|
|
|
|
|
|
|
Slider {
|
2021-11-11 21:18:45 +03:00
|
|
|
id: control
|
2021-11-11 08:16:25 +03:00
|
|
|
|
2021-11-11 23:32:38 +03:00
|
|
|
property color progressColor: Nheko.colors.highlight
|
2021-11-11 08:16:25 +03:00
|
|
|
property bool alwaysShowSlider: true
|
2021-11-11 21:18:45 +03:00
|
|
|
property int sliderRadius: 16
|
2021-11-11 08:16:25 +03:00
|
|
|
|
2021-11-11 23:32:38 +03:00
|
|
|
value: 0
|
|
|
|
implicitHeight: sliderRadius
|
|
|
|
padding: 0
|
2021-11-11 08:16:25 +03:00
|
|
|
|
|
|
|
background: Rectangle {
|
2021-11-11 23:32:38 +03:00
|
|
|
x: control.leftPadding + handle.width / 2
|
2021-11-11 21:18:45 +03:00
|
|
|
y: control.topPadding + control.availableHeight / 2 - height / 2
|
|
|
|
implicitWidth: 200
|
2021-11-11 23:32:38 +03:00
|
|
|
implicitHeight: control.sliderRadius / 4
|
2021-11-11 21:18:45 +03:00
|
|
|
width: control.availableWidth - handle.width
|
|
|
|
height: implicitHeight
|
2021-11-11 23:32:38 +03:00
|
|
|
radius: height / 2
|
2021-11-11 21:18:45 +03:00
|
|
|
color: Nheko.colors.buttonText
|
2021-11-11 08:16:25 +03:00
|
|
|
|
|
|
|
Rectangle {
|
2021-11-11 21:18:45 +03:00
|
|
|
width: control.visualPosition * parent.width
|
|
|
|
height: parent.height
|
|
|
|
color: control.progressColor
|
2021-11-11 08:16:25 +03:00
|
|
|
radius: 2
|
|
|
|
}
|
2021-11-11 23:32:38 +03:00
|
|
|
|
2021-11-11 08:16:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
handle: Rectangle {
|
2021-11-11 21:18:45 +03:00
|
|
|
x: control.leftPadding + control.visualPosition * background.width
|
|
|
|
y: control.topPadding + control.availableHeight / 2 - height / 2
|
|
|
|
implicitWidth: control.sliderRadius
|
|
|
|
implicitHeight: control.sliderRadius
|
2021-11-11 23:32:38 +03:00
|
|
|
radius: control.sliderRadius / 2
|
|
|
|
color: control.progressColor
|
|
|
|
visible: Settings.mobileMode || control.alwaysShowSlider || control.hovered || control.pressed
|
2021-11-11 21:18:45 +03:00
|
|
|
border.color: control.progressColor
|
2021-11-11 08:16:25 +03:00
|
|
|
}
|
2021-11-11 23:32:38 +03:00
|
|
|
|
2021-11-11 08:16:25 +03:00
|
|
|
}
|