Use queued signals/slots for widgets

This commit is contained in:
Alex Spataru 2021-12-06 22:10:04 -06:00
parent 16a1b4b284
commit 8ff38efca4
14 changed files with 27 additions and 20 deletions

View File

@ -98,9 +98,10 @@ Console::Console()
// Read received data automatically
const auto dm = Manager::getInstance();
const auto te = Misc::TimerEvents::getInstance();
connect(te, SIGNAL(highFreqTimeout()), this, SLOT(displayData()));
connect(dm, &Manager::dataSent, this, &Console::onDataSent);
connect(dm, &Manager::dataReceived, this, &Console::onDataReceived);
connect(te, SIGNAL(highFreqTimeout()), this, SLOT(displayData()),
Qt::QueuedConnection);
}
/**

View File

@ -47,7 +47,8 @@ Server::Server()
const auto ge = JSON::Generator::getInstance();
const auto te = Misc::TimerEvents::getInstance();
connect(ge, &JSON::Generator::jsonChanged, this, &Server::registerFrame);
connect(te, &Misc::TimerEvents::highFreqTimeout, this, &Server::sendProcessedData);
connect(te, &Misc::TimerEvents::highFreqTimeout, this, &Server::sendProcessedData,
Qt::QueuedConnection);
// Send I/O "raw" data directly
const auto io = IO::Manager::getInstance();

View File

@ -48,10 +48,13 @@ Dashboard::Dashboard()
const auto io = IO::Manager::getInstance();
const auto ge = JSON::Generator::getInstance();
const auto te = Misc::TimerEvents::getInstance();
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData()));
connect(te, SIGNAL(highFreqTimeout()), this, SLOT(updateData()));
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()));
connect(ge, SIGNAL(jsonFileMapChanged()), this, SLOT(resetData()));
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData()), Qt::QueuedConnection);
connect(te, SIGNAL(highFreqTimeout()), this, SLOT(updateData()),
Qt::QueuedConnection);
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()),
Qt::QueuedConnection);
connect(ge, SIGNAL(jsonFileMapChanged()), this, SLOT(resetData()),
Qt::QueuedConnection);
connect(ge, &JSON::Generator::jsonChanged, this, &Dashboard::processLatestJSON);
}

View File

@ -71,7 +71,7 @@ Accelerometer::Accelerometer(const int index)
setWidget(&m_gauge);
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -82,8 +82,8 @@ Bar::Bar(const int index)
setWidget(&m_thermo, Qt::AlignHCenter, false);
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(this, SIGNAL(resized()), this, SLOT(onResized()));
connect(this, SIGNAL(resized()), this, SLOT(onResized()), Qt::QueuedConnection);
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -70,7 +70,7 @@ Compass::Compass(const int index)
setWidget(&m_compass);
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(update()));
connect(dash, SIGNAL(updated()), this, SLOT(update()), Qt::QueuedConnection);
}
/**

View File

@ -152,7 +152,7 @@ DataGroup::DataGroup(const int index)
setLayout(m_mainLayout);
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -131,7 +131,7 @@ FFTPlot::FFTPlot(const int index)
}
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -102,7 +102,7 @@ GPS::GPS(const int index)
setLayout(&m_layout);
// React to Qt signals
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -73,7 +73,7 @@ Gauge::Gauge(const int index)
setWidget(&m_gauge);
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -59,7 +59,7 @@ Gyroscope::Gyroscope(const int index)
m_timer.start();
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -125,7 +125,7 @@ LEDPanel::LEDPanel(const int index)
setLayout(m_mainLayout);
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
}
/**

View File

@ -118,8 +118,9 @@ MultiPlot::MultiPlot(const int index)
m_plot.show();
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(pointsChanged()), this, SLOT(updateRange()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
connect(dash, SIGNAL(pointsChanged()), this, SLOT(updateRange()),
Qt::QueuedConnection);
}
/**

View File

@ -117,8 +117,9 @@ Plot::Plot(const int index)
}
// React to dashboard events
connect(dash, SIGNAL(updated()), this, SLOT(updateData()));
connect(dash, SIGNAL(pointsChanged()), this, SLOT(updateRange()));
connect(dash, SIGNAL(updated()), this, SLOT(updateData()), Qt::QueuedConnection);
connect(dash, SIGNAL(pointsChanged()), this, SLOT(updateRange()),
Qt::QueuedConnection);
}
/**