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