Have UatFrame send out proper notifications.

UatFrame was originally written for filter expressions, so it still
had some "filter expression specific" functionality in it.
Move the "filter expression notifications" to the preferences dialog
and add support for proper notification if UAT affects fields or
dissection (like expert info UAT).

Change-Id: I84cd0c7923450692916bbc6c2cdce93a9830d722
Reviewed-on: https://code.wireshark.org/review/22758
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2017-07-21 19:12:52 -04:00
parent 4107f6bca7
commit 40d158eee3
3 changed files with 21 additions and 4 deletions

View File

@ -917,6 +917,11 @@ void PreferencesDialog::on_buttonBox_accepted()
pd_ui_->filterExpressonsFrame->acceptChanges();
pd_ui_->expertFrame->acceptChanges();
//Filter expressions don't affect dissection, so there is no need to
//send any events to that effect. However, the app needs to know
//about any button changes.
wsApp->emitAppSignal(WiresharkApplication::FilterExpressionsChanged);
prefs_main_write();
if (save_decode_as_entries(&err) < 0)
{

View File

@ -114,6 +114,20 @@ void UatFrame::setUat(epan_uat *uat)
setWindowTitle(title);
}
void UatFrame::applyChanges()
{
if (!uat_) return;
if (uat_->flags & UAT_AFFECTS_FIELDS) {
/* Recreate list with new fields and redissect packets */
wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
}
if (uat_->flags & UAT_AFFECTS_DISSECTION) {
/* Just redissect packets if we have any */
wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
}
}
void UatFrame::acceptChanges()
{
if (!uat_) return;
@ -130,10 +144,7 @@ void UatFrame::acceptChanges()
uat_->post_update_cb();
}
//Filter expressions don't affect dissection, so there is no need to
//send any events to that effect. However, the app needs to know
//about any button changes.
wsApp->emitAppSignal(WiresharkApplication::FilterExpressionsChanged);
applyChanges();
}
}

View File

@ -55,6 +55,7 @@ private:
void checkForErrorHint(const QModelIndex &current, const QModelIndex &previous);
bool trySetErrorHintFromField(const QModelIndex &index);
void addRecord(bool copy_from_current = false);
void applyChanges();
private slots:
void modelDataChanged(const QModelIndex &topLeft);