diff options
author | Manuel Schneider | 2014-05-28 00:37:28 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-05-28 00:37:28 +0200 |
commit | afc69ca4ffb0e11d9d06b8ddd31ee40963f86f17 (patch) | |
tree | f7284ba33e98d2bb6e099f248c7b127282efa99f /src/client/connectwindow/connectwindow.h | |
parent | Remove TODO. User get visual feedback via cam icon. (diff) | |
download | pvs2-afc69ca4ffb0e11d9d06b8ddd31ee40963f86f17.tar.gz pvs2-afc69ca4ffb0e11d9d06b8ddd31ee40963f86f17.tar.xz pvs2-afc69ca4ffb0e11d9d06b8ddd31ee40963f86f17.zip |
Outsource serverDiscovery.
Diffstat (limited to 'src/client/connectwindow/connectwindow.h')
-rw-r--r-- | src/client/connectwindow/connectwindow.h | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h index 9319e45..39eac86 100644 --- a/src/client/connectwindow/connectwindow.h +++ b/src/client/connectwindow/connectwindow.h @@ -20,6 +20,7 @@ #include <QUdpSocket> #include <QSslSocket> #include "../../shared/networkmessage.h" +#include "../net/serverdiscovery.h" namespace Ui{ class ConnectWindow; @@ -38,54 +39,37 @@ class ConnectWindow : public QWidget Q_OBJECT public: - enum ConnectionState - { + enum ConnectionState { Idle, Scanning, Connecting, AwaitingChallenge, AwaitingChallengeResponse, LoggingIn, - InvalidIpList, - InvalidHash, // Hash of UDP reply invalid InvalidSslHash, // Hash of challenge inside SSL connection invalid InvalidCert, Connected }; -private: - Ui::ConnectWindow *_ui; - - bool _connected; - int _timerDiscover, _timerHide; - ServerConnection *_connection; - ConnectionState _state; - int _hashErrorCount, _hashSslErrorCount, _certErrorCount, _ipErrorCount; - int _discoveryInterval; - - QByteArray _sessionNameBytes; - QByteArray _salt2; - QUdpSocket _discoverySocket; - NetworkMessage _packet; - - void setState(const ConnectionState state); - void updateState(); - -public: explicit ConnectWindow(QWidget *parent = NULL); virtual ~ConnectWindow(); - void setConnected(const bool connected); void connectToSession(const QByteArray sessionName); +private: + Ui::ConnectWindow *_ui; + ServerConnection *_connection; + int _hashSslErrorCount; + ServerDiscovery _serverDiscovery; + ConnectionState _state; + QByteArray _sessionNameBytes; + NetworkMessage _packet; + bool _connected; + int _timerHide; + + void updateState(); + protected: - /* - void enterEvent(QEvent *e); - void leaveEvent(QEvent *e); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - */ void timerEvent(QTimerEvent* event); void closeEvent(QCloseEvent *e); void showEvent(QShowEvent* event); @@ -93,15 +77,16 @@ protected: protected slots: void onBtnConnection(); void onBtnHide(); - void onUdpReadyRead(); + void onConnectionStateChange(ConnectWindow::ConnectionState state); void onConnectionClosed(QObject* connection); - //void onSsl + void onConnectionDisconnected(); + // void onUdpReadyRead(); + void onServerDetected(const QString& host, const quint16 port, const QByteArray& sessionName, const QByteArray& certHash); signals: void disconnect(); void connected(ServerConnection* connection); - }; #endif |