Qt: Autoset limit to display filter for expert dialog

Autoset the "Limit to display filter" if a display filter
was present, when the dialog was opened
This commit is contained in:
Roland Knall 2022-06-12 17:28:57 +02:00
parent 01f9dcbb7b
commit 212abb7efe
4 changed files with 8 additions and 17 deletions

View File

@ -2865,10 +2865,8 @@ void LogwolfMainWindow::openFollowStreamDialogForType(follow_type_t type) {
// -z expert
void LogwolfMainWindow::statCommandExpertInfo(const char *, void *)
{
ExpertInfoDialog *expert_dialog = new ExpertInfoDialog(*this, capture_file_);
const DisplayFilterEdit *df_edit = dynamic_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
expert_dialog->setDisplayFilter(df_edit->text());
ExpertInfoDialog *expert_dialog = new ExpertInfoDialog(*this, capture_file_, df_edit->text());
connect(expert_dialog->getExpertInfoView(), SIGNAL(goToPacket(int, int)),
packet_list_, SLOT(goToPacket(int, int)));

View File

@ -33,12 +33,12 @@
// down to one item, make sure it uses a single (or a few) base color(s), and generate
// icons on the fly.
ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) :
ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file, QString displayFilter) :
WiresharkDialog(parent, capture_file),
ui(new Ui::ExpertInfoDialog),
expert_info_model_(new ExpertInfoModel(capture_file)),
proxyModel_(new ExpertInfoProxyModel(this)),
display_filter_(QString())
display_filter_(displayFilter)
{
ui->setupUi(this);
@ -105,7 +105,8 @@ ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) :
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent)),
this, SLOT(captureEvent(CaptureEvent)));
setDisplayFilter();
updateWidgets();
QTimer::singleShot(0, this, SLOT(retapPackets()));
}
@ -121,12 +122,6 @@ void ExpertInfoDialog::clearAllData()
expert_info_model_->clear();
}
void ExpertInfoDialog::setDisplayFilter(const QString &display_filter)
{
display_filter_ = display_filter;
updateWidgets();
}
ExpertInfoTreeView* ExpertInfoDialog::getExpertInfoView()
{
return ui->expertInfoTreeView;
@ -174,6 +169,7 @@ void ExpertInfoDialog::captureEvent(CaptureEvent e)
void ExpertInfoDialog::updateWidgets()
{
ui->limitCheckBox->setEnabled(! file_closed_ && ! display_filter_.isEmpty());
ui->limitCheckBox->setChecked(! display_filter_.isEmpty());
ui->actionShowError->setEnabled(expert_info_model_->numEvents(ExpertInfoModel::severityError) > 0);
ui->actionShowWarning->setEnabled(expert_info_model_->numEvents(ExpertInfoModel::severityWarn) > 0);

View File

@ -31,11 +31,10 @@ class ExpertInfoDialog : public WiresharkDialog
Q_OBJECT
public:
explicit ExpertInfoDialog(QWidget &parent, CaptureFile& capture_file);
explicit ExpertInfoDialog(QWidget &parent, CaptureFile& capture_file, QString displayFilter);
~ExpertInfoDialog();
void clearAllData();
void setDisplayFilter(const QString &display_filter = QString());
ExpertInfoTreeView* getExpertInfoView();

View File

@ -3150,10 +3150,8 @@ void WiresharkMainWindow::on_actionWirelessWlanStatistics_triggered()
// -z expert
void WiresharkMainWindow::statCommandExpertInfo(const char *, void *)
{
ExpertInfoDialog *expert_dialog = new ExpertInfoDialog(*this, capture_file_);
const DisplayFilterEdit *df_edit = dynamic_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
expert_dialog->setDisplayFilter(df_edit->text());
ExpertInfoDialog *expert_dialog = new ExpertInfoDialog(*this, capture_file_, df_edit->text());
connect(expert_dialog->getExpertInfoView(), SIGNAL(goToPacket(int, int)),
packet_list_, SLOT(goToPacket(int, int)));