From 327ba8b631436cf21866c05c6c7cae239fe54a5c Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 19 Apr 2025 02:45:38 -0400 Subject: Small UI cleanups --- gui/gui.cc | 9 ++-- gui/gui.ui | 127 ++++++++++++++++++++++++++++++++++++--------------------- gui/messages.h | 13 +++--- 3 files changed, 94 insertions(+), 55 deletions(-) diff --git a/gui/gui.cc b/gui/gui.cc index 0ba4867..a36920b 100644 --- a/gui/gui.cc +++ b/gui/gui.cc @@ -251,7 +251,7 @@ void GUI::on_upload_intructions_btn_clicked() "Binary Files (*.bin *.rv);;All Files (*.*)"); QFile file(filePath); if (filePath.isEmpty() || !file.open(QIODevice::ReadOnly)) { - this->set_status(get_bad_file); + this->set_status(get_no_instructions); return; } @@ -268,7 +268,10 @@ void GUI::on_upload_intructions_btn_clicked() } } - this->set_status(get_load_file); + if (this->p.empty()) + this->set_status(get_no_instructions); + else + this->set_status(get_load_file); file.close(); } @@ -306,5 +309,5 @@ void GUI::on_save_program_state_btn_clicked() void GUI::set_status(const std::function &func) { - this->status_label->setText("CPU SAYS: \"" + QString::fromStdString(func()) + "\""); + this->status_label->setText("COMPUTER SAYS: \"" + QString::fromStdString(func()) + "\""); } diff --git a/gui/gui.ui b/gui/gui.ui index a5a51f1..b9ad041 100644 --- a/gui/gui.ui +++ b/gui/gui.ui @@ -135,6 +135,16 @@ + + QLayout::SizeConstraint::SetMinimumSize + + + + + Qt::Orientation::Vertical + + + @@ -306,6 +316,20 @@ + + + + Qt::Orientation::Horizontal + + + + + + + Initialize! + + + @@ -326,36 +350,6 @@ - - - - - - - true - - - - Program State - - - - - - - Qt::Orientation::Horizontal - - - - - - - Clock Cycles - - - - - @@ -610,25 +604,66 @@ - - - 0 - - - 6 - - - 1 - + + + + + 0 + + + 6 + + + 1 + + + Qt::Orientation::Horizontal + + + QSlider::TickPosition::NoTicks + + + 1 + + + + + + + Qt::Orientation::Vertical + + + + + + + + + + true + + + + Program State + + + + + + + Clock Cycles + + + + + + + + + Qt::Orientation::Horizontal - - QSlider::TickPosition::NoTicks - - - 1 - diff --git a/gui/messages.h b/gui/messages.h index 8f852f7..2af8e6b 100644 --- a/gui/messages.h +++ b/gui/messages.h @@ -10,10 +10,11 @@ const std::vector waiting = { "WAITING FOR USER", "FRIENDS MISSING", "BORED", "SLEEPING"}; -const std::vector bad_file = { - "BAD FILE", "TRY AGAIN", "SEEKING NEW READING MATERIAL"}; const std::vector load_file = { "FILE LOADED", "FINISHED READING DATA. EAGERLY WAITING"}; +const std::vector no_instructions = { + "NO PROGRAM PROVIDED", "RISC V[ECTOR]: INSTRUCTIONS NOT INCLUDED", + "NOTHING TO DO, GIVING UP"}; /** * @return an unsolicited waiting message @@ -21,13 +22,13 @@ const std::vector load_file = { std::string get_waiting() { return RANDOM_MESSAGE(waiting); } /** - * @return a complaint about a bad file name + * @return confirmation of file upload */ -std::string get_bad_file() { return RANDOM_MESSAGE(bad_file); } +std::string get_load_file() { return RANDOM_MESSAGE(load_file); } /** - * @return confirmation of file upload + * @return a friendly reminder that the simulation is not configured yet */ -std::string get_load_file() { return RANDOM_MESSAGE(load_file); } +std::string get_no_instructions() { return RANDOM_MESSAGE(no_instructions); } #endif // MESSAGES_H -- cgit v1.2.3