Sayonara Player
CoverView.h
1 /* CoverView.h */
2 
3 /* Copyright (C) 2011-2019 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 index_by_model_index(const QModelIndex& idx) const override;
58  ModelIndexRange model_indexrange_by_index(int idx) const override;
59 
60  void change_zoom(int zoom=-1);
61  void change_sortorder(SortOrder so);
62 
63  static QList<ActionPair> sorting_actions();
64  static QStringList zoom_actions();
65 
66  public slots:
67  void reload();
68  void clear_cache();
69 
70  protected:
71  void fill() override;
72  void init_context_menu() override;
73 
74  void language_changed() override;
75  void wheelEvent(QWheelEvent* e) override;
76  void resizeEvent(QResizeEvent* e) override;
77  void hideEvent(QHideEvent* e) override;
78 
79  // ItemView
80  bool is_mergeable() const override;
81  MD::Interpretation metadata_interpretation() const override;
82 
83  int sizeHintForColumn(int) const override;
84 
85  private:
86  void resize_sections();
87 
88  // Library::ItemView
89  void play_clicked() override;
90  void play_new_tab_clicked() override;
91  void play_next_clicked() override;
92  void append_clicked() override;
93  void selection_changed(const IndexSet& indexes) override;
94  void refresh_clicked() override;
95  void run_merge_operation(const Library::MergeData& mergedata) override;
96  };
97 }
98 
99 #endif // COVERVIEW_H
SortOrder
The SortOrder enum.
Definition: Sortorder.h:31
Changes all metadata containing one of the source ids and replaces it with the target id...
Definition: MergeData.h:38
Definition: AbstractLibrary.h:41
Definition: LocalLibrary.h:35
MD::Interpretation metadata_interpretation() const override
get the interpretation for the metadata. Maybe a list of metadata should be intrepeted as albums whil...
Definition: typedefs.h:32
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:35
bool is_mergeable() const override
indicates if multiple ids can be merged into one. For example if the same artist is written in three ...
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32
The CoverView class.
Definition: CoverView.h:40
The main task of the ItemView is to display a context menu for various selections. It also handles drag and drop events with a cover. It supports merging and imports.
Definition: ItemView.h:54
Definition: EngineUtils.h:33