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











                                     
                                         


                                          
                                    

























                                        
                                                               

















                                                   

































                                                                         

                                                                 
 






                          


















                                                                                                                    
                  
 

                                                                                              







                                    
                              
                         
                                  

                      
                        
























                                                                                  

                        










                                                   

                                                                    

                   
                



                                    
                         
                        
                                     












                                             
                                    


                                               
                                                

                                                                                                                        
                            



      
#ifndef _MAINWINDOW_H_
#define _MAINWINDOW_H_

#include <QtGui>
#include <QtNetwork>
#include <QMainWindow>
#include <QFileDialog>
#include <src/gui/connectionList.h>
#include <src/util/consoleLogger.h>
#include <src/gui/connectionWindow.h>
#include <src/gui/profileDialog.h>
//#include <src/gui/dialog.h>
#include <src/gui/processesStartDialog.h>
#include <src/core/pvsClient.h>
#include <src/core/pvsConnectionManager.h>
#include "src/gui/aboutDialog.h"
#include "src/gui/processesDialog.h"
#include "src/gui/serverChatDialog.h"
#include <src/gui/serverFileTransfert.h>


namespace Ui
{
class MainWindow;
}


class PVSClient;
class ConnectionList;
class ConnectionWindow;
class profileDialog;
class ServerChatDialog;
//class Dialog;


class MainWindow : public QMainWindow
{
    friend class PVSConnectionManager;

    Q_OBJECT


public:
    MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
    ~MainWindow();

    //singleton methods
    static MainWindow* getWindow();
    static ConnectionWindow* getConnectionWindow();
    static ConnectionList* getConnectionList();

    ServerChatDialog sChatDialog;


    int getConnectionWindowWidth();
    int getConnectionWindowHeight();
    int x,y;
    QImage img;
    QImage img2;
    QString test;
    QStringList profilList;
    QStringList getProfilList();
    QString currentProfi;
    QString getCurrentProfi()
    {
    	return currentProfi;
    }
    void loadSettings();
    void loadSettings(QString profilname);
    void saveSettings(QString profilname);
    void removeProfil(QString profilname);

    // connection add/remove and dialog methods
    void addConnection(PVSClient* newCon);
    void removeConnection(PVSClient* newCon);
    //ConnectionFrame* getNewFrame();
    void onConnectionFailed(QString host = "");
    void onConnectionTerminated(PVSClient* newConnection);
    void onConnectionRemoved(PVSClient* newConnection);
    void onPasswordFailed(QString Qhost = "");

    void sendChatMsg(PVSMsg myMsg);
    void receiveChatMsg(QString nick_from, QString nick_to, QString msg);

    // view mode related methods
    unsigned int getGlobalFrameRate();
    void setGlobalFrameRate(unsigned int newRate);
    int getPrevWidth();
    void setPrevWidth(int newWidth);
    int getPrevHeight();
    void setPrevHeight(int newHeight);

   // int  createMsgDiag();
    void setMsgDialog(QString msgd){msgDialog = msgd;};
    QString getMsgDialog(){return msgDialog;};

    void setProcessesDialog(QString procd){procToStart = procd;};
    QString getProcessesDialog(){return procToStart;};

    bool isLockAllStatus()
    {
    	return _isLockAll;
    }

    void appendLogMsg();

protected:
    void closeEvent(QCloseEvent *e);
    void changeEvent(QEvent *e);
    void resizeEvent(QResizeEvent *event); //We need this to resize the frame in the window when window are resized.
    void updatePos(ConnectionFrame* cf, int x, int y);
    virtual void on_log_line(LogEntry consoleEntry);




private:
    Ui::MainWindow *ui;
    static ConnectionWindow* conWin;
    static ConnectionList* conList;
    //Dialog messageDiag;
    static MainWindow* myself;
    QString _pwdCon;
    QString _sessionName;
    QString _profilName;
    QString _info;

    int displayedClientNameEnum; //to tell if username, loginname or ip is shown in clientList

    QStringList _chatListClients;



    /*ConnectionDialog* myConDiag;
    ConnectionDialog* pwDiag;
    ConnectionDialog* messageDiag;*/

    AboutDialog	*_aboutDialog;
    QWidget *_helpDialog;
    profileDialog *_profileDialog;

    QString msgDialog;
    QString procToStart;
    bool    bgimage;
    bool    locked, locked1;
    bool    force_square;
    bool    is_fullscreen;
    bool    is_closeup;
    static  bool    _isLockAll;
    bool    showError, showNormal, showNetwork, showTerminal, showChat, showAtAll;
    bool    isDozent;
    QString fileName;

    int _initW, _initH, _firstResize;

    unsigned int updateRate, frameRate;
    int prev_width, prev_height, menuindex1, menuindex2;

    QTcpServer *_serverSocket;
    QPoint      _framePosOnCloseUp;

    bool     _isThumbnailrate;
    int      _updatefreq;
    QString  _oldRatio;

    QMenu*                    _profileMenuList;
    QMap<QString, QAction*>   _mapProfileToAction;

    QSettings _settings;

public slots:
	void loadProfile(QAction* actiontriggered);
    void setindexback();
    //void setindexback2();
    void lockalltoolbar();
    void resetall();
    void locksingle();
    void unlocksingle();
    void clientlisthide();
    void projecttoolbar();
    void unprojecttoolbar();
    void closeUp(ConnectionFrame* connFrame, PVSClient* client = 0);
    void unCloseUp(ConnectionFrame* connFrame);
    void closeUp();
    void foto();
    void info();
    void backgroundpicture();
    void repaintbackgroundpicture();
    void setdozenttoolbar();
    void startChatDialog();
    void showProcesses();
    void startProcess();
    int getDisplayedClientNameEnum();

private slots:
	void onToggleLog(bool showtime);
    void setLogConsoleDisabled(bool visible);
    //void close();
    void disconnect();
    void lockUnlockAll();
    void createProfile();
    void showusername();
    void showname();
    void showip();
    void incomingFile();
    void changeRatio(int ratio);
    void changeRefresh(int refresh);
    void changeStatus (int index);
    void setVNCQuality(int quality);
    void setPasswordForConnection(int enabled);
    void setPasswordForConnection(bool enabled);
    void combobox1(int menuindex1); // Funktion um index der combobox auszulesen und weiterzuverarbeiten   s. Ticker 671
    //void combobox2(int menuindex2); // Funktion um index der combobox auszulesen  und weiterzuverarbeiten
    void configureNetwork();
};


#endif