Diffstat (limited to 'noncore/net/wellenreiter/gui/protolistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/protolistview.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp index d4b0dfe..f4b45d0 100644 --- a/noncore/net/wellenreiter/gui/protolistview.cpp +++ b/noncore/net/wellenreiter/gui/protolistview.cpp | |||
@@ -19,37 +19,37 @@ | |||
19 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qhbox.h> | 21 | #include <qhbox.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qpalette.h> | 23 | #include <qpalette.h> |
24 | #include <qcolor.h> | 24 | #include <qcolor.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | 27 | ||
28 | ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) | 28 | ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) |
29 | :QScrollView( parent, name, f ) | 29 | :QScrollView( parent, name, f ) |
30 | { | 30 | { |
31 | actions = ( QString( "parsePackets" ) == QString( name ) ); | 31 | parse = ( QString( "parsePackets" ) == QString( name ) ); |
32 | 32 | ||
33 | setMargins( 3, 3, 0, 0 ); | 33 | setMargins( 3, 3, 0, 0 ); |
34 | viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); | 34 | viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); |
35 | 35 | ||
36 | vbox = new QVBox( viewport() ); | 36 | vbox = new QVBox( viewport() ); |
37 | vbox->setSpacing( 1 ); | 37 | vbox->setSpacing( 1 ); |
38 | addChild( vbox ); | 38 | addChild( vbox ); |
39 | 39 | ||
40 | QHBox* hbox = new QHBox( vbox ); | 40 | QHBox* hbox = new QHBox( vbox ); |
41 | hbox->setSpacing( 40 ); | 41 | hbox->setSpacing( 40 ); |
42 | new QLabel( tr( "Protocol Family" ), hbox ); | 42 | new QLabel( tr( "Protocol Family" ), hbox ); |
43 | if ( actions ) new QLabel( tr( "Perform Action" ), hbox ); | 43 | new QLabel( tr( "Perform Action" ), hbox ); |
44 | QFrame* frame = new QFrame( vbox ); | 44 | QFrame* frame = new QFrame( vbox ); |
45 | frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); | 45 | frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); |
46 | 46 | ||
47 | //TODO: hardcoded for now...a protocol database would be nice!? | 47 | //TODO: hardcoded for now...a protocol database would be nice!? |
48 | 48 | ||
49 | //addProtocol( "Ethernet" ); | 49 | //addProtocol( "Ethernet" ); |
50 | addProtocol( "Prism" ); | 50 | addProtocol( "Prism" ); |
51 | //addProtocol( "802.11" ); | 51 | //addProtocol( "802.11" ); |
52 | addProtocol( "802.11 Management" ); | 52 | addProtocol( "802.11 Management" ); |
53 | addProtocol( "802.11 SSID" ); | 53 | addProtocol( "802.11 SSID" ); |
54 | addProtocol( "802.11 Rates" ); | 54 | addProtocol( "802.11 Rates" ); |
55 | addProtocol( "802.11 CF" ); | 55 | addProtocol( "802.11 CF" ); |
@@ -69,49 +69,56 @@ ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f | |||
69 | 69 | ||
70 | 70 | ||
71 | ProtocolListView::~ProtocolListView() | 71 | ProtocolListView::~ProtocolListView() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | void ProtocolListView::addProtocol( const QString& name ) | 76 | void ProtocolListView::addProtocol( const QString& name ) |
77 | { | 77 | { |
78 | QHBox* hbox = new QHBox( vbox ); | 78 | QHBox* hbox = new QHBox( vbox ); |
79 | new QCheckBox( name, hbox, (const char*) name ); | 79 | new QCheckBox( name, hbox, (const char*) name ); |
80 | 80 | ||
81 | if ( actions ) | 81 | if ( parse ) |
82 | { | 82 | { |
83 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); | 83 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); |
84 | #ifdef QWS | 84 | #ifdef QWS |
85 | combo->setFixedWidth( 75 ); | 85 | combo->setFixedWidth( 75 ); |
86 | #endif | 86 | #endif |
87 | combo->insertItem( "Ignore" ); | 87 | combo->insertItem( "Ignore" ); |
88 | combo->insertItem( "Discard!" ); | ||
88 | combo->insertItem( "TouchSound" ); | 89 | combo->insertItem( "TouchSound" ); |
89 | combo->insertItem( "AlarmSound" ); | 90 | combo->insertItem( "AlarmSound" ); |
90 | combo->insertItem( "KeySound" ); | 91 | combo->insertItem( "KeySound" ); |
91 | combo->insertItem( "LedOn" ); | 92 | combo->insertItem( "LedOn" ); |
92 | combo->insertItem( "LedOff" ); | 93 | combo->insertItem( "LedOff" ); |
93 | combo->insertItem( "LogMessage" ); | 94 | combo->insertItem( "LogMessage" ); |
94 | combo->insertItem( "MessageBox" ); | 95 | combo->insertItem( "MessageBox" ); |
95 | } | 96 | } |
97 | else | ||
98 | { | ||
99 | QComboBox* combo = new QComboBox( hbox, (const char*) name ); | ||
100 | #ifdef QWS | ||
101 | combo->setFixedWidth( 75 ); | ||
102 | #endif | ||
103 | combo->insertItem( "Pass" ); | ||
104 | combo->insertItem( "Discard!" ); | ||
105 | } | ||
96 | } | 106 | } |
97 | 107 | ||
98 | 108 | ||
99 | bool ProtocolListView::isProtocolChecked( const QString& name ) | 109 | bool ProtocolListView::isProtocolChecked( const QString& name ) |
100 | { | 110 | { |
101 | QCheckBox* box = (QCheckBox*) child( (const char*) name ); | 111 | QCheckBox* box = (QCheckBox*) child( (const char*) name ); |
102 | return ( box && box->isOn() ); | 112 | return ( box && box->isOn() ); |
103 | } | 113 | } |
104 | 114 | ||
105 | 115 | ||
106 | QString ProtocolListView::protocolAction( const QString& name ) | 116 | QString ProtocolListView::protocolAction( const QString& name ) |
107 | { | 117 | { |
108 | //QObject * child ( const char * objName, const char * inheritsClass = 0, | ||
109 | // bool recursiveSearch = TRUE ) | ||
110 | |||
111 | QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); | 118 | QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); |
112 | if ( combo ) | 119 | if ( combo ) |
113 | return combo->currentText(); | 120 | return combo->currentText(); |
114 | else | 121 | else |
115 | return "<unknown>"; | 122 | return "<unknown>"; |
116 | } | 123 | } |
117 | 124 | ||