Communi  3.7.0
A cross-platform IRC framework written with Qt
Loading...
Searching...
No Matches
ircclient.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2020 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
16class IrcBuffer;
17class IrcMessage;
18class IrcUserModel;
19class IrcCompleter;
20class IrcConnection;
21class IrcBufferModel;
23
24QT_FORWARD_DECLARE_CLASS(QLineEdit)
25QT_FORWARD_DECLARE_CLASS(QListView)
26QT_FORWARD_DECLARE_CLASS(QTextEdit)
27QT_FORWARD_DECLARE_CLASS(QModelIndex)
28QT_FORWARD_DECLARE_CLASS(QTextDocument)
29
30class IrcClient : public QSplitter
31{
32 Q_OBJECT
33
34public:
35 IrcClient(QWidget* parent = nullptr);
36 ~IrcClient() override;
37
38private 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
57private:
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;
74 QHash<IrcBuffer*, IrcUserModel*> userModels;
75 QHash<IrcBuffer*, QTextDocument*> documents;
76};
77
78#endif // IRCCLIENT_H
Keeps track of buffers.
Definition ircbuffermodel.h:48
Keeps track of buffer status.
Definition ircbuffer.h:50
Parses commands from user input.
Definition irccommandparser.h:43
Provides command and name completion.
Definition irccompleter.h:44
Provides means to establish a connection to an IRC server.
Definition ircconnection.h:49
The base class of all messages.
Definition ircmessage.h:48
Keeps track of channel users.
Definition ircusermodel.h:46