Sayonara Player
Loading...
Searching...
No Matches
FileListView.h
1/* FileListView.h */
2
3/* Copyright (C) 2011-2024 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/SearchableWidget/SelectionView.h"
27#include "Gui/Utils/Widgets/Dragable.h"
28
29#include "Utils/Pimpl.h"
30
31namespace Library
32{
33 class Info;
34 class InfoAccessor;
35}
36
37namespace Directory
38{
39 class FileListModel;
40
44 private Gui::Dragable
45 {
46 Q_OBJECT
47 PIMPL(FileListView)
48
49 signals:
50 void sigDeleteClicked();
51 void sigPlayClicked();
52 void sigPlayNewTabClicked();
53 void sigPlayNextClicked();
54 void sigAppendClicked();
55 void sigEnterPressed();
56 void sigImportRequested(LibraryId lib_id, const QStringList& files, const QString& targetDirectory);
57 void sigRenameRequested(const QString& old_name, const QString& newName);
58 void sigRenameByExpressionRequested(const QString& oldName, const QString& expression);
59 void sigCopyToLibraryRequested(LibraryId libraryId);
60 void sigMoveToLibraryRequested(LibraryId libraryId);
61
62 public:
63 explicit FileListView(QWidget* parent = nullptr);
64 ~FileListView() override;
65
66 void init(Library::InfoAccessor* libraryInfoAccessor, const Library::Info& info);
67
68 [[nodiscard]] QStringList selectedPaths() const;
69
70 void setParentDirectory(const QString& dir);
71 [[nodiscard]] QString parentDirectory() const;
72 [[nodiscard]] SearchModel* searchModel() const override;
73
74 protected:
75 void contextMenuEvent(QContextMenuEvent* event) override;
76
77 void dragEnterEvent(QDragEnterEvent* event) override;
78 void dragMoveEvent(QDragMoveEvent* event) override;
79 void dropEvent(QDropEvent* event) override;
80
81 void skinChanged() override;
82
83 // SayonaraSelectionView
84 [[nodiscard]] int mapModelIndexToIndex(const QModelIndex& idx) const override;
85
86 // InfoDialogContainer interface
87 [[nodiscard]] MD::Interpretation metadataInterpretation() const override;
88 [[nodiscard]] MetaDataList infoDialogData() const override;
89 [[nodiscard]] bool hasMetadata() const override;
90 [[nodiscard]] QStringList pathlist() const override;
91 QWidget* getParentWidget() override;
92 ModelIndexRange mapIndexToModelIndexes(int idx) const override;
93
94 private:
95 void initContextMenu();
96
97 private slots:
98 void renameFileClicked();
99 void renameFileByTagClicked();
100 };
101}
102
103#endif // FILELISTVIEW_H
Definition FileListView.h:45
The Dragable class.
Definition Dragable.h:62
Definition InfoDialogContainer.h:61
Definition LibraryManager.h:36
The Info class.
Definition LibraryInfo.h:38
Definition MetaDataList.h:34
Definition SearchableModel.h:32
Definition SearchableView.h:70
Definition typedefs.h:33