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