1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00
transmission/qt/tracker-model-filter.cc

37 lines
1,004 B
C++
Raw Normal View History

/*
* This file Copyright (C) Mnemosyne LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* $Id$
*/
#include "tracker-model.h"
#include "tracker-model-filter.h"
TrackerModelFilter :: TrackerModelFilter( QObject * parent ):
QSortFilterProxyModel( parent ),
myShowBackups( false )
{
}
void
TrackerModelFilter :: setShowBackupTrackers( bool b )
{
myShowBackups = b;
invalidateFilter( );
}
bool
TrackerModelFilter :: filterAcceptsRow( int sourceRow,
const QModelIndex & sourceParent ) const
{
QModelIndex index = sourceModel()->index( sourceRow, 0, sourceParent );
2010-07-30 22:24:48 +00:00
const TrackerInfo trackerInfo = index.data( TrackerModel::TrackerRole ).value<TrackerInfo>();
return myShowBackups || !trackerInfo.st.isBackup;
}