TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
metadatamanager.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2009-2025 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 <QDir>
25 #include <QCache>
26 #include <QImage>
27 #include <QStringList>
28 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
29 # include <QMutex>
30 #else
31 # include <QRecursiveMutex>
32 #endif
33 #include "trackinfo.h"
34 #include "metadatamodel.h"
35 
36 class DecoderFactory;
37 class EngineFactory;
38 class InputSourceFactory;
39 class QmmpSettings;
40 
41 
46 {
47 public:
56  QList<TrackInfo*> createPlayList(const QString &path, TrackInfo::Parts parts = TrackInfo::AllParts, QStringList *ignoredPaths = nullptr) const;
63  MetaDataModel* createMetaDataModel(const QString &url, bool readOnly) const;
67  QStringList filters() const;
71  QStringList nameFilters() const;
75  QStringList protocols() const;
79  QList<RegularExpression> regExps() const;
83  bool supports(const QString &file) const;
89  QImage getCover(const QString &url) const;
96  QString getCoverPath(const QString &url) const;
104  QString findCoverFile(const QString &fileName) const;
108  void clearCoverCache();
112  void prepareForAnotherThread();
116  static MetaDataManager* instance();
117 
118 private:
119  MetaDataManager();
120  ~MetaDataManager();
121 
122  static void destroy();
123 
125  {
126  QString coverPath;
127  QImage coverImage;
128  };
129 
130  QFileInfoList findCoverFiles(QDir dir, int depth) const;
131  CoverCacheItem *createCoverCacheItem(const QString &url) const;
132  mutable QCache<QString, CoverCacheItem> *m_cover_cache;
133  QmmpSettings *m_settings = nullptr;
134 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
135  mutable QMutex m_mutex;
136 #else
137  mutable QRecursiveMutex m_mutex;
138 #endif
139 
141 
142 };
143 
144 #endif
Transport plugin interface.
QCache< QString, CoverCacheItem > * m_cover_cache
The QmmpSettings class provides access to global settings.
Definition: qmmpsettings.h:35
QRecursiveMutex m_mutex
static MetaDataManager * m_instance
The MetaDataModel is the base interface class of metadata access.
Definition: metadatamodel.h:78
The MetaDataManager class is the base class for metadata access.
Input plugin interface (decoder factory).
#define QMMP_EXPORT
Definition: qmmp_export.h:29
Engine plugin interface.
Definition: enginefactory.h:51