Sayonara Player
FileListView.h
1 /* FileListView.h */
2 
3 /* Copyright (C) 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 FILELISTVIEW_H
22 #define FILELISTVIEW_H
23 
24 #include "GUI/Helper/SearchableWidget/SearchableView.h"
25 #include "GUI/Helper/Dragable/Dragable.h"
26 
27 class FileListModel;
28 class MetaDataList;
29 class LibraryContextMenu;
30 
31 class FileListView :
32  public SearchableListView,
33  private Dragable
34 {
35  Q_OBJECT
36 
37 signals:
38  void sig_info_clicked();
39  void sig_delete_clicked();
40  void sig_play_next_clicked();
41  void sig_append_clicked();
42 
43 public:
44  explicit FileListView(QWidget* parent=nullptr);
45  virtual ~FileListView();
46 
47  QModelIndexList get_selected_rows() const;
48  MetaDataList get_selected_metadata() const;
49  QStringList get_selected_paths() const;
50 
51  void set_parent_directory(const QString& dir);
52 
53  QMimeData* get_mimedata() const override;
54 
55 private:
56  LibraryContextMenu* _context_menu=nullptr;
57  FileListModel* _model=nullptr;
58 
59 
60 private:
61  void mousePressEvent(QMouseEvent* event) override;
62  void mouseMoveEvent(QMouseEvent* event) override;
63 
64  void init_context_menu();
65 
66  // SayonaraSelectionView interface
67 public:
68  int get_index_by_model_index(const QModelIndex& idx) const override;
69  QModelIndex get_model_index_by_index(int idx) const override;
70 };
71 
72 #endif // FILELISTVIEW_H
Definition: FileListModel.h:31
Definition: FileListView.h:31
Definition: MetaDataList.h:39
The Dragable class.
Definition: Dragable.h:37
Definition: SearchableView.h:77
Context menu used for Library and playlist windows.
Definition: LibraryContextMenu.h:35