Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Library
DirectoryView
DirectoryTreeView.h
1
/* DirectoryTreeView.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 DIRECTORYTREEVIEW_H
22
#define DIRECTORYTREEVIEW_H
23
24
#include "DirectoryModel.h"
25
#include "Gui/InfoDialog/InfoDialogContainer.h"
26
27
#include "Gui/Utils/SearchableWidget/SearchableView.h"
28
#include "Gui/Utils/Widgets/WidgetTemplate.h"
29
#include "Gui/Utils/Widgets/Dragable.h"
30
#include "Utils/Pimpl.h"
31
32
#include <QTreeView>
33
#include <QModelIndexList>
34
#include <QTreeView>
35
36
class
Model;
37
class
IconProvider;
38
39
namespace
Gui
40
{
41
class
LibraryContextMenu;
42
class
CustomMimeData
;
43
}
44
45
namespace
Library
46
{
47
class
Info
;
48
class
InfoAccessor
;
49
}
50
51
namespace
Directory
52
{
57
class
TreeView :
58
public
Gui::WidgetTemplate
<QTreeView>,
59
public
InfoDialogContainer,
60
protected
Gui::Dragable
61
{
62
Q_OBJECT
63
PIMPL(TreeView)
64
65
using
Parent =
Gui::WidgetTemplate<QTreeView>
;
66
67
signals:
68
void
sigDeleteClicked();
69
void
sigPlayClicked();
70
void
sigPlayNewTabClicked();
71
void
sigPlayNextClicked();
72
void
sigAppendClicked();
73
void
sigDirectoryLoaded(
const
QModelIndex& index);
74
void
sigCurrentIndexChanged(
const
QModelIndex& index);
75
76
void
sigEnterPressed();
77
void
sigImportRequested(LibraryId libraryId,
const
QStringList& tracks,
const
QString& targetDirectory);
78
79
void
sigCopyRequested(
const
QStringList& paths,
const
QString& target);
80
void
sigMoveRequested(
const
QStringList& paths,
const
QString& target);
81
void
sigRenameRequested(
const
QString& path,
const
QString& target);
82
83
void
sigCopyToLibraryRequested(LibraryId libraryId);
84
void
sigMoveToLibraryRequested(LibraryId libraryId);
85
86
public
:
87
explicit
TreeView(QWidget* parent =
nullptr
);
88
~TreeView()
override
;
89
90
void
init(
Library::InfoAccessor
* libraryInfoAccessor,
const
Library::Info
& info);
91
92
QString directoryName(
const
QModelIndex& index);
93
94
QModelIndexList selectedRows()
const
;
95
QStringList selectedPaths()
const
;
96
97
void
setFilterTerm(
const
QString& filter);
98
99
public
slots:
100
void
setBusy(
bool
b);
101
102
private
:
103
enum class
DropAction
104
{
105
Copy,
106
Move,
107
Cancel
108
};
109
110
void
initContextMenu();
111
DropAction showDropMenu(
const
QPoint& pos);
112
void
handleSayonaraDrop(
const
Gui::CustomMimeData
* mimedata,
const
QString& targetDirectory);
113
114
private
slots:
115
void
createDirectoryClicked();
116
void
renameDirectoryClicked();
117
void
viewInFileManagerClicked();
118
void
dragTimerTimeout();
119
120
protected
:
121
void
skinChanged()
override
;
122
123
void
keyPressEvent(QKeyEvent* event)
override
;
124
void
contextMenuEvent(QContextMenuEvent* event)
override
;
125
126
void
dragEnterEvent(QDragEnterEvent* event)
override
;
127
void
dragLeaveEvent(QDragLeaveEvent* event)
override
;
128
void
dragMoveEvent(QDragMoveEvent* event)
override
;
129
void
dropEvent(QDropEvent* event)
override
;
130
131
void
selectionChanged(
const
QItemSelection& selected,
const
QItemSelection& deselected)
override
;
132
133
// InfoDialogContainer interface
134
MD::Interpretation metadataInterpretation()
const override
;
135
MetaDataList
infoDialogData()
const override
;
136
bool
hasMetadata()
const override
;
137
QStringList pathlist()
const override
;
138
QWidget* getParentWidget()
override
;
139
};
140
}
141
142
#endif
// DIRECTORYTREEVIEW_H
Gui::CustomMimeData
Definition
CustomMimeData.h:33
Gui::Dragable
The Dragable class.
Definition
Dragable.h:62
Gui::WidgetTemplate
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition
WidgetTemplate.h:86
Library::InfoAccessor
Definition
LibraryManager.h:36
Library::Info
The Info class.
Definition
LibraryInfo.h:38
MetaDataList
Definition
MetaDataList.h:34
Generated on
for Sayonara Player by
1.17.0