mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
first commit
This commit is contained in:
parent
39c59e1df7
commit
b9073b3cc2
13 changed files with 248 additions and 0 deletions
39
chatterino.pro
Normal file
39
chatterino.pro
Normal file
|
@ -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
|
26
chatwidget.cpp
Normal file
26
chatwidget.cpp
Normal file
|
@ -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);
|
||||
}
|
21
chatwidget.h
Normal file
21
chatwidget.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef CHATWIDGET_H
|
||||
#define CHATWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#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
|
11
main.cpp
Normal file
11
main.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
19
mainwindow.cpp
Normal file
19
mainwindow.cpp
Normal file
|
@ -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;
|
||||
}
|
22
mainwindow.h
Normal file
22
mainwindow.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
21
mainwindow.ui
Normal file
21
mainwindow.ui
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
15
notebook.cpp
Normal file
15
notebook.cpp
Normal file
|
@ -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);
|
||||
}
|
22
notebook.h
Normal file
22
notebook.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef NOTEBOOK_H
|
||||
#define NOTEBOOK_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include "notebookpage.h"
|
||||
#include "notebooktab.h"
|
||||
|
||||
class Notebook : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Notebook(QWidget *parent);
|
||||
|
||||
NotebookPage AddPage();
|
||||
|
||||
private:
|
||||
QList<std::tuple<NotebookPage, NotebookTab>> pages;
|
||||
};
|
||||
|
||||
#endif // NOTEBOOK_H
|
8
notebookpage.cpp
Normal file
8
notebookpage.cpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include "QWidget"
|
||||
#include "notebookpage.h"
|
||||
|
||||
NotebookPage::NotebookPage(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
14
notebookpage.h
Normal file
14
notebookpage.h
Normal file
|
@ -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
|
10
notebooktab.cpp
Normal file
10
notebooktab.cpp
Normal file
|
@ -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;
|
||||
}
|
20
notebooktab.h
Normal file
20
notebooktab.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue