diff --git a/client/src/dialog/connectdialog.cpp b/client/src/dialog/connectdialog.cpp index 3a5b1152..d405be5f 100644 --- a/client/src/dialog/connectdialog.cpp +++ b/client/src/dialog/connectdialog.cpp @@ -175,6 +175,18 @@ void ConnectDialog::stateChanged() QTimer::singleShot(300, this, &ConnectDialog::accept); break; + case Connection::State::Authenticating: + m_status->setText(Locale::tr("qtapp.connect_dialog:authenticating")); + break; + + case Connection::State::CreatingSession: + m_status->setText(Locale::tr("qtapp.connect_dialog:creating_session")); + break; + + case Connection::State::FetchingWorld: + m_status->setText(Locale::tr("qtapp.connect_dialog:fetching_world")); + break; + case Connection::State::SocketError: m_status->setText(m_connection->errorString()); setControlsEnabled(true); diff --git a/client/src/network/connection.cpp b/client/src/network/connection.cpp index dcfe9a97..0fe8cb4e 100644 --- a/client/src/network/connection.cpp +++ b/client/src/network/connection.cpp @@ -693,7 +693,7 @@ void Connection::getWorld() m_worldRequestId = invalidRequestId; setWorld(object); // TODO: show error?? - if(m_state == State::Connecting) + if(m_state == State::FetchingWorld) setState(State::Connected); }); } @@ -987,6 +987,7 @@ void Connection::processMessage(const std::shared_ptr message) void Connection::socketConnected() { + setState(State::Authenticating); std::unique_ptr loginRequest{Message::newRequest(Message::Command::Login)}; loginRequest->write(m_username.toUtf8()); loginRequest->write(m_password); @@ -995,6 +996,7 @@ void Connection::socketConnected() { if(loginResponse && loginResponse->isResponse() && !loginResponse->isError()) { + setState(State::CreatingSession); std::unique_ptr newSessionRequest{Message::newRequest(Message::Command::NewSession)}; send(newSessionRequest, [this](const std::shared_ptr newSessionResonse) @@ -1037,7 +1039,10 @@ void Connection::socketConnected() } if(m_worldProperty->hasObject()) + { + setState(State::FetchingWorld); getWorld(); + } else setState(State::Connected); } diff --git a/client/src/network/connection.hpp b/client/src/network/connection.hpp index c53f929b..86252991 100644 --- a/client/src/network/connection.hpp +++ b/client/src/network/connection.hpp @@ -60,13 +60,16 @@ class Connection : public QObject, public std::enable_shared_from_this