diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-09-17 17:42:44 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-09-17 17:42:44 +0200 |
commit | 7b907c5f88836effdefcad320d398ce1b18e857d (patch) | |
tree | 044fa9b9dc47e5aff18a9d5cb2834613cb985606 | |
parent | f8edb5c556f970f5fc9be8919e054e0d973e9dcc (diff) |
splines: mutex without ptr; appease -Wreorder
-rw-r--r-- | qfunctionconfigurator/functionconfig.cpp | 33 | ||||
-rw-r--r-- | qfunctionconfigurator/functionconfig.h | 4 |
2 files changed, 17 insertions, 20 deletions
diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 6e1569f9..f9c9957e 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -21,9 +21,9 @@ // // Constructor with List of Points in argument. // -FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) +FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) : + _mutex(QMutex::Recursive) { - _mutex = new QMutex(QMutex::Recursive); _title = title; _points = QList<QPointF>(); _data = 0; @@ -45,14 +45,13 @@ void FunctionConfig::setTrackingActive(bool blnActive) } FunctionConfig::FunctionConfig() : + _mutex(QMutex::Recursive), + _data(0), + _size(0), _tracking_active(false), _max_Input(0), - _max_Output(0), - _data(0), - _mutex(0), - _size(0) + _max_Output(0) { - _mutex = new QMutex(); } // @@ -61,7 +60,7 @@ FunctionConfig::FunctionConfig() : // The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running. // float FunctionConfig::getValue(float x) { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); float ret = getValueInternal(x2); lastValueTracked.setX(x); @@ -73,7 +72,7 @@ float FunctionConfig::getValue(float x) { // The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running. // bool FunctionConfig::getLastPoint(QPointF& point ) { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); point = lastValueTracked; return _tracking_active; } @@ -172,8 +171,6 @@ void FunctionConfig::reload() { FunctionConfig::~FunctionConfig() { if (_data) delete[] _data; - if (_mutex) - delete _mutex; } // @@ -181,7 +178,7 @@ FunctionConfig::~FunctionConfig() { // Used by the Widget. // void FunctionConfig::removePoint(int i) { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); if (i >= 0 && i < _points.size()) { _points.removeAt(i); @@ -194,7 +191,7 @@ void FunctionConfig::removePoint(int i) { // Used by the Widget and by loadSettings. // void FunctionConfig::addPoint(QPointF pt) { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); _points.append(pt); reload(); } @@ -204,7 +201,7 @@ void FunctionConfig::addPoint(QPointF pt) { // Used by the Widget. // void FunctionConfig::movePoint(int idx, QPointF pt) { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); if (idx >= 0 && idx < _points.size()) { _points[idx] = pt; @@ -218,8 +215,8 @@ void FunctionConfig::movePoint(int idx, QPointF pt) { // QList<QPointF> FunctionConfig::getPoints() { QList<QPointF> ret; - QMutexLocker foo(_mutex); - for (int i = 0; i < _points.size(); i++) { + QMutexLocker foo(&_mutex); + for (int i = 0; i < _points.size(); i++) { ret.append(_points[i]); } return ret; @@ -230,7 +227,7 @@ QList<QPointF> FunctionConfig::getPoints() { // Settings for a specific Curve are loaded from their own Group in the INI-file. // void FunctionConfig::loadSettings(QSettings& settings) { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); QPointF newPoint; QList<QPointF> points; @@ -266,7 +263,7 @@ void FunctionConfig::loadSettings(QSettings& settings) { // The number of Points is also saved, to make loading more convenient. // void FunctionConfig::saveSettings(QSettings& settings) { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); settings.beginGroup(QString("Curves-%1").arg(_title)); int max = _points.size(); settings.setValue("point-count", max); diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index f1310a8c..b6257df2 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -19,7 +19,7 @@ class FTNOIR_TRACKER_BASE_EXPORT FunctionConfig { private: - QMutex* _mutex; + QMutex _mutex; QList<QPointF> _points; void reload(); float* _data; @@ -47,7 +47,7 @@ public: // void removePoint(int i); void removeAllPoints() { - QMutexLocker foo(_mutex); + QMutexLocker foo(&_mutex); _points.clear(); reload(); } |