summaryrefslogblamecommitdiffstats
path: root/src/gui/connectionWindow.h
blob: 55442dbd13ebbe6cfc5e0ea68be86e1c2d26a9dd (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                    
                   









































































                                                                                                                                             
                                                         

























                                                                                                               
                                            












                                                                                           
#ifndef _CONNECTIONWINDOW_H_
#define _CONNECTIONWINDOW_H_

#include <QtGui>
#include <src/gui/connectionFrame.h>
#include <src/gui/connectionList.h>
#include <src/gui/mainWindow.h>
#include <list>
#include <iostream>
#include <math.h>
#include <QSettings>
#include <QPointer>
#define FRAME_DELAY 1000 	// to comply with the standard value in the gui


typedef std::pair<QString, QPoint> clientLocation;
typedef QList<clientLocation> clientLocationList;

class ConnectionList;
class PVSClient;
class PVSConnectionManager;
class MainWindow;
class ConnectionFrame;
class QDragEnterEvent;
class QDropEvent;


class ConnectionWindow : public QWidget
{
    Q_OBJECT
public:
    enum FILLORDER
    {
        ROW,
        COLUMN,
        SQUARE,
    };

    enum VIEWSTYLE
    {
        FULLSCREEN,
        TABLE,
    };



    ConnectionWindow(QWidget *parent=0);
    ~ConnectionWindow();
    void addFrame(ConnectionFrame *conFrame);
    void addFrameBySettings(QString client, QPoint pos);
    void showFrameFromSettings();
    void onChangeConnections();			// if connections are added or removed, this method makes sure the window changes accordingly
    void addConnection(PVSClient* newCon);	// handle newly connected clients (forward to con-list)
    void removeConnection(PVSClient* newCon); // Remove client on disconnect
    void onView();
    void updateConnection(PVSClient* newCon); // update stuff like username etc on a present connection
    void addVNC();
    void onVNCAdd(PVSClient* newCon);
    void removeVNC();
    void onRemoveConnection();			// tells the PVSConnectionManager to remove the connections that are marked in the sidebar
    void onConnectionRemoved(PVSClient* newConnection);	// does some cleanup and tells the gui elements that this connection is removed
    void setSize(int width, int height, bool forceSquare);	// tell the frames to use this size settings
    void getCloseupSize(int &width, int &height);
    bool getShowDummies();
    void setShowDummies(bool show);
    QList<ConnectionFrame*> dummyList;
    QList<ConnectionFrame*> AllFrameOnWindow;
    QList<ConnectionFrame*> getAllFrameOnWindow()
	{
    	return AllFrameOnWindow;
	}
    void removeFromList(ConnectionFrame* cF);

    bool remoteHelp(QString sname);
    bool projectStations(QString sname);
    bool unprojectStations(QString sname);
    bool lockStations();
    void lockStation(PVSClient* pvsCon);
    bool unlockStations();
    void unlockStation(PVSClient* pvsCon);
    bool lockAllStations();
    bool unlockAllStations();
    bool unprojectAllStations();
    bool lockInvertStations();
    void lockInvertStation(PVSClient* pvsCon);
    bool messageStations(QString ident, QString message);
    bool commandStations(QString ident, QString message);
    void messageStation(QString ident, QString message, PVSClient* pvsCon);
    bool lockStationsWithMessage(QString message);
    void lockStationsWithMessage(QString message, PVSClient* pvsCon);
    bool lockAllStationsWithMessage(QString message);

    void setCloseupFrame(ConnectionFrame* cFrame);
    int itemAt(ConnectionFrame* cf);
    ConnectionFrame* getCloseupFrame();
    QList<ConnectionFrame*> getFrameList(){ return frameList; };
    clientLocationList ClientLocationList;
    bool hasDozent; //if a Dozent machine is available this will be set to true else false
    //Frame position in the window
    int posX;
    int posY;

public Q_SLOTS:
	void addDummy();


protected:
    QList<ConnectionFrame*> frameList;	// list of all connected frames
    void mousePressEvent(QMouseEvent *event);

private:
    ConnectionFrame* newConFrame(PVSClient* newConnection);	// returns a new frame for the given connection
    ConnectionFrame* currentSingleFrame;	// pointer to the frame thats currently in FullScreen
    QPointer<ConnectionFrame> _closeupFrame;
    QPoint currentPosition (ConnectionFrame* cF);
    QMenu *menu;
    QAction *newDummy;
    bool ignoreRatio;			// wether the native ratio should be ignored or not
    bool onFullscreen;			// wether on fullscreen or not
    bool onCloseup;				// wether on closeup or not
    int defaultWidth, defaultHeight;	// obvious
    unsigned int frameRate;			// also obvious*/
    bool _showDummies;

};

#endif