diff options
-rw-r--r-- | gui/gui.cc | 2 | ||||
-rw-r--r-- | gui/gui.ui | 92 | ||||
-rw-r--r-- | gui/main.cc | 15 | ||||
-rw-r--r-- | gui/resources.qrc | 5 | ||||
-rw-r--r-- | gui/resources/input.txt | 1 | ||||
-rw-r--r-- | gui/resources/styles.qss | 139 |
6 files changed, 213 insertions, 41 deletions
@@ -336,7 +336,7 @@ void GUI::on_enabl_cache_checkbox_checkStateChanged(const Qt::CheckState &arg1) void GUI::on_step_btn_clicked() { qDebug() << "Run step button clicked."; - int steps = step_values[ui->step_slider->value()]; + int steps = step_values[ui->step_slider->value()]; emit sendRunSteps(steps); } @@ -124,18 +124,21 @@ <property name="title"> <string>Fetch</string> </property> + <property name="alignment"> + <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set> + </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QLineEdit" name="fetch_instruction_bits"> <property name="placeholderText"> - <string>Instruction Bits</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="fetch_pc"> <property name="placeholderText"> - <string>Program Counter</string> + <string/> </property> </widget> </item> @@ -154,18 +157,21 @@ <property name="title"> <string>Decode</string> </property> + <property name="alignment"> + <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set> + </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QLineEdit" name="decode_s1"> <property name="placeholderText"> - <string>Instruction Bits</string> + <string> </string> </property> </widget> </item> <item> <widget class="QLineEdit" name="decode_pc"> <property name="placeholderText"> - <string>Program Counter</string> + <string> </string> </property> </widget> </item> @@ -184,11 +190,14 @@ <property name="title"> <string>Execute</string> </property> + <property name="alignment"> + <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set> + </property> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QLineEdit" name="execute_s1"> <property name="placeholderText"> - <string>s1</string> + <string/> </property> </widget> </item> @@ -198,28 +207,28 @@ <string/> </property> <property name="placeholderText"> - <string>s2</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="execute_s3"> <property name="placeholderText"> - <string>s3</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="execute_mnemonic"> <property name="placeholderText"> - <string>Mnemonic</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="execute_pc"> <property name="placeholderText"> - <string>Program Counter</string> + <string/> </property> </widget> </item> @@ -238,11 +247,14 @@ <property name="title"> <string>Memory</string> </property> + <property name="alignment"> + <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set> + </property> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> <widget class="QLineEdit" name="memory_s1"> <property name="placeholderText"> - <string>s1</string> + <string/> </property> </widget> </item> @@ -252,28 +264,28 @@ <string/> </property> <property name="placeholderText"> - <string>s2</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="memory_s3"> <property name="placeholderText"> - <string>s3</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="memory_mnemonic"> <property name="placeholderText"> - <string>Mnemonic</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="memory_pc"> <property name="placeholderText"> - <string>Program Counter</string> + <string/> </property> </widget> </item> @@ -292,11 +304,14 @@ <property name="title"> <string>Write Back</string> </property> + <property name="alignment"> + <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set> + </property> <layout class="QVBoxLayout" name="verticalLayout_5"> <item> <widget class="QLineEdit" name="wb_s1"> <property name="placeholderText"> - <string>s1</string> + <string/> </property> </widget> </item> @@ -306,28 +321,28 @@ <string/> </property> <property name="placeholderText"> - <string>s2</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="wb_s3"> <property name="placeholderText"> - <string>s3</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="wb_mnemonic"> <property name="placeholderText"> - <string>Mnemonic</string> + <string/> </property> </widget> </item> <item> <widget class="QLineEdit" name="wb_pc"> <property name="placeholderText"> - <string>Program Counter</string> + <string/> </property> </widget> </item> @@ -372,8 +387,14 @@ </item> <item> <widget class="QPushButton" name="step_btn"> + <property name="minimumSize"> + <size> + <width>400</width> + <height>0</height> + </size> + </property> <property name="text"> - <string>Step</string> + <string>Step 1</string> </property> </widget> </item> @@ -421,15 +442,21 @@ </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <widget class="QPushButton" name="upload_program_state_btn"> - <property name="text"> - <string>Upload Program State File</string> - </property> - </widget> - </item> - </layout> + <widget class="QPushButton" name="upload_program_state_btn"> + <property name="text"> + <string>Upload Program State File</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="save_program_state_btn"> + <property name="text"> + <string>Save Current Program State</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"/> </item> </layout> </item> @@ -585,13 +612,6 @@ </property> </widget> </item> - <item> - <widget class="QPushButton" name="save_program_state_btn"> - <property name="text"> - <string>Save Current Program State</string> - </property> - </widget> - </item> </layout> </item> </layout> diff --git a/gui/main.cc b/gui/main.cc index 5e45465..09bc4e9 100644 --- a/gui/main.cc +++ b/gui/main.cc @@ -1,7 +1,9 @@ -#include "pipe_spec.h" #include "gui.h" #include "logger.h" +#include "pipe_spec.h" #include <QApplication> +#include <QFile> +#include <QFontDatabase> #include <getopt.h> #include <iostream> @@ -67,6 +69,17 @@ int main(int argc, char **argv) global_log->log(INFO, "Starting QT..."); QApplication a(argc, argv); + + int fId = QFontDatabase::addApplicationFont( + ":/resources/BigBlueTermPlusNerdFontMono-Regular.ttf"); + QFile ssf(":/resources/styles.qss"); + QString f = QFontDatabase::applicationFontFamilies(fId).at(0); + a.setFont(QFont(f)); + + ssf.open(QFile::ReadOnly); + QString ss = QLatin1String(ssf.readAll()); + a.setStyleSheet(ss); + GUI w; w.show(); return a.exec(); diff --git a/gui/resources.qrc b/gui/resources.qrc index 8bfd4e7..59fb36f 100644 --- a/gui/resources.qrc +++ b/gui/resources.qrc @@ -1,6 +1,7 @@ <!DOCTYPE RCC> <RCC version="1.0"> - <qresource prefix="/resources"> - <file alias="input.txt">resources/input.txt</file> + <qresource> + <file>resources/styles.qss</file> + <file>resources/BigBlueTermPlusNerdFontMono-Regular.ttf</file> </qresource> </RCC> diff --git a/gui/resources/input.txt b/gui/resources/input.txt deleted file mode 100644 index fc1c3cf..0000000 --- a/gui/resources/input.txt +++ /dev/null @@ -1 +0,0 @@ -Lorem Ipsum
\ No newline at end of file diff --git a/gui/resources/styles.qss b/gui/resources/styles.qss new file mode 100644 index 0000000..1f1b82f --- /dev/null +++ b/gui/resources/styles.qss @@ -0,0 +1,139 @@ +* { + font-family: "BigBlueTermPlusNerdFontMono", "monospace"; + font-size: 20pt; + color: "#00cc00"; + background-color: "#000004"; +} + +/* main window */ +QWidget { +} + +QGroupBox { + font-size: 17pt; + background-color: "#000004"; + border: 4px solid ; + border-radius: 0px; + margin-bottom: 1ex; /* leave space at the bottom for the title */ +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: bottom left; + border-radius: 0px; + padding: 0 2px; + background-color: "#00cc00"; + color: "#000000"; +} + +QLabel { +} + +/* text entry */ +QLineEdit { + font-size: 15pt; + border-radius: 0px; + padding: 0 4px; + selection-background-color: "#00cc00"; +} + +QTextEdit, QListView { + font-size: 10pt; + background-color: "#000004"; +} + +QPushButton { + border: 4px solid "#00cc00"; +} + +QPushButton:pressed { + color: "#000004"; + background-color: "#00cc00"; +} + +QPushButton:flat { + border: none; /* no border for a flat push button */ +} + +QPushButton:default { + border-color: "#00cc00"; +} + +QMenuBar { + background-color: "#00cc00"; + spacing: 3px; /* spacing between menu bar items */ +} + +QMenuBar::item { + padding: 1px 4px; + background: transparent; + border-radius: 4px; +} + +QMenuBar::item:selected { /* when selected using mouse or keyboard */ + background: #a8a8a8; +} + +QMenuBar::item:pressed { + background: #888888; +} + +QCheckBox { + spacing: 5px; +} + +QCheckBox::indicator { + width: 13px; + height: 13px; + border: 2px solid "#00cc00"; +} + +QCheckBox::indicator:unchecked { +} + +/* QCheckBox::indicator:unchecked:pressed { */ +/* image: url(:/images/checkbox_unchecked_pressed.png); */ +/* } */ + +QCheckBox::indicator:checked { + background: "#00cc00"; +} + +QSlider::groove:horizontal { + height: 5px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ + background: "#00cc00"; + margin: 2px 0; +} + +QSlider::handle:horizontal { + background: "#00cc00"; + width: 10px; + margin: -30px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ + border-radius: 3px; +} + +QScrollBar:horizontal { + border: 2px solid "#00cc00"; + height: 4px; + margin: 0px 20px 0 20px; +} +QScrollBar::handle:horizontal { + min-width: 20px; +} +QScrollBar::add-line:horizontal { + border: 2px solid "#00cc00"; + width: 4px; + subcontrol-position: right; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:horizontal { + border: 2px solid "#00cc00"; + width: 4px; + subcontrol-position: left; + subcontrol-origin: margin; +} + +/* Local Variables: */ +/* mode: css */ +/* End: */ |