Added support for detecting "portable" Avisynth.
[simple-x264-launcher.git] / src / model_sysinfo.h
blobe373358a540d4c12f213f66b2b98689d893f194f
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2016 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.
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.
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 ///////////////////////////////////////////////////////////////////////////////
22 #pragma once
24 #include <QMutex>
25 #include <QMutexLocker>
26 #include <QString>
27 #include <QFlags>
29 ///////////////////////////////////////////////////////////////////////////////
31 #define SYSINFO_MAKE_FLAG(NAME) \
32 protected: \
33 QFlags<NAME##_t> m_flag##NAME; \
34 public: \
35 inline void set##NAME(const NAME##_t &flag, const bool &enable) \
36 { \
37 QMutexLocker lock(&m_mutex); \
38 if(enable) m_flag##NAME |= flag; else m_flag##NAME &= (~flag); \
39 } \
40 inline bool get##NAME(const NAME##_t &flag) const \
41 { \
42 QMutexLocker lock(&m_mutex); \
43 return m_flag##NAME.testFlag(flag); \
44 } \
45 inline bool has##NAME(void) const \
46 { \
47 QMutexLocker lock(&m_mutex); \
48 return !!m_flag##NAME; \
49 } \
50 inline void clear##NAME(void) \
51 { \
52 QMutexLocker lock(&m_mutex); \
53 m_flag##NAME &= 0; \
56 #define SYSINFO_MAKE_PATH(NAME) \
57 protected: \
58 QString m_path##NAME; \
59 public: \
60 inline void set##NAME##Path(const QString &path) \
61 { \
62 QMutexLocker lock(&m_mutex); \
63 m_path##NAME = path; \
64 } \
65 inline const QString get##NAME##Path(void) const \
66 { \
67 QMutexLocker lock(&m_mutex); \
68 const QString path = m_path##NAME; \
69 return path; \
70 } \
71 inline void clear##NAME##Path(void) \
72 { \
73 QMutexLocker lock(&m_mutex); \
74 m_path##NAME.clear(); \
77 ///////////////////////////////////////////////////////////////////////////////
79 class SysinfoModel
81 public:
82 SysinfoModel(void) {}
84 typedef enum _CPUFeatures_t
86 CPUFeatures_MMX = 0x1,
87 CPUFeatures_SSE = 0x2,
88 CPUFeatures_X64 = 0x4,
90 CPUFeatures_t;
92 typedef enum _Avisynth_t
94 Avisynth_X86 = 0x1,
95 Avisynth_X64 = 0x2,
97 Avisynth_t;
99 typedef enum _VapourSynth_t
101 VapourSynth_X86 = 0x1,
102 VapourSynth_X64 = 0x2,
104 VapourSynth_t;
106 SYSINFO_MAKE_FLAG(CPUFeatures)
107 SYSINFO_MAKE_FLAG(Avisynth)
108 SYSINFO_MAKE_FLAG(VapourSynth)
110 SYSINFO_MAKE_PATH(AVS)
111 SYSINFO_MAKE_PATH(VPS)
112 SYSINFO_MAKE_PATH(App)
114 protected:
115 mutable QMutex m_mutex;
118 #undef SYSINFO_MAKE_FLAG
119 #undef SYSINFO_MAKE_PATH