From f3cc1750c5b1d5bcc4064e16444f599c56d569ca Mon Sep 17 00:00:00 2001 From: druid23 Date: Thu, 19 Aug 2010 00:46:33 +0100 Subject: [PATCH] Added duration label to mainwindow modified: playermainwindow.cpp modified: playermainwindow.ui --- playermainwindow.cpp | 20 ++++++++++++++++---- playermainwindow.ui | 51 +++++++++++++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/playermainwindow.cpp b/playermainwindow.cpp index 3f58f03..22e6218 100644 --- a/playermainwindow.cpp +++ b/playermainwindow.cpp @@ -290,17 +290,29 @@ } void PlayerMainWindow::updateUiWithCurrentStatus() { - QTime timeLength(0,0,0) ; - timeLength = timeLength.addSecs(mCurrentStatus.time); + // position + QTime timePosition(0,0,0) ; + timePosition = timePosition.addSecs(mCurrentStatus.time); - ui->timeLabel->setText(timeLength.toString("h:mm:ss")); + ui->timeLabel->setText(timePosition.toString("h:mm:ss")); + // duration + if (0 < mCurrentStatus.length) { + QTime timeDuration(0,0,0) ; + timeDuration = timeDuration.addSecs(mCurrentStatus.length); + + ui->durationLabel->setText(timeDuration.toString("h:mm:ss")); + } + else { + ui->durationLabel->setText("0:00:00"); + } if (mCurrentStatus.position >= 0 && mCurrentStatus.position <= 100) ui->slider->setValue(mCurrentStatus.position); ui->label->setText(mCurrentStatus.title); + if (PLAYING == mCurrentStatus.state) { ui->playpauseButton->setIcon(QIcon::fromTheme("camera_video_pause")); } @@ -313,7 +325,7 @@ // rebuild display layout // retrieve album art } - + // Update the buttons on the playlist window if (NULL != this->mPlayListMainWindow) { this->mPlayListMainWindow->updateUiWithCurrentStatus(& mCurrentStatus); } diff --git a/playermainwindow.ui b/playermainwindow.ui index 787f791..4f91409 100644 --- a/playermainwindow.ui +++ b/playermainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 800 - 600 + 798 + 598 @@ -26,17 +26,37 @@ Information + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + - - - color: rgb(201, 201, 201); - - - - - + + + + + color: rgb(201, 201, 201); + + + + + + + + + + color: rgb(201, 201, 201); + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + @@ -87,13 +107,6 @@ - @@ -182,8 +195,8 @@ 0 0 - 800 - 24 + 798 + 20 -- 1.7.9.5