TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
qmmp.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2008-2026 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 QMMP_H
22 #define QMMP_H
23 
24 #include <QString>
25 #include "qmmp_export.h"
26 
27 #define QMMP_VERSION_MAJOR 1
28 #define QMMP_VERSION_MINOR 7
29 #define QMMP_VERSION_PATCH 9
30 #define QMMP_VERSION_STABLE 1
31 
32 #define QMMP_VERSION_INT (QMMP_VERSION_MAJOR<<16 | QMMP_VERSION_MINOR<<8 | QMMP_VERSION_PATCH)
33 
37 #ifdef Q_OS_WIN
38 # define QStringToFileName(s) TagLib::FileName(reinterpret_cast<const wchar_t*>(s.utf16()))
39 #else
40 # define QStringToFileName(s) s.toLocal8Bit().constData()
41 #endif
42 
43 #ifndef qPrintable
44 # define qPrintable(s) QString(s).toLocal8Bit().constData()
45 #endif
46 
47 #ifndef qUtf8Printable
48 # define qUtf8Printable(s) QString(s).toUtf8().constData()
49 #endif
50 
51 #ifndef QmmpPrintable
52 # define QmmpPrintable(s) Qmmp::generatePrintable(s).constData()
53 #endif
54 
55 #define CSTR_TO_QSTR(codec, str, utf) codec->toUnicode(str.toCString(utf)).trimmed()
56 
57 #ifndef TTK_LIBRARY
58 // as_const defined
59 #if __cplusplus < 201703L
60 namespace std
61 {
62 // this adds const to non-const objects
63 template <typename T>
64 Q_DECL_CONSTEXPR typename std::add_const<T>::type &as_const(T &t) noexcept { return t; }
65 // prevent rvalue arguments:
66 template <typename T>
67 void as_const(const T &&) = delete;
68 }
69 #endif
70 
71 #if QT_VERSION < QT_VERSION_CHECK(5,7,0) || QT_VERSION >= QT_VERSION_CHECK(6,6,0)
72 # define qAsConst std::as_const
73 #endif
74 
75 #if QT_VERSION < QT_VERSION_CHECK(5,10,0)
76 using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
77 #endif
78 
79 #if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
80 # define QtSkipEmptyParts Qt::SkipEmptyParts
81 #else
82 # define QtSkipEmptyParts QString::SkipEmptyParts
83 #endif
84 #endif
85 
90 {
91 public:
95  enum State
96  {
97  Playing = 0,
102  FatalError
103  };
107  enum MetaData
108  {
109  UNKNOWN = -1,
110  TITLE = 0,
119  DISCNUMBER
120  };
125  {
126  UNKNOWN_PROPERTY = -1,
127  BITRATE = 0,
134  };
139  {
140  REPLAYGAIN_TRACK_GAIN = 0,
143  REPLAYGAIN_ALBUM_PEAK
144  };
149  {
150  PCM_UNKNOWN = -1,
151  PCM_S8 = 0,
165  PCM_FLOAT
166  };
167 
172  {
173  CHAN_NULL = 0x00,
174  CHAN_FRONT_LEFT = 0x01,
175  CHAN_FRONT_RIGHT = 0x02,
176  CHAN_REAR_LEFT = 0x04,
177  CHAN_REAR_RIGHT = 0x08,
178  CHAN_FRONT_CENTER = 0x10,
179  CHAN_REAR_CENTER = 0x20,
180  CHAN_SIDE_LEFT = 0x40,
181  CHAN_SIDE_RIGHT = 0x80,
182  CHAN_LFE = 0x100,
183  };
184 
188  static QString configFile();
192  static QString configDir();
196  static QString cacheDir();
200  static QString strVersion();
204  static QString pluginPath();
209  static QStringList findPlugins(const QString &prefix);
213  static QString ttkPluginPath();
218  static QByteArray generatePrintable(const QString &text);
219 };
220 
221 #endif
Q_DECL_CONSTEXPR std::add_const< T >::type & as_const(T &t) noexcept
Definition: ttkqtglobal.h:49
#define T(v)
Definition: http_parser.c:237
Definition: ttkcompat.h:39
TrackProperty
Definition: qmmp.h:124
ReplayGainKey
Definition: qmmp.h:138
ChannelPosition
Definition: qmmp.h:171
MetaData
Definition: qmmp.h:107
State
Definition: qmmp.h:95
#define QMMP_EXPORT
Definition: qmmp_export.h:29
TTK_MODULE_EXPORT QString pluginPath(const QString &module, const QString &format)
size_t(* FILE_SIZE)(void *handle)
Definition: wke.h:124
AudioFormat
Definition: qmmp.h:148
The Qmmp class stores global settings and enums.
Definition: qmmp.h:89