author | mickeyl <mickeyl> | 2003-10-27 19:06:54 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-27 19:06:54 (UTC) |
commit | f0a15a9866f9eddfe10596e63a1e6300b92b9e3f (patch) (side-by-side diff) | |
tree | 8e2829bdd6ba17db418fa5ef19b3e7a06f4003e2 | |
parent | df9d9d818c9667ba8e614e5c09f0e121e9225dfd (diff) | |
download | opie-f0a15a9866f9eddfe10596e63a1e6300b92b9e3f.zip opie-f0a15a9866f9eddfe10596e63a1e6300b92b9e3f.tar.gz opie-f0a15a9866f9eddfe10596e63a1e6300b92b9e3f.tar.bz2 |
merge noncore/comm/*
-rw-r--r-- | noncore/comm/keypebble/keypebble.pro | 8 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbdecoder.cpp | 7 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvnc.cpp | 18 | ||||
-rw-r--r-- | noncore/comm/keypebble/kvnc.h | 7 | ||||
-rw-r--r-- | noncore/comm/keypebble/main.cpp | 11 |
5 files changed, 25 insertions, 26 deletions
diff --git a/noncore/comm/keypebble/keypebble.pro b/noncore/comm/keypebble/keypebble.pro index 7af60f9..b3cb172 100644 --- a/noncore/comm/keypebble/keypebble.pro +++ b/noncore/comm/keypebble/keypebble.pro @@ -1,55 +1,55 @@ -TEMPLATE = app -CONFIG += qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG += qt warn_on release quick-app HEADERS = d3des.h \ krfbbuffer.h \ krfbcanvas.h \ krfbconnection.h \ krfbdecoder.h \ krfblogin.h \ krfbserver.h \ krfbserverinfo.h \ kvnc.h \ kvncconndlg.h \ kvncbookmarkdlg.h \ vncauth.h SOURCES = d3des.c \ vncauth.c \ krfbbuffer.cpp \ krfbcanvas.cpp \ krfbconnection.cpp \ krfbdecoder.cpp \ krfblogin.cpp \ krfbserver.cpp \ kvnc.cpp \ kvncconndlg.cpp \ kvncbookmarkdlg.cpp \ main.cpp INTERFACES = kvncconndlgbase.ui \ kvncbookmarkdlgbase.ui -TARGET = keypebble + INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe +TARGET = keypebble + TRANSLATIONS = ../../../i18n/de/keypebble.ts \ ../../../i18n/nl/keypebble.ts \ ../../../i18n/da/keypebble.ts \ ../../../i18n/xx/keypebble.ts \ ../../../i18n/en/keypebble.ts \ ../../../i18n/es/keypebble.ts \ ../../../i18n/fr/keypebble.ts \ ../../../i18n/hu/keypebble.ts \ ../../../i18n/ja/keypebble.ts \ ../../../i18n/ko/keypebble.ts \ ../../../i18n/no/keypebble.ts \ ../../../i18n/pl/keypebble.ts \ ../../../i18n/pt/keypebble.ts \ ../../../i18n/pt_BR/keypebble.ts \ ../../../i18n/sl/keypebble.ts \ ../../../i18n/zh_CN/keypebble.ts \ ../../../i18n/zh_TW/keypebble.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index 33418ae..dc90d9c 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp @@ -313,49 +313,49 @@ void KRFBDecoder::sendPixelFormat() con->write( &SetPixelFormatId, 1 ); con->write( padding, 3 ); con->write( &(format->bpp), 1 ); con->write( &(format->depth), 1 ); con->write( &(format->bigEndian), 1 ); con->write( &(format->trueColor), 1 ); con->write( &(format->redMax), 2 ); con->write( &(format->greenMax), 2 ); con->write( &(format->blueMax), 2 ); con->write( &(format->redShift), 1 ); con->write( &(format->greenShift), 1 ); con->write( &(format->blueShift), 1 ); con->write( format->padding, 3 ); // Padding } void KRFBDecoder::sendAllowedEncodings() { static CARD8 padding[1]; con->write( &SetEncodingsId, 1 ); con->write( padding, 1 ); - static CARD16 noEncodings = con->options()->encodings(); + CARD16 noEncodings = con->options()->encodings(); noEncodings = Swap16IfLE( noEncodings ); con->write( &noEncodings, 2 ); if ( con->options()->corre ) con->write( &CorreEncoding, 4 ); if ( con->options()->hexTile ) con->write( &HexTileEncoding, 4 ); if ( con->options()->rre ) con->write( &RreEncoding, 4 ); if ( con->options()->copyrect ) con->write( &CopyRectEncoding, 4 ); // We always support this con->write( &RawEncoding, 4 ); } void KRFBDecoder::sendUpdateRequest( bool incremental ) { if ( currentState != Idle ) return; con->write( &UpdateRequestId, 1 ); con->write( &incremental, 1 ); static CARD16 x = 0, y = 0; @@ -538,50 +538,53 @@ void KRFBDecoder::gotRawRectChunk() // TODO: Replace this! int count = lines * w * format->bpp / 8; char *hack = new char[ count ]; con->read( hack, count ); buf->drawRawRectChunk( hack, x, y, w, lines ); delete hack; // /TODO: h = h - lines; y = y + lines; if ( h > 0 ) { handleRawRect(); } else { noRects--; // qWarning( "There are %d rects left", noRects ); if ( noRects ) { currentState = AwaitingRectHeader; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); con->waitForData( RectHeaderLength ); } - else + else { + // we are now ready for the next update - no need to wait for the timer currentState = Idle; + sendUpdateRequest (1); + } } } // // Copy Rectangle Encoding // void KRFBDecoder::handleCopyRect() { currentState = AwaitingCopyRectPos; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotCopyRectPos() ) ); con->waitForData( CopyRectPosLength ); } void KRFBDecoder::gotCopyRectPos() { disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotCopyRectPos() ) ); CARD16 srcX; CARD16 srcY; con->read( &srcX, 2 ); con->read( &srcY, 2 ); diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp index 48a442c..c89dec5 100644 --- a/noncore/comm/keypebble/kvnc.cpp +++ b/noncore/comm/keypebble/kvnc.cpp @@ -6,125 +6,125 @@ #include <qpe/qpemenubar.h> #include <qstatusbar.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qpe/qpetoolbar.h> #include <qtimer.h> #include <qmessagebox.h> #include <qspinbox.h> #include <qlistbox.h> #include <qlineedit.h> #include <qpe/qpeapplication.h> #include <qpe/global.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <assert.h> #include "kvnc.h" #include "krfbcanvas.h" #include "krfbconnection.h" #include "kvncconndlg.h" #include "krfbserver.h" static int u_id = 1; -static int get_unique_id() -{ +static int get_unique_id() +{ return u_id++; } /* XPM */ static char * menu_xpm[] = { "12 12 5 1", " c None", ". c #000000", "+ c #FFFDAD", "@ c #FFFF00", "# c #E5E100", " ", " ", " ......... ", " .+++++++. ", " .+@@@@#. ", " .+@@@#. ", " .+@@#. ", " .+@#. ", " .+#. ", " .+. ", " .. ", " "}; const int StatusTextId = 0; -KVNC::KVNC( const char *name ) : QMainWindow( 0, name ,WStyle_ContextHelp) +KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name ,WStyle_ContextHelp) { setCaption( tr("VNC Viewer") ); fullscreen = false; stack = new QWidgetStack( this ); setCentralWidget( stack ); bookmarkSelector=new KVNCBookmarkDlg(); stack->addWidget(bookmarkSelector,get_unique_id()); - stack->raiseWidget( bookmarkSelector ); + stack->raiseWidget( bookmarkSelector ); canvas = new KRFBCanvas( stack, "canvas" ); stack->addWidget(canvas,get_unique_id()); setCentralWidget( stack ); connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(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 ); 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( "fileopen" ), 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(); @@ -199,95 +199,95 @@ void KVNC::setupActions() } void KVNC::toggleFullScreen() { if ( fullscreen ) { canvas->releaseKeyboard(); canvas->reparent( stack, 0, QPoint(0,0), false ); canvas->setFrameStyle( QFrame::Panel | QFrame::Sunken ); setCentralWidget( stack ); stack->addWidget(canvas,get_unique_id()); stack->raiseWidget(canvas); canvas->show(); stack->show(); fullScreenAction->setText( tr("Full Screen") ); } else { canvas->setFrameStyle( QFrame::NoFrame ); stack->removeWidget(canvas); canvas->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, QPoint(0,0),false); canvas->resize(qApp->desktop()->width(), qApp->desktop()->height()); canvas->raise(); canvas->setFocus(); canvas->grabKeyboard(); canvas->show(); - + 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 ); doubleClickAction->setEnabled( false ); rightClickAction->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 ) + if ( fullscreen ) toggleFullScreen(); static QString msg = tr( "Connection closed" ); statusMessage( msg ); ctlAltDelAction->setEnabled(false); disconnectAction->setEnabled( false ); fullScreenAction->setEnabled( false ); doubleClickAction->setEnabled( false ); rightClickAction->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) { diff --git a/noncore/comm/keypebble/kvnc.h b/noncore/comm/keypebble/kvnc.h index 51c7151..7b7cc91 100644 --- a/noncore/comm/keypebble/kvnc.h +++ b/noncore/comm/keypebble/kvnc.h @@ -1,60 +1,61 @@ // -*- c++ -*- #ifndef KVNC_H #define KVNC_H #include <qmainwindow.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: + KVNC( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); + ~KVNC(); public slots: void newConnection(); void deleteBookmark(); void openConnection(QListBoxItem *); void openConnection(QString); void openConnection(void); void toggleFullScreen(); void closeConnection(); + static QString appName() { return QString::fromLatin1("keypebble"); } 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; QAction *rightClickAction; diff --git a/noncore/comm/keypebble/main.cpp b/noncore/comm/keypebble/main.cpp index bc7782c..11f67fc 100644 --- a/noncore/comm/keypebble/main.cpp +++ b/noncore/comm/keypebble/main.cpp @@ -1,15 +1,10 @@ -#include <qurl.h> + #include <qpe/qpeapplication.h> #include "kvnc.h" +#include <opie/oapplicationfactory.h> -int main( int argc, char **argv ) -{ - QPEApplication app( argc, argv ); - KVNC *view = new KVNC( "Keypebble" ); - app.showMainWidget( view ); - return app.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<KVNC> ) |