X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtopia%2Fchatwidget.cpp;h=f7eaed2d3f74def50308def43af1908321576e2e;hp=9151cb79e88d261caf4945c21e913c5be870f2fa;hb=9fd4619e9aca7d53d7c5df156a0b25956a1bf682;hpb=6c6daea183c3a013a91fb8e9f250f6dece3023f8 diff --git a/src/qtopia/chatwidget.cpp b/src/qtopia/chatwidget.cpp index 9151cb79..f7eaed2d 100644 --- a/src/qtopia/chatwidget.cpp +++ b/src/qtopia/chatwidget.cpp @@ -17,3 +17,50 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + +#include +#include "chatwidget.h" + +ChatWidget::ChatWidget(QWidget *parent) : QTextEdit(parent) { + +} + +void ChatWidget::setContents(QList lines) { + clear(); + appendChatLines(lines); + +} + +void ChatWidget::prependMsg(AbstractUiMsg *msg) { + ChatLine *line = dynamic_cast(msg); + Q_ASSERT(line); + prependChatLine(line); +} + +void ChatWidget::appendMsg(AbstractUiMsg *msg) { + ChatLine *line = dynamic_cast(msg); + Q_ASSERT(line); + appendChatLine(line); +} + +void ChatWidget::appendChatLine(ChatLine *line) { + append(line->text()); qDebug() << "appending"; +} + +void ChatWidget::appendChatLines(QList list) { + foreach(ChatLine *line, list) { + appendChatLine(line); + } +} + +void ChatWidget::prependChatLine(ChatLine *line) { + QTextCursor cursor = textCursor(); + moveCursor(QTextCursor::Start); + insertHtml(line->text()); + setTextCursor(cursor); +} + +void ChatWidget::prependChatLines(QList list) { + + +}