2010-07-28 14:43:47 +00:00
|
|
|
/*
|
2015-06-10 21:27:11 +00:00
|
|
|
* This file Copyright (C) 2010-2015 Mnemosyne LLC
|
2010-07-28 14:43:47 +00:00
|
|
|
*
|
2014-12-21 23:49:39 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2010-07-28 14:43:47 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "TrackerModel.h"
|
|
|
|
#include "TrackerModelFilter.h"
|
2010-07-28 14:43:47 +00:00
|
|
|
|
2014-12-12 23:05:10 +00:00
|
|
|
TrackerModelFilter::TrackerModelFilter (QObject * parent):
|
2013-09-14 22:45:04 +00:00
|
|
|
QSortFilterProxyModel (parent),
|
|
|
|
myShowBackups (false)
|
2010-07-28 14:43:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-12-12 23:05:10 +00:00
|
|
|
TrackerModelFilter::setShowBackupTrackers (bool b)
|
2010-07-28 14:43:47 +00:00
|
|
|
{
|
2013-09-14 22:45:04 +00:00
|
|
|
myShowBackups = b;
|
|
|
|
invalidateFilter ();
|
2010-07-28 14:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-12-12 23:05:10 +00:00
|
|
|
TrackerModelFilter::filterAcceptsRow (int sourceRow,
|
|
|
|
const QModelIndex & sourceParent) const
|
2010-07-28 14:43:47 +00:00
|
|
|
{
|
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;
|
2010-07-28 14:43:47 +00:00
|
|
|
}
|