From 24d57c412f4f0e2202311e8495832caab9a8ba56 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 24 Jul 2008 06:53:07 +0000 Subject: [PATCH] some more chat dialog work --- src/channel.cpp | 24 ++++++++++++++++++++++++ src/channel.h | 14 ++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/channel.cpp b/src/channel.cpp index 398aa54f..9fa3aeb9 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -69,6 +69,14 @@ CChannelSet::CChannelSet() QObject::connect(&vecChannels[3],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh3())); QObject::connect(&vecChannels[4],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh4())); QObject::connect(&vecChannels[5],SIGNAL(NameHasChanged()),this,SLOT(OnNameHasChangedCh5())); + + // chate text received + QObject::connect(&vecChannels[0],SIGNAL(ChatTextReceived()),this,SLOT(OnChatTextReceivedCh0())); + QObject::connect(&vecChannels[1],SIGNAL(ChatTextReceived()),this,SLOT(OnChatTextReceivedCh1())); + QObject::connect(&vecChannels[2],SIGNAL(ChatTextReceived()),this,SLOT(OnChatTextReceivedCh2())); + QObject::connect(&vecChannels[3],SIGNAL(ChatTextReceived()),this,SLOT(OnChatTextReceivedCh3())); + QObject::connect(&vecChannels[4],SIGNAL(ChatTextReceived()),this,SLOT(OnChatTextReceivedCh4())); + QObject::connect(&vecChannels[5],SIGNAL(ChatTextReceived()),this,SLOT(OnChatTextReceivedCh5())); } CVector CChannelSet::CreateChannelList() @@ -107,6 +115,19 @@ void CChannelSet::CreateAndSendChanListForAllConChannels() } } +void CChannelSet::CreateAndSendChatTextForAllConChannels ( const QString& strName ) +{ + // send chat text to all connected clients + for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) + { + if ( vecChannels[i].IsConnected() ) + { + // send message + vecChannels[i].CreateChatTextMes ( strName ); + } + } +} + void CChannelSet::CreateAndSendChanListForAllExceptThisChan ( const int iCurChanID ) { // create channel list @@ -435,6 +456,9 @@ CChannel::CChannel() : sName ( "" ), QObject::connect( &Protocol, SIGNAL ( ChangeChanName ( QString ) ), this, SLOT ( OnChangeChanName ( QString ) ) ); + + QObject::connect( &Protocol, SIGNAL ( ChatTextReceived ( QString ) ), + this, SIGNAL ( ChatTextReceived ( QString ) ) ); } void CChannel::SetEnable ( const bool bNEnStat ) diff --git a/src/channel.h b/src/channel.h index 8960830b..ef3ffab7 100755 --- a/src/channel.h +++ b/src/channel.h @@ -115,8 +115,9 @@ public: Protocol.CreateJitBufMes ( iJitBufSize ); } } - void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); } - void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); } + void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); } + void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); } + void CreateChatTextMes ( const QString& strName ) { Protocol.CreateChatTextMes ( strName ); } void CreateNetwBlSiFactMes ( const int iNetwBlSiFact ) { @@ -192,6 +193,7 @@ signals: void ConClientListMesReceived ( CVector vecChanInfo ); void ProtocolStatus ( bool bOk ); void NameHasChanged(); + void ChatTextReceived ( QString strName ); }; @@ -237,6 +239,7 @@ protected: void CreateAndSendChanListForAllConChannels(); void CreateAndSendChanListForAllExceptThisChan ( const int iCurChanID ); void CreateAndSendChanListForThisChan ( const int iCurChanID ); + void CreateAndSendChatTextForAllConChannels ( const QString& strName ); /* do not use the vector class since CChannel does not have appropriate copy constructor/operator */ @@ -275,6 +278,13 @@ public slots: void OnNameHasChangedCh4() { CreateAndSendChanListForAllConChannels(); } void OnNameHasChangedCh5() { CreateAndSendChanListForAllConChannels(); } + void OnChatTextReceivedCh0(QString strName) { CreateAndSendChatTextForAllConChannels(strName); } + void OnChatTextReceivedCh1(QString strName) { CreateAndSendChatTextForAllConChannels(strName); } + void OnChatTextReceivedCh2(QString strName) { CreateAndSendChatTextForAllConChannels(strName); } + void OnChatTextReceivedCh3(QString strName) { CreateAndSendChatTextForAllConChannels(strName); } + void OnChatTextReceivedCh4(QString strName) { CreateAndSendChatTextForAllConChannels(strName); } + void OnChatTextReceivedCh5(QString strName) { CreateAndSendChatTextForAllConChannels(strName); } + signals: void MessReadyForSending ( int iChID, CVector vecMessage ); };