/* @file * * Wireshark - Network traffic analyzer * By Gerald Combs * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "compression_group_box.h" #include #include #include CompressionGroupBox::CompressionGroupBox(QWidget *parent) : QGroupBox(parent) { setTitle(tr("Compression options")); setFlat(true); bg_ = new QButtonGroup(this); QVBoxLayout *vbox = new QVBoxLayout(); QRadioButton *radio1 = new QRadioButton(tr("&Uncompressed")); bg_->addButton(radio1, WTAP_UNCOMPRESSED); vbox->addWidget(radio1); #if defined (HAVE_ZLIB) || defined (HAVE_ZLIBNG) QRadioButton *radio2 = new QRadioButton(tr("Compress with g&zip")); bg_->addButton(radio2, WTAP_GZIP_COMPRESSED); vbox->addWidget(radio2); #endif #ifdef HAVE_LZ4FRAME_H QRadioButton *radio3 = new QRadioButton(tr("Compress with &LZ4")); bg_->addButton(radio3, WTAP_LZ4_COMPRESSED); vbox->addWidget(radio3); #endif radio1->setChecked(true); setLayout(vbox); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect(bg_, &QButtonGroup::idToggled, [=] { emit stateChanged(); }); #else connect(bg_, QOverload::of(&QButtonGroup::buttonToggled), [=] { emit stateChanged(); }); #endif } CompressionGroupBox::~CompressionGroupBox() { } wtap_compression_type CompressionGroupBox::compressionType() const { return static_cast(bg_->checkedId()); } void CompressionGroupBox::setCompressionType(wtap_compression_type type) { QAbstractButton *button = bg_->button(type); if (button != nullptr) { button->setChecked(true); } }