Added basic UI

This commit is contained in:
nin0dev 2024-08-14 14:54:24 -04:00
parent 9f65109d32
commit 0904a8aca1
3 changed files with 25 additions and 4 deletions

View file

@ -11,7 +11,7 @@ int main(int argc, char *argv[])
MainWindow w;
w.setWindowTitle("txtcord");
w.setFixedSize(640, 480);
w.setMinimumSize(400, 300);
w.show();
return a.exec();

View file

@ -1,6 +1,7 @@
#include "mainwindow.h"
#include <QApplication>
#include <QHBoxLayout>
#include <QVBoxLayout>
MainWindow::MainWindow(QWidget *parent)
@ -9,6 +10,24 @@ MainWindow::MainWindow(QWidget *parent)
QWidget *centralWidget = new QWidget(this);
m_layout = new QVBoxLayout(centralWidget);
setCentralWidget(centralWidget);
// init chatlog
m_chatlog = new QTextEdit();
m_chatlog->setReadOnly(true);
m_chatlog->append("<b style=\"color:#00FFE5;\">Welcome to txtcord, the minimal Discord client.");
m_layout->addWidget(m_chatlog);
// init chatbox
QWidget *chatboxWidget = new QWidget();
QHBoxLayout *chatboxLayout = new QHBoxLayout();
m_box = new QLineEdit();
m_box->setPlaceholderText("Message (or /command)");
chatboxLayout->addWidget(m_box);
m_send = new QPushButton();
m_send->setText("Send");
chatboxLayout->addWidget(m_send);
chatboxWidget->setLayout(chatboxLayout);
m_layout->addWidget(chatboxWidget);
// init chatlog
}
MainWindow::~MainWindow() {

View file

@ -1,10 +1,12 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QLineEdit>
#include <QMainWindow>
#include <QProgressBar>
#include <QPushButton>
#include <QSlider>
#include <QTextEdit>
#include <QVBoxLayout>
class MainWindow : public QMainWindow
@ -16,8 +18,8 @@ public:
~MainWindow();
private:
QVBoxLayout *m_layout;
QPushButton *m_button;
QProgressBar *m_bar;
QSlider *m_slider;
QTextEdit *m_chatlog;
QLineEdit *m_box;
QPushButton *m_send;
};
#endif // MAINWINDOW_H