Added extra info to display stage of connecting
This will give some more insight to solve #33
Dieser Commit ist enthalten in:
Ursprung
1e9ef650c2
Commit
e4666e3fae
@ -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);
|
||||
|
||||
@ -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> message)
|
||||
|
||||
void Connection::socketConnected()
|
||||
{
|
||||
setState(State::Authenticating);
|
||||
std::unique_ptr<Message> 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<Message> newSessionRequest{Message::newRequest(Message::Command::NewSession)};
|
||||
send(newSessionRequest,
|
||||
[this](const std::shared_ptr<Message> newSessionResonse)
|
||||
@ -1037,7 +1039,10 @@ void Connection::socketConnected()
|
||||
}
|
||||
|
||||
if(m_worldProperty->hasObject())
|
||||
{
|
||||
setState(State::FetchingWorld);
|
||||
getWorld();
|
||||
}
|
||||
else
|
||||
setState(State::Connected);
|
||||
}
|
||||
|
||||
@ -60,13 +60,16 @@ class Connection : public QObject, public std::enable_shared_from_this<Connectio
|
||||
public:
|
||||
enum class State
|
||||
{
|
||||
Disconnected = 0,
|
||||
Disconnecting = 1,
|
||||
Connected = 2,
|
||||
Connecting = 3,
|
||||
SocketError = 4,
|
||||
ErrorAuthenticationFailed = 5,
|
||||
ErrorNewSessionFailed = 6,
|
||||
Disconnected,
|
||||
Disconnecting,
|
||||
Connected,
|
||||
Connecting,
|
||||
Authenticating,
|
||||
CreatingSession,
|
||||
FetchingWorld,
|
||||
SocketError,
|
||||
ErrorAuthenticationFailed,
|
||||
ErrorNewSessionFailed,
|
||||
};
|
||||
|
||||
using SocketError = QAbstractSocket::SocketError;
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren