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;
43 
44 namespace Playlist
45 {
50  class View :
51  public SearchableTableView,
52  public InfoDialogContainer,
53  private Gui::Dragable
54  {
55  Q_OBJECT
56  PIMPL(View)
57 
58  signals:
59  void sigDoubleClicked(int row);
60  void sigDeleteTracks(const IndexSet& rows);
61  void sigBookmarkPressed(int trackIdx, Seconds timestamp);
62 
63  public:
64  explicit View(PlaylistPtr playlist, QWidget* parent=nullptr);
65  ~View() override;
66 
67  void gotoRow(int row);
68  void deleteSelectedTracks();
69 
75  void dropEventFromOutside(QDropEvent* event);
76 
77  public slots:
78  void clear();
79  void removeSelectedRows();
80 
81  private slots:
82  void refresh();
83  void currentTrackChanged(int trackIndex, int playlistIndex);
84  void asyncDropFinished();
85  void ratingChanged(Rating rating);
86  void columnsChanged();
87  void showRatingChanged();
88  void findTrackTriggered();
89  void bookmarkTriggered(Seconds timestamp);
90  void moveSelectedRowsUp();
91  void moveSelectedRowsDown();
92  void playSelectedTrack();
93  void gotoToCurrentTrack();
94  void playlistBusyChanged(bool b);
95  void currentScannedFileChanged(const QString& currentFile);
96 
97  private:
98  void initContextMenu();
99 
100  // d & d
101  void handleDrop(QDropEvent* event);
102 
103  protected:
104  MD::Interpretation metadataInterpretation() const override;
105  MetaDataList infoDialogData() const override;
106  QMimeData* dragableMimedata() const override;
107  int mapModelIndexToIndex(const QModelIndex& idx) const override;
108  ModelIndexRange mapIndexToModelIndexes(int idx) const override;
109 
110  void skinChanged() override;
111 
116  void dragLeaveEvent(QDragLeaveEvent* event) override;
117  void dragEnterEvent(QDragEnterEvent* event) override;
118  void dragMoveEvent(QDragMoveEvent* event) override;
119  void dropEvent(QDropEvent* event) override;
120  void mousePressEvent(QMouseEvent* event) override;
121  void mouseDoubleClickEvent(QMouseEvent* event) override;
122  void keyPressEvent(QKeyEvent* event) override;
123  bool viewportEvent(QEvent* event) override;
124  void contextMenuEvent(QContextMenuEvent* e) override;
125  };
126 }
127 
128 #endif /* PlaylistView_H_ */
QPair
Definition: typedefs.h:32
Playlist::View::metadataInterpretation
MD::Interpretation metadataInterpretation() const override
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
Util::Set
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:37
Playlist::View
The PlaylistView class.
Definition: PlaylistView.h:54
Gui::WidgetTemplate
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:87
Playlist::View::dropEventFromOutside
void dropEventFromOutside(QDropEvent *event)
called from GUI_Playlist when data has not been dropped directly into the view widget....
Playlist::View::dragLeaveEvent
void dragLeaveEvent(QDragLeaveEvent *event) override
we start the drag action, all lines has to be cleared
InfoDialogContainer
An interface used to abstract the usage of the info dialog. An implementing class has to return the i...
Definition: InfoDialogContainer.h:64
Gui::Dragable
The Dragable class.
Definition: Dragable.h:61
Playlist::View::infoDialogData
MetaDataList infoDialogData() const override
get the metadata that should be used for the info dialog So for lists, the selected tracks are used h...