Qmmp
metadatamanager.h
1 /***************************************************************************
2  * Copyright (C) 2009-2016 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 "fileinfo.h"
30 #include "metadatamodel.h"
31 
32 class DecoderFactory;
33 class EngineFactory;
34 class InputSourceFactory;
35 class QmmpSettings;
36 
37 
42 {
43 public:
60  QList <FileInfo *> createPlayList(const QString &path, bool useMetaData = true, QStringList *ignoredPaths = 0) const;
67  MetaDataModel* createMetaDataModel(const QString &url, QObject *parent = 0) const;
71  QStringList filters() const;
75  QStringList nameFilters() const;
79  QStringList protocols() const;
83  bool supports(const QString &file) const;
89  QPixmap getCover(const QString &url) const;
96  QString getCoverPath(const QString &url) const;
104  QString findCoverFile(const QString &fileName) const;
108  void clearCoverCache();
116  static MetaDataManager* instance();
120  static void destroy();
121 
122 private:
123  struct CoverCacheItem
124  {
125  QString url;
126  QString coverPath;
127  QPixmap coverPixmap;
128  };
129 
130  QFileInfoList findCoverFiles(QDir dir, int depth) const;
131  CoverCacheItem *createCoverCacheItem(const QString &url) const;
132  mutable QList <CoverCacheItem *> m_cover_cache;
133  QmmpSettings *m_settings;
134  mutable QMutex m_mutex;
135 
136  static MetaDataManager* m_instance;
137 };
138 
139 #endif // METADATAMANAGER_H
Transport plugin interface.
Definition: inputsourcefactory.h:56
QList< FileInfo * > createPlayList(const QString &path, bool useMetaData=true, QStringList *ignoredPaths=0) const
QString getCoverPath(const QString &url) const
The QmmpSettings class provides access to global settings.
Definition: qmmpsettings.h:35
bool supports(const QString &file) const
The MetaDataModel is the base interface class of metadata access.
Definition: metadatamodel.h:34
The MetaDataManager class is the base class for metadata access.
Definition: metadatamanager.h:41
QStringList filters() const
Input plugin interface (decoder factory).
Definition: decoderfactory.h:67
void prepareForAnotherThread()
static void destroy()
static MetaDataManager * instance()
QString findCoverFile(const QString &fileName) const
QStringList protocols() const
Engine plugin interface.
Definition: enginefactory.h:60
QStringList nameFilters() const
MetaDataModel * createMetaDataModel(const QString &url, QObject *parent=0) const
void clearCoverCache()
QPixmap getCover(const QString &url) const