From c4ab9a22010e22180718745dc2fd985ee46b5590 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Fri, 28 Nov 2014 13:04:02 +0100 Subject: Remove redundant flags --- src/client/connectwindow/connectwindow.cpp | 11 ++++------- src/client/connectwindow/connectwindow.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/client/connectwindow') diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp index 4a57532..6f75e29 100644 --- a/src/client/connectwindow/connectwindow.cpp +++ b/src/client/connectwindow/connectwindow.cpp @@ -23,7 +23,6 @@ ConnectWindow::ConnectWindow(QWidget *parent) : QWidget(parent) { _ui = new Ui::ConnectWindow; - _connected = false; _timerHide = 0; _connection = NULL; _state = Idle; @@ -62,9 +61,9 @@ ConnectWindow::~ConnectWindow(){} */ void ConnectWindow::updateUserInterface() { - _ui->lineEditName->setEnabled(_state == Idle && !_connected); + _ui->lineEditName->setEnabled(_state == Idle); - if (_connected) + if (_state == Connected) { _ui->btn_connection->setEnabled(true); _ui->btn_connection->setText(tr("&Disconnect")); @@ -160,7 +159,7 @@ void ConnectWindow::showEvent(QShowEvent* event) */ void ConnectWindow::connectToSession(const QByteArray sessionName, QString mgrIP) { - if (_connected || _state != Idle) + if (_state != Idle) return; _state = Scanning; this->updateUserInterface(); @@ -187,7 +186,7 @@ void ConnectWindow::onBtnConnection() if (_serverDiscovery.isActive()) _serverDiscovery.stop(); - if (_connected || _state != Idle) + if (_state != Idle) { _tryReconnect = false; // Stop or disconnect @@ -254,7 +253,6 @@ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state QObject::disconnect(_connection, SIGNAL(destroyed(QObject*)), this, SLOT(onConnectionClosed(QObject*))); emit connected(_connection); - _connected = true; this->updateUserInterface(); _connection = NULL; @@ -276,7 +274,6 @@ void ConnectWindow::onConnectionClosed(QObject* connection) */ void ConnectWindow::onConnectionDisconnected() { - _connected = false; _state = Idle; this->updateUserInterface(); if (_tryReconnect) diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h index 02d690f..92d0a4c 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, _tryReconnect; + bool _tryReconnect; int _timerHide; void updateUserInterface(); -- cgit v1.2.3-55-g7522