-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/irdaconfigwidget.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 6 |
6 files changed, 34 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp index e1ff18a..7f82e06 100644 --- a/noncore/apps/opie-console/btconfigwidget.cpp +++ b/noncore/apps/opie-console/btconfigwidget.cpp @@ -1,202 +1,208 @@ #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qcombobox.h> #include <qhbox.h> #include <qradiobutton.h> #include "iolayerbase.h" #include "btconfigwidget.h" namespace { void setCurrent( const QString& str, QComboBox* bo ) { uint b = bo->count(); for (int i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); return; } } bo->insertItem( str ); bo->setCurrentItem( b ); } } BTConfigWidget::BTConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout( this ); m_device = new QLabel( tr( "Device" ), this ); QHBox *deviceBox = new QHBox( this ); m_devRadio = new QRadioButton( deviceBox ); connect( m_devRadio, SIGNAL( toggled(bool) ), this, SLOT( slotDevRadio(bool) ) ); m_deviceCmb = new QComboBox( deviceBox ); m_deviceCmb->setEditable( TRUE ); QLabel *macLabel = new QLabel( this ); macLabel->setText( tr( "Or peer mac address" ) ); QHBox *macBox = new QHBox( this ); m_macRadio = new QRadioButton( macBox ); connect( m_macRadio, SIGNAL( toggled(bool) ), this, SLOT( slotMacRadio(bool) ) ); m_mac = new QLineEdit( macBox ); m_base = new IOLayerBase(this, "base"); m_lay->addWidget( m_device ); m_lay->addWidget( deviceBox ); m_lay->addWidget( macLabel ); m_lay->addWidget( macBox ); m_lay->addWidget( m_base ); m_deviceCmb->insertItem( "/dev/ttyU0" ); m_deviceCmb->insertItem( "/dev/ttyU1" ); } BTConfigWidget::~BTConfigWidget() { } void BTConfigWidget::load( const Profile& prof ) { int rad_flow = prof.readNumEntry("Flow"); int rad_parity = prof.readNumEntry("Parity"); int speed = prof.readNumEntry("Speed"); QString mac = prof.readEntry("Mac"); if (!mac.isEmpty() ) { m_mac->setText( mac ); } else { m_devRadio->setChecked( true ); } if (rad_flow == 1) { m_base->setFlow( IOLayerBase::Hardware ); } else if (rad_flow == 2) { m_base->setFlow( IOLayerBase::Software ); } else if (rad_flow == 0) { m_base->setFlow( IOLayerBase::None ); } if (rad_parity == 1) { m_base->setParity( IOLayerBase::Even ); } else if ( rad_parity == 2 ) { m_base->setParity( IOLayerBase::Odd ); } else { m_base->setParity( IOLayerBase::NonePar ); } switch( speed ) { case 115200: m_base->setSpeed(IOLayerBase::Baud_115200 ); break; case 57600: m_base->setSpeed( IOLayerBase::Baud_57600 ); break; case 38400: m_base->setSpeed(IOLayerBase::Baud_38400 ); break; case 19200: m_base->setSpeed( IOLayerBase::Baud_19200 ); break; case 4800: m_base->setSpeed( IOLayerBase::Baud_4800 ); break; case 2400: m_base->setSpeed( IOLayerBase::Baud_2400 ); break; + case 1200: + m_base->setSpeed( IOLayerBase::Baud_1200 ); + break; case 9600: default: m_base->setSpeed(IOLayerBase::Baud_9600 ); break; } if ( prof.readEntry("Device").isEmpty() ) return; setCurrent( prof.readEntry("Device"), m_deviceCmb ); } /* * save speed, * flow, * parity */ void BTConfigWidget::save( Profile& prof ) { int flow, parity, speed; flow = parity = speed = 0; prof.writeEntry("Device", m_deviceCmb->currentText() ); switch( m_base->flow() ) { case IOLayerBase::None: flow = 0; break; case IOLayerBase::Software: flow = 2; break; case IOLayerBase::Hardware: flow = 1; break; } switch( m_base->parity() ) { case IOLayerBase::Odd: parity = 2; break; case IOLayerBase::Even: parity = 1; break; case IOLayerBase::NonePar: parity = 0; break; } switch( m_base->speed() ) { case IOLayerBase::Baud_115200: speed = 115200; break; case IOLayerBase::Baud_57600: speed = 57600; break; case IOLayerBase::Baud_38400: speed = 38400; break; case IOLayerBase::Baud_19200: speed = 19200; break; case IOLayerBase::Baud_4800: speed = 4800; break; case IOLayerBase::Baud_2400: speed = 2400; break; + case IOLayerBase::Baud_1200; + speed = 1200; + break; default: case IOLayerBase::Baud_9600: speed = 9600; break; } prof.writeEntry("Flow", flow); prof.writeEntry("Parity", parity); prof.writeEntry("Speed", speed); prof.writeEntry("Mac", m_mac->text() ); } void BTConfigWidget::slotMacRadio( bool on ) { if ( on ) { m_devRadio->setChecked( false ); m_deviceCmb->setEnabled( false ); m_mac->setEnabled( true ); } else { m_devRadio->setChecked( true ); } } void BTConfigWidget::slotDevRadio( bool on ) { if ( on ) { m_macRadio->setChecked( false ); m_deviceCmb->setEnabled( true ); m_mac->setEnabled( false ); } else { m_macRadio->setChecked( true ); } } diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp index 0f64d6a..95c291f 100644 --- a/noncore/apps/opie-console/iolayerbase.cpp +++ b/noncore/apps/opie-console/iolayerbase.cpp @@ -1,252 +1,260 @@ #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include <qhbuttongroup.h> #include <qradiobutton.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, id_baud_4800, - id_baud_2400 + id_baud_2400, + id_baud_1200 }; 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 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 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->add(m_groupFlow ); m_lroot->add(m_groupParity ); 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 ); m_speedBox->insertItem(tr("4800 baud"), id_baud_4800 ); m_speedBox->insertItem(tr("2400 baud"), id_baud_2400 ); + m_speedBox->insertItem(tr("1200 baud"), id_baud_1200 ); }; IOLayerBase::~IOLayerBase() { } void IOLayerBase::setFlow( Flow flo ) { switch ( flo ) { case Software: m_flowSw->setChecked( true ); break; case Hardware: m_flowHw->setChecked( true ); break; case None: m_flowNone->setChecked( true ); break; } } void IOLayerBase::setParity( Parity par ) { switch( par ) { case NonePar: m_parityNone->setChecked( true ); break; case Odd: m_parityOdd->setChecked( true ); break; case Even: m_parityEven->setChecked( true ); break; } } void IOLayerBase::setSpeed( Speed sp ) { int index = -1; switch( sp ) { case Baud_115200: index = id_baud_115200; break; case Baud_57600: index = id_baud_57600; break; case Baud_38400: index = id_baud_38400; break; case Baud_19200: index = id_baud_19200; break; case Baud_4800: index = id_baud_4800; break; case Baud_2400: index = id_baud_2400; break; + case Baud_1200: + index = id_baud_1200; + 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; } else if ( m_parityEven->isChecked() ) { return Even; } else { return NonePar; } } IOLayerBase::Speed IOLayerBase::speed()const{ switch( m_speedBox->currentItem() ) { case id_baud_115200: return Baud_115200; break; case id_baud_57600: return Baud_57600; break; case id_baud_38400: return Baud_38400; break; case id_baud_19200: return Baud_19200; break; case id_baud_4800: return Baud_4800; break; case id_baud_2400: return Baud_2400; break; + case id_baud_1200: + return Baud_1200; + 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; } } diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h index 214a35c..7d304a1 100644 --- a/noncore/apps/opie-console/iolayerbase.h +++ b/noncore/apps/opie-console/iolayerbase.h @@ -1,60 +1,61 @@ #ifndef OPIE_IO_LAYER_BASE_H #define OPIE_IO_LAYER_BASE_H #include <qwidget.h> class QLabel; class QComboBox; class QVBoxLayout; class QButtonGroup; class QRadioButton; class QHBoxLayout; class IOLayerBase : public QWidget { Q_OBJECT public: enum Flow { Hardware, Software, None }; enum Parity{ Odd =2 , Even =1, NonePar =0 }; enum Speed{ Baud_115200, Baud_57600, Baud_38400, Baud_19200, Baud_9600, Baud_4800, - Baud_2400 }; + Baud_2400, + Baud_1200 }; enum Data { Data_Five =5, Data_Six =6, Data_Seven=7, Data_Eight=8 }; enum Stop { Stop_One =1, Stop_OnePointFive=15, Stop_Two=2 }; IOLayerBase( QWidget* base, const char* name = 0l); ~IOLayerBase(); void setFlow( Flow flo ); void setParity( Parity par ); void setSpeed( Speed speed ); void setData( Data data ); void setStop( Stop stop ); Flow flow()const; Parity parity()const; Speed speed()const; Data data()const; Stop stop()const; private: QVBoxLayout* m_lroot; QLabel* m_speedLabel; QComboBox* m_speedBox; QButtonGroup* m_groupFlow, *m_groupData, *m_groupStop ; QRadioButton *m_flowHw, *m_flowSw, *m_flowNone; QButtonGroup* m_groupParity; QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone; QRadioButton *m_data5, *m_data6, *m_data7, *m_data8; QRadioButton *m_stop1, *m_stop15, *m_stop2; QHBoxLayout* m_hbox; QHBoxLayout* m_hboxPar; }; #endif diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp index 4ee770d..713862d 100644 --- a/noncore/apps/opie-console/irdaconfigwidget.cpp +++ b/noncore/apps/opie-console/irdaconfigwidget.cpp @@ -1,160 +1,166 @@ #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include "iolayerbase.h" #include "irdaconfigwidget.h" namespace { void setCurrent( const QString& str, QComboBox* bo ) { uint b = bo->count(); for (int i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); return; } } bo->insertItem( str ); bo->setCurrentItem( b ); } } IrdaConfigWidget::IrdaConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout(this ); m_device = new QLabel(tr("Device"), this ); m_deviceCmb = new QComboBox(this ); m_deviceCmb->setEditable( TRUE ); m_base = new IOLayerBase(this, "base"); m_lay->addWidget( m_device ); m_lay->addWidget( m_deviceCmb ); m_lay->addWidget( m_base ); m_deviceCmb->insertItem( "/dev/ircomm0" ); m_deviceCmb->insertItem( "/dev/ircomm1" ); } IrdaConfigWidget::~IrdaConfigWidget() { } void IrdaConfigWidget::load( const Profile& prof ) { int rad_flow = prof.readNumEntry("Flow"); int rad_parity = prof.readNumEntry("Parity"); int speed = prof.readNumEntry("Speed"); if (rad_flow == 1) { m_base->setFlow( IOLayerBase::Hardware ); } else if (rad_flow == 2) { m_base->setFlow( IOLayerBase::Software ); } else { m_base->setFlow( IOLayerBase::None ); } if (rad_parity == 1) { m_base->setParity( IOLayerBase::Even ); } else if ( rad_parity == 2 ) { m_base->setParity( IOLayerBase::Odd ); } else { m_base->setParity( IOLayerBase::NonePar ); } switch( speed ) { case 115200: m_base->setSpeed(IOLayerBase::Baud_115200 ); break; case 57600: m_base->setSpeed( IOLayerBase::Baud_57600 ); break; case 38400: m_base->setSpeed(IOLayerBase::Baud_38400 ); break; case 19200: m_base->setSpeed( IOLayerBase::Baud_19200 ); break; case 4800: m_base->setSpeed( IOLayerBase::Baud_4800 ); break; case 2400: m_base->setSpeed( IOLayerBase::Baud_2400 ); break; + case 1200: + m_base->setSpeed( IOLayerBase::Baud_1200 ); + break; case 9600: default: m_base->setSpeed(IOLayerBase::Baud_9600 ); break; } if ( prof.readEntry("Device").isEmpty() ) return; setCurrent( prof.readEntry("Device"), m_deviceCmb ); } /* * save speed, * flow, * parity */ void IrdaConfigWidget::save( Profile& prof ) { int flow, parity, speed; flow = parity = speed = 0; prof.writeEntry("Device", m_deviceCmb->currentText() ); switch( m_base->flow() ) { case IOLayerBase::None: flow = 0; break; case IOLayerBase::Software: flow = 2; break; case IOLayerBase::Hardware: flow = 1; break; } switch( m_base->parity() ) { case IOLayerBase::Odd: parity = 2; break; case IOLayerBase::Even: parity = 1; break; case IOLayerBase::NonePar: parity = 0; break; } switch( m_base->speed() ) { case IOLayerBase::Baud_115200: speed = 115200; break; case IOLayerBase::Baud_57600: speed = 57600; break; case IOLayerBase::Baud_38400: speed = 38400; break; case IOLayerBase::Baud_19200: speed = 19200; break; case IOLayerBase::Baud_4800: speed = 4800; break; case IOLayerBase::Baud_2400: speed = 2400; break; + case IOLayerBase::Baud_1200: + speed = 2400; + break; default: case IOLayerBase::Baud_9600: speed = 9600; break; } prof.writeEntry("Flow", flow); prof.writeEntry("Parity", parity); prof.writeEntry("Speed", speed); } diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 90d0b5b..b2f5c68 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp @@ -1,271 +1,276 @@ #include "modemconfigwidget.h" #include "dialdialog.h" /* OPIE */ #include <opie2/odebug.h> #include <qpe/qpeapplication.h> using namespace Opie::Core; /* QT */ #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include <qpushbutton.h> #include <qhbox.h> namespace { void setCurrent( const QString& str, QComboBox* bo ) { uint b = bo->count(); for (int i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); return; } } bo->insertItem( str ); bo->setCurrentItem( b ); } } ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout( this ); m_device = new QLabel(tr( "Modem is attached to:" ), this ); m_deviceCmb = new QComboBox(this ); m_deviceCmb->setEditable( TRUE ); QLabel* telLabel = new QLabel( this ); telLabel->setText( tr( "Enter telefon number here:" ) ); QHBox *buttonBox = new QHBox( this ); m_telNumber = new QLineEdit( buttonBox ); QPushButton *atButton = new QPushButton( buttonBox ); atButton->setText( tr( "AT commands" ) ); connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); QPushButton *dialButton = new QPushButton( buttonBox ); dialButton->setText( tr( "Enter number" ) ); connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); m_base = new IOLayerBase( this, "base" ); m_lay->addWidget( m_device ); m_lay->addWidget( m_deviceCmb ); m_lay->addWidget( telLabel ); m_lay->addWidget( buttonBox ); m_lay->addWidget( m_base ); m_lay->addStretch( 0 ); m_deviceCmb->insertItem( "/dev/ttyS0" ); m_deviceCmb->insertItem( "/dev/ttyS1" ); m_deviceCmb->insertItem( "/dev/ttyS2" ); atConf = new ATConfigDialog( this, "ATConfig", true ); } ModemConfigWidget::~ModemConfigWidget() { } void ModemConfigWidget::load( const Profile& prof ) { int rad_flow = prof.readNumEntry( "Flow" ); int rad_parity = prof.readNumEntry( "Parity" ); int speed = prof.readNumEntry( "Speed" ); int dbits = prof.readNumEntry("DataBits"); int sbits = prof.readNumEntry("StopBits"); QString number = prof.readEntry( "Number" ); if ( !number.isEmpty() ) { m_telNumber->setText( number ); } if ( rad_flow == 1 ) { m_base->setFlow( IOLayerBase::Hardware ); } else if (rad_flow == 2) { m_base->setFlow( IOLayerBase::Software ); } else if (rad_flow == 0) { m_base->setFlow( IOLayerBase::None ); } if ( rad_parity == 1 ) { m_base->setParity( IOLayerBase::Even ); } else if ( rad_parity == 2 ){ m_base->setParity( IOLayerBase::Odd ); } else { m_base->setParity( IOLayerBase::NonePar ); } switch( speed ) { case 115200: m_base->setSpeed( IOLayerBase::Baud_115200 ); break; case 57600: m_base->setSpeed( IOLayerBase::Baud_57600 ); break; case 38400: m_base->setSpeed( IOLayerBase::Baud_38400 ); break; case 19200: m_base->setSpeed( IOLayerBase::Baud_19200 ); break; case 4800: m_base->setSpeed( IOLayerBase::Baud_4800 ); break; case 2400: m_base->setSpeed( IOLayerBase::Baud_2400 ); break; + case 1200: + m_base->setSpeed( IOLayerBase::Baud_1200 ); case 9600: default: m_base->setSpeed( IOLayerBase::Baud_9600 ); break; } if ( dbits == 5) { m_base->setData( IOLayerBase::Data_Five ); } else if (rad_flow == 6) { m_base->setData( IOLayerBase::Data_Six ); } else if (rad_flow == 7) { m_base->setData( IOLayerBase::Data_Seven ); } else { m_base->setData( IOLayerBase::Data_Eight ); } if ( sbits == 2) { m_base->setStop( IOLayerBase::Stop_Two ); } else if ( sbits == 15 ) { m_base->setStop( IOLayerBase::Stop_OnePointFive ); } else { m_base->setStop( IOLayerBase::Stop_One ); } atConf->readConfig( prof ); if ( prof.readEntry( "Device" ).isEmpty() ) { owarn << "device empty!" << oendl; return; } setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); } /* * save speed, * flow, * parity */ void ModemConfigWidget::save( Profile& prof ) { int flow, parity, speed, data, stop; flow = parity = speed = data = stop = 0; prof.writeEntry( "Device", m_deviceCmb->currentText() ); switch( m_base->flow() ) { case IOLayerBase::None: flow = 0; break; case IOLayerBase::Software: flow = 2; break; case IOLayerBase::Hardware: flow = 1; break; } switch( m_base->parity() ) { case IOLayerBase::Odd: parity = 2; break; case IOLayerBase::Even: parity = 1; break; case IOLayerBase::NonePar: parity = 0; break; } switch( m_base->speed() ) { case IOLayerBase::Baud_115200: speed = 115200; break; case IOLayerBase::Baud_57600: speed = 57600; break; case IOLayerBase::Baud_38400: speed = 38400; break; case IOLayerBase::Baud_19200: speed = 19200; break; case IOLayerBase::Baud_9600: speed = 9600; break; case IOLayerBase::Baud_4800: speed = 4800; break; case IOLayerBase::Baud_2400: speed = 2400; break; + case IOLayerBase::Baud_1200: + speed = 1200; + break; } switch( m_base->data() ) { case IOLayerBase::Data_Five: data = 5; break; case IOLayerBase::Data_Six: data = 6; break; case IOLayerBase::Data_Seven: data = 7; break; case IOLayerBase::Data_Eight: data = 8; break; } switch( m_base->stop() ) { case IOLayerBase::Stop_One: stop = 1; break; case IOLayerBase::Stop_OnePointFive: stop = 15; break; case IOLayerBase::Stop_Two: stop = 2; break; } prof.writeEntry( "Flow", flow ); prof.writeEntry( "Parity", parity ); prof.writeEntry( "Speed", speed ); prof.writeEntry("DataBits", data); prof.writeEntry("StopBits", stop); prof.writeEntry( "Number", m_telNumber->text() ); atConf->writeConfig(prof); } void ModemConfigWidget::slotAT() { // ATConfigDialog conf( this, "ATConfig", true ); // josef/Max I know why don't you create the stuff on the stack // but making it a TopLevel Dialog and ignoring // cancel is not fun either... // what to do? FIXME!!! -zecke if ( QPEApplication::execDialog( atConf ) != QDialog::Accepted ) { // reload old settings } } void ModemConfigWidget::slotDial() { DialDialog dial( this, "DialConfig", true ); if(!m_telNumber->text().isEmpty()) { dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); } if ( QPEApplication::execDialog( &dial ) == QDialog::Accepted ) { m_telNumber->setText( dial.number() ); } } diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp index 5f3547a..c4c9c99 100644 --- a/noncore/apps/opie-console/serialconfigwidget.cpp +++ b/noncore/apps/opie-console/serialconfigwidget.cpp @@ -1,210 +1,216 @@ #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include "iolayerbase.h" #include "serialconfigwidget.h" namespace { void setCurrent( const QString& str, QComboBox* bo ) { uint b = bo->count(); for (int i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); return; } } bo->insertItem( str ); bo->setCurrentItem( b ); } } SerialConfigWidget::SerialConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout(this ); m_device = new QLabel(tr("Device"), this ); m_deviceCmb = new QComboBox(this ); m_deviceCmb->setEditable( TRUE ); m_base = new IOLayerBase(this, "base"); m_lay->addWidget( m_device ); m_lay->addWidget( m_deviceCmb ); m_lay->addWidget( m_base ); m_deviceCmb->insertItem( "/dev/ttyS0" ); m_deviceCmb->insertItem( "/dev/ttyS1" ); m_deviceCmb->insertItem( "/dev/ttySA0"); m_deviceCmb->insertItem( "/dev/ttySA1"); } SerialConfigWidget::~SerialConfigWidget() { } void SerialConfigWidget::load( const Profile& prof ) { int rad_flow = prof.readNumEntry("Flow"); int rad_parity = prof.readNumEntry("Parity"); int speed = prof.readNumEntry("Speed"); int dbits = prof.readNumEntry("DataBits"); int sbits = prof.readNumEntry("StopBits"); if (rad_flow == 1) { m_base->setFlow( IOLayerBase::Hardware ); } else if (rad_flow == 2) { m_base->setFlow( IOLayerBase::Software ); } else { m_base->setFlow( IOLayerBase::None ); } if (rad_parity == 1) { m_base->setParity( IOLayerBase::Even ); } else if ( rad_parity == 2 ) { m_base->setParity( IOLayerBase::Odd ); } else { m_base->setParity( IOLayerBase::NonePar ); } switch( speed ) { case 115200: m_base->setSpeed(IOLayerBase::Baud_115200 ); break; case 57600: m_base->setSpeed( IOLayerBase::Baud_57600 ); break; case 38400: m_base->setSpeed(IOLayerBase::Baud_38400 ); break; case 19200: m_base->setSpeed( IOLayerBase::Baud_19200 ); break; case 4800: m_base->setSpeed( IOLayerBase::Baud_4800 ); break; case 2400: m_base->setSpeed( IOLayerBase::Baud_2400 ); break; + case 1200: + m_base->setSpeed( IOLayerBase::Baud_1200 ); + break; case 9600: default: m_base->setSpeed(IOLayerBase::Baud_9600 ); break; } if ( dbits == 5) { m_base->setData( IOLayerBase::Data_Five ); } else if (rad_flow == 6) { m_base->setData( IOLayerBase::Data_Six ); } else if (rad_flow == 7) { m_base->setData( IOLayerBase::Data_Seven ); } else { m_base->setData( IOLayerBase::Data_Eight ); } if ( sbits == 2) { m_base->setStop( IOLayerBase::Stop_Two ); } else if ( sbits == 15 ) { m_base->setStop( IOLayerBase::Stop_OnePointFive ); } else { m_base->setStop( IOLayerBase::Stop_One ); } if ( prof.readEntry("Device").isEmpty() ) return; setCurrent( prof.readEntry("Device"), m_deviceCmb ); } /* * save speed, * flow, * parity */ void SerialConfigWidget::save( Profile& prof ) { int flow, parity, speed, data, stop; flow = parity = speed = data = stop = 0; prof.writeEntry("Device", m_deviceCmb->currentText() ); switch( m_base->flow() ) { case IOLayerBase::None: flow = 0; break; case IOLayerBase::Software: flow = 2; break; case IOLayerBase::Hardware: flow = 1; break; } switch( m_base->parity() ) { case IOLayerBase::Odd: parity = 2; break; case IOLayerBase::Even: parity = 1; break; case IOLayerBase::NonePar: parity = 0; break; } switch( m_base->speed() ) { case IOLayerBase::Baud_115200: speed = 115200; break; case IOLayerBase::Baud_57600: speed = 57600; break; case IOLayerBase::Baud_38400: speed = 38400; break; case IOLayerBase::Baud_19200: speed = 19200; break; case IOLayerBase::Baud_4800: speed = 4800; break; case IOLayerBase::Baud_2400: speed = 2400; break; + case IOLayerBase::Baud_1200: + speed = 1200; + break; default: case IOLayerBase::Baud_9600: speed = 9600; break; } switch( m_base->data() ) { case IOLayerBase::Data_Five: data = 5; break; case IOLayerBase::Data_Six: data = 6; break; case IOLayerBase::Data_Seven: data = 7; break; case IOLayerBase::Data_Eight: data = 8; break; } switch( m_base->stop() ) { case IOLayerBase::Stop_One: stop = 1; break; case IOLayerBase::Stop_OnePointFive: stop = 15; break; case IOLayerBase::Stop_Two: stop = 2; break; } prof.writeEntry("Flow", flow); prof.writeEntry("Parity", parity); prof.writeEntry("Speed", speed); prof.writeEntry("DataBits", data); prof.writeEntry("StopBits", stop); } |