Implement scaling of remote desktop for VNC protocol.
[kdenetwork.git] / krdc / vnc / vncview.h
blob917dff619fa80832ed595db0bf4d6653cfdc960d
1 /****************************************************************************
2 **
3 ** Copyright (C) 2007-2008 Urs Wolfer <uwolfer @ kde.org>
4 **
5 ** This file is part of KDE.
6 **
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; see the file COPYING. If not, write to
19 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ** Boston, MA 02110-1301, USA.
22 ****************************************************************************/
24 #ifndef VNCVIEW_H
25 #define VNCVIEW_H
27 #include "remoteview.h"
28 #include "vncclientthread.h"
30 #ifndef QTONLY
31 #include "vnchostpreferences.h"
32 #endif
34 #include <QClipboard>
36 extern "C" {
37 #include <rfb/rfbclient.h>
40 class VncView: public RemoteView
42 Q_OBJECT
44 public:
45 explicit VncView(QWidget *parent = 0, const KUrl &url = KUrl());
46 ~VncView();
48 QSize framebufferSize();
49 QSize sizeHint() const;
50 QSize minimumSizeHint() const;
51 void startQuitting();
52 bool isQuitting();
53 bool start();
54 bool supportsScaling() const;
55 bool supportsLocalCursor() const;
56 void keyEvent(QKeyEvent *e);
57 void setViewOnly(bool viewOnly);
58 void showDotCursor(DotCursorState state);
59 void enableScaling(bool scale);
61 public slots:
62 void scaleResize(int w, int h);
64 protected:
65 void paintEvent(QPaintEvent *event);
66 void resizeEvent(QResizeEvent *event);
67 void focusOutEvent(QFocusEvent *event);
68 void mouseMoveEvent(QMouseEvent *event);
69 void mousePressEvent(QMouseEvent *event);
70 void mouseDoubleClickEvent(QMouseEvent *event);
71 void mouseReleaseEvent(QMouseEvent *event);
72 void wheelEvent(QWheelEvent *event);
73 void keyPressEvent(QKeyEvent *event);
74 void keyReleaseEvent(QKeyEvent *event);
75 bool eventFilter(QObject *obj, QEvent *event);
77 private:
78 VncClientThread vncThread;
79 QClipboard *m_clipboard;
80 bool m_initDone;
81 int m_buttonMask;
82 int m_x, m_y, m_w, m_h;
83 bool m_repaint;
84 bool m_quitFlag;
85 bool m_firstPasswordTry;
86 bool m_dontSendClipboard;
87 qreal m_horizontalFactor;
88 qreal m_verticalFactor;
89 #ifndef QTONLY
90 VncHostPreferences *m_hostPreferences;
91 #endif
92 QImage m_frame;
94 private slots:
95 void updateImage(int x, int y, int w, int h);
96 void setCut(const QString &text);
97 void requestPassword();
98 void outputErrorMessage(const QString &message);
99 void mouseEvent(QMouseEvent *event);
100 void clipboardSelectionChanged();
101 void clipboardDataChanged();
104 #endif