Sayonara Player
CoverView.h
1 /* CoverView.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 #ifndef COVERVIEW_H
22 #define COVERVIEW_H
23 
24 #include "Gui/Library/ItemView.h"
25 #include "Gui/Library/Header/ActionPair.h"
26 #include "Utils/Library/Sortorder.h"
27 
28 class LocalLibrary;
29 class QAction;
30 
31 namespace Library
32 {
33  class MergeData;
34  class ActionPair;
35 
40  class CoverView :
41  public ItemView
42  {
43  Q_OBJECT
44  PIMPL(CoverView)
45 
46  public:
47  explicit CoverView(QWidget* parent = nullptr);
48  ~CoverView() override;
49 
50  void init(LocalLibrary* library);
51  AbstractLibrary* library() const override;
52 
53  // QAbstractItemView
54  QStyleOptionViewItem viewOptions() const override;
55 
56  //SayonaraSelectionView
57  int mapModelIndexToIndex(const QModelIndex& idx) const override;
58  ModelIndexRange mapIndexToModelIndexes(int idx) const override;
59  SelectionViewInterface::SelectionType selectionType() const override;
60 
61  void changeZoom(int zoom = -1);
62  void changeSortorder(SortOrder so);
63 
64  static QList<ActionPair> sortingActions();
65  static QStringList zoomActions();
66 
67  public slots:
68  void reload();
69  void clearCache();
70 
71  protected:
72  void fill() override;
73  void initContextMenu() override;
74 
75  void languageChanged() override;
76 
77  // ItemView
78  bool isMergeable() const override;
79  MD::Interpretation metadataInterpretation() const override;
80 
81  int sizeHintForColumn(int) const override;
82 
83  void wheelEvent(QWheelEvent* e) override;
84  void resizeEvent(QResizeEvent* e) override;
85  void hideEvent(QHideEvent* e) override;
86 
87  private:
88  void resizeSections();
89 
90  // Library::ItemView
91  void playClicked() override;
92  void playNewTabClicked() override;
93  void playNextClicked() override;
94  void appendClicked() override;
95  void selectedItemsChanged(const IndexSet& indexes) override;
96  void refreshClicked() override;
97  void runMergeOperation(const Library::MergeData& mergedata) override;
98  };
99 }
100 
101 #endif // COVERVIEW_H
QPair
Definition: typedefs.h:32
Library::ItemView
The main task of the ItemView is to display a context menu for various selections....
Definition: ItemView.h:57
Util::Set
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:37
QList
Definition: EngineUtils.h:33
Library::CoverView::isMergeable
bool isMergeable() const override
indicates if multiple ids can be merged into one. For example if the same artist is written in three ...
Library::CoverView::metadataInterpretation
MD::Interpretation metadataInterpretation() const override
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
AbstractLibrary
Definition: AbstractLibrary.h:43
Library::MergeData
Changes all metadata containing one of the source ids and replaces it with the target id....
Definition: MergeData.h:39
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31
LocalLibrary
Definition: LocalLibrary.h:37
Library::CoverView
The CoverView class.
Definition: CoverView.h:42
Library::SortOrder
SortOrder
The SortOrder enum.
Definition: Sortorder.h:32