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