author | treke <treke> | 2002-09-05 04:42:25 (UTC) |
---|---|---|
committer | treke <treke> | 2002-09-05 04:42:25 (UTC) |
commit | e2186a49cb5cbdf01b56f57818a15a760ff25b2e (patch) (unidiff) | |
tree | f22e7342c7a3adcccb6eed52a314fe8e301cc624 /noncore/comm/keypebble/krfbcanvas.cpp | |
parent | fd3239820e471044bf279a2964702573572859d6 (diff) | |
download | opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.zip opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.tar.gz opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.tar.bz2 |
Added support for client side scaling of the screen. Slow, but sometimes usable.
Diffstat (limited to 'noncore/comm/keypebble/krfbcanvas.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfbcanvas.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index 8b56795..896de7f 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp | |||
@@ -1,49 +1,50 @@ | |||
1 | #include "krfbconnection.h" | 1 | #include "krfbconnection.h" |
2 | #include "krfbcanvas.h" | 2 | #include "krfbcanvas.h" |
3 | #include "krfbserver.h" | 3 | #include "krfbserver.h" |
4 | #include "krfbbuffer.h" | 4 | #include "krfbbuffer.h" |
5 | 5 | ||
6 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qclipboard.h> | 10 | #include <qclipboard.h> |
11 | #include <qaction.h> | 11 | #include <qaction.h> |
12 | #include <qpixmap.h> | 12 | #include <qpixmap.h> |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | #include <qmainwindow.h> | 14 | #include <qmainwindow.h> |
15 | #include <qiconset.h> | 15 | #include <qiconset.h> |
16 | 16 | ||
17 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) | 17 | KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) |
18 | : QScrollView( parent, name ) | 18 | : QScrollView( parent, name ) |
19 | { | 19 | { |
20 | connection_ = new KRFBConnection(); | 20 | connection_ = new KRFBConnection(); |
21 | connect( connection_, SIGNAL( loggedIn() ), | 21 | connect( connection_, SIGNAL( loggedIn() ), |
22 | this, SLOT( loggedIn() ) ); | 22 | this, SLOT( loggedIn() ) ); |
23 | 23 | ||
24 | loggedIn_ = false; | 24 | loggedIn_ = false; |
25 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); | 25 | |
26 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); | ||
26 | 27 | ||
27 | viewport()->setFocusPolicy( QWidget::StrongFocus ); | 28 | viewport()->setFocusPolicy( QWidget::StrongFocus ); |
28 | viewport()->setFocus(); | 29 | viewport()->setFocus(); |
29 | } | 30 | } |
30 | 31 | ||
31 | KRFBCanvas::~KRFBCanvas() | 32 | KRFBCanvas::~KRFBCanvas() |
32 | { | 33 | { |
33 | } | 34 | } |
34 | 35 | ||
35 | 36 | ||
36 | void KRFBCanvas::openConnection(KRFBServer server) | 37 | void KRFBCanvas::openConnection(KRFBServer server) |
37 | { | 38 | { |
38 | 39 | ||
39 | 40 | ||
40 | QCString host = server.hostname.latin1(); | 41 | QCString host = server.hostname.latin1(); |
41 | password=server.password; | 42 | password=server.password; |
42 | connection_->connectTo( server); | 43 | connection_->connectTo( server); |
43 | } | 44 | } |
44 | 45 | ||
45 | 46 | ||
46 | void KRFBCanvas::openURL( const QUrl &url ) | 47 | void KRFBCanvas::openURL( const QUrl &url ) |
47 | { | 48 | { |
48 | if ( loggedIn_ ) { | 49 | if ( loggedIn_ ) { |
49 | qWarning( "openURL invoked when logged in\n" ); | 50 | qWarning( "openURL invoked when logged in\n" ); |
@@ -83,48 +84,50 @@ void KRFBCanvas::loggedIn() | |||
83 | // | 84 | // |
84 | // Get ready for action | 85 | // Get ready for action |
85 | // | 86 | // |
86 | loggedIn_ = true; | 87 | loggedIn_ = true; |
87 | viewport()->setMouseTracking( true ); | 88 | viewport()->setMouseTracking( true ); |
88 | viewport()->setBackgroundMode( NoBackground ); | 89 | viewport()->setBackgroundMode( NoBackground ); |
89 | setBackgroundMode( NoBackground ); | 90 | setBackgroundMode( NoBackground ); |
90 | 91 | ||
91 | // Start using the buffer | 92 | // Start using the buffer |
92 | connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ), | 93 | connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ), |
93 | this, SLOT( resizeContents(int,int) ) ); | 94 | this, SLOT( resizeContents(int,int) ) ); |
94 | connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), | 95 | connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), |
95 | this, SLOT( viewportUpdate(int,int,int,int) ) ); | 96 | this, SLOT( viewportUpdate(int,int,int,int) ) ); |
96 | connect( connection_->buffer(), SIGNAL( bell() ), | 97 | connect( connection_->buffer(), SIGNAL( bell() ), |
97 | this, SLOT( bell() ) ); | 98 | this, SLOT( bell() ) ); |
98 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), | 99 | connect( qApp->clipboard(), SIGNAL( dataChanged() ), |
99 | this, SLOT( clipboardChanged() ) ); | 100 | this, SLOT( clipboardChanged() ) ); |
100 | } | 101 | } |
101 | 102 | ||
102 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) | 103 | void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) |
103 | { | 104 | { |
104 | QRect r = e->rect(); | 105 | QRect r = e->rect(); |
105 | 106 | ||
106 | if ( loggedIn_ ) { | 107 | if ( loggedIn_ ) { |
108 | QPixmap p; | ||
109 | |||
107 | bitBlt( viewport(), r.x(), r.y(), | 110 | bitBlt( viewport(), r.x(), r.y(), |
108 | connection_->buffer()->pixmap(), | 111 | connection_->buffer()->pixmap(), |
109 | r.x() + contentsX(), r.y() + contentsY(), | 112 | r.x() + contentsX(), r.y() + contentsY(), |
110 | r.width(), r.height() ); | 113 | r.width(), r.height() ); |
111 | } | 114 | } |
112 | else { | 115 | else { |
113 | QScrollView::viewportPaintEvent( e ); | 116 | QScrollView::viewportPaintEvent( e ); |
114 | } | 117 | } |
115 | } | 118 | } |
116 | 119 | ||
117 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) | 120 | void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) |
118 | { | 121 | { |
119 | updateContents( x, y, w, h ); | 122 | updateContents( x, y, w, h ); |
120 | } | 123 | } |
121 | 124 | ||
122 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) | 125 | void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) |
123 | { | 126 | { |
124 | if ( loggedIn_ ) | 127 | if ( loggedIn_ ) |
125 | connection_->buffer()->mouseEvent( e ); | 128 | connection_->buffer()->mouseEvent( e ); |
126 | } | 129 | } |
127 | 130 | ||
128 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) | 131 | void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e ) |
129 | { | 132 | { |
130 | if ( loggedIn_ ) | 133 | if ( loggedIn_ ) |