diff --git a/include/MainWindow.hpp b/include/MainWindow.hpp new file mode 100644 index 0000000..77cde2f --- /dev/null +++ b/include/MainWindow.hpp @@ -0,0 +1,32 @@ +#pragma once +// MainWindow.hpp +// SPDX-License-Identifier: GPL-3.0-only +// Author: Unai Blazquez + +#include +#include +#include +#include + +/// @brief Minimal GUI window that displays the last integer received +/// from the ConsumerThread. Never blocks — values arrive via +/// Qt's queued signal/slot mechanism. +class MainWindow : public QWidget +{ + Q_OBJECT + + public: + explicit MainWindow(QWidget* parent = nullptr); + + /// @brief Returns the current text shown in the value label (for testing). + QString lastDisplayedText() const; + + public slots: + /// @brief Slot connected to ConsumerThread::valueReceived. + /// Updates the label with the new value. + void onValueReceived(int value); + + private: + QLabel* m_title_label; + QLabel* m_value_label; +};