mirror of https://code.videolan.org/videolan/vlc
Merge branch 'remaining-time' into 'master'
qt: Adapt remaining time according to playback speed Closes #28280 See merge request videolan/vlc!3842
This commit is contained in:
commit
de5086ca80
|
@ -1741,8 +1741,11 @@ void PlayerController::updateTime(vlc_tick_t system_now, bool forceUpdate)
|
|||
|
||||
// Update time properties
|
||||
emit timeChanged(d->m_time);
|
||||
if (d->m_time != VLC_TICK_INVALID && d->m_length != VLC_TICK_INVALID)
|
||||
const float playbackSpeed = getRate();
|
||||
if (d->m_time != VLC_TICK_INVALID && d->m_length != VLC_TICK_INVALID) {
|
||||
d->m_remainingTime = d->m_length - d->m_time;
|
||||
d->m_adjustedRemainingTime = d->m_remainingTime / playbackSpeed;
|
||||
}
|
||||
else
|
||||
d->m_remainingTime = VLC_TICK_INVALID;
|
||||
emit remainingTimeChanged(d->m_remainingTime);
|
||||
|
@ -2061,6 +2064,7 @@ PRIMITIVETYPE_GETTER(PlayerController::PlayingState, getPlayingState, m_playing_
|
|||
PRIMITIVETYPE_GETTER(QString, getName, m_name)
|
||||
PRIMITIVETYPE_GETTER(VLCTick, getTime, m_time)
|
||||
PRIMITIVETYPE_GETTER(VLCTick, getRemainingTime, m_remainingTime)
|
||||
PRIMITIVETYPE_GETTER(VLCTick, getAdjustedRemainingTime, m_adjustedRemainingTime)
|
||||
PRIMITIVETYPE_GETTER(float, getPosition, m_position)
|
||||
PRIMITIVETYPE_GETTER(VLCTick, getLength, m_length)
|
||||
PRIMITIVETYPE_GETTER(VLCTick, getAudioDelay, m_audioDelay)
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
|
||||
Q_PROPERTY(VLCTick time READ getTime WRITE setTime NOTIFY timeChanged FINAL)
|
||||
Q_PROPERTY(VLCTick remainingTime READ getRemainingTime NOTIFY remainingTimeChanged FINAL)
|
||||
Q_PROPERTY(VLCTick adjustedRemainingTime READ getAdjustedRemainingTime NOTIFY remainingTimeChanged FINAL)
|
||||
Q_PROPERTY(float position READ getPosition WRITE setPosition NOTIFY positionChanged FINAL)
|
||||
Q_PROPERTY(VLCTick length READ getLength NOTIFY lengthChanged FINAL)
|
||||
|
||||
|
@ -282,6 +283,7 @@ public slots:
|
|||
VLCTick getTime() const;
|
||||
void setTime(VLCTick);
|
||||
VLCTick getRemainingTime() const;
|
||||
VLCTick getAdjustedRemainingTime() const;
|
||||
float getPosition() const;
|
||||
void setPosition(float);
|
||||
VLCTick getLength() const;
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
|
||||
VLCTick m_time = 0;
|
||||
VLCTick m_remainingTime = 0;
|
||||
VLCTick m_adjustedRemainingTime = 0;
|
||||
double m_position = 0.f;
|
||||
VLCTick m_length= 0;
|
||||
|
||||
|
|
|
@ -140,6 +140,10 @@ T.Pane {
|
|||
anchors.fill: parent
|
||||
onClicked: MainCtx.showRemainingTime = !MainCtx.showRemainingTime
|
||||
}
|
||||
|
||||
T.ToolTip.visible: (hovered && MainCtx.showRemainingTime)
|
||||
T.ToolTip.delay: VLCStyle.delayToolTipAppear
|
||||
T.ToolTip.text: Player.adjustedRemainingTime.formatHMS() + ", " + Player.rate
|
||||
},
|
||||
SliderBar {
|
||||
id: trackPositionSlider
|
||||
|
|
Loading…
Reference in New Issue