1
0
mirror of https://gitlab.com/comunic/comunicterm synced 2024-12-26 05:28:54 +00:00

Refactor project

This commit is contained in:
Pierre HUBERT 2020-01-08 20:47:35 +01:00
parent 1cbd35e0b8
commit 981d58bcb9
3 changed files with 29 additions and 11 deletions

View File

@ -9,10 +9,12 @@ SOURCES += \
main.cpp \
api_request.cpp \
apiresponse.cpp \
loginscreen.cpp
loginscreen.cpp \
ui_utils.cpp
HEADERS += \
config.h \
api_request.h \
apiresponse.h \
loginscreen.h
loginscreen.h \
ui_utils.h

View File

@ -5,6 +5,7 @@
#include <iostream>
#include "loginscreen.h"
#include "ui_utils.h"
using namespace std;
@ -48,22 +49,14 @@ void LoginScreen::getCredentials(string &email, string &pass)
erase();
printw("ComunicTerm"); /* Print Hello World */
ui_utils::print_base_screen(stdscr);
// 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:");

23
ui_utils.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <ui_utils.h>
#include <string>
using namespace std;
void ui_utils::print_base_screen(WINDOW *w)
{
printw("ComunicTerm"); /* Print Hello World */
// Get screen size
int row, col;
getmaxyx(w, row, col);
const string msg = "Light client";
mvprintw(0, (col-static_cast<int>(msg.length())), msg.c_str());
refresh();
}