| 637 | } |
| 638 | |
| 639 | void DockManager::resetLayoutClicked(DockLayout::Index layout_index) |
| 640 | { |
| 641 | if (layout_index >= m_layouts.size()) |
| 642 | return; |
| 643 | |
| 644 | DockLayout& layout = m_layouts[layout_index]; |
| 645 | if (!layout.canReset()) |
| 646 | return; |
| 647 | |
| 648 | const QString title = tr("Confirmation"); |
| 649 | const QString text = tr("Are you sure you want to reset layout '%1'?").arg(layout.name()); |
| 650 | |
| 651 | AsyncDialogs::question(g_debugger_window, title, text, [this, layout_index]() { |
| 652 | if (layout_index >= m_layouts.size()) |
| 653 | return; |
| 654 | |
| 655 | DockLayout& layout = m_layouts[layout_index]; |
| 656 | if (!layout.canReset()) |
| 657 | return; |
| 658 | |
| 659 | bool current_layout = layout_index == m_current_layout; |
| 660 | |
| 661 | if (current_layout) |
| 662 | switchToLayout(DockLayout::INVALID_INDEX); |
| 663 | |
| 664 | layout.reset(); |
| 665 | layout.save(layout_index); |
| 666 | |
| 667 | if (current_layout) |
| 668 | switchToLayout(layout_index); |
| 669 | }); |
| 670 | } |
| 671 | |
| 672 | void DockManager::deleteLayoutClicked(DockLayout::Index layout_index) |
| 673 | { |