Sayonara Player
Album.h
1 /* Album.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 _ALBUM_H_
22 #define _ALBUM_H_
23 
24 #include "Utils/MetaData/LibraryItem.h"
25 #include "Utils/Library/Sortorder.h"
26 #include <QMetaType>
27 
28 class QVariant;
29 class QStringList;
30 class Album;
31 
32 Q_DECLARE_METATYPE(Album)
33 
34 
38 class Album :
39  public LibraryItem
40 {
41  PIMPL(Album)
42 
43 public:
44  QList<Disc> discnumbers;
45 
46  AlbumId id;
47  uint32_t length_sec;
48  uint16_t num_songs;
49  uint16_t year;
50 
51  Disc n_discs;
52  Rating rating;
53  bool is_sampler;
54 
55 
56 public:
57  Album();
58  Album(const Album& other);
59  Album(Album&& other);
60 
61  Album& operator=(const Album& other);
62  Album& operator=(Album&& other);
63 
64  ~Album();
65 
66  const QString& name() const;
67  void set_name(const QString& name);
68 
69  QStringList artists() const;
70  void set_artists(const QStringList& artists);
71 
72  QStringList album_artists() const;
73  void set_album_artists(const QStringList& album_artists);
74 
75  static QVariant toVariant(const Album& album);
76  static bool fromVariant(const QVariant& v, Album& album);
77  QString to_string() const;
78 };
79 
80 
85 class AlbumList : public std::vector<Album>
86 {
87 public:
88  bool contains(AlbumId album_id) const;
89 
90  int count() const;
91  AlbumList& operator <<(const Album& album);
92  Album first() const;
93 
94  void sort(Library::SortOrder so);
95 };
96 
97 #endif
98 
99 
The LibraryItem class.
Definition: LibraryItem.h:65
The AlbumList class.
Definition: Album.h:85
The Album class.
Definition: Album.h:38