summaryrefslogtreecommitdiffstats
path: root/src/pvsgui.h
blob: b96d73c6347ffd0c97cbda77eefccf98f6daf9b4 (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
/*
 # Copyright (c) 2009, 2010 - OpenSLX Project, Computer Center University of
 # Freiburg
 #
 # This program is free software distributed under the GPL version 2.
 # See http://openslx.org/COPYING
 #
 # If you have any feedback please consult http://openslx.org/feedback and
 # send your suggestions, praise, or complaints to feedback@openslx.org
 #
 # General information about OpenSLX can be found at http://openslx.org/
 */

#ifndef PVSCLIENTGUI_H_
#define PVSCLIENTGUI_H_

#include <QtGui>
#include <QtNetwork>
#include "3rdparty/qtsingleapplication/qtsingleapplication.h"
#include "ui_clientToolbar.h"
#include "src/gui/clientConfigDialog.h"
#include "src/gui/clientChatDialog.h"
#include "src/gui/clientFileSendDialog.h"
#include "src/gui/clientFileReceiveDialog.h"
#include "src/gui/clientVNCViewer.h"
#include "src/gui/clientInfoDialog.h"
#include "src/gui/aboutDialog.h"

#include "pvsinterface.h"

class PVSGUI: public QWidget, private Ui_ClientToolbarClass
{
    Q_OBJECT

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

    int const static POSITION_TOP_LEFT = 0;
    int const static POSITION_TOP_CENTER = 1;
    int const static POSITION_TOP_RIGHT = 2;
    int const static POSITION_BOTTOM_LEFT = 3;
    int const static POSITION_BOTTOM_CENTER = 4;
    int const static POSITION_BOTTOM_RIGHT = 5;

public Q_SLOTS:
    void updateConfig();
    void setVisible(bool visible);
    void setPosition(int position);
    void hide();

protected:
    void enterEvent(QEvent *e);
    void leaveEvent(QEvent *e);
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);

private Q_SLOTS:
    void showMessage(QString title, QString msg, bool useDialog = false);
    void connected(QString host);
    void disconnected();
    void addHost(QString host);
    void delHost(QString host);
    void pvsConnect(QAction *action);
    void pvsDisconnect();
    void sendFile();
    void receiveFile();
    void incomingMulticastFile(qulonglong, QString sender, QString basename, qulonglong size);

private:
    void setupMenu();
    void hide(bool b);

    QMenu *_menu;
    QMenu *_hostMenu;
    QHash<QString, QAction*> *_hosts;
    QSettings _settings;
    QSystemTrayIcon *_trayIcon;
    ClientChatDialog *_chatDialog;
    ClientConfigDialog *_configDialog;
    ClientInfoDialog *_infoDialog;
    ClientVNCViewer *_vncViewer;
    AboutDialog *_aboutDialog;

    QAction *_showAction;
    QAction *_disconnectAction;
    QAction *_startChatAction;
    QAction *_sendFileAction;
    QAction *_configAction;
    QAction *_showInfoAction;
    QAction *_aboutAction;
    QAction *_quitAction;

    int _position;
    QPoint _clickPoint;
    QString _passwd;

    QTcpServer *_serverSocket;

    OrgOpenslxPvsInterface *_ifaceDBus;

};

#endif /* PVSCLIENTGUI_H_ */