Changeset 43
- Timestamp:
- 01/07/08 17:44:35 (4 years ago)
- Files:
-
- 3 edited
-
gui/main_window.cpp (modified) (4 diffs)
-
lib/song.cpp (modified) (2 diffs)
-
lib/song.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gui/main_window.cpp
r42 r43 1 #include <cmath>2 1 #include <QtGui> 3 2 #include <QIcon> … … 123 122 trayIcon->setIcon(icon); 124 123 trayIcon->setToolTip("QtMPC"); 125 124 126 125 return true; 127 126 } … … 213 212 if (!song->title.isEmpty() && !song->artist.isEmpty() && !song->album.isEmpty()) { 214 213 trayIcon->showMessage(song->artist + " - " + song->title, 215 "album: " + song->album + "\n" +216 "track: " + QString::number(song->track) + "\n" +217 " time:" + QString::number(song->time) + "\n",214 "album: " + song->album + "\n" + 215 "track: " + QString::number(song->track) + "\n" + 216 "length: " + Song::formattedTime(song->time), 218 217 QSystemTrayIcon::Information, 5000); 219 218 } … … 248 247 timeElapsedFormattedString = "00:00 / 00:00"; 249 248 } else { 250 // Time elapsed 251 timeElapsedFormattedString += QString::number(floor(status.time_elapsed / 60.0)); 252 timeElapsedFormattedString += ":"; 253 if(status.time_elapsed % 60 < 10) { 254 timeElapsedFormattedString += "0"; 255 } 256 timeElapsedFormattedString += QString::number(status.time_elapsed % 60); 257 249 timeElapsedFormattedString += Song::formattedTime(status.time_elapsed); 258 250 timeElapsedFormattedString += " / "; 259 260 // Time total 261 timeElapsedFormattedString += QString::number(floor(status.time_total / 60.0)); 262 timeElapsedFormattedString += ":"; 263 if(status.time_total % 60 < 10) { 264 timeElapsedFormattedString += "0"; 265 } 266 timeElapsedFormattedString += QString::number(status.time_total % 60); 251 timeElapsedFormattedString += Song::formattedTime(status.time_total); 267 252 } 268 253 -
lib/song.cpp
r17 r43 1 #include <cmath> 1 2 #include "song.h" 2 3 … … 25 26 title = "<Unknown>"; 26 27 } 28 29 QString Song::formattedTime(const quint32 &seconds) 30 { 31 QString result; 32 33 result += QString::number(floor(seconds / 60.0)); 34 result += ":"; 35 if(seconds % 60 < 10) 36 result += "0"; 37 result += QString::number(seconds % 60); 38 39 return result; 40 } -
lib/song.h
r17 r43 20 20 bool isEmpty() const; 21 21 void fillEmptyFields(); 22 static QString formattedTime(const quint32 &seconds); 22 23 }; 23 24
Note: See TracChangeset
for help on using the changeset viewer.
