Add option to set stream as favourite

This commit is contained in:
craig
2011-12-14 19:38:56 +00:00
committed by craig
parent dfc686377f
commit 1deef1baec
9 changed files with 143 additions and 38 deletions

View File

@@ -21,6 +21,7 @@
* Boston, MA 02110-1301, USA.
*/
#include "streamsproxymodel.h"
#include "streamsmodel.h"
StreamsProxyModel::StreamsProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
{
@@ -30,3 +31,12 @@ StreamsProxyModel::StreamsProxyModel(QObject *parent) : QSortFilterProxyModel(pa
setSortLocaleAware(true);
sort(0);
}
bool StreamsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
StreamsModel::Stream *l=static_cast<StreamsModel::Stream *>(left.internalPointer());
StreamsModel::Stream *r=static_cast<StreamsModel::Stream *>(right.internalPointer());
return l->favorite > r->favorite
|| (l->favorite==r->favorite && l->name.localeAwareCompare(r->name)<0);
}