X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtopia%2Fmainwidget.cpp;fp=src%2Fqtopia%2Fmainwidget.cpp;h=3600fadf6e09350316d63797c071815b17e22ef7;hp=9ab5b620ff7db981b9986203462824731cb46b63;hb=52380175425bdab29f825c9cd17a0e4c1952c2db;hpb=5eb6d000ade10f3384c67e1dce42ea96a49dad2a diff --git a/src/qtopia/mainwidget.cpp b/src/qtopia/mainwidget.cpp index 9ab5b620..3600fadf 100644 --- a/src/qtopia/mainwidget.cpp +++ b/src/qtopia/mainwidget.cpp @@ -21,6 +21,7 @@ #include "mainwidget.h" #include "buffer.h" +#include "chatwidget.h" MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { ui.setupUi(this); @@ -39,9 +40,33 @@ MainWidget::~MainWidget() { } -void MainWidget::setBuffer(Buffer *b) { +void MainWidget::setBuffer(Buffer *buf) { // TODO update topic if changed; handle status buffer display - QString title = QString("%1 (%2): \"%3\"").arg(b->displayName()).arg(b->networkName()).arg(b->topic()); + QString title = QString("%1 (%2): \"%3\"").arg(buf->displayName()).arg(buf->networkName()).arg(buf->topic()); ui.topicBar->setContents(title); + //ui.chatWidget->setStyleSheet("div { color: #777777; }"); + //ui.chatWidget->setHtml("" + // "
foo
bar
baz"); + //ui.chatWidget->moveCursor(QTextCursor::End); + //ui.chatWidget->insertHtml("
brumm
"); + + ChatWidget *chatWidget; + if(!chatWidgets.contains(buf)) { + chatWidget = new ChatWidget(this); + QList lines; + QList msgs = buf->contents(); + foreach(AbstractUiMsg *msg, msgs) { + lines.append(dynamic_cast(msg)); + } + chatWidget->setContents(lines); + connect(buf, SIGNAL(msgAppended(AbstractUiMsg *)), chatWidget, SLOT(appendMsg(AbstractUiMsg *))); + connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), chatWidget, SLOT(prependMsg(AbstractUiMsg *))); + //connect(buf, SIGNAL(topicSet(QString)), this, SLOT(setTopic(QString))); + //connect(buf, SIGNAL(ownNickSet(QString)), this, SLOT(setOwnNick(QString))); + ui.stack->addWidget(chatWidget); + chatWidgets.insert(buf, chatWidget); + ui.stack->addWidget(chatWidget); + } else chatWidget = chatWidgets[buf]; + ui.stack->setCurrentWidget(chatWidget); }