mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 10:33:59 +02:00
* Hide empty / 0 values for bitrate, year, age, filesize.
This commit is contained in:
@@ -185,17 +185,20 @@ TrackModel::data( const QModelIndex& index, int role ) const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Bitrate:
|
case Bitrate:
|
||||||
|
if ( query->results().first()->bitrate() == 0 )
|
||||||
|
return QString();
|
||||||
|
else
|
||||||
return query->results().first()->bitrate();
|
return query->results().first()->bitrate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Age:
|
case Age:
|
||||||
if ( query->results().first()->modificationTime() == 0 )
|
|
||||||
return QString();
|
|
||||||
else
|
|
||||||
return TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) );
|
return TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Year:
|
case Year:
|
||||||
|
if ( query->results().first()->year() == 0 )
|
||||||
|
return QString();
|
||||||
|
else
|
||||||
return query->results().first()->year();
|
return query->results().first()->year();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -316,12 +316,18 @@ TreeModel::data( const QModelIndex& index, int role ) const
|
|||||||
return TomahawkUtils::timeToString( result->duration() );
|
return TomahawkUtils::timeToString( result->duration() );
|
||||||
|
|
||||||
case Bitrate:
|
case Bitrate:
|
||||||
|
if ( result->bitrate() == 0 )
|
||||||
|
return QString();
|
||||||
|
else
|
||||||
return result->bitrate();
|
return result->bitrate();
|
||||||
|
|
||||||
case Age:
|
case Age:
|
||||||
return TomahawkUtils::ageToString( QDateTime::fromTime_t( result->modificationTime() ) );
|
return TomahawkUtils::ageToString( QDateTime::fromTime_t( result->modificationTime() ) );
|
||||||
|
|
||||||
case Year:
|
case Year:
|
||||||
|
if ( result->year() == 0 )
|
||||||
|
return QString();
|
||||||
|
else
|
||||||
return result->year();
|
return result->year();
|
||||||
|
|
||||||
case Filesize:
|
case Filesize:
|
||||||
|
@@ -214,6 +214,9 @@ timeToString( int seconds )
|
|||||||
QString
|
QString
|
||||||
ageToString( const QDateTime& time )
|
ageToString( const QDateTime& time )
|
||||||
{
|
{
|
||||||
|
if ( time.toTime_t() == 0 )
|
||||||
|
return QString();
|
||||||
|
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
|
|
||||||
int mins = time.secsTo( now ) / 60;
|
int mins = time.secsTo( now ) / 60;
|
||||||
@@ -276,6 +279,9 @@ ageToString( const QDateTime& time )
|
|||||||
QString
|
QString
|
||||||
filesizeToString( unsigned int size )
|
filesizeToString( unsigned int size )
|
||||||
{
|
{
|
||||||
|
if ( size == 0 )
|
||||||
|
return QString();
|
||||||
|
|
||||||
int kb = size / 1024;
|
int kb = size / 1024;
|
||||||
int mb = kb / 1024;
|
int mb = kb / 1024;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user