Sayonara Player
FileListView.h
1 /* FileListView.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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/InfoDialog/InfoDialogContainer.h"
25 #include "Gui/Utils/SearchableWidget/SearchableView.h"
26 #include "Gui/Utils/Widgets/Dragable.h"
27 
28 #include "Utils/Pimpl.h"
29 
30 namespace Directory
31 {
32  class FileListModel;
37  class FileListView :
38  public SearchableTableView,
39  public InfoDialogContainer,
40  private Gui::Dragable
41  {
42  Q_OBJECT
43  PIMPL(FileListView)
44 
45  signals:
46  void sigDeleteClicked();
47  void sigPlayClicked();
48  void sigPlayNewTabClicked();
49  void sigPlayNextClicked();
50  void sigAppendClicked();
51  void sigEnterPressed();
52  void sigImportRequested(LibraryId lib_id, const QStringList& files, const QString& targetDirectory);
53 
54  void sigRenameRequested(const QString& old_name, const QString& newName);
55  void sigRenameByExpressionRequested(const QString& oldName, const QString& expression);
56 
57  void sigCopyToLibraryRequested(LibraryId libraryId);
58  void sigMoveToLibraryRequested(LibraryId libraryId);
59 
60  public:
61  explicit FileListView(QWidget* parent=nullptr);
62  ~FileListView() override;
63 
64  QModelIndexList selectedRows() const;
65  QStringList selectedPaths() const;
66 
67  void setParentDirectory(LibraryId id, const QString& dir);
68  QString parentDirectory() const;
69 
70  void setSearchFilter(const QString& search_string);
71 
72  QMimeData* dragableMimedata() const override;
73 
74  private:
75  void initContextMenu();
76 
77  private slots:
78  void renameFileClicked();
79  void renameFileByTagClicked();
80 
81  protected:
82  void contextMenuEvent(QContextMenuEvent* event) override;
83 
84  void dragEnterEvent(QDragEnterEvent* event) override;
85  void dragMoveEvent(QDragMoveEvent* event) override;
86  void dropEvent(QDropEvent* event) override;
87 
88  void languageChanged() override;
89  void skinChanged() override;
90 
91  // SayonaraSelectionView
92  int mapModelIndexToIndex(const QModelIndex& idx) const override;
93  ModelIndexRange mapIndexToModelIndexes(int idx) const override;
94 
95  // InfoDialogContainer interface
96  MD::Interpretation metadataInterpretation() const override;
97  MetaDataList infoDialogData() const override;
98  bool hasMetadata() const override;
99  QStringList pathlist() const override;
100  };
101 }
102 
103 #endif // FILELISTVIEW_H
An interface used to abstract the usage of the info dialog. An implementing class has to return the i...
Definition: InfoDialogContainer.h:61
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:84
The MetaDataList class.
Definition: MetaDataList.h:35
The FileListView class.
Definition: FileListView.h:37
MD::Interpretation metadataInterpretation() const override
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
Definition: typedefs.h:32
bool hasMetadata() const override
returns, if the widget can provide metadata instantly If false, the info dialog will the pathlist
MetaDataList infoDialogData() const override
get the metadata that should be used for the info dialog So for lists, the selected tracks are used h...
The Dragable class.
Definition: Dragable.h:60
QStringList pathlist() const override
Returns a list of paths. This is only used if has_metadata() returns false.