summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp12
-rw-r--r--noncore/apps/opie-console/io_serial.h2
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp19
-rw-r--r--noncore/apps/opie-console/iolayerbase.h4
-rw-r--r--noncore/apps/opie-console/irdaconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/main.cpp6
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp14
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp12
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp70
-rw-r--r--noncore/apps/opie-console/terminalwidget.h6
11 files changed, 128 insertions, 41 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index 0ac337f..e1ff18a 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -78,48 +78,54 @@ void BTConfigWidget::load( const Profile& prof ) {
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 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;
@@ -136,48 +142,54 @@ void BTConfigWidget::save( Profile& prof ) {
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;
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 ) {
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 89b70c6..1a0613f 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -20,49 +20,51 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
m_teEmu = new TEmuVt102(m_teWid );
connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ),
this, SIGNAL(changeSize(int,int) ) );
connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ),
this, SLOT(recvEmulation(const char*,int) ) );
m_teEmu->setConnect( true );
m_teEmu->setHistory( TRUE );
load( prof );
}
TEmulation* EmulationHandler::emulation() {
return m_teEmu;
}
EmulationHandler::~EmulationHandler() {
if (isRecording())
clearScript();
delete m_teEmu;
delete m_teWid;
}
void EmulationHandler::load( const Profile& prof) {
- m_teWid->setVTFont( font( prof.readNumEntry("Font") ) );
+
+// m_teWid->setVTFont( font( prof.readNumEntry("Font") ) );
+ m_teWid->setVTFont( QFont( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ) );
int num = prof.readNumEntry("Color");
setColor( foreColor(num), backColor(num) );
m_teWid->setBackgroundColor(backColor(num) );
int term = prof.readNumEntry("Terminal", 0) ;
switch(term) {
default:
case Profile::VT102:
case Profile::VT100:
m_teEmu->setKeytrans("vt100.keytab");
break;
case Profile::Linux:
m_teEmu->setKeytrans("linux.keytab");
break;
case Profile::XTerm:
m_teEmu->setKeytrans("default.Keytab");
break;
}
}
void EmulationHandler::recv( const QByteArray& ar) {
m_teEmu->onRcvBlock(ar.data(), ar.count() );
}
void EmulationHandler::recvEmulation(const char* src, int len ) {
QByteArray ar(len);
@@ -109,77 +111,77 @@ QFont EmulationHandler::font( int id ) {
size = 7;
break;
case 2:
name = QString::fromLatin1("Fixed");
size = 12;
break;
}
QFont font(name, size, QFont::Normal );
font.setFixedPitch(TRUE );
return font;
}
QColor EmulationHandler::foreColor(int col) {
QColor co;
/* we need to switch it */
switch( col ) {
default:
case Profile::White:
/* color is black */
co = Qt::white;
break;
case Profile::Black:
co = Qt::black;
break;
case Profile::Green:
- owarn << "Foreground green" << oendl;
+ owarn << "Foreground green" << oendl;
co = Qt::green;
break;
case Profile::Orange:
- owarn << "Foreground orange" << oendl;
+ owarn << "Foreground orange" << oendl;
co.setRgb( 231, 184, 98 );
break;
}
return co;
}
QColor EmulationHandler::backColor(int col ) {
QColor co;
/* we need to switch it */
switch( col ) {
default:
case Profile::White:
/* color is white */
co = Qt::black;
break;
case Profile::Black:
co = Qt::white;
break;
case Profile::Green:
- owarn << "Background black" << oendl;
+ owarn << "Background black" << oendl;
co = Qt::black;
break;
case Profile::Orange:
- owarn << "Background black" << oendl;
+ owarn << "Background black" << oendl;
co = Qt::black;
break;
}
return co;
}
QPushButton* EmulationHandler::cornerButton() {
return m_teWid->cornerButton();
}
Script *EmulationHandler::script() {
return m_script;
}
bool EmulationHandler::isRecording() {
return (m_script != 0);
}
void EmulationHandler::startRecording() {
if (!isRecording())
m_script = new Script();
}
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h
index 20c1ae1..f8b04e2 100644
--- a/noncore/apps/opie-console/io_serial.h
+++ b/noncore/apps/opie-console/io_serial.h
@@ -18,49 +18,49 @@ class IOSerial : public IOLayer {
Q_OBJECT
public:
enum Parity {
ParityNone = 0,
ParityEven,
ParityOdd,
ParitySpace,
ParityMark
};
enum Flow {
FlowHW = 0x01,
FlowSW = 0x02
};
IOSerial(const Profile &);
~IOSerial();
virtual QString identifier() const;
virtual QString name() const;
int rawIO() const;
void closeRawIO (int fd );
virtual QBitArray supports() const;
virtual bool isConnected();
-
+
/*signals:
void received(const QByteArray &);
void error(int, const QString &);
*/
public slots:
virtual void send(const QByteArray &);
virtual bool open();
virtual void close();
virtual void reload(const Profile &);
protected:
int baud(int baud) const;
void internDetach();
void internAttach();
protected slots:
void dataArrived();
void errorOccured();
protected:
QSocketNotifier *m_read;
QSocketNotifier *m_error;
QString m_device;
int m_baud;
int m_parity;
int m_dbits;
int m_sbits;
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp
index b434e66..0f64d6a 100644
--- a/noncore/apps/opie-console/iolayerbase.cpp
+++ b/noncore/apps/opie-console/iolayerbase.cpp
@@ -3,49 +3,51 @@
#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_9600,
+ id_baud_4800,
+ id_baud_2400
};
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 );
@@ -65,95 +67,102 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name )
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 );
};
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;
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;
}
}
@@ -187,48 +196,54 @@ IOLayerBase::Flow IOLayerBase::flow()const {
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;
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 e1b96df..214a35c 100644
--- a/noncore/apps/opie-console/iolayerbase.h
+++ b/noncore/apps/opie-console/iolayerbase.h
@@ -1,48 +1,50 @@
#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_9600,
+ Baud_4800,
+ Baud_2400 };
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;
diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp
index 059530d..4ee770d 100644
--- a/noncore/apps/opie-console/irdaconfigwidget.cpp
+++ b/noncore/apps/opie-console/irdaconfigwidget.cpp
@@ -57,48 +57,54 @@ void IrdaConfigWidget::load( const Profile& prof ) {
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 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;
@@ -115,34 +121,40 @@ void IrdaConfigWidget::save( Profile& prof ) {
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;
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/main.cpp b/noncore/apps/opie-console/main.cpp
index 1bd4338..f61f44e 100644
--- a/noncore/apps/opie-console/main.cpp
+++ b/noncore/apps/opie-console/main.cpp
@@ -1,36 +1,36 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
-
+#include <qfile.h>
#include <qpe/qpeapplication.h>
#include "mainwindow.h"
-//#define FSCKED_DISTRIBUTION 1
+#define FSCKED_DISTRIBUTION 1
#ifdef FSCKED_DISTRIBUTION
/*
* The Zaurus rom
*/
class FixIt {
public:
FixIt();
~FixIt();
void fixIt();
/* no real interested in implementing it */
void breakIt() {
};
char* m_file;
};
FixIt::FixIt() {
/* the new inittab */
m_file = "#\n# /etc/inittab"
"#"
""
"# 0 - halt (Do NOT set initdefault to this)"
"# 1 - Single user mode"
"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)"
@@ -70,41 +70,41 @@ FixIt::FixIt() {
}
FixIt::~FixIt() {
}
/*
* the retail Zaurus is broken in many ways
* one is that pppd is listening on our port...
* we've to stop it from that and then do kill(SIGHUP,1);
*/
void FixIt::fixIt() {
::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" );
QFile file( "/etc/inittab" );
if ( file.open(IO_WriteOnly | IO_Raw ) ) {
file.writeBlock(m_file,strlen(m_file) );
}
file.close();
::kill( SIGHUP, 1 );
}
#endif
int main(int argc, char **argv) {
// too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole";
QPEApplication app( argc, argv );
#ifdef FSCKED_DISTRIBUTION
- owarn << "fscked" << oendl;
+// owarn << "fscked" << oendl;
FixIt it;
it.fixIt();
#endif
MainWindow mw;
mw.setCaption(QObject::tr("Opie Console") );
app.showMainWidget( &mw );
int ap = app.exec();
#ifdef FSCKED_DISTRIBUTION
/* should add a signal handler too */
it.breakIt();
#endif
return ap;
}
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 9fdaf73..90d0b5b 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -89,77 +89,83 @@ void ModemConfigWidget::load( const Profile& prof ) {
}
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 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;
+ 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;
@@ -176,48 +182,54 @@ void ModemConfigWidget::save( Profile& prof ) {
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;
}
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;
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
index 3edf723..5f3547a 100644
--- a/noncore/apps/opie-console/serialconfigwidget.cpp
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -61,48 +61,54 @@ void SerialConfigWidget::load( const Profile& prof ) {
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 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 );
}
@@ -136,48 +142,54 @@ void SerialConfigWidget::save( Profile& prof ) {
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;
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;
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index 087476b..3e3b8a6 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -1,226 +1,242 @@
#include "terminalwidget.h"
/* OPIE */
#include <opie2/odebug.h>
+
using namespace Opie::Core;
/* QT */
#include <qlabel.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qradiobutton.h>
#include <qhgroupbox.h>
#include <qhbuttongroup.h>
#include <qlayout.h>
+#include <qhbox.h>
namespace {
enum TermIds {
id_term_vt100 = 0,
id_term_vt102,
id_term_linux,
id_term_xterm
};
enum ColourIds {
id_term_black,
id_term_white,
id_term_green,
id_term_orange
};
enum FontIds {
id_size_small,
id_size_medium,
id_size_large
};
};
TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
const char* na )
: ProfileDialogTerminalWidget( name, parent, na ) {
m_terminal = new QLabel(tr("Terminal Type"), this );
m_terminalBox = new QComboBox(this);
m_colorLabel = new QLabel(tr("Color scheme"), this);
m_colorCmb = new QComboBox(this );
- m_groupSize = new QHButtonGroup(tr("Font size"), this );
- m_sizeSmall = new QRadioButton(tr("small"), m_groupSize );
- m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize );
- m_sizeLarge = new QRadioButton(tr("large"), m_groupSize );
+// m_groupSize = new QHButtonGroup(tr("Font size"), this );
+ m_groupSize = new QHBox( this );
+ m_fontSelector = new Opie::Ui::OFontSelector( false, m_groupSize );
+
+// m_sizeSmall = new QRadioButton(tr("small"), m_groupSize );
+// m_sizeMedium = new QRadioButton(tr("medium"), m_groupSize );
+// m_sizeLarge = new QRadioButton(tr("large"), m_groupSize );
m_groupConv = new QHGroupBox( tr("Line-break conversions"), this );
m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv );
m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv );
+
m_groupOptions = new QHGroupBox( tr("Options"), this );
m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions );
m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions );
m_lroot = new QVBoxLayout( this );
m_typeBox = new QVBoxLayout( m_lroot );
m_colorBox = new QVBoxLayout( m_lroot );
// Layout
m_typeBox->add( m_terminal );
m_typeBox->add( m_terminalBox );
m_lroot->add( m_groupSize );
m_colorBox->add( m_colorLabel );
m_colorBox->add( m_colorCmb );
m_lroot->add( m_groupConv );
m_lroot->add( m_groupOptions );
m_lroot->addStretch( 0 );
// Fill in some options
- owarn << "Options for terminal box" << oendl;
+ owarn << "Options for terminal box" << oendl;
m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ );
m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */);
m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux );
m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm );
//m_terminalBox->insertItem( tr("ANSI"), id_term_ansi );
m_colorCmb->insertItem( tr("black on white"), id_term_black );
m_colorCmb->insertItem( tr("white on black"), id_term_white );
m_colorCmb->insertItem( tr("green on black"), id_term_green );
m_colorCmb->insertItem( tr("orange on black"), id_term_orange );
// signals + slots
/*
connect(m_terminalBox, SIGNAL(activated(int) ),
this, SLOT(slotTermTerm(int) ) );
connect(m_colorBox, SIGNAL(activated(int) ),
tis, SLOT(slotTermColor(int) ) );
connect(m_groupSize, SIGNAL(activated(int) ),
this, SLOT(slotTermFont(int) ) );
connect(m_optionEcho, SIGNAL(toggled(bool) ),
this, SLOT(slotTermEcho(bool) ) );
connect(m_optionWrap, SIGNAL(toggled(bool) ),
this, SLOT(slotTermWrap(bool) ) );
connect(m_convInbound, SIGNAL(toggled(bool) ),
this, SLOT(slotTermInbound(bool) ) );
connect(m_convOutbound, SIGNAL(toggled(bool) ),
this, SLOT(slotTermOutbound(bool) ) );
*/
}
TerminalWidget::~TerminalWidget() {
}
void TerminalWidget::load( const Profile& prof ) {
int term = prof.readNumEntry("Terminal");
int color = prof.readNumEntry("Color");
- int fontsize = prof.readNumEntry("Font");
+// int fontsize = prof.readNumEntry("Font");
int opt_echo = prof.readNumEntry("Echo");
int opt_wrap = prof.readNumEntry("Wrap");
int opt_inbound = prof.readNumEntry("Inbound");
int opt_outbound = prof.readNumEntry("Outbound");
switch( term ) {
case Profile::VT100:
m_terminalBox->setCurrentItem(id_term_vt100 );
break;
case Profile::VT102:
m_terminalBox->setCurrentItem(id_term_vt102 );
break;
case Profile::Linux:
m_terminalBox->setCurrentItem(id_term_linux );
break;
case Profile::XTerm:
m_terminalBox->setCurrentItem(id_term_xterm );
break;
default:
m_terminalBox->setCurrentItem(id_term_vt102 );
break;
};
switch( color ) {
case Profile::Black:
m_colorCmb->setCurrentItem(id_term_black );
break;
case Profile::White:
m_colorCmb->setCurrentItem(id_term_white );
break;
case Profile::Green:
m_colorCmb->setCurrentItem(id_term_green );
break;
case Profile::Orange:
m_colorCmb->setCurrentItem(id_term_orange );
break;
default:
break;
};
- switch( fontsize ) {
- case Profile::Micro:
- m_sizeSmall->setChecked(true );
- break;
- case Profile::Small:
- m_sizeMedium->setChecked(true );
- break;
- case Profile::Medium:
- m_sizeLarge->setChecked( true );
- break;
- default:
- m_sizeMedium->setChecked(true );
- break;
- };
+
+ m_fontSelector->setSelectedFont( prof.readEntry( "Font"), prof.readEntry( "FontStyle"), prof.readNumEntry( "FontSize" ), prof.readEntry( "FontCharset") );
+
+// switch( fontsize ) {
+// case Profile::Micro:
+// m_sizeSmall->setChecked(true );
+// break;
+// case Profile::Small:
+// m_sizeMedium->setChecked(true );
+// break;
+// case Profile::Medium:
+// m_sizeLarge->setChecked( true );
+// break;
+// default:
+// m_sizeMedium->setChecked(true );
+// break;
+// };
if (opt_echo) m_optionEcho->setChecked( true );
if (opt_wrap) m_optionWrap->setChecked( true );
if (opt_inbound) m_convInbound->setChecked( true );
if (opt_outbound) m_convOutbound->setChecked( true );
}
void TerminalWidget::save( Profile& profile ) {
switch(m_terminalBox->currentItem() ) {
case id_term_vt100:
profile.writeEntry("Terminal", Profile::VT100 );
break;
case id_term_vt102:
profile.writeEntry("Terminal", Profile::VT102 );
break;
case id_term_linux:
profile.writeEntry("Terminal", Profile::Linux );
break;
case id_term_xterm:
profile.writeEntry("Terminal", Profile::XTerm );
break;
//case id_term_ansi:
// profile.writeEntry("Terminal", Profile::VT102 );
// break;
default:
break;
};
// color
switch(m_colorCmb->currentItem() ) {
case id_term_black:
profile.writeEntry("Color", Profile::Black );
break;
case id_term_white:
profile.writeEntry("Color", Profile::White );
break;
case id_term_green:
profile.writeEntry("Color", Profile::Green );
break;
case id_term_orange:
profile.writeEntry("Color", Profile::Orange );
break;
default:
break;
};
- if (m_sizeSmall->isChecked() ) {
- profile.writeEntry("Font", Profile::Micro );
- }else if (m_sizeMedium->isChecked() ) {
- profile.writeEntry("Font", Profile::Small );
- }else {
- profile.writeEntry("Font", Profile::Medium );
- }
+
+ profile.writeEntry( "FontSize", m_fontSelector->fontSize() );
+ profile.writeEntry( "FontStyle", m_fontSelector->fontStyle() );
+ profile.writeEntry( "FontCharset", m_fontSelector->fontCharSet() );
+ profile.writeEntry( "Font", m_fontSelector->fontFamily() );
+
+
+// if (m_sizeSmall->isChecked() ) {
+// profile.writeEntry("Font", Profile::Micro );
+// }else if (m_sizeMedium->isChecked() ) {
+// profile.writeEntry("Font", Profile::Small );
+// }else {
+// profile.writeEntry("Font", Profile::Medium );
+// }
profile.writeEntry("Echo", m_optionEcho->isChecked() );
profile.writeEntry("Wrap", m_optionWrap->isChecked() );
profile.writeEntry("Inbound", m_convInbound->isChecked() );
profile.writeEntry("Outbound",m_convOutbound->isChecked() );
}
diff --git a/noncore/apps/opie-console/terminalwidget.h b/noncore/apps/opie-console/terminalwidget.h
index 217fea7..2bd38d6 100644
--- a/noncore/apps/opie-console/terminalwidget.h
+++ b/noncore/apps/opie-console/terminalwidget.h
@@ -1,48 +1,52 @@
#ifndef OPIE_TERMINAL_WIDGET_H
#define OPIE_TERMINAL_WIDGET_H
#include "profiledialogwidget.h"
+#include <opie2/ofontselector.h>
+
class QComboBox;
class QLabel;
class QVBoxLayout;
class QHBoxLayout;
class QButtonGroup;
class QRadioButton;
class QCheckBox;
class QHGroupBox;
class QHBox;
+
class TerminalWidget : public ProfileDialogTerminalWidget {
Q_OBJECT
public:
TerminalWidget(const QString& name, QWidget* wid,
const char* na ) ;
~TerminalWidget();
void load( const Profile& );
void save( Profile& );
private:
QVBoxLayout* m_lroot, *m_typeBox, *m_colorBox;
QLabel* m_terminal, *m_colorLabel;
QComboBox* m_terminalBox, *m_colorCmb;
- QButtonGroup* m_groupSize;
+ QHBox* m_groupSize;
QRadioButton* m_sizeSmall, *m_sizeMedium,
*m_sizeLarge;
QHGroupBox *m_groupConv, *m_groupOptions;
QCheckBox *m_convInbound,
*m_convOutbound, *m_optionEcho,
*m_optionWrap;
+ Opie::Ui::OFontSelector *m_fontSelector;
};
#endif