debugger_frame: remove pause button

and move its functionality to run button
This commit is contained in:
Megamouse 2017-07-11 17:31:37 +02:00 committed by Ani
parent 34709eb399
commit 06f6ac66fa
2 changed files with 20 additions and 19 deletions

View file

@ -31,8 +31,7 @@ debugger_frame::debugger_frame(QWidget *parent) : QDockWidget(tr("Debugger"), pa
m_go_to_addr = new QPushButton(tr("Go To Address"), this); m_go_to_addr = new QPushButton(tr("Go To Address"), this);
m_go_to_pc = new QPushButton(tr("Go To PC"), this); m_go_to_pc = new QPushButton(tr("Go To PC"), this);
m_btn_step = new QPushButton(tr("Step"), this); m_btn_step = new QPushButton(tr("Step"), this);
m_btn_run = new QPushButton(tr("Run"), this); m_btn_run = new QPushButton(Run, this);
m_btn_pause = new QPushButton(tr("Pause"), this);
EnableButtons(!Emu.IsStopped()); EnableButtons(!Emu.IsStopped());
@ -40,7 +39,6 @@ debugger_frame::debugger_frame(QWidget *parent) : QDockWidget(tr("Debugger"), pa
hbox_b_main->addWidget(m_go_to_pc); hbox_b_main->addWidget(m_go_to_pc);
hbox_b_main->addWidget(m_btn_step); hbox_b_main->addWidget(m_btn_step);
hbox_b_main->addWidget(m_btn_run); hbox_b_main->addWidget(m_btn_run);
hbox_b_main->addWidget(m_btn_pause);
hbox_b_main->addWidget(m_choice_units); hbox_b_main->addWidget(m_choice_units);
hbox_b_main->addStretch(); hbox_b_main->addStretch();
@ -76,14 +74,20 @@ debugger_frame::debugger_frame(QWidget *parent) : QDockWidget(tr("Debugger"), pa
connect(m_go_to_pc, &QAbstractButton::clicked, this, &debugger_frame::Show_PC); connect(m_go_to_pc, &QAbstractButton::clicked, this, &debugger_frame::Show_PC);
connect(m_btn_step, &QAbstractButton::clicked, this, &debugger_frame::DoStep); connect(m_btn_step, &QAbstractButton::clicked, this, &debugger_frame::DoStep);
connect(m_btn_run, &QAbstractButton::clicked, [=](){ connect(m_btn_run, &QAbstractButton::clicked, [=](){
const auto cpu = this->cpu.lock(); if (const auto cpu = this->cpu.lock())
if (cpu && cpu->state.test_and_reset(cpu_flag::dbg_pause)) {
if (!test(cpu->state, cpu_flag::dbg_pause + cpu_flag::dbg_global_pause)) if (m_btn_run->text() == Run && cpu->state.test_and_reset(cpu_flag::dbg_pause))
cpu->notify(); {
UpdateUI(); if (!test(cpu->state, cpu_flag::dbg_pause + cpu_flag::dbg_global_pause))
}); {
connect(m_btn_pause, &QAbstractButton::clicked, [=](){ cpu->notify();
if (const auto cpu = this->cpu.lock()) cpu->state += cpu_flag::dbg_pause; }
}
else
{
cpu->state += cpu_flag::dbg_pause;
}
}
UpdateUI(); UpdateUI();
}); });
connect(m_choice_units, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &debugger_frame::UpdateUI); connect(m_choice_units, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &debugger_frame::UpdateUI);
@ -147,7 +151,6 @@ void debugger_frame::UpdateUI()
m_btn_run->setEnabled(false); m_btn_run->setEnabled(false);
m_btn_step->setEnabled(false); m_btn_step->setEnabled(false);
m_btn_pause->setEnabled(false);
} }
} }
else else
@ -163,15 +166,13 @@ void debugger_frame::UpdateUI()
if (test(state & cpu_flag::dbg_pause)) if (test(state & cpu_flag::dbg_pause))
{ {
m_btn_run->setEnabled(true); m_btn_run->setText(Run);
m_btn_step->setEnabled(true); m_btn_step->setEnabled(true);
m_btn_pause->setEnabled(false);
} }
else else
{ {
m_btn_run->setEnabled(false); m_btn_run->setText(Pause);
m_btn_step->setEnabled(false); m_btn_step->setEnabled(false);
m_btn_pause->setEnabled(true);
} }
} }
} }
@ -407,7 +408,6 @@ void debugger_frame::EnableButtons(bool enable)
m_go_to_pc->setEnabled(enable); m_go_to_pc->setEnabled(enable);
m_btn_step->setEnabled(enable); m_btn_step->setEnabled(enable);
m_btn_run->setEnabled(enable); m_btn_run->setEnabled(enable);
m_btn_pause->setEnabled(enable);
} }
debugger_list::debugger_list(debugger_frame* parent) : QListWidget(parent) debugger_list::debugger_list(debugger_frame* parent) : QListWidget(parent)

View file

@ -42,7 +42,6 @@ class debugger_frame : public QDockWidget
QPushButton* m_go_to_pc; QPushButton* m_go_to_pc;
QPushButton* m_btn_step; QPushButton* m_btn_step;
QPushButton* m_btn_run; QPushButton* m_btn_run;
QPushButton* m_btn_pause;
QComboBox* m_choice_units; QComboBox* m_choice_units;
QString m_current_choice; QString m_current_choice;
bool m_noThreadSelected = true; bool m_noThreadSelected = true;
@ -54,7 +53,9 @@ class debugger_frame : public QDockWidget
QTimer* update; QTimer* update;
const QString NoThread = "No Thread"; const QString NoThread = tr("No Thread");
const QString Run = tr("Run");
const QString Pause = tr("Pause");
public: public:
std::unique_ptr<CPUDisAsm> m_disasm; std::unique_ptr<CPUDisAsm> m_disasm;