added option to refresh only certain channels

This commit is contained in:
fourtf 2017-01-16 15:06:12 +01:00
parent 1194905646
commit bacb183cdb
9 changed files with 47 additions and 16 deletions

View file

@ -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 =

View file

@ -23,6 +23,12 @@ public:
return m_view;
}
Channel *
channel() const
{
return m_channel;
}
protected:
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;

View file

@ -2,6 +2,7 @@
ChatWidgetHeaderButtonLabel::ChatWidgetHeaderButtonLabel()
{
setAlignment(Qt::AlignCenter);
}
void

View file

@ -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();
}
}
}

View file

@ -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

6
textinputform.cpp Normal file
View file

@ -0,0 +1,6 @@
#include "textinputform.h"
TextInputForm::TextInputForm()
{
}

12
textinputform.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef TEXTINPUTFORM_H
#define TEXTINPUTFORM_H
#include <QDialog>
class TextInputForm : public QDialog
{
public:
TextInputForm();
};
#endif // TEXTINPUTFORM_H

View file

@ -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);
}

View file

@ -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()