blob: 9d6ee3c566273e400dc81e1ab43a30f8c8bc0ad2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* Copyright (C) 2008-2014 The Communi Project
*
* This example is free, and not covered by the BSD license. There is no
* restriction applied to their modification, redistribution, using and so on.
* You can study them, modify them, use them in your own program - either
* completely or partially.
*/
#ifndef IRCCLIENT_H
#define IRCCLIENT_H
#include <QSplitter>
#include <QHash>
class IrcBuffer;
class IrcMessage;
class IrcUserModel;
class IrcCompleter;
class IrcConnection;
class IrcBufferModel;
class IrcCommandParser;
QT_FORWARD_DECLARE_CLASS(QLineEdit)
QT_FORWARD_DECLARE_CLASS(QListView)
QT_FORWARD_DECLARE_CLASS(QTextEdit)
QT_FORWARD_DECLARE_CLASS(QModelIndex)
QT_FORWARD_DECLARE_CLASS(QTextDocument)
class IrcClient : public QSplitter
{
Q_OBJECT
public:
IrcClient(QWidget* parent = 0);
~IrcClient();
private slots:
void onConnected();
void onConnecting();
void onDisconnected();
void onTextEdited();
void onTextEntered();
void onCompletion();
void onCompleted(const QString& text, int cursor);
void onBufferAdded(IrcBuffer* buffer);
void onBufferRemoved(IrcBuffer* buffer);
void onBufferActivated(const QModelIndex& index);
void onUserActivated(const QModelIndex& index);
void receiveMessage(IrcMessage* message);
private:
void createLayout();
void createCompleter();
void createParser();
void createUserList();
void createBufferList();
void createConnection();
QLineEdit* lineEdit;
QTextEdit* textEdit;
QListView* userList;
QListView* bufferList;
IrcCompleter* completer;
IrcCommandParser* parser;
IrcConnection* connection;
IrcBufferModel* bufferModel;
QHash<IrcBuffer*, IrcUserModel*> userModels;
QHash<IrcBuffer*, QTextDocument*> documents;
};
#endif // IRCCLIENT_H
|