From b859a7903c684da3b3b55e4ec6d1c6793f49492a Mon Sep 17 00:00:00 2001 From: Fabian Schmidt Date: Sat, 31 Jan 2026 21:13:27 +0100 Subject: [PATCH] Continued work on ui --- client/CMakeLists.txt | 1 + client/inc/ui/mainwindow.h | 22 ++++++---- client/src/ui/mainwindow.cpp | 10 +++++ client/src/ui/mainwindow.ui | 80 +++++++++++++++++++++++++++++++++--- 4 files changed, 99 insertions(+), 14 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 4d822e8..a7504e1 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -24,6 +24,7 @@ target_include_directories(chat_client target_link_libraries(chat_client PRIVATE + proto_interface Qt::Core Qt::Widgets ) diff --git a/client/inc/ui/mainwindow.h b/client/inc/ui/mainwindow.h index e92dbc9..c969412 100644 --- a/client/inc/ui/mainwindow.h +++ b/client/inc/ui/mainwindow.h @@ -3,17 +3,21 @@ #include QT_BEGIN_NAMESPACE -namespace Ui { class MainWindow; } +namespace Ui { +class MainWindow; +} QT_END_NAMESPACE -class MainWindow : public QMainWindow -{ - Q_OBJECT +class MainWindow : public QMainWindow { + Q_OBJECT - public: - MainWindow(QWidget *parent = nullptr); - ~MainWindow(); +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); - private: - Ui::MainWindow *ui; +private: + Ui::MainWindow *ui; + +public slots: + void receiveMsg(QString &); }; diff --git a/client/src/ui/mainwindow.cpp b/client/src/ui/mainwindow.cpp index 02bedd5..0d9a107 100644 --- a/client/src/ui/mainwindow.cpp +++ b/client/src/ui/mainwindow.cpp @@ -4,6 +4,16 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); + + connect(ui->sendButton, &QPushButton::clicked, this, + []() { qDebug() << "Button clicked"; }); } MainWindow::~MainWindow() { delete ui; } + +void MainWindow::receiveMsg(QString &msg) { + auto messages = ui->outputText->text(); + messages.append("\n"); + messages.append(msg); + ui->outputText->setText(messages); +} diff --git a/client/src/ui/mainwindow.ui b/client/src/ui/mainwindow.ui index dc457b7..67aca47 100644 --- a/client/src/ui/mainwindow.ui +++ b/client/src/ui/mainwindow.ui @@ -10,17 +10,88 @@ 600 - - MainWindow + + + 0 + 0 + - + + Chat client + + + + + + + + + + Qt::Orientation::Vertical + + + + + 0 + 0 + + + + + + + + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop + + + true + + + + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + + + + Send Message + + + + + + + + + + + + 0 0 800 - 22 + 30 @@ -29,4 +100,3 @@ -