| 829 | } |
| 830 | |
| 831 | void DockLayout::validatePrimaryDebuggerViews() |
| 832 | { |
| 833 | std::map<std::string, std::vector<DebuggerView*>> type_to_widgets; |
| 834 | for (const auto& [unique_name, widget] : m_widgets) |
| 835 | type_to_widgets[widget->metaObject()->className()].emplace_back(widget.get()); |
| 836 | |
| 837 | for (auto& [type, widgets] : type_to_widgets) |
| 838 | { |
| 839 | u32 primary_widgets = 0; |
| 840 | |
| 841 | // Make sure at most one widget is marked as primary. |
| 842 | for (DebuggerView* widget : widgets) |
| 843 | { |
| 844 | if (widget->isPrimary()) |
| 845 | { |
| 846 | if (primary_widgets != 0) |
| 847 | widget->setPrimary(false); |
| 848 | |
| 849 | primary_widgets++; |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | // If none of the widgets were marked as primary, just set the first one |
| 854 | // as the primary one. |
| 855 | if (primary_widgets == 0) |
| 856 | widgets[0]->setPrimary(true); |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | void DockLayout::setupDefaultLayout() |
| 861 | { |
nothing calls this directly
no test coverage detected