OSDN Git Service

Added an "advanced" option to apply the original file's "creation" and "last modified...
[lamexp/LameXP.git] / src / Model_Settings.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
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, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 //
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #pragma once
24
25 #include <QMutex>
26 #include <QScopedPointer>
27
28 class QString;
29 class SettingsCache;
30
31 ///////////////////////////////////////////////////////////////////////////////
32
33 #define LAMEXP_MAKE_OPTION_I(OPT) \
34 int OPT(void) const; \
35 void OPT(int value); \
36 int OPT##Default(void);
37
38 #define LAMEXP_MAKE_OPTION_S(OPT) \
39 QString OPT(void) const; \
40 void OPT(const QString &value); \
41 QString OPT##Default(void);
42
43 #define LAMEXP_MAKE_OPTION_B(OPT) \
44 bool OPT(void) const; \
45 void OPT(bool value); \
46 bool OPT##Default(void);
47
48 #define LAMEXP_MAKE_OPTION_U(OPT) \
49 unsigned int OPT(void) const; \
50 void OPT(unsigned int value); \
51 unsigned int OPT##Default(void);
52
53 ///////////////////////////////////////////////////////////////////////////////
54
55 class SettingsModel
56 {
57 public:
58         SettingsModel(void);
59         ~SettingsModel(void);
60
61         //Enums
62         enum Encoder
63         {
64                 MP3Encoder    = 0,
65                 VorbisEncoder = 1,
66                 AACEncoder    = 2,
67                 AC3Encoder    = 3,
68                 FLACEncoder   = 4,
69                 OpusEncoder   = 5,
70                 DCAEncoder    = 6,
71                 MACEncoder    = 7,
72                 PCMEncoder    = 8,
73                 ENCODER_COUNT = 9
74         };
75
76         enum RCMode
77         {
78                 VBRMode = 0,
79                 ABRMode = 1,
80                 CBRMode = 2,
81                 RCMODE_COUNT = 3
82         };
83
84         enum Overwrite
85         {
86                 Overwrite_KeepBoth = 0,
87                 Overwrite_SkipFile = 1,
88                 Overwrite_Replaces = 2
89         };
90         
91         enum AACEncoderType
92         {
93                 AAC_ENCODER_NONE = 0,
94                 AAC_ENCODER_NERO = 1,
95                 AAC_ENCODER_FHG  = 2,
96                 AAC_ENCODER_FDK  = 3,
97                 AAC_ENCODER_QAAC = 4,
98         };
99
100         //Consts
101         static const int samplingRates[8];
102
103         //Getters & setters
104         LAMEXP_MAKE_OPTION_I(aacEncProfile)
105         LAMEXP_MAKE_OPTION_I(aftenAudioCodingMode)
106         LAMEXP_MAKE_OPTION_I(aftenDynamicRangeCompression)
107         LAMEXP_MAKE_OPTION_I(aftenExponentSearchSize)
108         LAMEXP_MAKE_OPTION_B(aftenFastBitAllocation)
109         LAMEXP_MAKE_OPTION_B(antivirNotificationsEnabled)
110         LAMEXP_MAKE_OPTION_B(autoUpdateCheckBeta)
111         LAMEXP_MAKE_OPTION_B(autoUpdateEnabled)
112         LAMEXP_MAKE_OPTION_S(autoUpdateLastCheck)
113         LAMEXP_MAKE_OPTION_B(bitrateManagementEnabled)
114         LAMEXP_MAKE_OPTION_I(bitrateManagementMaxRate)
115         LAMEXP_MAKE_OPTION_I(bitrateManagementMinRate)
116         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateAacEnc)
117         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateAften)
118         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateDcaEnc)
119         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateFLAC)
120         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateLAME)
121         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateMacEnc)
122         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateOggEnc)
123         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateOpusEnc)
124         LAMEXP_MAKE_OPTION_I(compressionAbrBitrateWave)
125         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateAacEnc)
126         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateAften)
127         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateDcaEnc)
128         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateFLAC)
129         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateLAME)
130         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateMacEnc)
131         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateOggEnc)
132         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateOpusEnc)
133         LAMEXP_MAKE_OPTION_I(compressionCbrBitrateWave)
134         LAMEXP_MAKE_OPTION_I(compressionEncoder)
135         LAMEXP_MAKE_OPTION_I(compressionRCModeAacEnc)
136         LAMEXP_MAKE_OPTION_I(compressionRCModeAften)
137         LAMEXP_MAKE_OPTION_I(compressionRCModeDcaEnc)
138         LAMEXP_MAKE_OPTION_I(compressionRCModeFLAC)
139         LAMEXP_MAKE_OPTION_I(compressionRCModeLAME)
140         LAMEXP_MAKE_OPTION_I(compressionRCModeMacEnc)
141         LAMEXP_MAKE_OPTION_I(compressionRCModeOggEnc)
142         LAMEXP_MAKE_OPTION_I(compressionRCModeOpusEnc)
143         LAMEXP_MAKE_OPTION_I(compressionRCModeWave)
144         LAMEXP_MAKE_OPTION_I(compressionVbrQualityAacEnc)
145         LAMEXP_MAKE_OPTION_I(compressionVbrQualityAften)
146         LAMEXP_MAKE_OPTION_I(compressionVbrQualityDcaEnc)
147         LAMEXP_MAKE_OPTION_I(compressionVbrQualityFLAC)
148         LAMEXP_MAKE_OPTION_I(compressionVbrQualityLAME)
149         LAMEXP_MAKE_OPTION_I(compressionVbrQualityMacEnc)
150         LAMEXP_MAKE_OPTION_I(compressionVbrQualityOggEnc)
151         LAMEXP_MAKE_OPTION_I(compressionVbrQualityOpusEnc)
152         LAMEXP_MAKE_OPTION_I(compressionVbrQualityWave)
153         LAMEXP_MAKE_OPTION_B(createPlaylist)
154         LAMEXP_MAKE_OPTION_S(currentLanguage)
155         LAMEXP_MAKE_OPTION_S(currentLanguageFile)
156         LAMEXP_MAKE_OPTION_S(customParametersAacEnc)
157         LAMEXP_MAKE_OPTION_S(customParametersAften)
158         LAMEXP_MAKE_OPTION_S(customParametersDcaEnc)
159         LAMEXP_MAKE_OPTION_S(customParametersFLAC)
160         LAMEXP_MAKE_OPTION_S(customParametersLAME)
161         LAMEXP_MAKE_OPTION_S(customParametersMacEnc)
162         LAMEXP_MAKE_OPTION_S(customParametersOggEnc)
163         LAMEXP_MAKE_OPTION_S(customParametersOpusEnc)
164         LAMEXP_MAKE_OPTION_S(customParametersWave)
165         LAMEXP_MAKE_OPTION_S(customTempPath)
166         LAMEXP_MAKE_OPTION_B(customTempPathEnabled)
167         LAMEXP_MAKE_OPTION_B(dropBoxWidgetEnabled)
168         LAMEXP_MAKE_OPTION_I(dropBoxWidgetPositionX)
169         LAMEXP_MAKE_OPTION_I(dropBoxWidgetPositionY)
170         LAMEXP_MAKE_OPTION_S(favoriteOutputFolders)
171         LAMEXP_MAKE_OPTION_B(forceStereoDownmix)
172         LAMEXP_MAKE_OPTION_B(hibernateComputer)
173         LAMEXP_MAKE_OPTION_I(interfaceStyle)
174         LAMEXP_MAKE_OPTION_B(keepOriginalDataTime)
175         LAMEXP_MAKE_OPTION_I(lameAlgoQuality)
176         LAMEXP_MAKE_OPTION_I(lameChannelMode)
177         LAMEXP_MAKE_OPTION_I(licenseAccepted)
178         LAMEXP_MAKE_OPTION_U(maximumInstances)
179         LAMEXP_MAKE_OPTION_U(metaInfoPosition)
180         LAMEXP_MAKE_OPTION_S(mostRecentInputPath)
181         LAMEXP_MAKE_OPTION_B(neroAACEnable2Pass)
182         LAMEXP_MAKE_OPTION_B(neroAacNotificationsEnabled)
183         LAMEXP_MAKE_OPTION_B(normalizationFilterEnabled)
184         LAMEXP_MAKE_OPTION_B(normalizationFilterDynamic)
185         LAMEXP_MAKE_OPTION_B(normalizationFilterCoupled)
186         LAMEXP_MAKE_OPTION_I(normalizationFilterMaxVolume)
187         LAMEXP_MAKE_OPTION_I(normalizationFilterSize)
188         LAMEXP_MAKE_OPTION_I(opusComplexity)
189         LAMEXP_MAKE_OPTION_B(opusDisableResample)
190         LAMEXP_MAKE_OPTION_I(opusFramesize)
191         LAMEXP_MAKE_OPTION_I(opusOptimizeFor)
192         LAMEXP_MAKE_OPTION_S(outputDir)
193         LAMEXP_MAKE_OPTION_B(outputToSourceDir)
194         LAMEXP_MAKE_OPTION_I(overwriteMode)
195         LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath)
196         LAMEXP_MAKE_OPTION_B(renameFiles_regExpEnabled)
197         LAMEXP_MAKE_OPTION_S(renameFiles_regExpSearch)
198         LAMEXP_MAKE_OPTION_S(renameFiles_regExpReplace)
199         LAMEXP_MAKE_OPTION_B(renameFiles_renameEnabled)
200         LAMEXP_MAKE_OPTION_S(renameFiles_renamePattern)
201         LAMEXP_MAKE_OPTION_S(renameFiles_fileExtension)
202         LAMEXP_MAKE_OPTION_I(samplingRate)
203         LAMEXP_MAKE_OPTION_B(shellIntegrationEnabled)
204         LAMEXP_MAKE_OPTION_B(slowStartup)
205         LAMEXP_MAKE_OPTION_B(soundsEnabled)
206         LAMEXP_MAKE_OPTION_I(toneAdjustBass)
207         LAMEXP_MAKE_OPTION_I(toneAdjustTreble)
208         LAMEXP_MAKE_OPTION_B(writeMetaTags)
209
210         //Misc
211         void validate(void);
212         void syncNow(void);
213
214 private:
215         SettingsModel(const SettingsModel &other) {}
216         SettingsModel &operator=(const SettingsModel &other) { return *this; }
217
218         QString initDirectory(const QString &path) const;
219         QString defaultLanguage(void) const;
220         QString defaultDirectory(void) const;
221
222         SettingsCache *m_configCache;
223
224         mutable QMutex                  m_defaultLangLock;
225         mutable QScopedPointer<QString> m_defaultLanguage;
226 };
227
228 ///////////////////////////////////////////////////////////////////////////////
229
230 #undef LAMEXP_MAKE_OPTION_I
231 #undef LAMEXP_MAKE_OPTION_S
232 #undef LAMEXP_MAKE_OPTION_B
233 #undef LAMEXP_MAKE_OPTION_U