Qmmp
Loading...
Searching...
No Matches
qmmp.h
1/***************************************************************************
2 * Copyright (C) 2008-2022 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#ifndef QMMP_H
21#define QMMP_H
22
23#include <QString>
24#include "qmmp_export.h"
25
26#define QMMP_VERSION_MAJOR 1
27#define QMMP_VERSION_MINOR 6
28#define QMMP_VERSION_PATCH 5
29#define QMMP_VERSION_STABLE 1
30
31#define QMMP_VERSION_INT (QMMP_VERSION_MAJOR<<16 | QMMP_VERSION_MINOR<<8 | QMMP_VERSION_PATCH)
32
36#ifdef Q_OS_WIN
37#define QStringToFileName(s) TagLib::FileName(reinterpret_cast<const wchar_t *>(s.utf16()))
38#else
39#define QStringToFileName(s) s.toLocal8Bit().constData()
40#endif
41
42#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0))
43// this adds const to non-const objects (like std::as_const)
44template <typename T>
45Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
46// prevent rvalue arguments:
47template <typename T>
48void qAsConst(const T &&) = delete;
49#endif
50
51
55class QMMP_EXPORT Qmmp
56{
57public:
61 enum State
62 {
63 Playing = 0,
68 FatalError
69 };
74 {
75 UNKNOWN = -1,
76 TITLE = 0,
85 DISCNUMBER
86 };
91 {
92 UNKNOWN_PROPERTY = -1,
93 BITRATE = 0,
94 SAMPLERATE,
95 CHANNELS,
96 BITS_PER_SAMPLE,
97 FORMAT_NAME,
98 DECODER,
99 FILE_SIZE
100 };
105 {
106 REPLAYGAIN_TRACK_GAIN = 0,
109 REPLAYGAIN_ALBUM_PEAK
110 };
133
138 {
139 CHAN_NULL = 0x00,
140 CHAN_FRONT_LEFT = 0x01,
141 CHAN_FRONT_RIGHT = 0x02,
142 CHAN_REAR_LEFT = 0x04,
143 CHAN_REAR_RIGHT = 0x08,
144 CHAN_FRONT_CENTER = 0x10,
145 CHAN_REAR_CENTER = 0x20,
146 CHAN_SIDE_LEFT = 0x40,
147 CHAN_SIDE_RIGHT = 0x80,
148 CHAN_LFE = 0x100,
149 };
150
154 static QString configFile();
158 static QString configDir();
162 static void setConfigDir(const QString &path);
166 static QString strVersion();
170 static QString pluginPath();
175 static QStringList findPlugins(const QString &prefix);
179 static QString systemLanguageID();
183 static QString uiLanguageID();
188 static void setUiLanguageID(const QString &code);
192 static QString dataPath();
197 static QString userDataPath();
198#ifdef Q_OS_WIN
202 static bool isPortable();
203#endif
204
205#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
206 static QString wildcardToRegularExpression(const QString &pattern);
207 static QString anchoredPattern(const QString &expression);
208#endif
209
210private:
211 static QString m_configDir;
212 static QString m_langID;
213#ifdef Q_OS_WIN
214 static QString m_appDir;
215#endif
216
217};
218
219#endif
The Qmmp class stores global settings and enums.
Definition qmmp.h:56
static void setConfigDir(const QString &path)
static void setUiLanguageID(const QString &code)
TrackProperty
Definition qmmp.h:91
static QString strVersion()
ChannelPosition
Definition qmmp.h:138
static QString dataPath()
State
Definition qmmp.h:62
@ Stopped
Definition qmmp.h:65
@ Paused
Definition qmmp.h:64
@ NormalError
Definition qmmp.h:67
@ Buffering
Definition qmmp.h:66
static QString userDataPath()
MetaData
Definition qmmp.h:74
@ ALBUMARTIST
Definition qmmp.h:78
@ TRACK
Definition qmmp.h:84
@ COMPOSER
Definition qmmp.h:82
@ GENRE
Definition qmmp.h:81
@ COMMENT
Definition qmmp.h:80
@ ARTIST
Definition qmmp.h:77
@ ALBUM
Definition qmmp.h:79
@ YEAR
Definition qmmp.h:83
AudioFormat
Definition qmmp.h:115
@ PCM_S32BE
Definition qmmp.h:128
@ PCM_U8
Definition qmmp.h:118
@ PCM_S24BE
Definition qmmp.h:124
@ PCM_S16BE
Definition qmmp.h:120
@ PCM_S32LE
Definition qmmp.h:127
@ PCM_U24BE
Definition qmmp.h:126
@ PCM_U32BE
Definition qmmp.h:130
@ PCM_S16LE
Definition qmmp.h:119
@ PCM_S24LE
Definition qmmp.h:123
@ PCM_U24LE
Definition qmmp.h:125
@ PCM_U16BE
Definition qmmp.h:122
@ PCM_U32LE
Definition qmmp.h:129
@ PCM_U16LE
Definition qmmp.h:121
ReplayGainKey
Definition qmmp.h:105
@ REPLAYGAIN_ALBUM_GAIN
Definition qmmp.h:108
@ REPLAYGAIN_TRACK_PEAK
Definition qmmp.h:107
static QString systemLanguageID()
static QString uiLanguageID()
static QString configFile()
static QString configDir()
static QStringList findPlugins(const QString &prefix)
static QString pluginPath()