summaryrefslogtreecommitdiffstats
path: root/ui/qt/widgets/syntax_line_edit.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:26 +0000
commitc4e8a3222648fcf22ca207f1815ebbf7cd144eeb (patch)
tree93d5c6aa93d9987680dd1adad5685e2ad698f223 /ui/qt/widgets/syntax_line_edit.cpp
parentAdding upstream version 4.2.6. (diff)
downloadwireshark-upstream.tar.xz
wireshark-upstream.zip
Adding upstream version 4.4.0.upstream/4.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/widgets/syntax_line_edit.cpp')
-rw-r--r--ui/qt/widgets/syntax_line_edit.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/ui/qt/widgets/syntax_line_edit.cpp b/ui/qt/widgets/syntax_line_edit.cpp
index f2c32142..3e1abe96 100644
--- a/ui/qt/widgets/syntax_line_edit.cpp
+++ b/ui/qt/widgets/syntax_line_edit.cpp
@@ -9,8 +9,6 @@
#include "config.h"
-#include <glib.h>
-
#include <epan/prefs.h>
#include <epan/proto.h>
#include <epan/dfilter/dfilter.h>
@@ -86,7 +84,7 @@ void SyntaxLineEdit::setSyntaxState(SyntaxState state) {
QColor deprecated_bg = ColorUtils::fromColorT(&prefs.gui_text_deprecated);
QColor deprecated_fg = ColorUtils::contrastingTextColor(deprecated_bg);
- // Try to matche QLineEdit's placeholder text color (which sets the
+ // Try to match QLineEdit's placeholder text color (which sets the
// alpha channel to 50%, which doesn't work in style sheets).
// Setting the foreground color lets us avoid yet another background
// color preference and should hopefully make things easier to
@@ -212,7 +210,7 @@ bool SyntaxLineEdit::checkDisplayFilter(QString filter)
* We're being lazy and only printing the first warning.
* Would it be better to print all of them?
*/
- syntax_error_message_ = QString(static_cast<gchar *>(warn->data));
+ syntax_error_message_ = QString(static_cast<char *>(warn->data));
} else if (dfp != NULL && (depr = dfilter_deprecated_tokens(dfp)) != NULL) {
// You keep using that word. I do not think it means what you think it means.
// Possible alternatives: ::Troubled, or ::Problematic maybe?
@@ -222,7 +220,7 @@ bool SyntaxLineEdit::checkDisplayFilter(QString filter)
* Would it be better to print all of them?
*/
QString token((const char *)g_ptr_array_index(depr, 0));
- gchar *token_str = qstring_strdup(token.section('.', 0, 0));
+ char *token_str = qstring_strdup(token.section('.', 0, 0));
header_field_info *hfi = proto_registrar_get_byalias(token_str);
if (hfi)
syntax_error_message_ = tr("\"%1\" is deprecated in favour of \"%2\". "
@@ -267,10 +265,23 @@ void SyntaxLineEdit::checkCustomColumn(QString fields)
return;
}
- gchar **splitted_fields = g_regex_split_simple(COL_CUSTOM_PRIME_REGEX,
- fields.toUtf8().constData(), G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED);
-
- for (guint i = 0; i < g_strv_length(splitted_fields); i++) {
+#if 0
+ // XXX - Eventually, if the operator we split on is something not supported
+ // in the filter expression syntax (so that we can distinguish multifield
+ // concatenation of column strings from a logical OR), we would split and
+ // then check each split result as a valid display filter.
+ // For now, any expression that is a valid display filter should work.
+ //
+ // We also, for the custom columns, want some of the extra completion
+ // information from DisplayFilterEdit (like the display filter functions),
+ // without all of its integration into the main app, but not every user
+ // of FieldFilterEdit wants that, so perhaps we eventually should have
+ // another class.
+ char **splitted_fields = g_regex_split_simple(COL_CUSTOM_PRIME_REGEX,
+ fields.toUtf8().constData(), (GRegexCompileFlags) G_REGEX_RAW,
+ (GRegexMatchFlags) 0);
+
+ for (unsigned i = 0; i < g_strv_length(splitted_fields); i++) {
if (splitted_fields[i] && *splitted_fields[i]) {
if (proto_check_field_name(splitted_fields[i]) != 0) {
setSyntaxState(SyntaxLineEdit::Invalid);
@@ -280,6 +291,7 @@ void SyntaxLineEdit::checkCustomColumn(QString fields)
}
}
g_strfreev(splitted_fields);
+#endif
checkDisplayFilter(fields);
}