summaryrefslogtreecommitdiffstats
path: root/src/gui/clientVNCViewer.h
blob: 6ff9c33b362e53dc9b78d9c7f4b64f38b969a5cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 # Copyright (c) 2009, 2010 - OpenSLX Project, Computer Center University of
 # Freiburg
 #
 # This program is free software distributed under the GPL version 2.
 # See http://openslx.org/COPYING
 #
 # If you have any feedback please consult http://openslx.org/feedback and
 # send your suggestions, praise, or complaints to feedback@openslx.org
 #
 # General information about OpenSLX can be found at http://openslx.org/
 */

#ifndef CLIENTVNCVIEWER_H_
#define CLIENTVNCVIEWER_H_

#include <QtGui>
#include <QMouseEvent>
#include "pvsinterface.h"
#include "../util/vncClientThread.h"

// Definition of key modifier mask constants
#define KMOD_Alt_R  0x01
#define KMOD_Alt_L  0x02
#define KMOD_Meta_L     0x04
#define KMOD_Control_L  0x08
#define KMOD_Shift_L    0x10

class ClientVNCViewer: public QDialog
{
Q_OBJECT

public:
    ClientVNCViewer(QWidget *parent = 0);
    virtual ~ClientVNCViewer();

public Q_SLOTS:
    void open(QString host, int port, QString passwd, bool fullscreen = false,
            bool smoothTransformation = false, int quality = 0);
    void close();
    void updateImage(int x, int y, int w, int h);

protected:
    void paintEvent(QPaintEvent *event);
    //bool event(QEvent *event);
    //bool eventFilter(QObject *obj, QEvent *event);

private:
    VNCClientThread *_thread;
    //rfbClient *_rfbclient;
    QImage _img;
    bool _viewOnly;
    int _buttonMask;
    QMap<unsigned int, bool> _modkeys;
    bool eventFilter(QObject *obj, QEvent *event);
    void keyEventHandler(QKeyEvent *e);
    void unpressModifiers();
    void wheelEventHandler(QWheelEvent *event);
    void mouseEventHandler(QMouseEvent *event);


    Qt::TransformationMode _mode;

    OrgOpenslxPvsInterface *_ifaceDBus;
};

#endif /* CLIENTVNCVIEWER_H_ */