mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-27 17:59:49 +02:00
fix message when banned not fitting in the window, also partially fix issue #98 but needs to be done from the server
This commit is contained in:
@@ -20,6 +20,9 @@ void LoginModel::Login(string username, string password)
|
|||||||
break;
|
break;
|
||||||
case LoginError:
|
case LoginError:
|
||||||
statusText = "Error: " + Client::Ref().GetLastError();
|
statusText = "Error: " + Client::Ref().GetLastError();
|
||||||
|
int banStart = statusText.find(". Ban expire in"); //TODO: temporary, remove this when the ban message is fixed
|
||||||
|
if (banStart != statusText.npos)
|
||||||
|
statusText.replace(banStart, 15, ". Login at http://powdertoy.co.uk in order to see the full ban reason. Ban expires in");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
notifyStatusChanged();
|
notifyStatusChanged();
|
||||||
|
@@ -41,7 +41,9 @@ LoginView::LoginView():
|
|||||||
targetSize = Size;
|
targetSize = Size;
|
||||||
FocusComponent(usernameField);
|
FocusComponent(usernameField);
|
||||||
|
|
||||||
infoLabel->Appearance.HorizontalAlign = ui::Appearance::AlignCentre; infoLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
infoLabel->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
|
||||||
|
infoLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
||||||
|
infoLabel->SetMultiline(true);
|
||||||
infoLabel->Visible = false;
|
infoLabel->Visible = false;
|
||||||
AddComponent(infoLabel);
|
AddComponent(infoLabel);
|
||||||
|
|
||||||
@@ -56,14 +58,17 @@ LoginView::LoginView():
|
|||||||
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
cancelButton->SetActionCallback(new CancelAction(this));
|
cancelButton->SetActionCallback(new CancelAction(this));
|
||||||
AddComponent(titleLabel);
|
AddComponent(titleLabel);
|
||||||
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
|
|
||||||
AddComponent(usernameField);
|
AddComponent(usernameField);
|
||||||
usernameField->Appearance.icon = IconUsername;
|
usernameField->Appearance.icon = IconUsername;
|
||||||
usernameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; usernameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
usernameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
usernameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
AddComponent(passwordField);
|
AddComponent(passwordField);
|
||||||
passwordField->Appearance.icon = IconPassword;
|
passwordField->Appearance.icon = IconPassword;
|
||||||
passwordField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; passwordField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
passwordField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
passwordField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
passwordField->SetHidden(true);
|
passwordField->SetHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,12 +92,15 @@ void LoginView::OnTryExit(ExitMethod method)
|
|||||||
|
|
||||||
void LoginView::NotifyStatusChanged(LoginModel * sender)
|
void LoginView::NotifyStatusChanged(LoginModel * sender)
|
||||||
{
|
{
|
||||||
if(!infoLabel->GetText().length() && sender->GetStatusText().length())
|
if (infoLabel->Visible)
|
||||||
|
targetSize.Y -= infoLabel->Size.Y+2;
|
||||||
|
infoLabel->SetText(sender->GetStatusText());
|
||||||
|
infoLabel->AutoHeight();
|
||||||
|
if (sender->GetStatusText().length())
|
||||||
{
|
{
|
||||||
targetSize = Size+ui::Point(0, 18);
|
targetSize.Y += infoLabel->Size.Y+2;
|
||||||
infoLabel->Visible = true;
|
infoLabel->Visible = true;
|
||||||
}
|
}
|
||||||
infoLabel->SetText(sender->GetStatusText());
|
|
||||||
if(sender->GetStatus())
|
if(sender->GetStatus())
|
||||||
{
|
{
|
||||||
c->Exit();
|
c->Exit();
|
||||||
|
Reference in New Issue
Block a user