Implementación de la configuración de tiempo e hilos

Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
Somebody Master 2020-10-28 00:09:43 +01:00
parent 13f99f922b
commit 2b421d4935
Signed by: somebody_master
GPG Key ID: 78315CFDF0B25505

View File

@ -84,7 +84,7 @@ void userInterface(const int8_t *num_menu, vector<string> *mensaje, Config *conf
case PRIMER_INICIO: {
vector<string> textos_init = {"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 de ejecución\t> "};
ui::showTopTitle(&TITULO_PRINCIPAL);
vector<string> entrada = ui::showCentralInputBox(&textos_init, &CONFIGURAR_TODO, &elemens, TITULO_PRINCIPAL.size());
Config config2 = Config(atoi(entrada[0].c_str()), entrada[1]);
@ -95,12 +95,22 @@ void userInterface(const int8_t *num_menu, vector<string> *mensaje, Config *conf
}
case CONFIGURAR_HILOS: {
/*TODO*/
vector<string> textos_init = {"Número de hilos actuales: " + to_string(config->getNumHilos()), "", ""};
vector<string> elemens = {"- Número de hilos\t> "};
vector<string> entrada = ui::showCentralInputBox(&textos_init, &CONFIGURAR_TODO, &elemens, TITULO_PRINCIPAL.size());
config->setNumHilos(atoi(entrada[0].c_str()));
cf::saveConfig(config);
userInterface(&MENU_CONFIGURACION, mensaje, config);
break;
}
case CONFIGURAR_TIEMPO: {
/*TODO*/
vector<string> textos_init = {"Tiempo actual" + config->getTiempo(), "", ""};
vector<string> elemens = {"- Tiempo de ejecución\t> "};
vector<string> entrada = ui::showCentralInputBox(&textos_init, &CONFIGURAR_TODO, &elemens, TITULO_PRINCIPAL.size());
config->setTiempo(entrada[0]);
cf::saveConfig(config);
userInterface(&MENU_CONFIGURACION, mensaje, config);
break;
}
@ -170,12 +180,12 @@ void showMenu(vector<string> *menu_elems, const int8_t *num_menu, Config *config
for (int j = menu_elems->at(i).length(); j < (ui::g_menuWith - 4); j++) {
menu_elems->at(i).append(" ");
}
/*
Por algún motivo los acentos y tildes cuentan como un caracter
aparte, por lo que hay que añadir un espacio extra en esos
casos. De momento la mejor solución es leer la cadena cada dos
caracteres y ver si cuadra con alguna de las siguientes letras.
*/
// Por algún motivo los acentos y tildes cuentan como un caracter
// aparte, por lo que hay que añadir un espacio extra en esos
// casos. De momento la mejor solución es leer la cadena cada dos
// caracteres y ver si cuadra con alguna de las siguientes letras.
for (int j = 0; j < menu_elems->at(i).length(); j++) {
if (menu_elems->at(i).substr(j, 2).compare("á") == 0 |
menu_elems->at(i).substr(j, 2).compare("é") == 0 |