author | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
commit | 4151cc12a6c37cbec4bb6883204703eec2fb8648 (patch) (side-by-side diff) | |
tree | f7e81dc7de747628225ae4627c7cf3028183441a /noncore/apps/opie-console/iolayerbase.cpp | |
parent | e8c4383915db7ed6f47899945404247b1fd5c3c4 (diff) | |
download | opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.zip opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.gz opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.bz2 |
added data bits and stop bits
Diffstat (limited to 'noncore/apps/opie-console/iolayerbase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 102 |
1 files changed, 86 insertions, 16 deletions
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index 47f9e76..ba7c86e 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp @@ -1,80 +1,94 @@ #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include <qbuttongroup.h> #include <qhbuttongroup.h> #include <qradiobutton.h> +#include <qhbox.h> #include "iolayerbase.h" namespace { enum ParityIds { id_parity_none, id_parity_odd, id_parity_even }; enum FlowIds { id_flow_hw, id_flow_sw, id_flow_none, }; enum SpeedIds { id_baud_115200, id_baud_57600, id_baud_38400, id_baud_19200, id_baud_9600 }; + enum DataIds { + id_data_5, + id_data_6, + id_data_7, + id_data_8 + }; + + enum StopIds { + id_stop_1, + id_stop_1_5, + id_stop_2 + }; + } IOLayerBase::IOLayerBase( QWidget* par, const char* name ) : QWidget( par, name ) { m_speedLabel = new QLabel(tr("Speed"), this ); m_speedBox = new QComboBox(this ); - m_groupFlow = new QButtonGroup(tr("Flow control"),this ); + m_groupFlow = new QHButtonGroup(tr("Flow control"),this ); m_flowHw = new QRadioButton(tr("Hardware"), m_groupFlow ); m_flowSw = new QRadioButton(tr("Software"), m_groupFlow ); m_flowNone = new QRadioButton( tr("None"), m_groupFlow ); - m_groupParity = new QButtonGroup(tr("Parity"), this ); + m_groupParity = new QHButtonGroup(tr("Parity"), this ); m_parityNone = new QRadioButton(tr("None"), m_groupParity ); m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity ); m_parityEven = new QRadioButton(tr("Even"), m_groupParity ); + m_groupData = new QHButtonGroup(tr("Data Bits"), this); + m_data5 = new QRadioButton(tr("5"), m_groupData ); + m_data6 = new QRadioButton(tr("6"), m_groupData ); + m_data7 = new QRadioButton(tr("7"), m_groupData ); + m_data8 = new QRadioButton(tr("8"), m_groupData ); + + m_groupStop = new QHButtonGroup(tr("Stop Bits"), this ); + m_stop1 = new QRadioButton(tr("1"), m_groupStop ); + m_stop15 = new QRadioButton(tr("1.5"), m_groupStop ); + m_stop2 = new QRadioButton(tr("2"), m_groupStop ); + + m_lroot = new QVBoxLayout( this ); m_lroot->add(m_speedLabel ); m_lroot->add(m_speedBox ); - m_lroot->setStretchFactor(m_speedLabel, 1); - m_lroot->setStretchFactor(m_speedBox, 1 ); - - m_hbox = new QHBoxLayout(m_groupFlow, 2 ); - m_hbox->add(m_flowHw ); - m_hbox->add(m_flowSw ); - m_hbox->add(m_flowNone ); m_lroot->add(m_groupFlow ); - m_lroot->setStretchFactor(m_groupFlow, 2 ); - - m_hboxPar = new QHBoxLayout( m_groupParity, 2 ); - m_hboxPar->add(m_parityOdd ); - m_hboxPar->add(m_parityEven ); - m_hboxPar->add(m_parityNone ); m_lroot->add(m_groupParity ); - m_lroot->setStretchFactor(m_groupParity, 2 ); + m_lroot->add( m_groupData ); + m_lroot->add( m_groupStop ); m_lroot->addStretch(2); // profiles m_speedBox->insertItem(tr("115200 baud"), id_baud_115200 ); m_speedBox->insertItem(tr("57600 baud"), id_baud_57600 ); m_speedBox->insertItem(tr("38400 baud"), id_baud_38400 ); m_speedBox->insertItem(tr("19200 baud"), id_baud_19200 ); m_speedBox->insertItem(tr("9600 baud"), id_baud_9600 ); }; IOLayerBase::~IOLayerBase() { @@ -119,24 +133,59 @@ void IOLayerBase::setSpeed( Speed sp ) { index = id_baud_38400; break; case Baud_19200: index = id_baud_19200; break; default: case Baud_9600: index = id_baud_9600; break; } m_speedBox->setCurrentItem(index ); } + +void IOLayerBase::setData( Data data ) { + switch( data ) { + case Data_Five: + m_data5->setChecked( true ); + break; + case Data_Six: + m_data6->setChecked( true ); + break; + case Data_Seven: + m_data7->setChecked( true ); + break; + default: + m_data8->setChecked( true ); + break; + } +} + + +void IOLayerBase::setStop( Stop stop ) { + switch( stop ) { + case Stop_Two: + m_stop2->setChecked( true ); + break; + case Stop_OnePointFive: + m_stop15->setChecked( true ); + break; + default: + m_stop1->setChecked( true ); + break; + } +} + + + IOLayerBase::Flow IOLayerBase::flow()const { if (m_flowHw->isChecked() ) { return Hardware; }else if( m_flowSw->isChecked() ) { return Software; } else { return None; } } IOLayerBase::Parity IOLayerBase::parity()const { if ( m_parityOdd->isChecked() ) { return Odd; @@ -158,12 +207,33 @@ IOLayerBase::Speed IOLayerBase::speed()const{ case id_baud_38400: return Baud_38400; break; case id_baud_19200: return Baud_19200; break; default: case id_baud_9600: return Baud_9600; break; } } +IOLayerBase::Data IOLayerBase::data()const { + if ( m_data5->isChecked() ) { + return Data_Five; + } else if ( m_data6->isChecked() ) { + return Data_Six; + } else if ( m_data7->isChecked() ) { + return Data_Seven; + } else { + return Data_Eight; + } +} +IOLayerBase::Stop IOLayerBase::stop()const { + if ( m_stop2->isChecked() ) { + return Stop_Two; + } else if ( m_stop15->isChecked() ) { + return Stop_OnePointFive; + } else { + return Stop_One; + } +} + |