From 9320b900016cf2bf9b21dd601b92dc2057c2cf50 Mon Sep 17 00:00:00 2001 From: Valentino Orlandi Date: Sat, 3 Feb 2024 17:54:53 +0100 Subject: [PATCH] General improvements --- logdoctor/globals/global_configs.cpp | 5 ++-- logdoctor/globals/global_configs.h | 11 ++++---- .../modules/crapview/modules/filters.cpp | 27 +++++++++---------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/logdoctor/globals/global_configs.cpp b/logdoctor/globals/global_configs.cpp index 1a1ba31b..3e926fe6 100644 --- a/logdoctor/globals/global_configs.cpp +++ b/logdoctor/globals/global_configs.cpp @@ -2,7 +2,8 @@ #include "global_configs.h" -namespace GlobalConfigs { +namespace GlobalConfigs +{ WindowTheme window_theme = WindowTheme::Native; IconsTheme icons_theme = IconsTheme::Auto; @@ -10,4 +11,4 @@ ChartsTheme charts_theme = ChartsTheme::Light; QString icons_set = "light_native"; -} +} // namespace GlobalConfigs diff --git a/logdoctor/globals/global_configs.h b/logdoctor/globals/global_configs.h index 5f04c814..a6eb5539 100644 --- a/logdoctor/globals/global_configs.h +++ b/logdoctor/globals/global_configs.h @@ -32,15 +32,16 @@ enum class ChartsTheme : themes_t { /*! Globally shared configurations */ -namespace GlobalConfigs { +namespace GlobalConfigs +{ - extern WindowTheme window_theme; +extern WindowTheme window_theme; - extern IconsTheme icons_theme; +extern IconsTheme icons_theme; - extern ChartsTheme charts_theme; +extern ChartsTheme charts_theme; - extern QString icons_set; +extern QString icons_set; } // namespace GlobalConfigs diff --git a/logdoctor/modules/crapview/modules/filters.cpp b/logdoctor/modules/crapview/modules/filters.cpp index ea38f93e..3ee56371 100644 --- a/logdoctor/modules/crapview/modules/filters.cpp +++ b/logdoctor/modules/crapview/modules/filters.cpp @@ -4,7 +4,6 @@ #include "utilities/strings.h" #include -#include namespace FilterOps @@ -57,28 +56,28 @@ std::optional parseNumericFilter( const QString& filter_str ) noexcept return {aux}; } else if ( StringOps::isNumeric( aux ) ) { - aux.prepend( QChar('=') ); + aux.prepend( QLatin1Char('=') ); - } else if ( aux.at(0) == QChar('!') && aux.at(1) != QChar('=') ) { - aux.insert(1, QChar('=')); + } else if ( aux.at(0) == QLatin1Char('!') && aux.at(1) != QLatin1Char('=') ) { + aux.insert(1, QLatin1Char('=')); } else if ( aux.startsWith(QLatin1String("EQ")) ) { - aux.replace(0, 2, QChar('=')); + aux.replace(0, 2, QLatin1Char('=')); } else if ( aux.startsWith(QLatin1String("NE")) ) { - aux.replace(0, 2, QChar('=')).prepend(QChar('!')); + aux.replace(0, 2, QLatin1Char('=')).prepend(QLatin1Char('!')); } else if ( aux.startsWith(QLatin1String("LT")) ) { - aux.replace(0, 2, QChar('<')); + aux.replace(0, 2, QLatin1Char('<')); } else if ( aux.startsWith(QLatin1String("LE")) ) { - aux.replace(0, 2, QChar('=')).prepend(QChar('<')); + aux.replace(0, 2, QLatin1Char('=')).prepend(QLatin1Char('<')); } else if ( aux.startsWith(QLatin1String("GT")) ) { - aux.replace(0, 2, QChar('>')); + aux.replace(0, 2, QLatin1Char('>')); } else if ( aux.startsWith(QLatin1String("GE")) ) { - aux.replace(0, 2, QChar('=')).prepend(QChar('>')); + aux.replace(0, 2, QLatin1Char('=')).prepend(QLatin1Char('>')); } // final check @@ -112,13 +111,13 @@ std::optional parseTextualFilter( const QString& filter_str ) noexcept result.emplace(QStringLiteral(" IS NOT NULL")); } else { - if ( aux.startsWith(QChar('!')) ) { - result.emplace( QStringLiteral(" NOT LIKE '%1'").arg( aux.removeFirst().trimmed().replace(QChar('\''),QLatin1String("''")) ) ); + if ( aux.startsWith(QLatin1Char('!')) ) { + result.emplace( QStringLiteral(" NOT LIKE '%1'").arg( aux.removeFirst().trimmed().replace(QLatin1Char('\''),QLatin1String("''")) ) ); } else { - if ( aux.startsWith(QChar('\\')) ) { + if ( aux.startsWith(QLatin1Char('\\')) ) { aux.removeFirst(); } - result.emplace( QStringLiteral(" LIKE '%1'").arg( aux.replace(QChar('\''),QLatin1String("''")) ) ); + result.emplace( QStringLiteral(" LIKE '%1'").arg( aux.replace(QLatin1Char('\''),QLatin1String("''")) ) ); } } return result;