summaryrefslogtreecommitdiff
path: root/ui/qt/print_dialog.cpp
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-02-29 18:52:52 -0800
committerGuy Harris <guy@alum.mit.edu>2016-03-01 02:53:44 +0000
commitc73cf3cd00c1fb144e67ef79ea55be41993b79be (patch)
tree19a5343fab0b5abeb2832417f20cd7af78642dae /ui/qt/print_dialog.cpp
parentc0b29fcddd6eb9c7956ff63836a71a1d90169daa (diff)
downloadwireshark-c73cf3cd00c1fb144e67ef79ea55be41993b79be.tar.gz
Don't show a progress bar when previewing for the Qt print dialog.
We don't do much work to do that - we don't print anything before the first selected page, and once we're finished generating that page, we terminate the printing process - so it shouldn't need a progress bar. (If it needs a progress bar, We Have A Problem, as that slows down the drawing of the dialog box.) This should prevent the problem seen in bug 12040. Bug: 12040 Change-Id: I129191e06fff3e1eb59a9631c7395b9e7f650809 Reviewed-on: https://code.wireshark.org/review/14255 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/print_dialog.cpp')
-rw-r--r--ui/qt/print_dialog.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/ui/qt/print_dialog.cpp b/ui/qt/print_dialog.cpp
index 58f4cb0bba..07979b5306 100644
--- a/ui/qt/print_dialog.cpp
+++ b/ui/qt/print_dialog.cpp
@@ -145,6 +145,8 @@ gboolean PrintDialog::printHeader()
if (page_pos_ > page_top) {
if (in_preview_) {
+ // When generating a preview, only generate the first page;
+ // if we're past the first page, stop the printing process.
return FALSE;
}
// Second and subsequent pages only
@@ -178,6 +180,8 @@ gboolean PrintDialog::printLine(int indent, const char *line)
if (cur_printer_->pageRect().height() < page_pos_ + out_rect.height()) {
if (in_preview_) {
+ // When generating a preview, only generate the first page;
+ // if we're past the first page, stop the printing process.
return FALSE;
}
if (*line == '\0') { // Separator
@@ -257,12 +261,10 @@ void PrintDialog::printPackets(QPrinter *printer, bool in_preview)
QMessageBox::Ok);
close();
}
- // cf_print_packets updates the progress bar which in turn calls
- // WiresharkApplication::processEvents(), which can make the preview trip
- // over itself.
- preview_->setUpdatesEnabled(false);
- cf_print_packets(cap_file_, &print_args_);
- preview_->setUpdatesEnabled(true);
+ // Don't show a progress bar if we're previewing; if it takes a
+ // significant amount of time to generate a preview of the first
+ // page, We Have A Real Problem
+ cf_print_packets(cap_file_, &print_args_, in_preview ? FALSE : TRUE);
cur_printer_ = NULL;
cur_painter_ = NULL;
painter.end();