Time for another update. Most significantly, I implemented most user commands.
[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
39   signals:
40     void sendInput(QString, QString, QString);
41     void nickListChanged(QStringList);
42
43   public slots:
44     void recvMessage(Message);
45     void recvStatusMsg(QString msg);
46     void setTopic(QString);
47     void setNicks(QStringList);
48     void addNick(QString nick, VarMap props);
49     void renameNick(QString oldnick, QString newnick);
50     void removeNick(QString nick);
51     void updateNick(QString nick, VarMap props);
52     void setOwnNick(QString nick);
53
54
55   private slots:
56     void enterPressed();
57     void updateNickList();
58
59     void itemExpansionChanged(QTreeWidgetItem *);
60
61   private:
62     Ui::ChannelWidget ui;
63
64     QString stdCol, errorCol, noticeCol, joinCol, quitCol, partCol, kickCol, serverCol, nickCol;
65     QString CSS;
66     QString _networkName;
67     QString _bufferName;
68     VarMap nicks;
69
70     QCompleter *completer;
71
72     bool opsExpanded, voicedExpanded, usersExpanded;
73 };
74
75 /** Temporary widget for displaying a set of ChannelWidgets. */
76 class IrcWidget : public QWidget {
77   Q_OBJECT
78
79   public:
80     IrcWidget(QWidget *parent = 0);
81
82   public slots:
83     void recvMessage(QString network, QString buffer, Message message);
84     void recvStatusMsg(QString network, QString message);
85     void setTopic(QString, QString, QString);
86     void setNicks(QString, QString, QStringList);
87     void addNick(QString net, QString nick, VarMap props);
88     void removeNick(QString net, QString nick);
89     void renameNick(QString net, QString oldnick, QString newnick);
90     void updateNick(QString net, QString nick, VarMap props);
91     void setOwnNick(QString net, QString nick);
92
93   signals:
94     void sendInput(QString network, QString buffer, QString message);
95
96   private slots:
97     void userInput(QString, QString, QString);
98
99   private:
100     Ui::IrcWidget ui;
101     QHash<QString, ChannelWidget *> buffers;
102     VarMap nicks;
103     QHash<QString, QString> ownNick;
104
105     ChannelWidget * getBuffer(QString net, QString buf);
106 };
107
108 #endif