blob: 08a74daebecf948dca243d69e074793406064945 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/* @file
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "compression_group_box.h"
#include <QRadioButton>
#include <QButtonGroup>
#include <QVBoxLayout>
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<int, bool>::of(&QButtonGroup::buttonToggled), [=] { emit stateChanged(); });
#endif
}
CompressionGroupBox::~CompressionGroupBox()
{
}
wtap_compression_type CompressionGroupBox::compressionType() const
{
return static_cast<wtap_compression_type>(bg_->checkedId());
}
void CompressionGroupBox::setCompressionType(wtap_compression_type type)
{
QAbstractButton *button = bg_->button(type);
if (button != nullptr) {
button->setChecked(true);
}
}
|