Qt: accept hexadecimal input in Decode As dialog

The usb.product dissector table displays vendor+product values as
hexadecimal, ensure that these are not parsed as zero.

While at it, clarify the meaning of the model contents. Ideally the
model should store numeric selectors as integers rather than strings,
but that requires more work.

Change-Id: I3bb17ad0d0a03c8813ded4ea6890dbc2aedd738d
Reviewed-on: https://code.wireshark.org/review/26087
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2018-02-25 00:19:43 +01:00 committed by Anders Broman
parent 15c261e94b
commit 5cbc09e937
2 changed files with 6 additions and 6 deletions

View File

@ -259,7 +259,7 @@ bool DecodeAsModel::setData(const QModelIndex &cur_index, const QVariant &value,
if (IS_FT_STRING(selector_type)) {
item->selectorString_ = value.toString();
} else if (IS_FT_UINT(selector_type)) {
item->selectorUint_ = value.toUInt();
item->selectorUint_ = value.toString().toUInt(Q_NULLPTR, 0);
}
}
break;

View File

@ -49,11 +49,11 @@ public:
DecodeAsModel(QObject *parent, capture_file *cf = NULL);
enum DecodeAsColumn {
colTable = 0,
colSelector,
colType,
colDefault, // aka "initial"
colProtocol, // aka "current"
colTable = 0, // aka "Field" (or dissector table like "TCP Port")
colSelector, // the actual table value (e.g., port number 80)
colType, // field type (e.g. "Integer, base 16")
colDefault, // aka "initial" protocol chosen by Wireshark
colProtocol, // aka "current" protocol selected by user
colDecodeAsMax //not used
};