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; MainWindow w;
w.setWindowTitle("txtcord"); w.setWindowTitle("txtcord");
w.setFixedSize(640, 480); w.setMinimumSize(400, 300);
w.show(); w.show();
return a.exec(); return a.exec();

View file

@ -1,6 +1,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QApplication> #include <QApplication>
#include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
@ -9,6 +10,24 @@ MainWindow::MainWindow(QWidget *parent)
QWidget *centralWidget = new QWidget(this); QWidget *centralWidget = new QWidget(this);
m_layout = new QVBoxLayout(centralWidget); m_layout = new QVBoxLayout(centralWidget);
setCentralWidget(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() { MainWindow::~MainWindow() {

View file

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