add a watchdog to keep the status updated
This commit is contained in:
parent
a34ada6da5
commit
e0fb4ccbb3
|
@ -39,15 +39,23 @@ UniverseWindow::UniverseWindow(QWidget *parent, std::shared_ptr<DMX::Universe> u
|
|||
: QMainWindow(parent)
|
||||
, ui(new Ui::UniverseWindow())
|
||||
, universe_(universe)
|
||||
, status_watchdog_(new QTimer(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// set the status watchdog to update the status if the universe
|
||||
// isn't showing frequent activity
|
||||
status_watchdog_->callOnTimeout([this](){update_status_();});
|
||||
status_watchdog_->setInterval(DMX::E111_DATA_LOSS_TIMEOUT / 10);
|
||||
status_watchdog_->start();
|
||||
|
||||
auto model = new UniverseModel(this, universe);
|
||||
ui->tableView->setModel(model);
|
||||
|
||||
// update the status bar whenever the universe refreshes
|
||||
connect(model, &UniverseModel::dataChanged, this, [this]() {
|
||||
update_status_();
|
||||
status_watchdog_->start();
|
||||
});
|
||||
|
||||
// add data format combobox to toolbar
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <universe.h>
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
|
@ -52,4 +53,5 @@ private:
|
|||
std::shared_ptr<DMX::Universe> universe_;
|
||||
|
||||
void update_status_();
|
||||
QTimer *status_watchdog_;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user