Commit 0378568d authored by Don Gagne's avatar Don Gagne

parent 6982e89e
...@@ -46,7 +46,8 @@ void FactGroup::_setupTimer() ...@@ -46,7 +46,8 @@ void FactGroup::_setupTimer()
if (_updateRateMSecs > 0) { if (_updateRateMSecs > 0) {
connect(&_updateTimer, &QTimer::timeout, this, &FactGroup::_updateAllValues); connect(&_updateTimer, &QTimer::timeout, this, &FactGroup::_updateAllValues);
_updateTimer.setSingleShot(false); _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(); 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);
}
}
...@@ -38,6 +38,9 @@ public: ...@@ -38,6 +38,9 @@ public:
/// @return FactGroup for specified name, NULL if not found /// @return FactGroup for specified name, NULL if not found
Q_INVOKABLE FactGroup* getFactGroup(const QString& name); 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 factNames(void) const { return _factNames; }
QStringList factGroupNames(void) const { return _nameToFactGroupMap.keys(); } QStringList factGroupNames(void) const { return _nameToFactGroupMap.keys(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment