Sayonara Player
SearchableListView.h
1 /* SearchableListView.h */
2 
3 /* Copyright (C) 2011-2016 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 SEARCHABLELISTVIEW_H
24 #define SEARCHABLELISTVIEW_H
25 
26 
27 #include "SayonaraSelectionView.h"
28 
29 #include <QListView>
30 #include <QMouseEvent>
31 #include <QKeyEvent>
32 
33 class MiniSearcher;
36  public QListView,
38 {
39  Q_OBJECT
40 
41 signals:
42  void sig_mouse_moved();
43  void sig_mouse_pressed();
44  void sig_mouse_released();
45  void sig_focus_out();
46  void sig_key_pressed(QKeyEvent*);
47 
48 private slots:
49  void edit_changed(const QString& str);
50  void fwd_clicked();
51  void bwd_clicked();
52 
53 private:
54 
55  MiniSearcher* _mini_searcher;
56  AbstractSearchListModel* _abstr_model;
57  int _cur_row;
58 
59  virtual void set_current_index(int idx) override;
60  virtual QAbstractItemModel* get_model() const override;
61  virtual QItemSelectionModel* get_selection_model() const override;
62 
63 public:
64  SearchableListView(QWidget* parent=nullptr);
65  virtual ~SearchableListView();
66  void setAbstractModel(AbstractSearchListModel* model);
67 
68 protected:
69  virtual void mouseMoveEvent(QMouseEvent *) override;
70  virtual void mousePressEvent(QMouseEvent *) override;
71  virtual void mouseReleaseEvent(QMouseEvent *) override;
72  virtual void keyPressEvent(QKeyEvent *) override;
73 };
74 
75 
76 #endif // SEARCHABLELISTVIEW_H
Definition: MiniSearcher.h:67
Definition: SearchableListView.h:35
Definition: AbstractSearchModel.h:56
Definition: SayonaraSelectionView.h:35