add Tab, PgUp/Dn, Fullscreen buttons
authorchristian <christian@christian-laptop.(none)>
Tue, 13 Jul 2010 13:32:32 +0000 (15:32 +0200)
committerchristian <christian@christian-laptop.(none)>
Tue, 13 Jul 2010 13:32:32 +0000 (15:32 +0200)
src/mainwindow.cpp
src/mainwindow.h
src/vncview.cpp

index 0ba2749..5e4529f 100644 (file)
@@ -20,8 +20,12 @@ MainWindow::MainWindow(QString url, int quality):
 
        //set up toolbar
        toolbar = new QToolBar(0);
-       toolbar->addAction("Esc", this, SLOT(sendEsc()));
+       toolbar->addAction("Mod"); //TODO
        toolbar->addAction("Tab", this, SLOT(sendTab()));
+       toolbar->addAction("Esc", this, SLOT(sendEsc()));
+       toolbar->addAction("PgUp", this, SLOT(sendPgUp()));
+       toolbar->addAction("PgDn", this, SLOT(sendPgDn()));
+       toolbar->addAction("Fullscreen", this, SLOT(toggleFullscreen()));
        addToolBar(toolbar);
 
        //set up menu
index 6111a72..daa6896 100644 (file)
@@ -29,7 +29,10 @@ private:
        QAction *disconnect_action;
 
 private slots:
-       void sendEsc() { vnc_view->sendKey(Qt::Key_Escape); }
        void sendTab() { vnc_view->sendKey(Qt::Key_Tab); }
+       void sendEsc() { vnc_view->sendKey(Qt::Key_Escape); }
+       void sendPgUp() { vnc_view->sendKey(Qt::Key_PageUp); }
+       void sendPgDn() { vnc_view->sendKey(Qt::Key_PageDown); }
+       void toggleFullscreen() { setWindowState(windowState() ^ Qt::WindowFullScreen); }
 };
 #endif
index fddc7ff..6d63cf0 100644 (file)
@@ -641,8 +641,7 @@ void VncView::clipboardDataChanged()
 //fake key events
 void VncView::sendKey(Qt::Key key)
 {
-       rfbKeySym k = 0;
-       if(key == Qt::Key_Escape)
+       int k = 0; //X11 keysym
        switch(key) {
        case Qt::Key_Escape:
                k = 0xff1b;
@@ -650,6 +649,12 @@ void VncView::sendKey(Qt::Key key)
        case Qt::Key_Tab:
                k = 0xff09;
                break;
+       case Qt::Key_PageUp:
+               k = 0xff55;
+               break;
+       case Qt::Key_PageDown:
+               k = 0xff56;
+               break;
        default:
                kDebug(5011) << "unhandled Qt::Key value " << key;
                return;