Qmmp
qmmp.h
1 /***************************************************************************
2  * Copyright (C) 2008-2020 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 4
28 #define QMMP_VERSION_PATCH 1
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)
44 template <typename T>
45 Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
46 // prevent rvalue arguments:
47 template <typename T>
48 void qAsConst(const T &&) = delete;
49 #endif
50 
51 
55 class QMMP_EXPORT Qmmp
56 {
57 public:
61  enum State
62  {
63  Playing = 0,
68  FatalError
69  };
73  enum MetaData
74  {
75  UNKNOWN = -1,
76  TITLE = 0,
83  YEAR,
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  };
115  {
116  PCM_UNKNOWN = -1,
117  PCM_S8 = 0,
131  PCM_FLOAT
132  };
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();
193 #ifdef Q_OS_WIN
194 
197  static bool isPortable();
198 #endif
199 
200 private:
201  static QString m_configDir;
202  static QString m_langID;
203 #ifdef Q_OS_WIN
204  static QString m_appDir;
205 #endif
206 
207 };
208 
209 #endif
Definition: qmmp.h:77
Definition: qmmp.h:80
Definition: qmmp.h:127
Definition: qmmp.h:67
Definition: qmmp.h:82
Definition: qmmp.h:119
Definition: qmmp.h:122
Definition: qmmp.h:130
State
Definition: qmmp.h:61
ChannelPosition
Definition: qmmp.h:137
Definition: qmmp.h:118
Definition: qmmp.h:78
Definition: qmmp.h:66
Definition: qmmp.h:81
Definition: qmmp.h:65
Definition: qmmp.h:64
Definition: qmmp.h:124
Definition: qmmp.h:129
Definition: qmmp.h:128
Definition: qmmp.h:84
MetaData
Definition: qmmp.h:73
Definition: qmmp.h:126
Definition: qmmp.h:107
Definition: qmmp.h:83
Definition: qmmp.h:123
ReplayGainKey
Definition: qmmp.h:104
Definition: qmmp.h:120
Definition: qmmp.h:121
AudioFormat
Definition: qmmp.h:114
TrackProperty
Definition: qmmp.h:90
Definition: qmmp.h:125
Definition: qmmp.h:79
The Qmmp class stores global settings and enums.
Definition: qmmp.h:55
Definition: qmmp.h:108