Changeset 43 for lib/song.cpp


Ignore:
Timestamp:
01/07/08 17:44:35 (4 years ago)
Author:
sander
Message:

Made a function to format the time nicely.
Also tried to format the message content, though it's still not perfect, at least here.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/song.cpp

    r17 r43  
     1#include <cmath> 
    12#include "song.h" 
    23 
     
    2526        title = "<Unknown>"; 
    2627} 
     28 
     29QString 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} 
Note: See TracChangeset for help on using the changeset viewer.