summaryrefslogtreecommitdiff
path: root/gui/gui.cc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-21 15:56:38 -0400
committerbd <bdunahu@operationnull.com>2025-04-21 15:56:38 -0400
commit40dfec9ae067d3f8e3868d259bfc4251aeca8724 (patch)
tree28316cbc00a8e89ead3225d80b9199381a996d86 /gui/gui.cc
parent89763e6f696a96ad310f031c66960bcaaba3ffdb (diff)
Add functionality to toggle button.
Diffstat (limited to 'gui/gui.cc')
-rw-r--r--gui/gui.cc22
1 files changed, 15 insertions, 7 deletions
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<DigitLabel*> labels = this->findChildren<DigitLabel*>();
+ 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<int> info)
void GUI::onWorkerMemoryInfo(const std::vector<int> 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()