From ade963f35a7a1c1cc43921f8e072382b10750fa9 Mon Sep 17 00:00:00 2001 From: somebody_master Date: Wed, 12 May 2021 10:58:15 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adir=20t=C3=ADtulo=20a=20CpuMon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: somebody_master --- include/cpu_mon.hpp | 1 + include/idiomas/en.hpp | 1 + include/idiomas/es.hpp | 1 + include/idiomas/gl.hpp | 1 + include/textos.hpp | 1 + include/ui.hpp | 2 +- src/cpu_mon.cpp | 3 ++- src/textos.cpp | 5 +++++ src/ui.cpp | 4 +++- 9 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/cpu_mon.hpp b/include/cpu_mon.hpp index ae3b138..36634b2 100644 --- a/include/cpu_mon.hpp +++ b/include/cpu_mon.hpp @@ -1,3 +1,4 @@ +#include "textos.hpp" #include "ui.hpp" #include #include diff --git a/include/idiomas/en.hpp b/include/idiomas/en.hpp index 5b0189a..f68e536 100755 --- a/include/idiomas/en.hpp +++ b/include/idiomas/en.hpp @@ -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_2 = "Do not edit manually without knowing what you do"; +const extern std::string monitorTitulo = "CPU Monitor"; } // namespace en #endif // __EN_HPP_ diff --git a/include/idiomas/es.hpp b/include/idiomas/es.hpp index 54cb555..0d0dba5 100755 --- a/include/idiomas/es.hpp +++ b/include/idiomas/es.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_2 = "No editar manualmente sin saber lo que se hace"; +const extern std::string monitorTitulo = "Monitor CPU"; } // namespace es #endif // __ES_HPP_ diff --git a/include/idiomas/gl.hpp b/include/idiomas/gl.hpp index 3c3ad7c..4643f80 100755 --- a/include/idiomas/gl.hpp +++ b/include/idiomas/gl.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_2 = "Non editar manualmente sin saber o que se fai"; +const extern std::string monitorTitulo = "Monitor CPU"; } // namespace gl #endif // __GL_HPP_ diff --git a/include/textos.hpp b/include/textos.hpp index 34629eb..540e583 100755 --- a/include/textos.hpp +++ b/include/textos.hpp @@ -24,6 +24,7 @@ extern std::string g_confHilosError; extern std::string g_confTiempoError; extern std::string g_confArchText_1; extern std::string g_confArchText_2; +extern std::string g_monitorTitulo; void inicializarIdioma(std::string idioma); } // namespace txt diff --git a/include/ui.hpp b/include/ui.hpp index 0a3d72e..5a58070 100755 --- a/include/ui.hpp +++ b/include/ui.hpp @@ -29,7 +29,7 @@ void showCenterMensaje(std::vector *mensaje, void showTopTitle(const std::vector *titulo); void mostrarVentana(WINDOW *ventana, std::vector *texto, - int *ancho, uint8_t *sectores); + int *ancho, uint8_t *sectores, std::string *tituloVentana); void borrarVentana(WINDOW *ventana); diff --git a/src/cpu_mon.cpp b/src/cpu_mon.cpp index 0e1ff21..dc9b1c9 100644 --- a/src/cpu_mon.cpp +++ b/src/cpu_mon.cpp @@ -125,7 +125,8 @@ void CpuMon::obtenerUsoCPU(const std::vector &entradas1, 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) { diff --git a/src/textos.cpp b/src/textos.cpp index 00a258f..878e687 100755 --- a/src/textos.cpp +++ b/src/textos.cpp @@ -24,6 +24,7 @@ std::string txt::g_confHilosError; std::string txt::g_confTiempoError; std::string txt::g_confArchText_1; std::string txt::g_confArchText_2; +std::string txt::g_monitorTitulo; void txt::inicializarIdioma(std::string idioma) { idioma = idioma.substr(0, idioma.find("_")); @@ -50,6 +51,7 @@ void txt::inicializarIdioma(std::string idioma) { txt::g_confTiempoError = confTiempoError; txt::g_confArchText_1 = confArchText_1; txt::g_confArchText_2 = confArchText_2; + txt::g_monitorTitulo = monitorTitulo; } else if (idioma == "es") { using namespace es; txt::g_noColor = noColor; @@ -73,6 +75,7 @@ void txt::inicializarIdioma(std::string idioma) { txt::g_confTiempoError = confTiempoError; txt::g_confArchText_1 = confArchText_1; txt::g_confArchText_2 = confArchText_2; + txt::g_monitorTitulo = monitorTitulo; } else if (idioma == "en") { using namespace en; txt::g_noColor = noColor; @@ -96,6 +99,7 @@ void txt::inicializarIdioma(std::string idioma) { txt::g_confTiempoError = confTiempoError; txt::g_confArchText_1 = confArchText_1; txt::g_confArchText_2 = confArchText_2; + txt::g_monitorTitulo = monitorTitulo; } else { using namespace en; txt::g_noColor = noColor; @@ -119,5 +123,6 @@ void txt::inicializarIdioma(std::string idioma) { txt::g_confTiempoError = confTiempoError; txt::g_confArchText_1 = confArchText_1; txt::g_confArchText_2 = confArchText_2; + txt::g_monitorTitulo = monitorTitulo; } } diff --git a/src/ui.cpp b/src/ui.cpp index 8377c38..7e484eb 100755 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -143,9 +143,11 @@ void ui::borrarVentana(WINDOW *ventana) { } void ui::mostrarVentana(WINDOW *ventana, std::vector *texto, - int *ancho, uint8_t *sectores) { + int *ancho, uint8_t *sectores, + std::string *tituloVentana) { attron(A_BOLD); box(ventana, 0, 0); + mvwprintw(ventana, 0, 1, tituloVentana->c_str()); for (uint8_t i = 1; i < *sectores + 1; i++) { for (uint8_t j = 0; j < texto->size(); j++) { mvwprintw(ventana, j + 1, *ancho - *ancho / i + 1, texto->at(j).c_str());