summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/btconfigwidget.cpp7
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp32
-rw-r--r--noncore/apps/opie-console/io_modem.cpp1
-rw-r--r--noncore/apps/opie-console/iolayerbase.cpp13
-rw-r--r--noncore/apps/opie-console/iolayerbase.h6
-rw-r--r--noncore/apps/opie-console/irdaconfigwidget.cpp7
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp8
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp4
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp7
9 files changed, 62 insertions, 23 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp
index eac6a79..7673d0b 100644
--- a/noncore/apps/opie-console/btconfigwidget.cpp
+++ b/noncore/apps/opie-console/btconfigwidget.cpp
@@ -60,26 +60,28 @@ void BTConfigWidget::load( const Profile& prof ) {
}
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 {
+ } 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;
@@ -116,24 +118,27 @@ void BTConfigWidget::save( Profile& prof ) {
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;
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index 9138f29..d8e342b 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -12,54 +12,55 @@
#include <qrect.h>
#include <qscrollbar.h>
#define rimX 0 // left/right rim width
#define rimY 0 // top/bottom rim high
#define SCRWIDTH 16 // width of scrollbar
static const ColorEntry color_table[TABLE_COLORS] =
{
ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
- ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
- ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
- ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
- ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
- // intensiv
- ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
- ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
- ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
- ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ),
- ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
+ ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
+ ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
+ ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
+ ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
+ // intensiv
+ ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
+ ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
+ ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
+ ColorEntry(QColor(0x54,0x54,0xFF), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ),
+ ColorEntry(QColor(0x54,0xFF,0xFF), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 0, 0 )
};
EmulationWidget::EmulationWidget( const Profile& config, QWidget *parent, const char* name ) : WidgetLayer( config, parent, name )
{
// initialize font attributes
QFontMetrics fm( font() );
f_height = fm.height();
f_width = fm.maxWidth();
f_ascent = fm.ascent();
+
// initialize scrollbar related vars
m_scrollbar = new QScrollBar( this );
m_scrollbar->setCursor( arrowCursor );
// give reasonable defaults to m_columns, m_lines
calcGeometry();
- // load config
- reloadConfig( config );
+ // load config
+ reloadConfig( config );
m_resizing = false;
}
void EmulationWidget::reloadConfig( const Profile& config )
{
// nothing yet
}
EmulationWidget::~EmulationWidget()
{
@@ -100,24 +101,25 @@ static QChar vt100extended(QChar c)
case 0x03c0 : return 28;
case 0x2260 : return 29;
case 0x00a3 : return 30;
case 0x00b7 : return 31;
}
return c;
}
QSize EmulationWidget::calcSize( int cols, int lins ) const
{
int frw = width() - contentsRect().width();
+
int frh = height() - contentsRect().height();
int scw = (scrollLoc == SCRNONE? 0 : m_scrollbar->width() );
return QSize( f_width * cols + 2 * rimX + frw + scw, f_height * lins + 2 * rimY + frh );
}
void EmulationWidget::setImage( QArray<Character> const newimg, int lines, int columns )
{
const QPixmap* pm = backgroundPixmap();
QPainter paint;
// dont allow updates, while drawing
setUpdatesEnabled( false );
@@ -224,25 +226,29 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false );
x +=len -1;
}
delete [] disstrU;
drawFrame( &painter );
painter.end();
}
void EmulationWidget::calcGeometry()
{
m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() );
- switch( scrollLoc )
+ qDebug( QString(" TEST").arg( contentsRect().width() ) );
+ qDebug( QString(" TEST").arg( contentsRect().height() ) );
+ qDebug("NEUER TESTT!!!!!!!!");
+
+ switch( scrollLoc )
{
case SCRNONE :
m_columns = ( contentsRect().width() -2 * rimX ) / f_width;
m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2;
m_brX = m_blX;
m_scrollbar->hide();
break;
case SCRLEFT :
m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width;
m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2;
m_blX = m_brX + m_scrollbar->width();
m_scrollbar->move( contentsRect().topLeft() );
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index 28d1722..d93dc5a 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -28,24 +28,25 @@ bool IOModem::open() {
Dialer d(m_profile);
qWarning("dialer created");
int result = d.exec();
if(result == QDialog::Accepted)
{
return true;
}
else return false;
}
void IOModem::reload( const Profile &config ) {
+
m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE);
m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD);
m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY);
m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS);
m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS);
m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW);
m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
diff --git a/noncore/apps/opie-console/iolayerbase.cpp b/noncore/apps/opie-console/iolayerbase.cpp
index ec88b49..08acb75 100644
--- a/noncore/apps/opie-console/iolayerbase.cpp
+++ b/noncore/apps/opie-console/iolayerbase.cpp
@@ -1,23 +1,24 @@
#include <qlabel.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qbuttongroup.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,
@@ -33,43 +34,45 @@ namespace {
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_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_parityNone = new QRadioButton(tr("None"), m_groupParity );
m_parityOdd = new QRadioButton(tr("Odd"), m_groupParity );
m_parityEven = new QRadioButton(tr("Even"), m_groupParity );
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 );
// 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() {
@@ -81,24 +84,27 @@ void IOLayerBase::setFlow( Flow flo ) {
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;
switch( sp ) {
case Baud_115200:
@@ -123,28 +129,31 @@ IOLayerBase::Flow IOLayerBase::flow()const {
if (m_flowHw->isChecked() ) {
qWarning("Hardware flow");
return Hardware;
}else if( m_flowSw->isChecked() ) {
qWarning("Software");
return Software;
} else {
qWarning("None");
return None;
}
}
IOLayerBase::Parity IOLayerBase::parity()const {
- if (m_parityOdd->isChecked() )
+ if ( m_parityOdd->isChecked() ) {
return Odd;
- else
+ } 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;
diff --git a/noncore/apps/opie-console/iolayerbase.h b/noncore/apps/opie-console/iolayerbase.h
index d14f334..74de46a 100644
--- a/noncore/apps/opie-console/iolayerbase.h
+++ b/noncore/apps/opie-console/iolayerbase.h
@@ -2,46 +2,48 @@
#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 };
+ enum Parity{ Odd =2 , Even =1, NonePar =0 };
enum Speed{ Baud_115200,
Baud_57600,
Baud_38400,
Baud_19200,
Baud_9600 };
IOLayerBase( QWidget* base, const char* name = 0l);
~IOLayerBase();
void setFlow( Flow flo );
void setParity( Parity par );
void setSpeed( Speed speed );
Flow flow()const;
Parity parity()const;
Speed speed()const;
private:
QVBoxLayout* m_lroot;
QLabel* m_speedLabel;
QComboBox* m_speedBox;
QButtonGroup* m_groupFlow;
QRadioButton *m_flowHw, *m_flowSw, *m_flowNone;
QButtonGroup* m_groupParity;
- QRadioButton *m_parityOdd, *m_parityEven;
+ QRadioButton *m_parityOdd, *m_parityEven, *m_parityNone;
QHBoxLayout* m_hbox;
QHBoxLayout* m_hboxPar;
};
#endif
diff --git a/noncore/apps/opie-console/irdaconfigwidget.cpp b/noncore/apps/opie-console/irdaconfigwidget.cpp
index 2341fd4..72e99a1 100644
--- a/noncore/apps/opie-console/irdaconfigwidget.cpp
+++ b/noncore/apps/opie-console/irdaconfigwidget.cpp
@@ -50,26 +50,28 @@ void IrdaConfigWidget::load( const Profile& prof ) {
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 {
+ } 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;
@@ -106,24 +108,27 @@ void IrdaConfigWidget::save( Profile& prof ) {
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;
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index ac62e45..0f0ce7c 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -74,28 +74,31 @@ void ModemConfigWidget::load( const Profile& prof ) {
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 {
+ } 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;
@@ -136,24 +139,27 @@ void ModemConfigWidget::save( Profile& prof ) {
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;
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 113327c..e8bdb2e 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -69,28 +69,28 @@ Profile::ValueList ProfileManager::all()const {
* raise the dummy
* call session->connect(=
* this way we only need to reparent
* in TabWidget
*/
Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
Session* session = new Session();
session->setName( prof.name() );
/* translate the internal name to the external */
session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
prof) );
- QWidgetStack *stack = new QWidgetStack(parent);
+ QWidgetStack *stack = new QWidgetStack( parent );
session->setWidgetStack( stack );
QWidget* dummy = new QWidget( stack );
- QHBoxLayout* lay = new QHBoxLayout(dummy );
+ QHBoxLayout* lay = new QHBoxLayout( dummy );
stack->addWidget( dummy, 0 );
stack->raiseWidget( 0 );
EmulationHandler* handler = new EmulationHandler(prof,dummy );
lay->addWidget( handler->widget() );
// WidgetLayer* wid = new EmulationWidget( prof, dummy );
// lay->addWidget( wid );
// session->setEmulationWidget( wid );
// session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ),
// wid ) );
session->connect();
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
index 89acc98..d216c92 100644
--- a/noncore/apps/opie-console/serialconfigwidget.cpp
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -52,26 +52,28 @@ void SerialConfigWidget::load( const Profile& prof ) {
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 {
+ } 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;
@@ -107,24 +109,27 @@ void SerialConfigWidget::save( Profile& prof ) {
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;