Added duration label to mainwindow
authordruid23 <usr@dru-id.co.uk>
Wed, 18 Aug 2010 23:46:33 +0000 (00:46 +0100)
committerdruid23 <usr@dru-id.co.uk>
Wed, 18 Aug 2010 23:46:33 +0000 (00:46 +0100)
modified:   playermainwindow.cpp
modified:   playermainwindow.ui

playermainwindow.cpp
playermainwindow.ui

index 3f58f03..22e6218 100644 (file)
   }
 
   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"));
       }
           //   rebuild display layout
           //   retrieve album art
       }
-
+      // Update the buttons on the playlist window
       if (NULL != this->mPlayListMainWindow) {
         this->mPlayListMainWindow->updateUiWithCurrentStatus(& mCurrentStatus);
       }
index 787f791..4f91409 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
-    <height>600</height>
+    <width>798</width>
+    <height>598</height>
    </rect>
   </property>
   <property name="windowTitle">
       <property name="text">
        <string>Information</string>
       </property>
+      <property name="alignment">
+       <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+      </property>
      </widget>
     </item>
     <item>
-     <widget class="QLabel" name="timeLabel">
-      <property name="styleSheet">
-       <string notr="true">color: rgb(201, 201, 201);</string>
-      </property>
-      <property name="text">
-       <string/>
-      </property>
-     </widget>
+     <layout class="QHBoxLayout" name="horizontalLayoutTime">
+      <item>
+       <widget class="QLabel" name="timeLabel">
+        <property name="styleSheet">
+         <string notr="true">color: rgb(201, 201, 201);</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="durationLabel">
+        <property name="styleSheet">
+         <string notr="true">color: rgb(201, 201, 201);</string>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
     </item>
     <item>
      <widget class="QSlider" name="slider">
         </property>
        </widget>
       </item>
-      <!--item>
-       <widget class="QToolButton" name="pauseButton">
-        <property name="text">
-         <string>Pause</string>
-        </property>
-       </widget>
-      </item-->
       <item>
        <widget class="QToolButton" name="stopButton">
         <property name="text">
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>800</width>
-     <height>24</height>
+     <width>798</width>
+     <height>20</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuMenu">