Qmmp
metadatamodel.h
1 /***************************************************************************
2  * Copyright (C) 2009-2018 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 <QObject>
28 #include <QPixmap>
29 #include <QVariant>
30 #include <QFlags>
31 #include "tagmodel.h"
32 
33 
34 class QMMP_EXPORT MetaDataItem
35 {
36 public:
37  MetaDataItem(const QString &name, const QVariant &value, const QString &suffix = QString());
38 
39  const QString &name() const;
40  void setName(const QString &name);
41  const QVariant &value() const;
42  void setValue(const QString &value);
43  const QString &suffix() const;
44  void setSuffix(const QString &suffix);
45 
46 private:
47  QString m_name, m_suffix;
48  QVariant m_value;
49 };
50 
54 class QMMP_EXPORT MetaDataModel : public QObject
55 {
56 Q_OBJECT
57 public:
58  enum DialogHint
59  {
60  NO_HINTS = 0x0,
61  IS_COVER_EDITABLE = 0x1,
62  COMPLETE_PROPERTY_LIST = 0x2
63  };
64  Q_DECLARE_FLAGS(DialogHints, DialogHint)
69  MetaDataModel(bool readOnly, QObject *parent = 0);
73  virtual ~MetaDataModel();
74 
75  virtual QList<MetaDataItem> extraProperties() const;
76  virtual QList<MetaDataItem> descriptions() const;
81  virtual QList<TagModel* > tags() const;
86  virtual QPixmap cover() const;
90  virtual QString coverPath() const;
91  void setCover(const QPixmap &cover);
92  bool isReadOnly() const;
93  const DialogHints &dialogHints() const;
94 
95 protected:
96  void setDialogHints(const DialogHints &hints);
97  void setReadOnly(bool readOnly);
98 
99 private:
100  bool m_readOnly;
101  DialogHints m_dialogHints;
102 };
103 
104 #endif // METADATAMODEL_H
The MetaDataModel is the base interface class of metadata access.
Definition: metadatamodel.h:54