diff --git a/simulator_SIC_XE/.gitignore b/simulator_SIC_XE/.gitignore index 4cbe372..70b91f4 100644 --- a/simulator_SIC_XE/.gitignore +++ b/simulator_SIC_XE/.gitignore @@ -7,6 +7,7 @@ CMakeCache.txt CMakeFiles/ CMakeScripts/ cmake_install.cmake +Makefile *.cmake !CMakeLists.txt diff --git a/simulator_SIC_XE/Makefile b/simulator_SIC_XE/Makefile deleted file mode 100644 index 6d5d9ea..0000000 --- a/simulator_SIC_XE/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# Simple Makefile wrapper to configure, build and run the CMake project. -# Usage: -# make # builds (default) -# make build # configure + build -# make run # build (if needed) and run the executable -# make clean # run CMake clean (or remove build files) -# make distclean # remove build dir and generated targets - -CMAKE ?= cmake -BUILD_DIR := build -CMAKE_BUILD_TYPE ?= Release -TARGET := target/bin/simulator_exec -GUI_TARGET := target/bin/simulator_qt - -.PHONY: all configure build run clean distclean - -all: build - -configure: - @echo "Configuring (build dir: $(BUILD_DIR), type: $(CMAKE_BUILD_TYPE))" - $(CMAKE) -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) - -build: configure - @echo "Building..." - $(CMAKE) --build $(BUILD_DIR) -j$(shell nproc) - -run: build - @echo "Running primary target..." - # Prefer GUI if available, otherwise fall back to console executable - @if [ -x "$(GUI_TARGET)" ]; then \ - echo "Launching GUI: $(GUI_TARGET)"; \ - sh -c 'nohup env QT_QPA_PLATFORM=xcb ./$(GUI_TARGET) >/dev/null 2>&1 & echo $! > "$(BUILD_DIR)/simulator_qt.pid"'; \ - elif [ -x "$(TARGET)" ]; then \ - @./$(TARGET); \ - else \ - echo "No runnable target found (tried $(GUI_TARGET) and $(TARGET))."; exit 1; \ - fi - -.PHONY: run-gui -run-gui: build - @echo "Running GUI target ($(GUI_TARGET))" - @if [ -x "$(GUI_TARGET)" ]; then \ - echo "Starting GUI..."; ./$(GUI_TARGET) -platform xcb; \ - else \ - echo "GUI executable not found: $(GUI_TARGET)"; exit 1; \ - fi - -.PHONY: build-gui -build-gui: configure - @echo "Building GUI (and core)..." - $(CMAKE) --build $(BUILD_DIR) -j$(shell nproc) --target simulator_qt || true - -clean: - @echo "Cleaning build (CMake clean)..." - -$(CMAKE) --build $(BUILD_DIR) --target clean || true - -distclean: - @echo "Removing build artifacts and generated files..." - -rm -rf $(BUILD_DIR) CMakeFiles CMakeCache.txt cmake_install.cmake target/bin/* diff --git a/simulator_SIC_XE/gui/qt/CMakeLists.txt b/simulator_SIC_XE/gui/qt/CMakeLists.txt index cf8072a..0b42058 100644 --- a/simulator_SIC_XE/gui/qt/CMakeLists.txt +++ b/simulator_SIC_XE/gui/qt/CMakeLists.txt @@ -30,20 +30,19 @@ endif() set(GUI_SRCS main.cpp - mainwindow.cpp + MainWindow.cpp MachineController.cpp ) set(GUI_HDRS - mainwindow.h + MainWindow.h MachineController.h ) add_executable(simulator_qt ${GUI_SRCS} ${GUI_HDRS}) -# Allow the generated UI headers (from AUTOUIC) to be found in the build dir -# and also include the top-level include folder (works when added with add_subdirectory) -target_include_directories(simulator_qt PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include) +# Use top-level include folder (works when added with add_subdirectory) +target_include_directories(simulator_qt PRIVATE ${CMAKE_SOURCE_DIR}/include) # Link to core library target (must be defined by top-level CMake) target_link_libraries(simulator_qt PRIVATE simulator_lib ${QT_LIB}) diff --git a/simulator_SIC_XE/gui/qt/MainWindow.cpp b/simulator_SIC_XE/gui/qt/MainWindow.cpp new file mode 100644 index 0000000..09a31c2 --- /dev/null +++ b/simulator_SIC_XE/gui/qt/MainWindow.cpp @@ -0,0 +1,20 @@ +#include "MainWindow.h" +#include "MachineController.h" +#include +#include + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + QWidget *central = new QWidget(this); + auto *layout = new QVBoxLayout(central); + auto *label = new QLabel("SIC/XE Simulator — GUI stub", central); + label->setAlignment(Qt::AlignCenter); + layout->addWidget(label); + setCentralWidget(central); + + m_controller = new MachineController(this); + setWindowTitle("SIC/XE Simulator"); +} + +MainWindow::~MainWindow() = default; diff --git a/simulator_SIC_XE/gui/qt/mainwindow.h b/simulator_SIC_XE/gui/qt/MainWindow.h similarity index 55% rename from simulator_SIC_XE/gui/qt/mainwindow.h rename to simulator_SIC_XE/gui/qt/MainWindow.h index 9353441..a67c8d1 100644 --- a/simulator_SIC_XE/gui/qt/mainwindow.h +++ b/simulator_SIC_XE/gui/qt/MainWindow.h @@ -3,20 +3,16 @@ #include -namespace Ui { -class MainWindow; -} +class MachineController; -class MainWindow : public QMainWindow -{ +class MainWindow : public QMainWindow { Q_OBJECT - public: explicit MainWindow(QWidget *parent = nullptr); - ~MainWindow(); + ~MainWindow() override; private: - Ui::MainWindow *ui; + MachineController *m_controller = nullptr; }; #endif // MAINWINDOW_H diff --git a/simulator_SIC_XE/gui/qt/main.cpp b/simulator_SIC_XE/gui/qt/main.cpp index 877769b..74143ee 100644 --- a/simulator_SIC_XE/gui/qt/main.cpp +++ b/simulator_SIC_XE/gui/qt/main.cpp @@ -1,5 +1,5 @@ #include -#include "mainwindow.h" +#include "MainWindow.h" int main(int argc, char **argv) { QApplication app(argc, argv); diff --git a/simulator_SIC_XE/gui/qt/mainwindow.cpp b/simulator_SIC_XE/gui/qt/mainwindow.cpp deleted file mode 100644 index 49d64fc..0000000 --- a/simulator_SIC_XE/gui/qt/mainwindow.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); -} - -MainWindow::~MainWindow() -{ - delete ui; -} diff --git a/simulator_SIC_XE/gui/qt/mainwindow.ui b/simulator_SIC_XE/gui/qt/mainwindow.ui deleted file mode 100644 index 1a59260..0000000 --- a/simulator_SIC_XE/gui/qt/mainwindow.ui +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - MainWindow - - - - 0 - 0 - 640 - 480 - - - - MainWindow - - - - - - - -