summaryrefslogtreecommitdiffstats
path: root/src/gui/connectionFrame.h
blob: a0334bc2ef5e24fceec85c2327f4bb163641bfcd (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifndef _CONNECTIONFRAME_H_
#define _CONNECTIONFRAME_H_
#include <QtGui>
#include <fstream>
#include <iostream>
#include <QImage>
#include <QPixmap>
#include <QLabel>
#include <src/core/pvsClient.h>
#include <src/gui/frame.h>
//#include <src/gui/mainWindow.h>
#include <src/gui/dialog.h>
extern "C"
{
#include <rfb/rfbclient.h>
}

#define PROFILE
#define STYLE_DEFAULT "QGroupBox{background-color: #DCDCDC; margin: 2px; border: 1px solid black; border-radius: 8px; padding: 2px; padding-top: 1.5em;}"
#define STYLE_SELECTED "QGroupBox{background-color: #DCDCDC; margin: 2px; border: 1px solid red; border-radius: 8px; padding: 2px; padding-top: 1.5em;}"

#include <src/util/timeUtil.h>

/**
 * 	Container for the drawable area that shows the corresponding servers desktop
 *
 */

class PVSClient;
class VNCConnection;
class ConnectionWindow;
class Frame;
class Dialog;
class MainWindow;

class ConnectionFrame : public QGroupBox
{

    Q_OBJECT

public:
    ConnectionFrame(QWidget* parent=0); // on width and height being zero, defaults values are used
    virtual ~ConnectionFrame();

    QString getTitle();
    void setTheTitle(QString title);
    QString getTaskbarTitle();
    void setTaskbarTitle(QString title);
    void setInitSize(int w, int h);
    void Resize(int w, int h);
    void initFrame();

    int getPrevWidth(){return prev_width;};
    void setPrevWidth(int w){prev_width = w;}
    int getPrevHeight(){return prev_height;};
    void setPrevHeight(int h){prev_height = h;}

    void setConnection(PVSClient* newConnection);
    void resetConnectionWithQuality(int quality);
    PVSClient* getConnection()
    {
        return _myConnection;
    }
    ;
    //bool drawFrame(); // call to ask for a redraw of the frames content
    void setIgnoreRatio(bool ignore); // sets wether it should force square on the content or not
    void setFullscreen(bool fs); // toggles wether this frame is requested to shown fullscreen or not
    bool getFullscreen()
    {
        return _fullscreen;
    }
    ; // returns wether the frame is fullscreen (or requested to be) or not
    void setCloseup(bool cu); // toggles wether this frame is requested to shown fullscreen or not
    bool getCloseup()
    {
        return _closeup;
    }
    ; // returns wether the frame is fullscreen (or requested to be) or not

    void setInteractive(bool doit);
    float getRatio()
    {
        return _ratio;
    }
    ; // returns the native ratio of the source buffer (h/w)
    void setRatio(int newRatio)
    {
        _ratio = newRatio;
    }
    ;
    bool getOversized()
    {
        return overSized;
    }
    ; // returns wether the frame is reasonably wider than other frames (e.g. dual screen displays)
    void setOversized(bool over)
    {
        overSized = over;
    }
    ;
    void setActive(bool activate);
    bool getActive()
    {
        return active;
    }
    ;
    void setDummy(bool dummy);
    bool isDummy()
    {
        return _dummy;
    }
    ;
    bool isOnProjekt()
    {
    	return _isOnProjekt;
    }
    ;
    void setFrameRate(int newRate);
    bool isClientOnline;
    void paintCloseUp(int w, int h);
    void setSource();
    void setTarget();
    void setUnproject();
    void setDozent(bool isDozent);
    const QPixmap* getFramePixmap();
    Frame* getFrame();
    int init_w, init_h;

public Q_SLOTS:
    virtual void delDummy();
    virtual void on_projection();
	virtual void on_unprojection();
	virtual void on_lock();
	virtual void on_unlock();
	virtual void on_message();
	virtual void on_lock_with_message();
	virtual void on_lock_all_with_message();
	virtual void on_lock_all();
	virtual void on_unlock_all();
	virtual void on_lock_invert();
	virtual void on_remoteHelp();
	virtual void on_click();

protected:
    //virtual void paintEvent(QPaintEvent *event);
    void mouseReleaseEvent  ( QMouseEvent * e );
	virtual void 	enterEvent ( QEvent * event );
	virtual void 	leaveEvent ( QEvent * event );
	void mousePressEvent(QMouseEvent *event);
	void mouseMoveEvent(QMouseEvent *event);
	//void mouseReleaseEvent ( QMouseEvent * event );

private:

    Frame      *_frame;
    QVBoxLayout *_layoutTop;
    QHBoxLayout *_layoutBottom;
    QLabel* _ip;
	QLabel* _status;
	QLabel* _dozentContaimner;
	QWidget* _conFrameTaskbar;

    PVSClient* _myConnection;
    QPixmap _clientPix;
    QPixmap _clientStatus;
    QPixmap _clientDozent;
    int nat_height, nat_width; // native height and width of the source buffer
    int cu_height, cu_width;
    int prev_height, prev_width;
   // uint8_t prev_buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */
    int _ratio;
    bool _dummy;
    bool ignore_ratio, overSized, first;
    bool _fullscreen, _closeup, _isOnProjekt;

    bool viewOnly, active;
    rfbClient* myClient;

    QMenu *menu;
    QAction *DelDummy;
    QAction *lockClient ;
	QAction *uLockClient ;
	/*QAction *invertlockClient ;
	QAction *LockAllClient ;
	QAction *uLockAllClient ;*/
	QAction *msgLockAllClient ;
	QAction *msgClient ;
	QAction *msgLockClient ;
	QAction *project ;
	QAction *uproject ;
	//QAction *rHelp ;


    QPoint _clickPoint;
    QPoint _previousPoint;
};

#endif