1 /* Album.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 
Q_DECLARE_METATYPE(Album)33 Q_DECLARE_METATYPE(Album)
34 
35 /**
36  * @brief The Album class
37  * @ingroup MetaDataHelper
38  */
39 class Album :
40 		public LibraryItem
41 {
42 	PIMPL(Album)
43 
44 public:
45 	Album();
46 	Album(const Album& other);
47 	Album(Album&& other) noexcept ;
48 
49 	Album& operator=(const Album& other);
50 	Album& operator=(Album&& other) noexcept;
51 	bool operator==(const Album& other) const;
52 
53 	~Album();
54 
55 	AlbumId id() const;
56 	void setId(const AlbumId& id);
57 
58 	QString name() const;
59 	void setName(const QString& name);
60 
61 	QStringList artists() const;
62 	void setArtists(const QStringList& artists);
63 
64 	QString albumArtist() const;
65 	void setAlbumArtist(const QString& albumArtist);
66 
67 	QStringList pathHint() const;
68 	void setPathHint(const QStringList& paths);
69 
70 	Seconds durationSec() const;
71 	void setDurationSec(const Seconds& sec);
72 
73 	TrackNum songcount() const;
74 	void setSongcount(const TrackNum& songs);
75 
76 	Year year() const;
77 	void setYear(const Year& year);
78 
79 	Disc disccount() const;
80 
81 	Rating rating() const;
82 	void setRating(const Rating& rating);
83 
84 	bool isSampler() const;
85 
86 	QList<Disc> discnumbers() const;
87 	void setDiscnumbers(const QList<Disc>& discnumbers);
88 
89 	static QVariant toVariant(const Album& album);
90 	static bool fromVariant(const QVariant& v, Album& album);
91 	QString toString() const;
92 };
93 
94 
95 /**
96  * @brief The AlbumList class
97  * @ingroup MetaDataHelper
98  */
99 class AlbumList : public std::deque<Album>
100 {
101 	using Parent=std::deque<Album>;
102 
103 public:
104 	bool contains(AlbumId albumId) const;
105 
106 	int count() const;
107 	AlbumList& operator <<(const Album& album);
108 	Album first() const;
109 	Album& operator[](int idx);
110 	const Album& operator[](int idx) const;
111 
112 	AlbumList& appendUnique(const AlbumList& other);
113 	AlbumList& appendUnique(AlbumList&& other) noexcept;
114 
115 	void sort(::Library::SortOrder so);
116 };
117 
118 #endif //HEADER_ALBUM_H_
119 
120 
121