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