diff options
Diffstat (limited to 'src/osd/modules/debugger/qt/dasmwindow.cpp')
-rw-r--r-- | src/osd/modules/debugger/qt/dasmwindow.cpp | 85 |
1 files changed, 42 insertions, 43 deletions
diff --git a/src/osd/modules/debugger/qt/dasmwindow.cpp b/src/osd/modules/debugger/qt/dasmwindow.cpp index 52b33b50da8..4eee8d86fb1 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.cpp +++ b/src/osd/modules/debugger/qt/dasmwindow.cpp @@ -1,12 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Andrew Gardner #include "emu.h" -#include <QtWidgets/QHBoxLayout> -#include <QtWidgets/QVBoxLayout> -#include <QtWidgets/QAction> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> - #include "dasmwindow.h" #include "debug/debugcon.h" @@ -14,13 +8,19 @@ #include "debug/dvdisasm.h" #include "debug/points.h" +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QAction> +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> + -DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : +DasmWindow::DasmWindow(running_machine &machine, QWidget *parent) : WindowQt(machine, nullptr) { setWindowTitle("Debug: Disassembly View"); - if (parent != nullptr) + if (parent) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); @@ -29,10 +29,10 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : // // The main frame and its input and log widgets // - QFrame* mainWindowFrame = new QFrame(this); + QFrame *mainWindowFrame = new QFrame(this); // The top frame & groupbox that contains the input widgets - QFrame* topSubFrame = new QFrame(mainWindowFrame); + QFrame *topSubFrame = new QFrame(mainWindowFrame); // The input edit m_inputEdit = new QLineEdit(topSubFrame); @@ -42,28 +42,27 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : m_cpuComboBox = new QComboBox(topSubFrame); m_cpuComboBox->setObjectName("cpu"); m_cpuComboBox->setMinimumWidth(300); - connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged); + connect(m_cpuComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged); // The main disasm window m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this); connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated); // Force a recompute of the disassembly region - downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc"); + downcast<debug_view_disasm *>(m_dasmView->view())->set_expression("curpc"); - // Populate the combo box & set the proper cpu + // Populate the combo box & set the proper CPU populateComboBox(); setToCurrentCpu(); - // Layout - QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame); + QHBoxLayout *subLayout = new QHBoxLayout(topSubFrame); subLayout->addWidget(m_inputEdit); subLayout->addWidget(m_cpuComboBox); subLayout->setSpacing(3); subLayout->setContentsMargins(2,2,2,2); - QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame); + QVBoxLayout *vLayout = new QVBoxLayout(mainWindowFrame); vLayout->setSpacing(3); vLayout->setContentsMargins(2,2,2,2); vLayout->addWidget(topSubFrame); @@ -86,11 +85,11 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::runToCursor); // Right bar options - QActionGroup* rightBarGroup = new QActionGroup(this); + QActionGroup *rightBarGroup = new QActionGroup(this); rightBarGroup->setObjectName("rightbargroup"); - QAction* rightActRaw = new QAction("Raw Opcodes", this); - QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this); - QAction* rightActComments = new QAction("Comments", this); + QAction *rightActRaw = new QAction("Raw Opcodes", this); + QAction *rightActEncrypted = new QAction("Encrypted Opcodes", this); + QAction *rightActComments = new QAction("Comments", this); rightActRaw->setCheckable(true); rightActEncrypted->setCheckable(true); rightActComments->setCheckable(true); @@ -104,7 +103,7 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : connect(rightBarGroup, &QActionGroup::triggered, this, &DasmWindow::rightBarChanged); // Assemble the options menu - QMenu* optionsMenu = menuBar()->addMenu("&Options"); + QMenu *optionsMenu = menuBar()->addMenu("&Options"); optionsMenu->addAction(m_breakpointToggleAct); optionsMenu->addAction(m_breakpointEnableAct); optionsMenu->addAction(m_runToCursorAct); @@ -128,7 +127,7 @@ void DasmWindow::cpuChanged(int index) void DasmWindow::expressionSubmitted() { const QString expression = m_inputEdit->text(); - downcast<debug_view_disasm*>(m_dasmView->view())->set_expression(expression.toLocal8Bit().data()); + downcast<debug_view_disasm *>(m_dasmView->view())->set_expression(expression.toLocal8Bit().data()); m_dasmView->viewport()->update(); } @@ -145,19 +144,19 @@ void DasmWindow::toggleBreakpointAtCursor(bool changedTo) const debug_breakpoint *bp = cpuinfo->breakpoint_find(address); // If none exists, add a new one - if (bp == nullptr) + if (!bp) { int32_t bpindex = cpuinfo->breakpoint_set(address, nullptr, nullptr); - m_machine->debugger().console().printf("Breakpoint %X set\n", bpindex); + m_machine.debugger().console().printf("Breakpoint %X set\n", bpindex); } else { int32_t bpindex = bp->index(); cpuinfo->breakpoint_clear(bpindex); - m_machine->debugger().console().printf("Breakpoint %X cleared\n", bpindex); + m_machine.debugger().console().printf("Breakpoint %X cleared\n", bpindex); } - m_machine->debug_view().update_all(); - m_machine->debugger().refresh_display(); + m_machine.debug_view().update_all(); + m_machine.debugger().refresh_display(); } refreshAll(); @@ -175,12 +174,12 @@ void DasmWindow::enableBreakpointAtCursor(bool changedTo) // Find an existing breakpoint at this address const debug_breakpoint *bp = cpuinfo->breakpoint_find(address); - if (bp != nullptr) + if (bp) { cpuinfo->breakpoint_enable(bp->index(), !bp->enabled()); - m_machine->debugger().console().printf("Breakpoint %X %s\n", (uint32_t)bp->index(), bp->enabled() ? "enabled" : "disabled"); - m_machine->debug_view().update_all(); - m_machine->debugger().refresh_display(); + m_machine.debugger().console().printf("Breakpoint %X %s\n", (uint32_t)bp->index(), bp->enabled() ? "enabled" : "disabled"); + m_machine.debug_view().update_all(); + m_machine.debugger().refresh_display(); } } @@ -192,7 +191,7 @@ void DasmWindow::runToCursor(bool changedTo) { if (m_dasmView->view()->cursor_visible()) { - offs_t const address = downcast<debug_view_disasm*>(m_dasmView->view())->selected_address(); + offs_t const address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address(); m_dasmView->view()->source()->device()->debug()->go(address); } } @@ -231,7 +230,7 @@ void DasmWindow::dasmViewUpdated() // Find an existing breakpoint at this address const debug_breakpoint *bp = cpuinfo->breakpoint_find(address); - if (bp != nullptr) + if (bp) { haveBreakpoint = true; breakpointEnabled = bp->enabled(); @@ -248,7 +247,7 @@ void DasmWindow::dasmViewUpdated() void DasmWindow::populateComboBox() { - if (m_dasmView == nullptr) + if (!m_dasmView) return; m_cpuComboBox->clear(); @@ -261,7 +260,7 @@ void DasmWindow::populateComboBox() void DasmWindow::setToCurrentCpu() { - device_t* curCpu = m_machine->debugger().console().get_visible_cpu(); + device_t *curCpu = m_machine.debugger().console().get_visible_cpu(); if (curCpu) { const debug_view_source *source = m_dasmView->view()->source_for_device(curCpu); @@ -277,14 +276,14 @@ void DasmWindow::setToCurrentCpu() //========================================================================= // DasmWindowQtConfig //========================================================================= -void DasmWindowQtConfig::buildFromQWidget(QWidget* widget) +void DasmWindowQtConfig::buildFromQWidget(QWidget *widget) { WindowQtConfig::buildFromQWidget(widget); - DasmWindow* window = dynamic_cast<DasmWindow*>(widget); - QComboBox* cpu = window->findChild<QComboBox*>("cpu"); + DasmWindow *window = dynamic_cast<DasmWindow *>(widget); + QComboBox *cpu = window->findChild<QComboBox *>("cpu"); m_cpu = cpu->currentIndex(); - QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); + QActionGroup *rightBarGroup = window->findChild<QActionGroup *>("rightbargroup"); if (rightBarGroup->checkedAction()->text() == "Raw Opcodes") m_rightBar = 0; else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes") @@ -293,14 +292,14 @@ void DasmWindowQtConfig::buildFromQWidget(QWidget* widget) m_rightBar = 2; } -void DasmWindowQtConfig::applyToQWidget(QWidget* widget) +void DasmWindowQtConfig::applyToQWidget(QWidget *widget) { WindowQtConfig::applyToQWidget(widget); - DasmWindow* window = dynamic_cast<DasmWindow*>(widget); - QComboBox* cpu = window->findChild<QComboBox*>("cpu"); + DasmWindow *window = dynamic_cast<DasmWindow *>(widget); + QComboBox *cpu = window->findChild<QComboBox *>("cpu"); cpu->setCurrentIndex(m_cpu); - QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); + QActionGroup *rightBarGroup = window->findChild<QActionGroup *>("rightbargroup"); rightBarGroup->actions()[m_rightBar]->trigger(); } |