Skip to content

Refactor and change the structure of the GUI

Johannes Kung requested to merge refactor_gui into main

Relates to issue #54 (closed) and #46.

Changes the structure of the GUI into a more modular structure using the QT signal and slots system. This also improves the separation of concern. The most notable change is that the GUI class has been slimmed down and had many lines of code refactored and moved into separate classes. In particular, classes were made for the menu toolbar, the processor control toolbar and for processor control.

All methods related to controlling the processor, e.g. running continuously or loading state from file, are encapsulated in the ProcessorHandler class. The class has several signals for when the processor has changed in some way or another. The ProcessorHandler class also has several slots for controlling the processor simulation. With this structure, the menu and processor control toolbars become simple button interfaces with signals that the GUI class connects with appropriate slots of other widgets, notably the ProcessorHandler.

Moreover, the graphics scene does not need to concern itself with updating modules when the processor has been updated. Instead, the modules have update slots connected to a signal of the ProcessorHandler. This way, the graphics scene only concerns itself with managing the position and layout of the modules. Similarly, the pipeline diagram has a slot for setting the current instructions, connected to a signal of the ProcessorHandler. No classes need be aware of the others as long as the GUI class connects their signals and slots.

Merge request reports

Loading