Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Gui
Library
ItemView.h
1
/* View.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
/*
22
* MyListView.h
23
*
24
* Created on: Jun 26, 2011
25
* Author: Michael Lugmair (Lucio Carreras)
26
*/
27
28
#ifndef ITEM_VIEW_H_
29
#define ITEM_VIEW_H_
30
31
#include "Components/Library/PlayActionEventHandler.h"
32
33
#include "Gui/Utils/Widgets/Dragable.h"
34
#include "Gui/Utils/SearchableWidget/SearchableView.h"
35
#include "Gui/Utils/SearchableWidget/SelectionView.h"
36
37
#include "Gui/InfoDialog/InfoDialogContainer.h"
38
#include "Gui/Utils/ContextMenu/LibraryContextMenu.h"
39
40
#include "Utils/SetFwd.h"
41
#include "Utils/Pimpl.h"
42
43
class
AbstractLibrary
;
44
45
namespace
Library
46
{
47
class
MergeData
;
48
class
ItemModel
;
49
class
PlayActionEventHandler
;
50
51
class
ItemView :
52
public
SearchableTableView,
53
public
InfoDialogContainer,
54
protected
Gui::Dragable
55
{
56
Q_OBJECT
57
PIMPL(ItemView)
58
59
signals:
60
void
sigDeleteClicked();
61
void
sigPlayClicked();
62
void
sigPlayNextClicked();
63
void
sigPlayNewTabClicked();
64
void
sigAppendClicked();
65
void
sigReloadClicked();
66
void
sigImportFiles(
const
QStringList& files);
67
void
sigSelectionChanged(
const
IndexSet& indexes);
68
69
public
:
70
explicit
ItemView(QWidget* parent =
nullptr
);
71
~ItemView()
override
;
72
73
ItemView(
const
ItemView& other) =
delete
;
74
ItemView& operator=(
const
ItemView& other) =
delete
;
75
76
void
showClearButton(
bool
visible);
77
void
useClearButton(
bool
yesno);
78
79
[[nodiscard]]
virtual
Library::ContextMenu::Entries contextMenuEntries()
const
;
80
81
[[nodiscard]]
bool
isValidDragPosition(
const
QPoint& p)
const override
;
82
83
protected
:
84
void
init(
const
std::shared_ptr<PlayActionEventHandler>& playActionEventHandler);
85
void
selectionChanged(
const
QItemSelection& selected,
const
QItemSelection& deselected)
override
;
86
87
[[nodiscard]]
Library::ContextMenu
* contextMenu()
const
;
88
virtual
void
initContextMenu();
89
virtual
void
initCustomContextMenu(
Library::ContextMenu
* menu);
90
91
[[nodiscard]]
SearchModel
* searchModel()
const override
;
92
[[nodiscard]]
virtual
ItemModel
* itemModel()
const
= 0;
93
[[nodiscard]]
virtual
AbstractLibrary
* library()
const
;
94
95
[[nodiscard]]
virtual
bool
isMergeable()
const
= 0;
96
97
[[nodiscard]]
MetaDataList
infoDialogData()
const override
;
98
QWidget* getParentWidget()
override
;
99
100
virtual
void
importRequested(
const
QStringList& files);
101
102
virtual
void
runMergeOperation(
const
Library::MergeData
& mergeData);
103
virtual
void
triggerSelectionChange(
const
IndexSet& indexes) = 0;
104
[[nodiscard]]
virtual
PlayActionEventHandler::TrackSet trackSet()
const
= 0;
105
106
[[nodiscard]] QRect viewportGeometry()
const override
;
107
virtual
void
refreshView() = 0;
108
109
void
mousePressEvent(QMouseEvent* event)
override
;
110
void
contextMenuEvent(QContextMenuEvent* event)
override
;
111
void
dragEnterEvent(QDragEnterEvent* event)
override
;
112
void
dragMoveEvent(QDragMoveEvent* event)
override
;
113
void
dropEvent(QDropEvent* event)
override
;
114
void
resizeEvent(QResizeEvent* event)
override
;
115
116
protected
slots:
// NOLINT(*-redundant-access-specifiers)
117
virtual
void
showContextMenu(
const
QPoint&);
118
virtual
void
mergeActionTriggered();
119
virtual
void
playClicked();
120
virtual
void
playNewTabClicked();
121
virtual
void
playNextClicked();
122
virtual
void
deleteClicked();
123
virtual
void
appendClicked();
124
virtual
void
refreshClicked();
125
virtual
void
reloadClicked();
126
virtual
void
albumArtistsToggled();
127
virtual
void
filterExtensionsTriggered(
const
QString& extension,
bool
b);
128
virtual
void
fill();
129
130
private
slots:
131
void
selectedItemsChanged(
const
IndexSet& indexes);
132
133
private
:
// NOLINT(*-redundant-access-specifiers)
134
void
showContextMenuActions(Library::ContextMenu::Entries entries);
135
};
136
}
137
138
#endif
/* ITEM_VIEW_H_ */
AbstractLibrary
Definition
AbstractLibrary.h:41
Gui::Dragable
The Dragable class.
Definition
Dragable.h:62
Library::ContextMenu
Definition
LibraryContextMenu.h:40
Library::ItemModel
Definition
ItemModel.h:40
Library::MergeData
Definition
MergeData.h:33
Library::PlayActionEventHandler
Definition
PlayActionEventHandler.h:31
MetaDataList
Definition
MetaDataList.h:34
SearchModel
Definition
SearchableModel.h:32
Generated on
for Sayonara Player by
1.17.0