Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
interface_toolbar.h
1 /* interface_toolbar.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef INTERFACE_TOOLBAR_H
11 #define INTERFACE_TOOLBAR_H
12 
13 #include <glib.h>
14 
15 #include "ui/iface_toolbar.h"
16 #include "funnel_text_dialog.h"
17 #include "interface_toolbar_reader.h"
18 
19 #include <QFrame>
20 #include <QList>
21 #include <QMap>
22 #include <QString>
23 
24 
25 namespace Ui {
26 class InterfaceToolbar;
27 }
28 
30 {
31  QThread *reader_thread;
32  int out_fd;
33  QMap<int, QByteArray> value;
34  QMap<int, bool> value_changed;
35  QMap<int, QList<QByteArray> > list;
36  QMap<int, FunnelTextDialog *> log_dialog;
37  QMap<int, QString> log_text;
38  QMap<int, bool> widget_disabled;
39 };
40 
41 class InterfaceToolbar : public QFrame
42 {
43  Q_OBJECT
44 
45 public:
46  explicit InterfaceToolbar(QWidget *parent = 0, const iface_toolbar *toolbar = NULL);
48 
49  void startCapture(GArray *ifaces);
50  void stopCapture();
51  bool hasInterface(QString ifname);
52 
53 public slots:
54  void interfaceListChanged();
55  void controlReceived(QString ifname, int num, int command, QByteArray message);
56 
57 signals:
58  void closeReader();
59 
60 private slots:
61  void startReaderThread(QString ifname, void *control_in);
62  void updateWidgets();
63 
64  void onControlButtonPressed();
65  void onLogButtonPressed();
66  void onHelpButtonPressed();
67  void onRestoreButtonPressed();
68  void onCheckBoxChanged(int state);
69  void onComboBoxChanged(int idx);
70  void onLineEditChanged();
71 
72  void closeLog();
73 
74  void on_interfacesComboBox_currentIndexChanged(const QString &ifname);
75 
76 private:
77  void initializeControls(const iface_toolbar *toolbar);
78  void setDefaultValue(int num, const QByteArray &value);
79  void sendChangedValues(QString ifname);
80  QWidget *createCheckbox(iface_toolbar_control *control);
81  QWidget *createButton(iface_toolbar_control *control);
82  QWidget *createSelector(iface_toolbar_control *control);
83  QWidget *createString(iface_toolbar_control *control);
84  void controlSend(QString ifname, int num, int type, const QByteArray &payload);
85  void setWidgetValue(QWidget *widget, int type, QByteArray payload);
86  void setInterfaceValue(QString ifname, QWidget *widget, int num, int type, QByteArray payload);
87 
89  QMap<QString, struct interface_values> interface_;
90  QMap<int, QByteArray> default_value_;
91  QMap<int, QList<QByteArray> > default_list_;
92  QMap<int, QWidget *> control_widget_;
93  QMap<int, QWidget *> label_widget_;
94  QString help_link_;
95  bool use_spacer_;
96 };
97 
98 #endif // INTERFACE_TOOLBAR_H
99 
100 /*
101  * Editor modelines
102  *
103  * Local Variables:
104  * c-basic-offset: 4
105  * tab-width: 8
106  * indent-tabs-mode: nil
107  * End:
108  *
109  * ex: set shiftwidth=4 tabstop=8 expandtab:
110  * :indentSize=4:tabSize=8:noTabs=true:
111  */
Definition: ui_about_dialog.h:291
Definition: ui_interface_toolbar.h:91
Definition: iface_toolbar.h:42
Definition: interface_toolbar.h:29
Definition: iface_toolbar.h:58
Definition: interface_toolbar.h:41