root/trunk/qt4-gui/src/dialogs/chatdlg.h

Revision 5837, 4.0 kB (checked in by eugene, 12 months ago)

P.S. Happy recompiling ;-)

  • Property svn:eol-style set to native
Line 
1/*
2 * This file is part of Licq, an instant messaging client for UNIX.
3 * Copyright (C) 1999-2006 Licq developers
4 *
5 * Licq 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 * Licq 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 Licq; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20#ifndef CHATDLG_H
21#define CHATDLG_H
22
23#include <deque>
24#include <list>
25
26#include <QDialog>
27#include <QTextEdit>
28
29class QColor;
30class QComboBox;
31class QGridLayout;
32class QGroupBox;
33class QLabel;
34class QListWidget;
35class QMenu;
36class QPixmap;
37class QSocketNotifier;
38class QTextCodec;
39class QToolButton;
40
41class CChatManager;
42class CChatUser;
43
44namespace LicqQtGui
45{
46class ChatWindow : public QTextEdit
47{
48Q_OBJECT
49public:
50  ChatWindow(QWidget* p);
51  virtual ~ChatWindow() {}
52
53  QString lastLine() const;
54  void appendNoNewLine(QString);
55  void GotoEnd();
56
57  void setBackground(const QColor&);
58  void setForeground(const QColor&);
59
60public slots:
61  virtual void insert (const QString&);
62  virtual void paste();
63  virtual void cut() {}
64  void backspace();
65
66private:
67  virtual void keyPressEvent(QKeyEvent*);
68  virtual void mousePressEvent(QMouseEvent*);
69  virtual void mouseMoveEvent(QMouseEvent*);
70  virtual void mouseReleaseEvent(QMouseEvent* e);
71
72signals:
73  void keyPressed(QKeyEvent*);
74};
75
76
77class ChatDlg;
78typedef std::list<ChatDlg*> ChatDlgList;
79typedef struct {
80  CChatUser* u;
81  ChatWindow* w;
82  QLabel* l;
83} UserWindowPair;
84typedef std::list<UserWindowPair> ChatUserWindowsList;
85typedef std::list<QPixmap*> QPixmapList;
86
87enum ChatMode { CHAT_PANE, CHAT_IRC };
88
89
90//=====ChatDlg===============================================================
91
92class ChatDlg : public QDialog
93{
94   Q_OBJECT
95public:
96  ChatDlg(QString id, unsigned long ppid, QWidget* parent = 0);
97  virtual ~ChatDlg();
98
99  bool StartAsClient(unsigned short nPort);
100  bool StartAsServer();
101
102  unsigned short LocalPort();
103  QString id()  { return myId; }
104  unsigned long Ppid()  { return myPpid; }
105
106  QString ChatClients();
107  QString ChatName();
108
109  static ChatDlgList chatDlgs;
110
111signals:
112  void encodingChanged();
113
114private:
115  CChatManager* chatman;
116
117  ChatWindow* mlePaneLocal;
118  ChatWindow* mleIRCRemote;
119  ChatWindow* mleIRCLocal;
120  QGridLayout* paneLayout;
121  QGridLayout* remoteLayout;
122  QGroupBox* boxPane;
123  QGroupBox* boxIRC;
124  QLabel* lblLocal;
125  QLabel* lblRemote;
126  QMenu* mnuMode;
127  QMenu* mnuStyle;
128  QMenu* mnuMain;
129  QMenu* mnuFg;
130  QMenu* mnuBg;
131  QListWidget* lstUsers;
132
133  QAction* tbtBold;
134  QAction* tbtItalic;
135  QAction* tbtUnderline;
136  QAction* tbtStrikeOut;
137  QAction* tbtLaugh;
138  QAction* tbtBeep;
139  QAction* tbtFg;
140  QAction* tbtBg;
141  QAction* tbtIgnore;
142  QAction* tbtEncoding;
143
144  QString linebuf, chatname;
145  QComboBox* cmbFontName;
146  QComboBox* cmbFontSize;
147
148  ChatMode m_nMode;
149  ChatUserWindowsList chatUserWindows;
150
151  QString myId;
152  unsigned long myPpid;
153  QSocketNotifier* sn;
154  bool myAudio;
155  QTextCodec* codec;
156
157  virtual void closeEvent(QCloseEvent*);
158  ChatWindow* GetWindow(CChatUser* u);
159  void UpdateRemotePane();
160
161  friend class JoinChatDlg;
162
163private slots:
164  void chatSend(QKeyEvent*);
165  void chatSendBeep();
166  void chatClose(CChatUser*);
167
168  void slot_chat();
169  bool slot_save();
170  void slot_audio(bool audio);
171
172  void fontSizeChanged(const QString&);
173  void fontNameChanged(const QString&);
174  void sendFontInfo();
175  void fontStyleChanged();
176  void changeFrontColor(QAction* action);
177  void changeBackColor(QAction* action);
178  void updateRemoteStyle();
179
180  void SwitchToPaneMode();
181  void SwitchToIRCMode();
182  void setEncoding(QAction* action);
183};
184
185} // namespace LicqQtGui
186
187#endif
Note: See TracBrowser for help on using the browser.