mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 00:24:12 +02:00
* Hide empty / 0 values for bitrate, year, age, filesize.
This commit is contained in:
@@ -185,18 +185,21 @@ TrackModel::data( const QModelIndex& index, int role ) const
|
||||
break;
|
||||
|
||||
case Bitrate:
|
||||
return query->results().first()->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() ) );
|
||||
return TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) );
|
||||
break;
|
||||
|
||||
case Year:
|
||||
return query->results().first()->year();
|
||||
if ( query->results().first()->year() == 0 )
|
||||
return QString();
|
||||
else
|
||||
return query->results().first()->year();
|
||||
break;
|
||||
|
||||
case Filesize:
|
||||
|
@@ -316,13 +316,19 @@ TreeModel::data( const QModelIndex& index, int role ) const
|
||||
return TomahawkUtils::timeToString( result->duration() );
|
||||
|
||||
case Bitrate:
|
||||
return result->bitrate();
|
||||
if ( result->bitrate() == 0 )
|
||||
return QString();
|
||||
else
|
||||
return result->bitrate();
|
||||
|
||||
case Age:
|
||||
return TomahawkUtils::ageToString( QDateTime::fromTime_t( result->modificationTime() ) );
|
||||
|
||||
case Year:
|
||||
return result->year();
|
||||
if ( result->year() == 0 )
|
||||
return QString();
|
||||
else
|
||||
return result->year();
|
||||
|
||||
case Filesize:
|
||||
return TomahawkUtils::filesizeToString( result->size() );
|
||||
|
@@ -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;
|
||||
|
||||
@@ -556,7 +562,7 @@ proxyFactory( bool noMutexLocker )
|
||||
// Don't lock if being called from nam()
|
||||
QMutex otherMutex;
|
||||
QMutexLocker locker( noMutexLocker ? &otherMutex : &s_namAccessMutex );
|
||||
|
||||
|
||||
if ( s_threadProxyFactoryHash.contains( QThread::currentThread() ) )
|
||||
return s_threadProxyFactoryHash[ QThread::currentThread() ];
|
||||
|
||||
@@ -606,7 +612,7 @@ setProxyFactory( NetworkProxyFactory* factory, bool noMutexLocker )
|
||||
|
||||
|
||||
QNetworkAccessManager*
|
||||
nam()
|
||||
nam()
|
||||
{
|
||||
QMutexLocker locker( &s_namAccessMutex );
|
||||
if ( s_threadNamHash.contains( QThread::currentThread() ) )
|
||||
@@ -627,7 +633,7 @@ nam()
|
||||
newNam->setConfiguration( QNetworkConfiguration( mainNam->configuration() ) );
|
||||
newNam->setNetworkAccessible( mainNam->networkAccessible() );
|
||||
newNam->setProxyFactory( proxyFactory( true ) );
|
||||
|
||||
|
||||
s_threadNamHash[ QThread::currentThread() ] = newNam;
|
||||
|
||||
return newNam;
|
||||
|
Reference in New Issue
Block a user