clear login screen on failed login attempt

pull/23/head
JuanJakobo 2021-02-15 21:51:00 +01:00
parent ab36cf429f
commit 8bbe0a857f
3 changed files with 12 additions and 6 deletions

View File

@ -224,20 +224,18 @@ int EventHandler::pointerHandler(const int type, const int par1, const int par2)
{
_menu.drawLoadingScreen();
Log::writeLog("Start Login from loginscreen");
//TODO use progressbar and log (check what can go wrong?) catch?
if (_nextcloud.login(_loginView->getURL(), _loginView->getUsername(), _loginView->getPassword()))
{
_listView = std::unique_ptr<ListView>(new ListView(_menu.getContentRect(), _nextcloud.getItems()));
_loginView.reset();
FullUpdate();
}
else
{
//TODO redraw login screen so that loading disappears
Message(ICON_WARNING, "Warning", "Something went wrong...", 1200);
_menu.clearLoadingScreen();
Log::writeLog("login failed.");
}
FullUpdate();
return 1;
}
}

View File

@ -89,3 +89,9 @@ void MenuHandler::drawLoadingScreen()
DrawTextRect2(&_loadingScreenRect, "Loading...");
PartialUpdate(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h);
}
void MenuHandler::clearLoadingScreen()
{
FillArea(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h/4, WHITE);
PartialUpdate(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h);
}

View File

@ -39,6 +39,8 @@ public:
void drawLoadingScreen();
void clearLoadingScreen();
private:
ifont *_menuFont;
ifont *_loadingFont;