aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/widgets/byte_view_text.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-11-28Qt: Remove a couple of private variables.Gerald Combs1-6/+6
ByteViewText and ProtoTree only use mono_font_ in setMonospaceFont, so there's not much use in declaring it private in each case. Change-Id: I3ad986052f6e013988ce851420f7f6e7b47b7ea8 Reviewed-on: https://code.wireshark.org/review/35255 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-11-17Qt: Cleanup space inside parenthesesStig Bjørlykke1-2/+2
Remove randomly used space inside parentheses to make the coding style uniform. Add space after if, for and while. Change-Id: I519f5994b6f73d8a57a5004d51ca460276c618fe Reviewed-on: https://code.wireshark.org/review/35112 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-30Qt: fix more more Qt 5.13 deprecation warningsPeter Wu1-9/+17
Potential functional changes: - rect_on_screen: the new function no longer subtracts the space needed for the dock, task bar, etc. - fontMetrics().width(text) -> fontMetrics.boundingRect(text).width(): the bounding box width could be larger than horizontalAdvance(text). For the bytes view, they should be the same due to monospace font. The display filter field calculation was made more accurate (it assumes that textMargins() is 0 which is the default). Change-Id: I70b7937f9215d3bef278befdac7c36a023ffff84 Reviewed-on: https://code.wireshark.org/review/33770 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-24Qt: Switch ui/qt/widgets/*.cpp to new-style signals and slots.Gerald Combs1-2/+2
Switch our remaining home-grown widgets (which excludes QCustomPlot) to new-style signals and slots. Change-Id: Icbe2d25d4ddad11b66f4c1369fa0da89c213ba72 Reviewed-on: https://code.wireshark.org/review/31190 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-07Qt: Set the ByteViewText field and protocol foreground.Gerald Combs1-0/+4
Set a foreground color when we add a field and protocol format range. On some systems the highlight background is darker or lighter than the normal background, and we need to adjust the foreground to match. Add a note about correctly handling our hover rect color. Change-Id: Ib6b50403dec889280eb3d27f3deb10150d22a599 Reviewed-on: https://code.wireshark.org/review/28076 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-05Qt: Remove checks for version below 5.2Roland Knall1-2/+0
This stops the main source from being buildable by Qt 4.x Change-Id: I61edbae04ac2b3bf0ae8ee8e09d335083945c176 Reviewed-on: https://code.wireshark.org/review/26756 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-02-08replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.Dario Lombardo1-1/+1
The first is deprecated, as per https://spdx.org/licenses/. Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed Reviewed-on: https://code.wireshark.org/review/25661 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-01Qt: More byte view and proto tree fixes.Gerald Combs1-6/+19
47e1798762 broke byte view highlighting when selecting a proto tree item. Switch back to emitting fieldSelected from selectionChanged. Force a new selection in selectedFieldChanged, which does what we were trying to do in 47e1798762. Clear our marked byte offset in the byte view when we mark a field. Emit byteSelected whenever we click the mouse. Don't highlight anything when a tree item is deselected. Deselect a tree item if we click on something that's not a byte in the byte view. Change-Id: Ibf419ccb005d69f733b2fe12ce674e1fe504bb96 Reviewed-on: https://code.wireshark.org/review/25541 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-31Qt: Byte view and proto tree fixes.Gerald Combs1-2/+4
Select our byte field only when we enter marked / locked mode. Emit fieldSelected from autoScrollTo so that we always set the marked protocol. Don't clobber the current index in saveSelectedField. Change-Id: I967b20608f991a5f3e6a0979b1f702f874ce27b4 Reviewed-on: https://code.wireshark.org/review/25521 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-30Byte view: Mark bytes using an outline.Gerald Combs1-19/+11
Distinguish between hovered and marked bytes using a lighter and heavier outline. Remove the "mark" color definitions. Change-Id: Icf6363e920a634574b7a42a10ea77b538ce78290 Reviewed-on: https://code.wireshark.org/review/25513 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-24byte_view_text (qt): Fix Dead Store (Dead assignement/Dead increment) ↵Alexis La Goutte1-1/+1
Warning found by Clang Change-Id: Ibfaac5e1d8cc30d6bb8917d0c0e10a79e059a53e Reviewed-on: https://code.wireshark.org/review/25452 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-19Qt: Force integer font metrics in the byte view.Gerald Combs1-12/+15
Force the layout engine to use integer arithmetic so that we don't run into wierd rounding artifacts. Include the leading when applying formats. Restrict the hover line width to either 0.5 or 1 logical pixels. Change-Id: Icc992e085e96e328ed4ed247271f75ddd69637bc Reviewed-on: https://code.wireshark.org/review/25381 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-18Qt: Fix bits highlighting in the byte view.Gerald Combs1-4/+5
When the byte view is set to "Show bytes as bits" make sure we highlight all eight bits instead of just two. Change-Id: I1ece65032fa32f7274f4e7383e538b92e8fa4f65 Reviewed-on: https://code.wireshark.org/review/25354 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-17Qt: ByteViewText hover fixes & updates.Gerald Combs1-17/+44
Add back field highlighting during hover. Instead of marking hovered bytes using an underline+overline, draw a border rect. Change-Id: I574dd074cfa021ac0dec3cdea6c5f9b0b4da6d0e Reviewed-on: https://code.wireshark.org/review/25348 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-15Qt: change obsolete qVariantFromValue into QVariant::fromValue.Dario Lombardo1-5/+5
Change-Id: I767b06c0e316347cdb28b769f1032e6d44cba45b Reviewed-on: https://code.wireshark.org/review/25321 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Roland Knall <rknall@gmail.com> Reviewed-by: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-05Qt: Byte view recent updates.Gerald Combs1-24/+32
Add a recent.gui_bytes_encoding preference and use it for the byte view encoding as requested in bug 14044. The recent.gui_bytes_view preference is an enum, so make it one. Bug: 14044 Change-Id: Ibc40721c29465aca1940467e41d71e9dd2485e71 Reviewed-on: https://code.wireshark.org/review/25147 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2017-12-28Qt: Fix moc interface issueRoland Knall1-2/+0
moc has an issue with interfaces defined in classes, where also other Qt objects are being defined. At least in some versions for Qt, this may lead to the interface declaration not being found Change-Id: Id143311322086abe23085d2482957ec330ae67c8 Reviewed-on: https://code.wireshark.org/review/25032 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2017-12-27Qt: Add "Copy as…" to the byte view.Gerald Combs1-20/+22
Make ByteViewText an IDataPrintable and add "Copy as…" context menu actions. Remove some unused functions. Bug: 14276 Change-Id: Ie48c7c9b016de19fd8978397d03d23e9a7fe247a Reviewed-on: https://code.wireshark.org/review/24933 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2017-12-25Qt: rework ByteViewText::addFormatRange to avoid dead code (CID: 1426074).Dario Lombardo1-3/+2
Change-Id: I8341a6106cd38118f0bf1bdb87aa87cc90e89eee Reviewed-on: https://code.wireshark.org/review/24966 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-22byte_view_text.cpp: add initializers to please GCC 7.2.1Pascal Quantin1-2/+2
Even if a code review suggests that they are not required, it silence 2 compiler warnings. Change-Id: I9ea45dd6759275dd8a2b8fc48fc41d0a9cecbcc2 Reviewed-on: https://code.wireshark.org/review/24942 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-22Qt: Lighten non-printable byte view characters.Gerald Combs1-1/+20
Draw non-printable characters using a lighter foreground color in the byte view. Change-Id: Ib97a1f9f897fa6f78e33ff80c7efea21f68ef2d5 Reviewed-on: https://code.wireshark.org/review/24935 Reviewed-by: Roland Knall <rknall@gmail.com>
2017-12-21Qt: Add back byte view hover.Gerald Combs1-10/+31
Add back the byte view hover behavior. Draw an overline+underline when hovering to make it a bit less distracting and to make hovered vs marked modes more obvious. Update names to match. Change-Id: I554d1cad98199f08f1c19796b14d158ad41706b4 Reviewed-on: https://code.wireshark.org/review/24932 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2017-12-08More QVector fixes.Gerald Combs1-2/+2
Change-Id: I710f9c9d5391a8f1252cc02fdd263a8dfedb31f6 Reviewed-on: https://code.wireshark.org/review/24730 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-12-07Qt: Fix ByteViewText compilation for Qt < 5.5.Gerald Combs1-4/+4
Older versions of Qt don't let you pass a QVector to QVector::append. Change-Id: I58d62c44aa915d4ffb8319e08db85eee069ecbb2 Reviewed-on: https://code.wireshark.org/review/24729 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-12-07Qt: Use QTextLayout in ByteViewText.Gerald Combs1-204/+200
Use QTextLayout to draw each line in ByteViewText instead of drawing fragments ourselves. Build our pixel-to-byte-offset map when we draw our first line, which should hopefully make it more accurate. This should fix layout and hover issues on some systems. Start moving common code to DataPrinter. Mark prefs.gui_hex_dump_highlight_style GTK+ only. Bug: 11844 Change-Id: Ifda16ae7dc1a5ea22570c0bfd0eb20cee621bfc9 Reviewed-on: https://code.wireshark.org/review/24717 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2017-11-12Qt: Rename packetSelection to frameSelectedRoland Knall1-0/+1
In order to consolidate the interfaces between certain parts of the UI, the signal emitted after a frame change has occured, has to include the number of the frame. This led to two signals for frame change, and therefore packetSelection is to be removed. Change-Id: I24e0e0890291d2243935b0c48387beb66904bfa3 Reviewed-on: https://code.wireshark.org/review/24377 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
2017-11-08Qt: Further cleanup ByteViewRoland Knall1-0/+596
This further separates ByteView and the rest of the system. Using FieldInformation and DataPrinter, this is the final cleanup of the ByteViewTab Change-Id: If41521167527cf5664c2564cdd0d45fea0f3f612 Reviewed-on: https://code.wireshark.org/review/22783 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>