presencevnc (0.7) unstable; urgency=low
- * ...
+ * Show current magnification when zooming
-- Christian Pulvermacher <pulvermacher@gmx.de> Sat, 23 Oct 2010 18:32:50 +0200
#currently builds a maemo-only package
#comment this line for quick builds
-buildlibs=foo
+#buildlibs=foo
SOURCEDIR=./
BUILDDIR=debian/build/
#include "keymenu.h"
#include "mainwindow.h"
#include "preferences.h"
+#include "scrollarea.h"
#include "vncview.h"
#ifdef Q_WS_MAEMO_5
toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/control_keyboard.png"), "", this, SLOT(showInputPanel()));
#endif
- /*
- //move remaining buttons to the right
- QWidget *spacer = new QWidget();
- spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- toolbar->addWidget(spacer);
- */
-
QSettings settings;
zoom_slider = new QSlider(Qt::Horizontal, 0);
zoom_slider->setRange(0, 100);
vnc_view->forceFullRepaint();
break;
case RemoteView::Disconnecting:
- if(old_status != RemoteView::Disconnected) { //Disconnecting also occurs while connecting, so check last state
-#ifdef Q_WS_MAEMO_5
- if(disconnect_action->isEnabled()) //don't show when manually disconnecting
- QMaemo5InformationBox::information(this, tr("Connection lost"));
-#endif
-
- //clean up
- scroll_area->setWidget(0);
- vnc_view = 0;
- disconnect_action->setEnabled(false);
- toolbar->setEnabled(false);
-
- //exit fullscreen mode
- if(windowState() & Qt::WindowFullScreen)
- setWindowState(windowState() ^ Qt::WindowFullScreen);
- }
+ if(old_status == RemoteView::Disconnected) //Disconnecting also occurs while connecting, so check last state
+ break;
+
+ if(disconnect_action->isEnabled()) //don't show when manually disconnecting
+ scroll_area->showMessage(tr("Connection lost"));
+
+ //clean up
+ scroll_area->setWidget(0);
+ vnc_view = 0;
+ disconnect_action->setEnabled(false);
+ toolbar->setEnabled(false);
+
+ //exit fullscreen mode
+ if(windowState() & Qt::WindowFullScreen)
+ setWindowState(windowState() ^ Qt::WindowFullScreen);
break;
case RemoteView::Disconnected:
#ifdef Q_WS_MAEMO_5
if(!vnc_view)
return;
+ //TODO: use getZoomFactor() instead
int old_width = vnc_view->width();
QPoint center = vnc_view->visibleRegion().boundingRect().center();
vnc_view->visibleRegion().boundingRect().height()/2);
vnc_view->update();
-#ifdef Q_WS_MAEMO_5
- QMaemo5InformationBox::information(this, tr("%1\%").arg(qRound(100*vnc_view->getZoomFactor())));
-#endif
+ scroll_area->showMessage(tr("Zoom: %1\%").arg(qRound(100*vnc_view->getZoomFactor())));
}
}
#include <QtGui>
class KeyMenu;
-
-//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 ScrollArea;
class MainWindow : public QMainWindow {
Q_OBJECT
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 setZoomLevel(int level);
+ void setZoomLevel(int level);
void showInputPanel();
void showKeyMenu();
void showPreferences();
--- /dev/null
+/*
+ Presence VNC
+ Copyright (C) 2010 Christian Pulvermacher
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#ifndef SCROLLAREA_H
+#define SCROLLAREA_H
+
+#include <QScrollArea>
+#include <QLabel>
+#include <QTimer>
+
+//fixes tearing during scrolling and can display messages
+class ScrollArea : public QScrollArea {
+public:
+ ScrollArea(QWidget *parent):
+ QScrollArea(parent)
+ {
+ message.setParent(this);
+ message.setVisible(false);
+ message.setAlignment(Qt::AlignCenter);
+ message.setWordWrap(true);
+
+ QPalette pal = message.palette();
+ QColor backgroundColor = pal.color(backgroundRole());
+ backgroundColor.setAlpha(128);
+ pal.setColor(backgroundRole(), backgroundColor);
+ message.setPalette(pal);
+ message.setAutoFillBackground(true);
+
+ timer.setSingleShot(true);
+ timer.setInterval(2500);
+ connect(&timer, SIGNAL(timeout()),
+ &message, SLOT(hide()));
+ }
+
+ void showMessage(const QString &s)
+ {
+ message.setText(s);
+ message.show();
+ timer.start();
+ }
+protected:
+ virtual void resizeEvent(QResizeEvent* ev)
+ {
+ QScrollArea::resizeEvent(ev);
+ message.setFixedWidth(width());
+ }
+ virtual void scrollContentsBy(int dx, int dy)
+ {
+ QScrollArea::scrollContentsBy(dx, dy);
+ if(widget())
+ widget()->update(); //update whole widget
+ }
+private:
+ QLabel message;
+ QTimer timer;
+};
+#endif
TARGET = presencevnc-bin
LIBS += -Llibvnc/libvncclient/.libs -lvncclient
DEFINES += QTONLY
-CONFIG += silent clean
+CONFIG += silent debug
maemo5 {
QT += maemo5
VPATH = $${PWD}/src
INCLUDEPATH = $${PWD}/src $${PWD}/libvnc
-HEADERS += remoteview.h vncclientthread.h vncview.h mainwindow.h preferences.h connectdialog.h fullscreenexitbutton.h keymenu.h
+HEADERS += remoteview.h vncclientthread.h vncview.h mainwindow.h preferences.h connectdialog.h fullscreenexitbutton.h keymenu.h scrollarea.h
SOURCES += main.cpp remoteview.cpp vncclientthread.cpp vncview.cpp mainwindow.cpp preferences.cpp connectdialog.cpp keymenu.cpp