1
0
Fork 0

[UI] Add cache indicator to progressBar.

This commit is contained in:
Kitteh 2018-10-25 19:13:17 +01:00
parent 13f5fda250
commit 52ed2b6033
3 changed files with 977 additions and 12 deletions

View file

@ -151,6 +151,7 @@ MpvObject::MpvObject(QQuickItem * parent)
mpv_observe_property(mpv, 0, "media-title", MPV_FORMAT_STRING);
mpv_observe_property(mpv, 0, "sub-text", MPV_FORMAT_STRING);
mpv_observe_property(mpv, 0, "time-pos", MPV_FORMAT_DOUBLE);
mpv_observe_property(mpv, 0, "demuxer-cache-duration", MPV_FORMAT_DOUBLE);
mpv_set_wakeup_callback(mpv, wakeup, this);
@ -244,6 +245,11 @@ void MpvObject::handle_mpv_event(mpv_event *event)
}
} else if (strcmp(prop->name, "sub-text") == 0) {
QMetaObject::invokeMethod(this,"setSubtitles");
} else if (strcmp(prop->name, "demuxer-cache-duration") == 0) {
if (prop->format == MPV_FORMAT_DOUBLE) {
double duration = *(double *)prop->data;
QMetaObject::invokeMethod(this,"setCachedDuration",Q_ARG(QVariant,duration));
}
}
break;
}

File diff suppressed because one or more lines are too long

View file

@ -199,6 +199,11 @@ ApplicationWindow {
progressBar.value = val
}
function setCachedDuration(val) {
cachedLength.width = progressBar.width / progressBar.to
* (val - progressBar.value) - (progressBar.handle.width / 2)
}
function skipToNinth(val) {
console.log(val)
var skipto = 0
@ -278,7 +283,7 @@ ApplicationWindow {
x: 0
y: parent.height
width: parent.width
height: controlsBar.height + progressBar.height
height: (controlsBar.height * 2) + progressBar.height
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
hoverEnabled: true
@ -291,7 +296,7 @@ ApplicationWindow {
id: mouseAreaPlayer
width: parent.width
anchors.bottom: mouseAreaBar.top
anchors.bottomMargin: controlsBar.height / 22
anchors.bottomMargin: 10
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
@ -879,8 +884,20 @@ ApplicationWindow {
opacity: 1
}
}
Rectangle {
id: cachedLength
z: 1
//anchors.left: progressBar.handle.right
anchors.left: progressBar.handle.horizontalCenter
anchors.bottom: progressBar.background.bottom
anchors.top: progressBar.background.top
height: progressBar.background.height
color: "white"
opacity: 0.8
}
handle: Rectangle {
z: 2
id: handleRect
x: progressBar.leftPadding + progressBar.visualPosition
* (progressBar.availableWidth - width)