Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2010-2016 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef QMMPSETTINGS_H 00022 #define QMMPSETTINGS_H 00023 00024 #include <QObject> 00025 #include <QUrl> 00026 #include <QStringList> 00027 #include "qmmp.h" 00028 #include "eqsettings.h" 00029 00030 class QTimer; 00031 00035 class QmmpSettings : public QObject 00036 { 00037 Q_OBJECT 00038 public: 00044 QmmpSettings(QObject *parent = 0); 00048 virtual ~QmmpSettings(); 00052 enum ReplayGainMode 00053 { 00054 REPLAYGAIN_TRACK = 0, 00055 REPLAYGAIN_ALBUM, 00056 REPLAYGAIN_DISABLED 00057 }; 00061 QmmpSettings::ReplayGainMode replayGainMode() const; 00065 double replayGainPreamp() const; 00069 double replayGainDefaultGain() const; 00073 bool replayGainPreventClipping() const; 00081 void setReplayGainSettings(ReplayGainMode mode, double preamp, double default_gain, bool clip); 00085 bool useSoftVolume() const; 00089 Qmmp::AudioFormat outputFormat() const; 00093 bool useDithering() const; 00100 void setAudioSettings(bool soft_volume, Qmmp::AudioFormat format, bool use_dithering); 00105 QStringList coverNameFilters(bool include = true) const; 00109 int coverSearchDepth() const; 00113 bool useCoverFiles() const; 00123 void setCoverSettings(QStringList inc, QStringList exc, int depth, bool use_files); 00127 bool isProxyEnabled() const; 00131 bool useProxyAuth() const; 00135 QUrl proxy() const; 00142 void setNetworkSettings(bool use_proxy, bool auth, const QUrl &proxy); 00146 EqSettings eqSettings() const; 00150 void setEqSettings(const EqSettings &settings); 00155 void readEqSettings(int bands = EqSettings::EQ_BANDS_10); 00159 int bufferSize() const; 00164 void setBufferSize(int msec); 00169 void setVolumeStep(int step); 00173 int volumeStep() const; 00179 void setDetermineFileTypeByContent(bool enabled); 00183 bool determineFileTypeByContent() const; 00187 static QmmpSettings* instance(); 00188 00189 signals: 00193 void replayGainSettingsChanged(); 00197 void audioSettingsChanged(); 00201 void coverSettingsChanged(); 00205 void networkSettingsChanged(); 00209 void eqSettingsChanged(); 00210 00211 private slots: 00215 void sync(); 00216 00217 private: 00218 //replaygain settings 00219 QmmpSettings::ReplayGainMode m_rg_mode; 00220 double m_rg_preamp; 00221 double m_rg_defaut_gain; 00222 bool m_rg_prevent_clipping; 00223 //audio settings 00224 bool m_aud_software_volume; 00225 bool m_aud_dithering; 00226 Qmmp::AudioFormat m_aud_format; 00227 int m_volume_step; 00228 //cover settings 00229 QStringList m_cover_inc; 00230 QStringList m_cover_exclude; 00231 int m_cover_depth; 00232 bool m_cover_use_files; 00233 //network settings 00234 bool m_proxy_enabled; 00235 bool m_proxy_auth; 00236 QUrl m_proxy_url; 00237 //equalizer settings 00238 EqSettings m_eq_settings; 00239 //buffer size 00240 int m_buffer_size; 00241 //file type determination 00242 bool m_determine_by_content; 00243 //timer 00244 QTimer *m_timer; 00245 00246 static QmmpSettings* m_instance; 00247 00248 }; 00249 00250 #endif // QMMPSETTINGS_H