Sayonara Player
CoverView.h
1 /* CoverView.h */
2 
3 /* Copyright (C) 2011-2017 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 #ifndef COVERVIEW_H
24 #define COVERVIEW_H
25 
26 #include "GUI/Library/ItemView.h"
27 #include "GUI/Library/Utils/ActionPair.h"
28 #include "Utils/Library/Sortorder.h"
29 
30 class LocalLibrary;
31 struct ActionPair;
32 class QAction;
33 
34 namespace Library
35 {
36  class CoverView :
37  public ItemView
38  {
39  Q_OBJECT
40  PIMPL(CoverView)
41 
42  public:
43  explicit CoverView(QWidget* parent=nullptr);
44  virtual ~CoverView();
45 
46  void init(LocalLibrary* library);
47  AbstractLibrary* library() const override;
48 
49  // QAbstractItemView
50  QStyleOptionViewItem viewOptions() const override;
51 
52  //SayonaraSelectionView
53  int index_by_model_index(const QModelIndex& idx) const override;
54  ModelIndexRange model_indexrange_by_index(int idx) const override;
55 
56  void change_zoom(int zoom=-1);
57  void change_sortorder(SortOrder so);
58 
59  static QList<ActionPair> sorting_actions();
60  static QStringList zoom_actions();
61 
62  public slots:
63  void reload();
64  void clear_cache();
65 
66  protected:
67  void fill() override;
68  void init_context_menu() override;
69 
70  void language_changed() override;
71  void wheelEvent(QWheelEvent* e) override;
72  void resizeEvent(QResizeEvent* e) override;
73  void hideEvent(QHideEvent* e) override;
74 
75  int sizeHintForColumn(int) const override;
76 
77  private:
78  void resize_sections();
79 
80  // Library::ItemView
81  void play_clicked() override;
82  void play_new_tab_clicked() override;
83  void play_next_clicked() override;
84  void append_clicked() override;
85  void selection_changed(const IndexSet& indexes) override;
86  void refresh_clicked() override;
87  void run_merge_operation(const MergeData& mergedata) override;
88  };
89 }
90 
91 #endif // COVERVIEW_H
Definition: ActionPair.h:30
Definition: AbstractLibrary.h:39
Definition: LocalLibrary.h:35
Definition: typedefs.h:31
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:35
Definition: ItemView.h:61
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:29
Definition: CoverView.h:36
Definition: ItemView.h:51
Definition: org_mpris_media_player2_adaptor.h:20