diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-02-23 10:04:16 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-02-26 17:28:04 +0000 |
commit | 070fc33e8501168debf879b9068da5da8e6445d6 (patch) | |
tree | b502f9c492f44ffe73f386dfdf9ea584f1178729 /ui/qt/main_welcome.cpp | |
parent | 10358a2f14a69fbbf0e3042429399e4934a79674 (diff) |
Qt: Update selected interface filter behavior.
Change the selected interface behavior in the main window and the
capture interfaces dialog to better handle multiple selections. Attempt
to document this at the top of interface_tree.cpp.
Move the default capture filter code from CaptureFilterEdit to
MainWelcome. Add a "conflicting filter" check to CaptureEdit which
updates the placeholder text.
Handle conflicting filters in the main welcome screen and the capture
interfaces dialog. Propagate interface selections and filter updates in
the capture interfaces dialog to the main welcome screen.
Consolidate some of the interface handling code in InterfaceTree and
CaptureInterfacesDialog.
Make sure CaptureInterfacesDialog manages the global capture options by
device name instead numeric index.
Start deprecating prefs.capture_devices_filter and
capture_dev_user_cfilter_find.
Change some member function names so that they're hopefully more clear
and consistent.
Ping-Bug: 11886
Change-Id: I63b06dbae29c2c45ee9252092ad54bdcbacae6e6
Reviewed-on: https://code.wireshark.org/review/14129
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/main_welcome.cpp')
-rw-r--r-- | ui/qt/main_welcome.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp index a789132f78..94ac30f399 100644 --- a/ui/qt/main_welcome.cpp +++ b/ui/qt/main_welcome.cpp @@ -171,8 +171,9 @@ MainWelcome::MainWelcome(QWidget *parent) : connect(welcome_ui_->interfaceTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(interfaceClicked(QTreeWidgetItem*,int))); #endif - connect(welcome_ui_->interfaceTree, SIGNAL(interfacesUpdated()), + connect(welcome_ui_->interfaceTree, SIGNAL(itemSelectionChanged()), welcome_ui_->captureFilterComboBox, SIGNAL(interfacesChanged())); + connect(welcome_ui_->interfaceTree, SIGNAL(itemSelectionChanged()), this, SLOT(interfaceSelected())); connect(welcome_ui_->captureFilterComboBox->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(captureFilterTextEdited(QString))); connect(welcome_ui_->captureFilterComboBox, SIGNAL(pushFilterSyntaxStatus(const QString&)), @@ -242,6 +243,13 @@ void MainWelcome::appInitialized() welcome_ui_->childContainer->setGraphicsEffect(NULL); #endif +#ifdef HAVE_LIBPCAP + welcome_ui_->captureFilterComboBox->lineEdit()->setText(global_capture_opts.default_options.cfilter); +#endif // HAVE_LIBPCAP + + // Trigger interfacesUpdated. + welcome_ui_->interfaceTree->selectedInterfaceChanged(); + delete splash_overlay_; splash_overlay_ = NULL; } @@ -275,6 +283,26 @@ void MainWelcome::captureFilterTextEdited(const QString capture_filter) // update_filter_string(device.name, filter_text); } } + welcome_ui_->interfaceTree->updateToolTips(); +} + +// The interface list selection has changed. At this point the user might +// have entered a filter or we might have pre-filled one from a number of +// sources such as our remote connection, the command line, or a previous +// selection. +// Must not change any interface data. +void MainWelcome::interfaceSelected() +{ + QPair <const QString, bool> sf_pair = CaptureFilterEdit::getSelectedFilter(); + const QString user_filter = sf_pair.first; + bool conflict = sf_pair.second; + + if (conflict) { + welcome_ui_->captureFilterComboBox->lineEdit()->clear(); + welcome_ui_->captureFilterComboBox->setConflict(true); + } else { + welcome_ui_->captureFilterComboBox->lineEdit()->setText(user_filter); + } } void MainWelcome::interfaceDoubleClicked(QTreeWidgetItem *item, int) @@ -382,6 +410,12 @@ void MainWelcome::resizeEvent(QResizeEvent *event) QFrame::resizeEvent(event); } +void MainWelcome::setCaptureFilterText(const QString capture_filter) +{ + welcome_ui_->captureFilterComboBox->lineEdit()->setText(capture_filter); + captureFilterTextEdited(capture_filter); +} + void MainWelcome::changeEvent(QEvent* event) { if (0 != event) |