summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/gui.cc3
-rw-r--r--gui/messages.h33
2 files changed, 35 insertions, 1 deletions
diff --git a/gui/gui.cc b/gui/gui.cc
index 5848c65..699ab48 100644
--- a/gui/gui.cc
+++ b/gui/gui.cc
@@ -254,6 +254,7 @@ void GUI::on_upload_intructions_btn_clicked()
return;
}
+ this->p.clear();
while (!file.atEnd()) {
char bytes[4];
if (file.read(bytes, 4) == 4) {
@@ -304,5 +305,5 @@ void GUI::on_save_program_state_btn_clicked()
QString GUI::make_status(const std::function<std::string()> &func)
{
- return "CONSENSUS: " + QString::fromStdString(func());
+ return "CPU SAYS: \"" + QString::fromStdString(func()) + "\"";
}
diff --git a/gui/messages.h b/gui/messages.h
new file mode 100644
index 0000000..84b8318
--- /dev/null
+++ b/gui/messages.h
@@ -0,0 +1,33 @@
+#ifndef MESSAGES_H
+#define MESSAGES_H
+#include <vector>
+#include <string>
+
+/**
+ * Humorous computer speak.
+ */
+#define RANDOM_MESSAGE(v) (v[std::rand() % v.size()])
+
+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"};
+
+/**
+ * @return a random waiting message
+ */
+std::string get_waiting() { return RANDOM_MESSAGE(waiting); }
+
+/**
+ * @return a complaint about a bad file name
+ */
+std::string get_bad_file() { return RANDOM_MESSAGE(bad_file); }
+
+/**
+ * @return confirmation of file upload
+ */
+std::string get_load_file() { return RANDOM_MESSAGE(load_file); }
+
+#endif // MESSAGES_H