fixes and improvements to chat window
This commit is contained in:
parent
70d368c9b7
commit
a80ef7a9ca
3 changed files with 53 additions and 33 deletions
|
@ -115,19 +115,6 @@ void CChannelSet::CreateAndSendChanListForAllConChannels()
|
|||
}
|
||||
}
|
||||
|
||||
void CChannelSet::CreateAndSendChatTextForAllConChannels ( const QString& strChatText )
|
||||
{
|
||||
// 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 ( strChatText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CChannelSet::CreateAndSendChanListForAllExceptThisChan ( const int iCurChanID )
|
||||
{
|
||||
// create channel list
|
||||
|
@ -154,6 +141,35 @@ void CChannelSet::CreateAndSendChanListForThisChan ( const int iCurChanID )
|
|||
vecChannels[iCurChanID].CreateConClientListMes ( vecChanInfo );
|
||||
}
|
||||
|
||||
void CChannelSet::CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
||||
const QString& strChatText )
|
||||
{
|
||||
// create message which is sent to all connected clients -------------------
|
||||
// get client name, if name is empty, use IP address instead
|
||||
QString ChanName = vecChannels[iCurChanID].GetName();
|
||||
if ( ChanName.isEmpty() )
|
||||
{
|
||||
// convert IP address to text and show it
|
||||
const QHostAddress addrTest ( vecChannels[iCurChanID].GetAddress().InetAddr );
|
||||
ChanName = addrTest.toString();
|
||||
}
|
||||
|
||||
// add name of the client at the beginning of the message text
|
||||
const QString strActualMessageText =
|
||||
"<" + ChanName + "> " + strChatText;
|
||||
|
||||
|
||||
// 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 ( strActualMessageText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CChannelSet::GetFreeChan()
|
||||
{
|
||||
// look for a free channel
|
||||
|
|
|
@ -239,7 +239,7 @@ protected:
|
|||
void CreateAndSendChanListForAllConChannels();
|
||||
void CreateAndSendChanListForAllExceptThisChan ( const int iCurChanID );
|
||||
void CreateAndSendChanListForThisChan ( const int iCurChanID );
|
||||
void CreateAndSendChatTextForAllConChannels ( const QString& strChatText );
|
||||
void CreateAndSendChatTextForAllConChannels ( const int iCurChanID, const QString& strChatText );
|
||||
|
||||
/* do not use the vector class since CChannel does not have appropriate
|
||||
copy constructor/operator */
|
||||
|
@ -250,19 +250,19 @@ public slots:
|
|||
// CODE TAG: MAX_NUM_CHANNELS_TAG
|
||||
// make sure we have MAX_NUM_CHANNELS connections!!!
|
||||
// send message
|
||||
void OnSendProtMessCh0(CVector<uint8_t> mess) {emit MessReadyForSending(0,mess);}
|
||||
void OnSendProtMessCh1(CVector<uint8_t> mess) {emit MessReadyForSending(1,mess);}
|
||||
void OnSendProtMessCh2(CVector<uint8_t> mess) {emit MessReadyForSending(2,mess);}
|
||||
void OnSendProtMessCh3(CVector<uint8_t> mess) {emit MessReadyForSending(3,mess);}
|
||||
void OnSendProtMessCh4(CVector<uint8_t> mess) {emit MessReadyForSending(4,mess);}
|
||||
void OnSendProtMessCh5(CVector<uint8_t> mess) {emit MessReadyForSending(5,mess);}
|
||||
void OnSendProtMessCh0 ( CVector<uint8_t> mess ) {emit MessReadyForSending ( 0, mess ); }
|
||||
void OnSendProtMessCh1 ( CVector<uint8_t> mess ) {emit MessReadyForSending ( 1, mess ); }
|
||||
void OnSendProtMessCh2 ( CVector<uint8_t> mess ) {emit MessReadyForSending ( 2, mess ); }
|
||||
void OnSendProtMessCh3 ( CVector<uint8_t> mess ) {emit MessReadyForSending ( 3, mess ); }
|
||||
void OnSendProtMessCh4 ( CVector<uint8_t> mess ) {emit MessReadyForSending ( 4, mess ); }
|
||||
void OnSendProtMessCh5 ( CVector<uint8_t> mess ) {emit MessReadyForSending ( 5, mess ); }
|
||||
|
||||
void OnNewConnectionCh0() {vecChannels[0].CreateReqJitBufMes();}
|
||||
void OnNewConnectionCh1() {vecChannels[1].CreateReqJitBufMes();}
|
||||
void OnNewConnectionCh2() {vecChannels[2].CreateReqJitBufMes();}
|
||||
void OnNewConnectionCh3() {vecChannels[3].CreateReqJitBufMes();}
|
||||
void OnNewConnectionCh4() {vecChannels[4].CreateReqJitBufMes();}
|
||||
void OnNewConnectionCh5() {vecChannels[5].CreateReqJitBufMes();}
|
||||
void OnNewConnectionCh0() { vecChannels[0].CreateReqJitBufMes(); }
|
||||
void OnNewConnectionCh1() { vecChannels[1].CreateReqJitBufMes(); }
|
||||
void OnNewConnectionCh2() { vecChannels[2].CreateReqJitBufMes(); }
|
||||
void OnNewConnectionCh3() { vecChannels[3].CreateReqJitBufMes(); }
|
||||
void OnNewConnectionCh4() { vecChannels[4].CreateReqJitBufMes(); }
|
||||
void OnNewConnectionCh5() { vecChannels[5].CreateReqJitBufMes(); }
|
||||
|
||||
void OnReqConnClientsListCh0() { CreateAndSendChanListForThisChan ( 0 ); }
|
||||
void OnReqConnClientsListCh1() { CreateAndSendChanListForThisChan ( 1 ); }
|
||||
|
@ -278,12 +278,12 @@ public slots:
|
|||
void OnNameHasChangedCh4() { CreateAndSendChanListForAllConChannels(); }
|
||||
void OnNameHasChangedCh5() { CreateAndSendChanListForAllConChannels(); }
|
||||
|
||||
void OnChatTextReceivedCh0(QString strChatText) { CreateAndSendChatTextForAllConChannels(strChatText); }
|
||||
void OnChatTextReceivedCh1(QString strChatText) { CreateAndSendChatTextForAllConChannels(strChatText); }
|
||||
void OnChatTextReceivedCh2(QString strChatText) { CreateAndSendChatTextForAllConChannels(strChatText); }
|
||||
void OnChatTextReceivedCh3(QString strChatText) { CreateAndSendChatTextForAllConChannels(strChatText); }
|
||||
void OnChatTextReceivedCh4(QString strChatText) { CreateAndSendChatTextForAllConChannels(strChatText); }
|
||||
void OnChatTextReceivedCh5(QString strChatText) { CreateAndSendChatTextForAllConChannels(strChatText); }
|
||||
void OnChatTextReceivedCh0 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 0, strChatText ); }
|
||||
void OnChatTextReceivedCh1 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 1, strChatText ); }
|
||||
void OnChatTextReceivedCh2 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 2, strChatText ); }
|
||||
void OnChatTextReceivedCh3 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 3, strChatText ); }
|
||||
void OnChatTextReceivedCh4 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 4, strChatText ); }
|
||||
void OnChatTextReceivedCh5 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 5, strChatText ); }
|
||||
|
||||
signals:
|
||||
void MessReadyForSending ( int iChID, CVector<uint8_t> vecMessage );
|
||||
|
|
|
@ -29,7 +29,11 @@
|
|||
<widget class="QTextBrowser" name="TextViewChatWindow" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditLocalInputText" />
|
||||
<widget class="QLineEdit" name="lineEditLocalInputText" >
|
||||
<property name="maxLength" >
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
|
|
Loading…
Reference in a new issue