summaryrefslogtreecommitdiffstats
path: root/playerwidget.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2017-03-04 16:18:52 +0100
committerArno <arno@disconnect.de>2017-03-04 16:18:52 +0100
commit11262d031671c018b160b9200876ec5468526161 (patch)
tree42f287d0f46c9815e92a7a46668b28e24aa826ba /playerwidget.cpp
parente03bd4b683738f5d0decac5b990c2c929558d744 (diff)
downloadBeetPlayer-11262d031671c018b160b9200876ec5468526161.tar.gz
BeetPlayer-11262d031671c018b160b9200876ec5468526161.tar.bz2
BeetPlayer-11262d031671c018b160b9200876ec5468526161.zip
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...
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r--playerwidget.cpp6
1 files changed, 3 insertions, 3 deletions
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){