Handle VNC framebuffer size changes correctly. Such changes are for example used...
[kdenetwork.git] / krdc / vnc / vncview.h
blob08838266bb96d2c574935c566637e0e51a15147b
1 /****************************************************************************
2 **
3 ** Copyright (C) 2007 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 "vnchostpreferences.h"
29 #include "vncclientthread.h"
31 #include <QClipboard>
33 extern "C" {
34 #include <rfb/rfbclient.h>
37 class VncView: public RemoteView
39 Q_OBJECT
41 public:
42 explicit VncView(QWidget *parent = 0, const KUrl &url = KUrl());
43 ~VncView();
45 QSize framebufferSize();
46 QSize sizeHint() const;
47 QSize minimumSizeHint() const;
48 void startQuitting();
49 bool isQuitting();
50 bool start();
51 bool supportsLocalCursor() const;
52 void keyEvent(QKeyEvent *e);
54 protected:
55 void paintEvent(QPaintEvent *event);
56 void focusOutEvent(QFocusEvent *event);
57 void mouseMoveEvent(QMouseEvent *event);
58 void mousePressEvent(QMouseEvent *event);
59 void mouseDoubleClickEvent(QMouseEvent *event);
60 void mouseReleaseEvent(QMouseEvent *event);
61 void wheelEvent(QWheelEvent *event);
62 void keyPressEvent(QKeyEvent *event);
63 void keyReleaseEvent(QKeyEvent *event);
64 bool eventFilter(QObject *obj, QEvent *event);
66 private:
67 VncClientThread vncThread;
68 QClipboard *m_clipboard;
69 bool m_initDone;
70 int m_buttonMask;
71 int m_x, m_y, m_w, m_h;
72 bool m_repaint;
73 bool m_quitFlag;
74 bool m_firstPasswordTry;
75 bool m_dontSendClipboard;
76 VncHostPreferences *m_hostPreferences;
77 QImage m_frame;
79 private slots:
80 void updateImage(int x, int y, int w, int h);
81 void setCut(const QString &text);
82 void requestPassword();
83 void outputErrorMessage(const QString &message);
84 void mouseEvent(QMouseEvent *event);
85 void clipboardSelectionChanged();
86 void clipboardDataChanged();
89 #endif