Sayonara Player
LibraryViewAlbum.h
1 /* LibraryViewAlbum.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 #ifndef LIBRARYVIEWALBUM_H
22 #define LIBRARYVIEWALBUM_H
23 
24 #include "Helper/MetaData/Album.h"
25 #include "GUI/Library/Views/LibraryTableView.h"
26 #include <QList>
27 #include <QModelIndex>
28 
29 class DiscPopupMenu;
31 {
32  Q_OBJECT
33  PIMPL(LibraryViewAlbum)
34 
35 signals:
36  void sig_disc_pressed(int);
37 
38 protected slots:
39  void index_clicked(const QModelIndex& idx);
40 
41 public:
42  explicit LibraryViewAlbum(QWidget *parent=nullptr);
43  virtual ~LibraryViewAlbum();
44 
45 private:
46  void clear_discnumbers();
47  void add_discnumbers(const QList<quint8>& dns);
48  void calc_discmenu_point(QModelIndex idx);
49  void delete_discmenu();
50  void init_discmenu(QModelIndex idx);
51  void show_discmenu();
52  void rc_menu_show(const QPoint& p);
53 
54 public:
55  template <typename T, typename ModelType>
56  void fill(const T& input_data)
57  {
58  clear_discnumbers();
59 
60  for(const Album& album : input_data){
61  add_discnumbers(album.discnumbers);
62  }
63 
64  LibraryView::fill<T, ModelType>(input_data);
65  }
66 };
67 
68 
69 #endif // LIBRARYVIEWALBUM_H
Definition: LibraryTableView.h:31
Definition: DiscPopupMenu.h:44
Definition: LibraryViewAlbum.h:30
The Album class.
Definition: Album.h:38