[Backend] Added seekAbsolute.
This commit is contained in:
parent
02750f65db
commit
63eff586b0
|
@ -269,6 +269,12 @@ MpvPlayerBackend::addVolume(const QVariant& volume)
|
|||
<< "volume" << volume);
|
||||
}
|
||||
|
||||
void
|
||||
MpvPlayerBackend::seekAbsolute(const QVariant& seekTime)
|
||||
{
|
||||
command(QVariantList() << "seek" << seekTime << "absolute");
|
||||
}
|
||||
|
||||
void
|
||||
MpvPlayerBackend::seek(const QVariant& seekTime)
|
||||
{
|
||||
|
@ -393,6 +399,7 @@ MpvPlayerBackend::handle_mpv_event(mpv_event* event)
|
|||
} else if (strcmp(prop->name, "duration") == 0) {
|
||||
if (prop->format == MPV_FORMAT_DOUBLE) {
|
||||
double time = *(double*)prop->data;
|
||||
updateDurationStringText();
|
||||
findChild<QObject*>("progressBar")->setProperty("to", time);
|
||||
}
|
||||
} else if (strcmp(prop->name, "volume") == 0) {
|
||||
|
@ -424,6 +431,7 @@ MpvPlayerBackend::handle_mpv_event(mpv_event* event)
|
|||
updatePrev(QVariant(pos));
|
||||
}
|
||||
} else if (strcmp(prop->name, "pause") == 0) {
|
||||
qDebug() << prop->data;
|
||||
updatePlayPause(getProperty("pause"));
|
||||
} else if (strcmp(prop->name, "tracks-menu") == 0) {
|
||||
QMetaObject::invokeMethod(this, "tracksUpdate");
|
||||
|
|
|
@ -49,6 +49,7 @@ public slots:
|
|||
void addVolume(const QVariant& volume);
|
||||
void loadFile(const QVariant& filename);
|
||||
void seek(const QVariant& seekTime);
|
||||
void seekAbsolute(const QVariant& seekTime);
|
||||
void command(const QVariant& params);
|
||||
void setProperty(const QString& name, const QVariant& value);
|
||||
void setOption(const QString& name, const QVariant& value);
|
||||
|
|
|
@ -173,7 +173,7 @@ ApplicationWindow {
|
|||
if (val != 0) {
|
||||
skipto = Math.floor(progressBar.to / 9 * val)
|
||||
}
|
||||
player.command(["seek", skipto, "absolute"])
|
||||
player.seekAbsolute(skipto)
|
||||
}
|
||||
|
||||
function isAnyMenuOpen() {
|
||||
|
@ -945,7 +945,7 @@ ApplicationWindow {
|
|||
bottomPadding: 0
|
||||
|
||||
onMoved: {
|
||||
player.command(["seek", progressBar.value, "absolute"])
|
||||
player.seekAbsolute(progressBar.value)
|
||||
}
|
||||
|
||||
function getProgressBarHeight(nyan, isMouse) {
|
||||
|
@ -999,7 +999,7 @@ ApplicationWindow {
|
|||
z: 10
|
||||
radius: height
|
||||
anchors.left: progressLength.right
|
||||
anchors.leftMargin: progressBar.handle.width - 2
|
||||
anchors.leftMargin: 2
|
||||
//anchors.left: progressBar.handle.horizontalCenter
|
||||
anchors.bottom: progressBar.background.bottom
|
||||
anchors.top: progressBar.background.top
|
||||
|
|
Loading…
Reference in a new issue