Communi  3.4.0
A cross-platform IRC framework written with Qt
ircclient.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2015 The Communi Project
3  *
4  * This example is free, and not covered by the BSD license. There is no
5  * restriction applied to their modification, redistribution, using and so on.
6  * You can study them, modify them, use them in your own program - either
7  * completely or partially.
8  */
9 
10 #ifndef IRCCLIENT_H
11 #define IRCCLIENT_H
12 
13 #include <QSplitter>
14 #include <QHash>
15 
16 class IrcBuffer;
17 class IrcMessage;
18 class IrcUserModel;
19 class IrcCompleter;
20 class IrcConnection;
21 class IrcBufferModel;
22 class IrcCommandParser;
23 
24 QT_FORWARD_DECLARE_CLASS(QLineEdit)
25 QT_FORWARD_DECLARE_CLASS(QListView)
26 QT_FORWARD_DECLARE_CLASS(QTextEdit)
27 QT_FORWARD_DECLARE_CLASS(QModelIndex)
28 QT_FORWARD_DECLARE_CLASS(QTextDocument)
29 
30 class IrcClient : public QSplitter
31 {
32  Q_OBJECT
33 
34 public:
35  IrcClient(QWidget* parent = 0);
36  ~IrcClient();
37 
38 private slots:
39  void onConnected();
40  void onConnecting();
41  void onDisconnected();
42 
43  void onTextEdited();
44  void onTextEntered();
45 
46  void onCompletion();
47  void onCompleted(const QString& text, int cursor);
48 
49  void onBufferAdded(IrcBuffer* buffer);
50  void onBufferRemoved(IrcBuffer* buffer);
51 
52  void onBufferActivated(const QModelIndex& index);
53  void onUserActivated(const QModelIndex& index);
54 
55  void receiveMessage(IrcMessage* message);
56 
57 private:
58  void createLayout();
59  void createCompleter();
60  void createParser();
61  void createUserList();
62  void createBufferList();
63  void createConnection();
64 
65  QLineEdit* lineEdit;
66  QTextEdit* textEdit;
67  QListView* userList;
68  QListView* bufferList;
69 
70  IrcCompleter* completer;
71  IrcCommandParser* parser;
72  IrcConnection* connection;
73  IrcBufferModel* bufferModel;
76 };
77 
78 #endif // IRCCLIENT_H
Provides means to establish a connection to an IRC server.
Definition: ircconnection.h:48
Keeps track of channel users.
Definition: ircusermodel.h:44
Keeps track of buffer status.
Definition: ircbuffer.h:49
Provides command and name completion.
Definition: irccompleter.h:43
Parses commands from user input.
Definition: irccommandparser.h:42
Keeps track of buffers.
Definition: ircbuffermodel.h:46
The base class of all messages.
Definition: ircmessage.h:47
QObject * parent() const