diff --git a/ComunicTerm.pro b/ComunicTerm.pro index 8d23111..04a3ef8 100644 --- a/ComunicTerm.pro +++ b/ComunicTerm.pro @@ -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 diff --git a/loginscreen.cpp b/loginscreen.cpp index f717cce..36aaef1 100644 --- a/loginscreen.cpp +++ b/loginscreen.cpp @@ -5,6 +5,7 @@ #include #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(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:"); diff --git a/ui_utils.cpp b/ui_utils.cpp new file mode 100644 index 0000000..4f2345d --- /dev/null +++ b/ui_utils.cpp @@ -0,0 +1,23 @@ +#include + +#include + +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(msg.length())), msg.c_str()); + refresh(); + + + + +}