Sayonara Player
AbstractSearchModel.h
1 /* AbstractSearchModel.h */
2 
3 /* Copyright (C) 2013 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 
22 
23 #ifndef ABSTRACT_SEARCH_MODEL_H_
24 #define ABSTRACT_SEARCH_MODEL_H_
25 
26 #include <QModelIndex>
27 #include <QAbstractTableModel>
28 #include <QAbstractListModel>
29 #include <QMap>
30 #include <QString>
31 
32 
33 
34 // We need this for eventual disambiguation between the
35 // table itself and this interface
36 // in the Searchable View class
38 
39 public:
40  virtual QModelIndex getFirstRowIndexOf(QString substr)=0;
41  virtual QModelIndex getNextRowIndexOf(QString substr, int cur_row, const QModelIndex& parent=QModelIndex())=0;
42  virtual QModelIndex getPrevRowIndexOf(QString substr, int cur_row, const QModelIndex& parent=QModelIndex())=0;
43  virtual QMap<QChar, QString> getExtraTriggers()=0;
44 };
45 
46 
47 // Searchable Model for tables
48 class AbstractSearchTableModel : public QAbstractTableModel, public AbstractSearchModelInterface {
49 
50 public:
51  AbstractSearchTableModel(QObject* parent=0) : QAbstractTableModel(parent){}
52 };
53 
54 
55 // Searchable Model for lists
56 class AbstractSearchListModel : public QAbstractListModel, public AbstractSearchModelInterface {
57 
58 public:
59  AbstractSearchListModel(QObject* parent=0) : QAbstractListModel(parent){}
60 };
61 
62 
63 #endif
Definition: AbstractSearchModel.h:48
Definition: AbstractSearchModel.h:37
Definition: AbstractSearchModel.h:56