1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

* Hide empty / 0 values for bitrate, year, age, filesize.

This commit is contained in:
Christian Muehlhaeuser
2011-11-08 19:03:00 +01:00
parent 1fc3c4c2f2
commit b537a237a8
3 changed files with 26 additions and 11 deletions

View File

@@ -185,17 +185,20 @@ TrackModel::data( const QModelIndex& index, int role ) const
break;
case Bitrate:
if ( query->results().first()->bitrate() == 0 )
return QString();
else
return query->results().first()->bitrate();
break;
case Age:
if ( query->results().first()->modificationTime() == 0 )
return QString();
else
return TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) );
break;
case Year:
if ( query->results().first()->year() == 0 )
return QString();
else
return query->results().first()->year();
break;

View File

@@ -316,12 +316,18 @@ TreeModel::data( const QModelIndex& index, int role ) const
return TomahawkUtils::timeToString( result->duration() );
case Bitrate:
if ( result->bitrate() == 0 )
return QString();
else
return result->bitrate();
case Age:
return TomahawkUtils::ageToString( QDateTime::fromTime_t( result->modificationTime() ) );
case Year:
if ( result->year() == 0 )
return QString();
else
return result->year();
case Filesize:

View File

@@ -214,6 +214,9 @@ timeToString( int seconds )
QString
ageToString( const QDateTime& time )
{
if ( time.toTime_t() == 0 )
return QString();
QDateTime now = QDateTime::currentDateTime();
int mins = time.secsTo( now ) / 60;
@@ -276,6 +279,9 @@ ageToString( const QDateTime& time )
QString
filesizeToString( unsigned int size )
{
if ( size == 0 )
return QString();
int kb = size / 1024;
int mb = kb / 1024;