diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2014-01-18 15:20:02 +0100 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-02-25 17:43:13 +0000 |
commit | 579e7e19ce8e5f1a6e16b75f130ad4b001157ca5 (patch) | |
tree | 423547b0256e93647f98710cf14e15e112f7f73f /ui/qt/capture_file_dialog.cpp | |
parent | b6aae8d5c470aa681b70f33cad064dbb7045b3b7 (diff) | |
download | wireshark-579e7e19ce8e5f1a6e16b75f130ad4b001157ca5.tar.gz |
Wireshark: Add option to choose format type of capture file
The best heuristic can fail, so add possibility to manually choose
capture file format type, so not correctly recognize file format can be
loaded in Wireshark.
On the other side now it is possible to open capture file
as file format to be dissected.
Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a
Reviewed-on: https://code.wireshark.org/review/16
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'ui/qt/capture_file_dialog.cpp')
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index 68cd033e1d..bb78faf3fb 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -231,7 +231,7 @@ bool CaptureFileDialog::isCompressed() { return compressed_; } -int CaptureFileDialog::open(QString &file_name) { +int CaptureFileDialog::open(QString &file_name, unsigned int &type) { GString *fname = g_string_new(file_name.toUtf8().constData()); GString *dfilter = g_string_new(display_filter_.toUtf8().constData()); gboolean wof_status; @@ -239,6 +239,7 @@ int CaptureFileDialog::open(QString &file_name) { // XXX Add a widget->HWND routine to qt_ui_utils and use it instead. wof_status = win32_open_file((HWND)parentWidget()->effectiveWinId(), fname, dfilter); file_name = fname->str; + type = format_type_.currentIndex(); display_filter_ = dfilter->str; g_string_free(fname, TRUE); @@ -499,6 +500,15 @@ void CaptureFileDialog::addDisplayFilterEdit() { last_row_++; } +void CaptureFileDialog::addFormatTypeSelector(QVBoxLayout &v_box) { + format_type_.addItem("Automatic"); + for (int i = 0; open_routines[i].name != NULL; i += 1) { + format_type_.addItem(open_routines[i].name); + } + + v_box.addWidget(&format_type_, 0, Qt::AlignTop); +} + void CaptureFileDialog::addResolutionControls(QVBoxLayout &v_box) { mac_res_.setText(tr("&MAC name resolution")); mac_res_.setChecked(gbl_resolv_flags.mac_name); @@ -548,11 +558,12 @@ QDialogButtonBox *CaptureFileDialog::addHelpButton(topic_action_e help_topic) return button_box; } -int CaptureFileDialog::open(QString &file_name) { +int CaptureFileDialog::open(QString &file_name, unsigned int &type) { setWindowTitle(tr("Wireshark: Open Capture File")); setNameFilters(buildFileOpenTypeList()); setFileMode(QFileDialog::ExistingFile); + addFormatTypeSelector(left_v_box_); addDisplayFilterEdit(); addResolutionControls(left_v_box_); addPreview(right_v_box_); @@ -569,6 +580,7 @@ int CaptureFileDialog::open(QString &file_name) { if (QFileDialog::exec() && selectedFiles().length() > 0) { file_name = selectedFiles()[0]; + type = format_type_.currentIndex(); display_filter_.append(display_filter_edit_->text()); gbl_resolv_flags.mac_name = mac_res_.isChecked(); @@ -761,7 +773,7 @@ void CaptureFileDialog::preview(const QString & path) return; } - wth = wtap_open_offline(path.toUtf8().data(), &err, &err_info, TRUE); + wth = wtap_open_offline(path.toUtf8().data(), WTAP_TYPE_AUTO, &err, &err_info, TRUE); if (wth == NULL) { if(err == WTAP_ERR_FILE_UNKNOWN_FORMAT) { preview_format_.setText(tr("unknown file format")); |