X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtopia%2Fchatwidget.cpp;fp=src%2Fqtopia%2Fchatwidget.cpp;h=f7eaed2d3f74def50308def43af1908321576e2e;hp=9151cb79e88d261caf4945c21e913c5be870f2fa;hb=52380175425bdab29f825c9cd17a0e4c1952c2db;hpb=5eb6d000ade10f3384c67e1dce42ea96a49dad2a 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) { + + +}