summaryrefslogtreecommitdiff
path: root/ui/qt/display_filter_edit.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-02-11 16:07:10 -0800
committerGerald Combs <gerald@wireshark.org>2014-04-07 20:56:42 +0000
commita5cb72fe9eadfaf8cb0aefccb106a7eaad9266c9 (patch)
tree34a1965805b7373553d6057e9981de3ae6a01460 /ui/qt/display_filter_edit.cpp
parentcc3c05ed5f9e2d3eb8d72b3acc66bbacd50a26e7 (diff)
downloadwireshark-a5cb72fe9eadfaf8cb0aefccb106a7eaad9266c9.tar.gz
Add a Qt I/O Graph dialog.
For each graph you can set: - Its visibility - A name - A display filter - Color, from a fixed list - Plot style: Line, Impulse, Bar, Stacked Bar, Dot, Square, Diamond - Basic Y Axes (packets/s, bytes/s, bits/s) - Computed Y Axes (SUM, MIN, AVG, MAX) - Smoothing You can pan and zoom using the mouse and keyboard. Clicking on a graph selects the last packet for that interval. If all graphs have the same Y axis a single label is shown, otherwise a legend is shown. The time scale (X axis) can be toggled between relative seconds and the time of day. Graphs can be saved as PDF, PNG, BMP, and JPEG. Settings are "sticky" via the io_graphs UAT. To do: - Minimize graph drawing delays. - Figure out why smoothing differs from GTK+ - Everything else at the top of io_graph_dialog.cpp - Fix empty resets. A fair amount of code was copied from TCPStreamDialog. We might want to subclass QCustomPlot and place the shared code there. Move common syntax checking to SyntaxLineEdit. Move some common code from ui/gtk/io_stat.c to ui/io_graph_item.[ch] and use it in both GTK+ and Qt. Make the io_graph_item_t array allocation in io_stat.c static. The behavior should be identical and this gives us additional compile-time checks. Change-Id: I9a3d544469b7048f0761fdbf7bcf20f44ae76577 Reviewed-on: https://code.wireshark.org/review/435 Reviewed-by: Gerald Combs <gerald@wireshark.org> Tested-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/display_filter_edit.cpp')
-rw-r--r--ui/qt/display_filter_edit.cpp51
1 files changed, 20 insertions, 31 deletions
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp
index aa6c9d9de2..ea01dcca14 100644
--- a/ui/qt/display_filter_edit.cpp
+++ b/ui/qt/display_filter_edit.cpp
@@ -23,7 +23,6 @@
#include <glib.h>
-#include <epan/proto.h>
#include <epan/dfilter/dfilter.h>
#include "display_filter_edit.h"
@@ -85,7 +84,6 @@ UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */)
DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
SyntaxLineEdit(parent),
plain_(plain),
- field_name_only_(false),
apply_button_(NULL)
{
@@ -266,43 +264,34 @@ void DisplayFilterEdit::resizeEvent(QResizeEvent *)
void DisplayFilterEdit::checkFilter(const QString& text)
{
- dfilter_t *dfp;
- guchar c;
-
clear_button_->setVisible(!text.isEmpty());
popFilterSyntaxStatus();
-
- if (field_name_only_ && (c = proto_check_field_name(text.toUtf8().constData()))) {
- setSyntaxState(Invalid);
- emit pushFilterSyntaxStatus(QString().sprintf("Illegal character in field name: '%c'", c));
- } else if (dfilter_compile(text.toUtf8().constData(), &dfp)) {
- GPtrArray *depr = NULL;
- if (dfp != NULL) {
- depr = dfilter_deprecated_tokens(dfp);
- }
- if (text.isEmpty()) {
- setSyntaxState(Empty);
- } else if (depr) {
- /* You keep using that word. I do not think it means what you think it means. */
- setSyntaxState(Deprecated);
- /*
- * We're being lazy and only printing the first "problem" token.
- * Would it be better to print all of them?
- */
- emit pushFilterSyntaxWarning(QString().sprintf("\"%s\" may have unexpected results (see the User's Guide)",
- (const char *) g_ptr_array_index(depr, 0)));
- } else {
- setSyntaxState(Valid);
- }
- dfilter_free(dfp);
- } else {
- setSyntaxState(Invalid);
+ checkDisplayFilter(text);
+
+ switch (syntaxState()) {
+ case Deprecated:
+ {
+ /*
+ * We're being lazy and only printing the first "problem" token.
+ * Would it be better to print all of them?
+ */
+ QString deprecatedMsg(tr("\"%1\" may have unexpected results (see the User's Guide)")
+ .arg(deprecatedToken()));
+ emit pushFilterSyntaxWarning(deprecatedMsg);
+ break;
+ }
+ case Invalid:
+ {
QString invalidMsg(tr("Invalid filter"));
if (dfilter_error_msg) {
invalidMsg.append(QString().sprintf(": %s", dfilter_error_msg));
}
emit pushFilterSyntaxStatus(invalidMsg);
+ break;
+ }
+ default:
+ break;
}
bookmark_button_->setEnabled(syntaxState() == Valid || syntaxState() == Deprecated);