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

Method rebuildModel

app/src/UI/Taskbar.cpp:864–949  ·  view source on GitHub ↗

* @brief Rebuilds the taskbar's full and visible models from the latest dashboard frame. */

Source from the content-addressed store, hash-verified

862 * @brief Rebuilds the taskbar's full and visible models from the latest dashboard frame.
863 */
864void UI::Taskbar::rebuildModel()
865{
866 if (m_rebuildInProgress)
867 return;
868
869 m_focusCycleTimer.stop();
870 m_focusCycleQueue.clear();
871
872 m_rebuildInProgress = true;
873 {
874 QSignalBlocker fullBlocker(m_fullModel);
875 QSignalBlocker taskbarBlocker(m_taskbarButtons);
876
877 for (auto it = m_windowConnections.begin(); it != m_windowConnections.end(); ++it)
878 disconnect(*it);
879
880 m_windowConnections.clear();
881
882 m_windowIDs.clear();
883 m_fullModel->clear();
884 m_activeWindow = nullptr;
885 m_widgetIdToWindowId.clear();
886 m_windowIdToWidgetId.clear();
887 if (m_windowManager)
888 m_windowManager->clear();
889 }
890
891 auto* db = &UI::Dashboard::instance();
892
893 const auto& frame = db->processedFrame();
894 if (frame.title.isEmpty() || frame.groups.size() <= 0) {
895 setActiveGroupId(-1);
896 Q_EMIT fullModelChanged();
897 Q_EMIT windowStatesChanged();
898 Q_EMIT registeredWindowsChanged();
899 m_rebuildInProgress = false;
900 return;
901 }
902
903 QSet<int> groupIds;
904 for (const DataModel::Group& group : frame.groups) {
905 const auto groupId = group.groupId;
906 const auto groupName = group.title;
907 const auto groupType = SerialStudio::getDashboardWidget(group);
908 if (SerialStudio::isDashboardTool(groupType))
909 continue;
910
911 QList<int> windowIds;
912 QList<int> relativeIds;
913 QList<SerialStudio::DashboardWidget> widgetTypes;
914 collectGroupWidgetIds(groupId, windowIds, relativeIds, widgetTypes);
915
916 int mainWindowId = -1;
917 for (int i = 0; i < windowIds.count(); ++i) {
918 if (widgetTypes[i] != groupType)
919 continue;
920
921 mainWindowId = windowIds[i];

Callers

nothing calls this directly

Calls 7

beginMethod · 0.80
isEmptyMethod · 0.80
stopMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
countMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected