mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
71 lines
1.5 KiB
C++
71 lines
1.5 KiB
C++
#include "mainwindow.h"
|
|
#include <QPalette>
|
|
#include "chatwidget.h"
|
|
#include "colorscheme.h"
|
|
#include "notebook.h"
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, notebook(this)
|
|
{
|
|
setCentralWidget(&this->notebook);
|
|
|
|
this->notebook.addPage();
|
|
this->notebook.addPage();
|
|
this->notebook.addPage();
|
|
|
|
QPalette palette;
|
|
palette.setColor(QPalette::Background,
|
|
ColorScheme::instance().TabPanelBackground);
|
|
setPalette(palette);
|
|
|
|
resize(1280, 800);
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
}
|
|
|
|
void
|
|
MainWindow::layoutVisibleChatWidgets(Channel *channel)
|
|
{
|
|
auto *page = notebook.getSelectedPage();
|
|
|
|
if (page == NULL) {
|
|
return;
|
|
}
|
|
|
|
const std::vector<ChatWidget *> &widgets = page->getChatWidgets();
|
|
|
|
for (auto it = widgets.begin(); it != widgets.end(); ++it) {
|
|
ChatWidget *widget = *it;
|
|
|
|
if (channel == NULL || channel == widget->getChannel()) {
|
|
if (widget->getView().layoutMessages()) {
|
|
widget->repaint();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
MainWindow::repaintVisibleChatWidgets(Channel *channel)
|
|
{
|
|
auto *page = notebook.getSelectedPage();
|
|
|
|
if (page == NULL) {
|
|
return;
|
|
}
|
|
|
|
const std::vector<ChatWidget *> &widgets = page->getChatWidgets();
|
|
|
|
for (auto it = widgets.begin(); it != widgets.end(); ++it) {
|
|
ChatWidget *widget = *it;
|
|
|
|
if (channel == NULL || channel == widget->getChannel()) {
|
|
widget->getView().layoutMessages();
|
|
widget->repaint();
|
|
}
|
|
}
|
|
}
|