Sayonara Player
LibraryItem.h
1 /* LibraryItem.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 _LIBRARY_ITEM_H_
22 #define _LIBRARY_ITEM_H_
23 
24 #include "Utils/Pimpl.h"
25 #include <QHash>
26 
27 using HashValue=uint32_t;
28 
29 class CustomField;
31 
40 {
41  PIMPL(CustomField)
42 
43 public:
44  CustomField(const QString& id, const QString& display_name, const QString& value);
45  CustomField(const CustomField& other);
46  CustomField(CustomField&& other);
47 
48  CustomField& operator=(const CustomField& other);
49  CustomField& operator=(CustomField&& other);
50 
51  ~CustomField();
52 
53  QString get_id() const;
54  QString get_display_name() const;
55  QString get_value() const;
56 };
57 
58 
64 {
65  PIMPL(LibraryItem)
66 
67 public:
68  LibraryItem();
69  LibraryItem(const LibraryItem& other);
70  LibraryItem(LibraryItem&& other);
71 
72  LibraryItem& operator=(const LibraryItem& other);
73  LibraryItem& operator=(LibraryItem&& other);
74 
75  virtual ~LibraryItem();
76 
77  void add_custom_field(const CustomField& field);
78  void add_custom_field(const QString& id, const QString& display_name, const QString& value);
79  void replace_custom_field(const QString& id, const QString& display_name, const QString& value);
80 
81  const CustomFieldList& get_custom_fields() const;
82  QString get_custom_field(const QString& id) const;
83  QString get_custom_field(int idx) const;
84 
85  QStringList cover_download_urls() const;
86  void set_cover_download_urls(const QStringList& url);
87 
88  DbId db_id() const;
89  void set_db_id(DbId id);
90 
91  virtual void print() const;
92 
93 protected:
94  static QHash<HashValue, QString>& album_pool();
95  static QHash<HashValue, QString>& artist_pool();
96 };
97 
98 
99 
100 #endif
101 
The LibraryItem class.
Definition: LibraryItem.h:63
The CustomField class a CustomField is some additional entry than can be set for MetaData,...
Definition: LibraryItem.h:39
Definition: org_mpris_media_player2_adaptor.h:20