initial chat dialog work, no actual functionality added yet
This commit is contained in:
parent
8f8c7f6510
commit
466354c39d
8 changed files with 276 additions and 5 deletions
|
@ -10,8 +10,9 @@ llcon_SOURCES = ../src/buffer.cpp \
|
|||
../src/util.cpp \
|
||||
../src/llconclientdlg.cpp \
|
||||
../src/clientsettingsdlg.cpp \
|
||||
../src/client.cpp \
|
||||
../src/llconserverdlg.cpp \
|
||||
../src/chatdlg.cpp \
|
||||
../src/client.cpp \
|
||||
../src/server.cpp \
|
||||
../src/settings.cpp \
|
||||
../src/protocol.cpp \
|
||||
|
@ -33,11 +34,13 @@ llcon_SOURCES = ../src/buffer.cpp \
|
|||
../src/multicolorled.h \
|
||||
../src/audiomixerboard.h \
|
||||
../src/llconserverdlg.h \
|
||||
../src/chatdlg.h \
|
||||
../src/llconclientdlg.h \
|
||||
../src/clientsettingsdlg.h \
|
||||
../src/llconclientdlgbase.ui \
|
||||
../src/llconserverdlgbase.ui \
|
||||
../src/clientsettingsdlgbase.ui \
|
||||
../src/chatdlgbase.ui \
|
||||
../src/aboutdlgbase.ui \
|
||||
sound.h \
|
||||
../src/resources.qrc \
|
||||
|
@ -60,6 +63,8 @@ BUILT_SOURCES=moc/moc_server.cpp \
|
|||
moc/clientsettingsdlgbase.h \
|
||||
moc/moc_llconserverdlg.cpp \
|
||||
moc/llconserverdlgbase.h \
|
||||
moc/moc_chatdlg.cpp \
|
||||
moc/chatdlgbase.h \
|
||||
moc/aboutdlgbase.h \
|
||||
moc/resources.cpp
|
||||
|
||||
|
@ -105,6 +110,9 @@ moc/moc_clientsettingsdlg.cpp: ../src/clientsettingsdlg.h
|
|||
moc/moc_llconserverdlg.cpp: ../src/llconserverdlg.h
|
||||
$(QT_MOC) ../src/llconserverdlg.h -o moc/moc_llconserverdlg.cpp
|
||||
|
||||
moc/moc_chatdlg.cpp: ../src/chatdlg.h
|
||||
$(QT_MOC) ../src/chatdlg.h -o moc/moc_chatdlg.cpp
|
||||
|
||||
|
||||
moc/aboutdlgbase.h: ../src/aboutdlgbase.ui
|
||||
$(QT_UIC) ../src/aboutdlgbase.ui -o moc/aboutdlgbase.h
|
||||
|
@ -118,6 +126,9 @@ moc/clientsettingsdlgbase.h: ../src/clientsettingsdlgbase.ui
|
|||
moc/llconserverdlgbase.h: ../src/llconserverdlgbase.ui
|
||||
$(QT_UIC) ../src/llconserverdlgbase.ui -o moc/llconserverdlgbase.h
|
||||
|
||||
moc/chatdlgbase.h: ../src/chatdlgbase.ui
|
||||
$(QT_UIC) ../src/chatdlgbase.ui -o moc/chatdlgbase.h
|
||||
|
||||
|
||||
moc/resources.cpp: ../src/resources.qrc
|
||||
$(QT_RCC) ../src/resources.qrc -o moc/resources.cpp
|
||||
|
|
36
src/chatdlg.cpp
Executable file
36
src/chatdlg.cpp
Executable file
|
@ -0,0 +1,36 @@
|
|||
/******************************************************************************\
|
||||
* Copyright (c) 2004-2008
|
||||
*
|
||||
* Author(s):
|
||||
* Volker Fischer
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
\******************************************************************************/
|
||||
|
||||
#include "chatdlg.h"
|
||||
|
||||
|
||||
/* Implementation *************************************************************/
|
||||
CChatDlg::CChatDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||
{
|
||||
setupUi ( this );
|
||||
|
||||
|
||||
// Connections -------------------------------------------------------------
|
||||
|
||||
}
|
46
src/chatdlg.h
Executable file
46
src/chatdlg.h
Executable file
|
@ -0,0 +1,46 @@
|
|||
/******************************************************************************\
|
||||
* Copyright (c) 2004-2008
|
||||
*
|
||||
* Author(s):
|
||||
* Volker Fischer
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
\******************************************************************************/
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qstring.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qwhatsthis.h>
|
||||
#include <qlayout.h>
|
||||
#include "global.h"
|
||||
#ifdef _WIN32
|
||||
# include "../windows/moc/chatdlgbase.h"
|
||||
#else
|
||||
# include "moc/chatdlgbase.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Classes ********************************************************************/
|
||||
class CChatDlg : public QDialog, private Ui_CChatDlgBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CChatDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||
};
|
110
src/chatdlgbase.ui
Executable file
110
src/chatdlgbase.ui
Executable file
|
@ -0,0 +1,110 @@
|
|||
<ui version="4.0" >
|
||||
<class>CChatDlgBase</class>
|
||||
<widget class="QDialog" name="CChatDlgBase" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>535</width>
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Chat</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset resource="resources.qrc" >:/new/prefix1/mainicon.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="TextViewChatWindow" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditLocalInputText" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonClose" >
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>TextViewChatWindow</tabstop>
|
||||
<tabstop>lineEditLocalInputText</tabstop>
|
||||
<tabstop>buttonClose</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="resources.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonClose</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CChatDlgBase</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -92,6 +92,11 @@ MESSAGES
|
|||
+------------------+----------------------+
|
||||
|
||||
|
||||
- Chat text PROTMESSID_CHAT_TEXT
|
||||
|
||||
+------------------+----------------------+
|
||||
| 2 bytes number n | n bytes UTF-8 string |
|
||||
+------------------+----------------------+
|
||||
|
||||
|
||||
*
|
||||
|
@ -360,6 +365,11 @@ for ( int i = 0; i < iNumBytes; i++ ) {
|
|||
|
||||
EvaluateChanNameMes ( iPos, vecData );
|
||||
break;
|
||||
|
||||
case PROTMESSID_CHAT_TEXT:
|
||||
|
||||
EvaluateChatTextMes ( iPos, vecData );
|
||||
break;
|
||||
}
|
||||
|
||||
// send acknowledge message
|
||||
|
@ -593,6 +603,31 @@ void CProtocol::CreateChanNameMes ( const QString strName )
|
|||
CreateAndSendMessage ( PROTMESSID_CHANNEL_NAME, vecData );
|
||||
}
|
||||
|
||||
void CProtocol::CreateChatTextMes ( const QString strName )
|
||||
{
|
||||
unsigned int iPos = 0; // init position pointer
|
||||
const int iStrLen = strName.size(); // get string size
|
||||
|
||||
// size of current list entry
|
||||
const int iEntrLen = 2 /* str. size */ + iStrLen;
|
||||
|
||||
// build data vector
|
||||
CVector<uint8_t> vecData ( iEntrLen );
|
||||
|
||||
// number of bytes for name string (2 bytes)
|
||||
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iStrLen ), 2 );
|
||||
|
||||
// name string (n bytes)
|
||||
for ( int j = 0; j < iStrLen; j++ )
|
||||
{
|
||||
// byte-by-byte copying of the string data
|
||||
PutValOnStream ( vecData, iPos,
|
||||
static_cast<uint32_t> ( strName[j].toAscii() ), 1 );
|
||||
}
|
||||
|
||||
CreateAndSendMessage ( PROTMESSID_CHAT_TEXT, vecData );
|
||||
}
|
||||
|
||||
void CProtocol::EvaluateChanNameMes ( unsigned int iPos, const CVector<uint8_t>& vecData )
|
||||
{
|
||||
// number of bytes for name string (2 bytes)
|
||||
|
@ -612,6 +647,25 @@ void CProtocol::EvaluateChanNameMes ( unsigned int iPos, const CVector<uint8_t>&
|
|||
emit ChangeChanName ( strName );
|
||||
}
|
||||
|
||||
void CProtocol::EvaluateChatTextMes ( unsigned int iPos, const CVector<uint8_t>& vecData )
|
||||
{
|
||||
// number of bytes for name string (2 bytes)
|
||||
const int iStrLen =
|
||||
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
|
||||
|
||||
// name string (n bytes)
|
||||
QString strName = "";
|
||||
for ( int j = 0; j < iStrLen; j++ )
|
||||
{
|
||||
// byte-by-byte copying of the string data
|
||||
int iData = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||
strName += QString ( (char*) &iData );
|
||||
}
|
||||
|
||||
// invoke message action
|
||||
emit ChatTextReceived ( strName );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************\
|
||||
* Message generation (parsing) *
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define PROTMESSID_SERVER_FULL 16 // server full message
|
||||
#define PROTMESSID_REQ_CONN_CLIENTS_LIST 17 // request connected client list
|
||||
#define PROTMESSID_CHANNEL_NAME 18 // set channel name for fader tag
|
||||
#define PROTMESSID_CHAT_TEXT 19 // contains a chat text
|
||||
|
||||
// lengths of message as defined in protocol.cpp file
|
||||
#define MESS_HEADER_LENGTH_BYTE 7 // TAG (2), ID (2), cnt (1), length (2)
|
||||
|
@ -70,6 +71,7 @@ public:
|
|||
void CreateNetwBlSiFactMes ( const int iNetwBlSiFact );
|
||||
void CreateChanGainMes ( const int iChanID, const double dGain );
|
||||
void CreateChanNameMes ( const QString strName );
|
||||
void CreateChatTextMes ( const QString strName );
|
||||
|
||||
void CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo );
|
||||
|
||||
|
@ -138,6 +140,7 @@ protected:
|
|||
void EvaluateNetwBlSiFactMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateChanGainMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateChanNameMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateChatTextMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateConClientListMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
|
||||
int iOldRecID, iOldRecCnt;
|
||||
|
@ -161,6 +164,7 @@ signals:
|
|||
void ChangeNetwBlSiFact ( int iNewNetwBlSiFact );
|
||||
void ChangeChanGain ( int iChanID, double dNewGain );
|
||||
void ChangeChanName ( QString strName );
|
||||
void ChatTextReceived ( QString strName );
|
||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||
void ReqJittBufSize();
|
||||
void ReqConnClientsList();
|
||||
|
|
|
@ -32,6 +32,7 @@ rem .h --------------
|
|||
%qtdir%\bin\moc.exe ..\src\llconclientdlg.h -o moc\moc_llconclientdlg.cpp
|
||||
%qtdir%\bin\moc.exe ..\src\clientsettingsdlg.h -o moc\moc_clientsettingsdlg.cpp
|
||||
%qtdir%\bin\moc.exe ..\src\llconserverdlg.h -o moc\moc_llconserverdlg.cpp
|
||||
%qtdir%\bin\moc.exe ..\src\chatdlg.h -o moc\moc_chatdlg.cpp
|
||||
%qtdir%\bin\moc.exe ..\src\server.h -o moc\moc_server.cpp
|
||||
%qtdir%\bin\moc.exe ..\src\client.h -o moc\moc_client.cpp
|
||||
%qtdir%\bin\moc.exe ..\src\socket.h -o moc\moc_socket.cpp
|
||||
|
@ -40,10 +41,11 @@ rem .h --------------
|
|||
|
||||
|
||||
rem .ui -------------
|
||||
%qtdir%\bin\uic.exe ..\src\aboutdlgbase.ui -o moc\aboutdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\llconclientdlgbase.ui -o moc\llconclientdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\clientsettingsdlgbase.ui -o moc\clientsettingsdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\llconserverdlgbase.ui -o moc\llconserverdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\aboutdlgbase.ui -o moc\aboutdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\llconclientdlgbase.ui -o moc\llconclientdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\clientsettingsdlgbase.ui -o moc\clientsettingsdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\llconserverdlgbase.ui -o moc\llconserverdlgbase.h
|
||||
%qtdir%\bin\uic.exe ..\src\chatdlgbase.ui -o moc\chatdlgbase.h
|
||||
|
||||
rem .qrc ------------
|
||||
%qtdir%\bin\rcc.exe ..\src\resources.qrc -o moc\resources.cpp
|
||||
|
|
|
@ -636,6 +636,10 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\moc\moc_chatdlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="moc\moc_client.cpp"
|
||||
>
|
||||
|
@ -930,6 +934,10 @@
|
|||
RelativePath="..\src\channel.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\chatdlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\client.h"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue