2006-12-18 15:39:33 +01:00
|
|
|
/******************************************************************************\
|
2010-01-03 14:40:46 +01:00
|
|
|
* Copyright (c) 2004-2010
|
2006-12-18 15:39:33 +01:00
|
|
|
*
|
|
|
|
* 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
|
2008-03-28 22:46:13 +01:00
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
2006-12-18 15:39:33 +01:00
|
|
|
* version.
|
|
|
|
*
|
2008-03-28 22:46:13 +01:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
2006-12-18 15:39:33 +01:00
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
2008-03-28 22:46:13 +01:00
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
2006-12-18 15:39:33 +01:00
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
2008-03-28 22:46:13 +01:00
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
2006-12-18 15:39:33 +01:00
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
|
|
|
#include "llconserverdlg.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Implementation *************************************************************/
|
2008-01-14 23:14:17 +01:00
|
|
|
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
|
2009-05-01 12:06:07 +02:00
|
|
|
: pServer ( pNServP ), QDialog ( parent )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2008-01-22 20:58:53 +01:00
|
|
|
setupUi ( this );
|
|
|
|
|
|
|
|
// 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
|
|
|
|
2008-01-15 23:54:04 +01:00
|
|
|
// set up list view for connected clients
|
2006-12-29 11:52:25 +01:00
|
|
|
ListViewClients->setColumnWidth ( 0, 170 );
|
2009-03-10 11:47:55 +01:00
|
|
|
ListViewClients->setColumnWidth ( 1, 130 );
|
|
|
|
ListViewClients->setColumnWidth ( 2, 40 );
|
|
|
|
ListViewClients->setColumnWidth ( 3, 40 );
|
2006-12-18 15:39:33 +01:00
|
|
|
ListViewClients->clear();
|
|
|
|
|
2009-03-01 12:17:35 +01:00
|
|
|
// insert items in reverse order because in Windows all of them are
|
|
|
|
// always visible -> put first item on the top
|
|
|
|
vecpListViewItems.Init ( USED_NUM_CHANNELS );
|
|
|
|
for ( int i = USED_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 );
|
2008-03-28 22:46:13 +01:00
|
|
|
vecpListViewItems[i]->setHidden ( true );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
|
|
|
|
2008-01-15 23:54:04 +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
|
|
|
|
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Main menu bar -----------------------------------------------------------
|
2007-09-08 12:45:14 +02:00
|
|
|
pMenu = new QMenuBar ( this );
|
2008-01-15 23:54:04 +01:00
|
|
|
pMenu->addMenu ( new CLlconHelpMenu ( this ) );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2008-01-15 23:54:04 +01:00
|
|
|
// Now tell the layout about the menu
|
|
|
|
layout()->setMenuBar ( pMenu );
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Connections -------------------------------------------------------------
|
2008-01-15 23:54:04 +01:00
|
|
|
// 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
|
|
|
|
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// Timers ------------------------------------------------------------------
|
2008-01-15 23:54:04 +01:00
|
|
|
// 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()
|
|
|
|
{
|
2009-08-11 11:10:23 +02:00
|
|
|
CVector<CHostAddress> vecHostAddresses;
|
|
|
|
CVector<QString> vecsName;
|
|
|
|
CVector<int> veciJitBufNumFrames;
|
|
|
|
CVector<int> veciNetwFrameSizeFact;
|
|
|
|
double dCurTiStdDev;
|
2006-12-18 15:39:33 +01:00
|
|
|
|
|
|
|
ListViewMutex.lock();
|
2006-09-16 13:26:15 +02:00
|
|
|
|
2009-08-02 09:54:15 +02:00
|
|
|
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames,
|
2009-07-28 22:31:23 +02:00
|
|
|
veciNetwFrameSizeFact );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-01-22 20:58:53 +01:00
|
|
|
// fill list with connected clients
|
2009-03-01 12:17:35 +01:00
|
|
|
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2008-01-14 23:14:17 +01:00
|
|
|
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
|
2006-12-18 15:39:33 +01:00
|
|
|
{
|
2006-12-29 11:52:25 +01:00
|
|
|
// IP, port number
|
2008-03-28 22:46:13 +01:00
|
|
|
vecpListViewItems[i]->setText ( 0, QString("%1 : %2" ).
|
|
|
|
arg ( vecHostAddresses[i].InetAddr.toString() ).
|
|
|
|
arg ( vecHostAddresses[i].iPort ) );
|
2006-02-20 22:09:36 +01:00
|
|
|
|
2006-12-29 11:52:25 +01:00
|
|
|
// name
|
2008-01-22 22:15:04 +01:00
|
|
|
vecpListViewItems[i]->setText ( 1, vecsName[i] );
|
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,
|
2009-08-02 09:54:15 +02:00
|
|
|
QString().setNum ( veciJitBufNumFrames[i] ) );
|
2006-12-29 11:52:25 +01:00
|
|
|
|
2009-03-01 12:17:35 +01:00
|
|
|
// out network block size
|
2006-12-29 11:52:25 +01:00
|
|
|
vecpListViewItems[i]->setText ( 5,
|
2009-07-28 22:31:23 +02:00
|
|
|
QString().setNum ( static_cast<double> (
|
|
|
|
veciNetwFrameSizeFact[i] * SYSTEM_BLOCK_DURATION_MS_FLOAT
|
|
|
|
), 'f', 2 ) );
|
2006-12-18 15:39:33 +01:00
|
|
|
|
2008-03-28 22:46:13 +01:00
|
|
|
vecpListViewItems[i]->setHidden ( false );
|
2006-12-18 15:39:33 +01:00
|
|
|
}
|
2006-11-25 15:46:57 +01:00
|
|
|
else
|
|
|
|
{
|
2008-03-28 22:46:13 +01:00
|
|
|
vecpListViewItems[i]->setHidden ( true );
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-15 21:07:55 +01:00
|
|
|
void CLlconServerDlg::customEvent ( QEvent* 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;
|
2008-03-28 22:46:13 +01:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|