From 11262d031671c018b160b9200876ec5468526161 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 4 Mar 2017 16:18:52 +0100 Subject: Fix display of current length The player is a strange beast. Calculate the duration after the new song has been triggered. The results were more or less randon, I guess... --- playerwidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'playerwidget.cpp') diff --git a/playerwidget.cpp b/playerwidget.cpp index dc6d1aa..92bfda7 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -631,9 +631,6 @@ void PlayerWidget::play(const QString &fullPath){ mCurrentTE->append(QString("%1 %2").arg(tr("Genre:"), -20).arg(genre)); mCurrentTE->append(QString("%1 %2").arg(tr("Track:"), -20).arg(track, 3, 10, QChar('0'))); mCurrentTE->append(QString("%1 %2").arg(tr("Year:"), -20).arg(year, 4, 10)); - int minutes = mDurSecs / 60; - int seconds = mDurSecs % 60; - mCurrentTE->append(QString("%1 %2:%3").arg(tr("Length:"), -20).arg(minutes, 2, 10, QChar('0')).arg(seconds, 2, 10, QChar('0'))); mPlayA->trigger(); } @@ -696,6 +693,9 @@ void PlayerWidget::setDuration(qint64 dur){ mDurSecs = dur / 1000; mSongSlider->setMinimum(0); mSongSlider->setMaximum(mDurSecs); + int minutes = mDurSecs / 60; + int seconds = mDurSecs % 60; + mCurrentTE->append(QString("%1 %2:%3").arg(tr("Length:"), -20).arg(minutes, 2, 10, QChar('0')).arg(seconds, 2, 10, QChar('0'))); } void PlayerWidget::continuePlaying(QMediaPlayer::State state){ -- cgit v1.2.3-70-g09d2