2021-11-30 13:01:36 +00:00
|
|
|
/** @file
|
2017-04-15 21:30:30 +00:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2017-04-15 21:30:30 +00:00
|
|
|
|
|
|
|
#ifndef INTERFACE_TOOLBAR_H
|
|
|
|
#define INTERFACE_TOOLBAR_H
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include "ui/iface_toolbar.h"
|
|
|
|
#include "funnel_text_dialog.h"
|
|
|
|
#include "interface_toolbar_reader.h"
|
|
|
|
|
|
|
|
#include <QFrame>
|
2017-04-28 19:26:53 +00:00
|
|
|
#include <QList>
|
2017-04-15 21:30:30 +00:00
|
|
|
#include <QMap>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class InterfaceToolbar;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct interface_values
|
|
|
|
{
|
|
|
|
QThread *reader_thread;
|
|
|
|
int out_fd;
|
|
|
|
QMap<int, QByteArray> value;
|
2017-04-28 19:26:53 +00:00
|
|
|
QMap<int, bool> value_changed;
|
2017-04-15 21:30:30 +00:00
|
|
|
QMap<int, QList<QByteArray> > list;
|
2017-09-02 18:35:54 +00:00
|
|
|
QMap<int, FunnelTextDialog *> log_dialog;
|
|
|
|
QMap<int, QString> log_text;
|
2017-04-15 21:30:30 +00:00
|
|
|
QMap<int, bool> widget_disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
class InterfaceToolbar : public QFrame
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit InterfaceToolbar(QWidget *parent = 0, const iface_toolbar *toolbar = NULL);
|
|
|
|
~InterfaceToolbar();
|
|
|
|
|
2017-04-28 19:26:53 +00:00
|
|
|
void startCapture(GArray *ifaces);
|
2017-04-15 21:30:30 +00:00
|
|
|
void stopCapture();
|
|
|
|
bool hasInterface(QString ifname);
|
|
|
|
|
|
|
|
public slots:
|
2017-04-28 19:26:53 +00:00
|
|
|
void interfaceListChanged();
|
2017-04-15 21:30:30 +00:00
|
|
|
void controlReceived(QString ifname, int num, int command, QByteArray message);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void closeReader();
|
|
|
|
|
|
|
|
private slots:
|
2017-08-25 09:28:34 +00:00
|
|
|
void startReaderThread(QString ifname, void *control_in);
|
2017-04-15 21:30:30 +00:00
|
|
|
void updateWidgets();
|
|
|
|
|
2018-12-19 17:56:22 +00:00
|
|
|
void onControlButtonClicked();
|
|
|
|
void onLogButtonClicked();
|
|
|
|
void onHelpButtonClicked();
|
|
|
|
void onRestoreButtonClicked();
|
2017-04-15 21:30:30 +00:00
|
|
|
void onCheckBoxChanged(int state);
|
|
|
|
void onComboBoxChanged(int idx);
|
|
|
|
void onLineEditChanged();
|
|
|
|
|
|
|
|
void closeLog();
|
|
|
|
|
2022-08-05 08:35:55 +00:00
|
|
|
void on_interfacesComboBox_currentTextChanged(const QString &ifname);
|
2017-04-15 21:30:30 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void initializeControls(const iface_toolbar *toolbar);
|
|
|
|
void setDefaultValue(int num, const QByteArray &value);
|
|
|
|
void sendChangedValues(QString ifname);
|
|
|
|
QWidget *createCheckbox(iface_toolbar_control *control);
|
|
|
|
QWidget *createButton(iface_toolbar_control *control);
|
|
|
|
QWidget *createSelector(iface_toolbar_control *control);
|
|
|
|
QWidget *createString(iface_toolbar_control *control);
|
|
|
|
void controlSend(QString ifname, int num, int type, const QByteArray &payload);
|
|
|
|
void setWidgetValue(QWidget *widget, int type, QByteArray payload);
|
|
|
|
void setInterfaceValue(QString ifname, QWidget *widget, int num, int type, QByteArray payload);
|
|
|
|
|
|
|
|
Ui::InterfaceToolbar *ui;
|
|
|
|
QMap<QString, struct interface_values> interface_;
|
|
|
|
QMap<int, QByteArray> default_value_;
|
|
|
|
QMap<int, QList<QByteArray> > default_list_;
|
|
|
|
QMap<int, QWidget *> control_widget_;
|
|
|
|
QMap<int, QWidget *> label_widget_;
|
|
|
|
QString help_link_;
|
|
|
|
bool use_spacer_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INTERFACE_TOOLBAR_H
|