diff options
Diffstat (limited to 'src/client/connectwindow')
-rw-r--r-- | src/client/connectwindow/connectwindow.cpp | 12 | ||||
-rw-r--r-- | src/client/connectwindow/connectwindow.h | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp index 34087ad..7f24281 100644 --- a/src/client/connectwindow/connectwindow.cpp +++ b/src/client/connectwindow/connectwindow.cpp @@ -164,7 +164,7 @@ void ConnectWindow::connectToSession(const QByteArray sessionName) return; _state = Scanning; this->updateState(); - _serverDiscovery.start(_ui->lineEditName->text().toUtf8()); + _serverDiscovery.start(sessionName); } /* @@ -189,6 +189,7 @@ void ConnectWindow::onBtnConnection() if (_connected || _state != Idle) { + _tryReconnect = false; // Stop or disconnect emit disconnect(); _state = Idle; @@ -197,6 +198,7 @@ void ConnectWindow::onBtnConnection() else { // Connect (scan for session) + _tryReconnect = true; connectToSession(_ui->lineEditName->text().toUtf8()); } } @@ -233,6 +235,7 @@ void ConnectWindow::onServerDetected(const QString& host, const quint16 port, co */ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state) { + qDebug() << "STATE!"<< state; bool reset = (_state == Scanning); if (state == InvalidSslHash) ++_hashSslErrorCount; @@ -240,8 +243,10 @@ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state _state = state; this->updateState(); - if (reset) + if (reset) { + qDebug() << "RESET!!"<< state; _state = Scanning; + } if (state == Connected) { QObject::disconnect(_connection, SIGNAL(stateChange(ConnectWindow::ConnectionState)), this, SLOT(onConnectionStateChange(ConnectWindow::ConnectionState))); @@ -271,5 +276,8 @@ void ConnectWindow::onConnectionClosed(QObject* connection) void ConnectWindow::onConnectionDisconnected() { _connected = false; + _state = Idle; this->updateState(); + if (_tryReconnect) + connectToSession(_ui->lineEditName->text().toUtf8()); } diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h index 39eac86..df112fe 100644 --- a/src/client/connectwindow/connectwindow.h +++ b/src/client/connectwindow/connectwindow.h @@ -64,7 +64,7 @@ private: ConnectionState _state; QByteArray _sessionNameBytes; NetworkMessage _packet; - bool _connected; + bool _connected, _tryReconnect; int _timerHide; void updateState(); |