From bacb183cdbced4d9180f45b8d668918283b4b2bc Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 16 Jan 2017 15:06:12 +0100 Subject: [PATCH] added option to refresh only certain channels --- chatterino.pro | 6 ++++-- chatwidget.h | 6 ++++++ chatwidgetheaderbuttonlabel.cpp | 1 + mainwindow.cpp | 16 ++++++++++------ mainwindow.h | 4 ++-- textinputform.cpp | 6 ++++++ textinputform.h | 12 ++++++++++++ windows.cpp | 8 ++++---- windows.h | 4 ++-- 9 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 textinputform.cpp create mode 100644 textinputform.h diff --git a/chatterino.pro b/chatterino.pro index 652146ca0..0063e1478 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -67,7 +67,8 @@ SOURCES += main.cpp\ windows.cpp \ chatwidgetheaderbutton.cpp \ chatwidgetheaderbuttonlabel.cpp \ - channels.cpp + channels.cpp \ + textinputform.cpp HEADERS += mainwindow.h \ chatwidget.h \ @@ -106,7 +107,8 @@ HEADERS += mainwindow.h \ windows.h \ chatwidgetheaderbutton.h \ chatwidgetheaderbuttonlabel.h \ - channels.h + channels.h \ + textinputform.h PRECOMPILED_HEADER = diff --git a/chatwidget.h b/chatwidget.h index bd6378ce8..aa18ed4bb 100644 --- a/chatwidget.h +++ b/chatwidget.h @@ -23,6 +23,12 @@ public: return m_view; } + Channel * + channel() const + { + return m_channel; + } + protected: void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; diff --git a/chatwidgetheaderbuttonlabel.cpp b/chatwidgetheaderbuttonlabel.cpp index d43bb40b7..58da16882 100644 --- a/chatwidgetheaderbuttonlabel.cpp +++ b/chatwidgetheaderbuttonlabel.cpp @@ -2,6 +2,7 @@ ChatWidgetHeaderButtonLabel::ChatWidgetHeaderButtonLabel() { + setAlignment(Qt::AlignCenter); } void diff --git a/mainwindow.cpp b/mainwindow.cpp index 506c3efdc..3ae0942c8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -27,7 +27,7 @@ MainWindow::~MainWindow() } void -MainWindow::layoutVisibleChatWidgets() +MainWindow::layoutVisibleChatWidgets(Channel *channel) { auto *page = notebook.selected(); @@ -40,14 +40,16 @@ MainWindow::layoutVisibleChatWidgets() for (auto it = widgets.begin(); it != widgets.end(); ++it) { ChatWidget *widget = *it; - if (widget->view().layoutMessages()) { - widget->repaint(); + if (channel == NULL || channel == widget->channel()) { + if (widget->view().layoutMessages()) { + widget->repaint(); + } } } } void -MainWindow::repaintVisibleChatWidgets() +MainWindow::repaintVisibleChatWidgets(Channel *channel) { auto *page = notebook.selected(); @@ -60,7 +62,9 @@ MainWindow::repaintVisibleChatWidgets() for (auto it = widgets.begin(); it != widgets.end(); ++it) { ChatWidget *widget = *it; - widget->view().layoutMessages(); - widget->repaint(); + if (channel == NULL || channel == widget->channel()) { + widget->view().layoutMessages(); + widget->repaint(); + } } } diff --git a/mainwindow.h b/mainwindow.h index d57489619..1730ce00f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -13,8 +13,8 @@ public: ~MainWindow(); Notebook notebook; - void layoutVisibleChatWidgets(); - void repaintVisibleChatWidgets(); + void layoutVisibleChatWidgets(Channel *channel = NULL); + void repaintVisibleChatWidgets(Channel *channel = NULL); }; #endif // MAINWINDOW_H diff --git a/textinputform.cpp b/textinputform.cpp new file mode 100644 index 000000000..5565fc6d7 --- /dev/null +++ b/textinputform.cpp @@ -0,0 +1,6 @@ +#include "textinputform.h" + +TextInputForm::TextInputForm() +{ + +} diff --git a/textinputform.h b/textinputform.h new file mode 100644 index 000000000..3a55ebd65 --- /dev/null +++ b/textinputform.h @@ -0,0 +1,12 @@ +#ifndef TEXTINPUTFORM_H +#define TEXTINPUTFORM_H + +#include + +class TextInputForm : public QDialog +{ +public: + TextInputForm(); +}; + +#endif // TEXTINPUTFORM_H diff --git a/windows.cpp b/windows.cpp index 3ab0045e2..b6a55c576 100644 --- a/windows.cpp +++ b/windows.cpp @@ -5,13 +5,13 @@ QMutex Windows::m_windowMutex; MainWindow *Windows::m_mainWindow(NULL); void -Windows::layoutVisibleChatWidgets() +Windows::layoutVisibleChatWidgets(Channel *channel) { - m_mainWindow->layoutVisibleChatWidgets(); + m_mainWindow->layoutVisibleChatWidgets(channel); } void -Windows::repaintVisibleChatWidgets() +Windows::repaintVisibleChatWidgets(Channel *channel) { - m_mainWindow->repaintVisibleChatWidgets(); + m_mainWindow->repaintVisibleChatWidgets(channel); } diff --git a/windows.h b/windows.h index 79bf3efa5..f702f7804 100644 --- a/windows.h +++ b/windows.h @@ -8,8 +8,8 @@ class Windows { public: - static void layoutVisibleChatWidgets(); - static void repaintVisibleChatWidgets(); + static void layoutVisibleChatWidgets(Channel *channel = NULL); + static void repaintVisibleChatWidgets(Channel *channel = NULL); static MainWindow & mainWindow()