1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00
transmission/qt/tracker-model-filter.cc

34 lines
862 B
C++
Raw Normal View History

/*
* This file Copyright (C) 2010-2014 Mnemosyne LLC
*
* It may be used under the GNU Public License v2 or v3 licenses,
* or any future license endorsed by Mnemosyne LLC.
*
* $Id$
*/
#include "tracker-model.h"
#include "tracker-model-filter.h"
2013-09-14 22:45:04 +00:00
TrackerModelFilter :: TrackerModelFilter (QObject * parent):
QSortFilterProxyModel (parent),
myShowBackups (false)
{
}
void
2013-09-14 22:45:04 +00:00
TrackerModelFilter :: setShowBackupTrackers (bool b)
{
2013-09-14 22:45:04 +00:00
myShowBackups = b;
invalidateFilter ();
}
bool
2013-09-14 22:45:04 +00:00
TrackerModelFilter :: filterAcceptsRow (int sourceRow,
const QModelIndex & sourceParent) const
{
2013-09-14 22:45:04 +00:00
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
const TrackerInfo trackerInfo = index.data(TrackerModel::TrackerRole).value<TrackerInfo>();
return myShowBackups || !trackerInfo.st.isBackup;
}