diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
commit | e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch) | |
tree | 68cb5ef9081156392f1dd62a00c6ccc1451b93df /ui/qt/packet_format_group_box.cpp | |
parent | Initial commit. (diff) | |
download | wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip |
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/packet_format_group_box.cpp')
-rw-r--r-- | ui/qt/packet_format_group_box.cpp | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/ui/qt/packet_format_group_box.cpp b/ui/qt/packet_format_group_box.cpp new file mode 100644 index 0000000..18f2259 --- /dev/null +++ b/ui/qt/packet_format_group_box.cpp @@ -0,0 +1,148 @@ +/* packet_format_group_box.cpp + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "packet_format_group_box.h" +#include <ui_packet_format_group_box.h> + +#include <epan/print.h> + +#include <QStyle> +#include <QStyleOption> + +PacketFormatGroupBox::PacketFormatGroupBox(QWidget *parent) : + QGroupBox(parent), + pf_ui_(new Ui::PacketFormatGroupBox) +{ + pf_ui_->setupUi(this); + setFlat(true); + + QStyleOption style_opt; + int cb_label_offset = pf_ui_->detailsCheckBox->style()->subElementRect(QStyle::SE_CheckBoxContents, &style_opt).left(); + + // Indent the checkbox under the "Packet summary" checkbox + pf_ui_->includeColumnHeadingsCheckBox->setStyleSheet(QString( + "QCheckBox {" + " padding-left: %1px;" + "}" + ).arg(cb_label_offset)); + + // Indent the radio buttons under the "Packet details" checkbox + pf_ui_->allCollapsedButton->setStyleSheet(QString( + "QRadioButton {" + " padding-left: %1px;" + "}" + ).arg(cb_label_offset)); + pf_ui_->asDisplayedButton->setStyleSheet(QString( + "QRadioButton {" + " padding-left: %1px;" + "}" + ).arg(cb_label_offset)); + pf_ui_->allExpandedButton->setStyleSheet(QString( + "QRadioButton {" + " padding-left: %1px;" + "}" + ).arg(cb_label_offset)); + + // Indent the checkbox under the "Bytes" checkbox + pf_ui_->includeDataSourcesCheckBox->setStyleSheet(QString( + "QCheckBox {" + " padding-left: %1px;" + "}" + ).arg(cb_label_offset)); +} + +PacketFormatGroupBox::~PacketFormatGroupBox() +{ + delete pf_ui_; +} + +bool PacketFormatGroupBox::summaryEnabled() +{ + return pf_ui_->summaryCheckBox->isChecked(); +} + +bool PacketFormatGroupBox::detailsEnabled() +{ + return pf_ui_->detailsCheckBox->isChecked(); +} + +bool PacketFormatGroupBox::bytesEnabled() +{ + return pf_ui_->bytesCheckBox->isChecked(); +} + +bool PacketFormatGroupBox::includeColumnHeadingsEnabled() +{ + return pf_ui_->includeColumnHeadingsCheckBox->isChecked(); +} + +bool PacketFormatGroupBox::allCollapsedEnabled() +{ + return pf_ui_->allCollapsedButton->isChecked(); +} + +bool PacketFormatGroupBox::asDisplayedEnabled() +{ + return pf_ui_->asDisplayedButton->isChecked(); +} + +bool PacketFormatGroupBox::allExpandedEnabled() +{ + return pf_ui_->allExpandedButton->isChecked(); +} + +uint PacketFormatGroupBox::getHexdumpOptions() +{ + return pf_ui_->includeDataSourcesCheckBox->isChecked() ? HEXDUMP_SOURCE_MULTI : HEXDUMP_SOURCE_PRIMARY; +} + +void PacketFormatGroupBox::on_summaryCheckBox_toggled(bool checked) +{ + pf_ui_->includeColumnHeadingsCheckBox->setEnabled(checked); + emit formatChanged(); +} + +void PacketFormatGroupBox::on_detailsCheckBox_toggled(bool checked) +{ + pf_ui_->allCollapsedButton->setEnabled(checked); + pf_ui_->asDisplayedButton->setEnabled(checked); + pf_ui_->allExpandedButton->setEnabled(checked); + emit formatChanged(); +} + +void PacketFormatGroupBox::on_bytesCheckBox_toggled(bool checked) +{ + pf_ui_->includeDataSourcesCheckBox->setEnabled(checked); + emit formatChanged(); +} + +void PacketFormatGroupBox::on_includeColumnHeadingsCheckBox_toggled(bool) +{ + emit formatChanged(); +} + +void PacketFormatGroupBox::on_allCollapsedButton_toggled(bool checked) +{ + if (checked) emit formatChanged(); +} + +void PacketFormatGroupBox::on_asDisplayedButton_toggled(bool checked) +{ + if (checked) emit formatChanged(); +} + +void PacketFormatGroupBox::on_allExpandedButton_toggled(bool checked) +{ + if (checked) emit formatChanged(); +} + +void PacketFormatGroupBox::on_includeDataSourcesCheckBox_toggled(bool) +{ + emit formatChanged(); +} |