bug fix for server

This commit is contained in:
Volker Fischer 2008-03-28 21:46:13 +00:00
parent 6d8160c518
commit 25161fa55a
5 changed files with 74 additions and 65 deletions

View File

@ -114,7 +114,7 @@
<item>
<widget class="QLabel" name="TextLabelCopyright" >
<property name="text" >
<string>Copyright (C) 2005 - 2006</string>
<string>Copyright (C) 2005 - 2008</string>
</property>
<property name="wordWrap" >
<bool>false</bool>

View File

@ -1,5 +1,5 @@
/******************************************************************************\
* Copyright (c) 2004-2006
* Copyright (c) 2004-2008
*
* Author(s):
* Volker Fischer
@ -8,16 +8,16 @@
*
* 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
* 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
* 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
* 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.,
* this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\******************************************************************************/
@ -28,8 +28,8 @@
/* Implementation *************************************************************/
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
: pServer ( pNServP ), QDialog ( parent ),
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
{
setupUi ( this );
@ -39,8 +39,8 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
tr ( " server " ) + QString ( VERSION ) );
// create bitmaps
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
BitmCubeGreen.fill ( QColor ( 0, 255, 0 ) );
BitmCubeRed.fill ( QColor ( 255, 0, 0 ) );
BitmCubeYellow.fill ( QColor ( 255, 255, 0 ) );
// set up list view for connected clients
@ -63,7 +63,7 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent )
for ( int i = MAX_NUM_CHANNELS - 1; i >= 0; i-- )
{
vecpListViewItems[i] = new CServerListViewItem ( ListViewClients );
vecpListViewItems[i]->setHidden ( false );
vecpListViewItems[i]->setHidden ( true );
}
// Init timing jitter text label
@ -108,9 +108,9 @@ void CLlconServerDlg::OnTimer()
if ( !( vecHostAddresses[i].InetAddr == QHostAddress ( (quint32) 0 ) ) )
{
// IP, port number
vecpListViewItems[i]->setText ( 0, QString().sprintf ( "%s : %d",
vecHostAddresses[i].InetAddr.toString(),
vecHostAddresses[i].iPort ) /* IP, port */);
vecpListViewItems[i]->setText ( 0, QString("%1 : %2" ).
arg ( vecHostAddresses[i].InetAddr.toString() ).
arg ( vecHostAddresses[i].iPort ) );
// name
vecpListViewItems[i]->setText ( 1, vecsName[i] );
@ -123,15 +123,15 @@ void CLlconServerDlg::OnTimer()
vecpListViewItems[i]->setText ( 5,
QString().setNum (
double ( veciNetwInBlSiFact[i] * MIN_BLOCK_DURATION_MS ), 'f', 2 ) );
vecpListViewItems[i]->setText(6,
vecpListViewItems[i]->setText ( 6,
QString().setNum (
double ( veciNetwOutBlSiFact[i] * MIN_BLOCK_DURATION_MS ), 'f', 2 ) );
vecpListViewItems[i]->setHidden ( true );
vecpListViewItems[i]->setHidden ( false );
}
else
{
vecpListViewItems[i]->setHidden ( false );
vecpListViewItems[i]->setHidden ( true );
}
}
@ -156,8 +156,8 @@ void CLlconServerDlg::customEvent ( QEvent* Event )
ListViewMutex.lock();
const int iMessType = ( (CLlconEvent*) Event )->iMessType;
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
const int iStatus = ( (CLlconEvent*) Event )->iStatus;
const int iChanNum = ( (CLlconEvent*) Event )->iChanNum;
switch(iMessType)
{

View File

@ -6,22 +6,22 @@
*
* Description:
* Implements a multi-color LED
*
*
*
******************************************************************************
*
* 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
* 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
* 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
* 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.,
* this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\******************************************************************************/
@ -32,9 +32,9 @@
/* Implementation *************************************************************/
CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
: QLabel ( parent, f ),
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeGrey ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeGrey ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
BitmCubeYellow ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL )
{
// create bitmaps
@ -56,12 +56,12 @@ CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
eColorFlag = RL_GREY;
// init update time
SetUpdateTime ( DEFAULT_UPDATE_TIME );
SetUpdateTime ( DEFAULT_UPDATE_TIME );
// init timers -> we want to have single shot timers
TimerRedLight.setSingleShot ( true );
TimerGreenLight.setSingleShot ( true );
TimerYellowLight.setSingleShot ( true );
// init timers -> we want to have single shot timers
TimerRedLight.setSingleShot ( true );
TimerGreenLight.setSingleShot ( true );
TimerYellowLight.setSingleShot ( true );
// connect timer events to the desired slots
connect ( &TimerRedLight, SIGNAL ( timeout() ),
@ -70,6 +70,9 @@ CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
this, SLOT ( OnTimerGreenLight() ) );
connect ( &TimerYellowLight, SIGNAL ( timeout() ),
this, SLOT ( OnTimerYellowLight() ) );
connect ( this, SIGNAL ( newPixmap ( const QPixmap& ) ),
this, SLOT ( OnNewPixmap ( const QPixmap& ) ) );
}
void CMultiColorLED::Reset()
@ -109,7 +112,8 @@ void CMultiColorLED::UpdateColor()
{
if ( eColorFlag != RL_RED )
{
setPixmap ( BitmCubeRed );
//setPixmap ( BitmCubeRed );
emit newPixmap ( BitmCubeRed );
eColorFlag = RL_RED;
}
return;
@ -119,7 +123,8 @@ void CMultiColorLED::UpdateColor()
{
if ( eColorFlag != RL_YELLOW )
{
setPixmap ( BitmCubeYellow );
//setPixmap ( BitmCubeYellow );
emit newPixmap ( BitmCubeYellow );
eColorFlag = RL_YELLOW;
}
return;
@ -129,7 +134,8 @@ void CMultiColorLED::UpdateColor()
{
if ( eColorFlag != RL_GREEN )
{
setPixmap ( BitmCubeGreen );
//setPixmap ( BitmCubeGreen );
emit newPixmap ( BitmCubeGreen );
eColorFlag = RL_GREEN;
}
return;
@ -173,15 +179,15 @@ void CMultiColorLED::SetUpdateTime ( const int iNUTi )
{
// avoid too short intervals
if ( iNUTi < MIN_TIME_FOR_RED_LIGHT )
{
{
iUpdateTime = MIN_TIME_FOR_RED_LIGHT;
}
}
else
{
{
iUpdateTime = iNUTi;
}
}
TimerGreenLight.setInterval ( iUpdateTime );
TimerYellowLight.setInterval ( iUpdateTime );
TimerRedLight.setInterval ( iUpdateTime );
TimerGreenLight.setInterval ( iUpdateTime );
TimerYellowLight.setInterval ( iUpdateTime );
TimerRedLight.setInterval ( iUpdateTime );
}

View File

@ -82,18 +82,20 @@ protected:
bool bFlagYellowLi;
protected slots:
void OnTimerRedLight();
void OnTimerGreenLight();
void OnTimerYellowLight();
void OnTimerRedLight();
void OnTimerGreenLight();
void OnTimerYellowLight();
virtual void OnNewPixmap ( const QPixmap& newPixmap ) { setPixmap ( newPixmap ); }
signals:
void newPixmap ( const QPixmap& newPixmap );
};
// TODO list view item LED does not work anymore
class CMultColLEDListViewItem : public CMultiColorLED
{
Q_OBJECT
public:
CMultColLEDListViewItem ( const int iNewCol ) : iColumn ( iNewCol ),
pListViewItem ( NULL ) {}
@ -103,15 +105,16 @@ public:
pListViewItem = pNewListViewItem;
}
protected:
virtual void SetPixmap ( QPixmap& NewBitmap )
protected slots:
virtual void OnNewPixmap ( const QPixmap& newPixmap )
{
if ( pListViewItem != NULL )
{
pListViewItem->setIcon ( iColumn, QIcon ( NewBitmap ) );
pListViewItem->setIcon ( iColumn, QIcon ( newPixmap ) );
}
}
protected:
QTreeWidgetItem* pListViewItem;
int iColumn;
};

View File

@ -110,7 +110,7 @@ public:
DebugError ( "Writing vector out of bounds", "Vector size",
iVectorSize, "New parameter", iPos );
}
#endif
#endif
return pData[iPos]; }
inline TData operator[] ( const int iPos ) const {
@ -256,13 +256,13 @@ public:
inline TData GetAverage()
{
if ( this->iNorm == 0 )
{
return TData ( 0 );
}
{
return TData ( 0 );
}
else
{
return tCurAvResult / this->iNorm;
}
{
return tCurAvResult / this->iNorm;
}
}
virtual void Init ( const int iNewSize );
@ -299,15 +299,15 @@ template<class TData> void CMovingAv<TData>::Add ( const TData tNewD )
// increase position pointer and test if wrap
iCurIdx++;
if ( iCurIdx >= this->iVectorSize )
{
{
iCurIdx = 0;
}
}
// take care of norm
if ( this->iNorm < this->iVectorSize )
{
{
this->iNorm++;
}
}
}
@ -477,9 +477,9 @@ public:
const QDateTime curDateTime = QDateTime::currentDateTime();
// format date and time output according to "3.9.2006 11:38:08: "
return QString().setNum ( curDateTime.date().day() ) + "." +
return QString().setNum ( curDateTime.date().day() ) + "." +
QString().setNum ( curDateTime.date().month() ) + "." +
QString().setNum ( curDateTime.date().year() ) + " " +
QString().setNum ( curDateTime.date().year() ) + " " +
curDateTime.time().toString() + ": ";
}
};