Diffstat (limited to 'noncore/comm/keypebble/krfbconnection.cpp') (more/less context) (show 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,14 +1,21 @@ | |||
1 | #include <assert.h> | ||
2 | #include <qsocket.h> | ||
3 | #include <qtimer.h> | ||
4 | #include <string.h> | ||
5 | |||
6 | #include "krfbconnection.h" | 1 | #include "krfbconnection.h" |
7 | #include "krfblogin.h" | 2 | #include "krfblogin.h" |
8 | #include "krfbdecoder.h" | 3 | #include "krfbdecoder.h" |
9 | #include "krfbbuffer.h" | 4 | #include "krfbbuffer.h" |
10 | 5 | ||
6 | /* OPIE */ | ||
7 | #include <opie2/odebug.h> | ||
8 | using namespace Opie::Core; | ||
9 | |||
10 | /* QT */ | ||
11 | #include <qsocket.h> | ||
12 | #include <qtimer.h> | ||
13 | |||
14 | /* STD */ | ||
15 | #include <assert.h> | ||
16 | #include <string.h> | ||
17 | |||
11 | KRFBConnection::KRFBConnection( QObject *parent ) | 18 | KRFBConnection::KRFBConnection( QObject *parent ) |
12 | : QObject( parent, "KRFBConnection" ) | 19 | : QObject( parent, "KRFBConnection" ) |
13 | { | 20 | { |
14 | portBase_ = 5900; | 21 | portBase_ = 5900; |
@@ -42,17 +49,17 @@ void KRFBConnection::connectTo( KRFBServer server) | |||
42 | // Connect to something to notice connection or error | 49 | // Connect to something to notice connection or error |
43 | connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) ); | 50 | connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) ); |
44 | connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); | 51 | connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); |
45 | 52 | ||
46 | qWarning( "Connecting..." ); | 53 | owarn << "Connecting..." << oendl; |
47 | 54 | ||
48 | currentState_ = Connecting; | 55 | currentState_ = Connecting; |
49 | sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); | 56 | sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); |
50 | } | 57 | } |
51 | 58 | ||
52 | void KRFBConnection::disconnect() | 59 | void KRFBConnection::disconnect() |
53 | { | 60 | { |
54 | qWarning( "Disconnecting from server" ); | 61 | owarn << "Disconnecting from server" << oendl; |
55 | 62 | ||
56 | if ( ( currentState_ != Disconnected ) | 63 | if ( ( currentState_ != Disconnected ) |
57 | && ( currentState_ != Disconnecting ) | 64 | && ( currentState_ != Disconnecting ) |
58 | && sock ) { | 65 | && sock ) { |
@@ -81,9 +88,9 @@ void KRFBConnection::disconnectDone() | |||
81 | void KRFBConnection::gotSocketConnection() | 88 | void KRFBConnection::gotSocketConnection() |
82 | { | 89 | { |
83 | currentState_ = LoggingIn; | 90 | currentState_ = LoggingIn; |
84 | 91 | ||
85 | qWarning( "Connected, logging in..." ); | 92 | owarn << "Connected, logging in..." << oendl; |
86 | 93 | ||
87 | static QString statusMsg = tr( "Connected" ); | 94 | static QString statusMsg = tr( "Connected" ); |
88 | emit statusChanged( statusMsg ); | 95 | emit statusChanged( statusMsg ); |
89 | 96 | ||
@@ -92,9 +99,9 @@ void KRFBConnection::gotSocketConnection() | |||
92 | } | 99 | } |
93 | 100 | ||
94 | void KRFBConnection::gotRFBConnection() | 101 | void KRFBConnection::gotRFBConnection() |
95 | { | 102 | { |
96 | qWarning( "Logged into server" ); | 103 | owarn << "Logged into server" << oendl; |
97 | 104 | ||
98 | currentState_ = Connected; | 105 | currentState_ = Connected; |
99 | emit connected(); | 106 | emit connected(); |
100 | 107 | ||
@@ -121,9 +128,9 @@ void KRFBConnection::gotSocketError( int err ) | |||
121 | { | 128 | { |
122 | currentState_ = Error; | 129 | currentState_ = Error; |
123 | 130 | ||
124 | // Do some error handling stuff | 131 | // Do some error handling stuff |
125 | qWarning( "KRFBConnection: Socket error %d", err ); | 132 | owarn << "KRFBConnection: Socket error " << err << "" << oendl; |
126 | 133 | ||
127 | static QString refused = tr( "Connection Refused" ); | 134 | static QString refused = tr( "Connection Refused" ); |
128 | static QString host = tr( "Host not found" ); | 135 | static QString host = tr( "Host not found" ); |
129 | static QString read = tr( "Read Error: QSocket reported an error reading\n" | 136 | static QString read = tr( "Read Error: QSocket reported an error reading\n" |
@@ -171,13 +178,13 @@ void KRFBConnection::waitForData( unsigned int sz ) | |||
171 | assert( sz > 0 ); | 178 | assert( sz > 0 ); |
172 | assert( currentState_ != Error ); | 179 | assert( currentState_ != Error ); |
173 | 180 | ||
174 | if ( sock->size() >= sz ) { | 181 | if ( sock->size() >= sz ) { |
175 | // qWarning( "No need to wait for data" ); | 182 | // owarn << "No need to wait for data" << oendl; |
176 | emit gotEnoughData(); | 183 | emit gotEnoughData(); |
177 | } | 184 | } |
178 | else { | 185 | else { |
179 | // qWarning( "Waiting for %u bytes", sz ); | 186 | // owarn << "Waiting for " << sz << " bytes" << oendl; |
180 | minData_ = sz; | 187 | minData_ = sz; |
181 | connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); | 188 | connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); |
182 | } | 189 | } |
183 | } | 190 | } |