Pool Video Switch v2
Software video switch for distributed remote display in a lecture environment
connectwindow.h
Go to the documentation of this file.
1 /*
2  # Copyright (c) 2013 - OpenSLX Project, Computer Center University of
3  # Freiburg
4  #
5  # This program is free software distributed under the GPL version 2.
6  # See http://openslx.org/COPYING
7  #
8  # If you have any feedback please consult http://openslx.org/feedback and
9  # send your suggestions, praise, or complaints to feedback@openslx.org
10  #
11  # General information about OpenSLX can be found at http://openslx.org/
12  # ---------------------------------------------------------------------
13  # - Allow user to connect/disconnect to/from server
14  */
15 
16 #ifndef PVSCONNECTWINDOW_H_
17 #define PVSCONNECTWINDOW_H_
18 
19 #include <QWidget>
20 #include <QMap>
21 #include <QUdpSocket>
22 #include <QSslSocket>
23 #include "../../shared/networkmessage.h"
24 #include "../net/serverdiscovery.h"
25 #include "../util/room.h"
26 
27 namespace Ui
28 {
29 class ConnectWindow;
30 }
31 
32 class ServerConnection;
33 
41 class ConnectWindow : public QWidget
42 {
43  Q_OBJECT
44 
45 public:
53  InvalidSslHash, // Hash of challenge inside SSL connection invalid
56  };
57 
58  explicit ConnectWindow(QWidget *parent = nullptr);
59  ~ConnectWindow() override;
60 
61  void connectToSession(const QByteArray& sessionName, const QString &mgrIP);
62  void setAvailableRooms(const QList<Room>& m);
63 
64 private:
65  Ui::ConnectWindow *_ui;
70  QByteArray _currentSession;
71  QString _currentIp;
74  bool _tryReconnect{};
76 
77  void updateUserInterface();
78 
79 protected:
80  void timerEvent(QTimerEvent* event) override;
81  void closeEvent(QCloseEvent *e) override;
82  void showEvent(QShowEvent* event) override;
83 
84 protected slots:
85  void onBtnConnection();
86  void onBtnHide();
87 
88  void onRoomSelection(int index);
89 
91  void onConnectionClosed(QObject* connection);
93  // void onUdpReadyRead();
94  void onServerDetected(const QString& host, quint16 port, const QByteArray& sessionName, const QByteArray& certHash, bool autoConnect);
95 
96 public slots:
98  void DoConnect();
100  void DoDisconnect();
101 
102  void doShow();
103 signals:
104  void disconnect();
105  void connected(ServerConnection* connection);
106 };
107 
108 #endif
Class for handling the client connection.
Definition: connectwindow.h:41
void onConnectionClosed(QObject *connection)
If connection is closed set _pendingConnection = nullptr.
int _hashSslErrorCount
Definition: connectwindow.h:66
void DoDisconnect()
actually disconnects the connection
QString _defaultSessionName
Definition: connectwindow.h:72
void updateUserInterface()
Handle changes in state and update window.
QByteArray _currentSession
Definition: connectwindow.h:70
ConnectWindow(QWidget *parent=nullptr)
Initialize Connection Window.
void onBtnConnection()
Handle click on Connect/Disconnect button.
void onServerDetected(const QString &host, quint16 port, const QByteArray &sessionName, const QByteArray &certHash, bool autoConnect)
ConnectWindow::onServerDetected.
void onRoomSelection(int index)
check if "manual_connection" is selected, then switch to manual connection page
ServerDiscovery _serverDiscovery
Definition: connectwindow.h:67
~ConnectWindow() override
ConnectWindow::~ConnectWindow.
ConnectionState _state
Definition: connectwindow.h:69
ServerConnection * _pendingConnection
Definition: connectwindow.h:68
void setAvailableRooms(const QList< Room > &m)
set the available rooms.
void DoConnect()
actually connects the connection
void disconnect()
void onBtnHide()
Handle click on Cancel/Hide Button.
void closeEvent(QCloseEvent *e) override
Handle incoming closeEvent and hide window.
void connectToSession(const QByteArray &sessionName, const QString &mgrIP)
Public function connect to session.
void onConnectionDisconnected(ServerConnection *connection)
ConnectWindow::onConnectionDisconnected.
void connected(ServerConnection *connection)
void timerEvent(QTimerEvent *event) override
Called when a Qt timer fires; used for server discovery and auto-hiding the connect dialog...
NetworkMessage _packet
Definition: connectwindow.h:73
void onConnectionStateChange(ConnectWindow::ConnectionState state)
Handle connection state changes and update member variables describing state.
void showEvent(QShowEvent *event) override
Gives the keyboard input focus to the input line.
Ui::ConnectWindow * _ui
Definition: connectwindow.h:65
QString _currentIp
Definition: connectwindow.h:71