16 * along with this program; if not, write to the Free Software |
16 * along with this program; if not, write to the Free Software |
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
18 */ |
18 */ |
19 |
19 |
20 #include <QTextBrowser> |
20 #include <QTextBrowser> |
21 #include <QListWidget> |
|
22 #include <QLineEdit> |
21 #include <QLineEdit> |
23 #include <QAction> |
22 #include <QAction> |
24 #include <QApplication> |
23 #include <QApplication> |
25 #include <QTextDocument> |
24 #include <QTextDocument> |
26 |
25 |
53 chatNicks->setMinimumHeight(10); |
52 chatNicks->setMinimumHeight(10); |
54 chatNicks->setMinimumWidth(10); |
53 chatNicks->setMinimumWidth(10); |
55 chatNicks->setSortingEnabled(true); |
54 chatNicks->setSortingEnabled(true); |
56 chatNicks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
55 chatNicks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
57 chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu); |
56 chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu); |
|
57 connect(chatNicks, SIGNAL(itemDoubleClicked(QListWidgetItem *)), |
|
58 this, SLOT(chatNickDoubleClicked(QListWidgetItem *))); |
|
59 |
58 mainLayout.addWidget(chatNicks, 0, 1); |
60 mainLayout.addWidget(chatNicks, 0, 1); |
59 |
61 |
60 acInfo = new QAction(QAction::tr("Info"), chatNicks); |
62 acInfo = new QAction(QAction::tr("Info"), chatNicks); |
61 connect(acInfo, SIGNAL(triggered(bool)), this, SLOT(onInfo())); |
63 connect(acInfo, SIGNAL(triggered(bool)), this, SLOT(onInfo())); |
62 acKick = new QAction(QAction::tr("Kick"), chatNicks); |
64 acKick = new QAction(QAction::tr("Kick"), chatNicks); |
63 connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick())); |
65 connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick())); |
64 acBan = new QAction(QAction::tr("Ban"), chatNicks); |
66 acBan = new QAction(QAction::tr("Ban"), chatNicks); |
65 connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan())); |
67 connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan())); |
|
68 acFollow = new QAction(QAction::tr("Follow"), chatNicks); |
|
69 connect(acFollow, SIGNAL(triggered(bool)), this, SLOT(onFollow())); |
66 |
70 |
67 chatNicks->insertAction(0, acInfo); |
71 chatNicks->insertAction(0, acInfo); |
|
72 chatNicks->insertAction(0, acFollow); |
68 } |
73 } |
69 |
74 |
70 void HWChatWidget::returnPressed() |
75 void HWChatWidget::returnPressed() |
71 { |
76 { |
72 emit chatLine(chatEditLine->text()); |
77 emit chatLine(chatEditLine->text()); |
146 QListWidgetItem * curritem = chatNicks->currentItem(); |
151 QListWidgetItem * curritem = chatNicks->currentItem(); |
147 if (curritem) |
152 if (curritem) |
148 emit info(curritem->text()); |
153 emit info(curritem->text()); |
149 } |
154 } |
150 |
155 |
|
156 void HWChatWidget::onFollow() |
|
157 { |
|
158 QListWidgetItem * curritem = chatNicks->currentItem(); |
|
159 if (curritem) |
|
160 emit follow(curritem->text()); |
|
161 } |
|
162 |
|
163 void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item) |
|
164 { |
|
165 if (item) onFollow(); |
|
166 } |
|
167 |
151 void HWChatWidget::setReadyStatus(const QString & nick, bool isReady) |
168 void HWChatWidget::setReadyStatus(const QString & nick, bool isReady) |
152 { |
169 { |
153 QList<QListWidgetItem *> items = chatNicks->findItems(nick, Qt::MatchExactly); |
170 QList<QListWidgetItem *> items = chatNicks->findItems(nick, Qt::MatchExactly); |
154 if (items.size() != 1) |
171 if (items.size() != 1) |
155 { |
172 { |