mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Avoid locking application event loop with queued events
This commit is contained in:
parent
df9044108c
commit
def9f91fb8
@ -133,9 +133,6 @@ Misc::ModuleManager::ModuleManager()
|
||||
// Stop modules when application is about to quit
|
||||
connect(&m_engine, &QQmlApplicationEngine::quit, this,
|
||||
&Misc::ModuleManager::onQuit);
|
||||
|
||||
// Use software rendering to avoid crashes
|
||||
QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "UI/Dashboard.h"
|
||||
#include "MQTT/Client.h"
|
||||
#include "Misc/CommonFonts.h"
|
||||
#include "Misc/TimerEvents.h"
|
||||
#include "JSON/FrameBuilder.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -50,16 +49,6 @@ UI::Dashboard::Dashboard()
|
||||
connect(&JSON::FrameBuilder::instance(),
|
||||
&JSON::FrameBuilder::jsonFileMapChanged, this,
|
||||
&UI::Dashboard::resetData);
|
||||
|
||||
// Update widgets at 20 Hz (max)
|
||||
connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout24Hz, this,
|
||||
[=] {
|
||||
if (m_updateRequired)
|
||||
{
|
||||
m_updateRequired = false;
|
||||
Q_EMIT updated();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -826,7 +815,6 @@ void UI::Dashboard::processFrame(const JSON::Frame &frame)
|
||||
|
||||
// Copy frame data
|
||||
m_currentFrame = frame;
|
||||
m_updateRequired = true;
|
||||
|
||||
// Regenerate plot data
|
||||
updatePlots();
|
||||
@ -908,6 +896,7 @@ void UI::Dashboard::processFrame(const JSON::Frame &frame)
|
||||
}
|
||||
|
||||
// Share the frame with other models
|
||||
Q_EMIT updated();
|
||||
Q_EMIT frameReceived(m_currentFrame);
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,6 @@ private:
|
||||
private:
|
||||
int m_points;
|
||||
int m_precision;
|
||||
bool m_updateRequired;
|
||||
AxisVisibility m_axisVisibility;
|
||||
|
||||
QVector<qreal> m_xData;
|
||||
|
@ -54,7 +54,7 @@ Widgets::Accelerometer::Accelerometer(const int index)
|
||||
|
||||
// React to dashboard events
|
||||
connect(dash, SIGNAL(updated()), this, SLOT(updateData()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,9 +59,9 @@ Widgets::Bar::Bar(const int index)
|
||||
|
||||
// React to dashboard events
|
||||
connect(this, SIGNAL(resized()), this, SLOT(onResized()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
connect(dash, SIGNAL(updated()), this, SLOT(updateData()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,7 @@ Widgets::Compass::Compass(const int index)
|
||||
|
||||
// Connect update signal
|
||||
connect(dash, &UI::Dashboard::updated, this, &Compass::update,
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ Widgets::DataGrid::DataGrid(const int index)
|
||||
|
||||
// React to dashboard events
|
||||
connect(dash, SIGNAL(updated()), this, SLOT(updateData()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,9 +82,9 @@ Widgets::FFTPlot::FFTPlot(int index)
|
||||
// Connect update signal
|
||||
onAxisOptionsChanged();
|
||||
connect(dash, &UI::Dashboard::updated, this, &FFTPlot::updateData,
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
connect(dash, &UI::Dashboard::axisVisibilityChanged, this,
|
||||
&FFTPlot::onAxisOptionsChanged, Qt::QueuedConnection);
|
||||
&FFTPlot::onAxisOptionsChanged, Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,7 @@ Widgets::GPS::GPS(const int index)
|
||||
|
||||
// React to Qt signals
|
||||
connect(dash, SIGNAL(updated()), this, SLOT(updateData()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ Widgets::Gauge::Gauge(const int index)
|
||||
|
||||
// React to dashboard events
|
||||
connect(dash, SIGNAL(updated()), this, SLOT(updateData()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ Widgets::Gyroscope::Gyroscope(const int index)
|
||||
|
||||
// React to dashboard events
|
||||
connect(dash, SIGNAL(updated()), this, SLOT(updateData()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +119,7 @@ Widgets::LEDPanel::LEDPanel(const int index)
|
||||
|
||||
// React to dashboard events
|
||||
connect(dash, SIGNAL(updated()), this, SLOT(updateData()),
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,11 +88,11 @@ Widgets::MultiPlot::MultiPlot(const int index)
|
||||
// React to dashboard events
|
||||
onAxisOptionsChanged();
|
||||
connect(dash, &UI::Dashboard::updated, this, &MultiPlot::updateData,
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
connect(dash, &UI::Dashboard::pointsChanged, this, &MultiPlot::updateRange,
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
connect(dash, &UI::Dashboard::axisVisibilityChanged, this,
|
||||
&MultiPlot::onAxisOptionsChanged, Qt::QueuedConnection);
|
||||
&MultiPlot::onAxisOptionsChanged, Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,11 +84,11 @@ Widgets::Plot::Plot(const int index)
|
||||
// React to dashboard events
|
||||
onAxisOptionsChanged();
|
||||
connect(dash, &UI::Dashboard::updated, this, &Plot::updateData,
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
connect(dash, &UI::Dashboard::pointsChanged, this, &Plot::updateRange,
|
||||
Qt::QueuedConnection);
|
||||
Qt::DirectConnection);
|
||||
connect(dash, &UI::Dashboard::axisVisibilityChanged, this,
|
||||
&Plot::onAxisOptionsChanged, Qt::QueuedConnection);
|
||||
&Plot::onAxisOptionsChanged, Qt::DirectConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user