X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtopia%2Fmainwidget.cpp;h=287aa79a7a9ccf8fce6646742f8276d830ff4304;hp=520ba7667de195ba92b74dff2c85d44f1990c190;hb=c9ef00c67a47448e92398a5dce6ce5b74e77783a;hpb=adc222822ec7d872f2bcc0ca384e6ec5fd777287 diff --git a/src/qtopia/mainwidget.cpp b/src/qtopia/mainwidget.cpp index 520ba766..287aa79a 100644 --- a/src/qtopia/mainwidget.cpp +++ b/src/qtopia/mainwidget.cpp @@ -5,7 +5,7 @@ * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -25,6 +25,7 @@ MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { ui.setupUi(this); + ui.inputLine->hide(); ui.topicBar->hide(); connect(ui.inputLine, SIGNAL(returnPressed()), this, SLOT(enterPressed())); currentBuffer = 0; } @@ -36,6 +37,11 @@ MainWidget::~MainWidget() { } void MainWidget::setBuffer(Buffer *buf) { + if(!buf) { + ui.stack->setCurrentIndex(0); + currentBuffer = 0; + return; + } // TODO update topic if changed; handle status buffer display QString title = QString("%1 (%2): \"%3\"").arg(buf->name()).arg(buf->networkName()).arg(buf->topic()); ui.topicBar->setContents(title); @@ -57,12 +63,13 @@ void MainWidget::setBuffer(Buffer *buf) { 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(topicSet(QString)), this, SLOT(setTopic(QString))); //connect(buf, SIGNAL(ownNickSet(QString)), this, SLOT(setOwnNick(QString))); ui.stack->addWidget(chatWidget); chatWidgets.insert(buf, chatWidget); chatWidget->setFocusProxy(ui.inputLine); } else chatWidget = chatWidgets[buf]; + ui.inputLine->show(); ui.topicBar->show(); ui.stack->setCurrentWidget(chatWidget); ui.inputLine->setFocus(); currentBuffer = buf; @@ -76,3 +83,12 @@ void MainWidget::enterPressed() { } ui.inputLine->clear(); } + +// FIXME make this more elegant, we don't need to send a string around... +void MainWidget::setTopic(QString topic) { + Q_UNUSED(topic); + if(currentBuffer) { + QString title = QString("%1 (%2): \"%3\"").arg(currentBuffer->name()).arg(currentBuffer->networkName()).arg(currentBuffer->topic()); + ui.topicBar->setContents(title); + } +}