diff --git a/src/channel.cpp b/src/channel.cpp index c70e5b95..927ed0e4 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -58,7 +58,8 @@ CChannelSet::CChannelSet() void CChannelSet::CreateAndSendChanListForAllConClients() { - int i; + int i; + CVector veciChanIDs ( 0 ); CVector veciIpAddrs ( 0 ); CVector vecstrNames ( 0 ); @@ -71,7 +72,8 @@ void CChannelSet::CreateAndSendChanListForAllConClients() { if ( vecChannels[i].IsConnected() ) { - // append IP address and channel name to storing vectors + // append channel ID, IP address and channel name to storing vectors + veciChanIDs.Add ( i ); veciIpAddrs.Add ( vecChannels[i].GetAddress().InetAddr.ip4Addr() ); vecstrNames.Add ( vecChannels[i].GetName() ); } @@ -83,7 +85,7 @@ void CChannelSet::CreateAndSendChanListForAllConClients() if ( vecChannels[i].IsConnected() ) { // send message - vecChannels[i].CreateConClientListMes ( veciIpAddrs, vecstrNames ); + vecChannels[i].CreateConClientListMes ( veciChanIDs, veciIpAddrs, vecstrNames ); } } } diff --git a/src/channel.h b/src/channel.h index 428388bd..927c1b13 100755 --- a/src/channel.h +++ b/src/channel.h @@ -112,10 +112,11 @@ public: } } - void CreateConClientListMes ( const CVector& veciIpAddrs, + void CreateConClientListMes ( const CVector& veciChanIDs, + const CVector& veciIpAddrs, const CVector& vecstrNames ) { - Protocol.CreateConClientListMes ( veciIpAddrs, vecstrNames ); + Protocol.CreateConClientListMes ( veciChanIDs, veciIpAddrs, vecstrNames ); } protected: diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 243682fa..c99d2f3b 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -166,9 +166,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent, TimerStatus.start(STATUSBAR_UPDATE_TIME); - -// TEST /* +// TEST QGridLayout* grid1 = new QGridLayout ( FrameAudioFaders, 2, 1 ); QSlider* pSliderChannelFader = new QSlider ( Qt::Vertical, FrameAudioFaders ); @@ -207,6 +206,11 @@ grid2->addWidget( pTextChannelName2, 1, 0 ); FrameAudioFadersLayout->insertLayout ( 0, grid2 ); */ +/* +// TEST +new CLlconClientDlg::CChannelFader(FrameAudioFaders, FrameAudioFadersLayout); +*/ + } @@ -350,3 +354,33 @@ void CLlconClientDlg::customEvent ( QCustomEvent* Event ) ClientSettingsDlg.SetStatus ( iMessType, iStatus ); } } + + +// Help classes --------------------------------------------------------------- +CLlconClientDlg::CChannelFader::CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy ) : + pParentLayout ( pNPtLy ), + MainGrid ( pNW, 2, 1 ), + Fader ( Qt::Vertical, pNW ), + Label ( "", pNW ) +{ + // add slider to grid as position 0 / 0 + MainGrid.addWidget( &Fader, 0, 0 ); + + // setup slider + Fader.setPageStep ( 1 ); + Fader.setTickmarks ( QSlider::Both ); + Fader.setRange(0, AUD_MIX_FADER_MAX); + Fader.setTickInterval(AUD_MIX_FADER_MAX / 9); + +// TEST set value +Fader.setValue ( AUD_MIX_FADER_MAX ); + + // add label to grid + MainGrid.addWidget( &Label, 1, 0 ); + + +// TEST set label +Label.setText ( "Test" ); + + pParentLayout->insertLayout ( 0, &MainGrid ); +} diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index 4712271e..c249b5b1 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -72,20 +72,35 @@ public: virtual ~CLlconClientDlg (); -protected: - CClient* pClient; - bool bConnected; - QTimer TimerSigMet; - QTimer TimerStatus; +protected: + class CChannelFader + { + public: + CChannelFader ( QWidget* pNW, QHBoxLayout* pNPtLy ); + + protected: + QGridLayout MainGrid; + QSlider Fader; + QLabel Label; + + QHBoxLayout* pParentLayout; + }; - virtual void customEvent ( QCustomEvent* Event ); - virtual void closeEvent ( QCloseEvent * Event ); - void UpdateDisplay(); + CClient* pClient; + bool bConnected; + QTimer TimerSigMet; + QTimer TimerStatus; + + virtual void customEvent ( QCustomEvent* Event ); + virtual void closeEvent ( QCloseEvent * Event ); + void UpdateDisplay(); - QPopupMenu* pSettingsMenu; - QMenuBar* pMenu; + QPopupMenu* pSettingsMenu; + QMenuBar* pMenu; - CClientSettingsDlg ClientSettingsDlg; + CClientSettingsDlg ClientSettingsDlg; + + CVector vecpChanFader; public slots: void OnConnectDisconBut(); diff --git a/src/protocol.cpp b/src/protocol.cpp index e78ae8aa..3400b55d 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -59,18 +59,18 @@ MESSAGES - Gain of channel PROTMESSID_CHANNEL_GAIN - +--------------------+--------------+ - | 2 bytes channel ID | 2 bytes gain | - +--------------------+--------------+ + +-------------------+--------------+ + | 1 byte channel ID | 2 bytes gain | + +-------------------+--------------+ - IP number and name of connected clients PROTMESSID_CONN_CLIENTS_LIST for each connected client append following data: - +--------------------+------------------+----------------------+ - | 4 bytes IP address | 2 bytes number n | n bytes UTF-8 string | - +--------------------+------------------+----------------------+ + +-------------------+--------------------+------------------+----------------------+ + | 1 byte channel ID | 4 bytes IP address | 2 bytes number n | n bytes UTF-8 string | + +-------------------+--------------------+------------------+----------------------+ * ****************************************************************************** @@ -400,12 +400,12 @@ void CProtocol::EvaluateNetwBlSiFactMes ( unsigned int iPos, const CVector vecData ( 4 ); // 4 bytes of data + CVector vecData ( 3 ); // 3 bytes of data unsigned int iPos = 0; // init position pointer // build data vector // channel ID - PutValOnStream ( vecData, iPos, static_cast ( iChanID ), 2 ); + PutValOnStream ( vecData, iPos, static_cast ( iChanID ), 1 ); // actual gain, we convert from double with range 0..1 to integer const int iCurGain = (int) ( dGain * ( 1 << 16 ) ); @@ -418,7 +418,7 @@ void CProtocol::EvaluateChanGainMes ( unsigned int iPos, const CVector& { // channel ID const int iCurID = - static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); + static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); // actual gain, we convert from integer to double with range 0..1 const int iData = @@ -430,7 +430,8 @@ void CProtocol::EvaluateChanGainMes ( unsigned int iPos, const CVector& emit ChangeChanGain ( iCurID, dNewGain ); } -void CProtocol::CreateConClientListMes ( const CVector& veciIpAddrs, +void CProtocol::CreateConClientListMes ( const CVector& veciChanIDs, + const CVector& veciIpAddrs, const CVector& vecstrNames ) { const int iNumClients = veciIpAddrs.Size(); @@ -446,11 +447,15 @@ void CProtocol::CreateConClientListMes ( const CVector& veciIpAddrs, // size of current list entry const int iCurListEntrLen = - 4 /* IP addr. */ + 2 /* str. size */ + iCurStrLen; + 1 /* chan ID */ + 4 /* IP addr. */ + 2 /* str. size */ + iCurStrLen; // make space for new data vecData.Enlarge ( iCurListEntrLen ); + // channel ID + PutValOnStream ( vecData, iPos, + static_cast ( veciChanIDs[i] ), 1 ); + // IP address (4 bytes) PutValOnStream ( vecData, iPos, static_cast ( veciIpAddrs[i] ), 4 ); @@ -478,6 +483,8 @@ void CProtocol:: EvaluateConClientListMes ( unsigned int iPos, const CVector ( GetValFromStream ( vecData, iPos, 1 ) ); // IP address (4 bytes) iData = static_cast ( GetValFromStream ( vecData, iPos, 4 ) ); diff --git a/src/protocol.h b/src/protocol.h index 859f3bb0..b7dfb57a 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -65,7 +65,8 @@ public: void CreateNetwBlSiFactMes ( const int iNetwBlSiFact ); void CreateChanGainMes ( const int iChanID, const double dGain ); - void CreateConClientListMes ( const CVector& veciIpAddrs, + void CreateConClientListMes ( const CVector& veciChanIDs, + const CVector& veciIpAddrs, const CVector& vecstrNames ); void CreateAndSendAcknMess ( const int& iID, const int& iCnt );