summaryrefslogblamecommitdiffstats
path: root/src/server/mainwindow/mainwindow.h
blob: 0cc6abcda8bd8b3ed5ee83c7885a4e95af7ccd92 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11




                      
                          




                        



























                                                                              
                                                                      
                                       


















                                           



                                      









                                                                          
                                                                              




      
#ifndef _MAINWINDOW_H_
#define _MAINWINDOW_H_

#include <QtGui>
#include <QMainWindow>
#include "../net/client.h"

class SessionNameWindow;
class ConnectionFrame;
class ListenServer;
class DiscoveryListener;

namespace Ui
{
	class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

private:
    Ui::MainWindow *ui;
    SessionNameWindow *_sessionNameWindow;
    QLabel *_sessionNameLabel;
    QList<ConnectionFrame*> _clientFrames;
    int _tileWidth, _tileHeight;
    int _tilesX, _tilesY;
    int _tbIconSize;
    Qt::ToolBarArea _tbArea;
    int _timerId, _timerTimeout;
    ListenServer *_listenServer;
    DiscoveryListener *_discoveryListener;
    qint64 _buttonBlockTime;

    void placeFrameInFreeSlot(ConnectionFrame* frame);
    ConnectionFrame* createFrame();
    bool loadPosition(QSettings& settings, const QString& id, int& x, int& y);
    void savePosition(ConnectionFrame *cf);
    void prepareForProjection(Client * const from, Client * const to);
    bool isValidClient(Client* client);

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void closeEvent(QCloseEvent *e);
    void changeEvent(QEvent *e);
    void resizeEvent(QResizeEvent *e);
    void mouseReleaseEvent(QMouseEvent* e);
    void timerEvent(QTimerEvent* event);


protected slots:
	// This
	void onSessionNameClick();
	void onSessionNameUpdate();
	void onButtonSettings();
	void onButtonChat();
	void onButtonStudentToAll();
	void onButtonStudentToTutor();
	void onButtonTutorToAll();
	void onButtonTutorToStudent();
	void onButtonLock(bool checked);
	void onButtonExit();
	// connection frame
	void onPlaceFrame(ConnectionFrame* frame);
	void onFrameClicked(ConnectionFrame* frame);
	// Net
	void onClientConnected(Client* client);
	void onClientAuthenticating(Client* client, ClientLogin* request);
	void onClientAuthenticated(Client* client);
	void onVncServerStateChange(Client* client);
	void onVncClientStateChange(Client* client, int lastProjectionSource);

};


#endif