00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "protolistview.h"
00018
00019 #include <qcheckbox.h>
00020 #include <qcombobox.h>
00021 #include <qvbox.h>
00022 #include <qlabel.h>
00023
00024 ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f )
00025 :QScrollView( parent, name, f )
00026 {
00027 parse = ( QString( "parsePackets" ) == QString( name ) );
00028
00029 setMargins( 3, 3, 0, 0 );
00030 viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) );
00031
00032 vbox = new QVBox( viewport() );
00033 vbox->setSpacing( 1 );
00034 addChild( vbox );
00035
00036 QHBox* hbox = new QHBox( vbox );
00037 hbox->setSpacing( 40 );
00038 new QLabel( tr( "Protocol Family" ), hbox );
00039 new QLabel( tr( "Perform Action" ), hbox );
00040 QFrame* frame = new QFrame( vbox );
00041 frame->setFrameStyle( QFrame::HLine + QFrame::Sunken );
00042
00043
00044
00045
00046 addProtocol( "Prism" );
00047
00048 addProtocol( "802.11 Management" );
00049 addProtocol( "802.11 SSID" );
00050 addProtocol( "802.11 Rates" );
00051 addProtocol( "802.11 CF" );
00052 addProtocol( "802.11 FH" );
00053 addProtocol( "802.11 DS" );
00054 addProtocol( "802.11 Tim" );
00055 addProtocol( "802.11 IBSS" );
00056 addProtocol( "802.11 Challenge" );
00057 addProtocol( "802.11 Data" );
00058 addProtocol( "802.11 LLC" );
00059 addProtocol( "802.11 Data" );
00060 addProtocol( "IP" );
00061 addProtocol( "ARP" );
00062 addProtocol( "UDP" );
00063 addProtocol( "TCP" );
00064 }
00065
00066
00067 ProtocolListView::~ProtocolListView()
00068 {
00069 }
00070
00071
00072 void ProtocolListView::addProtocol( const QString& name )
00073 {
00074 QHBox* hbox = new QHBox( vbox );
00075 new QCheckBox( name, hbox, name.local8Bit() );
00076
00077 if ( parse )
00078 {
00079 QComboBox* combo = new QComboBox( hbox, name.local8Bit() );
00080 #ifdef QWS
00081 combo->setFixedWidth( 75 );
00082 #endif
00083 combo->insertItem( "Pass" );
00084 combo->insertItem( "Discard!" );
00085 combo->insertItem( "TouchSound" );
00086 combo->insertItem( "AlarmSound" );
00087 combo->insertItem( "KeySound" );
00088 combo->insertItem( "LedOn" );
00089 combo->insertItem( "LedOff" );
00090 combo->insertItem( "LogMessage" );
00091 combo->insertItem( "MessageBox" );
00092 }
00093 else
00094 {
00095 QComboBox* combo = new QComboBox( hbox, name.local8Bit() );
00096 #ifdef QWS
00097 combo->setFixedWidth( 75 );
00098 #endif
00099 combo->insertItem( "Pass" );
00100 combo->insertItem( "Discard!" );
00101 }
00102 }
00103
00104
00105 bool ProtocolListView::isProtocolChecked( const QString& name )
00106 {
00107 QCheckBox* box = (QCheckBox*) child( name.local8Bit() );
00108 return ( box && box->isOn() );
00109 }
00110
00111
00112 QString ProtocolListView::protocolAction( const QString& name )
00113 {
00114 QComboBox* combo = (QComboBox*) child( name.local8Bit(), "QComboBox" );
00115 if ( combo )
00116 return combo->currentText();
00117 else
00118 return "<unknown>";
00119 }
00120