-
Notifications
You must be signed in to change notification settings - Fork 2
/
Filter.cpp
40 lines (32 loc) · 1015 Bytes
/
Filter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "Filter.h"
#include "Note.h"
TagFilter *TagFilter::instance = 0;
SearchFilter* SearchFilter::instance = 0;
bool SearchFilter::shallBeFiltered(Note *item) const
{
return !item->getTitle().contains(enabledTitleContaining, Qt::CaseInsensitive);
}
bool FilterKit::isFilteredByFilters(Note *item) const
{
for(QMap<FilterType, Filter*>::const_iterator it = filters.begin(); it!=filters.end(); ++it){
if((*it)->shallBeFiltered(item))
return true;
}
return false;
}
FilterKit* FilterKit::instance=0; // pointeur sur l'unique instance
FilterKit* FilterKit::getInstance(){
if(!instance)
instance = new FilterKit();
return instance;
}
bool TagFilter::shallBeFiltered(Note *item) const
{
// qDebug() << "DisabledTags size: " << disabledTags.size();
// filtrer les notes
for(QSet<Tag*>::const_iterator it=disabledTags.begin(); it!=disabledTags.end(); it++)
{
if((*it)->getAssocs().contains(item)) return true;
}
return false;
}