summaryrefslogtreecommitdiffstats
path: root/src/gui/frame.h
blob: 4a3dd11dcdf043c07cfb3617941b3738a302185c (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef FRAME_H_
#define FRAME_H_

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

class VNCClientThread;
class ConnectionWindow;
class ConnectionFrame;
class MainWindow;
class InputEvent;

class Frame: public QLabel
{
    Q_OBJECT

public:
    Frame(const QString & text, QWidget * parent = 0 );
    virtual ~Frame();
    void setVNCThreadConnection(VNCClientThread * VNCclientThread);
    void stopVNCThreadConnection();
    VNCClientThread * getVNCClientThread()
	{
    	return _clientVNCThread;
	}
    void setConFrame (ConnectionFrame* cf)
    {
    	_cFrame = cf;
    }
    ConnectionFrame* getConFrame()
	{
    	return _cFrame;
	}
    void setToolButtonListVisible(bool visible);
    void setLockStatus(bool lock);
    bool getLockStatus()
    {
    	return _isLocked;
    }
    bool isDozent()
    {
    	return _dozent;
    }
    int X,Y;

    QString ip;
    QToolButton* button_closeUp;
    QToolButton* button_foto;
    QToolButton* button_lock;
    QToolButton* button_unlock;
    QToolButton* button_dozent;
    QToolButton* button_control;
    QToolButton* button_control_all;
    QList<QToolButton*> toolButtonList;

    bool _remoteControlEnabled;
    bool _remoteControlToAll;

public Q_SLOTS:
    void updateImage(int x, int y, int w, int h);
    void iamDown();
    void slotClicked();
    QImage image()
    {
    	return _clientImg;
    };
    void setImage(QImage img)
    {
    	_clientImg = img;
    };
    QImage getImageForFoto();
    void closeUp();
    void foto();
    void setLock();
    //void unlock();
    void setDozent();
    void setCloseUp(bool value);

private Q_SLOTS:
	void remoteControlClicked();
	void remoteControlAllClicked();
	void sendMouseMotionEvent();
	void showSpecialEventMenu();

signals:
	void clicked();
protected:
    void paintEvent(QPaintEvent *event);
    void mousePressEvent ( QMouseEvent * event );
    void mouseReleaseEvent ( QMouseEvent * event );
    void mouseMoveEvent ( QMouseEvent * event );
    void enterEvent(QEvent* event);
    void leaveEvent(QEvent* event);
    void keyPressEvent(QKeyEvent* event);
    void keyReleaseEvent(QKeyEvent* event);
    bool event(QEvent* event);

private:
    QToolButton* createToolButton(const QString &toolTip, const QIcon &icon, const char *member);
    void addButton(QToolButton *button);
    VNCClientThread *_clientVNCThread;
    ConnectionFrame *_cFrame;
    QImage _clientImg;
    bool _isLocked;
    bool _dozent;
    int _ux, _uy;
    bool _isCloseUp;

    // for remote control:
    QPoint _lastRecordedMousePosition;
    bool _mousePositionChanged;
    QTimer* _mouseMotionEventTimer;
    bool _mouseOver;
    QTimer* _specialEventTimer;
    QPoint rescalePosition(QPointF guiPosition);
    void updateMousePosition(QMouseEvent* event);
    void sendInputEvent(InputEvent const&);
};

#endif /* FRAME_H_ */