summaryrefslogtreecommitdiff
authortreke <treke>2002-09-05 04:42:25 (UTC)
committer treke <treke>2002-09-05 04:42:25 (UTC)
commite2186a49cb5cbdf01b56f57818a15a760ff25b2e (patch) (side-by-side diff)
treef22e7342c7a3adcccb6eed52a314fe8e301cc624
parentfd3239820e471044bf279a2964702573572859d6 (diff)
downloadopie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.zip
opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.tar.gz
opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.tar.bz2
Added support for client side scaling of the screen. Slow, but sometimes usable.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfbbuffer.cpp11
-rw-r--r--noncore/comm/keypebble/krfbcanvas.cpp5
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp7
-rw-r--r--noncore/comm/keypebble/krfbdecoder.h5
-rw-r--r--noncore/comm/keypebble/krfbserver.cpp2
-rw-r--r--noncore/comm/keypebble/krfbserver.h1
-rw-r--r--noncore/comm/keypebble/kvnc.cpp8
-rw-r--r--noncore/comm/keypebble/kvnc.h3
-rw-r--r--noncore/comm/keypebble/kvncbookmarkdlg.cpp3
-rw-r--r--noncore/comm/keypebble/kvncconndlg.cpp21
-rw-r--r--noncore/comm/keypebble/kvncconndlg.h1
-rw-r--r--noncore/comm/keypebble/kvncconndlgbase.ui180
12 files changed, 172 insertions, 75 deletions
diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp
index 5a52f31..f1cb929 100644
--- a/noncore/comm/keypebble/krfbbuffer.cpp
+++ b/noncore/comm/keypebble/krfbbuffer.cpp
@@ -1,40 +1,42 @@
#include <assert.h>
#include <qpixmap.h>
#include <qbrush.h>
#include <qimage.h>
#include <qpainter.h>
#include <qapplication.h>
#include "krfbdecoder.h"
#include "krfbbuffer.h"
+#include "krfbconnection.h"
+#include "krfbserver.h"
#include "krfbserverinfo.h"
//
// Endian stuff
//
#ifndef KDE_USE_FINAL
const int endianTest = 1;
#endif
#define Swap16IfLE(s) \
(*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
#define Swap32IfLE(l) \
(*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)) : (l))
KRFBBuffer::KRFBBuffer( KRFBDecoder *decoder,
QObject *parent, const char *name )
: QObject( parent, name )
{
assert( decoder );
this->decoder = decoder;
pix = new QPixmap();
}
KRFBBuffer::~KRFBBuffer()
{
delete pix;
}
@@ -57,75 +59,77 @@ void KRFBBuffer::soundBell()
void KRFBBuffer::mouseEvent( QMouseEvent *e )
{
decoder->sendMouseEvent( e );
}
void KRFBBuffer::keyPressEvent( QKeyEvent *e )
{
qWarning( "Buffer got a key" );
decoder->sendKeyPressEvent( e );
}
void KRFBBuffer::keyReleaseEvent( QKeyEvent *e )
{
decoder->sendKeyReleaseEvent( e );
}
void KRFBBuffer::copyRect( int srcX, int srcY,
int destX, int destY, int w, int h )
{
// qWarning( "Got copy rect" );
bitBlt( pix, destX, destY, pix, srcX, srcY, w, h, CopyROP );
emit updated( destX, destY, w, h );
}
void KRFBBuffer::drawRawRectChunk( void *data,
int x, int y, int w, int h )
{
QImage img( w, h, 32 );
+ int scaleFactor=decoder->con->options()->scaleFactor;
int redMax = Swap16IfLE( decoder->format->redMax );
int greenMax = Swap16IfLE( decoder->format->greenMax );
int blueMax = Swap16IfLE( decoder->format->blueMax );
QPainter p( pix );
if ( decoder->format->bpp == 8 ) {
uchar *d = (unsigned char *) data;
uint r,g,b;
+
for ( int j = 0; j < h; j++ ) {
for ( int i = 0; i < w ; i++ ) {
r = d[ j * w + i ];
r = r >> decoder->format->redShift;
r = r & redMax;
g = d[ j * w + i ];
g = g >> decoder->format->greenShift;
g = g & greenMax;
b = d[ j * w + i ];
b = b >> decoder->format->blueShift;
b = b & blueMax;
r = ( r * 255 ) / redMax;
g = ( g * 255 ) / greenMax;
b = ( b * 255 ) / blueMax;
uint *p = ( uint * ) img.scanLine( j ) + i;
*p = qRgb( r,g,b );
}
}
}
else if ( decoder->format->bpp == 32 ) {
ulong *d = (ulong *) data;
ulong r,g,b;
for ( int j = 0; j < h; j++ ) {
for ( int i = 0; i < w ; i++ ) {
ulong pixel = d[ j * w + i ];
pixel = Swap32IfLE( pixel );
@@ -158,37 +162,42 @@ void KRFBBuffer::drawRawRectChunk( void *data,
for ( int j = 0; j < h; j++ ) {
for ( int i = 0; i < w ; i++ ) {
CARD16 pixel = d[ j * w + i ];
pixel = Swap16IfLE( pixel );
r = pixel;
r = r >> decoder->format->redShift;
r = r & redMax;
g = pixel;
g = g >> decoder->format->greenShift;
g = g & greenMax;
b = pixel;
b = b >> decoder->format->blueShift;
b = b & blueMax;
r = ( r * 255 ) / redMax;
g = ( g * 255 ) / greenMax;
b = ( b * 255 ) / blueMax;
ulong *p = ( ulong * ) img.scanLine( j ) + i;
*p = qRgb( r,g,b );
}
}
}
else {
p.setBrush( QBrush( Qt::black ) );
p.drawRect( x, y, w, h );
}
+ if (scaleFactor > 1) {
+ p.drawImage( x/scaleFactor, y/scaleFactor, img.smoothScale(w/scaleFactor,h/scaleFactor) );
+ emit updated( x/scaleFactor, y/scaleFactor, w/scaleFactor, h/scaleFactor );
+ }
+ else {
p.drawImage( x, y, img );
-
emit updated( x, y, w, h );
}
+}
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,57 +1,58 @@
#include "krfbconnection.h"
#include "krfbcanvas.h"
#include "krfbserver.h"
#include "krfbbuffer.h"
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qapplication.h>
#include <qclipboard.h>
#include <qaction.h>
#include <qpixmap.h>
#include <qapplication.h>
#include <qmainwindow.h>
#include <qiconset.h>
KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name )
: QScrollView( parent, name )
{
connection_ = new KRFBConnection();
connect( connection_, SIGNAL( loggedIn() ),
this, SLOT( loggedIn() ) );
loggedIn_ = false;
- QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold);
+
+ //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold);
viewport()->setFocusPolicy( QWidget::StrongFocus );
viewport()->setFocus();
}
KRFBCanvas::~KRFBCanvas()
{
}
void KRFBCanvas::openConnection(KRFBServer server)
{
QCString host = server.hostname.latin1();
password=server.password;
connection_->connectTo( server);
}
void KRFBCanvas::openURL( const QUrl &url )
{
if ( loggedIn_ ) {
qWarning( "openURL invoked when logged in\n" );
return;
}
QCString host = url.host().latin1();
int display = url.port();
// connection_->connectTo( host, display );
}
@@ -75,64 +76,66 @@ void KRFBCanvas::bell()
topLevelWidget()->show();
}
}
void KRFBCanvas::loggedIn()
{
qWarning( "Ok, we're logged in" );
//
// Get ready for action
//
loggedIn_ = true;
viewport()->setMouseTracking( true );
viewport()->setBackgroundMode( NoBackground );
setBackgroundMode( NoBackground );
// Start using the buffer
connect( connection_->buffer(), SIGNAL( sizeChanged( int, int ) ),
this, SLOT( resizeContents(int,int) ) );
connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ),
this, SLOT( viewportUpdate(int,int,int,int) ) );
connect( connection_->buffer(), SIGNAL( bell() ),
this, SLOT( bell() ) );
connect( qApp->clipboard(), SIGNAL( dataChanged() ),
this, SLOT( clipboardChanged() ) );
}
void KRFBCanvas::viewportPaintEvent( QPaintEvent *e )
{
QRect r = e->rect();
if ( loggedIn_ ) {
+ QPixmap p;
+
bitBlt( viewport(), r.x(), r.y(),
connection_->buffer()->pixmap(),
r.x() + contentsX(), r.y() + contentsY(),
r.width(), r.height() );
}
else {
QScrollView::viewportPaintEvent( e );
}
}
void KRFBCanvas::viewportUpdate( int x, int y, int w, int h )
{
updateContents( x, y, w, h );
}
void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e )
{
if ( loggedIn_ )
connection_->buffer()->mouseEvent( e );
}
void KRFBCanvas::contentsMouseReleaseEvent( QMouseEvent *e )
{
if ( loggedIn_ )
connection_->buffer()->mouseEvent( e );
}
void KRFBCanvas::contentsMouseMoveEvent( QMouseEvent *e )
{
if ( loggedIn_ )
connection_->buffer()->mouseEvent( e );
}
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index a964c09..94e3b79 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -166,65 +166,65 @@ void KRFBDecoder::gotServerInit()
con->read( &info->height, 2 );
info->height = Swap16IfLE( info->height );
con->read( &(info->bpp), 1 );
con->read( &(info->depth), 1 );
con->read( &(info->bigEndian), 1 );
con->read( &(info->trueColor), 1 );
con->read( &(info->redMax), 2 );
info->redMax = Swap16IfLE( info->redMax );
con->read( &(info->greenMax), 2 );
info->greenMax = Swap16IfLE( info->greenMax );
con->read( &(info->blueMax), 2 );
info->blueMax = Swap16IfLE( info->blueMax );
con->read( &(info->redShift), 1 );
con->read( &(info->greenShift), 1 );
con->read( &(info->blueShift), 1 );
con->read( info->padding, 3 );
con->read( &(info->nameLength), 4 );
info->nameLength = Swap32IfLE( info->nameLength );
qWarning( "Width = %d, Height = %d", info->width, info->height );
qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d",
info->bpp, info->depth, info->bigEndian, info->trueColor );
qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d",
info->redMax, info->greenMax, info->blueMax );
qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d",
info->redShift, info->greenShift,info-> blueShift );
- buf->resize( info->width, info->height );
+ buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
// Wait for desktop name
qWarning( "Waiting for desktop name" );
static QString statusMsg = tr( "Waiting for desktop name..." );
emit status( statusMsg );
currentState = AwaitingDesktopName;
connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) );
con->waitForData( info->nameLength );
}
void KRFBDecoder::gotDesktopName()
{
assert( info );
assert( currentState == AwaitingDesktopName );
qWarning( "Got desktop name" );
disconnect( con, SIGNAL( gotEnoughData() ),
this, SLOT( gotDesktopName() ) );
char *buf = new char[ info->nameLength + 1 ];
CHECK_PTR( buf );
con->read( buf, info->nameLength );
buf[ info->nameLength ] = '\0';
info->name = buf;
qWarning( "Desktop: %s", info->name.latin1() );
delete buf;
@@ -613,66 +613,67 @@ void KRFBDecoder::handleCoRRERect()
{
qWarning( "CoRRE not implemented" );
}
void KRFBDecoder::handleHexTileRect()
{
qWarning( "HexTile not implemented" );
}
void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
{
// Deal with the buttons
if ( e->type() != QEvent::MouseMove ) {
buttonMask = 0;
if ( e->type() == QEvent::MouseButtonPress ) {
if ( e->button() & LeftButton )
buttonMask |= 0x01;
if ( e->button() & MidButton )
buttonMask |= 0x04;
if ( e->button() & RightButton )
buttonMask |= 0x02;
}
else if ( e->type() == QEvent::MouseButtonRelease ) {
if ( e->button() & LeftButton )
buttonMask &= 0x06;
if ( e->button() & MidButton )
buttonMask |= 0x03;
if ( e->button() & RightButton )
buttonMask |= 0x05;
}
}
- CARD16 x = Swap16IfLE( e->x() );
- CARD16 y = Swap16IfLE( e->y() );
+ // HACK: Scaling
+ CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor );
+ CARD16 y = Swap16IfLE( e->y() * con->options()->scaleFactor );
con->write( &PointerEventId, 1 );
con->write( &buttonMask, 1 );
con->write( &x, 2 );
con->write( &y, 2 );
}
void KRFBDecoder::sendCutEvent( const QString &unicode )
{
//
// Warning: There is a bug in the RFB protocol because there is no way to find
// out the codepage in use on the remote machine. This could be fixed by requiring
// the remote server to use utf8 etc. but for now we have to assume they're the
// same. I've reported this problem to the ORL guys, but they apparantly have no
// immediate plans to fix the issue. :-( (rich)
//
CARD8 padding[3];
QCString text = unicode.local8Bit();
CARD32 length = text.length();
length = Swap32IfLE( length );
con->write( &ClientCutTextId, 1 );
con->write( &padding, 3 );
con->write( &length, 4 );
con->write( text.data(), length );
}
void KRFBDecoder::gotServerCut()
{
qWarning( "Got server cut" );
diff --git a/noncore/comm/keypebble/krfbdecoder.h b/noncore/comm/keypebble/krfbdecoder.h
index 4ba0185..db6271d 100644
--- a/noncore/comm/keypebble/krfbdecoder.h
+++ b/noncore/comm/keypebble/krfbdecoder.h
@@ -69,66 +69,67 @@ protected:
void decidePixelFormat();
void sendPixelFormat();
void sendClientInit();
void sendAllowedEncodings();
//
// Rectange processing
//
void handleRawRect();
void handleCopyRect();
void handleRRERect();
void handleCoRRERect();
void handleHexTileRect();
void getRawRectChunk( int lines );
protected slots:
void gotServerInit();
void gotDesktopName();
void gotUpdateHeader();
void gotRectHeader();
void gotRawRectChunk();
void gotCopyRectPos();
void gotServerCut();
void gotServerCutLength();
void gotServerCutText();
void gotBell();
signals:
void error( const QString & );
void status( const QString & );
+protected:
+ /** The connection to the server. */
+ KRFBConnection *con;
private:
State currentState;
// Used to store the state we were in before a cut or bell msg
State oldState;
// The number of rects we're expecting
CARD16 noRects;
//
// Info about the current rect.
//
CARD16 x, y, w, h;
int lines;
CARD32 encoding;
CARD32 serverCutTextLen;
/** Where we draw the data (and the source of our events). */
KRFBBuffer *buf;
- /** The connection to the server. */
- KRFBConnection *con;
/** Info about the RFB server. */
KRFBServerInfo *info;
/** The pixel format we want. */
KRFBPixelFormat *format;
CARD8 buttonMask;
};
#endif // KRFBDECODER_H
diff --git a/noncore/comm/keypebble/krfbserver.cpp b/noncore/comm/keypebble/krfbserver.cpp
index 5775f09..b47534e 100644
--- a/noncore/comm/keypebble/krfbserver.cpp
+++ b/noncore/comm/keypebble/krfbserver.cpp
@@ -1,39 +1,41 @@
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include "krfbserver.h"
KRFBServer::KRFBServer()
{
QString name;
QString hostname;
QString password;
display=0;
+ scaleFactor=1;
+
hexTile=0;
corre=0;
rre=0;
copyrect=1;
colors256=1;
shared=0;
readOnly=0;
deIconify=0;
updateRate=0;
}
KRFBServer::~KRFBServer()
{
}
int KRFBServer::encodings()
{
// Initially one because we always support raw encoding
int count = 1;
count += hexTile ? 1 : 0;
count += corre ? 1 : 0;
count += rre ? 1 : 0;
count += copyrect ? 1 : 0;
return count;
}
diff --git a/noncore/comm/keypebble/krfbserver.h b/noncore/comm/keypebble/krfbserver.h
index f87eecc..e38e2d2 100644
--- a/noncore/comm/keypebble/krfbserver.h
+++ b/noncore/comm/keypebble/krfbserver.h
@@ -1,34 +1,35 @@
// -*- c++ -*-
#ifndef KRFBOPTIONS_H
#define KRFBOPTIONS_H
class Config;
class KRFBServer
{
public:
KRFBServer();
~KRFBServer();
int encodings();
QString name;
QString hostname;
QString password;
int display;
bool hexTile;
bool corre;
bool rre;
bool copyrect;
bool colors256;
bool shared;
bool readOnly;
bool deIconify;
int updateRate;
+ int scaleFactor;
};
#endif // KRFBOPTIONS_H
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index aa46e2f..b173004 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -43,85 +43,89 @@ static char * menu_xpm[] = {
"# c #E5E100",
" ",
" ",
" ......... ",
" .+++++++. ",
" .+@@@@#. ",
" .+@@@#. ",
" .+@@#. ",
" .+@#. ",
" .+#. ",
" .+. ",
" .. ",
" "};
const int StatusTextId = 0;
KVNC::KVNC( const char *name ) : QMainWindow( 0, name )
{
setCaption( tr("VNC Viewer") );
fullscreen = false;
stack = new QWidgetStack( this );
setCentralWidget( stack );
bookmarkSelector=new KVNCBookmarkDlg();
stack->addWidget(bookmarkSelector,get_unique_id());
stack->raiseWidget( bookmarkSelector );
canvas = new KRFBCanvas( stack, "canvas" );
stack->addWidget(canvas,get_unique_id());
setCentralWidget( stack );
+
connect( bookmarkSelector->bookmarkList, SIGNAL(doubleClicked(QListBoxItem *)),
this, SLOT(openConnection(QListBoxItem *)) );
connect( canvas->connection(), SIGNAL(statusChanged(const QString &)),
this, SLOT(statusMessage(const QString &)) );
connect( canvas->connection(), SIGNAL(error(const QString &)),
this, SLOT(error(const QString &)) );
connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) );
connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) );
connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) );
setupActions();
cornerButton = new QPushButton( this );
cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) );
canvas->setCornerWidget( cornerButton );
stack->raiseWidget( bookmarkSelector );
- QPEToolBar *bar = new QPEToolBar( this );
+ bar= new QToolBar( this );
+ setToolBarsMovable( false );
+ setRightJustification(false);
+
QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ),
QString::null, 0, this, 0 );
connect( n, SIGNAL( activated() ),
this, SLOT( newConnection() ) );
n->addTo( bar );
QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "edit" ),
QString::null, 0, this, 0 );
connect( o, SIGNAL( activated() ),
this, SLOT( openConnection() ) );
o->addTo( bar );
QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ),
QString::null, 0, this, 0 );
connect( d, SIGNAL( activated() ),
this, SLOT( deleteBookmark() ) );
d->addTo( bar );
}
KVNC::~KVNC()
{
}
void KVNC::newConnection()
{
curServer=new KRFBServer;
KVNCConnDlg dlg( curServer,this);
dlg.showMaximized();
if ( dlg.exec()) {
@@ -206,67 +210,69 @@ void KVNC::toggleFullScreen()
fullScreenAction->setText( tr("Stop Full Screen") );
}
fullscreen = !fullscreen;
}
void KVNC::closeConnection()
{
if ( fullscreen )
toggleFullScreen();
canvas->closeConnection();
}
void KVNC::showMenu()
{
QPoint pt = mapToGlobal(cornerButton->pos());
QSize s = cornerMenu->sizeHint();
pt.ry() -= s.height();
pt.rx() -= s.width();
cornerMenu->popup( pt );
}
void KVNC::connected()
{
static QString msg = tr( "Connected to remote host" );
statusMessage( msg );
ctlAltDelAction->setEnabled(true);
disconnectAction->setEnabled( true );
fullScreenAction->setEnabled( true );
stack->raiseWidget(canvas);
+ bar->hide();
}
void KVNC::loggedIn()
{
static QString msg = tr( "Logged in to remote host" );
statusMessage( msg );
}
void KVNC::disconnected()
{
if ( fullscreen )
toggleFullScreen();
static QString msg = tr( "Connection closed" );
statusMessage( msg );
ctlAltDelAction->setEnabled(false);
disconnectAction->setEnabled( false );
fullScreenAction->setEnabled( false );
stack->raiseWidget(bookmarkSelector);
+ bar->show();
}
void KVNC::statusMessage( const QString &m )
{
Global::statusMessage( m );
}
void KVNC::error( const QString &msg )
{
statusMessage( msg );
QMessageBox::warning( this, tr("VNC Viewer"), msg );
}
void KVNC::deleteBookmark(void)
{
bookmarkSelector->deleteBookmark(bookmarkSelector->selectedBookmark());
}
diff --git a/noncore/comm/keypebble/kvnc.h b/noncore/comm/keypebble/kvnc.h
index 6e0a385..82a24fc 100644
--- a/noncore/comm/keypebble/kvnc.h
+++ b/noncore/comm/keypebble/kvnc.h
@@ -1,66 +1,67 @@
// -*- c++ -*-
#ifndef KVNC_H
#define KVNC_H
#include <qmainwindow.h>
-#include <qurl.h>
+#include <qtoolbar.h>
#include <qwidgetstack.h>
#include "kvncbookmarkdlg.h"
class QAction;
class KRFBCanvas;
class QPushButton;
class QToolBar;
/**
* Top level window for Keystone.
*
* @author Richard Moore, rich@kde.org
* @version $Id$
*/
class KVNC : public QMainWindow
{
Q_OBJECT
public:
KVNC( const char *name = 0 );
~KVNC();
public slots:
void newConnection();
void deleteBookmark();
void openConnection(QListBoxItem *);
void openConnection(QString);
void openConnection(void);
void toggleFullScreen();
void closeConnection();
protected:
void setupActions();
protected slots:
void showMenu();
void connected();
void loggedIn();
void disconnected();
void statusMessage( const QString & );
void error( const QString & );
private:
bool fullscreen;
KRFBCanvas *canvas;
QPopupMenu *cornerMenu;
QPushButton *cornerButton;
QAction *fullScreenAction;
QAction *optionsAction;
QAction *disconnectAction;
QAction *ctlAltDelAction;;
QAction *connectAction;
+ QToolBar * bar;
KVNCBookmarkDlg * bookmarkSelector;
QWidgetStack * stack;
KRFBServer * curServer;
};
#endif // KVNC_H
diff --git a/noncore/comm/keypebble/kvncbookmarkdlg.cpp b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
index 1f97d13..1e2f3c3 100644
--- a/noncore/comm/keypebble/kvncbookmarkdlg.cpp
+++ b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
@@ -132,89 +132,92 @@ void KVNCBookmarkDlg::readBookmarks(void)
}
server = new KRFBServer();
if (!server)
return;
server->name=val;
}
else if (key=="hostname")
server->hostname=val;
else if (key=="password")
server->password=decipher(val);
else if (key=="display")
server->display=val.toInt();
else if (key=="hextile")
server->hexTile=val.toInt();
else if (key=="corre")
server->corre=val.toInt();
else if (key=="rre")
server->rre=val.toInt();
else if (key=="copyrect")
server->copyrect=val.toInt();
else if (key=="colors256")
server->colors256=val.toInt();
else if (key=="shared")
server->shared=val.toInt();
else if (key=="readonly")
server->readOnly=val.toInt();
else if (key=="deiconify")
server->deIconify=val.toInt();
else if (key=="updaterate")
server->updateRate=val.toInt();
+ else if (key=="scalefactor")
+ server->scaleFactor=val.toInt();
}
if (server){
servers.append(server);
server=0;
}
f.close();
}
}
void KVNCBookmarkDlg::writeBookmarks(void)
{
QString filename=Global::applicationFileName("keypebble","bookmarks");
QFile f(filename);
QString key, val;
KRFBServer * server=0;
if ( f.open(IO_ReadWrite) ) {
QTextStream t( &f );
QString s;
int n = 1;
KRFBServer *server;
for ( server=servers.first(); server != 0; server=servers.next() ) {
qDebug(server->name);
t << "server=" << server->name << '\n';
t << "\thostname=" << server->hostname << '\n';
t << "\tpassword=" << encipher(server->password )<< '\n';
t << "\tdisplay=" << server->display << '\n';
t << "\thextile=" << server->hexTile << '\n';
t << "\tcorre=" << server->corre << '\n';
t << "\trre=" << server->rre << '\n';
t << "\tcopyrect=" << server->copyrect << '\n';
t << "\tshared=" << server->shared << '\n';
t << "\treadonly=" << server->readOnly << '\n';
t << "\tdeiconify=" << server->deIconify << '\n';
t << "\tupdaterate=" << server->updateRate << '\n';
+ t << "\tscalefactor=" << server->scaleFactor << '\n';
}
f.close();
}
}
void KVNCBookmarkDlg::refresh(void)
{
bookmarkList->clear();
KRFBServer * server=0;
for ( server=servers.first(); server != 0; server=servers.next() ) {
bookmarkList->insertItem(server->name);
}
}
QString KVNCBookmarkDlg::selectedBookmark()
{
return bookmarkList->currentText();
}
diff --git a/noncore/comm/keypebble/kvncconndlg.cpp b/noncore/comm/keypebble/kvncconndlg.cpp
index 6873feb..2f073f8 100644
--- a/noncore/comm/keypebble/kvncconndlg.cpp
+++ b/noncore/comm/keypebble/kvncconndlg.cpp
@@ -1,75 +1,94 @@
#include <qframe.h>
#include <qvbox.h>
#include <qcheckbox.h>
+#include <qcombobox.h>
#include <qspinbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qwhatsthis.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include "krfbserver.h"
#include "kvncconndlg.h"
KVNCConnDlg::KVNCConnDlg( KRFBServer *options,
QWidget *parent, char *name, bool modal )
: KVNCConnDlgBase( parent, name, modal )
{
this->options=options;
tmpOptions=*options;
serverHostname->setText(options->hostname);
serverDisplay->setValue(options->display);
serverPassword->setText(options->password);
serverBookmark->setText(options->name);
hex->setChecked( options->hexTile );
corre->setChecked( options->corre );
rre->setChecked( options->rre );
copyRect->setChecked( options->copyrect );
+ for (int i=0; i < scaleFactor->count(); ++i) {
+ if (scaleFactor->text(i).toInt()==tmpOptions.scaleFactor) {
+ scaleFactor->setCurrentItem(i);
+ }
+ }
+
// TODO
hex->setEnabled( false );
corre->setEnabled( false );
rre->setEnabled( false );
// /TODO
deIconify->setChecked( options->deIconify );
bit->setChecked( options->colors256 );
shared->setChecked( options->shared );
timeBox->setValue( options->updateRate );
+ serverPassword->setEchoMode(QLineEdit::Password);
+
+ connect(togglePassword, SIGNAL( stateChanged(int) ), this, SLOT( showPassword(int) ) );
-}
+}
KVNCConnDlg::~KVNCConnDlg()
{
}
void KVNCConnDlg::accept()
{
save();
QDialog::accept();
}
void KVNCConnDlg::save()
{
tmpOptions.hexTile = hex->isChecked();
tmpOptions.corre = corre->isChecked();
tmpOptions.rre = rre->isChecked();
tmpOptions.copyrect = copyRect->isChecked();
tmpOptions.deIconify = deIconify->isChecked();
tmpOptions.colors256 = bit->isChecked();
tmpOptions.shared = shared->isChecked();
tmpOptions.hostname = serverHostname->text();
tmpOptions.password = serverPassword->text();
tmpOptions.display = serverDisplay->value();
tmpOptions.name = serverBookmark->text();
+ tmpOptions.scaleFactor = scaleFactor->currentText().toInt();
if (!serverBookmark->text().isEmpty()) {
if ( options) {
*options=tmpOptions;
}
}
}
+
+void KVNCConnDlg::showPassword(int show)
+{
+ if (show)
+ serverPassword->setEchoMode(QLineEdit::Normal);
+ else
+ serverPassword->setEchoMode(QLineEdit::Password);
+}
diff --git a/noncore/comm/keypebble/kvncconndlg.h b/noncore/comm/keypebble/kvncconndlg.h
index fae7d62..5e84750 100644
--- a/noncore/comm/keypebble/kvncconndlg.h
+++ b/noncore/comm/keypebble/kvncconndlg.h
@@ -1,33 +1,34 @@
// -*- c++ -*-
#ifndef KVNCCONNECTION_H
#define KVNCCONNECTION_H
#include "kvncconndlgbase.h"
#include "krfbserver.h"
class KVNCConnDlg : public KVNCConnDlgBase
{
Q_OBJECT
public:
KVNCConnDlg( KRFBServer *options,
QWidget *parent = 0, char *name = 0, bool modal = true );
~KVNCConnDlg();
protected:
void accept();
private slots:
void save();
+ void showPassword(int);
private:
KRFBServer tmpOptions;
KRFBServer * options;
};
#endif // KVNCCONNECTION_H
diff --git a/noncore/comm/keypebble/kvncconndlgbase.ui b/noncore/comm/keypebble/kvncconndlgbase.ui
index df0d375..42765c1 100644
--- a/noncore/comm/keypebble/kvncconndlgbase.ui
+++ b/noncore/comm/keypebble/kvncconndlgbase.ui
@@ -1,216 +1,214 @@
<!DOCTYPE UI><UI>
<class>KVNCConnDlgBase</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>KVNCConnDlgBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>984</width>
- <height>676</height>
+ <width>260</width>
+ <height>242</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>VNC Viewer Connection</string>
</property>
<property>
<name>layoutMargin</name>
</property>
- <vbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
<widget>
<class>QTabWidget</class>
<property stdset="1">
<name>name</name>
<cstring>TabWidget3</cstring>
</property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>266</width>
+ <height>233</height>
+ </rect>
+ </property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Server</string>
</attribute>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget row="0" column="0" >
- <class>QLabel</class>
+ <widget row="2" column="1" rowspan="1" colspan="2" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>hostname</cstring>
+ <cstring>serverPassword</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Host Name:</string>
+ <name>autoMask</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>echoMode</name>
+ <enum>Password</enum>
</property>
</widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
+ <widget row="3" column="1" >
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel2_2</cstring>
+ <cstring>togglePassword</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Display Number:</string>
+ <string>Show Password</string>
</property>
</widget>
- <widget row="2" column="1" rowspan="1" colspan="2" >
- <class>QLineEdit</class>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>serverPassword</cstring>
+ <cstring>TextLabel3</cstring>
</property>
<property stdset="1">
- <name>autoMask</name>
- <bool>true</bool>
+ <name>text</name>
+ <string>Password:</string>
</property>
</widget>
- <widget row="1" column="1" rowspan="1" colspan="2" >
- <class>QSpinBox</class>
+ <widget row="4" column="1" rowspan="1" colspan="2" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>serverDisplay</cstring>
- </property>
- <property stdset="1">
- <name>maxValue</name>
- <number>500</number>
+ <cstring>serverBookmark</cstring>
</property>
+ </widget>
+ <widget row="4" column="0" >
+ <class>QLabel</class>
<property stdset="1">
- <name>minValue</name>
- <number>0</number>
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
- <name>value</name>
- <number>0</number>
+ <name>text</name>
+ <string>Bookmark Name:</string>
</property>
</widget>
<widget row="0" column="1" rowspan="1" colspan="2" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>serverHostname</cstring>
</property>
</widget>
- <widget row="2" column="0" >
+ <widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel3</cstring>
+ <cstring>hostname</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Password:</string>
+ <string>Host Name:</string>
</property>
</widget>
- <widget row="3" column="1" rowspan="1" colspan="2" >
- <class>QLineEdit</class>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>serverBookmark</cstring>
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Display Number:</string>
</property>
</widget>
- <widget row="3" column="0" >
- <class>QLabel</class>
+ <widget row="1" column="1" rowspan="1" colspan="2" >
+ <class>QSpinBox</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1_2</cstring>
+ <cstring>serverDisplay</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Bookmark Name:</string>
+ <name>maxValue</name>
+ <number>500</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>0</number>
</property>
</widget>
<spacer row="5" column="2" >
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
- <widget row="4" column="1" >
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout3</cstring>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- </hbox>
- </widget>
</grid>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Options</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Check for screen updates every:</string>
</property>
</widget>
@@ -261,64 +259,117 @@
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>bit</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Request 8-bit session</string>
</property>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>deIconify</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Raise on bell</string>
</property>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>shared</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Request shared session</string>
</property>
</widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>1</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>2</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>4</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>scaleFactor</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Scale Factor</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Encodings</string>
@@ -383,50 +434,49 @@
<name>name</name>
<cstring>copyRect</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Copy rectangle encoding</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer3</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</widget>
- </vbox>
</widget>
<tabstops>
<tabstop>TabWidget3</tabstop>
<tabstop>serverHostname</tabstop>
<tabstop>serverDisplay</tabstop>
<tabstop>serverPassword</tabstop>
<tabstop>serverBookmark</tabstop>
<tabstop>timeBox</tabstop>
<tabstop>bit</tabstop>
<tabstop>deIconify</tabstop>
<tabstop>shared</tabstop>
<tabstop>hex</tabstop>
<tabstop>corre</tabstop>
<tabstop>rre</tabstop>
<tabstop>copyRect</tabstop>
</tabstops>
</UI>