mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-18 20:04:00 +02:00
* Allow to sort by composer and origin.
This commit is contained in:
@@ -269,6 +269,8 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
const QString album2 = q2->albumSortname();
|
const QString album2 = q2->albumSortname();
|
||||||
const QString track1 = q1->trackSortname();
|
const QString track1 = q1->trackSortname();
|
||||||
const QString track2 = q2->trackSortname();
|
const QString track2 = q2->trackSortname();
|
||||||
|
const QString composer1 = q1->composerSortname();
|
||||||
|
const QString composer2 = q2->composerSortname();
|
||||||
const unsigned int albumpos1 = q1->albumpos();
|
const unsigned int albumpos1 = q1->albumpos();
|
||||||
const unsigned int albumpos2 = q2->albumpos();
|
const unsigned int albumpos2 = q2->albumpos();
|
||||||
const unsigned int discnumber1 = q1->discnumber();
|
const unsigned int discnumber1 = q1->discnumber();
|
||||||
@@ -277,6 +279,8 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
unsigned int mtime1 = 0, mtime2 = 0;
|
unsigned int mtime1 = 0, mtime2 = 0;
|
||||||
unsigned int size1 = 0, size2 = 0;
|
unsigned int size1 = 0, size2 = 0;
|
||||||
float score1 = 0, score2 = 0;
|
float score1 = 0, score2 = 0;
|
||||||
|
QString origin1;
|
||||||
|
QString origin2;
|
||||||
qint64 id1 = 0, id2 = 0;
|
qint64 id1 = 0, id2 = 0;
|
||||||
|
|
||||||
if ( q1->numResults() )
|
if ( q1->numResults() )
|
||||||
@@ -286,6 +290,7 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
mtime1 = r->modificationTime();
|
mtime1 = r->modificationTime();
|
||||||
size1 = r->size();
|
size1 = r->size();
|
||||||
score1 = r->score();
|
score1 = r->score();
|
||||||
|
origin1 = r->friendlySource().toLower();
|
||||||
id1 = (qint64)&r;
|
id1 = (qint64)&r;
|
||||||
}
|
}
|
||||||
if ( q2->numResults() )
|
if ( q2->numResults() )
|
||||||
@@ -295,6 +300,7 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
mtime2 = r->modificationTime();
|
mtime2 = r->modificationTime();
|
||||||
size2 = r->size();
|
size2 = r->size();
|
||||||
score2 = r->score();
|
score2 = r->score();
|
||||||
|
origin2 = r->friendlySource().toLower();
|
||||||
id2 = (qint64)&r;
|
id2 = (qint64)&r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +333,28 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
|
|
||||||
return QString::localeAwareCompare( artist1, artist2 ) < 0;
|
return QString::localeAwareCompare( artist1, artist2 ) < 0;
|
||||||
}
|
}
|
||||||
|
else if ( column == PlayableModel::Composer ) // sort by composer
|
||||||
|
{
|
||||||
|
if ( composer1 == composer2 )
|
||||||
|
{
|
||||||
|
if ( album1 == album2 )
|
||||||
|
{
|
||||||
|
if ( discnumber1 == discnumber2 )
|
||||||
|
{
|
||||||
|
if ( albumpos1 == albumpos2 )
|
||||||
|
return id1 < id2;
|
||||||
|
|
||||||
|
return albumpos1 < albumpos2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return discnumber1 < discnumber2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString::localeAwareCompare( album1, album2 ) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString::localeAwareCompare( composer1, composer2 ) < 0;
|
||||||
|
}
|
||||||
else if ( column == PlayableModel::Album ) // sort by album
|
else if ( column == PlayableModel::Album ) // sort by album
|
||||||
{
|
{
|
||||||
if ( album1 == album2 )
|
if ( album1 == album2 )
|
||||||
@@ -372,6 +400,13 @@ PlayableProxyModel::lessThan( int column, const Tomahawk::query_ptr& q1, const T
|
|||||||
|
|
||||||
return score1 < score2;
|
return score1 < score2;
|
||||||
}
|
}
|
||||||
|
else if ( column == PlayableModel::Origin ) // sort by file origin
|
||||||
|
{
|
||||||
|
if ( origin1 == origin2 )
|
||||||
|
return id1 < id2;
|
||||||
|
|
||||||
|
return origin1 < origin2;
|
||||||
|
}
|
||||||
else if ( column == PlayableModel::AlbumPos ) // sort by album pos
|
else if ( column == PlayableModel::AlbumPos ) // sort by album pos
|
||||||
{
|
{
|
||||||
if ( discnumber1 != discnumber2 )
|
if ( discnumber1 != discnumber2 )
|
||||||
|
Reference in New Issue
Block a user