1 /***************************************************************************
2 * Copyright (C) 2005 by The Quassel Team *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "channelwidget.h"
27 ChannelWidget::ChannelWidget(QWidget *parent) : QWidget(parent) {
29 //ui.inputEdit->grabKeyboard();
32 ui.textBrowser->setHtml("[17:21] <em>--> Dante has joined #quassel (~hurz@p1af2242.dip.t-dialin.net)</em><br>"
33 "[17:21] <em>--> Sput has joined #quassel (~Sput42@vincent.mindpool.net)</em><br>"
34 "[17:23] <<b>Dante</b>> Das sieht ja soweit schonmal Klasse aus!<br>"
35 "[17:23] <<b>Sput</b>> Find ich auch... schade dass es noch nix tut :p<br>"
36 "[17:24] <<b>Dante</b>> Das wird sich ja gottseidank bald ändern.<br>"
37 "[17:24] <<b>Sput</b>> Wollen wir's hoffen :D"
39 ui.listWidget->addItem("@Dante");
40 ui.listWidget->addItem("@Sput");
42 //connect(&core, SIGNAL(outputLine( const QString& )), ui.textBrowser, SLOT(insertPlainText(const QString &)));
43 //connect(ui.lineEdit, SIGNAL(
44 //connect(&core, SIGNAL(outputLine( const QString& )), this, SLOT(lineReceived(const QString &)));
45 connect(ui.inputEdit, SIGNAL(returnPressed()), this, SLOT(enterPressed()));
46 //connect(this, SIGNAL(inputLine( const QString& )), &core, SLOT(inputLine( const QString& )));
48 connect(this, SIGNAL(inputLine(QString)), guiProxy, SLOT(gsUserInput(QString)));
49 connect(guiProxy, SIGNAL(csSendMessage(QString, QString, QString)), this, SLOT(msgReceived(QString, QString, QString)));
50 connect(guiProxy, SIGNAL(csSendStatusMsg(QString, QString)), this, SLOT(statusMsgReceived(QString, QString)));
51 ui.inputEdit->setFocus();
54 void ChannelWidget::enterPressed() {
55 emit inputLine(ui.inputEdit->text());
56 ui.inputEdit->clear();
59 void ChannelWidget::msgReceived(QString net, QString chan, QString msg) {
60 ui.chatWidget->insertPlainText(QString("[%1:%2] %3\n").arg(net).arg(chan).arg(msg));
61 ui.chatWidget->ensureCursorVisible();
64 void ChannelWidget::statusMsgReceived(QString net, QString msg) {
65 msgReceived(net, "STATUS", msg);