a9b33287e67c5accfc69eac844ec6945d7f9e82d
[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 renameNick(QString oldnick, QString newnick);
48     void removeNick(QString nick);
49     void updateNick(QString nick, VarMap props);
50     void setOwnNick(QString nick);
51
52
53   private slots:
54     void enterPressed();
55     void updateNickList();
56
57   private:
58     Ui::ChannelWidget ui;
59
60     QString stdCol, errorCol, noticeCol, joinCol, quitCol, partCol, kickCol, serverCol, nickCol;
61     QString CSS;
62     QString _networkName;
63     QString _bufferName;
64     VarMap nicks;
65 };
66
67 /** Temporary widget for displaying a set of ChannelWidgets. */
68 class IrcWidget : public QWidget {
69   Q_OBJECT
70
71   public:
72     IrcWidget(QWidget *parent = 0);
73
74   public slots:
75     void recvMessage(QString network, QString buffer, Message message);
76     void recvStatusMsg(QString network, QString message);
77     void setTopic(QString, QString, QString);
78     void setNicks(QString, QString, QStringList);
79     void addNick(QString net, QString nick, VarMap props);
80     void removeNick(QString net, QString nick);
81     void renameNick(QString net, QString oldnick, QString newnick);
82     void updateNick(QString net, QString nick, VarMap props);
83     void setOwnNick(QString net, QString nick);
84
85   signals:
86     void sendInput(QString network, QString buffer, QString message);
87
88   private slots:
89     void userInput(QString, QString, QString);
90
91   private:
92     Ui::IrcWidget ui;
93     QHash<QString, ChannelWidget *> buffers;
94     VarMap nicks;
95     QHash<QString, QString> ownNick;
96
97     ChannelWidget * getBuffer(QString net, QString buf);
98 };
99
100 #endif