diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index f7a250fea..238610c20 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -1184,8 +1184,6 @@ void MainWindow::UpdateTrackPosition() { if (length <= 0) { // Probably a stream that we don't know the length of - //ui_->track_slider->SetStopped(); - //tray_icon_->SetProgress(0); return; } diff --git a/src/widgets/trackslider.cpp b/src/widgets/trackslider.cpp index e41ae76fe..754b5a3b1 100644 --- a/src/widgets/trackslider.cpp +++ b/src/widgets/trackslider.cpp @@ -100,7 +100,10 @@ void TrackSlider::SetValue(int elapsed, int total) { setting_value_ = true; // This is so we don't emit from QAbstractSlider::valueChanged ui_->slider->setMaximum(total); - ui_->slider->setValue(elapsed); + if (!ui_->slider->isSliderDown()) { + ui_->slider->setValue(elapsed); + } + setting_value_ = false; UpdateTimes(elapsed / kMsecPerSec); @@ -116,7 +119,7 @@ void TrackSlider::UpdateTimes(int elapsed) { } else { // Check if slider maximum value is changed before updating - if (slider_maximum_value_ != ui_->slider->maximum()) { + if (slider_maximum_value_ != ui_->slider->maximum() || !ui_->slider->isEnabled()) { slider_maximum_value_ = ui_->slider->maximum(); ui_->remaining->setText(Utilities::PrettyTime((ui_->slider->maximum() / kMsecPerSec))); } diff --git a/src/widgets/tracksliderslider.cpp b/src/widgets/tracksliderslider.cpp index bba54bd73..142705549 100644 --- a/src/widgets/tracksliderslider.cpp +++ b/src/widgets/tracksliderslider.cpp @@ -111,7 +111,11 @@ void TrackSliderSlider::enterEvent(QEvent* e) { void TrackSliderSlider::leaveEvent(QEvent* e) { QSlider::leaveEvent(e); - popup_->hide(); + // On some (but not all) systems, displaying the TrackSliderPopup + // generates a leaveEvent. Ensure that this leaveEvent is genuine. + if (!geometry().contains(mapFromGlobal(QCursor::pos()))) { + popup_->hide(); + } } void TrackSliderSlider::keyPressEvent(QKeyEvent* event) { @@ -130,7 +134,7 @@ void TrackSliderSlider::keyPressEvent(QKeyEvent* event) { void TrackSliderSlider::UpdateDeltaTime() { if (popup_->isVisible()) { - int delta_seconds = mouse_hover_seconds_ - value(); + int delta_seconds = mouse_hover_seconds_ - (value() / kMsecPerSec); popup_->SetSmallText(Utilities::PrettyTimeDelta(delta_seconds)); } }