From 40dfec9ae067d3f8e3868d259bfc4251aeca8724 Mon Sep 17 00:00:00 2001 From: bd Date: Mon, 21 Apr 2025 15:56:38 -0400 Subject: Add functionality to toggle button. --- gui/gui.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gui/gui.cc') diff --git a/gui/gui.cc b/gui/gui.cc index 2744a06..294a7d0 100644 --- a/gui/gui.cc +++ b/gui/gui.cc @@ -48,6 +48,13 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent), ui(new Ui::GUI) worker = new Worker(); worker->moveToThread(&workerThread); + // find all the labels + QList labels = this->findChildren(); + for (DigitLabel* label : labels) { + connect(this, &GUI::hex_toggled, label, &DigitLabel::on_hex_toggle); + } + emit this->hex_toggled(this->is_hex); + // display clock cycles and PC connect(worker, &Worker::clock_cycles, this, &GUI::on_worker_refresh_gui); @@ -207,6 +214,7 @@ void GUI::onWorkerExecuteInfo(const std::vector info) void GUI::onWorkerMemoryInfo(const std::vector info) { if (!info.empty()) { + std::cout << "this " << info[3] << std::endl; ui->memory_mnemonic->setText(mnemonicToString((Mnemonic)info[0])); ui->memory_squashed->setText(QString::number(info[1])); ui->memory_s1->set_value(info[2]); @@ -299,13 +307,13 @@ void GUI::on_upload_program_state_btn_clicked() void GUI::on_enable_pipeline_checkbox_checkStateChanged( const Qt::CheckState &arg1) { - if (arg1 == Qt::CheckState::Checked) { - qDebug() << "enable pipeline checkbox checked."; - this->is_pipelined = true; - } else { - qDebug() << "enable pipeline checkbox unchecked."; - this->is_pipelined = false; - } + this->is_pipelined = (arg1 == Qt::CheckState::Checked) ? true : false; +} + +void GUI::on_base_toggle_checkbox_checkStateChanged(const Qt::CheckState &state) +{ + this->is_hex = (state == Qt::CheckState::Checked) ? false : true; + emit this->hex_toggled(this->is_hex); } void GUI::on_step_btn_clicked() -- cgit v1.2.3