-rw-r--r-- | noncore/net/wellenreiter/gui/packetview.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index f0f16ff..69438fa 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp | |||
@@ -68,27 +68,29 @@ PacketView::PacketView( QWidget * parent, const char * name, WFlags f ) | |||
68 | clear(); | 68 | clear(); |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | void PacketView::add( const OPacket* p, int size ) | 72 | void PacketView::add( const OPacket* p, int size ) |
73 | { | 73 | { |
74 | odebug << "PacketView::add() size = " << size << oendl; | 74 | odebug << "PacketView::add() size = " << size << oendl; |
75 | if ( size == -1 ) // unlimited buffer | 75 | if ( size == -1 ) // unlimited buffer |
76 | { | 76 | { |
77 | _packets.append( p ); | 77 | _packets.append( p ); |
78 | } | 78 | } |
79 | else | 79 | else |
80 | // limited buffer, limit = size | 80 | { // limited buffer, limit = size |
81 | if ( _packets.count() < size ) | 81 | while ( _packets.count() >= size ) |
82 | { | 82 | { |
83 | _packets.removeFirst(); | ||
84 | } | ||
83 | _packets.append( p ); | 85 | _packets.append( p ); |
84 | } | 86 | } |
85 | 87 | ||
86 | _number->setMinValue( 1 ); | 88 | _number->setMinValue( 1 ); |
87 | _number->setMaxValue( _packets.count() ); | 89 | _number->setMaxValue( _packets.count() ); |
88 | _number->setValue( _packets.count() ); | 90 | _number->setValue( _packets.count() ); |
89 | } | 91 | } |
90 | 92 | ||
91 | void PacketView::showPacket( int number ) | 93 | void PacketView::showPacket( int number ) |
92 | { | 94 | { |
93 | _list->clear(); | 95 | _list->clear(); |
94 | _hex->setText(""); | 96 | _hex->setText(""); |