summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/statwindow.cpp
blob: 48e48474c6c8997a278c24c297ef5b3a05be5cb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**********************************************************************
** Copyright (C) 2002-2004 Michael 'Mickey' Lauer.  All rights reserved.
**
** This file is part of Wellenreiter II.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/

#include "statwindow.h"
#include <opie2/olistview.h>

MStatWindow::MStatWindow( QWidget * parent, const char * name, WFlags f )
           :QVBox( parent, name, f )
{
    table = new OListView( this );
    table->addColumn( tr( "Protocol" ) );
    table->addColumn( tr( "Count" ) );
    table->setItemMargin( 2 );
};


void MStatWindow::updateCounter( const QString& protocol, int counter )
{
    QListViewItemIterator it( table );
    for ( ; it.current(); ++it )
    {
        if ( it.current()->text( 0 ) == protocol )
        {
            it.current()->setText( 1, QString::number( counter ) );
            return;
        }
    }

    new OListViewItem( table, protocol, QString::number( counter ) );
}