summaryrefslogblamecommitdiffstats
path: root/src/pvsgui.h
blob: f87b328ad2f1400b724d28e5baf8610f6c23b8ef (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                            
                                                             













                                                           













                                                
                                  

                                   









                                                                         





                                     

                       
                                                                                              


                     












                                      
                         







                               
                  
                     









                                       
/*
 # 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;
    bool _restricted;
    QPoint _clickPoint;
    QString _passwd;

    QTcpServer *_serverSocket;

    OrgOpenslxPvsInterface *_ifaceDBus;

};

#endif /* PVSCLIENTGUI_H_ */