Sayonara Player
AbstractSearchModel.h
1 /* AbstractSearchModel.h */
2 
3 /* Copyright 2011-2017 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 
21 #ifndef ABSTRACT_SEARCH_MODEL_H_
22 #define ABSTRACT_SEARCH_MODEL_H_
23 
24 #include <QAbstractTableModel>
25 #include <QAbstractListModel>
26 #include <QMap>
27 #include <QString>
28 #include "Helper/Library/SearchMode.h"
29 
30 // We need this for eventual disambiguation between the
31 // table itself and this interface
32 // in the Searchable View class
33 
35 {
36 public:
37  virtual QModelIndex getFirstRowIndexOf(const QString& substr)=0;
38  virtual QModelIndex getNextRowIndexOf(const QString& substr, int cur_row, const QModelIndex& parent=QModelIndex())=0;
39  virtual QModelIndex getPrevRowIndexOf(const QString& substr, int cur_row, const QModelIndex& parent=QModelIndex())=0;
40  virtual QMap<QChar, QString> getExtraTriggers()=0;
41 
42  virtual void set_search_mode(Library::SearchModeMask search_mode);
43  virtual Library::SearchModeMask search_mode() const final;
44 
45 protected:
47  virtual ~SearchModelFunctionality();
48 
49 private:
50  Library::SearchModeMask _search_mode;
51 };
52 
53 
54 template <typename AbstractModel>
57  public AbstractModel
58 {
59  public:
60 
61  SearchModelInterface(QObject* parent=nullptr) :
63  AbstractModel(parent)
64  {}
65 
66  virtual ~SearchModelInterface() {}
67 };
68 
71 
72 #endif
Definition: AbstractSearchModel.h:55
Definition: AbstractSearchModel.h:34
Definition: org_mpris_media_player2_adaptor.h:21