e1d2f2e26b54b9e0c718d588e5a2bdb9cabc9a71
[quassel.git] / gui / channelwidget.h
1 /***************************************************************************
2  *   Copyright (C) 2005 by The Quassel Team                                *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
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.                                   *
9  *                                                                         *
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.                          *
14  *                                                                         *
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  ***************************************************************************/
20
21 #ifndef _CHANNELWIDGET_H_
22 #define _CHANNELWIDGET_H_
23
24 #include "ui_channelwidget.h"
25 #include "ui_ircwidget.h"
26
27 #include "global.h"
28 #include "message.h"
29
30 class ChannelWidget : public QWidget {
31   Q_OBJECT
32
33   public:
34     ChannelWidget(QString netname, QString bufname, QString ownNick, QWidget *parent = 0);
35
36     QString bufferName() { return _bufferName; }
37     QString networkName() { return _networkName; }
38   signals:
39     void sendInput(QString, QString, QString);
40
41   public slots:
42     void recvMessage(Message);
43     void recvStatusMsg(QString msg);
44     void setTopic(QString);
45     void setNicks(QStringList);
46     void addNick(QString nick, VarMap props);
47     void removeNick(QString nick);
48     void updateNick(QString nick, VarMap props);
49     void setOwnNick(QString nick);
50
51
52   private slots:
53     void enterPressed();
54     void updateNickList();
55
56   private:
57     Ui::ChannelWidget ui;
58
59     QColor stdCol, errorCol, noticeCol, joinCol, quitCol, partCol, serverCol;
60     QString _networkName;
61     QString _bufferName;
62     VarMap nicks;
63 };
64
65 /** Temporary widget for displaying a set of ChannelWidgets. */
66 class IrcWidget : public QWidget {
67   Q_OBJECT
68
69   public:
70     IrcWidget(QWidget *parent = 0);
71
72   public slots:
73     void recvMessage(QString network, QString buffer, Message message);
74     void recvStatusMsg(QString network, QString message);
75     void setTopic(QString, QString, QString);
76     void setNicks(QString, QString, QStringList);
77     void addNick(QString net, QString nick, VarMap props);
78     void removeNick(QString net, QString nick);
79     void updateNick(QString net, QString nick, VarMap props);
80     void setOwnNick(QString net, QString nick);
81
82   signals:
83     void sendInput(QString network, QString buffer, QString message);
84
85   private slots:
86     void userInput(QString, QString, QString);
87
88   private:
89     Ui::IrcWidget ui;
90     QHash<QString, ChannelWidget *> buffers;
91     VarMap nicks;
92     QString ownNick;
93
94     ChannelWidget * getBuffer(QString net, QString buf);
95 };
96
97 #endif