Hide 'Exit fullscreen' button during scrolling (improves performance)
[presencevnc] / src / mainwindow.cpp
index d89af5a..07bcf51 100644 (file)
@@ -17,7 +17,6 @@
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    */
 #include "connectdialog.h"
-#include "fullscreenexitbutton.h"
 #include "keymenu.h"
 #include "mainwindow.h"
 #include "preferences.h"
@@ -40,7 +39,7 @@
 MainWindow::MainWindow(QString url, int quality, int listen_port, bool view_only):
     QMainWindow(0),
     vnc_view(0),
-    scroll_area(new ScrollArea(0)),
+    scroll_area(new ScrollArea(this)),
     input_toolbuttons(new QActionGroup(this)),
     key_menu(0)
 {
@@ -54,7 +53,8 @@ MainWindow::MainWindow(QString url, int quality, int listen_port, bool view_only
 
     //set up toolbar
     toolbar = new QToolBar(0);
-    input_toolbuttons->addAction(toolbar->addAction(QChar(0x2026), this, SLOT(showKeyMenu()))); //"..." button
+    key_menu_button = input_toolbuttons->addAction(toolbar->addAction(QChar(0x2026), this, SLOT(showKeyMenu()))); //"..." button
+    key_menu_button->setCheckable(true); //used to indicate wether a modifier key is still pressed
     input_toolbuttons->addAction(toolbar->addAction(tr("Tab"), this, SLOT(sendTab())));
     input_toolbuttons->addAction(toolbar->addAction(tr("Esc"), this, SLOT(sendEsc())));
     input_toolbuttons->addAction(toolbar->addAction(tr("PgUp"), this, SLOT(sendPgUp())));
@@ -133,8 +133,7 @@ MainWindow::MainWindow(QString url, int quality, int listen_port, bool view_only
 
     setCentralWidget(scroll_area);
 
-    FullScreenExitButton* fullscreen_exit_button = new FullScreenExitButton(this);
-    connect(fullscreen_exit_button, SIGNAL(clicked()),
+    connect(scroll_area, SIGNAL(fullscreenButtonClicked()),
             this, SLOT(toggleFullscreen()));
 
     grabZoomKeys(true);
@@ -206,6 +205,8 @@ void MainWindow::connectToHost(QString url, int quality, int listen_port, bool v
 
     connect(vnc_view, SIGNAL(statusChanged(RemoteView::RemoteStatus)),
             this, SLOT(statusChanged(RemoteView::RemoteStatus)));
+    connect(vnc_view, SIGNAL(errorMessage(QString, QString)),
+        scroll_area, SLOT(showMessage(QString, QString)));
     scroll_area->setWidget(vnc_view);
     vnc_view->start();
     setWindowTitle(QString("Presence VNC - %1").arg(vnc_view->host()) + (view_only?tr(" [View Only]"):""));
@@ -321,6 +322,7 @@ void MainWindow::showKeyMenu()
 {
     key_menu->exec();
     vnc_view->sendKeySequence(key_menu->getKeySequence());
+    key_menu_button->setChecked(key_menu->isAltChecked() or key_menu->isWinChecked());
 }
 
 void MainWindow::showPreferences()