diff options
-rw-r--r-- | gui/gui.cc | 9 | ||||
-rw-r--r-- | gui/gui.ui | 127 | ||||
-rw-r--r-- | gui/messages.h | 13 |
3 files changed, 94 insertions, 55 deletions
@@ -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<std::string()> &func) { - this->status_label->setText("CPU SAYS: \"" + QString::fromStdString(func()) + "\""); + this->status_label->setText("COMPUTER SAYS: \"" + QString::fromStdString(func()) + "\""); } @@ -135,6 +135,16 @@ </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="sizeConstraint"> + <enum>QLayout::SizeConstraint::SetMinimumSize</enum> + </property> + <item> + <widget class="Line" name="line_8"> + <property name="orientation"> + <enum>Qt::Orientation::Vertical</enum> + </property> + </widget> + </item> <item> <layout class="QVBoxLayout" name="verticalLayout_9"> <property name="sizeConstraint"> @@ -307,6 +317,20 @@ </layout> </item> <item> + <widget class="Line" name="line_7"> + <property name="orientation"> + <enum>Qt::Orientation::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="config"> + <property name="text"> + <string>Initialize!</string> + </property> + </widget> + </item> + <item> <widget class="Line" name="line_34"> <property name="orientation"> <enum>Qt::Orientation::Horizontal</enum> @@ -326,36 +350,6 @@ </property> </widget> </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_30"> - <item> - <widget class="QLabel" name="label_15"> - <property name="font"> - <font> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Program State</string> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_39"> - <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="cycles_label"> - <property name="text"> - <string>Clock Cycles</string> - </property> - </widget> - </item> - </layout> - </item> </layout> </item> <item row="1" column="0" colspan="5"> @@ -610,25 +604,66 @@ <item> <layout class="QVBoxLayout" name="verticalLayout_6"> <item> - <widget class="QSlider" name="step_slider"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>6</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <item> + <widget class="QSlider" name="step_slider"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>6</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="orientation"> + <enum>Qt::Orientation::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TickPosition::NoTicks</enum> + </property> + <property name="tickInterval"> + <number>1</number> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_9"> + <property name="orientation"> + <enum>Qt::Orientation::Vertical</enum> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_10"> + <item> + <widget class="QLabel" name="label_15"> + <property name="font"> + <font> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Program State</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="cycles_label"> + <property name="text"> + <string>Clock Cycles</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <widget class="Line" name="line_10"> <property name="orientation"> <enum>Qt::Orientation::Horizontal</enum> </property> - <property name="tickPosition"> - <enum>QSlider::TickPosition::NoTicks</enum> - </property> - <property name="tickInterval"> - <number>1</number> - </property> </widget> </item> <item> 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<std::string> waiting = { "WAITING FOR USER", "FRIENDS MISSING", "BORED", "SLEEPING"}; -const std::vector<std::string> bad_file = { - "BAD FILE", "TRY AGAIN", "SEEKING NEW READING MATERIAL"}; const std::vector<std::string> load_file = { "FILE LOADED", "FINISHED READING DATA. EAGERLY WAITING"}; +const std::vector<std::string> 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<std::string> 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 |