QT Print Dialog: Make header optional

Add a checkbox to make the file information header/banner optional.

Fixes: wireshark/wireshark#17322
This commit is contained in:
Uli Heilmeier 2021-04-02 22:16:16 +02:00 committed by Wireshark GitLab Utility
parent 52030fdca7
commit 587198a4cc
2 changed files with 24 additions and 6 deletions

View File

@ -31,6 +31,7 @@ extern "C" {
// Page element callbacks
static gboolean
print_preamble_pd(print_stream_t *self, gchar *, const char *)
{
@ -123,6 +124,8 @@ PrintDialog::PrintDialog(QWidget *parent, capture_file *cf, QString selRange) :
this, SLOT(checkValidity()));
connect(pd_ui_->formFeedCheckBox, SIGNAL(toggled(bool)),
preview_, SLOT(updatePreview()));
connect(pd_ui_->bannerCheckBox, SIGNAL(toggled(bool)),
preview_, SLOT(updatePreview()));
checkValidity();
}
@ -153,12 +156,14 @@ gboolean PrintDialog::printHeader()
page_pos_ = page_top;
}
QString banner = QString(tr("%1 %2 total packets, %3 shown"))
.arg(cap_file_->filename)
.arg(cap_file_->count)
.arg(cap_file_->displayed_count);
cur_painter_->setFont(header_font_);
cur_painter_->drawText(0, page_top, banner);
if (pd_ui_->bannerCheckBox->isChecked()) {
QString banner = QString(tr("%1 %2 total packets, %3 shown"))
.arg(cap_file_->filename)
.arg(cap_file_->count)
.arg(cap_file_->displayed_count);
cur_painter_->setFont(header_font_);
cur_painter_->drawText(0, page_top, banner);
}
page_pos_ += cur_painter_->fontMetrics().height();
cur_painter_->setFont(packet_font_);
return TRUE;

View File

@ -35,6 +35,19 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="bannerCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Print capture file information on each page&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Capture information header</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">