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(); _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())) if (_nextcloud.login(_loginView->getURL(), _loginView->getUsername(), _loginView->getPassword()))
{ {
_listView = std::unique_ptr<ListView>(new ListView(_menu.getContentRect(), _nextcloud.getItems())); _listView = std::unique_ptr<ListView>(new ListView(_menu.getContentRect(), _nextcloud.getItems()));
_loginView.reset(); _loginView.reset();
FullUpdate();
} }
else else
{ {
//TODO redraw login screen so that loading disappears _menu.clearLoadingScreen();
Message(ICON_WARNING, "Warning", "Something went wrong...", 1200); Log::writeLog("login failed.");
} }
FullUpdate();
return 1; return 1;
} }
} }

View File

@ -89,3 +89,9 @@ void MenuHandler::drawLoadingScreen()
DrawTextRect2(&_loadingScreenRect, "Loading..."); DrawTextRect2(&_loadingScreenRect, "Loading...");
PartialUpdate(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h); 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 drawLoadingScreen();
void clearLoadingScreen();
private: private:
ifont *_menuFont; ifont *_menuFont;
ifont *_loadingFont; ifont *_loadingFont;