Sayonara Player
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Library::Filter Class Reference

The Filter class. More...

#include <Filter.h>

Public Types

enum  Mode {
  Fulltext =0,
  Filename,
  Genre,
  Track,
  Invalid
}
 

Public Member Functions

 Filter (const Filter &other)
 
Filteroperator= (const Filter &other)
 
bool operator== (const Filter &other)
 
QStringList filtertext (bool with_percent) const
 get splitted filtertext with or without percent. Needed for file search for example where cissearch is not suitable More...
 
QStringList search_mode_filtertext (bool with_percent) const
 get splitted filtertext with or without percent but converts the search string suitable for cissearch first. More...
 
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 More...
 
Filter::Mode mode () const
 Returns the filtermode. More...
 
void set_mode (Filter::Mode mode)
 Sets the Filter::Mode. More...
 
void clear ()
 Clear the searchterm. We are not looking for an invalid genre, too.
 
bool cleared () const
 Is the searchterm empty? More...
 
void set_invalid_genre (bool b)
 Sets a genre, which is not searched directly. This is meant to fetch all tracks which contains no genre. More...
 
bool is_invalid_genre () const
 Is the invalid genre mode active? More...
 
bool is_usable () const
 Invalid mode is not usable. Invalid genre means, that this is a valid query -> Usable. When searching for a track, the id needs to be non-negative. When searching for different stuff, the size of the searchstrings needs at least to be 3 characters. More...
 
TrackID track_id () const
 When searching for a track (Filter::Mode == Filter::Mode::Track) this will return the track id. More...
 

Static Public Member Functions

static QString get_text (Mode mode)
 Get an human readable string for the mode. More...
 

Detailed Description

The Filter class.

Member Function Documentation

◆ cleared()

bool Library::Filter::cleared ( ) const

Is the searchterm empty?

Returns
true if the searchterm is empty. If the current mode indicates that we are looking for an invalid genre, false is returned, too

◆ filtertext()

QStringList Library::Filter::filtertext ( bool  with_percent) const

get splitted filtertext with or without percent. Needed for file search for example where cissearch is not suitable

Parameters
with_percentappends and prepends a percent sign to each filtertext
Returns

◆ get_text()

static QString Library::Filter::get_text ( Mode  mode)
static

Get an human readable string for the mode.

Parameters
mode
Returns

◆ is_invalid_genre()

bool Library::Filter::is_invalid_genre ( ) const

Is the invalid genre mode active?

Returns

◆ is_usable()

bool Library::Filter::is_usable ( ) const

Invalid mode is not usable. Invalid genre means, that this is a valid query -> Usable. When searching for a track, the id needs to be non-negative. When searching for different stuff, the size of the searchstrings needs at least to be 3 characters.

Returns

◆ mode()

Filter::Mode Library::Filter::mode ( ) const

Returns the filtermode.

Returns

◆ search_mode_filtertext()

QStringList Library::Filter::search_mode_filtertext ( bool  with_percent) const

get splitted filtertext with or without percent but converts the search string suitable for cissearch first.

Parameters
with_percentappends and prepends a percent sign to each filtertext
Returns

◆ set_filtertext()

void Library::Filter::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

Parameters
strsearchstring
search_modewhat do we want to search?

◆ set_invalid_genre()

void Library::Filter::set_invalid_genre ( bool  b)

Sets a genre, which is not searched directly. This is meant to fetch all tracks which contains no genre.

Parameters
b

◆ set_mode()

void Library::Filter::set_mode ( Filter::Mode  mode)

Sets the Filter::Mode.

Parameters
mode

◆ track_id()

TrackID Library::Filter::track_id ( ) const

When searching for a track (Filter::Mode == Filter::Mode::Track) this will return the track id.

Returns