Qmmp
metadatamanager.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 METADATAMANAGER_H
22 #define METADATAMANAGER_H
23 
24 #include <QList>
25 #include <QStringList>
26 #include <QPixmap>
27 #include <QDir>
28 #include <QMutex>
29 #include "trackinfo.h"
30 #include "metadatamodel.h"
31 
32 class DecoderFactory;
33 class EngineFactory;
34 class InputSourceFactory;
35 class QmmpSettings;
36 
37 
41 class QMMP_EXPORT MetaDataManager
42 {
43 public:
51  ~MetaDataManager();
59  QList <TrackInfo *> createPlayList(const QString &path, TrackInfo::Parts parts = TrackInfo::AllParts, QStringList *ignoredPaths = 0) const;
66  MetaDataModel* createMetaDataModel(const QString &url, bool readOnly, QObject *parent) const;
70  QStringList filters() const;
74  QStringList nameFilters() const;
78  QStringList protocols() const;
82  bool supports(const QString &file) const;
88  QPixmap getCover(const QString &url) const;
95  QString getCoverPath(const QString &url) const;
103  QString findCoverFile(const QString &fileName) const;
107  void clearCoverCache();
111  void prepareForAnotherThread();
115  static MetaDataManager* instance();
119  static void destroy();
120 
121 private:
122  struct CoverCacheItem
123  {
124  QString url;
125  QString coverPath;
126  QPixmap coverPixmap;
127  };
128 
129  QFileInfoList findCoverFiles(QDir dir, int depth) const;
130  CoverCacheItem *createCoverCacheItem(const QString &url) const;
131  mutable QList <CoverCacheItem *> m_cover_cache;
132  QmmpSettings *m_settings;
133  mutable QMutex m_mutex;
134 
135  static MetaDataManager* m_instance;
136 };
137 
138 #endif // METADATAMANAGER_H
Transport plugin interface.
Definition: inputsourcefactory.h:56
The QmmpSettings class provides access to global settings.
Definition: qmmpsettings.h:35
The MetaDataModel is the base interface class of metadata access.
Definition: metadatamodel.h:54
The MetaDataManager class is the base class for metadata access.
Definition: metadatamanager.h:41
Input plugin interface (decoder factory).
Definition: decoderfactory.h:64
Engine plugin interface.
Definition: enginefactory.h:62