Añadir título a CpuMon
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
		| @@ -1,3 +1,4 @@ | |||||||
|  | #include "textos.hpp" | ||||||
| #include "ui.hpp" | #include "ui.hpp" | ||||||
| #include <string> | #include <string> | ||||||
| #include <vector> | #include <vector> | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ const extern std::string confTiempoError = "The time format must be HH:mm:ss"; | |||||||
| const extern std::string confArchText_1 = "Autogenerated file by Stress_UI"; | const extern std::string confArchText_1 = "Autogenerated file by Stress_UI"; | ||||||
| const extern std::string confArchText_2 = | const extern std::string confArchText_2 = | ||||||
|     "Do not edit manually without knowing what you do"; |     "Do not edit manually without knowing what you do"; | ||||||
|  | const extern std::string monitorTitulo = "CPU Monitor"; | ||||||
| } // namespace en | } // namespace en | ||||||
|  |  | ||||||
| #endif // __EN_HPP_ | #endif // __EN_HPP_ | ||||||
|   | |||||||
| @@ -27,6 +27,7 @@ const extern std::string confTiempoError = | |||||||
| const extern std::string confArchText_1 = "Archivo autogenerado por Stress_UI"; | const extern std::string confArchText_1 = "Archivo autogenerado por Stress_UI"; | ||||||
| const extern std::string confArchText_2 = | const extern std::string confArchText_2 = | ||||||
|     "No editar manualmente sin saber lo que se hace"; |     "No editar manualmente sin saber lo que se hace"; | ||||||
|  | const extern std::string monitorTitulo = "Monitor CPU"; | ||||||
| } // namespace es | } // namespace es | ||||||
|  |  | ||||||
| #endif // __ES_HPP_ | #endif // __ES_HPP_ | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ const extern std::string confTiempoError = | |||||||
| const extern std::string confArchText_1 = "Arquivo autoxenerado por Stress_UI"; | const extern std::string confArchText_1 = "Arquivo autoxenerado por Stress_UI"; | ||||||
| const extern std::string confArchText_2 = | const extern std::string confArchText_2 = | ||||||
|     "Non editar manualmente sin saber o que se fai"; |     "Non editar manualmente sin saber o que se fai"; | ||||||
|  | const extern std::string monitorTitulo = "Monitor CPU"; | ||||||
| } // namespace gl | } // namespace gl | ||||||
|  |  | ||||||
| #endif // __GL_HPP_ | #endif // __GL_HPP_ | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ extern std::string g_confHilosError; | |||||||
| extern std::string g_confTiempoError; | extern std::string g_confTiempoError; | ||||||
| extern std::string g_confArchText_1; | extern std::string g_confArchText_1; | ||||||
| extern std::string g_confArchText_2; | extern std::string g_confArchText_2; | ||||||
|  | extern std::string g_monitorTitulo; | ||||||
|  |  | ||||||
| void inicializarIdioma(std::string idioma); | void inicializarIdioma(std::string idioma); | ||||||
| } // namespace txt | } // namespace txt | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ void showCenterMensaje(std::vector<std::string> *mensaje, | |||||||
| void showTopTitle(const std::vector<std::string> *titulo); | void showTopTitle(const std::vector<std::string> *titulo); | ||||||
|  |  | ||||||
| void mostrarVentana(WINDOW *ventana, std::vector<std::string> *texto, | void mostrarVentana(WINDOW *ventana, std::vector<std::string> *texto, | ||||||
|                     int *ancho, uint8_t *sectores); |                     int *ancho, uint8_t *sectores, std::string *tituloVentana); | ||||||
|  |  | ||||||
| void borrarVentana(WINDOW *ventana); | void borrarVentana(WINDOW *ventana); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -125,7 +125,8 @@ void CpuMon::obtenerUsoCPU(const std::vector<DatosCPU> &entradas1, | |||||||
|     salida[i - 1] = CpuMon::obtenerBarra(&usoCPU, e1.cpu); |     salida[i - 1] = CpuMon::obtenerBarra(&usoCPU, e1.cpu); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   ui::mostrarVentana(ventanaMonitorCPU, &salida, &columnas, &num_sectores); |   ui::mostrarVentana(ventanaMonitorCPU, &salida, &columnas, &num_sectores, | ||||||
|  |                      &txt::g_monitorTitulo); | ||||||
| } | } | ||||||
|  |  | ||||||
| std::string CpuMon::obtenerBarra(float *porcentaje, std::string cpu) { | std::string CpuMon::obtenerBarra(float *porcentaje, std::string cpu) { | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ std::string txt::g_confHilosError; | |||||||
| std::string txt::g_confTiempoError; | std::string txt::g_confTiempoError; | ||||||
| std::string txt::g_confArchText_1; | std::string txt::g_confArchText_1; | ||||||
| std::string txt::g_confArchText_2; | std::string txt::g_confArchText_2; | ||||||
|  | std::string txt::g_monitorTitulo; | ||||||
|  |  | ||||||
| void txt::inicializarIdioma(std::string idioma) { | void txt::inicializarIdioma(std::string idioma) { | ||||||
|   idioma = idioma.substr(0, idioma.find("_")); |   idioma = idioma.substr(0, idioma.find("_")); | ||||||
| @@ -50,6 +51,7 @@ void txt::inicializarIdioma(std::string idioma) { | |||||||
|     txt::g_confTiempoError = confTiempoError; |     txt::g_confTiempoError = confTiempoError; | ||||||
|     txt::g_confArchText_1 = confArchText_1; |     txt::g_confArchText_1 = confArchText_1; | ||||||
|     txt::g_confArchText_2 = confArchText_2; |     txt::g_confArchText_2 = confArchText_2; | ||||||
|  |     txt::g_monitorTitulo = monitorTitulo; | ||||||
|   } else if (idioma == "es") { |   } else if (idioma == "es") { | ||||||
|     using namespace es; |     using namespace es; | ||||||
|     txt::g_noColor = noColor; |     txt::g_noColor = noColor; | ||||||
| @@ -73,6 +75,7 @@ void txt::inicializarIdioma(std::string idioma) { | |||||||
|     txt::g_confTiempoError = confTiempoError; |     txt::g_confTiempoError = confTiempoError; | ||||||
|     txt::g_confArchText_1 = confArchText_1; |     txt::g_confArchText_1 = confArchText_1; | ||||||
|     txt::g_confArchText_2 = confArchText_2; |     txt::g_confArchText_2 = confArchText_2; | ||||||
|  |     txt::g_monitorTitulo = monitorTitulo; | ||||||
|   } else if (idioma == "en") { |   } else if (idioma == "en") { | ||||||
|     using namespace en; |     using namespace en; | ||||||
|     txt::g_noColor = noColor; |     txt::g_noColor = noColor; | ||||||
| @@ -96,6 +99,7 @@ void txt::inicializarIdioma(std::string idioma) { | |||||||
|     txt::g_confTiempoError = confTiempoError; |     txt::g_confTiempoError = confTiempoError; | ||||||
|     txt::g_confArchText_1 = confArchText_1; |     txt::g_confArchText_1 = confArchText_1; | ||||||
|     txt::g_confArchText_2 = confArchText_2; |     txt::g_confArchText_2 = confArchText_2; | ||||||
|  |     txt::g_monitorTitulo = monitorTitulo; | ||||||
|   } else { |   } else { | ||||||
|     using namespace en; |     using namespace en; | ||||||
|     txt::g_noColor = noColor; |     txt::g_noColor = noColor; | ||||||
| @@ -119,5 +123,6 @@ void txt::inicializarIdioma(std::string idioma) { | |||||||
|     txt::g_confTiempoError = confTiempoError; |     txt::g_confTiempoError = confTiempoError; | ||||||
|     txt::g_confArchText_1 = confArchText_1; |     txt::g_confArchText_1 = confArchText_1; | ||||||
|     txt::g_confArchText_2 = confArchText_2; |     txt::g_confArchText_2 = confArchText_2; | ||||||
|  |     txt::g_monitorTitulo = monitorTitulo; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -143,9 +143,11 @@ void ui::borrarVentana(WINDOW *ventana) { | |||||||
| } | } | ||||||
|  |  | ||||||
| void ui::mostrarVentana(WINDOW *ventana, std::vector<std::string> *texto, | void ui::mostrarVentana(WINDOW *ventana, std::vector<std::string> *texto, | ||||||
|                         int *ancho, uint8_t *sectores) { |                         int *ancho, uint8_t *sectores, | ||||||
|  |                         std::string *tituloVentana) { | ||||||
|   attron(A_BOLD); |   attron(A_BOLD); | ||||||
|   box(ventana, 0, 0); |   box(ventana, 0, 0); | ||||||
|  |   mvwprintw(ventana, 0, 1, tituloVentana->c_str()); | ||||||
|   for (uint8_t i = 1; i < *sectores + 1; i++) { |   for (uint8_t i = 1; i < *sectores + 1; i++) { | ||||||
|     for (uint8_t j = 0; j < texto->size(); j++) { |     for (uint8_t j = 0; j < texto->size(); j++) { | ||||||
|       mvwprintw(ventana, j + 1, *ancho - *ancho / i + 1, texto->at(j).c_str()); |       mvwprintw(ventana, j + 1, *ancho - *ancho / i + 1, texto->at(j).c_str()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user