wireshark/ui/qt/export_pdu_dialog.cpp
Guy Harris 01151ec332 Clean up "Export PDUs to File" code.
Combine exp_pdu_file_open() is called only by do_export_pdu(); just
combine them into one routine.

Get rid of the exp_pdu_t * argument to do_export_pdu(); instead, have
the exp_pdu_t structure be a local variable in that routine.  There's no
need to initialize exp_pdu_data.pkt_encap in
ExportPDUDialog::on_buttonBox_accepted() - do_export_pdu() already does
so.

The return value of do_export_pdu() isn't used; don't return anything.
2021-03-14 06:51:36 -07:00

44 lines
1 KiB
C++

/* export_pdu_dialog.cpp
* Dialog for exporting PDUs to file
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include "export_pdu_dialog.h"
#include <ui_export_pdu_dialog.h>
#include <epan/tap.h>
#include <epan/exported_pdu.h>
#include "ui/export_pdu_ui_utils.h"
ExportPDUDialog::ExportPDUDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ExportPDUDialog)
{
GSList *tap_name_list;
ui->setupUi(this);
for (tap_name_list = get_export_pdu_tap_list(); tap_name_list; tap_name_list = g_slist_next(tap_name_list)) {
ui->comboBox->addItem((const char*)(tap_name_list->data));
}
}
void ExportPDUDialog::on_buttonBox_accepted()
{
const QByteArray& filter = ui->displayFilterLineEdit->text().toUtf8();
const QByteArray& tap_name = ui->comboBox->currentText().toUtf8();
do_export_pdu(filter.constData(), tap_name.constData());
}
ExportPDUDialog::~ExportPDUDialog()
{
delete ui;
}