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

Method reconfigureDashboard

app/src/UI/Dashboard.cpp:1695–1761  ·  view source on GitHub ↗

* @brief Reconfigures the dashboard layout and widgets based on the new frame. Time rings * and the per-source cache are snapshotted before resetData() and restored after, * so a cosmetic project edit that rebuilds the layout does not erase in-flight plot * history. */

Source from the content-addressed store, hash-verified

1693 * history.
1694 */
1695void UI::Dashboard::reconfigureDashboard(const DataModel::Frame& frame)
1696{
1697 Q_ASSERT(!frame.groups.empty());
1698 Q_ASSERT(streamAvailable());
1699
1700 const bool pro = SerialStudio::proWidgetsEnabled();
1701
1702 auto savedSourceFrames = m_sourceRawFrames;
1703 auto savedClocks = m_plotClocks;
1704
1705 auto savedPlotRings = snapshotPlotTimeRings();
1706 auto savedMultiplotRings = snapshotMultiplotTimeRings();
1707
1708 resetData(false);
1709
1710 m_sourceRawFrames = std::move(savedSourceFrames);
1711 m_plotClocks = std::move(savedClocks);
1712
1713 m_lastFrame = frame;
1714
1715 DataModel::Group terminal;
1716 terminal.widget = "terminal";
1717 terminal.title = tr("Console");
1718 terminal.groupId = m_lastFrame.groups.size();
1719 terminal.uniqueId = DataModel::runtime_group_unique_id(terminal.groupId);
1720 m_lastFrame.groups.push_back(terminal);
1721
1722#ifdef BUILD_COMMERCIAL
1723 DataModel::Group notif;
1724 notif.widget = "notification-log";
1725 notif.title = tr("Notifications");
1726 notif.groupId = m_lastFrame.groups.size();
1727 notif.uniqueId = DataModel::runtime_group_unique_id(notif.groupId);
1728 m_lastFrame.groups.push_back(notif);
1729#endif
1730
1731 DataModel::Group clock;
1732 clock.widget = "clock";
1733 clock.title = tr("Clock");
1734 clock.groupId = m_lastFrame.groups.size();
1735 clock.uniqueId = DataModel::runtime_group_unique_id(clock.groupId);
1736 m_lastFrame.groups.push_back(clock);
1737
1738 DataModel::Group stopwatch;
1739 stopwatch.widget = "stopwatch";
1740 stopwatch.title = tr("Stopwatch");
1741 stopwatch.groupId = m_lastFrame.groups.size();
1742 stopwatch.uniqueId = DataModel::runtime_group_unique_id(stopwatch.groupId);
1743 m_lastFrame.groups.push_back(stopwatch);
1744
1745 buildWidgetGroups(frame, pro);
1746
1747 registerWidgets();
1748
1749 buildDatasetReferences();
1750 buildValuePushes();
1751
1752 updateDataSeries();

Callers

nothing calls this directly

Calls 3

runtime_group_unique_idFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected