summaryrefslogblamecommitdiffstats
path: root/src/gui/connectionFrame.h
blob: a0334bc2ef5e24fceec85c2327f4bb163641bfcd (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                 

                                                                                                                                                         
 


































































































                                                                                                     


































                                                         

                               
                


                                  




































                                                                              
#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