1
0
mirror of https://gitlab.com/comunic/comunicterm synced 2024-11-16 10:31:06 +00:00
comunicterm/loginscreen.cpp
2020-01-08 17:43:04 +01:00

62 lines
1.2 KiB
C++

#include <ncurses.h>
#include <string.h>
#include <string>
#include "loginscreen.h"
using namespace std;
LoginScreen::LoginScreen()
{
}
bool LoginScreen::exec()
{
initscr(); /* Start curses mode */
keypad(stdscr, TRUE); // Listen to function keys
printw("ComunicTerm"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
// Get screen size
int row, col;
getmaxyx(stdscr, row, col);
const string msg = "Light client";
mvprintw(0, (col-static_cast<int>(msg.length())), msg.c_str());
refresh();
int startX = (row-4*2)/2;
int startY = (col-50)/2;
mvprintw(startX, startY, "Please login to your Comunic account:");
// Ask for email
wattron(stdscr, A_REVERSE);
mvprintw(startX+2, startY, "Email address:");
wattroff(stdscr, A_REVERSE);
// Ask for password
wattron(stdscr, A_REVERSE);
mvprintw(startX+4, startY, "Password:");
wattroff(stdscr, A_REVERSE);
// Validate button
wattron(stdscr, A_REVERSE);
mvprintw(startX+6, startY, "Login");
wattroff(stdscr, A_REVERSE);
refresh();
getch(); /* Wait for user input */
endwin(); /* End curses mode */
}