The Dashboard class.
More...
#include <Dashboard.h>
|
enum class | WidgetType {
Group
, MultiPlot
, FFT
, Plot
,
Bar
, Gauge
, Compass
, Gyroscope
,
Accelerometer
, GPS
, LED
, Unknown
} |
|
|
void | setPoints (const int points) |
|
void | setPrecision (const int precision) |
|
void | setBarVisible (const int index, const bool visible) |
|
void | setFFTVisible (const int index, const bool visible) |
|
void | setGpsVisible (const int index, const bool visible) |
|
void | setLedVisible (const int index, const bool visible) |
|
void | setPlotVisible (const int index, const bool visible) |
|
void | setGroupVisible (const int index, const bool visible) |
|
void | setGaugeVisible (const int index, const bool visible) |
|
void | setCompassVisible (const int index, const bool visible) |
|
void | setGyroscopeVisible (const int index, const bool visible) |
|
void | setMultiplotVisible (const int index, const bool visible) |
|
void | setAccelerometerVisible (const int index, const bool visible) |
|
The Dashboard class.
The Dashboard
class receives data from the JSON::Generator
class and builds the vector modules used by the QML user interface and the C++ widgets to display the current frame.
This class is very large, but its really simple to understand. Most of the code here is repeated in order to support all the widgets implemented by Serial Studio.
The important functions are:
The rest of the functions of this class rely on the procedures above in order to implement common functionality features for each widget type.
◆ WidgetType
Enumerator |
---|
Group | |
MultiPlot | |
FFT | |
Plot | |
Bar | |
Gauge | |
Compass | |
Gyroscope | |
Accelerometer | |
GPS | |
LED | |
Unknown | |
◆ Dashboard() [1/3]
UI::Dashboard::Dashboard |
( |
| ) |
|
|
explicitprivate |
Constructor of the class.
◆ Dashboard() [2/3]
◆ Dashboard() [3/3]
UI::Dashboard::Dashboard |
( |
const Dashboard & |
| ) |
|
|
privatedelete |
◆ accelerometerCount()
int UI::Dashboard::accelerometerCount |
( |
| ) |
const |
◆ accelerometerTitles()
◆ accelerometerVisible()
bool UI::Dashboard::accelerometerVisible |
( |
const int |
index | ) |
const |
◆ available()
bool UI::Dashboard::available |
( |
| ) |
|
◆ barCount()
int UI::Dashboard::barCount |
( |
| ) |
const |
◆ barTitles()
◆ barVisible()
bool UI::Dashboard::barVisible |
( |
const int |
index | ) |
const |
◆ compassCount()
int UI::Dashboard::compassCount |
( |
| ) |
const |
◆ compassTitles()
◆ compassVisible()
bool UI::Dashboard::compassVisible |
( |
const int |
index | ) |
const |
◆ currentFrame()
◆ dataReset
void UI::Dashboard::dataReset |
( |
| ) |
|
|
signal |
◆ datasetTitles()
Returns the titles of the datasets contained in the specified vector.
◆ fftCount()
int UI::Dashboard::fftCount |
( |
| ) |
const |
◆ fftPlotValues()
const QVector< PlotData > & UI::Dashboard::fftPlotValues |
( |
| ) |
|
|
inline |
◆ fftTitles()
◆ fftVisible()
bool UI::Dashboard::fftVisible |
( |
const int |
index | ) |
const |
◆ frameValid()
bool UI::Dashboard::frameValid |
( |
| ) |
const |
Returns true
if the current JSON frame is valid and ready-to-use by the QML interface.
◆ gaugeCount()
int UI::Dashboard::gaugeCount |
( |
| ) |
const |
◆ gaugeTitles()
◆ gaugeVisible()
bool UI::Dashboard::gaugeVisible |
( |
const int |
index | ) |
const |
◆ getAccelerometer()
const JSON::Group & UI::Dashboard::getAccelerometer |
( |
const int |
index | ) |
const |
◆ getBar()
const JSON::Dataset & UI::Dashboard::getBar |
( |
const int |
index | ) |
const |
◆ getCompass()
const JSON::Dataset & UI::Dashboard::getCompass |
( |
const int |
index | ) |
const |
◆ getFFT()
const JSON::Dataset & UI::Dashboard::getFFT |
( |
const int |
index | ) |
const |
◆ getFFTWidgets()
Returns a vector with all the datasets that need to be shown in the FFT widgets.
◆ getGauge()
const JSON::Dataset & UI::Dashboard::getGauge |
( |
const int |
index | ) |
const |
◆ getGPS()
const JSON::Group & UI::Dashboard::getGPS |
( |
const int |
index | ) |
const |
◆ getGroups()
const JSON::Group & UI::Dashboard::getGroups |
( |
const int |
index | ) |
const |
◆ getGyroscope()
const JSON::Group & UI::Dashboard::getGyroscope |
( |
const int |
index | ) |
const |
◆ getLED()
const JSON::Group & UI::Dashboard::getLED |
( |
const int |
index | ) |
const |
◆ getLEDWidgets()
QVector< JSON::Group > UI::Dashboard::getLEDWidgets |
( |
| ) |
|
|
private |
Returns a group with all the datasets that need to be shown in the LED status panel.
- Note
- We return a vector with a single group item because we want to display a title on the window without breaking the current software architecture.
◆ getMultiplot()
const JSON::Group & UI::Dashboard::getMultiplot |
( |
const int |
index | ) |
const |
◆ getPlot()
const JSON::Dataset & UI::Dashboard::getPlot |
( |
const int |
index | ) |
const |
◆ getPlotWidgets()
Returns a vector with all the datasets that need to be plotted.
◆ getVisibility()
bool UI::Dashboard::getVisibility |
( |
const QVector< bool > & |
vector, |
|
|
const int |
index |
|
) |
| const |
|
private |
Returns true
if the widget at the specifed index of the vector should be displayed in the QML user interface.
◆ getWidgetDatasets()
QVector< JSON::Dataset > UI::Dashboard::getWidgetDatasets |
( |
const QString & |
handle | ) |
|
|
private |
Returns a vector with all the datasets that implement a widget with the specified handle.
◆ getWidgetGroups()
QVector< JSON::Group > UI::Dashboard::getWidgetGroups |
( |
const QString & |
handle | ) |
|
|
private |
Returns a vector with all the groups that implement the widget with the specied handle.
◆ gpsCount()
int UI::Dashboard::gpsCount |
( |
| ) |
const |
◆ gpsTitles()
◆ gpsVisible()
bool UI::Dashboard::gpsVisible |
( |
const int |
index | ) |
const |
◆ groupCount()
int UI::Dashboard::groupCount |
( |
| ) |
const |
◆ groupTitles() [1/2]
◆ groupTitles() [2/2]
Returns the titles of the groups contained in the specified vector.
◆ groupVisible()
bool UI::Dashboard::groupVisible |
( |
const int |
index | ) |
const |
◆ gyroscopeCount()
int UI::Dashboard::gyroscopeCount |
( |
| ) |
const |
◆ gyroscopeTitles()
◆ gyroscopeVisible()
bool UI::Dashboard::gyroscopeVisible |
( |
const int |
index | ) |
const |
◆ instance()
Returns a pointer to the only instance of the class.
◆ ledCount()
int UI::Dashboard::ledCount |
( |
| ) |
const |
◆ ledTitles()
◆ ledVisible()
bool UI::Dashboard::ledVisible |
( |
const int |
index | ) |
const |
◆ linearPlotValues()
const QVector< PlotData > & UI::Dashboard::linearPlotValues |
( |
| ) |
|
|
inline |
◆ monoFont()
QFont UI::Dashboard::monoFont |
( |
| ) |
const |
◆ multiPlotCount()
int UI::Dashboard::multiPlotCount |
( |
| ) |
const |
◆ multiPlotTitles()
◆ multiPlotVisible()
bool UI::Dashboard::multiPlotVisible |
( |
const int |
index | ) |
const |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ plotCount()
int UI::Dashboard::plotCount |
( |
| ) |
const |
◆ plotTitles()
◆ plotVisible()
bool UI::Dashboard::plotVisible |
( |
const int |
index | ) |
const |
◆ points()
int UI::Dashboard::points |
( |
| ) |
const |
Returns the number of points displayed by the graphs
◆ pointsChanged
void UI::Dashboard::pointsChanged |
( |
| ) |
|
|
signal |
◆ precision()
int UI::Dashboard::precision |
( |
| ) |
const |
Returns the number of decimal digits displayed by the widgets
◆ precisionChanged
void UI::Dashboard::precisionChanged |
( |
| ) |
|
|
signal |
◆ processLatestJSON
void UI::Dashboard::processLatestJSON |
( |
const QJsonObject & |
json | ) |
|
|
privateslot |
Regenerates the data displayed on the dashboard widgets
◆ relativeIndex()
int UI::Dashboard::relativeIndex |
( |
const int |
globalIndex | ) |
const |
Returns the widget-specific index for the widget with the specified index.
To simplify operations and user interface generation in QML, this class represents the widgets in two manners:
- A global list of all widgets
- A widget-specific list for each type of widget
The global index allows us to use the WidgetLoader
class to load any type of widget, which reduces the need of implementing QML-specific code for each widget that Serial Studio implements.
The relative index is used by the visibility switches in the QML user interface.
We need to be careful to sincronize the order of the widgets in order to allow the global-index system to work correctly.
◆ resetData
void UI::Dashboard::resetData |
( |
| ) |
|
|
privateslot |
Removes all available data from the UI when the device is disconnected or the CSV file is closed.
◆ setAccelerometerVisible
void UI::Dashboard::setAccelerometerVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setBarVisible
void UI::Dashboard::setBarVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setCompassVisible
void UI::Dashboard::setCompassVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setFFTVisible
void UI::Dashboard::setFFTVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setGaugeVisible
void UI::Dashboard::setGaugeVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setGpsVisible
void UI::Dashboard::setGpsVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setGroupVisible
void UI::Dashboard::setGroupVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setGyroscopeVisible
void UI::Dashboard::setGyroscopeVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setLedVisible
void UI::Dashboard::setLedVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setMultiplotVisible
void UI::Dashboard::setMultiplotVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setPlotVisible
void UI::Dashboard::setPlotVisible |
( |
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
slot |
◆ setPoints
void UI::Dashboard::setPoints |
( |
const int |
points | ) |
|
|
slot |
◆ setPrecision
void UI::Dashboard::setPrecision |
( |
const int |
precision | ) |
|
|
slot |
◆ setVisibility()
void UI::Dashboard::setVisibility |
( |
QVector< bool > & |
vector, |
|
|
const int |
index, |
|
|
const bool |
visible |
|
) |
| |
|
private |
Changes the visible flag of the widget at the specified index of the given vector. Calling this function with visible set to false
will hide the widget in the QML user interface.
◆ title()
QString UI::Dashboard::title |
( |
| ) |
|
◆ titleChanged
void UI::Dashboard::titleChanged |
( |
| ) |
|
|
signal |
◆ totalWidgetCount()
int UI::Dashboard::totalWidgetCount |
( |
| ) |
const |
Returns the total number of widgets that compose the current JSON frame. This function is used as a helper to the functions that use the global-index widget system.
In the case of this function, we do not care about the order of the items that generate the summatory count of all widgets. But in the other global-index functions we need to be careful to sincronize the order of the widgets in order to allow the global-index system to work correctly.
◆ updated
void UI::Dashboard::updated |
( |
| ) |
|
|
signal |
◆ updatePlots
void UI::Dashboard::updatePlots |
( |
| ) |
|
|
privateslot |
Regenerates the data displayed on the dashboard plots
◆ widgetCountChanged
void UI::Dashboard::widgetCountChanged |
( |
| ) |
|
|
signal |
◆ widgetIcon()
QString UI::Dashboard::widgetIcon |
( |
const int |
globalIndex | ) |
const |
Returns the appropiate SVG-icon to load for the widget at the specified globalIndex.
To simplify operations and user interface generation in QML, this class represents the widgets in two manners:
- A global list of all widgets
- A widget-specific list for each type of widget
The global index allows us to use the WidgetLoader
class to load any type of widget, which reduces the need of implementing QML-specific code for each widget that Serial Studio implements.
We need to be careful to sincronize the order of the widgets in order to allow the global-index system to work correctly.
◆ widgetTitles()
Returns a list
with the titles of all the widgets that compose the current JSON frame.
We need to be careful to sincronize the order of the widgets in order to allow the global-index system to work correctly.
◆ widgetType()
Returns the type of widget that corresponds to the given globalIndex.
Possible return values are:
To simplify operations and user interface generation in QML, this class represents the widgets in two manners:
- A global list of all widgets
- A widget-specific list for each type of widget
The global index allows us to use the WidgetLoader
class to load any type of widget, which reduces the need of implementing QML-specific code for each widget that Serial Studio implements.
We need to be careful to sincronize the order of the widgets in order to allow the global-index system to work correctly.
◆ widgetVisibilityChanged
void UI::Dashboard::widgetVisibilityChanged |
( |
| ) |
|
|
signal |
◆ widgetVisible()
bool UI::Dashboard::widgetVisible |
( |
const int |
globalIndex | ) |
const |
Returns true
if the widget with the specifed globalIndex should be displayed in the QML user interface.
To simplify operations and user interface generation in QML, this class represents the widgets in two manners:
- A global list of all widgets
- A widget-specific list for each type of widget
The global index allows us to use the WidgetLoader
class to load any type of widget, which reduces the need of implementing QML-specific code for each widget that Serial Studio implements.
We need to be careful to sincronize the order of the widgets in order to allow the global-index system to work correctly.
◆ xPlotValues()
const PlotData & UI::Dashboard::xPlotValues |
( |
| ) |
|
|
inline |
◆ m_accelerometerVisibility
QVector<bool> UI::Dashboard::m_accelerometerVisibility |
|
private |
◆ m_accelerometerWidgets
QVector<JSON::Group> UI::Dashboard::m_accelerometerWidgets |
|
private |
◆ m_barVisibility
QVector<bool> UI::Dashboard::m_barVisibility |
|
private |
◆ m_barWidgets
◆ m_compassVisibility
QVector<bool> UI::Dashboard::m_compassVisibility |
|
private |
◆ m_compassWidgets
◆ m_currentFrame
◆ m_fftPlotValues
QVector<PlotData> UI::Dashboard::m_fftPlotValues |
|
private |
◆ m_fftVisibility
QVector<bool> UI::Dashboard::m_fftVisibility |
|
private |
◆ m_fftWidgets
◆ m_gaugeVisibility
QVector<bool> UI::Dashboard::m_gaugeVisibility |
|
private |
◆ m_gaugeWidgets
◆ m_gpsVisibility
QVector<bool> UI::Dashboard::m_gpsVisibility |
|
private |
◆ m_gpsWidgets
◆ m_groupVisibility
QVector<bool> UI::Dashboard::m_groupVisibility |
|
private |
◆ m_groupWidgets
◆ m_gyroscopeVisibility
QVector<bool> UI::Dashboard::m_gyroscopeVisibility |
|
private |
◆ m_gyroscopeWidgets
◆ m_ledVisibility
QVector<bool> UI::Dashboard::m_ledVisibility |
|
private |
◆ m_ledWidgets
◆ m_linearPlotValues
QVector<PlotData> UI::Dashboard::m_linearPlotValues |
|
private |
◆ m_multiplotValues
QVector<QVector<PlotData> > UI::Dashboard::m_multiplotValues |
|
private |
◆ m_multiPlotVisibility
QVector<bool> UI::Dashboard::m_multiPlotVisibility |
|
private |
◆ m_multiPlotWidgets
◆ m_plotVisibility
QVector<bool> UI::Dashboard::m_plotVisibility |
|
private |
◆ m_plotWidgets
◆ m_points
int UI::Dashboard::m_points |
|
private |
◆ m_precision
int UI::Dashboard::m_precision |
|
private |
◆ m_xData
◆ accelerometerCount
int UI::Dashboard::accelerometerCount |
|
read |
◆ accelerometerTitles
◆ available
bool UI::Dashboard::available |
|
read |
Returns true
if there is any data available to generate the QML dashboard.
◆ barCount
int UI::Dashboard::barCount |
|
read |
◆ barTitles
◆ compassCount
int UI::Dashboard::compassCount |
|
read |
◆ compassTitles
◆ fftCount
int UI::Dashboard::fftCount |
|
read |
◆ fftTitles
◆ gaugeCount
int UI::Dashboard::gaugeCount |
|
read |
◆ gaugeTitles
◆ gpsCount
int UI::Dashboard::gpsCount |
|
read |
◆ gpsTitles
◆ groupCount
int UI::Dashboard::groupCount |
|
read |
◆ groupTitles
◆ gyroscopeCount
int UI::Dashboard::gyroscopeCount |
|
read |
◆ gyroscopeTitles
◆ ledCount
int UI::Dashboard::ledCount |
|
read |
◆ ledTitles
◆ multiPlotCount
int UI::Dashboard::multiPlotCount |
|
read |
◆ multiPlotTitles
◆ plotCount
int UI::Dashboard::plotCount |
|
read |
◆ plotTitles
◆ points
int UI::Dashboard::points |
|
readwrite |
◆ precision
int UI::Dashboard::precision |
|
readwrite |
◆ title
QString UI::Dashboard::title |
|
read |
Returns the title of the current JSON project/frame.
◆ totalWidgetCount
int UI::Dashboard::totalWidgetCount |
|
read |
The documentation for this class was generated from the following files:
- /Users/alex/Documents/GitHub/Serial-Studio/src/UI/Dashboard.h
- /Users/alex/Documents/GitHub/Serial-Studio/src/UI/Dashboard.cpp