Optimitzat el tema de comparacions i asignacions de strings buits. Mes que optimitzat, ara està mes mono

This commit is contained in:
2024-10-13 14:25:05 +02:00
parent ba7c44ad06
commit 46540ad7c3
16 changed files with 47 additions and 53 deletions

View File

@@ -147,18 +147,19 @@ void Notify::clearFinishedNotifications()
void Notify::showText(std::string text1, std::string text2, int icon)
{
// Cuenta el número de textos a mostrar
const int numTexts = (text1 != "") + (text2 != "");
const int numTexts = !text1.empty() + !text2.empty();
// Si no hay texto, acaba
if (numTexts == 0)
{
return;
}
// Si solo hay un texto, lo coloca en la primera variable
else if (numTexts == 1)
if (numTexts == 1)
{
text1 = text1 + text2;
text2 = "";
text1 += text2;
text2.clear();
}
// Si las notificaciones no se apilan, elimina las anteriores