-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.cpp | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/iolayerbase.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/irdaconfigwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/main.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.cpp | 70 | ||||
-rw-r--r-- | noncore/apps/opie-console/terminalwidget.h | 6 |
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 @@ -86,32 +86,38 @@ void BTConfigWidget::load( const Profile& prof ) { 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 ) { @@ -144,32 +150,38 @@ void BTConfigWidget::save( Profile& prof ) { 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 ); 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 @@ -28,33 +28,35 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c 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"); @@ -117,61 +119,61 @@ QFont EmulationHandler::font( int id ) { 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; } 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 @@ -26,33 +26,33 @@ public: }; 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(); 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 @@ -11,33 +11,35 @@ namespace { 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 }; } @@ -73,33 +75,34 @@ IOLayerBase::IOLayerBase( QWidget* par, const char* name ) 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; } @@ -120,32 +123,38 @@ void IOLayerBase::setParity( Parity par ) { } 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; @@ -195,32 +204,38 @@ IOLayerBase::Parity IOLayerBase::parity()const { } 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; } 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 @@ -8,33 +8,35 @@ 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; 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 @@ -65,32 +65,38 @@ void IrdaConfigWidget::load( const Profile& prof ) { 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 ) { @@ -123,26 +129,32 @@ void IrdaConfigWidget::save( Profile& prof ) { 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,28 +1,28 @@ #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; }; @@ -78,33 +78,33 @@ FixIt::~FixIt() { 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 @@ -97,61 +97,67 @@ void ModemConfigWidget::load( const Profile& prof ) { 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() ); @@ -184,32 +190,38 @@ void ModemConfigWidget::save( Profile& prof ) { 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; } 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 @@ -69,32 +69,38 @@ void SerialConfigWidget::load( const Profile& prof ) { 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 ); } @@ -144,32 +150,38 @@ void SerialConfigWidget::save( Profile& prof ) { 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; 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,93 +1,99 @@ #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) ), @@ -97,33 +103,33 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, 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: @@ -138,46 +144,49 @@ void TerminalWidget::load( const Profile& prof ) { 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: @@ -198,29 +207,36 @@ void TerminalWidget::save( Profile& profile ) { 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 |