Mercurial > octave-nkf
comparison gui/octave-gui/src/irc/IRCWidget.h @ 14240:a9992bc3c3f7 gui
GUI: Added qtermwidget snapshot as a subproject to build as a library that links with Octave GUI.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sat, 21 Jan 2012 11:26:36 +0100 |
parents | gui/src/irc/IRCWidget.h@e272af3f252d |
children |
comparison
equal
deleted
inserted
replaced
14239:7ecaa8a66d5a | 14240:a9992bc3c3f7 |
---|---|
1 /* OctaveGUI - A graphical user interface for Octave | |
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) | |
3 * | |
4 * This program is free software: you can redistribute it and/or modify | |
5 * it under the terms of the GNU Affero General Public License as | |
6 * published by the Free Software Foundation, either version 3 of the | |
7 * License, or (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU Affero General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU Affero General Public License | |
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 #ifndef IRCWIDGET_H | |
19 #define IRCWIDGET_H | |
20 | |
21 #include <QWidget> | |
22 #include <QPlainTextEdit> | |
23 #include <QPushButton> | |
24 #include <QLineEdit> | |
25 #include <QCompleter> | |
26 #include "IRCClientInterface.h" | |
27 | |
28 class ChatMessageTextEdit : public QPlainTextEdit | |
29 { | |
30 Q_OBJECT | |
31 public: | |
32 explicit ChatMessageTextEdit(QWidget *parent = 0); | |
33 ~ChatMessageTextEdit(); | |
34 | |
35 void setCompleter(QCompleter *m_completer); | |
36 QCompleter *completer() const; | |
37 | |
38 signals: | |
39 void sendMessage (const QString& message); | |
40 | |
41 protected: | |
42 void keyPressEvent(QKeyEvent *e); | |
43 void focusInEvent(QFocusEvent *e); | |
44 | |
45 private slots: | |
46 void insertCompletion(const QString &completion); | |
47 | |
48 private: | |
49 QString textUnderCursor() const; | |
50 | |
51 private: | |
52 QCompleter *m_completer; | |
53 }; | |
54 | |
55 class IRCWidget : public QWidget | |
56 { | |
57 Q_OBJECT public: | |
58 explicit IRCWidget (QWidget * parent); | |
59 void connectToServer (); | |
60 | |
61 public slots: | |
62 void showStatusMessage (const QString&); | |
63 void showErrorMessage (const QString&); | |
64 void showMessage (const QString& channel, const QString& sender, const QString& message); | |
65 void showNotification (const QString& sender, const QString& message); | |
66 | |
67 void handleConnected (const QString& host); | |
68 void joinOctaveChannel (const QString& nick); | |
69 | |
70 void handleLoggedIn (const QString& nick); | |
71 void handleNickChange (const QString& oldNick, const QString& newNick); | |
72 void handleUserJoined (const QString& nick, const QString& channel); | |
73 void handleUserQuit (const QString& nick, const QString& reason); | |
74 void handleUserNicknameChanged (const QString& nick); | |
75 | |
76 void showChangeUserNickPopup (); | |
77 void sendMessage (QString); | |
78 | |
79 void maybeIdentifyOnNickServ (); | |
80 void scrollToBottom (); | |
81 | |
82 signals: | |
83 void unreadMessages (bool yes); | |
84 | |
85 protected: | |
86 void focusInEvent (QFocusEvent *focusEvent); | |
87 | |
88 private: | |
89 IRCClientInterface *m_ircClientInterface; | |
90 IRCChannelProxyInterface *m_octaveChannel; | |
91 QTextEdit *m_chatWindow; | |
92 QPushButton *m_nickButton; | |
93 ChatMessageTextEdit *m_chatMessageTextEdit; | |
94 | |
95 QString m_initialNick; | |
96 bool m_autoIdentification; | |
97 QString m_nickServPassword; | |
98 QString m_settingsFile; | |
99 }; | |
100 | |
101 #endif // IRCWIDGET_H |