Freeciv21
Develop your civilization from humble roots to a global empire
chat_widget Class Reference

#include <chatline.h>

+ Inheritance diagram for chat_widget:
+ Collaboration diagram for chat_widget:

Public Member Functions

 chat_widget (QWidget *parent)
 Constructor for chat_widget. More...
 
virtual ~chat_widget ()
 Destructor. More...
 
void append (const QString &str)
 Adds news string to chat_widget. More...
 
void make_link (struct tile *ptile)
 Makes link to tile/unit or city. More...
 
void update_widgets ()
 Hides allies and links button for local game. More...
 
int default_size (int lines)
 Returns how much space chatline of given number of lines would require, or zero if it can't be determined. More...
 
void take_focus ()
 Shows the chat and ensures the chat line has focus. More...
 
void update_font ()
 Updates font for chat_widget. More...
 
bool is_chat_visible () const
 Returns whether the chat widget is currently visible. More...
 
void set_chat_visible (bool visible)
 Manages toggling minimization. More...
 
- Public Member Functions inherited from resizable_widget
void setResizable (Qt::Edges edges)
 Set resizable flags. More...
 
Qt::Edges getResizable () const
 Get resizable flags of wdiget. More...
 
- Public Member Functions inherited from fcwidget
 fcwidget (QWidget *parent=nullptr)
 Constructor. More...
 
virtual void update_menu ()=0
 

Public Attributes

chat_inputchat_line
 

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 Paint event for chat_widget. More...
 
bool eventFilter (QObject *obj, QEvent *event) override
 Processess history for chat. More...
 
- Protected Member Functions inherited from resizable_widget
void mousePressEvent (QMouseEvent *event) override
 Checks if info_tab can be moved. More...
 
void mouseMoveEvent (QMouseEvent *event) override
 Called when mouse moved (mouse track is enabled). More...
 
void mouseReleaseEvent (QMouseEvent *event) override
 Restores cursor when resizing is done. More...
 

Private Slots

void update_menu () override
 
void rm_links ()
 User clicked clear links button. More...
 
void anchor_clicked (const QUrl &link)
 User clicked some custom link. More...
 

Private Member Functions

void chat_message_received (const QString &message, const struct text_tag_list *tags) override
 Adds news string to chat_widget (from chat_listener interface) More...
 
- Private Member Functions inherited from chat_listener
 chat_listener ()
 Constructor. More...
 
void send_chat_message (const QString &message)
 Sends commands to server, but first searches for custom keys, if it finds then it makes custom action. More...
 
QString back_in_history ()
 Goes back one position in history, and returns the message at the new position. More...
 
QString forward_in_history ()
 Goes forward one position in history, and returns the message at the new position. More...
 
void reset_history_position ()
 Go to the end of the history. More...
 
- Private Member Functions inherited from listener< chat_listener >
 listener ()
 
virtual ~listener ()
 
void listen ()
 

Private Attributes

bool m_chat_visible = true
 
QTextBrowser * chat_output
 
QPushButton * remove_links
 
QPushButton * show_hide
 
QToolButton * cb
 
QMenu * cb_menu
 
move_widgetmw
 

Additional Inherited Members

- Signals inherited from resizable_widget
void resized (QRect rect)
 
- Private Types inherited from listener< chat_listener >
typedef chat_listener type_t
 
- Static Private Member Functions inherited from listener< chat_listener >
static void invoke (_member_fct_ function, _args_ &&...args)
 
- Static Private Attributes inherited from chat_listener
static const int HISTORY_END = -1
 

Detailed Description

Definition at line 100 of file chatline.h.

Constructor & Destructor Documentation

◆ chat_widget()

chat_widget::chat_widget ( QWidget *  parent)

Constructor for chat_widget.

Definition at line 342 of file chatline.cpp.

◆ ~chat_widget()

chat_widget::~chat_widget ( )
virtual

Destructor.

Definition at line 452 of file chatline.cpp.

Member Function Documentation

◆ anchor_clicked

void chat_widget::anchor_clicked ( const QUrl &  link)
privateslot

User clicked some custom link.

Definition at line 535 of file chatline.cpp.

Referenced by chat_widget().

◆ append()

void chat_widget::append ( const QString &  str)

◆ chat_message_received()

void chat_widget::chat_message_received ( const QString &  message,
const struct text_tag_list *  tags 
)
overrideprivatevirtual

Adds news string to chat_widget (from chat_listener interface)

Reimplemented from chat_listener.

Definition at line 586 of file chatline.cpp.

◆ default_size()

int chat_widget::default_size ( int  lines)

Returns how much space chatline of given number of lines would require, or zero if it can't be determined.

Definition at line 656 of file chatline.cpp.

◆ eventFilter()

bool chat_widget::eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprotected

Processess history for chat.

Definition at line 623 of file chatline.cpp.

◆ is_chat_visible()

bool chat_widget::is_chat_visible ( ) const
inline

Returns whether the chat widget is currently visible.

Definition at line 116 of file chatline.h.

Referenced by fc_game_tab_widget::event().

◆ make_link()

void chat_widget::make_link ( struct tile ptile)

Makes link to tile/unit or city.

Definition at line 690 of file chatline.cpp.

Referenced by map_view::shortcut_pressed().

◆ paintEvent()

void chat_widget::paintEvent ( QPaintEvent *  event)
overrideprotected

Paint event for chat_widget.

Definition at line 606 of file chatline.cpp.

◆ rm_links

void chat_widget::rm_links ( )
privateslot

User clicked clear links button.

Definition at line 530 of file chatline.cpp.

Referenced by chat_widget().

◆ set_chat_visible()

void chat_widget::set_chat_visible ( bool  visible)

Manages toggling minimization.

Definition at line 461 of file chatline.cpp.

Referenced by chat_widget(), and fc_client::current_page().

◆ take_focus()

void chat_widget::take_focus ( )

Shows the chat and ensures the chat line has focus.

Definition at line 513 of file chatline.cpp.

Referenced by map_view::keyPressEvent().

◆ update_font()

void chat_widget::update_font ( )

Updates font for chat_widget.

Definition at line 522 of file chatline.cpp.

Referenced by gui_qt_apply_font().

◆ update_menu

void chat_widget::update_menu ( )
inlineoverrideprivateslot

Definition at line 120 of file chatline.h.

◆ update_widgets()

void chat_widget::update_widgets ( )

Hides allies and links button for local game.

Definition at line 643 of file chatline.cpp.

Referenced by fc_client::current_page().

Member Data Documentation

◆ cb

QToolButton* chat_widget::cb
private

Definition at line 136 of file chatline.h.

Referenced by chat_widget(), set_chat_visible(), and update_widgets().

◆ cb_menu

QMenu* chat_widget::cb_menu
private

Definition at line 137 of file chatline.h.

Referenced by chat_widget(), and ~chat_widget().

◆ chat_line

chat_input* chat_widget::chat_line

◆ chat_output

QTextBrowser* chat_widget::chat_output
private

◆ m_chat_visible

bool chat_widget::m_chat_visible = true
private

Definition at line 132 of file chatline.h.

Referenced by is_chat_visible(), and set_chat_visible().

◆ mw

move_widget* chat_widget::mw
private

Definition at line 138 of file chatline.h.

Referenced by chat_widget().

◆ remove_links

QPushButton* chat_widget::remove_links
private

Definition at line 134 of file chatline.h.

Referenced by chat_widget(), and set_chat_visible().

◆ show_hide

QPushButton* chat_widget::show_hide
private

Definition at line 135 of file chatline.h.

Referenced by chat_widget(), set_chat_visible(), and take_focus().