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/MyPty.cpp14
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp6
-rw-r--r--noncore/apps/opie-console/TEmulation.cpp8
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp13
-rw-r--r--noncore/apps/opie-console/dialer.cpp27
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp14
-rw-r--r--noncore/apps/opie-console/emulation_widget.cpp10
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp9
-rw-r--r--noncore/apps/opie-console/io_bt.cpp7
-rw-r--r--noncore/apps/opie-console/io_irda.cpp8
-rw-r--r--noncore/apps/opie-console/io_modem.cpp8
-rw-r--r--noncore/apps/opie-console/main.cpp2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp39
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp11
-rw-r--r--noncore/apps/opie-console/opie-console.pro4
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp6
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp7
-rw-r--r--noncore/apps/opie-console/terminalwidget.cpp11
-rw-r--r--noncore/apps/opie-console/test/senderui.cpp14
-rw-r--r--noncore/apps/opie-console/widget.cpp6
-rw-r--r--noncore/apps/opie-console/widget_layer.cpp4
21 files changed, 135 insertions, 93 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index a37f980..6d57703 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -42,83 +42,87 @@
[NOTE: much of the technical stuff below will be replaced by forkpty.]
publish the SIGCHLD signal if not related to an instance.
clearify TEPty::done vs. TEPty::~TEPty semantics.
check if pty is restartable via run after done.
\par Pseudo terminals
Pseudo terminals are a unique feature of UNIX, and always come in form of
pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each
other by the operating system. One may think of them as two serial devices
linked by a null-modem cable. Being based on devices the number of
simultanous instances of this class is (globally) limited by the number of
those device pairs, which is 256.
Another technic are UNIX 98 PTY's. These are supported also, and prefered
over the (obsolete) predecessor.
There's a sinister ioctl(2), signal(2) and job control stuff
nessesary to make everything work as it should.
*/
+#include "procctl.h"
+#include "MyPty.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qsocketnotifier.h>
#include <qfile.h>
+/* STD */
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#ifdef HAVE_OPENPTY
#include <pty.h>
#endif
-#include "procctl.h"
-#include "MyPty.h"
-
-
#undef VERBOSE_DEBUG
/* -------------------------------------------------------------------------- */
/*!
Informs the client program about the
actual size of the window.
*/
void MyPty::setSize(int lines, int columns)
{
- qWarning("setting size");
+ owarn << "setting size" << oendl;
struct winsize wsize;
wsize.ws_row = (unsigned short)lines;
wsize.ws_col = (unsigned short)columns;
if(m_fd < 0) return;
ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
}
void MyPty::donePty()
{
// This is code from the Qt DumbTerminal example
::close(m_fd);
if (m_cpid) {
kill(m_cpid, SIGHUP);
//waitpid(m_cpid, &status, 0);
delete m_sn_e;
delete m_sn_r;
m_sn_e = 0l;
m_sn_r = 0l;
}
m_cpid = 0;
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index e535296..d168a5e 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -1008,92 +1008,92 @@ void TEWidget::onClearSelection()
// For auto-hide, we need to get keypress-events, but we only get them when
// we have focus.
void TEWidget::doScroll(int lines)
{
scrollbar->setValue(scrollbar->value()+lines);
}
bool TEWidget::eventFilter( QObject *obj, QEvent *e )
{
if ( (e->type() == QEvent::Accel ||
e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
static_cast<QKeyEvent *>( e )->ignore();
return true;
}
if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
return FALSE; // not us
if ( e->type() == QEvent::Wheel) {
QApplication::sendEvent(scrollbar, e);
}
#ifdef FAKE_CTRL_AND_ALT
static bool control = FALSE;
static bool alt = FALSE;
-// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:");
+// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
bool dele=FALSE;
if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
QKeyEvent* ke = (QKeyEvent*)e;
bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
switch (ke->key()) {
case Key_F9: // let this be "Control"
control = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
dele=TRUE;
break;
case Key_F13: // let this be "Alt"
alt = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
dele=TRUE;
break;
default:
if ( control ) {
int a = toupper(ke->ascii())-64;
if ( a >= 0 && a < ' ' ) {
e = new QKeyEvent(e->type(), ke->key(),
a, ke->state()|ControlButton, QChar(a,0));
dele=TRUE;
}
}
if ( alt ) {
e = new QKeyEvent(e->type(), ke->key(),
ke->ascii(), ke->state()|AltButton, ke->text());
dele=TRUE;
}
}
}
#endif
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent* ke = (QKeyEvent*)e;
actSel=0; // Key stroke implies a screen update, so TEWidget won't
// know where the current selection is.
-// qDebug("key pressed is 0x%x",ke->key());
+// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
-// qDebug("key pressed 2 is 0x%x",ke->key());
+// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl;
emitText("\\"); // expose
} else
emit keyPressedSignal(ke); // expose
ke->accept();
#ifdef FAKE_CTRL_AND_ALT
if ( dele ) delete e;
#endif
return true; // stop the event
}
if ( e->type() == QEvent::Enter ) {
QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
}
if ( e->type() == QEvent::Leave ) {
QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
}
return QFrame::eventFilter( obj, e );
}
/* ------------------------------------------------------------------------- */
/* */
/* Frame */
/* */
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp
index d0169d7..6ff73af 100644
--- a/noncore/apps/opie-console/TEmulation.cpp
+++ b/noncore/apps/opie-console/TEmulation.cpp
@@ -49,48 +49,54 @@
We use a refreshing algorithm here that has been adoped from rxvt/kvt.
By this, refreshing is driven by a timer, which is (re)started whenever
a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'.
As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger
refresh. This rule suits both bulk display operation as done by curses as
well as individual characters typed.
(BULK_TIMEOUT < 1000 / max characters received from keyboard per second).
Additionally, we trigger refreshing by newlines comming in to make visual
snapshots of lists as produced by `cat', `ls' and likely programs, thereby
producing the illusion of a permanent and immediate display operation.
As a sort of catch-all needed for cases where none of the above
conditions catch, the screen refresh is also triggered by a count
of incoming bulks (`bulk_incnt').
*/
/* FIXME
- evtl. the bulk operations could be made more transparent.
*/
#include "TEmulation.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* STD */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/* ------------------------------------------------------------------------- */
/* */
/* TEmulation */
/* */
/* ------------------------------------------------------------------------- */
#define CNTL(c) ((c)-'@')
/*!
*/
TEmulation::TEmulation(TEWidget* gui)
: decoder((QTextDecoder*)NULL)
{
this->gui = gui;
screen[0] = new TEScreen(gui->Lines(),gui->Columns());
screen[1] = new TEScreen(gui->Lines(),gui->Columns());
scr = screen[0];
@@ -183,49 +189,49 @@ void TEmulation::onRcvChar(int c)
{
c &= 0xff;
switch (c)
{
case '\b' : scr->BackSpace(); break;
case '\t' : scr->Tabulate(); break;
case '\n' : scr->NewLine(); break;
case '\r' : scr->Return(); break;
case 0x07 : gui->Bell(); break;
default : scr->ShowCharacter(c); break;
};
}
/* ------------------------------------------------------------------------- */
/* */
/* Keyboard Handling */
/* */
/* ------------------------------------------------------------------------- */
/*!
*/
void TEmulation::onKeyPress( QKeyEvent* ev )
{
- qWarning("onKeyPress,....");
+ owarn << "onKeyPress,...." << oendl;
if (!connected) return; // someone else gets the keys
if (scr->getHistCursor() != scr->getHistLines());
scr->setHistCursor(scr->getHistLines());
if (!ev->text().isEmpty())
{ // A block of text
// Note that the text is proper unicode.
// We should do a conversion here, but since this
// routine will never be used, we simply emit plain ascii.
emit sndBlock(ev->text().ascii(),ev->text().length());
}
else if (ev->ascii()>0)
{ unsigned char c[1];
c[0] = ev->ascii();
emit sndBlock((char*)c,1);
}
}
// Unblocking, Byte to Unicode translation --------------------------------- --
/*
We are doing code conversion from locale to unicode first.
*/
void TEmulation::onRcvBlock(const char *s, int len)
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index 8e91b9e..c998f96 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -1,37 +1,40 @@
+#include "atconfigdialog.h"
+#include "io_modem.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qlineedit.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qtabwidget.h>
#include <qlabel.h>
#include <qscrollview.h>
-#include "atconfigdialog.h"
-#include "io_modem.h"
-
-
ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
setCaption( tr( "Dialing parameter setup" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
QTabWidget *tabWidget = new QTabWidget( this );
tabWidget->addTab( tab0( this ), tr("Settings1") );
tabWidget->addTab( tab1( this ), tr("Settings2") );
layout->addWidget( tabWidget );
}
QWidget* ATConfigDialog::tab0( QWidget* parent) {
QScrollView* sv = new QScrollView( parent );
QWidget *returnWidget = new QWidget( sv->viewport() );
sv->setResizePolicy( QScrollView::AutoOneFit );
// sv->setHScrollBarMode( QScrollView::AlwaysOff );
@@ -131,49 +134,49 @@ QWidget* ATConfigDialog::tab1( QWidget* parent ) {
layout->addWidget( bpsDetectBox, 4, 1 );
bpsDetectBox->insertItem( tr("No") );
bpsDetectBox->insertItem( tr("Yes") );
QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
dcdLinesBox = new QComboBox( returnWidget );
layout->addWidget( dcdLinesLabel, 5, 0 );
layout->addWidget( dcdLinesBox, 5, 1 );
dcdLinesBox->insertItem( tr("No") );
dcdLinesBox->insertItem( tr("Yes") );
QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
multiLineUntagBox = new QComboBox( returnWidget );
layout->addWidget( multiLineUntagLabel, 6, 0 );
layout->addWidget( multiLineUntagBox, 6, 1 );
multiLineUntagBox->insertItem( tr("No") );
multiLineUntagBox->insertItem( tr("Yes") );
return returnWidget;
}
void ATConfigDialog::readConfig( const Profile& config ) {
- qWarning("config in atconfigdialog");
+ owarn << "config in atconfigdialog" << oendl;
initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) );
numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) );
dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) );
bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) );
dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) );
multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) );
// Not implemented yet
resetStringLine->setEnabled(false);
dialSuf1Line->setEnabled(false);
dialPref2Line->setEnabled(false);
dialSuf2Line->setEnabled(false);
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 67ad10e..7010594 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -1,41 +1,46 @@
#include "dialer.h"
+#include "io_modem.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+/* QT */
#include <qlayout.h>
#include <qprogressbar.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qapp.h>
#include <qtimer.h>
#include <qmessagebox.h>
+/* STD */
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
-#include "io_modem.h"
-
// State machine: | When an error occurs, we don't have to
// | reset everything.
// (init) <------+ | But if the user wants to reset,
// | | | we stop dialing immediately.
// v | |
// (options) ----+ | Following the state machine is necessary
// | \ | to get determinable results.
// v ^ |
// (dial) ----+ |
// | ^ |
// v | |
// (online) --+ |
// | |
// v |
// from atconfigdialog
//initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
//resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
//dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
//dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
//dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
//dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
//dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
@@ -83,196 +88,196 @@ Dialer::~Dialer()
{
}
void Dialer::setHangupOnly()
{
state = state_cancel;
usercancel = 1;
send( m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING )+"\r" );
}
void Dialer::slotCancel()
{
if(state != state_online)
{
usercancel = 1;
reset();
}
else {
accept();
}
}
void Dialer::reset()
{
- qWarning("reset");
+ owarn << "reset" << oendl;
switchState(state_cancel);
}
void Dialer::slotAutostart()
{
//state = state_preinit;
dial(m_profile.readEntry("Number"));
}
void Dialer::dial(const QString& number)
{
while(state != state_online)
{
if(!usercancel)
{
state = state_preinit;
trydial(number);
}
else break;
}
if(usercancel)
{
// modem hangup
trydial(QString::null);
reject();
}
}
void Dialer::trydial(const QString& number)
{
- qWarning("TryDial:%s", number.latin1() );
+ owarn << "TryDial:" << number.latin1() << "" << oendl;
if(state != state_cancel) switchState(state_preinit);
if(cleanshutdown)
{
- qWarning("HangupString " + m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING));
+ owarn << "HangupString " << m_profile.readEntry("HangupString") << oendl;
send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r");
}
if(state != state_cancel)
{
switchState(state_init);
-// qWarning("Init String " + m_profile.readEntry("InitString") );
+// owarn << "Init String " + m_profile.readEntry("InitString") << oendl;
send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r");
QString response2 = receive();
if(!response2.contains("\nOK\r"))
reset();
}
/* if(state != state_cancel)
{
switchState(state_options);
- qWarning("ATM3l3");
+ owarn << "ATM3l3" << oendl;
send("ATM3L3\r");
QString response3 = receive();
if(!response3.contains("\nOK\r"))
reset();
}
*/
if(state != state_cancel)
{
switchState(state_dialtone);
send("ATX1\r");
QString response4 = receive();
if(!response4.contains("\nOK\r"))
reset();
}
if(state != state_cancel)
{
- qWarning("progress");
+ owarn << "progress" << oendl;
switchState(state_dialing);
// send(QString("ATDT %1\r").arg(number));
send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ))
.arg(number));
QString response5 = receive();
if(!response5.contains("CONNECT") )
{
if(response5.contains("BUSY"))
switchState(state_dialing);
else
{
QMessageBox::warning(this,
QObject::tr("Failure"),
QObject::tr("Dialing the number failed."));
slotCancel();
}
}
}
if(state != state_cancel)
{
state = state_online;
slotCancel();
}
}
void Dialer::send(const QString& msg)
{
QString m = msg;
int bytes;
QString termination;
- qWarning("Sending: %s", m.latin1());
+ owarn << "Sending: " << m.latin1() << "" << oendl;
/* termination = "\r";
//termination = m_profile.readEntry("Termination");
if(termination == "\n") m = m + "\n";
else if(termination == "\r") m = m + "\r";
else m = m + "\r\n";
*/
m = m.replace(QRegExp("\n"), "\r");
bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit()));
if(bytes < 0)
{
reset();
}
}
QString Dialer::receive()
{
QString buf;
char buffer[1024];
int ret;
int counter = 0;
while(1)
{
ret = ::read(m_fd, buffer, sizeof(buffer));
if(ret > 0)
{
for(int i = 0; i < ret; i++)
buffer[i] = buffer[i] & 0x7F;
buffer[ret] = 0;
- qWarning("Got: %s", buffer);
+ owarn << "Got: " << buffer << "" << oendl;
buf.append(QString(buffer));
if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY")))
{
- //qWarning("Receiving: '%s'", buf.latin1());
+ //owarn << "Receiving: '" << buf.latin1() << "'" << oendl;
cleanshutdown = 1;
return buf;
}else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) {
cleanshutdown = 1;
return QString::null;
}
}
else if(ret < 0)
{
if(errno != EAGAIN) reset();
else if(!(counter++ % 100)) qApp->processEvents();
}
else if(!(counter++ % 100)) qApp->processEvents();
if(usercancel) return QString::null;
}
cleanshutdown = 1;
return QString::null;
}
void Dialer::switchState(int newstate)
{
int oldstate = state;
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 99d069f..89b70c6 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -1,31 +1,33 @@
-
#include "TEmuVt102.h"
-
#include "profile.h"
#include "emulation_handler.h"
#include "script.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
: QObject(0, name )
{
m_teWid = new TEWidget( parent, "TerminalMain");
// use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
// use setWrapAt(80) for normal console with scrollbar
setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80);
m_teWid->setMinimumSize(150, 70 );
m_script = 0;
parent->resize( m_teWid->calcSize(80, 24 ) );
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() {
@@ -107,77 +109,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:
- qWarning("Foreground green");
+ owarn << "Foreground green" << oendl;
co = Qt::green;
break;
case Profile::Orange:
- qWarning("Foreground orange");
+ 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:
- qWarning("Background black");
+ owarn << "Background black" << oendl;
co = Qt::black;
break;
case Profile::Orange:
- qWarning("Background black");
+ 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/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp
index ad8ecba..4688551 100644
--- a/noncore/apps/opie-console/emulation_widget.cpp
+++ b/noncore/apps/opie-console/emulation_widget.cpp
@@ -203,97 +203,97 @@ void EmulationWidget::paintEvent( QPaintEvent* pe )
int cb = m_image[loc(x,y)].b;
int cr = m_image[loc(x,y)].r;
while (x+len <= rlx &&
m_image[loc(x+len,y)].f == cf &&
m_image[loc(x+len,y)].b == cb &&
m_image[loc(x+len,y)].r == cr )
{
disstrU[len] = vt100extended(m_image[loc(x+len,y)].c);
len += 1;
}
QString unistr(disstrU,len);
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() );
- qDebug( QString(" TEST").arg( contentsRect().width() ) );
- qDebug( QString(" TEST").arg( contentsRect().height() ) );
- qDebug("NEUER TESTT!!!!!!!!");
+ odebug << QString(" TEST").arg( contentsRect().width() ) << oendl;
+ odebug << QString(" TEST").arg( contentsRect().height() ) << oendl;
+ odebug << "NEUER TESTT!!!!!!!!" << oendl;
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() );
m_scrollbar->show();
break;
case SCRIGHT:
m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width;
m_blX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2;
m_brX = m_blX;
m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) );
m_scrollbar->show();
break;
}
m_lines = ( contentsRect().height() - 2 * rimY ) / f_height;
m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2;
}
void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear )
{
- qWarning("Color1 %s", color_table[attr.b].color.name().latin1() );
+ owarn << "Color1 " << color_table[attr.b].color.name().latin1() << "" << oendl;
if ( usePixmap && color_table[attr.b].transparent )
{
painter.setBackgroundMode( TransparentMode );
if ( clear )
erase( rect );
}
else
{
if ( blinking )
painter.fillRect( rect, color_table[attr.b].color );
else
{
painter.setBackgroundMode( OpaqueMode );
- qWarning("Color %s", color_table[attr.b].color.name().latin1() );
+ owarn << "Color " << color_table[attr.b].color.name().latin1() << "" << oendl;
painter.setBackgroundColor( color_table[attr.b].color );
}
}
if ( color_table[attr.f].bold )
painter.setPen( QColor( 0x8F, 0x00, 0x00 ) );
else
painter.setPen( color_table[attr.f].color );
painter.drawText( rect.x(), rect.y() + f_ascent, string );
}
///////////////////////
// scrollbar
// ////////////////////
void EmulationWidget::scroll( int value )
{
}
void EmulationWidget::setScroll( int cursor, int slines )
{
}
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index eb32551..6613183 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -1,64 +1,69 @@
#include "function_keyboard.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qlayout.h>
#include <qlistbox.h>
#include <qlabel.h>
#include <qdir.h>
#define DEFAULT_ROWS 2
#define DEFAULT_COLS 12
/* FunctionKeyboard {{{1 */
FunctionKeyboard::FunctionKeyboard(QWidget *parent) :
QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS),
pressedRow(0), pressedCol(0) {
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
/*
* all the saving/loading is now done in a profile. downside is that you cant modify
* the keyboard for all profiles, but must do it on a profile-basis
*
Config conf("opie-console-keys");
conf.setGroup("keys");
for (uint r = 0; r < numRows; r++)
for (uint c = 0; c < numCols; c++) {
QString handle = "r" + QString::number(r) + "c" + QString::number(c);
QStringList value_list = conf.readListEntry( handle, '|');
if (value_list.isEmpty()) continue;
keys.insert(
handle,
FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort())
);
}
- //qWarning("loaded %d keys", keys.count());
+ //owarn << "loaded " << keys.count() << " keys" << oendl;
*/
if (keys.isEmpty()) loadDefaults();
}
FunctionKeyboard::~FunctionKeyboard() {}
void FunctionKeyboard::changeRows(int r) {
numRows = r;
// have to do this so the whole thing gets redrawn
hide(); show();
}
void FunctionKeyboard::changeCols(int c) {
numCols = c;
keyWidth = (double)width()/numCols; // have to reset this thing too
repaint(false);
}
void FunctionKeyboard::load (const Profile& prof) {
@@ -235,49 +240,49 @@ void FunctionKeyboard::loadDefaults() {
keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff));
keys.insert( "r1c0", FKey ("F1", 0, 4144, 0));
keys.insert( "r1c1", FKey ("F2", 0, 4145, 0));
keys.insert( "r1c2", FKey ("F3", 0, 4146, 0));
keys.insert( "r1c3", FKey ("F4", 0, 4147, 0));
keys.insert( "r1c4", FKey ("F5", 0, 4148, 0));
keys.insert( "r1c5", FKey ("F6", 0, 4149, 0));
keys.insert( "r1c6", FKey ("F7", 0, 4150, 0));
keys.insert( "r1c7", FKey ("F8", 0, 4151, 0));
keys.insert( "r1c8", FKey ("F9", 0, 4152, 0));
keys.insert( "r1c9", FKey ("F10", 0, 4153, 0));
keys.insert( "r1c10", FKey ("F11", 0, 4154, 0));
keys.insert( "r1c11", FKey ("F12", 0, 4155, 0));
}
/* FunctionKeyboardConfig {{{1 */
FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na )
: ProfileDialogKeyWidget(name, parent, na),
selectedRow(0), selectedCol(0)
{
- qWarning("FunctionKeyboardConfig");
+ owarn << "FunctionKeyboardConfig" << oendl;
kb = new FunctionKeyboard(this);
connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool)));
QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this);
QLabel *l = new QLabel("Rows", dimentions);
m_rowBox = new QSpinBox(1, 15, 1, dimentions);
connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int)));
l = new QLabel("Columns", dimentions);
m_colBox = new QSpinBox(1, 15, 1, dimentions);
connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int)));
QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this);
l = new QLabel("Label", editKey);
m_labels = new QComboBox(true, editKey);
m_labels->setInsertionPolicy(QComboBox::AtCurrent);
m_labels->insertItem("");
QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList();
for (uint i = 0; i < files.count(); i++) {
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index a29fa8e..c102427 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -1,93 +1,96 @@
#include "io_bt.h"
+/* OPIE */
+#include <opie2/odebug.h>
using namespace Opie::Core;
+
IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
m_attach = 0;
}
IOBt::~IOBt() {
if ( m_attach ) {
delete m_attach;
}
}
void IOBt::close() {
IOSerial::close();
// still need error handling
if ( m_attach ) {
delete m_attach;
m_attach = 0;
}
}
bool IOBt::open() {
bool ret = false;
// only set up bt stuff if mac address was set, otherwise use the device set
if ( !m_mac.isEmpty() ) {
// now it should also be checked, if there is a connection to the device with that mac allready
// hciattach here
m_attach = new OProcess();
*m_attach << "hciattach /dev/ttyS2 any 57600";
// then start hcid, then rcfomm handling (m_mac)
connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ),
this, SLOT( slotExited(Opie::Core::OProcess*) ) );
if ( m_attach->start() ) {
ret = IOSerial::open();
} else {
- qWarning("could not attach to device");
+ owarn << "could not attach to device" << oendl;
delete m_attach;
m_attach = 0;
}
} else {
// directly to the normal serial
// TODO: look first if the connection really exists. ( is set up )
ret =IOSerial::open();
}
return ret;
}
void IOBt::reload( const Profile &config ) {
m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
}
QString IOBt::identifier() const {
return "bluetooth";
}
QString IOBt::name() const {
return "BLuetooth IO Layer";
}
void IOBt::slotExited( OProcess* proc ){
close();
delete proc;
}
QBitArray IOBt::supports() const {
return QBitArray( 3 );
}
bool IOBt::isConnected() {
return false;
}
void IOBt::send(const QByteArray &data) {
- qDebug( "Please overload me..." );
+ odebug << "Please overload me..." << oendl;
}
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
index 07c2b62..38542f5 100644
--- a/noncore/apps/opie-console/io_irda.cpp
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -1,78 +1,80 @@
-
#include "io_irda.h"
+/* OPIE */
+#include <opie2/odebug.h>
using namespace Opie::Core;
+
IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) {
m_attach = 0;
}
IOIrda::~IOIrda() {
if ( m_attach ) {
delete m_attach;
}
}
void IOIrda::close() {
IOSerial::close();
// still need error handling
delete m_attach;
}
bool IOIrda::open() {
bool ret;
// irdaattach here
m_attach = new OProcess();
*m_attach << "irattach /dev/ttyS2 -s";
connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ),
this, SLOT( slotExited(Opie::Core::OProcess*) ) );
if ( m_attach->start() ) {
ret= IOSerial::open();
} else {
// emit error!!!
- qWarning("could not attach to device");
+ owarn << "could not attach to device" << oendl;
delete m_attach;
m_attach = 0l;
}
return ret;
}
void IOIrda::reload( const Profile &config ) {
m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW);
}
QString IOIrda::identifier() const {
return "irda";
}
QString IOIrda::name() const {
return "Irda IO Layer";
}
void IOIrda::slotExited(OProcess* proc ){
close();
delete proc;
}
QBitArray IOIrda::supports()const {
return QBitArray( 3 );
}
bool IOIrda::isConnected() {
return false;
}
void IOIrda::send(const QByteArray &data) {
- qDebug( "Please overload me..." );
+ odebug << "Please overload me..." << oendl;
}
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index b74d076..c499dfe 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -1,39 +1,39 @@
#include "io_modem.h"
-
#include "dialer.h"
+/* OPIE */
+#include <opie2/odebug.h>
using namespace Opie::Core;
-using namespace Opie::Core;
+
IOModem::IOModem( const Profile &profile )
: IOSerial( profile ) {
m_profile = profile;
}
IOModem::~IOModem() {
-
}
void IOModem::close() {
// Hangup, discarding result
// int fd = rawIO();
internDetach();
Dialer d(m_profile, m_fd);
d.setHangupOnly();
//d.exec();
internAttach();
// closeRawIO(fd);
IOSerial::close();
}
bool IOModem::open() {
bool ret = IOSerial::open();
if(!ret) return false;
// int fd = rawIO();
internDetach();
Dialer d(m_profile, m_fd);
@@ -83,26 +83,26 @@ void IOModem::reload( const Profile &config ) {
QString IOModem::identifier() const {
return "modem";
}
QString IOModem::name() const {
return "Modem IO Layer";
}
void IOModem::slotExited(OProcess* proc ){
close();
/* delete it afterwards */
delete proc;
}
QBitArray IOModem::supports()const {
return QBitArray( 3 );
}
bool IOModem::isConnected() {
return false;
}
void IOModem::send(const QByteArray &data) {
- qDebug( "Please overload me..." );
+ odebug << "Please overload me..." << oendl;
}
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp
index dfb2f83..1bd4338 100644
--- a/noncore/apps/opie-console/main.cpp
+++ b/noncore/apps/opie-console/main.cpp
@@ -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
- qWarning("fscked");
+ 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/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 06a8f7d..b403b4d 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,51 +1,54 @@
-#include <assert.h>
-
-#include <qaction.h>
-#include <qmenubar.h>
-#include <qtoolbar.h>
-#include <qmessagebox.h>
-#include <qwhatsthis.h>
-#include <qfileinfo.h>
-
-#include <qpe/filemanager.h>
-
-#include <opie2/ofiledialog.h>
-
#include "TEmulation.h"
#include "profileeditordialog.h"
#include "configdialog.h"
#include "default.h"
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.h"
#include "transferdialog.h"
#include "function_keyboard.h"
#include "emulation_handler.h"
#include "script.h"
-
+/* OPIE */
+#include <opie2/odebug.h>
+#include <opie2/ofiledialog.h>
+#include <qpe/filemanager.h>
+using namespace Opie::Core;
using namespace Opie::Ui;
+
+/* QT */
+#include <qaction.h>
+#include <qmenubar.h>
+#include <qtoolbar.h>
+#include <qmessagebox.h>
+#include <qwhatsthis.h>
+#include <qfileinfo.h>
+
+/* STD */
+#include <assert.h>
+
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
KeyTrans::loadAll();
for (int i = 0; i < KeyTrans::count(); i++ ) {
KeyTrans* s = KeyTrans::find(i );
assert( s );
}
m_factory = new MetaFactory();
Default def(m_factory);
m_sessions.setAutoDelete( TRUE );
m_curSession = 0;
m_manager = new ProfileManager( m_factory );
m_manager->load();
m_scriptsData.setAutoDelete(TRUE);
initUI();
populateProfiles();
populateScripts();
}
void MainWindow::initUI() {
setToolBarsMovable( FALSE );
/* tool bar for the menu */
@@ -425,55 +428,55 @@ void MainWindow::slotQuickLaunch() {
void MainWindow::slotConfigure() {
ConfigDialog conf( manager()->all(), factory() );
int ret = QPEApplication::execDialog( &conf );
if ( QDialog::Accepted == ret ) {
manager()->setProfiles( conf.list() );
manager()->save();
populateProfiles();
}
}
/*
* we will remove
* this window from the tabwidget
* remove it from the list
* delete it
* and set the currentSession()
*/
void MainWindow::slotClose() {
if (!currentSession() )
return;
Session* ses = currentSession();
- qWarning("removing! currentSession %s", currentSession()->name().latin1() );
+ owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl;
/* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
m_curSession = NULL;
tabWidget()->remove( /*currentSession()*/ses );
/*it's autodelete */
m_sessions.remove( ses );
- qWarning("after remove!!");
+ owarn << "after remove!!" << oendl;
if (!currentSession() ) {
m_connect->setEnabled( false );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( false );
m_transfer->setEnabled( false );
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
m_scripts->setItemEnabled(m_runScript_id, false);
m_fullscreen->setEnabled( false );
m_wrap->setEnabled( false );
m_closewindow->setEnabled( false );
}
m_kb->loadDefaults();
}
/*
* We will get the name
* Then the profile
* and then we will make a profile
*/
void MainWindow::slotProfile( int id) {
Profile prof = manager()->profile( m_sessionsPop->text( id) );
@@ -549,58 +552,58 @@ void MainWindow::slotTransfer()
}
}
void MainWindow::slotOpenKeb(bool state) {
if (state) m_keyBar->show();
else m_keyBar->hide();
}
void MainWindow::slotOpenButtons( bool state ) {
if ( state ) {
m_buttonBar->show();
} else {
m_buttonBar->hide();
}
}
void MainWindow::slotSessionChanged( Session* ses ) {
- qWarning("changed!");
+ owarn << "changed!" << oendl;
if(m_curSession)
if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
if(ses)
if(ses->transferDialog()) ses->transferDialog()->show();
if ( ses ) {
m_curSession = ses;
- qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
+ odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl;
if ( m_curSession->layer()->isConnected() ) {
m_connect->setEnabled( false );
m_disconnect->setEnabled( true );
m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
m_scripts->setItemEnabled(m_runScript_id, true);
} else {
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
m_scripts->setItemEnabled(m_runScript_id, false);
}
if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
m_transfer->setEnabled( false );
} else {
m_transfer->setEnabled( true );
}
QWidget *w = m_curSession->widget();
if(w) w->setFocus();
if(currentSession()->profile().readNumEntry("Wrap", 80)){
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 3466e3a..9fdaf73 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,36 +1,39 @@
+#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>
-#include "modemconfigwidget.h"
-#include "dialdialog.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 );
@@ -114,49 +117,49 @@ void ModemConfigWidget::load( const Profile& prof ) {
}
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() ) {
- qWarning("device empty!");
+ 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;
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 7a15828..f7e33e9 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -1,28 +1,26 @@
TEMPLATE = app
-TMAKE_CXXFLAGS += -DHAVE_OPENPTY
CONFIG += qt warn_on
-#CONFIG = qt
DESTDIR = $(OPIEDIR)/bin
HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \
file_layer.h filetransfer.h \
metafactory.h \
session.h \
mainwindow.h \
profile.h \
profileconfig.h \
profilemanager.h \
tabwidget.h \
configdialog.h \
keytrans.h \
transferdialog.h \
profiledialogwidget.h \
profileeditordialog.h \
default.h \
iolayerbase.h \
serialconfigwidget.h irdaconfigwidget.h \
btconfigwidget.h modemconfigwidget.h \
atconfigdialog.h dialdialog.h \
procctl.h \
function_keyboard.h \
receive_layer.h filereceive.h \
script.h \
@@ -49,28 +47,28 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
profiledialogwidget.cpp \
profileeditordialog.cpp \
iolayerbase.cpp \
serialconfigwidget.cpp irdaconfigwidget.cpp \
btconfigwidget.cpp modemconfigwidget.cpp \
atconfigdialog.cpp dialdialog.cpp \
default.cpp procctl.cpp \
function_keyboard.cpp \
receive_layer.cpp filereceive.cpp \
script.cpp \
dialer.cpp \
terminalwidget.cpp \
emulation_handler.cpp TEHistory.cpp \
TEScreen.cpp TEWidget.cpp \
TEmuVt102.cpp TEmulation.cpp MyPty.cpp \
consoleconfigwidget.cpp
INTERFACES = configurebase.ui editbase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopiecore2 -lopieui2 -lutil
TARGET = opie-console
-
+DEFINES += HAVE_OPENPTY
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp
index fbc5306..f505998 100644
--- a/noncore/apps/opie-console/sz_transfer.cpp
+++ b/noncore/apps/opie-console/sz_transfer.cpp
@@ -20,67 +20,67 @@ void SzTransfer::sendFile(const QFile& file) {
sendFile(file.name());
}
void SzTransfer::sendFile(const QString& file) {
//setcbreak(2); /* raw no echo */
proc = new OProcess;
*proc << "sz";
*proc << "-v" << "-v" << "-b" << file;
connect(proc, SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT(sent()));
connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
this, SLOT(SzReceivedStdout(Opie::Core::OProcess*,char*,int)));
connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
this, SLOT(SzReceivedStderr(Opie::Core::OProcess*,char*,int)));
connect(layer(), SIGNAL(received(const QByteArray&)),
this, SLOT(receivedStdin(const QByteArray&)));
proc->start(OProcess::NotifyOnExit, OProcess::All);
}
void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) {
- qWarning("recieved from sz on stdout %d bytes", buflen);
+ owarn << "recieved from sz on stdout " << buflen << " bytes" << oendl;
QByteArray data(buflen);
data.fill(*buffer, buflen);
for (uint i = 0; i < data.count(); i++ ) {
printf("%c", buffer[i] );
}
printf("\n");
// send out through the io layer
layer()->send(data);
}
void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) {
// parse and show data in a progress dialog/widget
printf("stderr:\n");
//for (int i = 0; i < length; i++)
// printf("%c", buffer[i]);
//printf("\n");
}
void SzTransfer::receivedStdin(const QByteArray &data) {
- qWarning("recieved from io_serial %d bytes", data.size());
+ owarn << "recieved from io_serial " << data.size() << " bytes" << oendl;
// recieved data from the io layer goes to sz
proc->writeStdin(data.data(), data.size());
}
void SzTransfer::sent() {
- qWarning("sent file");
+ owarn << "sent file" << oendl;
//setcbreak(0); /* default */
delete proc;
disconnect(layer(), SIGNAL(received(const QByteArray&)),
this, SLOT(receivedStdin(const QByteArray&)));
}
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp
index 6429e3c..41a91ed 100644
--- a/noncore/apps/opie-console/tabwidget.cpp
+++ b/noncore/apps/opie-console/tabwidget.cpp
@@ -1,39 +1,42 @@
-
#include "tabwidget.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
using namespace Opie::Ui;
+
TabWidget::TabWidget( QWidget* parent, const char* name )
: OTabWidget( parent, name ) {
connect(this, SIGNAL( currentChanged(QWidget*) ),
this, SLOT( slotCurChanged(QWidget*) ) );
}
TabWidget::~TabWidget() {
}
void TabWidget::add( Session* ses ) {
- qWarning("session ses " + ses->name() );
+ owarn << "session ses " + ses->name() << oendl;
if ( !ses->widgetStack() ) return;
//reparent( ses->widgetStack(), QPoint() );
addTab( ses->widgetStack(), "console/konsole", ses->name() );
//addTab( ses->widgetStack(), ses->name() );
m_map.insert( ses->widgetStack(), ses );
}
void TabWidget::remove( Session* ses ) {
m_map.remove( ses->widgetStack() );
removePage( ses->widgetStack() );
}
void TabWidget::slotCurChanged( QWidget* wid ) {
QMap<QWidget*, Session*>::Iterator it;
it = m_map.find( wid );
if ( it == m_map.end() ) {
return;
}
emit activated( it.data() );
}
void TabWidget::setCurrent( Session* ses ) {
if (!ses )
return;
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp
index 6870487..087476b 100644
--- a/noncore/apps/opie-console/terminalwidget.cpp
+++ b/noncore/apps/opie-console/terminalwidget.cpp
@@ -1,34 +1,39 @@
+#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 "terminalwidget.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 )
@@ -48,49 +53,49 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent,
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
- qWarning("Options for terminal box");
+ 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) ) );
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp
index df27055..45fd11d 100644
--- a/noncore/apps/opie-console/test/senderui.cpp
+++ b/noncore/apps/opie-console/test/senderui.cpp
@@ -5,75 +5,75 @@
#include <qmultilineedit.h>
#include <qsocketnotifier.h>
#include "../profile.h"
#include "../io_serial.h"
#include "../filetransfer.h"
#include "../filereceive.h"
#include <opie2/oprocess.h>
#include "senderui.h"
using namespace Opie::Core;
using namespace Opie::Core;
SenderUI::SenderUI()
: Sender() {
/* we do that manually */
Profile prof;
QString str = "/dev/bty0";
prof.writeEntry("Device",str );
prof.writeEntry("Baud", 19200 );
- qWarning("prof " + prof.readEntry("Device") + " " + str);
+ owarn << "prof " + prof.readEntry("Device") + " " + str << oendl;
ser = new IOSerial(prof);
connect(ser, SIGNAL(received(const QByteArray&) ),
this, SLOT(got(const QByteArray&) ) );
if ( ser->open() )
- qWarning("opened!!!");
+ owarn << "opened!!!" << oendl;
else
- qWarning("could not open");
+ owarn << "could not open" << oendl;
}
SenderUI::~SenderUI() {
}
void SenderUI::slotSendFile() {
sz = new FileTransfer(FileTransfer::SY, ser);
sz->sendFile("/home/ich/bootopie-v06-13.jffs2");
connect (sz, SIGNAL(sent()),
this, SLOT(fileTransComplete()));
}
void SenderUI::slotSend() {
QCString str = MultiLineEdit1->text().utf8();
- qWarning("sending: %s", str.data() );
+ owarn << "sending: " << str.data() << "" << oendl;
str = str.replace( QRegExp("\n"), "\r");
ser->send( str );
}
void SenderUI::got(const QByteArray& ar) {
- qWarning("got:");
+ owarn << "got:" << oendl;
for ( uint i = 0; i < ar.count(); i++ ) {
printf("%c", ar[i] );
}
printf("\n");
}
void SenderUI::fileTransComplete() {
- qWarning("file transfer complete");
+ owarn << "file transfer complete" << oendl;
}
void SenderUI::send() {
}
void SenderUI::slotRev(){
-qWarning("Going to receive!");
+owarn << "Going to receive!" << oendl;
FileReceive *rev = new FileReceive( FileReceive::SZ, ser );
rev->receive();
}
diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp
index e17dfd4..c51983f 100644
--- a/noncore/apps/opie-console/widget.cpp
+++ b/noncore/apps/opie-console/widget.cpp
@@ -974,92 +974,92 @@ void Widget::onClearSelection()
// For auto-hide, we need to get keypress-events, but we only get them when
// we have focus.
void Widget::doScroll(int lines)
{
scrollbar->setValue(scrollbar->value()+lines);
}
bool Widget::eventFilter( QObject *obj, QEvent *e )
{
if ( (e->type() == QEvent::Accel ||
e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
static_cast<QKeyEvent *>( e )->ignore();
return true;
}
if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
return FALSE; // not us
if ( e->type() == QEvent::Wheel) {
QApplication::sendEvent(scrollbar, e);
}
#ifdef FAKE_CTRL_AND_ALT
static bool control = FALSE;
static bool alt = FALSE;
-// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:");
+// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
bool dele=FALSE;
if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
QKeyEvent* ke = (QKeyEvent*)e;
bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
switch (ke->key()) {
case Key_F9: // let this be "Control"
control = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
dele=TRUE;
break;
case Key_F13: // let this be "Alt"
alt = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
dele=TRUE;
break;
default:
if ( control ) {
int a = toupper(ke->ascii())-64;
if ( a >= 0 && a < ' ' ) {
e = new QKeyEvent(e->type(), ke->key(),
a, ke->state()|ControlButton, QChar(a,0));
dele=TRUE;
}
}
if ( alt ) {
e = new QKeyEvent(e->type(), ke->key(),
ke->ascii(), ke->state()|AltButton, ke->text());
dele=TRUE;
}
}
}
#endif
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent* ke = (QKeyEvent*)e;
actSel=0; // Key stroke implies a screen update, so Widget won't
// know where the current selection is.
-// qDebug("key pressed is 0x%x",ke->key());
+// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
-// qDebug("key pressed 2 is 0x%x",ke->key());
+// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl;
emitText("\\"); // expose
} else
emit keyPressedSignal(ke); // expose
ke->accept();
#ifdef FAKE_CTRL_AND_ALT
if ( dele ) delete e;
#endif
return true; // stop the event
}
if ( e->type() == QEvent::Enter ) {
QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
}
if ( e->type() == QEvent::Leave ) {
QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
}
return QFrame::eventFilter( obj, e );
}
/* ------------------------------------------------------------------------- */
/* */
/* Frame */
/* */
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp
index 96dda1c..ab25919 100644
--- a/noncore/apps/opie-console/widget_layer.cpp
+++ b/noncore/apps/opie-console/widget_layer.cpp
@@ -54,89 +54,89 @@ QSize WidgetLayer::sizeHint()
return size();
}
/* --------------------------------- audio ---------------------------------- */
void WidgetLayer::bell()
{
QApplication::beep();
}
bool WidgetLayer::eventFilter( QObject *obj, QEvent *e )
{
if ( (e->type() == QEvent::Accel ||
e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
static_cast<QKeyEvent *>( e )->ignore();
return true;
}
if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
return false; // not us
#ifdef FAKE_CTRL_AND_ALT
static bool control = false;
static bool alt = false;
-// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:");
+// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
bool dele = false;
if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
QKeyEvent* ke = (QKeyEvent*)e;
bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
switch (ke->key()) {
case Key_F9: // let this be "Control"
control = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
dele=TRUE;
break;
case Key_F13: // let this be "Alt"
alt = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
dele=TRUE;
break;
default:
if ( control ) {
int a = toupper(ke->ascii())-64;
if ( a >= 0 && a < ' ' ) {
e = new QKeyEvent(e->type(), ke->key(),
a, ke->state()|ControlButton,
QChar(a,0));
dele=TRUE;
}
}
if ( alt ) {
e = new QKeyEvent(e->type(), ke->key(),
ke->ascii(), ke->state()|AltButton, ke->text());
dele=TRUE;
}
}
}
#endif
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent* ke = (QKeyEvent*)e;
//actSel=0; // Key stroke implies a screen update, so Widget won't
// know where the current selection is.
-// qDebug("key pressed is 0x%x",ke->key());
+// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
insertText("\\"); // expose
} else
emit keyPressed( ke ); // expose
ke->accept();
#ifdef FAKE_CTRL_AND_ALT
if ( dele ) delete e;
#endif
return true; // stop the event
}
return QFrame::eventFilter( obj, e );
}
/* --------------------------------- screen --------------------------------- */
void WidgetLayer::propagateSize()
{
QArray<Character> oldimage = m_image.copy();
int oldlines = m_lines;
int oldcolumns = m_columns;