diff --git a/src/UI/DocumentViews/MpvContainer.cc b/src/UI/DocumentViews/MpvContainer.cc index 703466fe4c3f60b1dafdcc684747cd60a524607a..fcc6d076ab2ae1cb643ae84ad99015f35eb47296 100644 --- a/src/UI/DocumentViews/MpvContainer.cc +++ b/src/UI/DocumentViews/MpvContainer.cc @@ -79,6 +79,7 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept // Declare here variables that can be used in the switch-case statements qint64 w, h; double time; + QString msgText; union { mpv_event_log_message *msg; mpv_event_property *prop; @@ -103,8 +104,11 @@ MpvContainer::handleMpvEvent(mpv_event *event) noexcept break; case MPV_EVENT_LOG_MESSAGE: - msg = reinterpret_cast<mpv_event_log_message *>(event->data); - qDebug("MPV - MSG [%s] %s: %s", msg->prefix, msg->level, msg->text); + msg = reinterpret_cast<mpv_event_log_message *>(event->data); + msgText = msg->text; + msgText.replace('\n', ""); + qDebug().nospace().noquote() + << "MPV - MSG [" << msg->prefix << "] " << msg->level << ": " << msgText; break; case MPV_EVENT_PROPERTY_CHANGE: diff --git a/src/UI/DocumentViews/MpvControls.cc b/src/UI/DocumentViews/MpvControls.cc index b129142b17b78f33a1f84ec0c684b12d43d11677..571513896756944fc756f0c237477d687be4fe22 100644 --- a/src/UI/DocumentViews/MpvControls.cc +++ b/src/UI/DocumentViews/MpvControls.cc @@ -1,7 +1,7 @@ #include "MpvControls.hh" #include "MpvContainer.hh" -#include <QProgressBar> +#include <QSlider> #include <QVBoxLayout> using namespace Vivy; @@ -10,14 +10,19 @@ MpvControls::MpvControls(MpvContainer *passedContainer, QWidget *parent) noexcep : QWidget(parent) , mpv(passedContainer) { - QProgressBar *progressBar = new QProgressBar(this); + auto *progressBar = new QSlider(this); + progressBar->setTracking(false); + progressBar->setOrientation(Qt::Horizontal); mpv->registerMpvDurationCallback([progressBar](double time) noexcept -> void { progressBar->setMaximum(static_cast<int>(time)); progressBar->setValue(0); }); mpv->registerMpvTimeCallback([progressBar](double time) noexcept -> void { - progressBar->setValue(static_cast<int>(time)); + if (!progressBar->isSliderDown()) { + // The user is not pressing the slider + progressBar->setValue(static_cast<int>(time)); + } }); auto *centralLayout = new QVBoxLayout(this);