2006-12-18 15:39:33 +01:00
|
|
|
/******************************************************************************\
|
|
|
|
* Copyright (c) 2004-2006
|
|
|
|
*
|
|
|
|
* 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 "llconserverdlg.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Implementation *************************************************************/
|
2006-02-17 20:07:10 +01:00
|
|
|
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent,
|
2006-11-25 15:46:57 +01:00
|
|
|
const char* name, bool modal, WFlags f ) : pServer ( pNServP ),
|
2006-12-18 15:39:33 +01:00
|
|
|
CLlconServerDlgBase ( parent, name, modal, f )
|
|
|
|
{
|
|
|
|
/* set text for version and application name */
|
2006-12-29 11:52:25 +01:00
|
|
|
TextLabelNameVersion->setText ( QString ( APP_NAME ) +
|
|
|
|
tr ( " server " ) + QString ( VERSION ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
/* Create bitmaps */
|
|
|
|
/* Define size of the bitmaps */
|
|
|
|
const int iXSize = 13;
|
|
|
|
const int iYSize = 13;
|
2006-12-29 11:52:25 +01:00
|
|
|
BitmCubeGreen.resize ( iXSize, iYSize );
|
|
|
|
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
|
|
|
|
BitmCubeRed.resize ( iXSize, iYSize );
|
|
|
|
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
|
|
|
|
BitmCubeYellow.resize ( iXSize, iYSize );
|
|
|
|
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
/* set up list view for connected clients (We assume that one column is
|
|
|
|
already there) */
|
2006-12-29 11:52:25 +01:00
|
|
|
ListViewClients->setColumnText ( 0, tr ( "Client IP : Port" ) );
|
|
|
|
ListViewClients->setColumnWidth ( 0, 170 );
|
|
|
|
ListViewClients->addColumn ( tr ( "Name" ) );
|
|
|
|
ListViewClients->setColumnAlignment ( 1, Qt::AlignLeft );
|
|
|
|
ListViewClients->setColumnWidth ( 1, 150 );
|
|
|
|
ListViewClients->addColumn ( tr ( "Put" ) );
|
|
|
|
ListViewClients->setColumnAlignment ( 2, Qt::AlignCenter );
|
|
|
|
ListViewClients->addColumn ( tr ( "Get" ) );
|
|
|
|
ListViewClients->setColumnAlignment ( 3, Qt::AlignCenter );
|
|
|
|
ListViewClients->addColumn ( tr ( "Jitter buffer size" ) );
|
|
|
|
ListViewClients->setColumnAlignment ( 4, Qt::AlignRight );
|
|
|
|
ListViewClients->addColumn ( tr ( "Block Size In" ) );
|
|
|
|
ListViewClients->setColumnAlignment ( 5, Qt::AlignRight );
|
|
|
|
ListViewClients->addColumn ( tr ( "Block Size Out" ) );
|
|
|
|
ListViewClients->setColumnAlignment ( 6, Qt::AlignRight );
|
2006-12-18 15:39:33 +01:00
|
|
|
ListViewClients->clear();
|
|
|
|
|
|
|
|
/* insert items in reverse order because in Windows all of them are
|
|
|
|
always visible -> put first item on the top */
|
|
|
|
vecpListViewItems.Init(MAX_NUM_CHANNELS);
|
2007-09-08 12:45:14 +02:00
|
|
|
for ( int i = MAX_NUM_CHANNELS - 1; i >= 0; i-- )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2007-09-08 12:45:14 +02:00
|
|
|
vecpListViewItems[i] = new CServerListViewItem ( ListViewClients );
|
2006-12-18 15:39:33 +01:00
|
|
|
#ifndef _WIN32
|
2007-09-08 12:45:14 +02:00
|
|
|
vecpListViewItems[i]->setVisible ( false );
|
2006-12-18 15:39:33 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* Init timing jitter text label */
|
2007-09-08 12:45:14 +02:00
|
|
|
TextLabelResponseTime->setText ( "" );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* Main menu bar -------------------------------------------------------- */
|
2007-09-08 12:45:14 +02:00
|
|
|
pMenu = new QMenuBar ( this );
|
|
|
|
CHECK_PTR ( pMenu );
|
|
|
|
pMenu->insertItem ( tr ( "&?" ), new CLlconHelpMenu ( this ) );
|
|
|
|
pMenu->setSeparator ( QMenuBar::InWindowsStyle );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
/* Now tell the layout about the menu */
|
2007-09-08 12:45:14 +02:00
|
|
|
CLlconServerDlgBaseLayout->setMenuBar ( pMenu );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
/* connections ---------------------------------------------------------- */
|
|
|
|
/* timers */
|
2007-09-08 12:45:14 +02:00
|
|
|
QObject::connect ( &Timer, SIGNAL ( timeout() ), this, SLOT ( OnTimer() ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* timers --------------------------------------------------------------- */
|
|
|
|
/* start timer for GUI controls */
|
2007-09-08 12:45:14 +02:00
|
|
|
Timer.start ( GUI_CONTRL_UPDATE_TIME );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CLlconServerDlg::OnTimer()
|
|
|
|
{
|
|
|
|
CVector<CHostAddress> vecHostAddresses;
|
2006-12-29 11:52:25 +01:00
|
|
|
CVector<std::string> vecsName;
|
2006-11-25 15:46:57 +01:00
|
|
|
CVector<int> veciJitBufSize;
|
|
|
|
CVector<int> veciNetwOutBlSiFact;
|
|
|
|
CVector<int> veciNetwInBlSiFact;
|
2006-12-18 15:39:33 +01:00
|
|
|
double dCurTiStdDev;
|
|
|
|
|
|
|
|
ListViewMutex.lock();
|
2006-09-16 13:26:15 +02:00
|
|
|
|
2006-12-29 11:52:25 +01:00
|
|
|
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufSize,
|
2006-11-25 15:46:57 +01:00
|
|
|
veciNetwOutBlSiFact, veciNetwInBlSiFact );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
/* fill list with connected clients */
|
2006-12-29 11:52:25 +01:00
|
|
|
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2006-12-29 11:52:25 +01:00
|
|
|
if ( ! ( vecHostAddresses[i].InetAddr == QHostAddress ( (Q_UINT32) 0 ) ) )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2006-12-29 11:52:25 +01:00
|
|
|
// IP, port number
|
|
|
|
vecpListViewItems[i]->setText ( 0, QString().sprintf ( "%s : %d",
|
2006-12-18 15:39:33 +01:00
|
|
|
vecHostAddresses[i].InetAddr.toString().latin1(),
|
2006-12-29 11:52:25 +01:00
|
|
|
vecHostAddresses[i].iPort ) /* IP, port */);
|
2006-02-20 22:09:36 +01:00
|
|
|
|
2006-12-29 11:52:25 +01:00
|
|
|
// name
|
|
|
|
vecpListViewItems[i]->setText ( 1, vecsName[i].c_str() );
|
2006-09-16 13:26:15 +02:00
|
|
|
|
2006-12-29 11:52:25 +01:00
|
|
|
// jitter buffer size (polling for updates)
|
|
|
|
vecpListViewItems[i]->setText ( 4,
|
|
|
|
QString().setNum ( veciJitBufSize[i] ) );
|
|
|
|
|
|
|
|
// in/out network block sizes
|
|
|
|
vecpListViewItems[i]->setText ( 5,
|
|
|
|
QString().setNum (
|
|
|
|
double ( veciNetwInBlSiFact[i] * MIN_BLOCK_DURATION_MS), 'f', 2 ) );
|
|
|
|
vecpListViewItems[i]->setText(6,
|
|
|
|
QString().setNum (
|
|
|
|
double ( veciNetwOutBlSiFact[i] * MIN_BLOCK_DURATION_MS), 'f', 2 ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
vecpListViewItems[i]->setVisible ( true );
|
|
|
|
#endif
|
|
|
|
}
|
2006-11-25 15:46:57 +01:00
|
|
|
else
|
|
|
|
{
|
2006-02-22 18:48:25 +01:00
|
|
|
#ifdef _WIN32
|
2006-12-29 11:52:25 +01:00
|
|
|
// remove text for Windows version
|
|
|
|
vecpListViewItems[i]->setText ( 0, "" );
|
|
|
|
vecpListViewItems[i]->setText ( 1, "" );
|
|
|
|
vecpListViewItems[i]->setText ( 4, "" );
|
|
|
|
vecpListViewItems[i]->setText ( 5, "" );
|
2006-02-22 18:48:25 +01:00
|
|
|
#else
|
2006-11-25 15:46:57 +01:00
|
|
|
vecpListViewItems[i]->setVisible ( false );
|
2006-02-22 18:48:25 +01:00
|
|
|
#endif
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-25 15:46:57 +01:00
|
|
|
ListViewMutex.unlock();
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-29 11:52:25 +01:00
|
|
|
// response time (if available)
|
2006-11-25 15:46:57 +01:00
|
|
|
if ( pServer->GetTimingStdDev ( dCurTiStdDev ) )
|
|
|
|
{
|
2006-12-29 11:52:25 +01:00
|
|
|
TextLabelResponseTime->setText ( QString().
|
|
|
|
setNum ( dCurTiStdDev, 'f', 2 ) + " ms" );
|
2006-11-25 15:46:57 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-29 11:52:25 +01:00
|
|
|
TextLabelResponseTime->setText ( "---" );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-29 11:52:25 +01:00
|
|
|
void CLlconServerDlg::customEvent ( QCustomEvent* Event )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2006-12-29 11:52:25 +01:00
|
|
|
if ( Event->type() == QEvent::User + 11 )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
|
|
|
ListViewMutex.lock();
|
|
|
|
|
2006-12-29 11:52:25 +01:00
|
|
|
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
|
|
|
|
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
|
|
|
|
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
switch(iMessType)
|
|
|
|
{
|
|
|
|
case MS_JIT_BUF_PUT:
|
2006-12-29 11:52:25 +01:00
|
|
|
vecpListViewItems[iChanNum]->SetLight ( 0, iStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MS_JIT_BUF_GET:
|
2006-12-29 11:52:25 +01:00
|
|
|
vecpListViewItems[iChanNum]->SetLight ( 1, iStatus );
|
2006-12-18 15:39:33 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ListViewMutex.unlock();
|
|
|
|
}
|
|
|
|
}
|