Made the mutexes in the model classes "mutable" rather than "static".
This commit is contained in:
parent
6982596882
commit
ac9c8b3ce9
@ -31,7 +31,8 @@
|
|||||||
inline TYPE get##NAME(void) const \
|
inline TYPE get##NAME(void) const \
|
||||||
{ \
|
{ \
|
||||||
QMutexLocker lock(&m_mutex); \
|
QMutexLocker lock(&m_mutex); \
|
||||||
return m_##PREFIX##NAME; \
|
const TYPE value = m_##PREFIX##NAME; \
|
||||||
|
return value; \
|
||||||
} \
|
} \
|
||||||
inline void set##NAME(const TYPE PREFIX##NAME) \
|
inline void set##NAME(const TYPE PREFIX##NAME) \
|
||||||
{ \
|
{ \
|
||||||
@ -71,7 +72,7 @@ public:
|
|||||||
static void savePreferences(PreferencesModel *preferences);
|
static void savePreferences(PreferencesModel *preferences);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static QMutex m_mutex;
|
mutable QMutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -25,7 +25,12 @@
|
|||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#define SYSINFO_MAKE_FLAG(NAME) \
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define SYSINFO_MAKE_FLAG(NAME, VALUE) \
|
||||||
|
protected: \
|
||||||
|
static const unsigned int FLAG_HAS_##NAME = VALUE; \
|
||||||
|
public: \
|
||||||
inline void set##NAME##Support(const bool &enable) \
|
inline void set##NAME##Support(const bool &enable) \
|
||||||
{ \
|
{ \
|
||||||
QMutexLocker lock(&m_mutex); \
|
QMutexLocker lock(&m_mutex); \
|
||||||
@ -34,50 +39,49 @@
|
|||||||
inline bool has##NAME##Support(void) const \
|
inline bool has##NAME##Support(void) const \
|
||||||
{ \
|
{ \
|
||||||
QMutexLocker lock(&m_mutex); \
|
QMutexLocker lock(&m_mutex); \
|
||||||
return ((m_flags & (FLAG_HAS_##NAME)) == FLAG_HAS_##NAME); \
|
const bool enabeld = ((m_flags & (FLAG_HAS_##NAME)) == FLAG_HAS_##NAME); \
|
||||||
|
return enabeld; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SYSINFO_MAKE_PATH(NAME) \
|
#define SYSINFO_MAKE_PATH(NAME) \
|
||||||
|
protected: \
|
||||||
|
QString m_path##NAME; \
|
||||||
|
public: \
|
||||||
inline void set##NAME##Path(const QString &path) \
|
inline void set##NAME##Path(const QString &path) \
|
||||||
{ \
|
{ \
|
||||||
QMutexLocker lock(&m_mutex); \
|
QMutexLocker lock(&m_mutex); \
|
||||||
m_path##NAME = path; \
|
m_path##NAME = path; \
|
||||||
} \
|
} \
|
||||||
inline const QString & get##NAME##Path(void) const \
|
inline const QString get##NAME##Path(void) const \
|
||||||
{ \
|
{ \
|
||||||
QMutexLocker lock(&m_mutex); \
|
QMutexLocker lock(&m_mutex); \
|
||||||
return m_path##NAME; \
|
const QString path = m_path##NAME; \
|
||||||
|
return path; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class SysinfoModel
|
class SysinfoModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SysinfoModel(void) { m_flags = 0; }
|
SysinfoModel(void) { m_flags = 0; }
|
||||||
|
|
||||||
SYSINFO_MAKE_FLAG(X64)
|
SYSINFO_MAKE_FLAG(X64, 0x00000001)
|
||||||
SYSINFO_MAKE_FLAG(MMX)
|
SYSINFO_MAKE_FLAG(MMX, 0x00000002)
|
||||||
SYSINFO_MAKE_FLAG(SSE)
|
SYSINFO_MAKE_FLAG(SSE, 0x00000004)
|
||||||
SYSINFO_MAKE_FLAG(AVS)
|
SYSINFO_MAKE_FLAG(AVS, 0x00000008)
|
||||||
SYSINFO_MAKE_FLAG(VPS)
|
SYSINFO_MAKE_FLAG(VPS, 0x00000010)
|
||||||
|
SYSINFO_MAKE_FLAG(256, 0x00000020)
|
||||||
|
|
||||||
SYSINFO_MAKE_PATH(VPS)
|
SYSINFO_MAKE_PATH(VPS)
|
||||||
SYSINFO_MAKE_PATH(App)
|
SYSINFO_MAKE_PATH(App)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const unsigned int FLAG_HAS_X64 = 0x00000001;
|
|
||||||
static const unsigned int FLAG_HAS_MMX = 0x00000002;
|
|
||||||
static const unsigned int FLAG_HAS_SSE = 0x00000004;
|
|
||||||
static const unsigned int FLAG_HAS_AVS = 0x00000008;
|
|
||||||
static const unsigned int FLAG_HAS_VPS = 0x00000010;
|
|
||||||
|
|
||||||
inline void setFlag(const unsigned int &flag) { m_flags = (m_flags | flag); }
|
inline void setFlag(const unsigned int &flag) { m_flags = (m_flags | flag); }
|
||||||
inline void clrFlag(const unsigned int &flag) { m_flags = (m_flags & (~flag)); }
|
inline void clrFlag(const unsigned int &flag) { m_flags = (m_flags & (~flag)); }
|
||||||
|
|
||||||
unsigned int m_flags;
|
unsigned int m_flags;
|
||||||
|
mutable QMutex m_mutex;
|
||||||
QString m_pathApp;
|
|
||||||
QString m_pathVPS;
|
|
||||||
|
|
||||||
static QMutex m_mutex;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef SYSINFO_MAKE_FLAG
|
#undef SYSINFO_MAKE_FLAG
|
||||||
|
Loading…
Reference in New Issue
Block a user