author | mickeyl <mickeyl> | 2004-03-09 17:59:55 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-09 17:59:55 (UTC) |
commit | dd34b866c0f3e5041696dd97cf356d86a8d6d212 (patch) (unidiff) | |
tree | fb4c6e414b851a3000d91d34d38a666da1fbf95a /noncore/net/wellenreiter/gui/packetview.cpp | |
parent | 25434cbbcd2d2473c9cd3d486cec7a96a6a6323e (diff) | |
download | opie-dd34b866c0f3e5041696dd97cf356d86a8d6d212.zip opie-dd34b866c0f3e5041696dd97cf356d86a8d6d212.tar.gz opie-dd34b866c0f3e5041696dd97cf356d86a8d6d212.tar.bz2 |
on the way to a new hex window
Diffstat (limited to 'noncore/net/wellenreiter/gui/packetview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/packetview.cpp | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index e986b49..ef5d020 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp | |||
@@ -11,34 +11,58 @@ | |||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "packetview.h" | 16 | #include "packetview.h" |
17 | #include <qmultilineedit.h> | 17 | |
18 | /* OPIE */ | ||
19 | #include <opie2/opcap.h> | ||
20 | |||
21 | /* QT */ | ||
22 | #include <qtextview.h> | ||
23 | #include <qspinbox.h> | ||
24 | #include <qlabel.h> | ||
25 | #include <qlayout.h> | ||
26 | #include <qlist.h> | ||
18 | 27 | ||
19 | PacketView::PacketView( QWidget * parent, const char * name, WFlags f ) | 28 | PacketView::PacketView( QWidget * parent, const char * name, WFlags f ) |
20 | :QVBox( parent, name, f ) | 29 | :QFrame( parent, name, f ) |
21 | { | 30 | { |
22 | ledit = new QMultiLineEdit( this ); | 31 | _number = new QSpinBox( this ); |
23 | ledit->setFont( QFont( "fixed", 10 ) ); | 32 | _number->setPrefix( "Packet # " ); |
24 | ledit->setReadOnly( true ); | 33 | _label = new QLabel( this ); |
34 | _label->setText( "eth0 2004/03/08 - 00:00:21" ); | ||
35 | _list = new QLabel( this ); | ||
36 | _hex = new QTextView( this ); | ||
37 | |||
38 | QVBoxLayout* vb = new QVBoxLayout( this, 2, 2 ); | ||
39 | QHBoxLayout* hb = new QHBoxLayout( vb, 2 ); | ||
40 | hb->addWidget( _label ); | ||
41 | hb->addWidget( _number ); | ||
42 | vb->addWidget( _list ); | ||
43 | vb->addWidget( _hex ); | ||
44 | |||
45 | _packets.setAutoDelete( true ); | ||
46 | |||
47 | _list->setText( "<b>[ 802.11 [ LLC [ IP [ UDP [ DHCP ] ] ] ] ]</b>" ); | ||
25 | }; | 48 | }; |
26 | 49 | ||
27 | void PacketView::log( const QString& text ) | 50 | void PacketView::add( OPacket* p ) |
28 | { | 51 | { |
29 | int col; | 52 | _packets.append( p ); |
30 | int row; | ||
31 | ledit->getCursorPosition( &col, &row ); | ||
32 | ledit->insertAt( text, col, row ); | ||
33 | }; | 53 | }; |
34 | 54 | ||
35 | const QString PacketView::getLog() const | 55 | const QString PacketView::getLog() const |
36 | { | 56 | { |
37 | return ledit->text(); | ||
38 | } | 57 | } |
39 | 58 | ||
40 | void PacketView::clear() | 59 | void PacketView::clear() |
41 | { | 60 | { |
42 | ledit->clear(); | 61 | _packets.clear(); |
62 | _number->setMinValue( 0 ); | ||
63 | _number->setMaxValue( 0 ); | ||
64 | _label->setText( "---" ); | ||
65 | _list->setText( " <b>-- no Packet available --</b> " ); | ||
66 | _hex->setText( " <i>-- no Packet available --</i> " ); | ||
43 | } | 67 | } |
44 | 68 | ||