diff --git a/pom.xml b/pom.xml
index 9e9feaa..5c1cef2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,13 @@
eu.m724.chaqt.Main
+
+
+ m724
+ https://git.m724.eu/api/packages/Minecon724/maven
+
+
+
io.qtjambi
@@ -26,6 +33,11 @@
qtjambi-native-linux-x64
6.7.2
+
+ eu.m724
+ chatapi
+ 1.0
+
diff --git a/src/main/java/eu/m724/chaqt/ChatWindowViewModel.java b/src/main/java/eu/m724/chaqt/ChatWindowViewModel.java
new file mode 100644
index 0000000..a217c5c
--- /dev/null
+++ b/src/main/java/eu/m724/chaqt/ChatWindowViewModel.java
@@ -0,0 +1,14 @@
+package eu.m724.chaqt;
+
+import eu.m724.chatapi.chat.Chat;
+
+public class ChatWindowViewModel {
+ private ChatWindowWidget widget;
+
+ private Chat chat;
+
+ public ChatWindowViewModel(ChatWindowWidget widget, Chat chat) {
+ this.widget = widget;
+ this.chat = chat;
+ }
+}
diff --git a/src/main/java/eu/m724/chaqt/ChatWindowWidget.java b/src/main/java/eu/m724/chaqt/ChatWindowWidget.java
new file mode 100644
index 0000000..9178950
--- /dev/null
+++ b/src/main/java/eu/m724/chaqt/ChatWindowWidget.java
@@ -0,0 +1,62 @@
+package eu.m724.chaqt;
+
+import eu.m724.chatapi.chat.Chat;
+import io.qt.core.Qt;
+import io.qt.widgets.*;
+
+public class ChatWindowWidget extends QWidget {
+ private ChatWindowViewModel viewModel;
+
+ private QVBoxLayout layout;
+ private QTextEdit textEdit;
+
+ public ChatWindowWidget(Chat chat) {
+ this.viewModel = new ChatWindowViewModel(this, chat);
+
+ //
+
+ this.layout = new QVBoxLayout();
+ layout.setAlignment(Qt.AlignmentFlag.AlignBottom); // or top?
+
+ QWidget widget = new QWidget();
+ widget.setLayout(layout);
+
+ QScrollArea scrollArea = new QScrollArea();
+ scrollArea.setWidgetResizable(true);
+ scrollArea.setWidget(widget);
+
+ //
+
+ this.textEdit = new QTextEdit();
+ textEdit.setPlaceholderText("Write a message...");
+ textEdit.textChanged.connect(this, "handleComposerType()");
+
+ QPushButton sendButton = new QPushButton("Send");
+
+ QHBoxLayout composerLayout = new QHBoxLayout();
+ composerLayout.addWidget(textEdit);
+ composerLayout.addWidget(sendButton, 0, Qt.AlignmentFlag.AlignBottom);
+
+ QWidget composerWidget = new QWidget();
+ composerWidget.setLayout(composerLayout);
+
+ handleComposerType(); // TODO make it resizable and fix it
+
+ //
+
+ QVBoxLayout mainLayout = new QVBoxLayout();
+ mainLayout.addWidget(scrollArea, 1);
+ mainLayout.addWidget(composerWidget);
+ setLayout(mainLayout);
+
+ for (int i=0; i<10; i++) {
+ QPushButton pushButton = new QPushButton("hello");
+ layout.addWidget(pushButton);
+ }
+ }
+
+ public void handleComposerType() {
+ int height = (int) textEdit.document().size().height();
+ textEdit.setFixedHeight(height + textEdit.contentsMargins().top() + textEdit.contentsMargins().bottom());
+ }
+}
diff --git a/src/main/java/eu/m724/chaqt/Main.java b/src/main/java/eu/m724/chaqt/Main.java
index 2be5d85..6d9f28e 100644
--- a/src/main/java/eu/m724/chaqt/Main.java
+++ b/src/main/java/eu/m724/chaqt/Main.java
@@ -1,5 +1,6 @@
package eu.m724.chaqt;
+import eu.m724.chatapi.chat.Chat;
import io.qt.widgets.QApplication;
import io.qt.widgets.QMessageBox;
@@ -8,8 +9,10 @@ public class Main {
public static void main(String[] args) {
QApplication.initialize(args);
- HelloWorld hello = new HelloWorld();
- hello.show();
+ Chat chat = new Chat();
+
+ ChatWindowWidget widget = new ChatWindowWidget(chat);
+ widget.show();
QApplication.exec();
}