Babel
Epitech's C++ VoIP project
Classes | Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Babel::HomePage Class Reference

Main client Class. More...

#include <HomePage.hpp>

Inheritance diagram for Babel::HomePage:
Collaboration diagram for Babel::HomePage:

Classes

struct  MessageHandler
 All the necessary information to handle a response. More...
 
struct  UserInfo
 All the necessary information for a user in call or in the display list. More...
 

Public Member Functions

 HomePage ()
 ctor More...
 
 ~HomePage () override=default
 dtor More...
 

Public Attributes

const uint16_t startUdpPort = 0
 The port to receive udp audio packets. More...
 

Private Member Functions

void sendHandler (const Message< RFCCodes > &m)
 send the message to the server and add it to the message send queue to handle responses type More...
 
void onMessage (Message< RFCCodes > m)
 is used to redirect responses from request to the correct handling functions More...
 
void doConnect ()
 Connects to the server with tcp. More...
 
void doLogin ()
 send a login request, look into field inputs for username More...
 
void doListUsers ()
 send a listUsers request More...
 
void doCallUser ()
 Call a specific user look in the list for the selected username. More...
 
void doJoinCall (int callId, std::string &address, uint16_t port)
 join the callId given More...
 
void doDenyCall (int callId)
 deny a callId More...
 
void doHangUp ()
 quit a call More...
 
void onLoginResponse (const Message< RFCCodes > &m)
 handler for any responses of the login request More...
 
void onListUsersResponse (const Message< RFCCodes > &m)
 handler for any responses of the listuser request More...
 
void onCallUserResponse (const Message< RFCCodes > &m)
 handler for any responses of the callUser request More...
 
void onJoinCall (const Message< RFCCodes > &m)
 handler for any responses of the joinCall request More...
 
void handleIncomingCall (const Message< RFCCodes > &m)
 handle incoming call request More...
 
void handleUserJoined (const Message< RFCCodes > &m)
 handle user joined request More...
 
void handleUserLeft (const Message< RFCCodes > &m)
 handle user left request More...
 
void updateDisplaySelectedUser ()
 Update qt interface to display the correct username and infos. More...
 
void changeCurrentUITab (QWidget *tab)
 Change the currently selected tab. More...
 

Static Private Member Functions

static void onBasicResponse (const Message< RFCCodes > &m)
 handler for any simple responses (opens a dialog if error) otherwise do nothing More...
 

Private Attributes

QMainWindow * _window
 The display window. More...
 
Ui::babelHome _ui {}
 The UI Class. More...
 
QtTCPConnection _connection
 tcp connection handler More...
 
TSQueue< RFCCodes_requestsMade
 all the request made by the client (expecting a response) More...
 
SoundHandler _audio
 Audio call manager. More...
 
std::map< RFCCodes, MessageHandler_messageHandlers
 Used to call the correct handling function. More...
 
std::map< std::string, UserInfo_usersInfos
 Userinfo holder the username is the key. More...
 
std::list< std::string > _usersInCurrentCall
 a list containing all users in the currentCall More...
 
int _currentCallId
 handling the callId of the current call (to be able to hang up, ...) More...
 
std::string _address
 The local ip. More...
 
std::string _username
 The username of the connected user. More...
 

Static Private Attributes

static constexpr int CurrentlyNotInCall = -1
 Used to set and verify the _currentCallId if a call is ongoing. More...
 

Detailed Description

Main client Class.

Constructor & Destructor Documentation

◆ HomePage()

Babel::HomePage::HomePage ( )

ctor

◆ ~HomePage()

Babel::HomePage::~HomePage ( )
overridedefault

dtor

Member Function Documentation

◆ changeCurrentUITab()

void Babel::HomePage::changeCurrentUITab ( QWidget *  tab)
inlineprivate

Change the currently selected tab.

◆ doCallUser()

void Babel::HomePage::doCallUser ( )
private

Call a specific user look in the list for the selected username.

◆ doConnect()

void Babel::HomePage::doConnect ( )
private

Connects to the server with tcp.

◆ doDenyCall()

void Babel::HomePage::doDenyCall ( int  callId)
private

deny a callId

◆ doHangUp()

void Babel::HomePage::doHangUp ( )
private

quit a call

◆ doJoinCall()

void Babel::HomePage::doJoinCall ( int  callId,
std::string &  address,
uint16_t  port 
)
private

join the callId given

◆ doListUsers()

void Babel::HomePage::doListUsers ( )
private

send a listUsers request

◆ doLogin()

void Babel::HomePage::doLogin ( )
private

send a login request, look into field inputs for username

◆ handleIncomingCall()

void Babel::HomePage::handleIncomingCall ( const Message< RFCCodes > &  m)
private

handle incoming call request

◆ handleUserJoined()

void Babel::HomePage::handleUserJoined ( const Message< RFCCodes > &  m)
private

handle user joined request

◆ handleUserLeft()

void Babel::HomePage::handleUserLeft ( const Message< RFCCodes > &  m)
private

handle user left request

◆ onBasicResponse()

void Babel::HomePage::onBasicResponse ( const Message< RFCCodes > &  m)
staticprivate

handler for any simple responses (opens a dialog if error) otherwise do nothing

◆ onCallUserResponse()

void Babel::HomePage::onCallUserResponse ( const Message< RFCCodes > &  m)
private

handler for any responses of the callUser request

◆ onJoinCall()

void Babel::HomePage::onJoinCall ( const Message< RFCCodes > &  m)
private

handler for any responses of the joinCall request

◆ onListUsersResponse()

void Babel::HomePage::onListUsersResponse ( const Message< RFCCodes > &  m)
private

handler for any responses of the listuser request

◆ onLoginResponse()

void Babel::HomePage::onLoginResponse ( const Message< RFCCodes > &  m)
private

handler for any responses of the login request

◆ onMessage()

void Babel::HomePage::onMessage ( Message< RFCCodes m)
private

is used to redirect responses from request to the correct handling functions

◆ sendHandler()

void Babel::HomePage::sendHandler ( const Message< RFCCodes > &  m)
private

send the message to the server and add it to the message send queue to handle responses type

Note
The client should always use this function to send messages to the server

◆ updateDisplaySelectedUser()

void Babel::HomePage::updateDisplaySelectedUser ( )
private

Update qt interface to display the correct username and infos.

Member Data Documentation

◆ _address

std::string Babel::HomePage::_address
private

The local ip.

Note
the address to receive udp audio packets

◆ _audio

SoundHandler Babel::HomePage::_audio
private

Audio call manager.

◆ _connection

QtTCPConnection Babel::HomePage::_connection
private

tcp connection handler

◆ _currentCallId

int Babel::HomePage::_currentCallId
private

handling the callId of the current call (to be able to hang up, ...)

Note
when set to CurrentlyNotInCall no call is happening

◆ _messageHandlers

std::map<RFCCodes, MessageHandler> Babel::HomePage::_messageHandlers
private

Used to call the correct handling function.

Note
Expects a response for each type of request, expect FIFO order

◆ _requestsMade

TSQueue<RFCCodes> Babel::HomePage::_requestsMade
private

all the request made by the client (expecting a response)

◆ _ui

Ui::babelHome Babel::HomePage::_ui {}
private

The UI Class.

◆ _username

std::string Babel::HomePage::_username
private

The username of the connected user.

Note
set to an empty string when not connected

◆ _usersInCurrentCall

std::list<std::string> Babel::HomePage::_usersInCurrentCall
private

a list containing all users in the currentCall

◆ _usersInfos

std::map<std::string, UserInfo> Babel::HomePage::_usersInfos
private

Userinfo holder the username is the key.

◆ _window

QMainWindow* Babel::HomePage::_window
private

The display window.

◆ CurrentlyNotInCall

constexpr int Babel::HomePage::CurrentlyNotInCall = -1
staticconstexprprivate

Used to set and verify the _currentCallId if a call is ongoing.

◆ startUdpPort

const uint16_t Babel::HomePage::startUdpPort = 0

The port to receive udp audio packets.

Note
setting it to zero will let the OS choose a random available port

The documentation for this class was generated from the following files: