diff options
author | Gerald Combs <gerald@zing.org> | 2014-12-21 13:23:02 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2014-12-22 18:12:31 +0000 |
commit | 5cdad9fe423662e2aea3d63540cd19b7e518b7c3 (patch) | |
tree | 16deed9efb4df400a81b564ec1aa5d9f5b1c9c61 /ui/qt/endpoint_dialog.cpp | |
parent | 30c3d394adbf8deff83854f01dc1082db9cac598 (diff) | |
download | wireshark-5cdad9fe423662e2aea3d63540cd19b7e518b7c3.tar.gz |
Qt: Add methods to CaptureFile and WiresharkApplication.
Add isValid, fileTitle, and retapPackets methods to CaptureFile. Add
application name and title separator convenience methods to
WiresharkApplication.
Convert traffic tables, conversations, and endpoints to use CaptureFile
directly and to let the user know when the capture file is closed. Set
the file dialog titles while we're here.
Change-Id: I990392786d3833e1e0b3638aa2d34a5ada39fa13
Reviewed-on: https://code.wireshark.org/review/5957
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/endpoint_dialog.cpp')
-rw-r--r-- | ui/qt/endpoint_dialog.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/ui/qt/endpoint_dialog.cpp b/ui/qt/endpoint_dialog.cpp index d0450bff71..e726a66bf6 100644 --- a/ui/qt/endpoint_dialog.cpp +++ b/ui/qt/endpoint_dialog.cpp @@ -41,7 +41,7 @@ #include <QUrl> const QString table_name_ = QObject::tr("Endpoint"); -EndpointDialog::EndpointDialog(QWidget *parent, capture_file *cf, int cli_proto_id, const char *filter) : +EndpointDialog::EndpointDialog(QWidget *parent, CaptureFile &cf, int cli_proto_id, const char *filter) : TrafficTableDialog(parent, cf, filter, table_name_) { #ifdef HAVE_GEOIP @@ -82,9 +82,7 @@ EndpointDialog::EndpointDialog(QWidget *parent, capture_file *cf, int cli_proto_ #endif itemSelectionChanged(); - if (cap_file_) { - cf_retap_packets(cap_file_); - } + cap_file_.retapPackets(); } EndpointDialog::~EndpointDialog() @@ -106,19 +104,19 @@ EndpointDialog::~EndpointDialog() } } -void EndpointDialog::setCaptureFile(capture_file *cf) +void EndpointDialog::captureFileClosing() { - if (!cf) { // We only want to know when the file closes. - cap_file_ = NULL; - for (int i = 0; i < trafficTableTabWidget()->count(); i++) { - EndpointTreeWidget *cur_tree = qobject_cast<EndpointTreeWidget *>(trafficTableTabWidget()->widget(i)); - remove_tap_listener(cur_tree->trafficTreeHash()); - disconnect(cur_tree, SIGNAL(filterAction(QString&,FilterAction::Action,FilterAction::ActionType)), - this, SIGNAL(filterAction(QString&,FilterAction::Action,FilterAction::ActionType))); - } - displayFilterCheckBox()->setEnabled(false); - enabledTypesPushButton()->setEnabled(false); + // Keep the dialog around but disable any controls that depend + // on a live capture file. + for (int i = 0; i < trafficTableTabWidget()->count(); i++) { + EndpointTreeWidget *cur_tree = qobject_cast<EndpointTreeWidget *>(trafficTableTabWidget()->widget(i)); + remove_tap_listener(cur_tree->trafficTreeHash()); + disconnect(cur_tree, SIGNAL(filterAction(QString&,FilterAction::Action,FilterAction::ActionType)), + this, SIGNAL(filterAction(QString&,FilterAction::Action,FilterAction::ActionType))); } + displayFilterCheckBox()->setEnabled(false); + enabledTypesPushButton()->setEnabled(false); + TrafficTableDialog::captureFileClosing(); } bool EndpointDialog::addTrafficTable(register_ct_t *table) @@ -149,7 +147,7 @@ bool EndpointDialog::addTrafficTable(register_ct_t *table) QByteArray filter_utf8; const char *filter = NULL; if (displayFilterCheckBox()->isChecked()) { - filter = cap_file_->dfilter; + filter = cap_file_.capFile()->dfilter; } else if (!filter_.isEmpty()) { filter_utf8 = filter_.toUtf8(); filter = filter_utf8.constData(); |