Dar formato al código
This commit is contained in:
31
src/ui.cpp
31
src/ui.cpp
@@ -51,11 +51,17 @@ void ui::showCenterMensaje(vector<string> *mensaje, const int8_t *menu_color) {
|
||||
g_mensaje = false;
|
||||
}
|
||||
|
||||
vector<string> ui::showCentralInputBox(std::vector<std::string> *textos, const int8_t *num_box, std::vector<std::string> *elems, const int8_t *color_error) {
|
||||
vector<string> ui::showCentralInputBox(std::vector<std::string> *textos,
|
||||
const int8_t *num_box,
|
||||
std::vector<std::string> *elems,
|
||||
const int8_t *color_error) {
|
||||
return ui::showCentralInputBox(textos, num_box, elems, 0, color_error);
|
||||
}
|
||||
|
||||
vector<string> ui::showCentralInputBox(vector<string> *textos, const int8_t *num_box, vector<string> *elems, long title_size, const int8_t *color_error) {
|
||||
vector<string> ui::showCentralInputBox(vector<string> *textos,
|
||||
const int8_t *num_box,
|
||||
vector<string> *elems, long title_size,
|
||||
const int8_t *color_error) {
|
||||
vector<string> entrada;
|
||||
int start_ver_window = 1;
|
||||
|
||||
@@ -64,7 +70,8 @@ vector<string> ui::showCentralInputBox(vector<string> *textos, const int8_t *num
|
||||
}
|
||||
|
||||
int height = ui::g_maxLines - (title_size + 4) - 1;
|
||||
WINDOW *centralBOX = newwin(height, ui::g_maxCols - ui::g_menuWith - 4, start_ver_window, ui::g_menuWith + 2);
|
||||
WINDOW *centralBOX = newwin(height, ui::g_maxCols - ui::g_menuWith - 4,
|
||||
start_ver_window, ui::g_menuWith + 2);
|
||||
box(centralBOX, 0, 0);
|
||||
|
||||
for (int i = 0; i < textos->size(); i++) {
|
||||
@@ -83,24 +90,27 @@ vector<string> ui::showCentralInputBox(vector<string> *textos, const int8_t *num
|
||||
mvwprintw(centralBOX, i * 2 + 1 + textos->size(), 1, elems->at(i).c_str());
|
||||
wrefresh(centralBOX);
|
||||
wgetnstr(centralBOX, input, 10);
|
||||
if (elems->at(i) == txt::g_confHilosInput){
|
||||
if (elems->at(i) == txt::g_confHilosInput) {
|
||||
regex integer_expr("(\\+|-)?[[:digit:]]+");
|
||||
if(regex_match(input, integer_expr)){
|
||||
if (regex_match(input, integer_expr)) {
|
||||
entrada.push_back(input);
|
||||
} else {
|
||||
mvwprintw(centralBOX, i * 2 + 1 + textos->size(), 1, cleaner.c_str());
|
||||
wattron(centralBOX, COLOR_PAIR(*color_error));
|
||||
mvwprintw(centralBOX, i * 2 + textos->size(), 1, txt::g_confHilosError.c_str());
|
||||
mvwprintw(centralBOX, i * 2 + textos->size(), 1,
|
||||
txt::g_confHilosError.c_str());
|
||||
wattroff(centralBOX, COLOR_PAIR(*color_error));
|
||||
i--;
|
||||
}
|
||||
} else if(elems->at(i) == txt::g_confTiempoInput){
|
||||
if(regex_match(input,regex("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$"))){
|
||||
} else if (elems->at(i) == txt::g_confTiempoInput) {
|
||||
if (regex_match(input,
|
||||
regex("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$"))) {
|
||||
entrada.push_back(input);
|
||||
} else {
|
||||
mvwprintw(centralBOX, i * 2 + 1 + textos->size(), 1, cleaner.c_str());
|
||||
wattron(centralBOX, COLOR_PAIR(*color_error));
|
||||
mvwprintw(centralBOX, i * 2 + textos->size(), 1, txt::g_confTiempoError.c_str());
|
||||
mvwprintw(centralBOX, i * 2 + textos->size(), 1,
|
||||
txt::g_confTiempoError.c_str());
|
||||
wattroff(centralBOX, COLOR_PAIR(*color_error));
|
||||
i--;
|
||||
}
|
||||
@@ -119,7 +129,8 @@ void ui::showTopTitle(const vector<string> *titulo) {
|
||||
attron(A_BOLD);
|
||||
box(topTitleWin, 0, 0);
|
||||
for (int i = 0; i < height; i++) {
|
||||
mvwprintw(topTitleWin, i + 1, (g_maxCols - 4 - titulo->at(i).length()) / 2, titulo->at(i).c_str());
|
||||
mvwprintw(topTitleWin, i + 1, (g_maxCols - 4 - titulo->at(i).length()) / 2,
|
||||
titulo->at(i).c_str());
|
||||
}
|
||||
attroff(A_BOLD);
|
||||
wrefresh(topTitleWin);
|
||||
|
||||
Reference in New Issue
Block a user