#endif
-MainWindow::MainWindow(QString url, int quality):
+MainWindow::MainWindow(QString url, int quality, bool view_only):
QMainWindow(0),
vnc_view(0),
scroll_area(new ScrollArea(0)),
+ input_toolbuttons(new QActionGroup(this)),
key_menu(new KeyMenu(this))
{
setWindowTitle("Presence VNC");
- setContextMenuPolicy(Qt::NoContextMenu);
#ifdef Q_WS_MAEMO_5
+ setContextMenuPolicy(Qt::NoContextMenu);
setAttribute(Qt::WA_Maemo5StackedWindow);
#endif
//set up toolbar
toolbar = new QToolBar(0);
- toolbar->addAction(QChar(0x2026), this, SLOT(showKeyMenu())); //"..." button
- toolbar->addAction(tr("Tab"), this, SLOT(sendTab()));
- toolbar->addAction(tr("Esc"), this, SLOT(sendEsc()));
- toolbar->addAction(tr("PgUp"), this, SLOT(sendPgUp()));
- toolbar->addAction(tr("PgDn"), this, SLOT(sendPgDn()));
+ input_toolbuttons->addAction(toolbar->addAction(QChar(0x2026), this, SLOT(showKeyMenu()))); //"..." button
+ 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())));
+ input_toolbuttons->addAction(toolbar->addAction(tr("PgDn"), this, SLOT(sendPgDn())));
#ifdef Q_WS_MAEMO_5
- toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/chat_enter.png"), "", this, SLOT(sendReturn()));
- toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/control_keyboard.png"), "", this, SLOT(showInputPanel()));
+ input_toolbuttons->addAction(toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/chat_enter.png"), "", this, SLOT(sendReturn())));
+ input_toolbuttons->addAction(toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/control_keyboard.png"), "", this, SLOT(showInputPanel())));
#endif
QSettings settings;
//set up menu
QAction *connect_action = new QAction(tr("Connect"), this);
disconnect_action = new QAction(tr("Disconnect"), this);
- show_toolbar = new QAction(tr("Show Toolbar"), this);
+ show_toolbar = new QAction(tr("Show toolbar"), this);
show_toolbar->setCheckable(true);
show_toolbar->setChecked(settings.value("show_toolbar", true).toBool());
QAction *pref_action = new QAction(tr("Preferences"), this);
grabZoomKeys(true);
reloadSettings();
- if(url.isNull()) {
+ if(url.isEmpty()) {
disconnect_action->setEnabled(false);
showConnectDialog();
} else {
connect(vnc_view, SIGNAL(statusChanged(RemoteView::RemoteStatus)),
this, SLOT(statusChanged(RemoteView::RemoteStatus)));
scroll_area->setWidget(vnc_view);
+ vnc_view->setViewOnly(view_only);
vnc_view->start();
}
}
QMessageBox::about(this, tr("About Presence VNC"),
tr("<center><h1>Presence VNC 0.8</h1>\
<p>A touchscreen friendly VNC client</p>\
-<p><a href=\"https://garage.maemo.org/projects/presencevnc/\">https://garage.maemo.org/projects/presencevnc</a></p></center>\
+<p><a href=\"http://presencevnc.garage.maemo.org/\">http://presencevnc.garage.maemo.org/</a></p></center>\
<small><p>©2010 Christian Pulvermacher <pulvermacher@gmx.de><br />\
Based on KRDC, © 2007-2008 Urs Wolfer<br />\
and LibVNCServer, © 2001-2003 Johannes E. Schindelin</p>\
void MainWindow::showConnectDialog()
{
ConnectDialog *connect_dialog = new ConnectDialog(this);
- connect(connect_dialog, SIGNAL(connectToHost(QString, int, int)),
- this, SLOT(connectToHost(QString, int, int)));
+ connect(connect_dialog, SIGNAL(connectToHost(QString, int, int, bool)),
+ this, SLOT(connectToHost(QString, int, int, bool)));
connect_dialog->exec();
}
-void MainWindow::connectToHost(QString url, int quality, int listen_port)
+void MainWindow::connectToHost(QString url, int quality, int listen_port, bool view_only)
{
disconnectFromHost();
vnc_view = new VncView(this, url, RemoteView::Quality(quality), listen_port);
+ vnc_view->setViewOnly(view_only);
connect(vnc_view, SIGNAL(statusChanged(RemoteView::RemoteStatus)),
this, SLOT(statusChanged(RemoteView::RemoteStatus)));
#endif
toolbar->setEnabled(true);
+ //disable key input buttons in view only mode
+ input_toolbuttons->setEnabled(!vnc_view->viewOnly());
+
vnc_view->setZoomLevel(zoom_slider->value());
vnc_view->useFastTransformations(false);
vnc_view->repaint();