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
27using HashValue = uint32_t;
28using UniqueId = uint64_t;
29
30class 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
53
54 QString id() const;
55 QString displayName() const;
56 QString value() const;
57};
58
64{
65 PIMPL(LibraryItem)
66
67 public:
69 LibraryItem(const LibraryItem& other);
70 LibraryItem(LibraryItem&& other) noexcept;
71
72 LibraryItem& operator=(const LibraryItem& other);
73 LibraryItem& operator=(LibraryItem&& other) noexcept;
74
75 virtual ~LibraryItem();
76
77 void addCustomField(const CustomField& field);
78 void addCustomField(const QString& id, const QString& displayName, const QString& value);
79 void replaceCustomField(const QString& id, const QString& displayName, const QString& value);
80
81 const CustomFieldList& customFields() const;
82 QString customField(const QString& id) const;
83 QString customField(int idx) const;
84
85 QStringList coverDownloadUrls() const;
86 void setCoverDownloadUrls(const QStringList& url);
87
88 DbId databaseId() const;
89 void setDatabaseId(DbId id);
90
91 UniqueId uniqueId() const;
92
93 protected:
94 static QHash<HashValue, QString>& albumPool();
95 static QHash<HashValue, QString>& artistPool();
96};
97
98#endif
99
The CustomField class a CustomField is some additional entry than can be set for MetaData,...
Definition: LibraryItem.h:41
The LibraryItem class.
Definition: LibraryItem.h:64
Definition: EngineUtils.h:33