Freeciv-3.3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes
chat_listener Class Reference

#include <chatline.h>

+ Inheritance diagram for chat_listener:

Public Member Functions

 chat_listener ()
 
virtual void chat_message_received (const QString &, const struct text_tag_list *)
 
virtual void chat_word_list_changed (const QStringList &cmplt_word_list)
 
void send_chat_message (const QString &message)
 
int position_in_history ()
 
QString back_in_history ()
 
QString forward_in_history ()
 
void reset_history_position ()
 
QStringList current_word_list ()
 

Static Public Member Functions

static void update_word_list ()
 
- Static Public Member Functions inherited from listener< chat_listener >
static void invoke (_member_fct_ function)
 
static void invoke (_member_fct_ function, _arg1_t_ arg)
 
static void invoke (_member_fct_ function, _arg1_t_ arg1, _arg2_t_ arg2)
 

Static Public Attributes

static const int HISTORY_END = -1
 

Private Attributes

int position
 

Static Private Attributes

static QStringList history = QStringList()
 
static QStringList word_list = QStringList()
 

Additional Inherited Members

- Public Types inherited from listener< chat_listener >
typedef chat_listener type_t
 
- Protected Member Functions inherited from listener< chat_listener >
 listener ()
 
virtual ~listener ()
 
void listen ()
 

Detailed Description

Definition at line 46 of file chatline.h.

Constructor & Destructor Documentation

◆ chat_listener()

chat_listener::chat_listener ( )
explicit

Constructor.

Definition at line 84 of file chatline.cpp.

Member Function Documentation

◆ back_in_history()

QString chat_listener::back_in_history ( )

Goes back one position in history, and returns the message at the new position.

Definition at line 173 of file chatline.cpp.

Referenced by chat_input::event().

◆ chat_message_received()

void chat_listener::chat_message_received ( const QString ,
const struct text_tag_list  
)
virtual

Called whenever a message is received. Default implementation does nothing.

Reimplemented in chatwdg, and fc_client.

Definition at line 92 of file chatline.cpp.

Referenced by qtg_real_output_window_append().

◆ chat_word_list_changed()

void chat_listener::chat_word_list_changed ( const QStringList cmplt_word_list)
virtual

Called whenever the completion word list changes. Default implementation does nothing.

Reimplemented in chat_input.

Definition at line 100 of file chatline.cpp.

Referenced by update_word_list().

◆ current_word_list()

QStringList chat_listener::current_word_list ( )
inline

Definition at line 75 of file chatline.h.

Referenced by chat_input::chat_input().

◆ forward_in_history()

QString chat_listener::forward_in_history ( )

Goes forward one position in history, and returns the message at the new position. An empty string is returned if the new position is HISTORY_END.

Definition at line 187 of file chatline.cpp.

Referenced by chat_input::event().

◆ position_in_history()

int chat_listener::position_in_history ( )
inline

Definition at line 70 of file chatline.h.

◆ reset_history_position()

void chat_listener::reset_history_position ( )

Go to the end of the history.

Definition at line 204 of file chatline.cpp.

Referenced by send_chat_message().

◆ send_chat_message()

void chat_listener::send_chat_message ( const QString message)

Sends commands to server, but first searches for custom keys, if it finds then it makes custom action.

The history position is reset to HISTORY_END.

Definition at line 109 of file chatline.cpp.

Referenced by chat_input::send(), and fc_client::send_fake_chat_message().

◆ update_word_list()

void chat_listener::update_word_list ( )
static

Updates the chat completion word list.

Definition at line 58 of file chatline.cpp.

Referenced by qtg_real_output_window_append().

Field Documentation

◆ history

QStringList chat_listener::history = QStringList()
staticprivate

Definition at line 49 of file chatline.h.

Referenced by back_in_history(), forward_in_history(), and send_chat_message().

◆ HISTORY_END

const int chat_listener::HISTORY_END = -1
static

Definition at line 58 of file chatline.h.

Referenced by back_in_history(), forward_in_history(), and reset_history_position().

◆ position

int chat_listener::position
private

◆ word_list

QStringList chat_listener::word_list = QStringList()
staticprivate

Definition at line 54 of file chatline.h.

Referenced by current_word_list(), and update_word_list().