Qmmp
qmmpsettings.h
1 /***************************************************************************
2  * Copyright (C) 2010-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 
21 #ifndef QMMPSETTINGS_H
22 #define QMMPSETTINGS_H
23 
24 #include <QObject>
25 #include <QUrl>
26 #include <QStringList>
27 #include "qmmp.h"
28 #include "eqsettings.h"
29 
30 class QTimer;
31 
35 class QMMP_EXPORT QmmpSettings : public QObject
36 {
37 Q_OBJECT
38 public:
43  {
44  REPLAYGAIN_TRACK = 0,
46  REPLAYGAIN_DISABLED
47  };
48 
52  enum ProxyType
53  {
54  HTTP_PROXY = 0,
55  SOCKS5_PROXY
56  };
62  QmmpSettings(QObject *parent = nullptr);
66  virtual ~QmmpSettings();
70  QmmpSettings::ReplayGainMode replayGainMode() const;
74  double replayGainPreamp() const;
78  double replayGainDefaultGain() const;
82  bool replayGainPreventClipping() const;
90  void setReplayGainSettings(ReplayGainMode mode, double preamp, double default_gain, bool clip);
94  bool useSoftVolume() const;
98  Qmmp::AudioFormat outputFormat() const;
102  bool useDithering() const;
109  void setAudioSettings(bool soft_volume, Qmmp::AudioFormat format, bool use_dithering);
114  QStringList coverNameFilters(bool include = true) const;
118  int coverSearchDepth() const;
122  bool useCoverFiles() const;
132  void setCoverSettings(QStringList inc, QStringList exc, int depth, bool use_files);
136  bool isProxyEnabled() const;
140  bool useProxyAuth() const;
144  const QUrl &proxy() const;
148  ProxyType proxyType() const;
156  void setNetworkSettings(bool use_proxy, bool auth, ProxyType type, const QUrl &proxy);
160  const EqSettings &eqSettings() const;
164  void setEqSettings(const EqSettings &settings);
169  void readEqSettings(EqSettings::Bands bands = EqSettings::EQ_BANDS_10);
173  int bufferSize() const;
178  void setBufferSize(int msec);
183  void setVolumeStep(int step);
187  int volumeStep() const;
194  void setAverageBitrate(bool enabled);
198  bool averageBitrate() const;
204  void setDetermineFileTypeByContent(bool enabled);
208  bool determineFileTypeByContent() const;
212  static QmmpSettings* instance();
213 
214 signals:
218  void replayGainSettingsChanged();
222  void audioSettingsChanged();
226  void coverSettingsChanged();
230  void networkSettingsChanged();
234  void eqSettingsChanged();
235 
236 private slots:
240  void sync();
241 
242 private:
243  //replaygain settings
245  double m_rg_preamp;
246  double m_rg_defaut_gain;
247  bool m_rg_prevent_clipping;
248  //audio settings
249  bool m_aud_software_volume;
250  bool m_aud_dithering;
251  Qmmp::AudioFormat m_aud_format;
252  int m_volume_step;
253  bool m_average_bitrate;
254  //cover settings
255  QStringList m_cover_inc;
256  QStringList m_cover_exclude;
257  int m_cover_depth;
258  bool m_cover_use_files;
259  //network settings
260  bool m_proxy_enabled;
261  bool m_proxy_auth;
262  QUrl m_proxy_url;
263  ProxyType m_proxy_type;
264  //equalizer settings
265  EqSettings m_eq_settings;
266  //buffer size
267  int m_buffer_size;
268  //file type determination
269  bool m_determine_by_content;
270  //timer
271  QTimer *m_timer;
272 
273  static QmmpSettings* m_instance;
274 
275 };
276 
277 #endif // QMMPSETTINGS_H
ReplayGainMode
Definition: qmmpsettings.h:42
The QmmpSettings class provides access to global settings.
Definition: qmmpsettings.h:35
Definition: qmmpsettings.h:45
The EqSettings class helps to work with equalizer settings.
Definition: eqsettings.h:29
Definition: eqsettings.h:37
Bands
Definition: eqsettings.h:35
ProxyType
Definition: qmmpsettings.h:52
AudioFormat
Definition: qmmp.h:114