summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/protolistview.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/protolistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.cpp19
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
@@ -25,25 +25,25 @@
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qframe.h> 26#include <qframe.h>
27 27
28ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) 28ProtocolListView::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" );
@@ -75,42 +75,49 @@ ProtocolListView::~ProtocolListView()
75 75
76void ProtocolListView::addProtocol( const QString& name ) 76void 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
99bool ProtocolListView::isProtocolChecked( const QString& name ) 109bool 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
106QString ProtocolListView::protocolAction( const QString& name ) 116QString 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}