diff options
-rw-r--r-- | epan/prefs.h | 2 | ||||
-rw-r--r-- | ui/qt/capture_interfaces_dialog.cpp | 127 | ||||
-rw-r--r-- | ui/qt/capture_interfaces_dialog.h | 8 | ||||
-rw-r--r-- | ui/qt/capture_interfaces_dialog.ui | 6 | ||||
-rw-r--r-- | ui/qt/interface_tree.cpp | 10 | ||||
-rw-r--r-- | ui/qt/main_welcome.cpp | 43 | ||||
-rw-r--r-- | ui/qt/main_welcome.h | 2 | ||||
-rw-r--r-- | ui/qt/main_window.h | 7 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 38 |
9 files changed, 150 insertions, 93 deletions
diff --git a/epan/prefs.h b/epan/prefs.h index ca5c389779..6bb48d70dd 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -202,7 +202,7 @@ typedef struct _e_prefs { #endif gchar *capture_devices_snaplen; gchar *capture_devices_pmode; - gchar *capture_devices_filter; + gchar *capture_devices_filter; /* XXX - Mostly unused. Deprecate? */ gboolean capture_prom_mode; gboolean capture_pcap_ng; gboolean capture_real_time; diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp index e18bd50bf8..d234f08b52 100644 --- a/ui/qt/capture_interfaces_dialog.cpp +++ b/ui/qt/capture_interfaces_dialog.cpp @@ -33,9 +33,10 @@ #ifdef HAVE_LIBPCAP -#include <QTimer> +#include <QAbstractItemModel> #include <QFileDialog> #include <QMessageBox> +#include <QTimer> #include "ringbuffer.h" #include "ui/capture_ui_utils.h" @@ -60,8 +61,10 @@ // To do: // - Set a size hint for item delegates. // - Make promiscuous a checkbox. -// - Allow sorting by the traffic column? We'd have to subclass QTreeWidgetItem -// (see ConversationTreeWidget). +// - Fix InterfaceTreeDelegate method names. +// - You can edit filters via the main CaptureFilterCombo and via each +// individual interface row. We should probably do one or the other. +// - resizeColumnToContents isn't shrinking some columns properly. const int stat_update_interval_ = 1000; // ms @@ -153,27 +156,22 @@ CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : connect(ui->interfaceTree,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(interfaceClicked(QTreeWidgetItem*,int))); connect(ui->interfaceTree, SIGNAL(itemSelectionChanged()), this, SLOT(interfaceSelected())); - connect(ui->allFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(allFilterChanged())); - connect(this, SIGNAL(interfacesChanged()), ui->allFilterComboBox, SIGNAL(interfacesChanged())); + connect(ui->captureFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(updateWidgets())); + connect(ui->captureFilterComboBox->lineEdit(), SIGNAL(textEdited(QString)), + this, SLOT(filterEdited())); + connect(&interface_item_delegate_, SIGNAL(filterChanged(QString)), + ui->captureFilterComboBox->lineEdit(), SLOT(setText(QString))); + connect(this, SIGNAL(interfacesChanged()), ui->captureFilterComboBox, SIGNAL(interfacesChanged())); connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList())); connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces())); connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); } -void CaptureInterfacesDialog::allFilterChanged() -{ - foreach (QTreeWidgetItem *ti, ui->interfaceTree->selectedItems()) { - QString str = ui->allFilterComboBox->currentText(); - ti->setText(col_filter_, str); - } - updateWidgets(); -} - void CaptureInterfacesDialog::interfaceSelected() { interface_t *device; - if (!ui->interfaceTree->selectedItems().size()) { + if (ui->interfaceTree->selectedItems().isEmpty()) { for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { device = &g_array_index(global_capture_opts.all_ifaces, interface_t, i); device->selected = false; @@ -190,9 +188,22 @@ void CaptureInterfacesDialog::interfaceSelected() updateWidgets(); } +void CaptureInterfacesDialog::filterEdited() +{ + QList<QTreeWidgetItem*> si = ui->interfaceTree->selectedItems(); + if (si.isEmpty()) return; + + foreach (QTreeWidgetItem *ti, si) { + ti->setText(col_filter_, ui->captureFilterComboBox->lineEdit()->text()); + } + + QModelIndex col_filter_idx = ui->interfaceTree->model()->index(ui->interfaceTree->indexOfTopLevelItem(si[0]), col_filter_); + ui->interfaceTree->scrollTo(col_filter_idx); +} + void CaptureInterfacesDialog::updateWidgets() { - SyntaxLineEdit *sle = qobject_cast<SyntaxLineEdit *>(ui->allFilterComboBox->lineEdit()); + SyntaxLineEdit *sle = qobject_cast<SyntaxLineEdit *>(ui->captureFilterComboBox->lineEdit()); if (!sle) { return; } @@ -210,7 +221,7 @@ void CaptureInterfacesDialog::updateWidgets() void CaptureInterfacesDialog::interfaceClicked(QTreeWidgetItem *, int) { guint i; - QString filter = ui->allFilterComboBox->currentText(); + QString filter = ui->captureFilterComboBox->currentText(); global_capture_opts.num_selected = 0; for (i = 0; i < global_capture_opts.all_ifaces->len; i++) { @@ -257,10 +268,11 @@ void CaptureInterfacesDialog::on_capturePromModeCheckBox_toggled(bool checked) interface_t *device; prefs.capture_prom_mode = checked; for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]); + QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); + int device_idx = ti->data(col_interface_, Qt::UserRole).toUInt(); + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); // QString device_name = ui->interfaceTree->topLevelItem(row)->text(col_interface_); device->pmode = checked; - QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); ti->setText(col_pmode_, checked? tr("enabled"):tr("disabled")); } } @@ -329,10 +341,8 @@ void CaptureInterfacesDialog::on_cbResolveTransportNames_toggled(bool checked) void CaptureInterfacesDialog::start_button_clicked() { - qDebug("Starting capture"); - if (saveOptionsToPreferences()) { - emit setFilterValid(true); + emit setFilterValid(true, ui->captureFilterComboBox->lineEdit()->text()); accept(); } } @@ -463,18 +473,18 @@ void CaptureInterfacesDialog::updateInterfaces() if (global_capture_opts.all_ifaces->len > 0) { interface_t *device; - for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, i); + for (guint device_idx = 0; device_idx < global_capture_opts.all_ifaces->len; device_idx++) { + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); /* Continue if capture device is hidden */ if (device->hidden) { continue; } - deviceMap[ui->interfaceTree->topLevelItemCount()] = i; // Traffic sparklines InterfaceTreeWidgetItem *ti = new InterfaceTreeWidgetItem(ui->interfaceTree); ti->setFlags(ti->flags() | Qt::ItemIsEditable); + ti->setData(col_interface_, Qt::UserRole, qVariantFromValue(device_idx)); ti->setData(col_traffic_, Qt::UserRole, qVariantFromValue(&ti->points)); ti->setText(col_interface_, device->display_name); @@ -552,12 +562,16 @@ void CaptureInterfacesDialog::updateInterfaces() #ifdef HAVE_EXTCAP } #endif - gchar* prefFilter = capture_dev_user_cfilter_find(device->name); - if (prefFilter) { - g_free(device->cfilter); - device->cfilter = prefFilter; + // If the capture filter column has text, assume that the user + // has filled it in via selectedIfaceCaptureFilterComboBox. + if (ti->text(col_filter_).isEmpty()) { + gchar* user_cfilter = capture_dev_user_cfilter_find(device->name); + if (user_cfilter) { + g_free(device->cfilter); + device->cfilter = user_cfilter; + } + ti->setText(col_filter_, device->cfilter); } - ti->setText(col_filter_, device->cfilter); if (prefs.capture_device && strstr(prefs.capture_device, device->name) != NULL) { device->selected = TRUE; @@ -623,7 +637,7 @@ void CaptureInterfacesDialog::on_compileBPF_clicked() interfaces.append(ti->text(col_interface_)); } - QString filter = ui->allFilterComboBox->currentText(); + QString filter = ui->captureFilterComboBox->currentText(); CompiledFilterOutput *cfo = new CompiledFilterOutput(this, interfaces, filter); cfo->show(); @@ -631,8 +645,6 @@ void CaptureInterfacesDialog::on_compileBPF_clicked() bool CaptureInterfacesDialog::saveOptionsToPreferences() { - interface_t *device; - if (ui->rbPcapng->isChecked()) { global_capture_opts.use_pcapng = true; prefs.capture_pcap_ng = true; @@ -761,7 +773,15 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() global_capture_opts.autostop_files = ui->stopFilesSpinBox->value(); } - for (int col = col_link_; col <= col_filter_; col++){ + interface_t *device; + + // Close the editor if it's open. + QTreeWidgetItem *ti = ui->interfaceTree->currentItem(); + if (ti) { + ui->interfaceTree->setCurrentItem(ti, col_interface_); + } + + for (int col = col_link_; col <= col_filter_; col++) { if (ui->interfaceTree->isColumnHidden(col)) { continue; } @@ -773,7 +793,9 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() QStringList link_list; for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]); + QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); + guint device_idx = ti->data(col_interface_, Qt::UserRole).toUInt(); + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); if (device->active_dlt == -1) { continue; } @@ -789,7 +811,9 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() QStringList buffer_size_list; for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]); + QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); + guint device_idx = ti->data(col_interface_, Qt::UserRole).toUInt(); + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); if (device->buffer == -1) { continue; } @@ -805,7 +829,9 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() QStringList snaplen_list; for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]); + QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); + guint device_idx = ti->data(col_interface_, Qt::UserRole).toUInt(); + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); snaplen_list << QString("%1:%2(%3)") .arg(device->name) .arg(device->has_snaplen) @@ -820,7 +846,9 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() QStringList pmode_list; for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]); + QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); + guint device_idx = ti->data(col_interface_, Qt::UserRole).toUInt(); + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); if (device->pmode == -1) { continue; } @@ -836,7 +864,9 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() QStringList monitor_list; for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]); + QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); + guint device_idx = ti->data(col_interface_, Qt::UserRole).toUInt(); + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); if (!device->monitor_mode_supported || (device->monitor_mode_supported && !device->monitor_mode_enabled)) { continue; } @@ -849,18 +879,18 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() #endif // HAVE_MONITOR_SETTING case col_filter_: { - QStringList filter_list; - + // XXX Update selected interfaces only? for (int row = 0; row < ui->interfaceTree->topLevelItemCount(); row++) { - device = &g_array_index(global_capture_opts.all_ifaces, interface_t, deviceMap[row]); - if (!device->cfilter) { - continue; + QTreeWidgetItem *ti = ui->interfaceTree->topLevelItem(row); + guint device_idx = ti->data(col_interface_, Qt::UserRole).toUInt(); + device = &g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx); + g_free(device->cfilter); + if (ti->text(col_filter_).isEmpty()) { + device->cfilter = NULL; + } else { + device->cfilter = qstring_strdup(ti->text(col_filter_)); } - filter_list << QString("%1(%2)").arg(device->name).arg(device->cfilter); } - g_free(prefs.capture_devices_filter); - prefs.capture_devices_filter = qstring_strdup(filter_list.join(",")); - break; } } } @@ -1019,6 +1049,7 @@ QWidget* InterfaceTreeDelegate::createEditor(QWidget *parent, const QStyleOption case col_filter_: { CaptureFilterCombo *cf = new CaptureFilterCombo(parent); + connect(cf->lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(filterChanged(QString))); w = (QWidget*) cf; } default: diff --git a/ui/qt/capture_interfaces_dialog.h b/ui/qt/capture_interfaces_dialog.h index b1139f76d3..0c38cf310e 100644 --- a/ui/qt/capture_interfaces_dialog.h +++ b/ui/qt/capture_interfaces_dialog.h @@ -55,6 +55,9 @@ public: void setTree(QTreeWidget* tree) { tree_ = tree; } bool eventFilter(QObject *object, QEvent *event); +signals: + void filterChanged(const QString filter); + private slots: void pmode_changed(QString index); #if defined (HAVE_PCAP_CREATE) @@ -93,9 +96,9 @@ private slots: void on_buttonBox_helpRequested(); void interfaceClicked(QTreeWidgetItem *item, int column); void interfaceSelected(); + void filterEdited(); void updateWidgets(); void updateStatistics(void); - void allFilterChanged(); void refreshInterfaceList(); void updateLocalInterfaces(); void browseButtonClicked(); @@ -106,7 +109,7 @@ signals: void stopCapture(); void getPoints(int row, PointList *pts); void setSelectedInterfaces(); - void setFilterValid(bool valid); + void setFilterValid(bool valid, const QString capture_filter); void interfacesChanged(); void ifsChanged(); void interfaceListChanged(); @@ -120,7 +123,6 @@ private: if_stat_cache_t *stat_cache_; QTimer *stat_timer_; InterfaceTreeDelegate interface_item_delegate_; - QMap<int, int> deviceMap; bool saveOptionsToPreferences(); }; diff --git a/ui/qt/capture_interfaces_dialog.ui b/ui/qt/capture_interfaces_dialog.ui index a4aae74501..267885e396 100644 --- a/ui/qt/capture_interfaces_dialog.ui +++ b/ui/qt/capture_interfaces_dialog.ui @@ -121,16 +121,16 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1,0,0"> <item> <widget class="QLabel" name="label_4"> <property name="text"> - <string>Capture Filter for selected Interfaces:</string> + <string>Capture filter for selected interfaces:</string> </property> </widget> </item> <item> - <widget class="CaptureFilterCombo" name="allFilterComboBox"> + <widget class="CaptureFilterCombo" name="captureFilterComboBox"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> diff --git a/ui/qt/interface_tree.cpp b/ui/qt/interface_tree.cpp index 94b798a7fa..30f0fd5e9f 100644 --- a/ui/qt/interface_tree.cpp +++ b/ui/qt/interface_tree.cpp @@ -45,6 +45,9 @@ #include <QHeaderView> #include <QTimer> +// To do: +// - Add tooltips to each tree item to show addresses, filters, and other info. + #ifdef HAVE_LIBPCAP const int stat_update_interval_ = 1000; // ms #endif @@ -178,7 +181,6 @@ void InterfaceTree::display() // traffic, interface name, or most recently used. QList<QTreeWidgetItem *> phys_ifaces; QList<QTreeWidgetItem *> virt_ifaces; - QTreeWidgetItem *selected_iface = NULL; for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); @@ -213,9 +215,9 @@ void InterfaceTree::display() phys_ifaces << ti; } + // XXX Need to handle interfaces passed from the command line. if (strstr(prefs.capture_device, device.name) != NULL) { device.selected = TRUE; - selected_iface = ti; global_capture_opts.num_selected++; global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i); g_array_insert_val(global_capture_opts.all_ifaces, i, device); @@ -224,9 +226,7 @@ void InterfaceTree::display() if (!phys_ifaces.isEmpty()) addTopLevelItems(phys_ifaces); if (!virt_ifaces.isEmpty()) addTopLevelItems(virt_ifaces); - if (selected_iface) { - setCurrentItem(selected_iface); - } + setSelectedInterfaces(); // XXX Add other device information resizeColumnToContents(IFTREE_COL_NAME); diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp index 87341b6869..a789132f78 100644 --- a/ui/qt/main_welcome.cpp +++ b/ui/qt/main_welcome.cpp @@ -27,6 +27,8 @@ #include <epan/prefs.h> +#include "ui/capture_globals.h" + #include "wsutil/ws_version_info.h" #include "main_welcome.h" @@ -171,6 +173,8 @@ MainWelcome::MainWelcome(QWidget *parent) : #endif connect(welcome_ui_->interfaceTree, SIGNAL(interfacesUpdated()), welcome_ui_->captureFilterComboBox, SIGNAL(interfacesChanged())); + connect(welcome_ui_->captureFilterComboBox->lineEdit(), SIGNAL(textEdited(QString)), + this, SLOT(captureFilterTextEdited(QString))); connect(welcome_ui_->captureFilterComboBox, SIGNAL(pushFilterSyntaxStatus(const QString&)), this, SIGNAL(pushFilterSyntaxStatus(const QString&))); connect(welcome_ui_->captureFilterComboBox, SIGNAL(popFilterSyntaxStatus()), @@ -207,6 +211,14 @@ const QString MainWelcome::captureFilter() return welcome_ui_->captureFilterComboBox->currentText(); } +void MainWelcome::setCaptureFilter(const QString capture_filter) +{ + // capture_filter comes from the current filter in + // CaptureInterfacesDialog. We need to find a good way to handle + // multiple filters. + welcome_ui_->captureFilterComboBox->lineEdit()->setText(capture_filter); +} + void MainWelcome::appInitialized() { // XXX Add a "check for updates" link? @@ -234,6 +246,37 @@ void MainWelcome::appInitialized() splash_overlay_ = NULL; } +// Update each selected device cfilter when the user changes the contents +// of the capture filter lineedit. We do so here so that we don't clobber +// filters set in the Capture Options / Interfaces dialog or ones set via +// the command line. +void MainWelcome::captureFilterTextEdited(const QString capture_filter) +{ + if (global_capture_opts.num_selected > 0) { + interface_t device; + + for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { + device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); + if (!device.selected) { + continue; + } + // if (device.active_dlt == -1) { + // simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The link type of interface %s was not specified.", device.name); + // continue; /* Programming error: somehow managed to select an "unsupported" entry */ + // } + g_array_remove_index(global_capture_opts.all_ifaces, i); + g_free(device.cfilter); + if (capture_filter.isEmpty()) { + device.cfilter = NULL; + } else { + device.cfilter = qstring_strdup(capture_filter); + } + g_array_insert_val(global_capture_opts.all_ifaces, i, device); + // update_filter_string(device.name, filter_text); + } + } +} + void MainWelcome::interfaceDoubleClicked(QTreeWidgetItem *item, int) { if (item) { diff --git a/ui/qt/main_welcome.h b/ui/qt/main_welcome.h index 37676a5941..4118d0668a 100644 --- a/ui/qt/main_welcome.h +++ b/ui/qt/main_welcome.h @@ -43,6 +43,7 @@ public: virtual ~MainWelcome(); InterfaceTree *getInterfaceTree(); const QString captureFilter(); + void setCaptureFilter(const QString capture_filter); protected: void resizeEvent(QResizeEvent *event); @@ -70,6 +71,7 @@ signals: private slots: void appInitialized(); + void captureFilterTextEdited(const QString capture_filter); #if HAVE_EXTCAP void interfaceClicked(QTreeWidgetItem *item, int column); #endif diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 20c7233f32..9d142452ad 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -279,6 +279,11 @@ private slots: void initViewColorizeMenu(); // in main_window_slots.cpp + /** + * @brief startCapture + * Start capturing from the selected interfaces using the capture filter + * shown in the main welcome screen. + */ void startCapture(); void pipeTimeout(); void pipeActivated(int source); @@ -307,7 +312,7 @@ private slots: void addExternalMenus(); QMenu * searchSubMenu(QString objectName); - void startInterfaceCapture(bool valid); + void startInterfaceCapture(bool valid, const QString capture_filter); void setFeaturesEnabled(bool enabled = true); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 56bbec4c30..1881350e41 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -838,36 +838,6 @@ void MainWindow::startCapture() { /* XXX - we might need to init other pref data as well... */ - // Set our cfilters. - QString capture_filter = main_welcome_->captureFilter(); - g_free(global_capture_opts.default_options.cfilter); - if (capture_filter.isEmpty()) { - global_capture_opts.default_options.cfilter = NULL; - } else { - global_capture_opts.default_options.cfilter = qstring_strdup(capture_filter); - } - - if (global_capture_opts.num_selected > 0) { - interface_t device; - - for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) { - device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); - if (!device.selected) { - continue; - } - // if (device.active_dlt == -1) { - // simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The link type of interface %s was not specified.", device.name); - // continue; /* Programming error: somehow managed to select an "unsupported" entry */ - // } - g_array_remove_index(global_capture_opts.all_ifaces, i); - g_free(device.cfilter); - device.cfilter = qstring_strdup(capture_filter); - g_array_insert_val(global_capture_opts.all_ifaces, i, device); - // update_filter_string(device.name, filter_text); - } - } - - /* XXX - can this ever happen? */ if (cap_session_.state != CAPTURE_STOPPED) return; @@ -1418,9 +1388,12 @@ void MainWindow::captureFilterSyntaxChanged(bool valid) interfaceSelectionChanged(); } -void MainWindow::startInterfaceCapture(bool valid) +void MainWindow::startInterfaceCapture(bool valid, const QString capture_filter) { capture_filter_valid_ = valid; + main_welcome_->setCaptureFilter(capture_filter); + // The interface tree will update the selected interfaces via its timer + // so no need to do anything here. startCapture(); } @@ -3608,7 +3581,8 @@ void MainWindow::on_actionStatisticsProtocolHierarchy_triggered() #ifdef HAVE_LIBPCAP void MainWindow::on_actionCaptureOptions_triggered() { - connect(&capture_interfaces_dialog_, SIGNAL(setFilterValid(bool)), this, SLOT(startInterfaceCapture(bool))); + connect(&capture_interfaces_dialog_, SIGNAL(setFilterValid(bool, const QString)), + this, SLOT(startInterfaceCapture(bool, const QString))); capture_interfaces_dialog_.SetTab(0); capture_interfaces_dialog_.updateInterfaces(); |