summaryrefslogtreecommitdiffstats
path: root/src/gui/mainWindow.h
blob: f3e9f185475304ad0effa8580814dea5916c59ac (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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#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