3 @author Bruno M. Carvalho and Deniz Sarioz
4 licensed under (open-source) QPL v1.0
5 which accompanies this distribution in the file QPL
10 #include <qbuttongroup.h>
13 #include <qpushbutton.h>
14 #include <qradiobutton.h>
19 * Constructs a tracewindow which is a child of 'parent', with the
20 * name 'name' and widget flags set to 'f'
22 * The dialog will by default be modeless, unless you set 'modal' to
23 * TRUE to construct a modal dialog.
25 @author Bruno M. Carvalho
27 tracewindow::tracewindow( QWidget* parent, const char* name, bool modal, WFlags fl )
28 : QDialog( parent, name, modal, fl )
32 setName( "tracewindow" );
34 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) );
35 setMinimumSize( QSize( width, 270 ) );
36 setMaximumSize( QSize( width, 270 ) );
37 setCaption( tr( "Trace Window" ) );
39 tracelabel = new QLabel( this, "tracelabel" );
40 tracelabel->setGeometry( QRect( 10, 10, 90, 30 ) );
41 tracelabel->setMinimumSize( QSize( 90, 30 ) );
42 tracelabel->setMaximumSize( QSize( 90, 30 ) );
43 tracelabel->setText( tr( "TRACE" ) );
45 Line18 = new QFrame( this, "Line18" );
46 Line18->setGeometry( QRect( -5, 190, width + 10, 16 ) );
47 Line18->setFrameStyle( QFrame::HLine | QFrame::Sunken );
49 tracebuttongroup = new QButtonGroup( this, "tracebuttongroup" );
50 tracebuttongroup->setGeometry( QRect( 80, 10, 200, 180 ) );
51 tracebuttongroup->setTitle( tr( "trace_level" ) );
52 tracebuttongroup->setAlignment( int( QButtonGroup::AlignHCenter ) );
54 tracebuttonslayout = new QGridLayout( tracebuttongroup, 5, 2 );
56 tl0button = new QRadioButton( tracebuttongroup, "tl0button" );
57 tl0button->setChecked( TRUE );
58 tl0button->setText( tr( "0 (unspecified)" ) );
59 // rows start from 0: leave some space on top
60 tracebuttonslayout->addMultiCellWidget(tl0button, 1, 1, 0, 1, Qt::AlignHCenter | Qt::AlignTop );
62 tl1button = new QRadioButton( tracebuttongroup, "tl1button" );
63 tl1button->setText( tr( "1" ) );
64 tracebuttonslayout->addWidget(tl1button, 2, 0, Qt::AlignHCenter | Qt::AlignVCenter );
66 tl5button = new QRadioButton( tracebuttongroup, "tl5button" );
67 tl5button->setText( tr( "5" ) );
68 tracebuttonslayout->addWidget(tl5button, 2, 1, Qt::AlignHCenter | Qt::AlignVCenter );
70 tl6button = new QRadioButton( tracebuttongroup, "tl6button" );
71 tl6button->setText( tr( "6" ) );
72 tracebuttonslayout->addWidget(tl6button, 3, 0, Qt::AlignHCenter | Qt::AlignVCenter );
74 tl7button = new QRadioButton( tracebuttongroup, "tl7button" );
75 tl7button->setText( tr( "7" ) );
76 tracebuttonslayout->addWidget(tl7button, 3, 1, Qt::AlignHCenter | Qt::AlignVCenter );
78 tl8button = new QRadioButton( tracebuttongroup, "tl8button" );
79 tl8button->setText( tr( "8" ) );
80 tracebuttonslayout->addWidget(tl8button, 4, 0, Qt::AlignHCenter | Qt::AlignVCenter );
82 tl10button = new QRadioButton( tracebuttongroup, "tl10button" );
83 tl10button->setText( tr( "10" ) );
84 tracebuttonslayout->addWidget(tl10button, 4, 1, Qt::AlignHCenter | Qt::AlignVCenter );
86 okbutton = new QPushButton( this, "okbutton" );
87 okbutton->setGeometry( QRect( 50, 210, 100, 40 ) );
88 okbutton->setText( tr( "OK" ) );
89 QObject::connect(okbutton,SIGNAL(clicked()),this,SLOT(accept()));
91 cancelbutton = new QPushButton( this, "cancelbutton" );
92 cancelbutton->setGeometry( QRect( width - 150, 210, 100, 40 ) );
93 cancelbutton->setText( tr( "Cancel" ) );
94 QObject::connect(cancelbutton,SIGNAL(clicked()),this,SLOT(reject()));
98 * Destroys the object and frees any allocated resources
100 tracewindow::~tracewindow()
102 // no need to delete child widgets, Qt does it all for us
105 /** Returns a string for TRACE input sequence
108 @author Bruno M. Carvalho
110 QString tracewindow::getOutput()
112 QString selectedText = tracebuttongroup->selected()->text();
113 QString traceText = (selectedText.startsWith("0")) ? "0" : selectedText;
114 QString output = "TRACE " + traceText + " ";