update epan/dissectors/pidl/drsuapi/drsuapi.idl from samba
[wireshark-sm.git] / ui / qt / tap_parameter_dialog.h
blob84a6f69e2421f674a0b5d85b659be2f22ba66612
1 /** @file
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #ifndef TAP_PARAMETER_DIALOG_H
11 #define TAP_PARAMETER_DIALOG_H
14 * @file Base class for statistics and analysis dialogs.
15 * Provides convenience classes for command-line tap parameters ("-z ...")
16 * and general tapping.
19 #include "config.h"
21 #include <epan/stat_groups.h>
22 #include <epan/stat_tap_ui.h>
24 #include <QMenu>
26 #include "filter_action.h"
27 #include "wireshark_dialog.h"
29 class QHBoxLayout;
30 class QLineEdit;
31 class QTreeWidget;
32 class QTreeWidgetItem;
33 class QVBoxLayout;
35 namespace Ui {
36 class TapParameterDialog;
39 class TapParameterDialog;
40 typedef TapParameterDialog* (*tpdCreator)(QWidget &parent, const QString cfg_str, const QString arg, CaptureFile &cf);
42 class TapParameterDialog : public WiresharkDialog
44 Q_OBJECT
46 public:
47 explicit TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic = 0);
48 ~TapParameterDialog();
50 static const QString &actionName() { return action_name_; }
51 static void registerDialog(const QString title, const char *cfg_abbr, register_stat_group_t group, stat_tap_init_cb tap_init_cb, tpdCreator creator);
53 static TapParameterDialog *showTapParameterStatistics(QWidget &parent, CaptureFile &cf, const QString cfg_str, const QString arg, void *);
54 // Needed by static member functions in subclasses. Should we just make
55 // "ui" available instead?
56 QTreeWidget *statsTreeWidget();
57 QLineEdit *displayFilterLineEdit();
58 QPushButton *applyFilterButton();
59 QVBoxLayout *verticalLayout();
60 QHBoxLayout *filterLayout();
62 void drawTreeItems();
64 signals:
65 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
66 void updateFilter(QString filter);
68 public slots:
70 protected:
71 void contextMenuEvent(QContextMenuEvent *event);
72 void addFilterActions();
73 void addTreeCollapseAllActions();
74 QString displayFilter();
75 void setDisplayFilter(const QString &filter);
76 void setHint(const QString &hint);
77 // Retap packets on first display. RPC stats need to disable this.
78 void setRetapOnShow(bool retap);
80 protected slots:
81 void filterActionTriggered();
82 void collapseAllActionTriggered();
83 void expandAllActionTriggered();
84 void updateWidgets();
86 private:
87 Ui::TapParameterDialog *ui;
88 QMenu ctx_menu_;
89 QList<QAction *> filter_actions_;
90 int help_topic_;
91 static const QString action_name_;
92 QTimer *show_timer_;
94 virtual const QString filterExpression() { return QString(); }
95 QString itemDataToPlain(QVariant var, int width = 0);
96 virtual QList<QVariant> treeItemData(QTreeWidgetItem *) const;
97 virtual QByteArray getTreeAsString(st_format_type format);
99 private slots:
100 // Called by the constructor. The subclass should tap packets here.
101 virtual void fillTree() = 0;
103 void on_applyFilterButton_clicked();
104 void on_actionCopyToClipboard_triggered();
105 void on_actionSaveAs_triggered();
106 void on_buttonBox_helpRequested();
109 #endif // TAP_PARAMETER_DIALOG_H