diff options
author | Gerald Combs <gerald@wireshark.org> | 2014-12-29 11:42:01 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2014-12-30 03:34:03 +0000 |
commit | 4556498f337d1a9cc4284167526280efa00810b5 (patch) | |
tree | 393ba6e17a82f8973de06738cc644cc4fdc02b2b /ui/qt/stats_tree_dialog.cpp | |
parent | b6ff338e81d4e1f42f2ec8cb90409dc17422f6c6 (diff) | |
download | wireshark-4556498f337d1a9cc4284167526280efa00810b5.tar.gz |
Qt: Convert more dialogs to WiresharkDialog.
Make the Sequence, IO Graph, Statistics Tree, and VoIP Calls dialogs
subclasses of WiresharkDialog.
Remove "Stats Tree" from Statistics Tree dialog titles. Don't complain
if the user opens more than one instance of the dialog.
Use the applicationName property in WiresharkApplication instead of a
separate variable.
Add a preexisting item to the IO Graph bug list (hovering when the file
is closed clears the graph).
Change-Id: I8411a25305d00b16e0d4a82fa50a9bad5c85b239
Reviewed-on: https://code.wireshark.org/review/6125
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/stats_tree_dialog.cpp')
-rw-r--r-- | ui/qt/stats_tree_dialog.cpp | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/ui/qt/stats_tree_dialog.cpp b/ui/qt/stats_tree_dialog.cpp index e94d19ebc5..c9f8ad3d85 100644 --- a/ui/qt/stats_tree_dialog.cpp +++ b/ui/qt/stats_tree_dialog.cpp @@ -44,9 +44,7 @@ // - Add help // - Update to match bug 9452 / r53657 -#include <QDebug> - -const int item_col_ = 0; +const int item_col_ = 0; const int expand_all_threshold_ = 100; // Arbitrary @@ -72,15 +70,15 @@ public: } }; -StatsTreeDialog::StatsTreeDialog(QWidget *parent, capture_file *cf, const char *cfg_abbr) : - QDialog(parent), +StatsTreeDialog::StatsTreeDialog(QWidget &parent, CaptureFile &cf, const char *cfg_abbr) : + WiresharkDialog(parent, cf), ui(new Ui::StatsTreeDialog), st_(NULL), - st_cfg_(NULL), - cap_file_(cf) + st_cfg_(NULL) { ui->setupUi(this); st_cfg_ = stats_tree_get_cfg_by_abbr(cfg_abbr); + memset(&cfg_pr_, 0, sizeof(struct _tree_cfg_pres)); if (!st_cfg_) { QMessageBox::critical(this, tr("Configuration not found"), @@ -110,35 +108,19 @@ StatsTreeDialog::~StatsTreeDialog() delete ui; } -void StatsTreeDialog::setCaptureFile(capture_file *cf) -{ - if (!cf) { // We only want to know when the file closes. - cap_file_ = NULL; - ui->displayFilterLineEdit->setEnabled(false); - ui->applyFilterButton->setEnabled(false); - } -} - void StatsTreeDialog::fillTree() { GString *error_string; - if (!st_cfg_) return; + if (!st_cfg_ || file_closed_) return; gchar* display_name_temp = stats_tree_get_displayname(st_cfg_->name); QString display_name(display_name_temp); g_free(display_name_temp); - setWindowTitle(display_name + tr(" Stats Tree")); + // The GTK+ UI appends "Stats Tree" to the window title. If we do the same + // here we should expand the name completely, e.g. to "Statistics Tree". + setWindowSubtitle(display_name); - if (!cap_file_) return; - - if (st_cfg_->in_use) { - QMessageBox::warning(this, tr("%1 already open").arg(display_name), - tr("Each type of tree can only be generated one at time.")); - reject(); - } - - st_cfg_->in_use = TRUE; st_cfg_->pr = &cfg_pr_; cfg_pr_.st_dlg = this; @@ -174,13 +156,12 @@ void StatsTreeDialog::fillTree() reject(); } - cf_retap_packets(cap_file_); + cf_retap_packets(cap_file_.capFile()); drawTreeItems(st_); ui->statsTreeWidget->setSortingEnabled(true); remove_tap_listener(st_); - st_cfg_->in_use = FALSE; st_cfg_->pr = NULL; } @@ -250,6 +231,14 @@ void StatsTreeDialog::drawTreeItems(void *st_ptr) } } +void StatsTreeDialog::updateWidgets() +{ + if (file_closed_) { + ui->displayFilterLineEdit->setEnabled(false); + ui->applyFilterButton->setEnabled(false); + } +} + void StatsTreeDialog::on_applyFilterButton_clicked() { fillTree(); |