MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / getDashboardWidgets

Method getDashboardWidgets

app/src/SerialStudio.cpp:493–523  ·  view source on GitHub ↗

* @brief Retrieves a list of dashboard widgets for a specified JSON dataset. */

Source from the content-addressed store, hash-verified

491 * @brief Retrieves a list of dashboard widgets for a specified JSON dataset.
492 */
493QList<SerialStudio::DashboardWidget> SerialStudio::getDashboardWidgets(
494 const DataModel::Dataset& dataset)
495{
496 QList<DashboardWidget> list;
497
498 static const QHash<QString, DashboardWidget> kDatasetWidgetMap = {
499 {QStringLiteral("compass"), DashboardCompass},
500 { QStringLiteral("bar"), DashboardBar},
501 { QStringLiteral("gauge"), DashboardGauge},
502 { QStringLiteral("meter"), DashboardMeter},
503 };
504 const auto it = kDatasetWidgetMap.constFind(dataset.widget);
505 if (it != kDatasetWidgetMap.constEnd())
506 list.append(it.value());
507
508 if (dataset.plt)
509 list.append(DashboardPlot);
510
511 if (dataset.fft)
512 list.append(DashboardFFT);
513
514 if (dataset.led)
515 list.append(DashboardLED);
516
517#ifdef BUILD_COMMERCIAL
518 if (dataset.waterfall)
519 list.append(DashboardWaterfall);
520#endif
521
522 return list;
523}
524
525//--------------------------------------------------------------------------------------------------
526// Parsing & project model logic

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected