summaryrefslogtreecommitdiffhomepage
path: root/qfunctionconfigurator
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-07 21:28:00 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-10-07 21:36:51 +0200
commit790a9cff9a25def2370186e2a56ed30fbdbf0195 (patch)
tree781db9eb1becd938b92f2ebd38daeabbe664f9b3 /qfunctionconfigurator
parent7233ba88c0cd55eeddc4453c612a7cce0a7d2da9 (diff)
qfc: no need to load lazily, it's received immediately
Diffstat (limited to 'qfunctionconfigurator')
-rw-r--r--qfunctionconfigurator/functionconfig.cpp20
-rw-r--r--qfunctionconfigurator/functionconfig.h5
2 files changed, 9 insertions, 16 deletions
diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp
index f2e81b17..b93a4cbf 100644
--- a/qfunctionconfigurator/functionconfig.cpp
+++ b/qfunctionconfigurator/functionconfig.cpp
@@ -19,18 +19,12 @@ Map::Map() :
_mutex(QMutex::Recursive),
activep(false),
max_x(0),
- max_y(0),
- lazy_reload(true)
+ max_y(0)
{
}
float Map::getValue(float x) {
QMutexLocker foo(&_mutex);
- if (lazy_reload)
- {
- lazy_reload = false;
- reload();
- }
float q = x * precision();
int xi = (int)q;
float yi = getValueInternal(xi);
@@ -151,14 +145,14 @@ void Map::removePoint(int i) {
if (i >= 0 && i < cur.input.size())
{
cur.input.removeAt(i);
- lazy_reload = true;
+ reload();
}
}
void Map::addPoint(QPointF pt) {
QMutexLocker foo(&_mutex);
cur.input.append(pt);
- lazy_reload = true;
+ reload();
qStableSort(cur.input.begin(), cur.input.end(), sortFn);
}
@@ -167,8 +161,8 @@ void Map::movePoint(int idx, QPointF pt) {
if (idx >= 0 && idx < cur.input.size())
{
cur.input[idx] = pt;
- lazy_reload = true;
- // we don't allow points to be reodered, so no sort here
+ reload();
+ // we don't allow points to be reordered, so no sort here
}
}
@@ -181,7 +175,7 @@ void Map::invalidate_unsaved_settings()
{
QMutexLocker foo(&_mutex);
cur = saved;
- lazy_reload = true;
+ reload();
}
void Map::loadSettings(QSettings& settings, const QString& title) {
@@ -210,7 +204,7 @@ void Map::loadSettings(QSettings& settings, const QString& title) {
points.append(QPointF(maxInput(), maxOutput()));
cur.input = points;
- lazy_reload = true;
+ reload();
saved = cur;
}
diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h
index 25e072d2..31aebdf6 100644
--- a/qfunctionconfigurator/functionconfig.h
+++ b/qfunctionconfigurator/functionconfig.h
@@ -37,7 +37,6 @@ private:
double max_y;
State cur, saved;
- bool lazy_reload;
public:
double maxInput() const { return max_x; }
double maxOutput() const { return max_y; }
@@ -46,7 +45,7 @@ public:
{
setMaxInput(maxx);
setMaxOutput(maxy);
- lazy_reload = true;
+ reload();
}
float getValue(float x);
@@ -55,7 +54,7 @@ public:
void removeAllPoints() {
QMutexLocker foo(&_mutex);
cur.input.clear();
- lazy_reload = true;
+ reload();
}
void addPoint(QPointF pt);