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 
65  protected:
66  void fill() override;
67  void init_context_menu() override;
68 
69  void language_changed() override;
70  void wheelEvent(QWheelEvent* e) override;
71  void resizeEvent(QResizeEvent* e) override;
72  void hideEvent(QHideEvent* e) override;
73 
74  int sizeHintForColumn(int) const override;
75 
76  private:
77  void resize_sections();
78 
79  // Library::ItemView
80  void play_clicked() override;
81  void play_new_tab_clicked() override;
82  void play_next_clicked() override;
83  void append_clicked() override;
84  void selection_changed(const IndexSet& indexes) override;
85  void refresh_clicked() override;
86  void run_merge_operation(const MergeData& mergedata) override;
87  };
88 }
89 
90 #endif // COVERVIEW_H
Definition: ItemView.h:66
Definition: ActionPair.h:30
Definition: AbstractLibrary.h:47
Definition: LocalLibrary.h:35
Definition: typedefs.h:28
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31
Definition: CoverView.h:36
Definition: ItemView.h:56
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: AbstractPlaylist.h:38
Definition: org_mpris_media_player2_adaptor.h:20