Sayonara Player
LibraryItem.h
1 /* LibraryItem.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 SAYONARA_LIBRARY_ITEM_H_
22 #define SAYONARA_LIBRARY_ITEM_H_
23 
24 #include "Utils/Pimpl.h"
25 #include <QHash>
26 
27 using HashValue=uint32_t;
28 using UniqueId=uint64_t;
29 
30 class CustomField;
32 
41 {
42  PIMPL(CustomField)
43 
44 public:
45  CustomField(const QString& id, const QString& displayName, const QString& value);
46  CustomField(const CustomField& other);
47  CustomField(CustomField&& other) noexcept;
48 
49  CustomField& operator=(const CustomField& other);
50  CustomField& operator=(CustomField&& other) noexcept;
51 
52  ~CustomField();
53 
54  QString id() const;
55  QString displayName() const;
56  QString value() const;
57 };
58 
59 
65 {
66  PIMPL(LibraryItem)
67 
68 public:
69  LibraryItem();
70  LibraryItem(const LibraryItem& other);
71  LibraryItem(LibraryItem&& other) noexcept;
72 
73  LibraryItem& operator=(const LibraryItem& other);
74  LibraryItem& operator=(LibraryItem&& other) noexcept;
75 
76  virtual ~LibraryItem();
77 
78  void addCustomField(const CustomField& field);
79  void addCustomField(const QString& id, const QString& displayName, const QString& value);
80  void replaceCustomField(const QString& id, const QString& displayName, const QString& value);
81 
82  const CustomFieldList& customFields() const;
83  QString customField(const QString& id) const;
84  QString customField(int idx) const;
85 
86  QStringList coverDownloadUrls() const;
87  void setCoverDownloadUrls(const QStringList& url);
88 
89  DbId databaseId() const;
90  void setDatabaseId(DbId id);
91 
92  virtual void print() const;
93 
94  UniqueId uniqueId() const;
95 
96 protected:
97  static QHash<HashValue, QString>& albumPool();
98  static QHash<HashValue, QString>& artistPool();
99 };
100 
101 #endif
102 
QList
Definition: EngineUtils.h:33
CustomField
The CustomField class a CustomField is some additional entry than can be set for MetaData,...
Definition: LibraryItem.h:41
LibraryItem
The LibraryItem class.
Definition: LibraryItem.h:65