Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Extract pcapfileformatoptions into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
pstavirs committed Nov 16, 2023
1 parent 8c58d86 commit f779b01
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 796 deletions.
6 changes: 6 additions & 0 deletions common/ostfile.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ HEADERS = \
sessionfileformat.h \
streamfileformat.h

HEADERS += \
pcapfileformatoptions.h

SOURCES += \
ostprotolib.cpp \
nativefileformat.cpp \
Expand All @@ -39,6 +42,9 @@ SOURCES += \
streamfileformat.cpp \
spinboxdelegate.cpp

SOURCES += \
pcapfileformatoptions.cpp

SOURCES += \
vlanpdml.cpp \
svlanpdml.cpp \
Expand Down
34 changes: 2 additions & 32 deletions common/pcapfileformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>

#include "pcapfileformat.h"

#include "pcapfileformatoptions.h"

#include "pdmlreader.h"
#include "ostprotolib.h"
#include "streambase.h"
Expand All @@ -42,38 +44,6 @@ const quint32 kDltEthernet = 1;

PcapFileFormat pcapFileFormat;

PcapImportOptionsDialog::PcapImportOptionsDialog(QVariantMap *options)
: QDialog(NULL)
{
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
options_ = options;

viaPdml->setChecked(options_->value("ViaPdml").toBool());
// XXX: By default this key is absent - so that pcap import tests
// evaluate to false and hence show minimal diffs.
// However, for the GUI user, this should be enabled by default.
recalculateCksums->setChecked(
options_->value("RecalculateCksums", QVariant(true))
.toBool());
doDiff->setChecked(options_->value("DoDiff").toBool());

connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
}

PcapImportOptionsDialog::~PcapImportOptionsDialog()
{
}

void PcapImportOptionsDialog::accept()
{
options_->insert("ViaPdml", viaPdml->isChecked());
options_->insert("RecalculateCksums", recalculateCksums->isChecked());
options_->insert("DoDiff", doDiff->isChecked());

QDialog::accept();
}

PcapFileFormat::PcapFileFormat()
{
importOptions_.insert("ViaPdml", true);
Expand Down
14 changes: 0 additions & 14 deletions common/pcapfileformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#define _PCAP_FILE_FORMAT_H

#include "streamfileformat.h"
#include "ui_pcapfileimport.h"

#include <QDataStream>
#include <QVariantMap>

class PcapImportOptionsDialog: public QDialog, public Ui::PcapFileImport
{
public:
PcapImportOptionsDialog(QVariantMap *options);
~PcapImportOptionsDialog();

private slots:
void accept();

private:
QVariantMap *options_;
};

class PdmlReader;
class PcapFileFormat : public StreamFileFormat
{
Expand Down
Loading

0 comments on commit f779b01

Please sign in to comment.