mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Work on #22
This commit is contained in:
parent
e9696a06cb
commit
8dcd401531
@ -63,22 +63,20 @@ GraphProvider::GraphProvider()
|
|||||||
qRegisterMetaType<QAbstractAxis *>();
|
qRegisterMetaType<QAbstractAxis *>();
|
||||||
qRegisterMetaType<QAbstractSeries *>();
|
qRegisterMetaType<QAbstractSeries *>();
|
||||||
|
|
||||||
// Update graph values as soon as JSON manager reads data
|
// Module signals/slots
|
||||||
auto cp = CSV::Player::getInstance();
|
auto cp = CSV::Player::getInstance();
|
||||||
auto io = IO::Manager::getInstance();
|
auto io = IO::Manager::getInstance();
|
||||||
|
auto co = IO::Console::getInstance();
|
||||||
|
auto ge = JSON::Generator::getInstance();
|
||||||
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData()));
|
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData()));
|
||||||
|
connect(ge, SIGNAL(jsonChanged()), this, SLOT(updateValues()));
|
||||||
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()));
|
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()));
|
||||||
|
connect(co, SIGNAL(enabledChanged()), this, SLOT(updateValues()));
|
||||||
|
|
||||||
// Avoid issues when CSV player goes backwards
|
// Avoid issues when CSV player goes backwards
|
||||||
connect(CSV::Player::getInstance(), SIGNAL(timestampChanged()),
|
connect(CSV::Player::getInstance(), SIGNAL(timestampChanged()),
|
||||||
this, SLOT(csvPlayerFixes()));
|
this, SLOT(csvPlayerFixes()));
|
||||||
|
|
||||||
// Update user interface at a frequency of ~40 Hz
|
|
||||||
m_timer.setInterval(1000 / 40);
|
|
||||||
m_timer.setTimerType(Qt::PreciseTimer);
|
|
||||||
connect(&m_timer, &QTimer::timeout, this, &GraphProvider::updateValues);
|
|
||||||
m_timer.start();
|
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
LOG_TRACE() << "Class initialized";
|
LOG_TRACE() << "Class initialized";
|
||||||
}
|
}
|
||||||
@ -211,11 +209,6 @@ void GraphProvider::updateValues()
|
|||||||
if (IO::Console::getInstance()->enabled())
|
if (IO::Console::getInstance()->enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Abort if not connected to device or reproducing CSV file
|
|
||||||
if (!IO::Manager::getInstance()->connected()
|
|
||||||
&& !CSV::Player::getInstance()->isPlaying())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Clear dataset & latest values list
|
// Clear dataset & latest values list
|
||||||
m_datasets.clear();
|
m_datasets.clear();
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#ifndef GRAPH_PROVIDER_H
|
#ifndef GRAPH_PROVIDER_H
|
||||||
#define GRAPH_PROVIDER_H
|
#define GRAPH_PROVIDER_H
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
@ -80,7 +79,6 @@ private slots:
|
|||||||
void csvPlayerFixes();
|
void csvPlayerFixes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTimer m_timer;
|
|
||||||
int m_prevFramePos;
|
int m_prevFramePos;
|
||||||
int m_displayedPoints;
|
int m_displayedPoints;
|
||||||
QVector<double> m_maximumValues;
|
QVector<double> m_maximumValues;
|
||||||
|
@ -43,17 +43,15 @@ static WidgetProvider *INSTANCE = Q_NULLPTR;
|
|||||||
*/
|
*/
|
||||||
WidgetProvider::WidgetProvider()
|
WidgetProvider::WidgetProvider()
|
||||||
{
|
{
|
||||||
// React to open/close of devices & files
|
// Module signals/slots
|
||||||
auto cp = CSV::Player::getInstance();
|
auto cp = CSV::Player::getInstance();
|
||||||
auto io = IO::Manager::getInstance();
|
auto io = IO::Manager::getInstance();
|
||||||
|
auto co = IO::Console::getInstance();
|
||||||
|
auto ge = JSON::Generator::getInstance();
|
||||||
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData()));
|
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData()));
|
||||||
|
connect(ge, SIGNAL(jsonChanged()), this, SLOT(updateModels()));
|
||||||
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()));
|
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()));
|
||||||
|
connect(co, SIGNAL(enabledChanged()), this, SLOT(updateModels()));
|
||||||
// Update user interface at a frequency of ~40 Hz
|
|
||||||
m_timer.setInterval(1000 / 40);
|
|
||||||
m_timer.setTimerType(Qt::PreciseTimer);
|
|
||||||
connect(&m_timer, &QTimer::timeout, this, &WidgetProvider::updateModels);
|
|
||||||
m_timer.start();
|
|
||||||
|
|
||||||
// Look like a pro
|
// Look like a pro
|
||||||
LOG_TRACE() << "Class initialized";
|
LOG_TRACE() << "Class initialized";
|
||||||
@ -416,11 +414,6 @@ void WidgetProvider::updateModels()
|
|||||||
if (IO::Console::getInstance()->enabled())
|
if (IO::Console::getInstance()->enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Abort if not connected to device or reproducing CSV file
|
|
||||||
if (!IO::Manager::getInstance()->connected()
|
|
||||||
&& !CSV::Player::getInstance()->isPlaying())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Clear current groups
|
// Clear current groups
|
||||||
m_barDatasets.clear();
|
m_barDatasets.clear();
|
||||||
m_mapGroups.clear();
|
m_mapGroups.clear();
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#define WIDGETPROVIDER_H
|
#define WIDGETPROVIDER_H
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QTimer>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <JSON/Frame.h>
|
#include <JSON/Frame.h>
|
||||||
|
|
||||||
@ -88,7 +87,6 @@ private:
|
|||||||
QList<JSON::Dataset *> getWidgetDatasets(const QString &handle);
|
QList<JSON::Dataset *> getWidgetDatasets(const QString &handle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTimer m_timer;
|
|
||||||
QList<JSON::Group *> m_mapGroups;
|
QList<JSON::Group *> m_mapGroups;
|
||||||
QList<JSON::Group *> m_gyroGroups;
|
QList<JSON::Group *> m_gyroGroups;
|
||||||
QList<JSON::Dataset *> m_barDatasets;
|
QList<JSON::Dataset *> m_barDatasets;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user