1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2017 LoRd_MuldeR <MuldeR2@GMX.de>
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.
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.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
25 #include <QMutexLocker>
27 ///////////////////////////////////////////////////////////////////////////////
29 #define PREFERENCES_MAKE_X(NAME, PREFIX, TYPE) \
31 inline TYPE get##NAME(void) const \
33 QMutexLocker lock(&m_mutex); \
34 const TYPE value = m_##PREFIX##NAME; \
37 inline void set##NAME(const TYPE PREFIX##NAME) \
39 QMutexLocker lock(&m_mutex); \
40 m_##PREFIX##NAME = PREFIX##NAME; \
43 TYPE m_##PREFIX##NAME;
45 #define PREFERENCES_MAKE_B(NAME) PREFERENCES_MAKE_X(NAME, b, bool)
46 #define PREFERENCES_MAKE_I(NAME) PREFERENCES_MAKE_X(NAME, i, int)
47 #define PREFERENCES_MAKE_U(NAME) PREFERENCES_MAKE_X(NAME, u, unsigned int)
49 ///////////////////////////////////////////////////////////////////////////////
51 class PreferencesModel
54 PreferencesModel(void);
56 PREFERENCES_MAKE_B(AutoRunNextJob
)
57 PREFERENCES_MAKE_U(MaxRunningJobCount
)
58 PREFERENCES_MAKE_B(ShutdownComputer
)
59 PREFERENCES_MAKE_B(Prefer64BitSource
)
60 PREFERENCES_MAKE_B(SaveLogFiles
)
61 PREFERENCES_MAKE_B(SaveToSourcePath
)
62 PREFERENCES_MAKE_I(ProcessPriority
)
63 PREFERENCES_MAKE_B(EnableSounds
)
64 PREFERENCES_MAKE_B(DisableWarnings
)
65 PREFERENCES_MAKE_B(NoUpdateReminder
)
66 PREFERENCES_MAKE_B(AbortOnTimeout
)
67 PREFERENCES_MAKE_B(SkipVersionTest
)
68 PREFERENCES_MAKE_B(NoSystrayWarning
)
69 PREFERENCES_MAKE_B(SaveQueueNoConfirm
)
72 static void initPreferences(PreferencesModel
*preferences
);
73 static void loadPreferences(PreferencesModel
*preferences
);
74 static void savePreferences(PreferencesModel
*preferences
);
77 mutable QMutex m_mutex
;
80 ///////////////////////////////////////////////////////////////////////////////
82 #undef PREFERENCES_MAKE_X
83 #undef PREFERENCES_MAKE_B
84 #undef PREFERENCES_MAKE_I
85 #undef PREFERENCES_MAKE_U