Browse Source

Add support for tuning on/off live updating

QGC4.4
Don Gagne 6 years ago
parent
commit
0378568d2b
  1. 19
      src/FactSystem/FactGroup.cc
  2. 3
      src/FactSystem/FactGroup.h

19
src/FactSystem/FactGroup.cc

@ -46,7 +46,8 @@ void FactGroup::_setupTimer() @@ -46,7 +46,8 @@ void FactGroup::_setupTimer()
if (_updateRateMSecs > 0) {
connect(&_updateTimer, &QTimer::timeout, this, &FactGroup::_updateAllValues);
_updateTimer.setSingleShot(false);
_updateTimer.start(_updateRateMSecs);
_updateTimer.setInterval(_updateRateMSecs);
_updateTimer.start();
}
}
@ -125,3 +126,19 @@ void FactGroup::_updateAllValues(void) @@ -125,3 +126,19 @@ void FactGroup::_updateAllValues(void)
fact->sendDeferredValueChangedSignal();
}
}
void FactGroup::setLiveUpdates(bool liveUpdates)
{
if (_updateTimer.interval() == 0) {
return;
}
if (liveUpdates) {
_updateTimer.stop();
} else {
_updateTimer.start();
}
for(Fact* fact: _nameToFactMap) {
fact->setSendValueChangedSignals(liveUpdates);
}
}

3
src/FactSystem/FactGroup.h

@ -38,6 +38,9 @@ public: @@ -38,6 +38,9 @@ public:
/// @return FactGroup for specified name, NULL if not found
Q_INVOKABLE FactGroup* getFactGroup(const QString& name);
/// Turning on live updates will allow value changes to flow through as they are received.
Q_INVOKABLE void setLiveUpdates(bool liveUpdates);
QStringList factNames(void) const { return _factNames; }
QStringList factGroupNames(void) const { return _nameToFactGroupMap.keys(); }

Loading…
Cancel
Save