| 474 | } |
| 475 | |
| 476 | void DockLayout::setPrimaryDebuggerView(DebuggerView* widget, bool is_primary) |
| 477 | { |
| 478 | bool present = false; |
| 479 | for (auto& [unique_name, test_widget] : m_widgets) |
| 480 | { |
| 481 | if (test_widget.get() == widget) |
| 482 | { |
| 483 | present = true; |
| 484 | break; |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | if (!present) |
| 489 | return; |
| 490 | |
| 491 | if (is_primary) |
| 492 | { |
| 493 | // Set the passed widget as the primary widget. |
| 494 | for (auto& [unique_name, test_widget] : m_widgets) |
| 495 | { |
| 496 | if (strcmp(test_widget->metaObject()->className(), widget->metaObject()->className()) == 0) |
| 497 | { |
| 498 | test_widget->setPrimary(test_widget.get() == widget); |
| 499 | } |
| 500 | } |
| 501 | } |
| 502 | else if (widget->isPrimary()) |
| 503 | { |
| 504 | // Set an arbitrary widget as the primary widget. |
| 505 | bool next = true; |
| 506 | for (auto& [unique_name, test_widget] : m_widgets) |
| 507 | { |
| 508 | if (test_widget != widget && |
| 509 | strcmp(test_widget->metaObject()->className(), widget->metaObject()->className()) == 0) |
| 510 | { |
| 511 | test_widget->setPrimary(next); |
| 512 | next = false; |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | // If we haven't set another widget as the primary one we can't make |
| 517 | // this one not the primary one. |
| 518 | if (!next) |
| 519 | widget->setPrimary(false); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | void DockLayout::deleteFile() |
| 524 | { |
no test coverage detected