Sayonara Player
Filter.h
1 /* Filter.h
2 
3  * Copyright (C) 2011-2019 Lucio Carreras
4  *
5  * This file is part of sayonara-player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * created by Lucio Carreras,
21  * Jul 9, 2012
22  *
23  */
24 
25 #ifndef FILTER_H_
26 #define FILTER_H_
27 
28 
29 #include "Utils/Pimpl.h"
30 #include "Utils/Library/SearchMode.h"
31 
32 namespace Library
33 {
34  class DateFilter;
40  class Filter
41  {
42  PIMPL(Filter)
43 
44  public:
45 
46  enum Mode
47  {
48  Fulltext=0,
49  Filename,
50  Genre,
51  Track,
52  Invalid
53  };
54 
55  Filter();
56  ~Filter();
57 
58  Filter(const Filter& other);
59  Filter& operator=(const Filter& other);
60 
61  bool operator==(const Filter& other);
62 
69  QStringList filtertext(bool with_percent) const;
70 
77  QStringList search_mode_filtertext(bool with_percent) const;
78 
79 
86  void set_filtertext(const QString& str, SearchModeMask search_mode);
87 
92  Filter::Mode mode() const;
93 
98  void set_mode(Filter::Mode mode);
99 
103  void clear();
104 
110  bool cleared() const;
111 
117  void set_invalid_genre(bool b);
118 
123  bool is_invalid_genre() const;
124 
133  bool is_usable() const;
134 
140  TrackID track_id() const;
141 
147  static QString get_text(Mode mode);
148  };
149 }
150 
151 #endif /* FILTER_H_ */
void set_filtertext(const QString &str, SearchModeMask search_mode)
set comma separated filtertext. Usually this is the string found at the search box in the library
QStringList filtertext(bool with_percent) const
get splitted filtertext with or without percent. Needed for file search for example where cissearch i...
The Filter class.
Definition: Filter.h:40
bool cleared() const
Is the searchterm empty?
bool is_invalid_genre() const
Is the invalid genre mode active?
TrackID track_id() const
When searching for a track (Filter::Mode == Filter::Mode::Track) this will return the track id.
bool is_usable() const
Invalid mode is not usable. Invalid genre means, that this is a valid query -> Usable....
void set_mode(Filter::Mode mode)
Sets the Filter::Mode.
QStringList search_mode_filtertext(bool with_percent) const
get splitted filtertext with or without percent but converts the search string suitable for cissearch...
Filter::Mode mode() const
Returns the filtermode.
Definition: Genre.h:30
void clear()
Clear the searchterm. We are not looking for an invalid genre, too.
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
static QString get_text(Mode mode)
Get an human readable string for the mode.
void set_invalid_genre(bool b)
Sets a genre, which is not searched directly. This is meant to fetch all tracks which contains no gen...