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