Sayonara Player
ItemView.h
1/* View.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/*
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 "Gui/Utils/Widgets/Dragable.h"
32#include "Gui/Utils/SearchableWidget/SearchableView.h"
33
34#include "Gui/InfoDialog/InfoDialogContainer.h"
35#include "Gui/Utils/ContextMenu/LibraryContextMenu.h"
36
37#include "Utils/SetFwd.h"
38#include "Utils/Pimpl.h"
39
40class AbstractLibrary;
41
42namespace Library
43{
44 class MergeData;
45 class ItemModel;
46
53 class ItemView :
56 protected Gui::Dragable
57 {
58 Q_OBJECT
59 PIMPL(ItemView)
60
61 signals:
62 void sigDeleteClicked();
63 void sigPlayClicked();
64 void sigPlayNextClicked();
65 void sigPlayNewTabClicked();
66 void sigAppendClicked();
67 void sigRefreshClicked();
68 void sigReloadClicked();
69 void sigImportFiles(const QStringList& files);
70 void sigSelectionChanged(const IndexSet& indexes);
71
72 private:
73 ItemView(const ItemView& other) = delete;
74 ItemView& operator=(const ItemView& other) = delete;
75
76 void showContextMenuActions(Library::ContextMenu::Entries entries);
77
78 using SearchableTableView::setSearchableModel;
79
80 public:
81 explicit ItemView(QWidget* parent = nullptr);
82 virtual ~ItemView() override;
83
84 void setItemModel(ItemModel* model);
85
86 void showClearButton(bool visible);
87 void useClearButton(bool yesno);
88
89 virtual Library::ContextMenu::Entries contextMenuEntries() const;
90
92 bool isValidDragPosition(const QPoint& p) const override;
93
94 protected:
95 // Events implemented in LibraryViewEvents.cpp
96 virtual void mousePressEvent(QMouseEvent* event) override;
97 virtual void contextMenuEvent(QContextMenuEvent* event) override;
98 virtual void dragEnterEvent(QDragEnterEvent* event) override;
99 virtual void dragMoveEvent(QDragMoveEvent* event) override;
100 virtual void dropEvent(QDropEvent* event) override;
101 virtual void resizeEvent(QResizeEvent* event) override;
102
103 virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected) override;
104
105 Library::ContextMenu* contextMenu() const;
106 virtual void initContextMenu();
107 virtual void initCustomContextMenu(Library::ContextMenu* menu);
108
109 ItemModel* itemModel() const;
110 virtual AbstractLibrary* library() const;
111
118 virtual bool isMergeable() const = 0;
119
120 MetaDataList infoDialogData() const override;
121 QWidget* getParentWidget() override;
122
123 virtual void selectedItemsChanged(const IndexSet& indexes);
124 virtual void importRequested(const QStringList& files);
125
126 virtual void runMergeOperation(const Library::MergeData& md);
127
128 int viewportHeight() const override;
129
130 protected slots:
131 virtual void showContextMenu(const QPoint&);
132 virtual void mergeActionTriggered();
133 virtual void playClicked();
134 virtual void playNewTabClicked();
135 virtual void playNextClicked();
136 virtual void deleteClicked();
137 virtual void appendClicked();
138 virtual void refreshClicked();
139 virtual void reloadClicked();
140 virtual void albumArtistsToggled();
141 virtual void filterExtensionsTriggered(const QString& extension, bool b);
142 virtual void fill();
143 };
144}
145
146#endif /* ITEM_VIEW_H_ */
Definition: AbstractLibrary.h:44
The Dragable class.
Definition: Dragable.h:61
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:87
An interface used to abstract the usage of the info dialog. An implementing class has to return the i...
Definition: InfoDialogContainer.h:64
Definition: LibraryContextMenu.h:40
The ItemModel is intended to abstract the various views. It supports searching, selections and a libr...
Definition: ItemModel.h:43
The main task of the ItemView is to display a context menu for various selections....
Definition: ItemView.h:57
bool isValidDragPosition(const QPoint &p) const override
MetaDataList infoDialogData() const override
get the metadata that should be used for the info dialog So for lists, the selected tracks are used h...
virtual bool isMergeable() const =0
indicates if multiple ids can be merged into one. For example if the same artist is written in three ...
Definition: MergeData.h:33
The MetaDataList class.
Definition: MetaDataList.h:39
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:37
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31