Sayonara Player
Artist.h
1 /* Artist.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 _ARTIST_H_
22 #define _ARTIST_H_
23 
24 #include "Utils/MetaData/LibraryItem.h"
25 #include "Utils/Library/Sortorder.h"
26 #include "Utils/Pimpl.h"
27 
28 #include <QStringList>
29 #include <QMetaType>
30 #include <deque>
31 
36 class Artist :
37  public LibraryItem
38 {
39  PIMPL(Artist)
40 
41 public:
42  ArtistId id;
43  uint16_t num_albums;
44  uint16_t num_songs;
45 
46  Artist();
47  Artist(const Artist& other);
48  Artist(Artist&& other);
49 
50  Artist& operator=(const Artist& other);
51  Artist& operator=(Artist&& other);
52 
53  ~Artist();
54 
55  QString name() const;
56  void set_name(const QString& name);
57 
58  static bool fromVariant(const QVariant& v, Artist& a);
59  static QVariant toVariant(const Artist& a);
60  void print() const ;
61 };
62 
63 
64 Q_DECLARE_METATYPE(Artist)
65 
66 
70 class ArtistList :
71  public std::deque<Artist>
72 {
73  using Parent=std::deque<Artist>;
74 
75 public:
76  ArtistList();
77  ~ArtistList();
78 
84  static QString get_major_artist(const QStringList& artists);
85 
91  QString get_major_artist() const;
92 
93 
94  bool contains(ArtistId artist_id) const;
95 
96  int count() const;
97  ArtistList& operator <<(const Artist& artist);
98  Artist first() const;
99 
100  ArtistList& append_unique(const ArtistList& other);
101 
102  void sort(Library::SortOrder so);
103 };
104 
105 #endif
The LibraryItem class.
Definition: LibraryItem.h:63
ArtistList.
Definition: Artist.h:70
The Artist class.
Definition: Artist.h:36