Sayonara Player
PlaylistView.h
1 /* PlaylistView.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 /*
23  * PlaylistView.h
24  *
25  * Created on: Jun 27, 2011
26  * Author: Michael Lugmair (Lucio Carreras)
27  */
28 
29 #ifndef PLAYLISTVIEW_H_
30 #define PLAYLISTVIEW_H_
31 
32 #include "Gui/Utils/SearchableWidget/SearchableView.h"
33 #include "Gui/Utils/Widgets/Dragable.h"
34 #include "Gui/Utils/Widgets/WidgetTemplate.h"
35 
36 #include "Gui/InfoDialog/InfoDialogContainer.h"
37 
38 #include "Utils/Playlist/PlaylistFwd.h"
39 #include "Utils/MetaData/MetaDataFwd.h"
40 #include "Utils/Pimpl.h"
41 
42 class QPoint;
44 class PlaylistCreator;
45 
46 namespace Playlist
47 {
52  class View :
53  public SearchableTableView,
54  public InfoDialogContainer,
55  private Gui::Dragable
56  {
57  Q_OBJECT
58  PIMPL(View)
59 
60  public:
61  View(PlaylistCreator* playlistCreator, PlaylistPtr playlist, DynamicPlaybackChecker* dynamicPlaybackChecker, QWidget* parent=nullptr);
62  ~View() override;
63 
64  void dropEventFromOutside(QDropEvent* event);
65  void removeSelectedRows();
66 
67  public slots:
68  void gotoRow(int row);
69 
70  protected:
71  MD::Interpretation metadataInterpretation() const override;
72  MetaDataList infoDialogData() const override;
73  QWidget* getParentWidget() override;
74 
75  int mapModelIndexToIndex(const QModelIndex& idx) const override;
76  ModelIndexRange mapIndexToModelIndexes(int idx) const override;
77 
78  void skinChanged() override;
79 
84  void dragLeaveEvent(QDragLeaveEvent* event) override;
85  void dragEnterEvent(QDragEnterEvent* event) override;
86  void dragMoveEvent(QDragMoveEvent* event) override;
87  void dropEvent(QDropEvent* event) override;
88  void mousePressEvent(QMouseEvent* event) override;
89  void mouseDoubleClickEvent(QMouseEvent* event) override;
90  void keyPressEvent(QKeyEvent* event) override;
91  bool viewportEvent(QEvent* event) override;
92  void contextMenuEvent(QContextMenuEvent* e) override;
93 
94  private slots:
95  void clear();
96  void refresh();
97  void asyncDropFinished();
98  void ratingChanged(Rating rating);
99  void columnsChanged();
100  void showRatingChanged();
101  void findTrackTriggered();
102  void bookmarkTriggered(Seconds timestamp);
103  void moveSelectedRowsUp();
104  void moveSelectedRowsDown();
105  void playSelectedTrack();
106  void jumpToCurrentTrack();
107  void playlistBusyChanged(bool isBusy);
108  void currentScannedFileChanged(const QString& currentFile);
109  void currentTrackChanged(int index);
110  void deleteSelectedTracks();
111 
112  private:
113  void initContextMenu();
114  void initShortcuts();
115  void handleDrop(QDropEvent* event);
116  };
117 }
118 
119 #endif /* PlaylistView_H_ */
Definition: DynamicPlayback.h:24
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
The MetaDataList class.
Definition: MetaDataList.h:37
Definition: PlaylistInterface.h:56
The PlaylistView class.
Definition: PlaylistView.h:56
void dragLeaveEvent(QDragLeaveEvent *event) override
we start the drag action, all lines has to be cleared
MetaDataList infoDialogData() const override
get the metadata that should be used for the info dialog So for lists, the selected tracks are used h...
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:33