Qmmp
metadatamodel.h
1 /***************************************************************************
2  * Copyright (C) 2009-2019 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef METADATAMODEL_H
22 #define METADATAMODEL_H
23 
24 #include <QHash>
25 #include <QList>
26 #include <QString>
27 #include <QCoreApplication>
28 #include <QPixmap>
29 #include <QVariant>
30 #include <QFlags>
31 #include "tagmodel.h"
32 
33 
37 class QMMP_EXPORT MetaDataItem
38 {
39 public:
46  MetaDataItem(const QString &name, const QVariant &value, const QString &suffix = QString());
50  const QString &name() const;
54  void setName(const QString &name);
58  const QVariant &value() const;
62  void setValue(const QString &value);
66  const QString &suffix() const;
70  void setSuffix(const QString &suffix);
71 
72 private:
73  QString m_name, m_suffix;
74  QVariant m_value;
75 };
76 
80 class QMMP_EXPORT MetaDataModel
81 {
82 public:
87  {
88  NO_HINTS = 0x0,
89  IS_COVER_EDITABLE = 0x1,
90  COMPLETE_PROPERTY_LIST = 0x2
91  };
92  Q_DECLARE_FLAGS(DialogHints, DialogHint)
98  MetaDataModel(bool readOnly, DialogHints hints = NO_HINTS);
102  virtual ~MetaDataModel();
107  virtual QList<MetaDataItem> extraProperties() const;
112  virtual QList<MetaDataItem> descriptions() const;
117  virtual QList<TagModel* > tags() const;
122  virtual QPixmap cover() const;
128  virtual void setCover(const QPixmap &pix);
133  virtual void removeCover();
137  virtual QString coverPath() const;
141  bool isReadOnly() const;
145  const DialogHints &dialogHints() const;
146 
147 protected:
151  void setDialogHints(const DialogHints &hints);
156  void setReadOnly(bool readOnly);
157 
158 private:
159  bool m_readOnly;
160  DialogHints m_dialogHints;
161 };
162 
163 Q_DECLARE_OPERATORS_FOR_FLAGS(MetaDataModel::DialogHints)
164 
165 #endif // METADATAMODEL_H
Container of extra file/track property.
Definition: metadatamodel.h:37
The MetaDataModel is the base interface class of metadata access.
Definition: metadatamodel.h:80
DialogHint
Definition: metadatamodel.h:86