| 19 | DebuggerWindow* g_debugger_window = nullptr; |
| 20 | |
| 21 | DebuggerWindow::DebuggerWindow(QWidget* parent) |
| 22 | : KDDockWidgets::QtWidgets::MainWindow(QStringLiteral("DebuggerWindow"), {}, parent) |
| 23 | , m_dock_manager(new DockManager(this)) |
| 24 | { |
| 25 | m_ui.setupUi(this); |
| 26 | |
| 27 | g_debugger_window = this; |
| 28 | |
| 29 | setupDefaultToolBarState(); |
| 30 | setupFonts(); |
| 31 | restoreWindowGeometry(); |
| 32 | |
| 33 | m_dock_manager->loadLayouts(); |
| 34 | |
| 35 | connect(m_ui.actionAnalyse, &QAction::triggered, this, &DebuggerWindow::onAnalyse); |
| 36 | connect(m_ui.actionSettings, &QAction::triggered, this, &DebuggerWindow::onSettings); |
| 37 | connect(m_ui.actionGameSettings, &QAction::triggered, this, &DebuggerWindow::onGameSettings); |
| 38 | connect(m_ui.actionClose, &QAction::triggered, this, &DebuggerWindow::close); |
| 39 | |
| 40 | connect(m_ui.actionOnTop, &QAction::triggered, this, [this](bool checked) { |
| 41 | if (checked) |
| 42 | setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); |
| 43 | else |
| 44 | setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint); |
| 45 | show(); |
| 46 | }); |
| 47 | |
| 48 | connect(m_ui.actionRun, &QAction::triggered, this, &DebuggerWindow::onRunPause); |
| 49 | connect(m_ui.actionStepInto, &QAction::triggered, this, &DebuggerWindow::onStepInto); |
| 50 | connect(m_ui.actionStepOver, &QAction::triggered, this, &DebuggerWindow::onStepOver); |
| 51 | connect(m_ui.actionStepOut, &QAction::triggered, this, &DebuggerWindow::onStepOut); |
| 52 | |
| 53 | connect(m_ui.actionShutDown, &QAction::triggered, [this]() { |
| 54 | if (currentCPU() && currentCPU()->isAlive()) |
| 55 | g_emu_thread->shutdownVM(false); |
| 56 | }); |
| 57 | |
| 58 | connect(m_ui.actionReset, &QAction::triggered, [this]() { |
| 59 | if (currentCPU() && currentCPU()->isAlive()) |
| 60 | g_emu_thread->resetVM(); |
| 61 | }); |
| 62 | |
| 63 | connect(m_ui.menuTools, &QMenu::aboutToShow, this, [this]() { |
| 64 | m_dock_manager->createToolsMenu(m_ui.menuTools); |
| 65 | }); |
| 66 | |
| 67 | connect(m_ui.menuWindows, &QMenu::aboutToShow, this, [this]() { |
| 68 | m_dock_manager->createWindowsMenu(m_ui.menuWindows); |
| 69 | }); |
| 70 | |
| 71 | connect(m_ui.actionResetAllLayouts, &QAction::triggered, this, [this]() { |
| 72 | const QString title = tr("Confirmation"); |
| 73 | const QString text = tr("Are you sure you want to reset all layouts?"); |
| 74 | |
| 75 | AsyncDialogs::question(this, title, text, [this]() { |
| 76 | m_dock_manager->resetAllLayouts(); |
| 77 | }); |
| 78 | }); |
nothing calls this directly
no test coverage detected