General improvements

This commit is contained in:
Valentino Orlandi 2024-02-03 17:54:53 +01:00
parent 6182a61420
commit 9320b90001
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
3 changed files with 22 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,6 @@
#include "utilities/strings.h"
#include <QRegularExpression>
#include <QStringList>
namespace FilterOps
@ -57,28 +56,28 @@ std::optional<QString> 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<QString> 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;