diff --git a/chatterino.pro b/chatterino.pro new file mode 100644 index 000000000..0d6385c4d --- /dev/null +++ b/chatterino.pro @@ -0,0 +1,39 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-12-28T18:23:35 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = chatterino +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + + +SOURCES += main.cpp\ + mainwindow.cpp \ + chatwidget.cpp \ + notebook.cpp \ + notebooktab.cpp \ + notebookpage.cpp + +HEADERS += mainwindow.h \ + chatwidget.h \ + notebook.h \ + notebooktab.h \ + notebookpage.h + +FORMS += mainwindow.ui diff --git a/chatwidget.cpp b/chatwidget.cpp new file mode 100644 index 000000000..6f36e4b82 --- /dev/null +++ b/chatwidget.cpp @@ -0,0 +1,26 @@ +#include "chatwidget.h" +#include "QPainter" +#include "QFont" +#include "QFontDatabase" + +ChatWidget::ChatWidget(QWidget *parent) + : QWidget(parent) +{ + QFont font("Segoe UI", 15, QFont::Normal, false); + this->font = font; +} + +void ChatWidget::paintEvent(QPaintEvent *) +{ + QPainter painter (this); + QColor color (255, 0, 0); + + painter.setBrush(color); + painter.setPen(color); + + painter.setFont(this->font); + painter.drawRect(5, 10, 10, 5); + + QString text = "test text"; + painter.drawText(20, 20, text); +} diff --git a/chatwidget.h b/chatwidget.h new file mode 100644 index 000000000..382dd50ef --- /dev/null +++ b/chatwidget.h @@ -0,0 +1,21 @@ +#ifndef CHATWIDGET_H +#define CHATWIDGET_H + +#include + +#include "QFont" +class ChatWidget : public QWidget +{ + Q_OBJECT + +public: + ChatWidget(QWidget *parent = 0); + +protected: + void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; + +private: + QFont font; +}; + +#endif // CHATWIDGET_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 000000000..b48f94ec8 --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 000000000..3f72c87b4 --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,19 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include "chatwidget.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + //ui->setupUi(this); + + //ChatWidget widget = new ChatWidget(this); + + setCentralWidget(new ChatWidget(this)); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 000000000..a3948a917 --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,22 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui new file mode 100644 index 000000000..72e2bd70a --- /dev/null +++ b/mainwindow.ui @@ -0,0 +1,21 @@ + + + MainWindow + + + + 0 + 0 + 400 + 300 + + + + MainWindow + + + + + + + diff --git a/notebook.cpp b/notebook.cpp new file mode 100644 index 000000000..2c7f7c27f --- /dev/null +++ b/notebook.cpp @@ -0,0 +1,15 @@ +#include "QWidget" +#include "notebook.h" +#include "notebookpage.h" + +Notebook::Notebook(QWidget *parent) + : QWidget(parent) +{ + +} + +NotebookPage +Notebook::AddPage() +{ + return new NotebookPage(this); +} diff --git a/notebook.h b/notebook.h new file mode 100644 index 000000000..78f88cfd7 --- /dev/null +++ b/notebook.h @@ -0,0 +1,22 @@ +#ifndef NOTEBOOK_H +#define NOTEBOOK_H + +#include +#include +#include "notebookpage.h" +#include "notebooktab.h" + +class Notebook : public QWidget +{ +Q_OBJECT + +public: + Notebook(QWidget *parent); + + NotebookPage AddPage(); + +private: + QList> pages; +}; + +#endif // NOTEBOOK_H diff --git a/notebookpage.cpp b/notebookpage.cpp new file mode 100644 index 000000000..260967da1 --- /dev/null +++ b/notebookpage.cpp @@ -0,0 +1,8 @@ +#include "QWidget" +#include "notebookpage.h" + +NotebookPage::NotebookPage(QWidget *parent) + : QWidget(parent) +{ + +} diff --git a/notebookpage.h b/notebookpage.h new file mode 100644 index 000000000..cc0d8b46f --- /dev/null +++ b/notebookpage.h @@ -0,0 +1,14 @@ +#ifndef NOTEBOOKPAGE_H +#define NOTEBOOKPAGE_H + +#include "QWidget" + +class NotebookPage : public QWidget +{ +Q_OBJECT + +public: + NotebookPage(QWidget *parent); +}; + +#endif // NOTEBOOKPAGE_H diff --git a/notebooktab.cpp b/notebooktab.cpp new file mode 100644 index 000000000..97013ed38 --- /dev/null +++ b/notebooktab.cpp @@ -0,0 +1,10 @@ +#include "notebook.h" +#include "notebooktab.h" +#include "notebookpage.h" + +NotebookTab::NotebookTab(QWidget *parent, Notebook *notebook, NotebookPage *page) + : QWidget(parent) +{ + this->notebook = notebook; + this->page = page; +} diff --git a/notebooktab.h b/notebooktab.h new file mode 100644 index 000000000..4b015f72a --- /dev/null +++ b/notebooktab.h @@ -0,0 +1,20 @@ +#ifndef NOTEBOOKTAB_H +#define NOTEBOOKTAB_H + +#include "QObject" +#include "notebook.h" +#include "notebookpage.h" + +class NotebookTab : public QWidget +{ +Q_OBJECT + +public: + NotebookTab(QWidget *parent, Notebook *notebook, NotebookPage *page); + +private: + Notebook *notebook; + NotebookPage *page; +}; + +#endif // NOTEBOOKTAB_H