| 603 | } |
| 604 | |
| 605 | void DockManager::editLayoutClicked(DockLayout::Index layout_index) |
| 606 | { |
| 607 | if (layout_index >= m_layouts.size()) |
| 608 | return; |
| 609 | |
| 610 | const DockLayout& layout = m_layouts[layout_index]; |
| 611 | |
| 612 | const auto name_validator = [this, layout_index](const QString& name) { |
| 613 | return !hasNameConflict(name, layout_index); |
| 614 | }; |
| 615 | |
| 616 | LayoutEditorDialog* dialog = new LayoutEditorDialog(layout.name(), layout.cpu(), name_validator, g_debugger_window); |
| 617 | dialog->setAttribute(Qt::WA_DeleteOnClose); |
| 618 | |
| 619 | connect(dialog, &QDialog::accepted, this, [this, layout_index, dialog, name_validator]() { |
| 620 | if (layout_index >= m_layouts.size()) |
| 621 | return; |
| 622 | |
| 623 | DockLayout& layout = m_layouts[layout_index]; |
| 624 | |
| 625 | if (!name_validator(dialog->name())) |
| 626 | return; |
| 627 | |
| 628 | layout.setName(dialog->name()); |
| 629 | layout.setCpu(dialog->cpu()); |
| 630 | |
| 631 | layout.save(layout_index); |
| 632 | |
| 633 | updateLayoutSwitcher(); |
| 634 | }); |
| 635 | |
| 636 | dialog->open(); |
| 637 | } |
| 638 | |
| 639 | void DockManager::resetLayoutClicked(DockLayout::Index layout_index) |
| 640 | { |