summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-14 23:53:11 (UTC)
committer harlekin <harlekin>2002-10-14 23:53:11 (UTC)
commit06330eede01fa5082ec382045b63454b2262bba6 (patch) (unidiff)
treef376fbe312afa908428d128de1684b30dca7d90c
parentb3ad9188f40cf6e3c170cc48be3ed180d509036f (diff)
downloadopie-06330eede01fa5082ec382045b63454b2262bba6.zip
opie-06330eede01fa5082ec382045b63454b2262bba6.tar.gz
opie-06330eede01fa5082ec382045b63454b2262bba6.tar.bz2
push the gui a bit up
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp
index 08acb75..49ed284 100644
--- a/noncore/apps/opie-console/iolayerbase.cpp
+++ b/noncore/apps/opie-console/iolayerbase.cpp
@@ -1,168 +1,170 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qcombobox.h> 3#include <qcombobox.h>
4#include <qbuttongroup.h> 4#include <qbuttongroup.h>
5#include <qhbuttongroup.h> 5#include <qhbuttongroup.h>
6#include <qradiobutton.h> 6#include <qradiobutton.h>
7 7
8#include "iolayerbase.h" 8#include "iolayerbase.h"
9 9
10namespace { 10namespace {
11 enum ParityIds { 11 enum ParityIds {
12 id_parity_none, 12 id_parity_none,
13 id_parity_odd, 13 id_parity_odd,
14 id_parity_even 14 id_parity_even
15 }; 15 };
16 16
17 enum FlowIds { 17 enum FlowIds {
18 id_flow_hw, 18 id_flow_hw,
19 id_flow_sw, 19 id_flow_sw,
20 id_flow_none, 20 id_flow_none,
21 }; 21 };
22 22
23 enum SpeedIds { 23 enum SpeedIds {
24 id_baud_115200, 24 id_baud_115200,
25 id_baud_57600, 25 id_baud_57600,
26 id_baud_38400, 26 id_baud_38400,
27 id_baud_19200, 27 id_baud_19200,
28 id_baud_9600 28 id_baud_9600
29 }; 29 };
30 30
31} 31}
32 32
33 33
34IOLayerBase::IOLayerBase( QWidget* par, const char* name ) 34IOLayerBase::IOLayerBase( QWidget* par, const char* name )
35 : QWidget( par, name ) 35 : QWidget( par, name )
36{ 36{
37 m_speedLabel = new QLabel(tr("Speed"), this ); 37 m_speedLabel = new QLabel(tr("Speed"), this );
38 m_speedBox = new QComboBox(this ); 38 m_speedBox = new QComboBox(this );
39 39
40 m_groupFlow = new QButtonGroup(tr("Flow control"),this ); 40 m_groupFlow = new QButtonGroup(tr("Flow control"),this );
41 m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); 41 m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow );
42 m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); 42 m_flowSw = new QRadioButton(tr("Software"), m_groupFlow );
43 m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); 43 m_flowNone = new QRadioButton( tr("None"), m_groupFlow );
44 44
45 m_groupParity = new QButtonGroup(tr("Parity"), this ); 45 m_groupParity = new QButtonGroup(tr("Parity"), this );
46 m_parityNone = new QRadioButton(tr("None"), m_groupParity ); 46 m_parityNone = new QRadioButton(tr("None"), m_groupParity );
47 m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); 47 m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity );
48 m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); 48 m_parityEven = new QRadioButton(tr("Even"), m_groupParity );
49 49
50 m_lroot = new QVBoxLayout( this ); 50 m_lroot = new QVBoxLayout( this );
51 m_lroot->add(m_speedLabel ); 51 m_lroot->add(m_speedLabel );
52 m_lroot->add(m_speedBox ); 52 m_lroot->add(m_speedBox );
53 m_lroot->setStretchFactor(m_speedLabel, 1); 53 m_lroot->setStretchFactor(m_speedLabel, 1);
54 m_lroot->setStretchFactor(m_speedBox, 1 ); 54 m_lroot->setStretchFactor(m_speedBox, 1 );
55 55
56 m_hbox = new QHBoxLayout(m_groupFlow, 2 ); 56 m_hbox = new QHBoxLayout(m_groupFlow, 2 );
57 m_hbox->add(m_flowHw ); 57 m_hbox->add(m_flowHw );
58 m_hbox->add(m_flowSw ); 58 m_hbox->add(m_flowSw );
59 m_hbox->add(m_flowNone ); 59 m_hbox->add(m_flowNone );
60 m_lroot->add(m_groupFlow ); 60 m_lroot->add(m_groupFlow );
61 m_lroot->setStretchFactor(m_groupFlow, 2 ); 61 m_lroot->setStretchFactor(m_groupFlow, 2 );
62 62
63 m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); 63 m_hboxPar = new QHBoxLayout( m_groupParity, 2 );
64 m_hboxPar->add(m_parityOdd ); 64 m_hboxPar->add(m_parityOdd );
65 m_hboxPar->add(m_parityEven ); 65 m_hboxPar->add(m_parityEven );
66 m_hboxPar->add(m_parityNone ); 66 m_hboxPar->add(m_parityNone );
67 m_lroot->add(m_groupParity ); 67 m_lroot->add(m_groupParity );
68 m_lroot->setStretchFactor(m_groupParity, 2 ); 68 m_lroot->setStretchFactor(m_groupParity, 2 );
69 m_lroot->addStretch(2);
69 70
70 // profiles 71 // profiles
71 m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); 72 m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 );
72 m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); 73 m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 );
73 m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); 74 m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 );
74 m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); 75 m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 );
75 m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); 76 m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 );
77
76}; 78};
77IOLayerBase::~IOLayerBase() { 79IOLayerBase::~IOLayerBase() {
78 80
79} 81}
80void IOLayerBase::setFlow( Flow flo ) { 82void IOLayerBase::setFlow( Flow flo ) {
81 switch ( flo ) { 83 switch ( flo ) {
82 case Software: 84 case Software:
83 m_flowSw->setChecked( true ); 85 m_flowSw->setChecked( true );
84 break; 86 break;
85 case Hardware: 87 case Hardware:
86 m_flowHw->setChecked( true ); 88 m_flowHw->setChecked( true );
87 break; 89 break;
88 case None: 90 case None:
89 m_flowNone->setChecked( true ); 91 m_flowNone->setChecked( true );
90 break; 92 break;
91 } 93 }
92} 94}
93 95
94void IOLayerBase::setParity( Parity par ) { 96void IOLayerBase::setParity( Parity par ) {
95 switch( par ) { 97 switch( par ) {
96 case NonePar: 98 case NonePar:
97 m_parityNone->setChecked( true ); 99 m_parityNone->setChecked( true );
98 break; 100 break;
99 case Odd: 101 case Odd:
100 m_parityOdd->setChecked( true ); 102 m_parityOdd->setChecked( true );
101 break; 103 break;
102 case Even: 104 case Even:
103 m_parityEven->setChecked( true ); 105 m_parityEven->setChecked( true );
104 break; 106 break;
105 } 107 }
106} 108}
107void IOLayerBase::setSpeed( Speed sp ) { 109void IOLayerBase::setSpeed( Speed sp ) {
108 int index; 110 int index;
109 switch( sp ) { 111 switch( sp ) {
110 case Baud_115200: 112 case Baud_115200:
111 index = id_baud_115200; 113 index = id_baud_115200;
112 break; 114 break;
113 case Baud_57600: 115 case Baud_57600:
114 index = id_baud_57600; 116 index = id_baud_57600;
115 break; 117 break;
116 case Baud_38400: 118 case Baud_38400:
117 index = id_baud_38400; 119 index = id_baud_38400;
118 break; 120 break;
119 case Baud_19200: 121 case Baud_19200:
120 index = id_baud_19200; 122 index = id_baud_19200;
121 break; 123 break;
122 case Baud_9600: 124 case Baud_9600:
123 index = id_baud_9600; 125 index = id_baud_9600;
124 break; 126 break;
125 } 127 }
126 m_speedBox->setCurrentItem(index ); 128 m_speedBox->setCurrentItem(index );
127} 129}
128IOLayerBase::Flow IOLayerBase::flow()const { 130IOLayerBase::Flow IOLayerBase::flow()const {
129 if (m_flowHw->isChecked() ) { 131 if (m_flowHw->isChecked() ) {
130 qWarning("Hardware flow"); 132 qWarning("Hardware flow");
131 return Hardware; 133 return Hardware;
132 }else if( m_flowSw->isChecked() ) { 134 }else if( m_flowSw->isChecked() ) {
133 qWarning("Software"); 135 qWarning("Software");
134 return Software; 136 return Software;
135 } else { 137 } else {
136 qWarning("None"); 138 qWarning("None");
137 return None; 139 return None;
138 } 140 }
139} 141}
140IOLayerBase::Parity IOLayerBase::parity()const { 142IOLayerBase::Parity IOLayerBase::parity()const {
141 if ( m_parityOdd->isChecked() ) { 143 if ( m_parityOdd->isChecked() ) {
142 return Odd; 144 return Odd;
143 } else if ( m_parityEven->isChecked() ) { 145 } else if ( m_parityEven->isChecked() ) {
144 return Even; 146 return Even;
145 } else { 147 } else {
146 return NonePar; 148 return NonePar;
147 } 149 }
148 150
149} 151}
150IOLayerBase::Speed IOLayerBase::speed()const{ 152IOLayerBase::Speed IOLayerBase::speed()const{
151 switch( m_speedBox->currentItem() ) { 153 switch( m_speedBox->currentItem() ) {
152 case id_baud_115200: 154 case id_baud_115200:
153 return Baud_115200; 155 return Baud_115200;
154 break; 156 break;
155 case id_baud_57600: 157 case id_baud_57600:
156 return Baud_57600; 158 return Baud_57600;
157 break; 159 break;
158 case id_baud_38400: 160 case id_baud_38400:
159 return Baud_38400; 161 return Baud_38400;
160 break; 162 break;
161 case id_baud_19200: 163 case id_baud_19200:
162 return Baud_19200; 164 return Baud_19200;
163 break; 165 break;
164 case id_baud_9600: 166 case id_baud_9600:
165 return Baud_9600; 167 return Baud_9600;
166 break; 168 break;
167 } 169 }
168} 170}