Diffstat (limited to 'noncore/comm/keypebble/krfbconnection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfbconnection.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp index b447046..33e0563 100644 --- a/noncore/comm/keypebble/krfbconnection.cpp +++ b/noncore/comm/keypebble/krfbconnection.cpp @@ -1,18 +1,25 @@ -#include <assert.h> -#include <qsocket.h> -#include <qtimer.h> -#include <string.h> - #include "krfbconnection.h" #include "krfblogin.h" #include "krfbdecoder.h" #include "krfbbuffer.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qsocket.h> +#include <qtimer.h> + +/* STD */ +#include <assert.h> +#include <string.h> + KRFBConnection::KRFBConnection( QObject *parent ) : QObject( parent, "KRFBConnection" ) { portBase_ = 5900; currentState_ = Disconnected; sock = 0; minData_ = 0; options_ = new KRFBServer(); @@ -38,25 +45,25 @@ void KRFBConnection::connectTo( KRFBServer server) sock = new QSocket( this, "rfbSocket" ); CHECK_PTR( sock ); // Connect to something to notice connection or error connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) ); connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); - qWarning( "Connecting..." ); + owarn << "Connecting..." << oendl; currentState_ = Connecting; sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); } void KRFBConnection::disconnect() { - qWarning( "Disconnecting from server" ); + owarn << "Disconnecting from server" << oendl; if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { currentState_ = Disconnecting; connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); sock->close(); @@ -77,28 +84,28 @@ void KRFBConnection::disconnectDone() delete buffer_; emit disconnected(); } void KRFBConnection::gotSocketConnection() { currentState_ = LoggingIn; - qWarning( "Connected, logging in..." ); + owarn << "Connected, logging in..." << oendl; static QString statusMsg = tr( "Connected" ); emit statusChanged( statusMsg ); // Do some login stuff login = new KRFBLogin( this ); } void KRFBConnection::gotRFBConnection() { - qWarning( "Logged into server" ); + owarn << "Logged into server" << oendl; currentState_ = Connected; emit connected(); // Create the decoder and start doing stuff decoder_ = new KRFBDecoder( this ); CHECK_PTR( decoder_ ); @@ -117,17 +124,17 @@ void KRFBConnection::gotRFBConnection() updater->start( options_->updateRate ); } void KRFBConnection::gotSocketError( int err ) { currentState_ = Error; // Do some error handling stuff - qWarning( "KRFBConnection: Socket error %d", err ); + owarn << "KRFBConnection: Socket error " << err << "" << oendl; static QString refused = tr( "Connection Refused" ); static QString host = tr( "Host not found" ); static QString read = tr( "Read Error: QSocket reported an error reading\n" "data, the remote host has probably dropped the\n" "connection." ); static QString confused = tr( "QSocket reported an invalid error code" ); @@ -167,21 +174,21 @@ void KRFBConnection::gotMoreData() void KRFBConnection::waitForData( unsigned int sz ) { assert( minData_ == 0 ); assert( sz > 0 ); assert( currentState_ != Error ); if ( sock->size() >= sz ) { - // qWarning( "No need to wait for data" ); + // owarn << "No need to wait for data" << oendl; emit gotEnoughData(); } else { - // qWarning( "Waiting for %u bytes", sz ); + // owarn << "Waiting for " << sz << " bytes" << oendl; minData_ = sz; connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); } } int KRFBConnection::read( void *buf, int sz ) { return sock->readBlock( (char *) buf, sz ); |