Re-factorización del código
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
parent
b0aa7eea06
commit
e2b7ac2434
@ -4,8 +4,7 @@
|
|||||||
#ifndef __CONFIG_FILE_HPP_
|
#ifndef __CONFIG_FILE_HPP_
|
||||||
#define __CONFIG_FILE_HPP_
|
#define __CONFIG_FILE_HPP_
|
||||||
namespace cf {
|
namespace cf {
|
||||||
const std::string g_configFile =
|
const std::string g_configFile = std::string(getenv("HOME")) + "/.config/stressUI.cfg";
|
||||||
std::string(getenv("HOME")) + "/.config/stressUI.cfg";
|
|
||||||
Config openConfig();
|
Config openConfig();
|
||||||
void closeConfig(Config *config);
|
void closeConfig(Config *config);
|
||||||
std::string getLine(std::ifstream *file);
|
std::string getLine(std::ifstream *file);
|
||||||
|
@ -5,21 +5,15 @@
|
|||||||
#define __UI_HPP_
|
#define __UI_HPP_
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
extern int g_maxLines, g_maxCols, g_begCol, g_begLine, g_menuWith;
|
extern int g_maxLines, g_maxCols, g_begCol, g_begLine, g_menuWith;
|
||||||
extern bool g_mensaje;
|
extern bool g_mensaje;
|
||||||
|
|
||||||
int8_t initUI(const int8_t *menu_principal, const int8_t *menu_error);
|
int8_t initUI(const int8_t *menu_principal, const int8_t *menu_error);
|
||||||
|
|
||||||
void closeUI();
|
void closeUI();
|
||||||
void showCentralInputBox(std::vector<std::string> *textos,
|
void showCentralInputBox(std::vector<std::string> *textos, const int8_t *num_box, std::vector<std::string> *elems);
|
||||||
const int8_t *num_box,
|
std::vector<std::string> showCentralInputBox(std::vector<std::string> *textos, const int8_t *num_box, std::vector<std::string> *elems, long title_size);
|
||||||
std::vector<std::string> *elems);
|
void showCenterMensaje(std::vector<std::string> *mensaje, const int8_t *menu_color);
|
||||||
std::vector<std::string> showCentralInputBox(std::vector<std::string> *textos,
|
|
||||||
const int8_t *num_box,
|
|
||||||
std::vector<std::string> *elems,
|
|
||||||
long title_size);
|
|
||||||
void showCenterMensaje(std::vector<std::string> *mensaje,
|
|
||||||
const int8_t *menu_color);
|
|
||||||
void showTopTitle(const std::vector<std::string> *titulo);
|
void showTopTitle(const std::vector<std::string> *titulo);
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
#endif // __UI_HPP_
|
#endif // __UI_HPP_
|
||||||
|
@ -9,7 +9,18 @@ Config::Config(int8_t numHilos, std::string tiempo) {
|
|||||||
// delete numHilos;
|
// delete numHilos;
|
||||||
// delete tiempo;
|
// delete tiempo;
|
||||||
// }
|
// }
|
||||||
int8_t Config::getNumHilos() { return *numHilos; }
|
int8_t Config::getNumHilos() {
|
||||||
std::string Config::getTiempo() { return *tiempo; }
|
return *numHilos;
|
||||||
void Config::setNumHilos(int8_t numHilos) { Config::numHilos = &numHilos; }
|
}
|
||||||
void Config::setTiempo(std::string tiempo) { Config::tiempo = &tiempo; }
|
|
||||||
|
std::string Config::getTiempo() {
|
||||||
|
return *tiempo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Config::setNumHilos(int8_t numHilos) {
|
||||||
|
Config::numHilos = &numHilos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Config::setTiempo(std::string tiempo) {
|
||||||
|
Config::tiempo = &tiempo;
|
||||||
|
}
|
||||||
|
@ -48,68 +48,28 @@ std::string cf::getLine(std::ifstream *file) {
|
|||||||
|
|
||||||
void cf::saveConfig(Config *config) {
|
void cf::saveConfig(Config *config) {
|
||||||
std::ofstream file(g_configFile);
|
std::ofstream file(g_configFile);
|
||||||
file << "####################################################################"
|
file << "#######################################################################" << std::endl;
|
||||||
"###"
|
file << "# + + + + #" << std::endl;
|
||||||
<< std::endl;
|
file << "# + + + #" << std::endl;
|
||||||
file << "# + + + + "
|
file << "# + + #" << std::endl;
|
||||||
" #"
|
file << "# \\ / #" << std::endl;
|
||||||
<< std::endl;
|
file << "# + _ - _+_ - ___ #" << std::endl;
|
||||||
file << "# + + + "
|
file << "# _=. .:. /=\\ _|===|_ || ::| #" << std::endl;
|
||||||
" #"
|
file << "# | | _|. | | | | | | __===_ -=- || ::| #" << std::endl;
|
||||||
<< std::endl;
|
file << "# |==| | | __ |.:.| /\\| | :.| | | | .|| : ||| ::| #" << std::endl;
|
||||||
file << "# + + "
|
file << "# | |- |.:|_|. :__ |.: |--|==| | .| |_ | . |. ||. ||| :.| #" << std::endl;
|
||||||
" #"
|
file << "# __|. | |_|. | |.|...||---| |==| | | | |_--. || |||. | #" << std::endl;
|
||||||
<< std::endl;
|
file << "# | | | |. | | |::.|| :.| |==| | . : |=|===| :|| . ||| .| #" << std::endl;
|
||||||
file << "# \\ / "
|
file << "# |:.| .| | | | |:.:|| . | |==| | |=|===| . | | | | #" << std::endl;
|
||||||
" #"
|
file << "# | | | | | : . | ; ; | #" << std::endl;
|
||||||
<< std::endl;
|
file << "# : : . . . : #" << std::endl;
|
||||||
file << "# + _ - _+_ - "
|
file << "# #" << std::endl;
|
||||||
"___ #"
|
file << "# Archivo autogenerado por Stress_UI #" << std::endl;
|
||||||
<< std::endl;
|
file << "# No editar manualmente sin saber lo que se hace #" << std::endl;
|
||||||
file << "# _=. .:. /=\\ _|===|_ || "
|
file << "#######################################################################" << std::endl;
|
||||||
"::| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# | | _|. | | | | | | __===_ -=- || "
|
|
||||||
"::| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# |==| | | __ |.:.| /\\| | :.| | | | .|| : ||| "
|
|
||||||
"::| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# | |- |.:|_|. :__ |.: |--|==| | .| |_ | . |. ||. ||| "
|
|
||||||
":.| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# __|. | |_|. | |.|...||---| |==| | | | |_--. || |||. "
|
|
||||||
"| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# | | | |. | | |::.|| :.| |==| | . : |=|===| :|| . ||| "
|
|
||||||
".| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# |:.| .| | | | |:.:|| . | |==| | |=|===| . | | | "
|
|
||||||
"| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# | | | | | : . | ; ; "
|
|
||||||
"| #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# : : . . . "
|
|
||||||
": #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# "
|
|
||||||
" #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# Archivo autogenerado por Stress_UI "
|
|
||||||
" #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "# No editar manualmente sin saber lo que se hace "
|
|
||||||
" #"
|
|
||||||
<< std::endl;
|
|
||||||
file << "####################################################################"
|
|
||||||
"###"
|
|
||||||
<< std::endl;
|
|
||||||
file << std::endl;
|
file << std::endl;
|
||||||
file << "Número de hilos\t\t= " << std::to_string(config->getNumHilos());
|
file << "Número de hilos\t\t= " << std::to_string(config->getNumHilos());
|
||||||
file << std::endl;
|
file << std::endl;
|
||||||
file << "Tiempo de ejecución\t= " << config->getTiempo();
|
file << "Tiempo de ejecución\t= " << config->getTiempo();
|
||||||
// std::string str = "shit";
|
|
||||||
// file << str;
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
68
src/main.cpp
68
src/main.cpp
@ -22,26 +22,19 @@ const int8_t MENU_TITULO = 9;
|
|||||||
const int8_t PRIMER_INICIO = 10;
|
const int8_t PRIMER_INICIO = 10;
|
||||||
|
|
||||||
const vector<string> TITULO_PRINCIPAL = {
|
const vector<string> TITULO_PRINCIPAL = {
|
||||||
"____ ___ __ __ _____ ____ ___ ______ __ ____ _____ ______ "
|
"____ ___ __ __ _____ ____ ___ ______ __ ____ _____ ______ _______ ____ ",
|
||||||
" _______ ____ ",
|
"/ ___| / _ \\| \\/ | ____| __ ) / _ \\| _ \\ \\ / / / ___|| ____| _ \\ \\ / / ____| _ \\ ",
|
||||||
"/ ___| / _ \\| \\/ | ____| __ ) / _ \\| _ \\ \\ / / / ___|| ____| "
|
"\\___ \\| | | | |\\/| | _| | _ \\| | | | | | \\ V / \\___ \\| _| | |_) \\ \\ / /| _| | |_) |",
|
||||||
"_ \\ \\ / / ____| _ \\ ",
|
" ___) | |_| | | | | |___| |_) | |_| | |_| || | ___) | |___| _ < \\ V / | |___| _ < ",
|
||||||
"\\___ \\| | | | |\\/| | _| | _ \\| | | | | | \\ V / \\___ \\| _| "
|
"|____/ \\___/|_| |_|_____|____/ \\___/|____/ |_| |____/|_____|_| \\_\\ \\_/ |_____|_| \\_\\",
|
||||||
"| |_) \\ \\ / /| _| | |_) |",
|
|
||||||
" ___) | |_| | | | | |___| |_) | |_| | |_| || | ___) | |___| _ < "
|
|
||||||
"\\ V / | |___| _ < ",
|
|
||||||
"|____/ \\___/|_| |_|_____|____/ \\___/|____/ |_| |____/|_____|_| "
|
|
||||||
"\\_\\ \\_/ |_____|_| \\_\\",
|
|
||||||
"",
|
"",
|
||||||
"_______________________________________________________________________",
|
"_______________________________________________________________________",
|
||||||
};
|
};
|
||||||
|
|
||||||
void userInterface(const int8_t *menu, Config *config);
|
void userInterface(const int8_t *menu, Config *config);
|
||||||
void userInterface(const int8_t *menu, vector<string> *mensaje, Config *config);
|
void userInterface(const int8_t *menu, vector<string> *mensaje, Config *config);
|
||||||
void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
void showMenu(vector<string> *menu_elems, const int8_t *num_menu, vector<string> *mensaje, Config *config);
|
||||||
vector<string> *mensaje, Config *config);
|
void showMenu(vector<string> *menu_elems, const int8_t *num_menu, Config *config);
|
||||||
void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
|
||||||
Config *config);
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
// locale::global(locale("es_ES.utf8"));
|
// locale::global(locale("es_ES.utf8"));
|
||||||
@ -64,32 +57,25 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void userInterface(const int8_t *menu, Config *config) {
|
void userInterface(const int8_t *menu, Config *config) {
|
||||||
/*int8_t menu_num = inputToInt(menu);*/
|
|
||||||
vector<string> dummy = {""};
|
vector<string> dummy = {""};
|
||||||
userInterface(menu, &dummy, config);
|
userInterface(menu, &dummy, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void userInterface(const int8_t *num_menu, vector<string> *mensaje,
|
void userInterface(const int8_t *num_menu, vector<string> *mensaje, Config *config) {
|
||||||
Config *config) {
|
|
||||||
switch (*num_menu) {
|
switch (*num_menu) {
|
||||||
|
|
||||||
case CONFIGURAR_MENU_PRINCIPAL:
|
case CONFIGURAR_MENU_PRINCIPAL:
|
||||||
case MENU_PRINCIPAL: {
|
case MENU_PRINCIPAL: {
|
||||||
vector<string> elem_menu = {"- Iniciar Stress Test", "- Configurar",
|
vector<string> elem_menu = {"- Iniciar Stress Test", "- Configurar", "- Salir"};
|
||||||
"- Salir"};
|
|
||||||
showMenu(&elem_menu, &MENU_PRINCIPAL, mensaje, config);
|
showMenu(&elem_menu, &MENU_PRINCIPAL, mensaje, config);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MENU_INICIAR_STRESS: {
|
case MENU_INICIAR_STRESS: {
|
||||||
/*TODO*/
|
/*TODO*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MENU_CONFIGURACION: {
|
case MENU_CONFIGURACION: {
|
||||||
vector<string> elem_menu = {"- Configurar todo", "- Número de hilos",
|
vector<string> elem_menu = {"- Configurar todo", "- Número de hilos", "- Tiempo", "- Menú principal"};
|
||||||
"- Tiempo", "- Menú principal"};
|
|
||||||
|
|
||||||
showMenu(&elem_menu, num_menu, mensaje, config);
|
showMenu(&elem_menu, num_menu, mensaje, config);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -97,12 +83,10 @@ void userInterface(const int8_t *num_menu, vector<string> *mensaje,
|
|||||||
case CONFIGURAR_TODO:
|
case CONFIGURAR_TODO:
|
||||||
case PRIMER_INICIO: {
|
case PRIMER_INICIO: {
|
||||||
|
|
||||||
vector<string> textos_init = {
|
vector<string> textos_init = {"Toda la configuración se escribirá en " + cf::g_configFile, "", ""};
|
||||||
"Toda la configuración se escribirá en " + cf::g_configFile, "", ""};
|
|
||||||
vector<string> elemens = {"- Número de hilos\t> ", "- Tiempo\t\t> "};
|
vector<string> elemens = {"- Número de hilos\t> ", "- Tiempo\t\t> "};
|
||||||
ui::showTopTitle(&TITULO_PRINCIPAL);
|
ui::showTopTitle(&TITULO_PRINCIPAL);
|
||||||
vector<string> entrada = ui::showCentralInputBox(
|
vector<string> entrada = ui::showCentralInputBox(&textos_init, &CONFIGURAR_TODO, &elemens, TITULO_PRINCIPAL.size());
|
||||||
&textos_init, &CONFIGURAR_TODO, &elemens, TITULO_PRINCIPAL.size());
|
|
||||||
Config config2 = Config(atoi(entrada[0].c_str()), entrada[1]);
|
Config config2 = Config(atoi(entrada[0].c_str()), entrada[1]);
|
||||||
config = &config2;
|
config = &config2;
|
||||||
cf::saveConfig(config);
|
cf::saveConfig(config);
|
||||||
@ -111,14 +95,17 @@ void userInterface(const int8_t *num_menu, vector<string> *mensaje,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case CONFIGURAR_HILOS: {
|
case CONFIGURAR_HILOS: {
|
||||||
|
/*TODO*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CONFIGURAR_TIEMPO: {
|
case CONFIGURAR_TIEMPO: {
|
||||||
|
/*TODO*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MENU_TITULO: {
|
case MENU_TITULO: {
|
||||||
|
/*TODO*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,33 +115,26 @@ void userInterface(const int8_t *num_menu, vector<string> *mensaje,
|
|||||||
|
|
||||||
default: {
|
default: {
|
||||||
ui::g_mensaje = true;
|
ui::g_mensaje = true;
|
||||||
*mensaje = {"¿Como has llegado aquí?",
|
*mensaje = {"¿Como has llegado aquí?", "Por si acaso vamos al menú principal"};
|
||||||
"Por si acaso vamos al menú principal"};
|
|
||||||
|
|
||||||
userInterface(&MENU_PRINCIPAL, mensaje, config);
|
userInterface(&MENU_PRINCIPAL, mensaje, config);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
void showMenu(vector<string> *menu_elems, const int8_t *num_menu, vector<string> *mensaje, Config *config) {
|
||||||
vector<string> *mensaje, Config *config) {
|
|
||||||
clear();
|
clear();
|
||||||
if (ui::g_mensaje) {
|
if (ui::g_mensaje) {
|
||||||
ui::showCenterMensaje(mensaje, &MENU_ERROR);
|
ui::showCenterMensaje(mensaje, &MENU_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
showMenu(menu_elems, num_menu, config);
|
showMenu(menu_elems, num_menu, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
void showMenu(vector<string> *menu_elems, const int8_t *num_menu, Config *config) {
|
||||||
Config *config) {
|
|
||||||
size_t height = menu_elems->size();
|
size_t height = menu_elems->size();
|
||||||
|
|
||||||
attron(COLOR_PAIR(MENU_PRINCIPAL));
|
attron(COLOR_PAIR(MENU_PRINCIPAL));
|
||||||
WINDOW *menuwin =
|
WINDOW *menuwin = newwin(height + 2, ui::g_menuWith, TITULO_PRINCIPAL.size() + 4, 2);
|
||||||
// newwin(height + 2, g_maxCols - 4, g_maxLines - height - 3, 2);
|
|
||||||
newwin(height + 2, ui::g_menuWith, TITULO_PRINCIPAL.size() + 4, 2);
|
|
||||||
|
|
||||||
box(menuwin, 0, 0);
|
box(menuwin, 0, 0);
|
||||||
refresh();
|
refresh();
|
||||||
@ -166,6 +146,7 @@ void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
|||||||
|
|
||||||
int choice = 0;
|
int choice = 0;
|
||||||
int8_t highlight = 0;
|
int8_t highlight = 0;
|
||||||
|
|
||||||
switch (*num_menu) {
|
switch (*num_menu) {
|
||||||
|
|
||||||
case MENU_PRINCIPAL: {
|
case MENU_PRINCIPAL: {
|
||||||
@ -178,16 +159,15 @@ void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (true) {
|
|
||||||
|
|
||||||
|
while (true) {
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
if (i == highlight) {
|
if (i == highlight) {
|
||||||
wattron(menuwin, A_REVERSE);
|
wattron(menuwin, A_REVERSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_elems->at(i).length() < (ui::g_menuWith - 4)) {
|
if (menu_elems->at(i).length() < (ui::g_menuWith - 4)) {
|
||||||
for (int j = menu_elems->at(i).length(); j < (ui::g_menuWith - 4);
|
for (int j = menu_elems->at(i).length(); j < (ui::g_menuWith - 4); j++) {
|
||||||
j++) {
|
|
||||||
menu_elems->at(i).append(" ");
|
menu_elems->at(i).append(" ");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -208,6 +188,7 @@ void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
|||||||
menu_elems->at(i).substr(j, 2).compare("Ú") == 0 |
|
menu_elems->at(i).substr(j, 2).compare("Ú") == 0 |
|
||||||
menu_elems->at(i).substr(j, 2).compare("ñ") == 0 |
|
menu_elems->at(i).substr(j, 2).compare("ñ") == 0 |
|
||||||
menu_elems->at(i).substr(j, 2).compare("Ñ") == 0) {
|
menu_elems->at(i).substr(j, 2).compare("Ñ") == 0) {
|
||||||
|
|
||||||
menu_elems->at(i).append(" ");
|
menu_elems->at(i).append(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,14 +202,12 @@ void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
|||||||
choice = wgetch(menuwin);
|
choice = wgetch(menuwin);
|
||||||
|
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
|
|
||||||
case KEY_UP: {
|
case KEY_UP: {
|
||||||
if (highlight > 0) {
|
if (highlight > 0) {
|
||||||
highlight--;
|
highlight--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case KEY_DOWN: {
|
case KEY_DOWN: {
|
||||||
if ((highlight + 1) < height) {
|
if ((highlight + 1) < height) {
|
||||||
highlight++;
|
highlight++;
|
||||||
@ -251,7 +230,6 @@ void showMenu(vector<string> *menu_elems, const int8_t *num_menu,
|
|||||||
highlight++;
|
highlight++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MENU_CONFIGURACION: {
|
case MENU_CONFIGURACION: {
|
||||||
highlight = highlight + 4;
|
highlight = highlight + 4;
|
||||||
break;
|
break;
|
||||||
|
21
src/ui.cpp
21
src/ui.cpp
@ -50,26 +50,20 @@ void ui::showCenterMensaje(vector<string> *mensaje, const int8_t *menu_color) {
|
|||||||
g_mensaje = false;
|
g_mensaje = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui::showCentralInputBox(std::vector<std::string> *textos,
|
void ui::showCentralInputBox(std::vector<std::string> *textos, const int8_t *num_box, std::vector<std::string> *elems) {
|
||||||
const int8_t *num_box,
|
|
||||||
std::vector<std::string> *elems) {
|
|
||||||
ui::showCentralInputBox(textos, num_box, elems, 0);
|
ui::showCentralInputBox(textos, num_box, elems, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> ui::showCentralInputBox(vector<string> *textos,
|
vector<string> ui::showCentralInputBox(vector<string> *textos, const int8_t *num_box, vector<string> *elems, long title_size) {
|
||||||
const int8_t *num_box,
|
|
||||||
vector<string> *elems, long title_size) {
|
|
||||||
|
|
||||||
vector<string> entrada;
|
vector<string> entrada;
|
||||||
|
|
||||||
int start_ver_window = 1;
|
int start_ver_window = 1;
|
||||||
|
|
||||||
if (title_size != 0) {
|
if (title_size != 0) {
|
||||||
start_ver_window = title_size + 4;
|
start_ver_window = title_size + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int height = ui::g_maxLines - (title_size + 4) - 1;
|
int height = ui::g_maxLines - (title_size + 4) - 1;
|
||||||
WINDOW *centralBOX = newwin(height, ui::g_maxCols - ui::g_menuWith - 4,
|
WINDOW *centralBOX = newwin(height, ui::g_maxCols - ui::g_menuWith - 4, start_ver_window, ui::g_menuWith + 2);
|
||||||
start_ver_window, ui::g_menuWith + 2);
|
|
||||||
box(centralBOX, 0, 0);
|
box(centralBOX, 0, 0);
|
||||||
|
|
||||||
for (int i = 0; i < textos->size(); i++) {
|
for (int i = 0; i < textos->size(); i++) {
|
||||||
@ -91,10 +85,6 @@ vector<string> ui::showCentralInputBox(vector<string> *textos,
|
|||||||
noecho();
|
noecho();
|
||||||
cbreak();
|
cbreak();
|
||||||
|
|
||||||
// std::chrono::milliseconds timespan(10000); // or whatever
|
|
||||||
|
|
||||||
// std::this_thread::sleep_for(timespan);
|
|
||||||
|
|
||||||
return entrada;
|
return entrada;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,8 +94,7 @@ void ui::showTopTitle(const vector<string> *titulo) {
|
|||||||
attron(A_BOLD);
|
attron(A_BOLD);
|
||||||
box(topTitleWin, 0, 0);
|
box(topTitleWin, 0, 0);
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
mvwprintw(topTitleWin, i + 1, (g_maxCols - 4 - titulo->at(i).length()) / 2,
|
mvwprintw(topTitleWin, i + 1, (g_maxCols - 4 - titulo->at(i).length()) / 2, titulo->at(i).c_str());
|
||||||
titulo->at(i).c_str());
|
|
||||||
}
|
}
|
||||||
attroff(A_BOLD);
|
attroff(A_BOLD);
|
||||||
wrefresh(topTitleWin);
|
wrefresh(topTitleWin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user