TODO netlogon_user_flags_ntlmv2_enabled
[wireshark-sm.git] / ui / qt / packet_format_group_box.cpp
blob4a505f2886395f7577978ab528b7196a30420180
1 /* packet_format_group_box.cpp
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #include "packet_format_group_box.h"
11 #include <ui_packet_format_group_box.h>
13 #include <epan/print.h>
15 #include <QStyle>
16 #include <QStyleOption>
18 PacketFormatGroupBox::PacketFormatGroupBox(QWidget *parent) :
19 QGroupBox(parent),
20 pf_ui_(new Ui::PacketFormatGroupBox)
22 pf_ui_->setupUi(this);
23 setFlat(true);
25 QStyleOption style_opt;
26 int cb_label_offset = pf_ui_->detailsCheckBox->style()->subElementRect(QStyle::SE_CheckBoxContents, &style_opt).left();
28 // Indent the checkbox under the "Packet summary" checkbox
29 pf_ui_->includeColumnHeadingsCheckBox->setStyleSheet(QStringLiteral(
30 "QCheckBox {"
31 " padding-left: %1px;"
32 "}"
33 ).arg(cb_label_offset));
35 // Indent the radio buttons under the "Packet details" checkbox
36 pf_ui_->allCollapsedButton->setStyleSheet(QStringLiteral(
37 "QRadioButton {"
38 " padding-left: %1px;"
39 "}"
40 ).arg(cb_label_offset));
41 pf_ui_->asDisplayedButton->setStyleSheet(QStringLiteral(
42 "QRadioButton {"
43 " padding-left: %1px;"
44 "}"
45 ).arg(cb_label_offset));
46 pf_ui_->allExpandedButton->setStyleSheet(QStringLiteral(
47 "QRadioButton {"
48 " padding-left: %1px;"
49 "}"
50 ).arg(cb_label_offset));
52 // Indent the checkbox under the "Bytes" checkbox
53 pf_ui_->includeDataSourcesCheckBox->setStyleSheet(QStringLiteral(
54 "QCheckBox {"
55 " padding-left: %1px;"
56 "}"
57 ).arg(cb_label_offset));
59 pf_ui_->timestampCheckBox->setStyleSheet(QStringLiteral(
60 "QCheckBox {"
61 " padding-left: %1px;"
62 "}"
63 ).arg(cb_label_offset));
66 PacketFormatGroupBox::~PacketFormatGroupBox()
68 delete pf_ui_;
71 bool PacketFormatGroupBox::summaryEnabled()
73 return pf_ui_->summaryCheckBox->isChecked();
76 bool PacketFormatGroupBox::detailsEnabled()
78 return pf_ui_->detailsCheckBox->isChecked();
81 bool PacketFormatGroupBox::bytesEnabled()
83 return pf_ui_->bytesCheckBox->isChecked();
86 bool PacketFormatGroupBox::includeColumnHeadingsEnabled()
88 return pf_ui_->includeColumnHeadingsCheckBox->isChecked();
91 bool PacketFormatGroupBox::allCollapsedEnabled()
93 return pf_ui_->allCollapsedButton->isChecked();
96 bool PacketFormatGroupBox::asDisplayedEnabled()
98 return pf_ui_->asDisplayedButton->isChecked();
101 bool PacketFormatGroupBox::allExpandedEnabled()
103 return pf_ui_->allExpandedButton->isChecked();
106 uint PacketFormatGroupBox::getHexdumpOptions()
108 return (pf_ui_->includeDataSourcesCheckBox->isChecked() ? HEXDUMP_SOURCE_MULTI : HEXDUMP_SOURCE_PRIMARY) | (pf_ui_->timestampCheckBox->isChecked() ? HEXDUMP_TIMESTAMP : HEXDUMP_TIMESTAMP_NONE);
111 void PacketFormatGroupBox::on_summaryCheckBox_toggled(bool checked)
113 pf_ui_->includeColumnHeadingsCheckBox->setEnabled(checked);
114 emit formatChanged();
117 void PacketFormatGroupBox::on_detailsCheckBox_toggled(bool checked)
119 pf_ui_->allCollapsedButton->setEnabled(checked);
120 pf_ui_->asDisplayedButton->setEnabled(checked);
121 pf_ui_->allExpandedButton->setEnabled(checked);
122 emit formatChanged();
125 void PacketFormatGroupBox::on_bytesCheckBox_toggled(bool checked)
127 pf_ui_->includeDataSourcesCheckBox->setEnabled(checked);
128 pf_ui_->timestampCheckBox->setEnabled(checked);
129 emit formatChanged();
132 void PacketFormatGroupBox::on_includeColumnHeadingsCheckBox_toggled(bool)
134 emit formatChanged();
137 void PacketFormatGroupBox::on_allCollapsedButton_toggled(bool checked)
139 if (checked) emit formatChanged();
142 void PacketFormatGroupBox::on_asDisplayedButton_toggled(bool checked)
144 if (checked) emit formatChanged();
147 void PacketFormatGroupBox::on_allExpandedButton_toggled(bool checked)
149 if (checked) emit formatChanged();
152 void PacketFormatGroupBox::on_includeDataSourcesCheckBox_toggled(bool)
154 emit formatChanged();
157 void PacketFormatGroupBox::on_timestampCheckBox_toggled(bool)
159 emit formatChanged();