some cleanup for the server

This commit is contained in:
Volker Fischer 2011-04-14 19:40:12 +00:00
parent a238cd9569
commit 043a7f28e1
3 changed files with 49 additions and 117 deletions

View file

@ -38,8 +38,7 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
// set up list view for connected clients
ListViewClients->setColumnWidth ( 0, 170 );
ListViewClients->setColumnWidth ( 1, 130 );
ListViewClients->setColumnWidth ( 2, 40 );
ListViewClients->setColumnWidth ( 3, 40 );
ListViewClients->setColumnWidth ( 2, 60 );
ListViewClients->clear();
// insert items in reverse order because in Windows all of them are
@ -51,9 +50,6 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
vecpListViewItems[i]->setHidden ( true );
}
// Init timing jitter text label
TextLabelResponseTime->setText ( "" );
// Main menu bar -----------------------------------------------------------
pMenu = new QMenuBar ( this );
@ -79,56 +75,46 @@ void CLlconServerDlg::OnTimer()
CVector<QString> vecsName;
CVector<int> veciJitBufNumFrames;
CVector<int> veciNetwFrameSizeFact;
double dCurTiStdDev;
ListViewMutex.lock();
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames,
veciNetwFrameSizeFact );
// fill list with connected clients
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
pServer->GetConCliParam ( vecHostAddresses,
vecsName,
veciJitBufNumFrames,
veciNetwFrameSizeFact );
// fill list with connected clients
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{
// IP, port number
vecpListViewItems[i]->setText ( 0, QString("%1 : %2" ).
arg ( vecHostAddresses[i].InetAddr.toString() ).
arg ( vecHostAddresses[i].iPort ) );
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
{
// IP, port number
vecpListViewItems[i]->setText ( 0, QString("%1 : %2" ).
arg ( vecHostAddresses[i].InetAddr.toString() ).
arg ( vecHostAddresses[i].iPort ) );
// name
vecpListViewItems[i]->setText ( 1, vecsName[i] );
// name
vecpListViewItems[i]->setText ( 1, vecsName[i] );
// jitter buffer size (polling for updates)
vecpListViewItems[i]->setText ( 4,
QString().setNum ( veciJitBufNumFrames[i] ) );
// jitter buffer size (polling for updates)
vecpListViewItems[i]->setText ( 3,
QString().setNum ( veciJitBufNumFrames[i] ) );
// out network block size
vecpListViewItems[i]->setText ( 5,
QString().setNum ( static_cast<double> (
veciNetwFrameSizeFact[i] * SYSTEM_BLOCK_DURATION_MS_FLOAT
), 'f', 2 ) );
// out network block size
vecpListViewItems[i]->setText ( 4,
QString().setNum ( static_cast<double> (
veciNetwFrameSizeFact[i] * SYSTEM_BLOCK_DURATION_MS_FLOAT
), 'f', 2 ) );
vecpListViewItems[i]->setHidden ( false );
}
else
{
vecpListViewItems[i]->setHidden ( true );
vecpListViewItems[i]->setHidden ( false );
}
else
{
vecpListViewItems[i]->setHidden ( true );
}
}
}
ListViewMutex.unlock();
// response time (if available)
if ( pServer->GetTimingStdDev ( dCurTiStdDev ) )
{
TextLabelResponseTime->setText ( QString().
setNum ( dCurTiStdDev, 'f', 2 ) + " ms" );
}
else
{
TextLabelResponseTime->setText ( "---" );
}
}
void CLlconServerDlg::customEvent ( QEvent* Event )
@ -136,22 +122,19 @@ void CLlconServerDlg::customEvent ( QEvent* Event )
if ( Event->type() == QEvent::User + 11 )
{
ListViewMutex.lock();
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
switch(iMessType)
{
case MS_JIT_BUF_PUT:
vecpListViewItems[iChanNum]->SetLight ( 0, iStatus );
break;
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
case MS_JIT_BUF_GET:
vecpListViewItems[iChanNum]->SetLight ( 1, iStatus );
break;
switch(iMessType)
{
case MS_JIT_BUF_PUT:
case MS_JIT_BUF_GET:
vecpListViewItems[iChanNum]->SetLight ( iStatus );
break;
}
}
ListViewMutex.unlock();
}
}

View file

@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>765</width>
<width>580</width>
<height>315</height>
</rect>
</property>
@ -51,22 +51,17 @@
</column>
<column>
<property name="text" >
<string>Put</string>
<string>Buffers</string>
</property>
</column>
<column>
<property name="text" >
<string>Get</string>
<string>Jitter Buffer Size</string>
</property>
</column>
<column>
<property name="text" >
<string>Jitter buffer size</string>
</property>
</column>
<column>
<property name="text" >
<string>Block Size Out</string>
<string>Block Size Out/ms</string>
</property>
</column>
</widget>
@ -98,42 +93,6 @@
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>72</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="TextLabel1" >
<property name="text" >
<string>Timing Standard Deviation:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelResponseTime" >
<property name="text" >
<string>TextLabelResponseTime</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >

View file

@ -132,28 +132,18 @@ class CServerListViewItem : public QTreeWidgetItem
{
public:
CServerListViewItem ( QTreeWidget* parent )
: QTreeWidgetItem ( parent ), LED0 ( 2 ), LED1 ( 3 )
: QTreeWidgetItem ( parent ), LED ( 2 )
{
LED0.SetListViewItemPointer ( this );
LED1.SetListViewItemPointer ( this );
LED.SetListViewItemPointer ( this );
}
void SetLight ( int iWhichLED, int iNewStatus )
void SetLight ( int iNewStatus )
{
switch ( iWhichLED )
{
case 0:
LED0.SetLight ( iNewStatus );
break;
case 1:
LED1.SetLight ( iNewStatus );
break;
}
LED.SetLight ( iNewStatus );
}
protected:
CMultColLEDListViewItem LED0, LED1;
CMultColLEDListViewItem LED;
};