Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-qt/chatline.cpp Source File

Freeciv-3.1

Loading...
Searching...
No Matches
chatline.cpp
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18//Qt
19#include <QApplication>
20#include <QCheckBox>
21#include <QCompleter>
22#include <QGridLayout>
23#include <QKeyEvent>
24#include <QPainter>
25#include <QScrollBar>
26#include <QStyleFactory>
27#include <QTextBlock>
28#include <QTextLayout>
29#include <QTextBrowser>
30
31// common
32#include "chat.h"
33
34// client
35#include "audio.h"
36#include "climap.h"
37#include "climisc.h" // For write_chatline_content()
38#include "connectdlg_common.h"
39#include "control.h"
40#include "game.h"
41
42// gui-qt
43#include "chatline.h"
44#include "colors.h"
45#include "fc_client.h"
46#include "gui_main.h"
47#include "qtg_cxxside.h"
48
49static bool is_plain_public_message(QString s);
50
51 FC_CPP_DECLARE_LISTENER(chat_listener)
52QStringList chat_listener::history = QStringList();
53QStringList chat_listener::word_list = QStringList();
54
55/***********************************************************************/
58 void chat_listener::update_word_list()
59{
60 QString str;
61
62 conn_list_iterate(game.est_connections, pconn) {
63 if (pconn->playing) {
64 word_list << pconn->playing->name;
65 word_list << pconn->playing->username;
66 } else {
67 word_list << pconn->username;
68 }
69 } conn_list_iterate_end;
70
71 players_iterate(pplayer) {
72 str = pplayer->name;
73 if (!word_list.contains(str)) {
74 word_list << str;
75 }
76 } players_iterate_end
77
78 invoke(&chat_listener::chat_word_list_changed, word_list);
79}
80
81/***********************************************************************/
84chat_listener::chat_listener() :
85 position(HISTORY_END)
86{}
87
88/***********************************************************************/
92 void chat_listener::chat_message_received(const QString &,
93 const struct text_tag_list *)
94{}
95
96/***********************************************************************/
100 void chat_listener::chat_word_list_changed(const QStringList &)
101{}
102
103/***********************************************************************/
109 void chat_listener::send_chat_message(const QString &message)
110{
111 int index;
112 QString splayer, s;
113
114 /* FIXME
115 * Key == PICK: used for picking nation, it was put here cause those
116 * Qt slots are a bit limited ...I'm unable to pass custom player pointer
117 * or idk how to do that
118 */
119 s = message;
120 index = message.indexOf("PICK:");
121
122 if (index != -1) {
123 s = s.remove("PICK:");
124 /* now should be playername left in string */
125 players_iterate(pplayer) {
126 splayer = QString(pplayer->name);
127
128 if (!splayer.compare(s)) {
129 popup_races_dialog(pplayer);
130 }
131 } players_iterate_end;
132 return;
133 }
134
135 history << message;
136 reset_history_position();
137
138 /*
139 * If client send commands to take ai, set /away to disable AI
140 */
141 if (message.startsWith("/take ")) {
142 s = s.remove("/take ");
143 players_iterate(pplayer) {
144 splayer = QString(pplayer->name);
145 splayer = "\"" + splayer + "\"";
146
147 if (!splayer.compare(s)) {
148 if (is_ai(pplayer)) {
149 send_chat(message.toUtf8());
150 send_chat("/away");
151 return;
152 }
153 }
154 } players_iterate_end;
155 }
156
157 /*
158 * Option to send to allies by default
159 */
160 if (!message.isEmpty()) {
161 if (client_state() >= C_S_RUNNING && gui_options.gui_qt_allied_chat_only
162 && is_plain_public_message(message)) {
163 send_chat((QString(CHAT_ALLIES_PREFIX)
164 + " " + message).toUtf8());
165 } else {
166 send_chat(message.toUtf8());
167 }
168 }
169 // Empty messages aren't sent
170 // FIXME Inconsistent behavior: "." will send an empty message to allies
171}
172
173/***********************************************************************/
177QString chat_listener::back_in_history()
178{
179 if (!history.empty() && position == HISTORY_END) {
180 position = history.size() - 1;
181 } else if (position > 0) {
182 position--;
183 }
184 return history.empty() ? "" : history.at(position);
185}
186
187/***********************************************************************/
191QString chat_listener::forward_in_history()
192{
193 if (position == HISTORY_END) {
194 return "";
195 }
196 position++;
197 if (position >= history.size()) {
198 position = HISTORY_END;
199 return "";
200 } else {
201 return history.at(position);
202 }
203}
204
205/***********************************************************************/
208 void chat_listener::reset_history_position()
209{
210 position = HISTORY_END;
211}
212
213/***********************************************************************/
216chat_input::chat_input(QWidget *parent) :
217 QLineEdit(parent)
218{
219 connect(this, &QLineEdit::returnPressed, this, &chat_input::send);
220 chat_word_list_changed(current_word_list());
221 chat_listener::listen();
222}
223
224/***********************************************************************/
227 void chat_input::send()
228{
229 send_chat_message(text());
230 clear();
231}
232
233/***********************************************************************/
236 void chat_input::chat_word_list_changed(const QStringList &cmplt_word_list)
237{
238 QCompleter *cmplt = completer();
239
240 if (cmplt != nullptr) {
241 delete cmplt;
242 }
243
244 cmplt = new QCompleter(cmplt_word_list);
245 cmplt->setCaseSensitivity(Qt::CaseInsensitive);
246 cmplt->setCompletionMode(QCompleter::InlineCompletion);
247 setCompleter(cmplt);
248}
249
250/***********************************************************************/
253 bool chat_input::event(QEvent *event)
254{
255 if (event->type() == QEvent::KeyPress) {
256 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
257 switch (keyEvent->key()) {
258 case Qt::Key_Up:
259 setText(back_in_history());
260 return true;
261 case Qt::Key_Down:
262 setText(forward_in_history());
263 return true;
264 }
265 }
266 return QLineEdit::event(event);
267}
268
269/***********************************************************************/
272chatwdg::chatwdg(QWidget *parent)
273{
274 QGridLayout *gl;
275
276 setParent(parent);
277 cb = new QCheckBox("");
278 cb->setToolTip(_("Allies only"));
279 cb->setChecked(gui_options.gui_qt_allied_chat_only);
280 gl = new QGridLayout;
281 chat_line = new chat_input;
282 chat_output = new text_browser_dblclck(this);
283 chat_output->setFont(*fc_font::instance()->get_font(fonts::chatline));
284 remove_links = new QPushButton("");
285 remove_links->setIcon(style()->standardPixmap(QStyle::SP_DialogCancelButton));
286 remove_links->setToolTip(_("Clear links"));
287 gl->setVerticalSpacing(0);
288 gl->addWidget(chat_output,0 , 0, 1 ,3);
289 gl->addWidget(chat_line,1, 0);
290 gl->addWidget(cb,1,1);
291 gl->addWidget(remove_links,1,2);
292 gl->setContentsMargins(0, 0, 6, 0);
293 setLayout(gl);
294 chat_output->setReadOnly(true);
295 chat_line->installEventFilter(this);
296 chat_output->setVisible(true);
297 chat_output->setAcceptRichText(true);
298 chat_output->setOpenLinks(false);
299 chat_output->setReadOnly(true);
300 connect(chat_output, &QTextBrowser::anchorClicked,
301 this, &chatwdg::anchor_clicked);
302 connect(chat_output, &QTextBrowser::anchorClicked,
303 this, &chatwdg::anchor_clicked);
304 connect(chat_output, &text_browser_dblclck::dbl_clicked,
305 this, &chatwdg::toggle_size);
306 connect(remove_links, &QAbstractButton::clicked, this, &chatwdg::rm_links);
307 connect(cb, &QCheckBox::stateChanged, this, &chatwdg::state_changed);
308 setMouseTracking(true);
309
310 chat_listener::listen();
311}
312
313/***********************************************************************/
316 void chatwdg::state_changed(int state)
317{
318 if (state > 0) {
319 gui_options.gui_qt_allied_chat_only = true;
320 } else {
321 gui_options.gui_qt_allied_chat_only = false;
322 }
323}
324
325/***********************************************************************/
328 void chatwdg::toggle_size()
329{
330 if (gui()->infotab->chat_maximized) {
331 gui()->infotab->restore_chat();
332 return;
333 } else {
334 gui()->infotab->maximize_chat();
335 chat_line->setFocus();
336 }
337}
338
339/***********************************************************************/
342 void chatwdg::scroll_to_bottom()
343{
344 chat_output->verticalScrollBar()->setSliderPosition(
345 chat_output->verticalScrollBar()->maximum());
346}
347
348
349/***********************************************************************/
352 void chatwdg::update_font()
353{
354 QFont *qf;
355 qf = fc_font::instance()->get_font(fonts::chatline);
356 chat_output->setFont(*qf);
357}
358
359/***********************************************************************/
362 void chatwdg::rm_links()
363{
364 link_marks_clear_all();
365}
366
367/***********************************************************************/
370 void chatwdg::anchor_clicked(const QUrl &link)
371{
372 int n;
373 QStringList sl;
374 int id;
375 enum text_link_type type;
376 struct tile *ptile = nullptr;
377
378 sl = link.toString().split(",");
379 n = sl.at(0).toInt();
380 id = sl.at(1).toInt();
381
382 type = static_cast< text_link_type>(n);
383
384 switch (type) {
385 case TLT_CITY: {
386 struct city *pcity = game_city_by_number(id);
387
388 if (pcity) {
389 ptile = client_city_tile(pcity);
390 } else {
391 output_window_append(ftc_client, _("This city isn't known!"));
392 }
393 }
394 break;
395 case TLT_TILE:
396 ptile = index_to_tile(&(wld.map), id);
397
398 if (!ptile) {
399 output_window_append(ftc_client,
400 _("This tile doesn't exist in this game!"));
401 }
402 break;
403 case TLT_UNIT: {
404 struct unit *punit = game_unit_by_number(id);
405
406 if (punit) {
407 ptile = unit_tile(punit);
408 } else {
409 output_window_append(ftc_client, _("This unit isn't known!"));
410 }
411 }
412 break;
413 }
414 if (ptile != nullptr) {
415 center_tile_mapcanvas(ptile);
416 link_mark_restore(type, id);
417 }
418}
419
420/***********************************************************************/
423 void chatwdg::chat_message_received(const QString &message,
424 const struct text_tag_list *tags)
425{
426 QColor col = chat_output->palette().color(QPalette::Text);
427 append(apply_tags(message, tags, col));
428}
429
430/***********************************************************************/
433 void chatwdg::append(const QString &str)
434{
435 QTextCursor cursor;
436
437 chat_output->append(str);
438 chat_output->verticalScrollBar()->setSliderPosition(
439 chat_output->verticalScrollBar()->maximum());
440}
441
442/***********************************************************************/
445 void chatwdg::paint(QPainter *painter, QPaintEvent *event)
446{
447 painter->setBrush(QColor(0, 0, 0, 35));
448 painter->drawRect(0, 0, width(), height());
449}
450
451/***********************************************************************/
454 void chatwdg::paintEvent(QPaintEvent *event)
455{
456 QPainter painter;
457
458 painter.begin(this);
459 paint(&painter, event);
460 painter.end();
461}
462
463/***********************************************************************/
466 bool chatwdg::eventFilter(QObject *obj, QEvent *event)
467{
468 if (obj == chat_line) {
469 if (event->type() == QEvent::KeyPress) {
470 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
471 if (keyEvent->key() == Qt::Key_Escape) {
472 gui()->infotab->restore_chat();
473 gui()->mapview_wdg->setFocus();
474 return true;
475 }
476 }
477 if (event->type() == QEvent::ShortcutOverride) {
478 event->setAccepted(true);
479 }
480 }
481
482 return QObject::eventFilter(obj, event);
483}
484
485/***********************************************************************/
488 void chatwdg::update_widgets()
489{
490 if (is_server_running()) {
491 cb->hide();
492 remove_links->hide();
493 } else {
494 cb->show();
495 remove_links->show();
496 }
497}
498
499/***********************************************************************/
503 int chatwdg::default_size(int lines)
504{
505 int line_count = 0;
506 int line_height;
507 int size;
508 QTextBlock qtb;
509
510 qtb = chat_output->document()->firstBlock();
511 /* Count all lines in all text blocks layouts
512 * document()->lineCount returns number of lines without wordwrap */
513
514 while (qtb.isValid()) {
515 line_count = line_count + qtb.layout()->lineCount();
516 qtb = qtb.next();
517 }
518
519 if (line_count == 0) {
520 return 0;
521 }
522
523 line_height = (chat_output->document()->size().height()
524 - 2 * chat_output->document()->documentMargin())
525 / line_count;
526
527 size = lines * line_height
528 + chat_line->size().height() + chat_output->document()->documentMargin();
529 size = qMax(0, size);
530
531 return size;
532}
533
534/***********************************************************************/
537 void chatwdg::make_link(struct tile *ptile)
538{
539 struct unit *punit;
540 char buf[MAX_LEN_MSG];
541
542 punit = find_visible_unit(ptile);
543 if (tile_city(ptile)) {
544 sz_strlcpy(buf, city_link(tile_city(ptile)));
545 } else if (punit) {
546 sz_strlcpy(buf, unit_link(punit));
547 } else {
548 sz_strlcpy(buf, tile_link(ptile));
549 }
550 chat_line->insert(QString(buf));
551 chat_line->setFocus();
552}
553
554/***********************************************************************/
557QString apply_tags(QString str, const struct text_tag_list *tags,
558 QColor bg_color)
559{
560 int start, stop, last_i;
561 QString str_col;
562 QString color;
563 QString final_string;
564 QByteArray qba;
565 QColor qc;
566 QMultiMap <int, QString> mm;
567 QByteArray str_bytes;
568
569 if (tags == nullptr) {
570 return str;
571 }
572 str_bytes = str.toUtf8();
573 qba = str_bytes.data();
574
575 text_tag_list_iterate(tags, ptag) {
576 if ((text_tag_stop_offset(ptag) == FT_OFFSET_UNSET)) {
577 stop = qba.length();
578 } else {
579 stop = text_tag_stop_offset(ptag);
580 }
581
582 if ((text_tag_start_offset(ptag) == FT_OFFSET_UNSET)) {
583 start = 0;
584 } else {
585 start = text_tag_start_offset(ptag);
586 }
587 switch (text_tag_type(ptag)) {
588 case TTT_BOLD:
589 mm.insert(stop, "</b>");
590 mm.insert(start, "<b>");
591 break;
592 case TTT_ITALIC:
593 mm.insert(stop, "</i>");
594 mm.insert(start, "<i>");
595 break;
596 case TTT_STRIKE:
597 mm.insert(stop, "</s>");
598 mm.insert(start, "<s>");
599 break;
600 case TTT_UNDERLINE:
601 mm.insert(stop, "</u>");
602 mm.insert(start, "<u>");
603 break;
604 case TTT_COLOR:
605 if (text_tag_color_foreground(ptag)) {
606 color = text_tag_color_foreground(ptag);
607 if (color == "#00008B") {
608 color = bg_color.name();
609 } else {
610 qc.setNamedColor(color);
611 qc = qc.lighter(200);
612 color = qc.name();
613 }
614 str_col = QString("<span style=color:%1>").arg(color);
615 mm.insert(stop, "</span>");
616 mm.insert(start, str_col);
617 }
618 if (text_tag_color_background(ptag)) {
619 color = text_tag_color_background(ptag);
620 if (QColor::isValidColor(color)) {
621 str_col = QString("<span style= background-color:%1;>").arg(color);
622 mm.insert(stop, "</span>");
623 mm.insert(start, str_col);
624 }
625 }
626 break;
627 case TTT_LINK: {
628 struct color *pcolor = nullptr;
629
630 switch (text_tag_link_type(ptag)) {
631 case TLT_CITY:
632 pcolor = get_color(tileset, COLOR_MAPVIEW_CITY_LINK);
633 break;
634 case TLT_TILE:
635 pcolor = get_color(tileset, COLOR_MAPVIEW_TILE_LINK);
636 break;
637 case TLT_UNIT:
638 pcolor = get_color(tileset, COLOR_MAPVIEW_UNIT_LINK);
639 break;
640 }
641
642 if (pcolor == nullptr) {
643 break; // Not a valid link type case.
644 }
645 color = pcolor->qcolor.name(QColor::HexRgb);
646 str_col = QString("<font color=\"%1\">").arg(color);
647 mm.insert(stop, "</a></font>");
648
649 color = QString(str_col + "<a href=%1,%2>").
650 arg(QString::number(text_tag_link_type(ptag)),
651 QString::number(text_tag_link_id(ptag)));
652 mm.insert(start, color);
653 }
654 }
655 } text_tag_list_iterate_end;
656
657 // Insert html starting from last items
658 last_i = str.length();
659 QMultiMap<int, QString>::const_iterator i = mm.constEnd();
660 QMultiMap<int, QString>::const_iterator j = mm.constEnd();
661
662 while (i != mm.constBegin()) {
663 i--;
664 if (i.key() < last_i) {
665 final_string = final_string.prepend(QString(qba.mid(i.key(),
666 last_i - i.key()))
667 .toHtmlEscaped());
668 }
669 last_i = i.key();
670 j = i;
671 if (i != mm.constBegin()) {
672 j--;
673 }
674 if (j.key() == i.key() && i != j) {
675 final_string = final_string.prepend(j.value());
676 final_string = final_string.prepend(i.value());
677 i--;
678 } else {
679 final_string = final_string.prepend(i.value());
680 }
681 }
682
683 if (last_i == str.length()) {
684 return str;
685 }
686
687 return final_string;
688}
689
690/***********************************************************************/
694 static bool is_plain_public_message(QString s)
695{
696 QString s1, str;
697 int i;
698
699 str = s.trimmed();
700 if (str.at(0) == SERVER_COMMAND_PREFIX
701 || str.at(0) == CHAT_ALLIES_PREFIX
702 || str.at(0) == CHAT_DIRECT_PREFIX) {
703 return false;
704 }
705
706 /* Search for private message */
707 if (!str.contains(CHAT_DIRECT_PREFIX)) {
708 return true;
709 }
710 i = str.indexOf(CHAT_DIRECT_PREFIX);
711 str = str.left(i);
712
713 /* Compare all players and connections looking for match */
714 conn_list_iterate(game.all_connections, pconn) {
715 s1 = pconn->username;
716 if (s1.length() < i) {
717 continue;
718 }
719 if (!QString::compare(s1.left(i), str, Qt::CaseInsensitive)) {
720 return false;
721 }
722 } conn_list_iterate_end;
723 players_iterate(pplayer) {
724 s1 = pplayer->name;
725 if (s1.length() < i) {
726 continue;
727 }
728 if (!QString::compare(s1.left(i), str, Qt::CaseInsensitive)) {
729 return false;
730 }
731 } players_iterate_end;
732
733 return true;
734}
735
736/***********************************************************************/
740 void qtg_real_output_window_append(const char *astring,
741 const struct text_tag_list *tags,
742 int conn_id)
743{
744 QString str;
745 QString wakeup;
746 QApplication *qapp;
747
748 str = QString::fromUtf8(astring);
749 gui()->set_status_bar(str);
750
751 wakeup = gui_options.gui_qt_wakeup_text;
752
753 /* Format wakeup string if needed */
754 if (wakeup.contains("%1")) {
755 wakeup = wakeup.arg(client.conn.username);
756 }
757
758 qapp = current_app();
759
760 if (str.contains(client.conn.username)) {
761 qapp->alert(gui()->central_wdg);
762 }
763
764 /* Play sound if we encountered wakeup string */
765 if (str.contains(wakeup) && client_state() < C_S_RUNNING
766 && !wakeup.isEmpty()) {
767 qapp->alert(gui()->central_wdg);
768 audio_play_sound("e_player_wake", NULL);
769 }
770
771 chat_listener::update_word_list();
772 chat_listener::invoke(&chat_listener::chat_message_received,
773 str, tags);
774}
775
776/***********************************************************************/
780 void log_output_window(void)
781{
782 /* PORTME */
783 write_chatline_content(NULL);
784}
785
786/***********************************************************************/
789 void clear_output_window(void)
790{
791 /* PORTME */
792#if 0
793 set_output_window_text(_("Cleared output window."));
794#endif
795}
796
797/***********************************************************************/
800version_message_event::version_message_event(const QString &msg) :
801 QEvent(QEvent::User),
802 message(msg)
803{}
804
805/***********************************************************************/
808 void qtg_version_message(const char *vertext)
809{
810 current_app()->postEvent(gui(), new version_message_event(vertext));
811}
str
#define str
Definition astring.c:76
n
#define n
Definition astring.c:77
audio_play_sound
void audio_play_sound(const char *const tag, const char *const alt_tag)
Definition audio.c:521
audio.h
get_font
static QFont * get_font(enum client_font font)
Definition canvas.cpp:359
height
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
pcolor
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
Definition canvas_g.h:57
width
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
chat.h
CHAT_DIRECT_PREFIX
#define CHAT_DIRECT_PREFIX
Definition chat.h:31
CHAT_ALLIES_PREFIX
#define CHAT_ALLIES_PREFIX
Definition chat.h:30
SERVER_COMMAND_PREFIX
#define SERVER_COMMAND_PREFIX
Definition chat.h:28
log_output_window
void log_output_window(void)
Definition chatline.cpp:780
clear_output_window
void clear_output_window(void)
Definition chatline.cpp:789
apply_tags
QString apply_tags(QString str, const struct text_tag_list *tags, QColor bg_color)
Definition chatline.cpp:557
qtg_version_message
void qtg_version_message(const char *vertext)
Definition chatline.cpp:808
qtg_real_output_window_append
void qtg_real_output_window_append(const char *astring, const struct text_tag_list *tags, int conn_id)
Definition chatline.cpp:740
is_plain_public_message
static bool is_plain_public_message(QString s)
Definition chatline.cpp:694
send_chat
int send_chat(const char *message)
Definition chatline_common.c:46
output_window_append
void output_window_append(const struct ft_color color, const char *featured_text)
Definition chatline_common.c:104
write_chatline_content
void write_chatline_content(const char *txt)
Definition chatline_common.c:196
chat_input
Definition chatline.h:81
chat_input::event
bool event(QEvent *event)
Definition chatline.cpp:253
chat_input::chat_word_list_changed
virtual void chat_word_list_changed(const QStringList &cmplt_word_list)
Definition chatline.cpp:236
chat_input::send
void send()
Definition chatline.cpp:227
chat_input::chat_input
chat_input(QWidget *parent=nullptr)
Definition chatline.cpp:216
chat_listener
Definition chatline.h:46
chat_listener::current_word_list
QStringList current_word_list()
Definition chatline.h:74
chat_listener::HISTORY_END
static const int HISTORY_END
Definition chatline.h:57
chat_listener::forward_in_history
QString forward_in_history()
Definition chatline.cpp:191
chat_listener::send_chat_message
void send_chat_message(const QString &message)
Definition chatline.cpp:109
chat_listener::reset_history_position
void reset_history_position()
Definition chatline.cpp:208
chat_listener::back_in_history
QString back_in_history()
Definition chatline.cpp:177
chat_listener::history
static QStringList history
Definition chatline.h:48
chat_listener::chat_word_list_changed
virtual void chat_word_list_changed(const QStringList &cmplt_word_list)
Definition chatline.cpp:100
chat_listener::update_word_list
static void update_word_list()
Definition chatline.cpp:58
chat_listener::word_list
static QStringList word_list
Definition chatline.h:53
chat_listener::chat_listener
chat_listener()
Definition chatline.cpp:84
chat_listener::chat_message_received
virtual void chat_message_received(const QString &, const struct text_tag_list *)
Definition chatline.cpp:92
chat_listener::position
int position
Definition chatline.h:50
chatwdg::eventFilter
bool eventFilter(QObject *obj, QEvent *event)
Definition chatline.cpp:466
chatwdg::chat_line
chat_input * chat_line
Definition chatline.h:120
chatwdg::chatwdg
chatwdg(QWidget *parent)
Definition chatline.cpp:272
chatwdg::paintEvent
void paintEvent(QPaintEvent *event)
Definition chatline.cpp:454
chatwdg::update_font
void update_font()
Definition chatline.cpp:352
chatwdg::anchor_clicked
void anchor_clicked(const QUrl &link)
Definition chatline.cpp:370
chatwdg::default_size
int default_size(int lines)
Definition chatline.cpp:503
chatwdg::chat_output
text_browser_dblclck * chat_output
Definition chatline.h:139
chatwdg::make_link
void make_link(struct tile *ptile)
Definition chatline.cpp:537
chatwdg::chat_message_received
void chat_message_received(const QString &message, const struct text_tag_list *tags)
Definition chatline.cpp:423
chatwdg::scroll_to_bottom
void scroll_to_bottom()
Definition chatline.cpp:342
chatwdg::paint
void paint(QPainter *painter, QPaintEvent *event)
Definition chatline.cpp:445
chatwdg::update_widgets
void update_widgets()
Definition chatline.cpp:488
chatwdg::cb
QCheckBox * cb
Definition chatline.h:141
chatwdg::rm_links
void rm_links()
Definition chatline.cpp:362
chatwdg::remove_links
QPushButton * remove_links
Definition chatline.h:140
chatwdg::state_changed
void state_changed(int state)
Definition chatline.cpp:316
chatwdg::append
void append(const QString &str)
Definition chatline.cpp:433
chatwdg::toggle_size
void toggle_size()
Definition chatline.cpp:328
fc_font::instance
static fc_font * instance()
Definition fonts.cpp:41
fc_font::get_font
QFont * get_font(QString name)
Definition fonts.cpp:63
listener< chat_listener >::invoke
static void invoke(_member_fct_ function)
Definition listener.h:175
listener< chat_listener >::listen
void listen()
Definition listener.h:149
text_browser_dblclck
Definition chatline.h:99
text_browser_dblclck::dbl_clicked
void dbl_clicked()
version_message_event
Definition chatline.h:146
version_message_event::version_message_event
version_message_event(const QString &msg)
Definition chatline.cpp:800
client
struct civclient client
Definition client_main.c:149
client_state
enum client_states client_state(void)
Definition client_main.c:1029
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
client_city_tile
struct tile * client_city_tile(const struct city *pcity)
Definition climap.c:87
climap.h
climisc.h
get_color
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
Definition colors_common.c:100
is_server_running
bool is_server_running(void)
Definition connectdlg_common.c:124
connectdlg_common.h
conn_list_iterate
#define conn_list_iterate(connlist, pconn)
Definition connection.h:113
conn_list_iterate_end
#define conn_list_iterate_end
Definition connection.h:115
find_visible_unit
struct unit * find_visible_unit(struct tile *ptile)
Definition control.c:805
control.h
punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:73
id
int int id
Definition editgui_g.h:28
event
enum event_type event
Definition events.c:81
fc_client.h
_
#define _(String)
Definition fcintl.h:67
text_tag_link_type
enum text_link_type text_tag_link_type(const struct text_tag *ptag)
Definition featured_text.c:741
tile_link
const char * tile_link(const struct tile *ptile)
Definition featured_text.c:1106
text_tag_stop_offset
ft_offset_t text_tag_stop_offset(const struct text_tag *ptag)
Definition featured_text.c:704
text_tag_color_foreground
const char * text_tag_color_foreground(const struct text_tag *ptag)
Definition featured_text.c:713
ftc_client
const struct ft_color ftc_client
Definition featured_text.c:78
city_link
const char * city_link(const struct city *pcity)
Definition featured_text.c:1072
text_tag_link_id
int text_tag_link_id(const struct text_tag *ptag)
Definition featured_text.c:756
text_tag_start_offset
ft_offset_t text_tag_start_offset(const struct text_tag *ptag)
Definition featured_text.c:696
unit_link
const char * unit_link(const struct unit *punit)
Definition featured_text.c:1200
text_tag_color_background
const char * text_tag_color_background(const struct text_tag *ptag)
Definition featured_text.c:727
text_tag_list_iterate_end
#define text_tag_list_iterate_end
Definition featured_text.h:116
text_tag_list_iterate
#define text_tag_list_iterate(tags, ptag)
Definition featured_text.h:114
FT_OFFSET_UNSET
#define FT_OFFSET_UNSET
Definition featured_text.h:104
text_link_type
text_link_type
Definition featured_text.h:131
TLT_TILE
@ TLT_TILE
Definition featured_text.h:133
TLT_UNIT
@ TLT_UNIT
Definition featured_text.h:134
TLT_CITY
@ TLT_CITY
Definition featured_text.h:132
text_tag_type
text_tag_type
Definition featured_text.h:120
TTT_LINK
@ TTT_LINK
Definition featured_text.h:126
TTT_BOLD
@ TTT_BOLD
Definition featured_text.h:121
TTT_ITALIC
@ TTT_ITALIC
Definition featured_text.h:122
TTT_STRIKE
@ TTT_STRIKE
Definition featured_text.h:123
TTT_COLOR
@ TTT_COLOR
Definition featured_text.h:125
TTT_UNDERLINE
@ TTT_UNDERLINE
Definition featured_text.h:124
game
struct civ_game game
Definition game.c:57
wld
struct world wld
Definition game.c:58
game_unit_by_number
struct unit * game_unit_by_number(int id)
Definition game.c:111
game_city_by_number
struct city * game_city_by_number(int id)
Definition game.c:102
game.h
is_plain_public_message
static bool is_plain_public_message(const char *s)
Definition chatline.c:97
popup_races_dialog
void popup_races_dialog(struct player *pplayer)
Definition dialogs.c:1223
type
GType type
Definition repodlgs.c:1312
apply_tags
QString apply_tags(QString str, const struct text_tag_list *tags, QColor bg_color)
Definition chatline.cpp:557
set_output_window_text
#define set_output_window_text(_pstr_)
Definition chatline.h:31
chatline.h
colors.h
gui_main.h
qapp
static QApplication * qapp
Definition gui_main.cpp:70
current_app
QApplication * current_app()
Definition gui_main.cpp:220
FC_CPP_DECLARE_LISTENER
#define FC_CPP_DECLARE_LISTENER(_type_)
Definition listener.h:134
index_to_tile
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
Definition map.c:454
link_mark_restore
void link_mark_restore(enum text_link_type type, int id)
Definition mapview_common.c:3998
center_tile_mapcanvas
void center_tile_mapcanvas(const struct tile *ptile)
Definition mapview_common.c:1222
link_marks_clear_all
void link_marks_clear_all(void)
Definition mapview_common.c:3953
gui
static mpgui * gui
Definition mpgui_qt.cpp:52
fonts::chatline
const char *const chatline
Definition fonts.h:31
gui_options
struct client_options gui_options
Definition options.c:71
MAX_LEN_MSG
#define MAX_LEN_MSG
Definition packets.h:43
lines
char * lines
Definition packhand.c:129
players_iterate_end
#define players_iterate_end
Definition player.h:535
players_iterate
#define players_iterate(_pplayer)
Definition player.h:530
is_ai
#define is_ai(plr)
Definition player.h:234
qtg_cxxside.h
size
size_t size
Definition specvec.h:72
astring
Definition astring.h:36
city
Definition city.h:309
civ_game::est_connections
struct conn_list * est_connections
Definition game.h:97
civ_game::all_connections
struct conn_list * all_connections
Definition game.h:96
civclient::conn
struct connection conn
Definition client_main.h:96
client_options::gui_qt_allied_chat_only
bool gui_qt_allied_chat_only
Definition options.h:388
client_options::gui_qt_wakeup_text
char gui_qt_wakeup_text[512]
Definition options.h:400
color
Definition colors.h:20
connection::username
char username[MAX_LEN_NAME]
Definition connection.h:169
message
Definition messagewin_common.h:29
tile
Definition tile.h:49
tileset
Definition tilespec.c:459
unit
Definition unit.h:138
world::map
struct civ_map map
Definition world_object.h:38
sz_strlcpy
#define sz_strlcpy(dest, src)
Definition support.h:161
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
unit_tile
#define unit_tile(_pu)
Definition unit.h:388