X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtopia%2Fchatwidget.cpp;h=9f8eabb538a420c99461b87fc795f2edcd97bd9b;hp=43758d36fdf71e36ca06e21025fc17b62c0e0be4;hb=906789f761e5d1b37b46b5a05a2f649e28900e36;hpb=6ecdc735718f39110baf3be8c4773c3a26712b6f diff --git a/src/qtopia/chatwidget.cpp b/src/qtopia/chatwidget.cpp index 43758d36..9f8eabb5 100644 --- a/src/qtopia/chatwidget.cpp +++ b/src/qtopia/chatwidget.cpp @@ -22,30 +22,32 @@ #include #include "chatwidget.h" -ChatWidget::ChatWidget(QWidget *parent) : QTextEdit(parent) { +ChatWidget::ChatWidget(QWidget *parent) : QTextEdit(parent), AbstractChatView() { setStyleSheet("background-color: rgba(255, 255, 255, 60%)"); setTextInteractionFlags(Qt::TextBrowserInteraction); } -void ChatWidget::setContents(QList lines) { +void ChatWidget::setContents(const QList &lines) { clear(); - appendChatLines(lines); + QList list; + foreach(AbstractUiMsg *msg, lines) list << static_cast(msg); + appendChatLines(list); } void ChatWidget::prependMsg(AbstractUiMsg *msg) { - ChatLineOld *line = static_cast(msg); + ChatLine *line = static_cast(msg); Q_ASSERT(line); prependChatLine(line); } void ChatWidget::appendMsg(AbstractUiMsg *msg) { - ChatLineOld *line = static_cast(msg); + ChatLine *line = static_cast(msg); Q_ASSERT(line); appendChatLine(line); } -void ChatWidget::appendChatLine(ChatLineOld *line) { +void ChatWidget::appendChatLine(ChatLine *line) { QTextCursor cursor = textCursor(); moveCursor(QTextCursor::End); if(!document()->isEmpty()) insertPlainText("\n"); @@ -55,13 +57,13 @@ void ChatWidget::appendChatLine(ChatLineOld *line) { setTextCursor(cursor); } -void ChatWidget::appendChatLines(QList list) { - foreach(ChatLineOld *line, list) { +void ChatWidget::appendChatLines(QList list) { + foreach(ChatLine *line, list) { appendChatLine(line); } } -void ChatWidget::prependChatLine(ChatLineOld *line) { +void ChatWidget::prependChatLine(ChatLine *line) { QTextCursor cursor = textCursor(); moveCursor(QTextCursor::Start); bool flg = document()->isEmpty(); @@ -72,13 +74,13 @@ void ChatWidget::prependChatLine(ChatLineOld *line) { setTextCursor(cursor); } -void ChatWidget::prependChatLines(QList list) { - foreach(ChatLineOld *line, list) { +void ChatWidget::prependChatLines(QList list) { + foreach(ChatLine *line, list) { prependChatLine(line); } } -void ChatWidget::insertChatLine(ChatLineOld *line) { +void ChatWidget::insertChatLine(ChatLine *line) { if(!document()->isEmpty()) insertPlainText("\n"); insertStyledText(line->styledSender()); insertPlainText(" ");