* @brief Retrieves a list of dashboard widgets for a specified JSON dataset. */
| 491 | * @brief Retrieves a list of dashboard widgets for a specified JSON dataset. |
| 492 | */ |
| 493 | QList<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 |