ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ckbsettings.cpp File Reference
#include "ckbsettings.h"
#include "ckbsettingswriter.h"
#include <QThread>
#include <QMutex>
#include <QDebug>
+ Include dependency graph for ckbsettings.cpp:

Go to the source code of this file.

Macros

#define lockMutex   QMutexLocker locker(backing == _globalSettings ? &settingsMutex : 0)
 
#define lockMutexStatic   QMutexLocker locker(&settingsMutex)
 
#define lockMutexStatic2   QMutexLocker locker2(&settingsMutex)
 
#define lockMutexCache   QMutexLocker locker(&settingsCacheMutex)
 

Functions

QAtomicInt cacheWritesInProgress (0)
 
QMutex settingsMutex (QMutex::Recursive)
 
QMutex settingsCacheMutex (QMutex::Recursive)
 
static QSettings * globalSettings ()
 

Variables

static QSettings * _globalSettings = 0
 
static QThreadglobalThread = 0
 
static QMap< QString, QVariant > globalCache
 

Macro Definition Documentation

#define lockMutex   QMutexLocker locker(backing == _globalSettings ? &settingsMutex : 0)
#define lockMutexCache   QMutexLocker locker(&settingsCacheMutex)

Definition at line 18 of file ckbsettings.cpp.

Referenced by CkbSettings::get(), CkbSettings::set(), and CkbSettings::setValue().

#define lockMutexStatic   QMutexLocker locker(&settingsMutex)

Definition at line 16 of file ckbsettings.cpp.

Referenced by globalSettings(), and CkbSettings::set().

#define lockMutexStatic2   QMutexLocker locker2(&settingsMutex)

Definition at line 17 of file ckbsettings.cpp.

Referenced by CkbSettings::get().

Function Documentation

QAtomicInt cacheWritesInProgress ( )

Referenced by CkbSettings::cleanUp(), and CkbSettings::isBusy().

+ Here is the caller graph for this function:

static QSettings* globalSettings ( )
static

Definition at line 27 of file ckbsettings.cpp.

References _globalSettings, and lockMutexStatic.

Referenced by CkbSettings::get(), and CkbSettings::set().

27  {
28  if(!_globalSettings){
30  if(!(volatile QSettings*)_globalSettings){ // Check again after locking mutex in case another thread created the object
31  // Put the settings object in a separate thread so that it won't lock up the GUI when it syncs
32  globalThread = new QThread;
33  globalThread->start();
34  _globalSettings = new QSettings;
35  qInfo() << "Path to settings is" << _globalSettings->fileName();
36  _globalSettings->moveToThread(globalThread);
37  }
38  }
39  return _globalSettings;
40 }
static QThread * globalThread
Definition: ckbsettings.cpp:9
static QSettings * _globalSettings
Definition: ckbsettings.cpp:8
#define lockMutexStatic
Definition: ckbsettings.cpp:16

+ Here is the caller graph for this function:

QMutex settingsCacheMutex ( QMutex::Recursive  )
QMutex settingsMutex ( QMutex::Recursive  )

Variable Documentation

QSettings* _globalSettings = 0
static

Definition at line 8 of file ckbsettings.cpp.

Referenced by CkbSettings::cleanUp(), and globalSettings().

QMap<QString, QVariant> globalCache
static

Definition at line 12 of file ckbsettings.cpp.

Referenced by CkbSettings::get(), CkbSettings::set(), and CkbSettings::setValue().

QThread* globalThread = 0
static

Definition at line 9 of file ckbsettings.cpp.

Referenced by CkbSettings::cleanUp().