Qt: Add hint label in Show Packet Bytes

Show frame number, field name (abbrev) and number of bytes.
Added some translations.

Change-Id: I9777d43d63a52fcdb221864bad097a9604522d3a
Reviewed-on: https://code.wireshark.org/review/13888
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Stig Bjørlykke 2016-02-10 20:39:55 +01:00
parent 7a1eca1726
commit eefcbc0a59
3 changed files with 121 additions and 2 deletions

View File

@ -49,11 +49,19 @@ ShowPacketBytesDialog::ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf) :
ui->setupUi(this);
field_info *finfo = cf.capFile()->finfo_selected;
setWindowSubtitle (QString("%1 (%2)").arg(finfo->hfinfo->name, finfo->hfinfo->abbrev));
QString field_name = QString("%1 (%2)").arg(finfo->hfinfo->name, finfo->hfinfo->abbrev);
setWindowSubtitle (field_name);
const guint8 *bytes = tvb_get_ptr(finfo->ds_tvb, 0, -1) + finfo->start;
field_bytes_ = QByteArray((const char *)bytes, finfo->length);
QString hint = tr("Frame %1, %2, %Ln byte(s).", "", finfo->length)
.arg(cf.capFile()->current_frame->num)
.arg(field_name);
hint.prepend("<small><i>");
hint.append("</i></small>");
ui->hintLabel->setText(hint);
// Try loading as image
if (image_.loadFromData(field_bytes_)) {
show_as_ = ShowAsImage;

View File

@ -30,6 +30,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hintLabel">
<property name="text">
<string>Hint.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_1" stretch="0,0,0,0,1,0,0">
<item>

View File

@ -8043,7 +8043,12 @@ a:hover {
<translation type="unfinished"></translation>
</message>
<message>
<location filename="main_window.ui" line="2866"/>
<location filename="main_window.ui" line="2842"/>
<source>Show Packet Bytes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="main_window.ui" line="2871"/>
<source>UDP Multicast Streams</source>
<translation type="unfinished"></translation>
</message>
@ -13701,6 +13706,102 @@ a:hover {
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ShowPacketBytesDialog</name>
<message>
<location filename="show_packet_bytes_dialog.ui" line="20"/>
<source>Show Packet Bytes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.ui" line="36"/>
<source>Hint.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.ui" line="48"/>
<source>Show as</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.ui" line="79"/>
<source>Find:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.ui" line="89"/>
<source>Find &amp;Next</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="show_packet_bytes_dialog.cpp" line="58"/>
<source>Frame %1, %2, %Ln byte(s).</source>
<translation type="unfinished">
<numerusform>Frame %1, %2, %Ln byte.</numerusform>
<numerusform>Frame %1, %2, %Ln bytes.</numerusform>
</translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="76"/>
<source>ASCII</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="77"/>
<source>EBCDIC</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="78"/>
<source>Hex Dump</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="79"/>
<source>HTML</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="80"/>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="81"/>
<source>ISO 8859-1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="82"/>
<source>Raw</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="83"/>
<source>UTF-8</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="87"/>
<source>Print</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="90"/>
<source>Copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="93"/>
<source>Save as</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="show_packet_bytes_dialog.cpp" line="179"/>
<source>Save Selected Packet Bytes As</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SimpleDialog</name>
<message>