Qt: change default behavior of 'Decode As' window

Up to know Qt 'Decode As' window was saving manual configuration automatically, contrary to GTK UI.
This can be misleading when decoding protocols without a fixed identifier (port number, USB bus/device id, ...).
Opening a new trace might lead to previous and now irrelevant settings being applied.
Make this optional and add a Save button to permanently store the current configuration.

Change-Id: I077c560f9e71cab16a74247e2e9d87523c0ed85e
Reviewed-on: https://code.wireshark.org/review/9058
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Pascal Quantin 2015-06-23 10:31:58 -07:00 committed by Alexis La Goutte
parent 8bc294c0d1
commit 0901e26505
3 changed files with 20 additions and 7 deletions

View File

@ -537,7 +537,7 @@ void DecodeAsDialog::resetChangedList(const gchar *table_name,
}
}
void DecodeAsDialog::on_buttonBox_accepted()
void DecodeAsDialog::applyChanges()
{
/* Reset all dissector tables, then apply all rules from GUI */
@ -592,13 +592,25 @@ void DecodeAsDialog::on_buttonBox_accepted()
delete(dissector_info);
}
save_decode_as_entries();
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
}
void DecodeAsDialog::on_buttonBox_helpRequested()
void DecodeAsDialog::on_buttonBox_clicked(QAbstractButton *button)
{
wsApp->helpTopicAction(HELP_DECODE_AS_SHOW_DIALOG);
switch (ui->buttonBox->standardButton(button)) {
case QDialogButtonBox::Ok:
applyChanges();
break;
case QDialogButtonBox::Save:
applyChanges();
save_decode_as_entries();
break;
case QDialogButtonBox::Help:
wsApp->helpTopicAction(HELP_DECODE_AS_SHOW_DIALOG);
break;
default:
break;
}
}
/*

View File

@ -30,6 +30,7 @@
#include <QDialog>
#include <QMap>
#include <QAbstractButton>
class QTreeWidgetItem;
class QComboBox;
@ -85,8 +86,8 @@ private slots:
void selectorEditTextChanged(const QString & text);
void curProtoCurrentIndexChanged(const QString & text);
void curProtoDestroyed();
void on_buttonBox_accepted();
void on_buttonBox_helpRequested();
void applyChanges();
void on_buttonBox_clicked(QAbstractButton *button);
};
#endif // DECODE_AS_DIALOG_H

View File

@ -139,7 +139,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok|QDialogButtonBox::Save</set>
</property>
</widget>
</item>