summaryrefslogtreecommitdiffstats
path: root/src/gui/connectionList.h
blob: 50d8924ef9f9bde7515c8cb2fbe5874c3ddca400 (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
#ifndef _CONNECTIONLIST_H_
#define _CONNECTIONLIST_H_

#include <QtGui>
#include <src/core/pvsClient.h>
#include <QTableView>
#include <QObject>
#include <QMap>
#include <QItemSelection>
#include <src/gui/mainWindow.h>
#include <src/gui/dialog.h>
#include <src/gui/projectionDialog.h>

class PVSClient;

//class QAbstractItemView;


/**
  *	The Sidebar showing the connected servers
  *	also used to determine to which connection
  *	contextual actions should be applied
  */

class QVBoxLayout;
class QSortFilterProxyModel;
class QAbstractItemModel;
class QAbstractItemView;
class QItemSelectionModel;
class MainWindow;
class Dialog;
class ProjectionDialog;
//class ConnectionList;

class ConnectionList: public QTableView
{
    Q_OBJECT

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

    void onAddClient(PVSClient* newConnection);	// called if a new connection is added
    void onUpdateClient(PVSClient* newConnection); // update the username*/
    void addClientToList(QString clientname);
    void onRemoveClient(PVSClient* newCon);
    void removeClientToList(QString clientname);
    QList<QString> getClientist()
    {
        return _clientNames;
    };
    //  void updateAllClients();
    bool useUserName();
    bool useUserName(bool use);
    QList<QString> projectList;
    QList<QString> targetList;
    QList<QString> displayList;
    QList<QString> sourceList;
	QMap<QString, QList<QString> > sourceMap;
	QString projSourceName;
    std::list<QString>* getSelectedClients(bool isClickOnWindow=false);	// returns the currently selected clients
    //void setTargetToDisplay(QString source); // return the list for the projection
    void setProjectProporties(QString source);
    QList<QString> getTargetToDisplay(QString source);
    void addTargetToProjectList(QString name);
    QList<QString> getTargetForTheProject(QString source);
    QList<QString>getTargetToProject()
	{
		return projectList;
	}
    // void removeFromList(PVSConnection* newConnection);	// called if a connection is removed
    // void setMultipleSelection(bool on);

    QAbstractItemModel *model;

private:
    QItemSelectionModel *_selectionModel;
    QList<QString> _clientNames;

    int clientindex; //Index of clientname in the list.

    static bool    isOnProjection;

    QMenu *_popupMenu; // in der PopupMenu
    /*Die Aktionen in der PopupMenu*/
   /* QAction *a1 ;
    QAction *a2 ;
    QAction *a3 ;*/
    QAction *_lockClient ;
    QAction *_uLockClient ;
    /*QAction *invertlockClient ;
    QAction *LockAllClient ;
    QAction *uLockAllClient ;*/
    QAction *_msgLockClient ;
    QAction *_msgLockAllClient ;
    QAction *_msgClient ;
    QAction *_project ;
    QAction *_uproject ;
  //  QAction *rHelp ;

    void preparePopup();
    void unproject(QString source);
    QAction* createToolbarButton(const QString &name, const char *slot);

public slots:
    //Signal handlers:

    virtual void on_projection();
    virtual void on_unprojection();
    virtual void on_lock();
    virtual void on_unlock();
    virtual void on_message();
    virtual void on_lock_with_message();
    virtual void on_lock_all_with_message();
    virtual void on_lock_all();
    virtual void on_unlock_all();
    virtual void on_unproject_all();
    virtual void on_lock_invert();
    virtual void on_remoteHelp();
    void on_vnc_add();
    void on_vnc_remove();
    void on_removeClient();
    void removeClient(QModelIndexList indexes);
    /*virtual void on_menu_file_remove_connection();*/

signals:
    void selectionChanged (const QItemSelection &selected);

protected:
    bool _useUserName;
    virtual void mouseReleaseEvent  (QMouseEvent * e );
};

#endif