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/Utils/SearchableWidget/SearchableView.h"
25 #include "GUI/Utils/Widgets/Dragable.h"
26 #include "GUI/Utils/Widgets/WidgetTemplate.h"
27 
28 #include "Utils/Pimpl.h"
29 
30 class FileListModel;
31 class MetaDataList;
32 class LibraryContextMenu;
33 
34 class FileListView :
35  public Gui::WidgetTemplate<SearchableListView>,
36  private Dragable
37 {
38  Q_OBJECT
39  PIMPL(FileListView)
40 
41 signals:
42  void sig_info_clicked();
43  void sig_edit_clicked();
44  void sig_lyrics_clicked();
45  void sig_delete_clicked();
46  void sig_play_clicked();
47  void sig_play_new_tab_clicked();
48  void sig_play_next_clicked();
49  void sig_append_clicked();
50  void sig_enter_pressed();
51  void sig_import_requested(LibraryId lib_id, const QStringList& files, const QString& target_dir);
52 
53 public:
54  explicit FileListView(QWidget* parent=nullptr);
55  virtual ~FileListView();
56 
57  QModelIndexList selected_rows() const;
58  MetaDataList selected_metadata() const;
59 
60  QStringList selected_paths() const;
61 
62  void set_parent_directory(LibraryId id, const QString& dir);
63  QString parent_directory() const;
64 
65  void set_search_filter(const QString& search_string);
66 
67  QMimeData* dragable_mimedata() const override;
68 
69 
70 protected:
71  void keyPressEvent(QKeyEvent* event) override;
72  void mousePressEvent(QMouseEvent* event) override;
73  void mouseMoveEvent(QMouseEvent* event) override;
74 
75  void dragEnterEvent(QDragEnterEvent* event) override;
76  void dragMoveEvent(QDragMoveEvent* event) override;
77  void dropEvent(QDropEvent* event) override;
78 
79  void language_changed() override;
80  void skin_changed() override;
81 
82 
83  // SayonaraSelectionView
84  int index_by_model_index(const QModelIndex& idx) const override;
85  QModelIndex model_index_by_index(int idx) const override;
86 
87 private:
88  void init_context_menu();
89 
90 private slots:
91  void rename_file_clicked();
92 
93 };
94 
95 #endif // FILELISTVIEW_H
Definition: FileListModel.h:32
Definition: FileListView.h:34
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings...
Definition: WidgetTemplate.h:47
The MetaDataList class.
Definition: MetaDataList.h:38
The Dragable class.
Definition: Dragable.h:37
Context menu used for Library and playlist windows.
Definition: LibraryContextMenu.h:37