grow update rectangle when rescaling
[presencevnc] / src / mainwindow.h
index f5aaddc..52656e8 100644 (file)
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 
-#include <QtGui>
-
 #include "remoteview.h"
 #include "vncview.h"
 
+#include <QtGui>
+
+//fix tearing during scrolling
+class ScrollArea : public QScrollArea {
+public:
+       ScrollArea(QWidget *parent) : QScrollArea(parent) { }
+protected:
+       virtual void scrollContentsBy(int dx, int dy)
+       {
+               QScrollArea::scrollContentsBy(dx, dy);
+               if(widget())
+                       widget()->update(); //update whole widget
+       }
+};
+
 class MainWindow : public QMainWindow {
        Q_OBJECT
 public:
@@ -31,6 +44,7 @@ public:
 public slots:
        void about();
        void showConnectDialog();
+       void connectToHost(QString url);
        void disconnectFromHost();
        void forceResize();
        void forceResizeDelayed();
@@ -38,6 +52,7 @@ public slots:
        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 sendReturn() { vnc_view->sendKey(Qt::Key_Return); }
        void showInputPanel();
        void showModifierMenu();
        void showPreferences();
@@ -49,9 +64,8 @@ private:
        void grabZoomKeys(bool grab);
        void reloadSettings();
        VncView *vnc_view;
-       QScrollArea *scroll_area;
+       ScrollArea *scroll_area;
        QToolBar *toolbar;      
-       QAction *scaling;
-       QAction *disconnect_action;
+       QAction *scaling, *show_toolbar, *disconnect_action;
 };
 #endif