Commit Graph

34 Commits

Author SHA1 Message Date
Stig Bjørlykke 44a615e854 Qt: Give a directory to wsApp->setLastOpenDir()
Use wsApp->setLastOpenDirFromFilename() to convert a filename
to a directory name before calling wsApp->setLastOpenDir().

This will ensure to always store a directory instead of a filename
in the recent gui.fileopen_remembered_dir.
2021-06-07 13:52:59 +00:00
Gerald Combs d3f17ee08a Remove modelines in ui/qt.
Remove the editor modeline blocks from most of the source files in ui/qt
by running

    perl -i -p0e 's{ \n+ /[ *\n]+ editor \s+ modelines .* shiftwidth= .* \*/ \s+ } {\n}gsix' $( ag -g '\.(cpp|h)' )

then cleaning up the remaining files by hand.

This *shouldn't* affect anyone since

- All of the source files in ui/qt use 4 space indentation, which
  matches the default in our top-level .editorconfig

- The one notable editor that's likely to be used on these files and
  *doesn't* support EditorConfig (Qt Creator) defaults to 4 space
  indentation.
2021-03-08 18:11:32 +00:00
Gerald Combs d2da4c7afb Qt: Use … instead of UTF8_HORIZONTAL_ELLIPSIS in translated strings.
Run

$ gsed -i -e 's/\(tr *(.*".*\)" *UTF8_HORIZONTAL_ELLIPSIS/\1…"/' $( ag -l 'tr *\(.*" *UTF8_HORIZONTAL_ELLIPSIS' )
$ gsed -i -e 's/\(tr *( *\)UTF8_HORIZONTAL_ELLIPSIS *"/\1"…/' $( ag -l 'tr *\( *UTF8_HORIZONTAL_ELLIPSIS *"' )

in ui/qt. As discussed in #16812, the UTF8_ macros were required at one
time because we only allowed ASCII in our source code. However, that
requirement has since been relaxed and Qt's translation framework
doesn't handle concatenating strings and macros very well.
2020-10-01 06:40:14 +00:00
Martin Mathieson e0eefe186a Fix some cppcheck issues:
- Some redundant assignments or tests.
- Some declarations were changed to match definitions in terms of
including _U_ for the same parameters
- Some parenthesis added/changed to made precedence more obvious

epan/color_filters.c:533: style: Variable 'name' is reassigned a value before the old one has been used.
epan/color_filters.c:534: style: Variable 'filter_exp' is reassigned a value before the old one has been used.
asn1/tcap/packet-tcap-template.c:2199: warning: Function 'dissect_tcap_ITU_ComponentPDU' argument order different: declaration '_U_, tvb, offset, _U_, tree, _U_' definition '_U_, tvb, offset, actx, tree, _U_'
epan/dissectors/packet-aim.c:2546: warning: Function 'dissect_aim_tlv_value_icq' argument order different: declaration 'ti, subtype, tvb, _U_' definition 'ti, _U_, tvb, pinfo'
epan/dissectors/packet-arp.c:1133: style: Clarify calculation precedence for '&' and '?'.
epan/dissectors/packet-arp.c:1143: style: Clarify calculation precedence for '&' and '?'.
epan/dissectors/packet-arp.c:1158: style: Clarify calculation precedence for '&' and '?'.
epan/dissectors/packet-arp.c:1168: style: Clarify calculation precedence for '&' and '?'.
epan/dissectors/packet-gtpv2.c:5997: warning: Function 'dissect_gtpv2_mbms_service_area' argument order different: declaration 'tvb, _U_, tree, _U_, _U_, _U_, _U_, _U_' definition 'tvb, _U_, tree, item, _U_, _U_, _U_, _U_'
epan/dissectors/packet-gtpv2.c:6291: warning: Function 'dissect_gtpv2_mbms_time_to_data_xfer' argument order different: declaration 'tvb, _U_, tree, _U_, _U_, _U_, _U_, _U_' definition 'tvb, _U_, tree, item, _U_, _U_, _U_, _U_'
epan/dissectors/packet-gtpv2.c:6369: warning: Function 'dissect_gtpv2_epc_timer' argument order different: declaration 'tvb, _U_, tree, _U_, _U_, _U_, _U_, _U_' definition 'tvb, _U_, tree, item, _U_, message_type, _U_, _U_'
epan/dissectors/packet-knxip.c:2939: style: Condition 'mac_error' is always false  (just added comment)
epan/dissectors/packet-mac-lte.c:4386: style: Clarify calculation precedence for '&' and '?'.
epan/dissectors/packet-nas_5gs.c:1828: style: Variable 'nas5gs_data->payload_container_type' is reassigned a value before the old one has been used. (noted confusing recursion)
epan/dissectors/packet-rpcrdma.c:587: warning: Identical condition 'offset>max_offset', second condition is always false
epan/dissectors/packet-rsl.c:2098: style: Assignment of function parameter has no effect outside the function.

Change-Id: Ib5c9a04cfb6e6233972bc041434601c8ef09c969
Reviewed-on: https://code.wireshark.org/review/37343
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-06-01 20:44:27 +00:00
Gerald Combs 76d92ba7e7 Qt: Updates for 5.15.
Fix the following deprecation issues for Qt 5.15:

Use Qt::WindowFlags() instead of 0 in Qt >= 5.6.

Pass Qt::SkipEmptyParts instead of QString::SkipEmptyParts to QString::split() in Qt >= 5.15.

Use QMultiMap instead of QMap where we were using QMap::uniqeKeys().

Use QCP::Interactions() instead of 0.

Use '\n' instead of QTextStream::endl.

Use QWheelEvent::angleDelta() instead of QWheelEvent::angle().

Change-Id: Ie2d69d3a396c0821c2c34f506ddad6f8e22f7049
Reviewed-on: https://code.wireshark.org/review/37334
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>
2020-05-30 06:45:07 +00:00
Gerald Combs 48024b102d Qt: Make sure shortcuts are visible in context menus.
As of Qt 5.10, context menu shortcuts can be hidden:

https://bugreports.qt.io/browse/QTBUG-61181

Add set_action_shortcuts_visible_in_context_menu to qt_ui_utils and call
it for our context menus as needed. For Qt 5.{10,11,12} it calls
QAction::setShortcutVisibleInContextMenu(true).

For Qt 5.13 and later, call
QStyleHints::setShowShortcutsInContextMenus(true) in
WiresharkApplication.

Change-Id: Ie8941951c3a9801b4642f4ce15ac217e37d1300f
Reviewed-on: https://code.wireshark.org/review/35761
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-01-13 18:58:28 +00:00
Stig Bjørlykke a51c58fa1b Qt: Cleanup space inside parentheses
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-11-17 20:43:10 +00:00
Alexis La Goutte ef500e800a Update to qcustomplot 2.0.1
Upgrade the internal version of QCustomPlot to 2.0.1

Change-Id: I1eb372d8e6a2f6c1bbdde4c74596785bf2d405c2
Reviewed-on: https://code.wireshark.org/review/17980
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-09-17 08:34:46 +00:00
Gerald Combs 62999cc677 Windows: Make sure more native dialogs handle HiDPI.
Add a WiresharkFileDialog class, which is a thin wrapper around a few
QFileDialog functions that sets per-monitor v2 DPI awareness before
showing native dialogs and resets the awareness context afterward.
Use it where we call QFileDialog::getXXX.

Change-Id: Ib711a70aa94b693a2515804a729f666ea7fbd673
Reviewed-on: https://code.wireshark.org/review/27568
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-05-16 04:22:20 +00:00
Stig Bjørlykke 14720ace06 Fix comment end after SPDX identifier
Move */ to a separate line below the SPDX identifier.

Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f
Reviewed-on: https://code.wireshark.org/review/27211
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-01 06:56:37 +00:00
Martin Mathieson bd41b8e417 RLC graph: fix zooming, both in normal case and when graph direction has been switched
Change-Id: I05e02b2821367ef1a78b9ededd462324053cf06e
Reviewed-on: https://code.wireshark.org/review/25683
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-09 05:30:55 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
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-08 14:57:36 +00:00
Dario Lombardo e52172c775 Qt: use SPDX identifiers.
Change-Id: I111945c08f99818c249a868c12d9a7b3a3df64b3
Reviewed-on: https://code.wireshark.org/review/25563
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-02 13:39:36 +00:00
Peter Wu 9be01dc616 Qt 4.8 compatibility fixes
Add missing include headers, define Q_NULLPTR for all Qt objects (to
avoid having to include an ugly compat header), use old signal/slot
syntax (Q_SIGNALS are protected in Qt 4.8), disable Qt 5 log message
handler, etc.

Change-Id: I449beb0b74050fdfb0fc5828d8fb74eedb2b45bf
Reviewed-on: https://code.wireshark.org/review/25469
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-25 17:17:13 +00:00
Martin Mathieson cd573915ea LTE RLC graph: export graph as image, like TCP stream does
Change-Id: I8709f7c09528a44a9729a06ea2ba4d6f99dbeccb
Reviewed-on: https://code.wireshark.org/review/24864
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-17 08:02:34 +00:00
Martin Mathieson d96ef7ed05 Allow switching direction in LTE RLC graph
Change-Id: I1681089aebe7f00b2b84ece00c53a3bf8769d50b
Reviewed-on: https://code.wireshark.org/review/24682
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2017-12-09 13:58:19 +00:00
Guy Harris 8aa14236f8 Have the frame_tvbuff.c routines not use the global cfile.
Have the routines that create them take a pointer to a struct
packet_provider_data, store that in the tvbuff data, and use it to get
the wtap from which packets are being read.

While we're at it, don't include globals.h in any header files, and
include it in source files iff the source file actually uses cfile.  Add
whatever includes that requires.

Change-Id: I9f1ee391f951dc427ff62c80f67aa4877a37c229
Reviewed-on: https://code.wireshark.org/review/24733
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-08 08:31:41 +00:00
Martin Mathieson 5350fd741f RLC LTE graph: add comments clarifying tracer limitation
Change-Id: Ib6a79689ced9377b1ac00513810db2e86d26d83f
Reviewed-on: https://code.wireshark.org/review/24690
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-04 05:49:49 +00:00
Martin Mathieson e7b12d8550 LTE RLC graph: 'r' should reset, not zoom out
Change-Id: I34ad795b5c4f3f5d47b357d3af1de1f4b5fe481b
Reviewed-on: https://code.wireshark.org/review/24561
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-24 05:12:01 +00:00
Roland Knall ddfc1d37cc Qt: Move utils to separate utils directory
Following the move for widgets directory, moving utils
to the utils directory. Guidelines for this directory are:

 - Generic use but not a widget
 - Utility functionality used by many classes
 
 Note: additionally all includes affected by this move have been changed
 to absolute path includes, instead of relative ones.

Change-Id: I019ae4b6e6f6d06a5745a63ed195edbd36fb936b
Reviewed-on: https://code.wireshark.org/review/22602
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-07-26 10:11:55 +00:00
Dario Lombardo 88b9b750f5 Qt: add initializer (CID 1328485).
Change-Id: I1ce4ddc8bfb66522d4e472c258de2f928d5c776f
Reviewed-on: https://code.wireshark.org/review/17298
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-08-24 12:26:54 +00:00
Dario Lombardo bad783b38a Qt: add initializers (CID 1328485).
Change-Id: I9135dabc3f656ac17f6269221f795a5dda7552af
Reviewed-on: https://code.wireshark.org/review/16946
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-07 18:27:16 +00:00
Stig Bjørlykke 1a716800e3 Qt: Add dialog geometry restore
Add GeometryStateDialog class to handle load and save dialog geometry.
The QDialog class name will be used as window name.  For shared
classes the UAT name or the statistics title or abbr will be used.

Change-Id: I5a019598307fb3861518f41e733de834788184d8
Reviewed-on: https://code.wireshark.org/review/14139
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-02-28 18:25:50 +00:00
Pascal Quantin 4fc7423da0 RLC LTE: upgrade dissector to v13.0.0
Change-Id: Ibe4586925ffe49f5aaab72956c40e123855a1a1e
Reviewed-on: https://code.wireshark.org/review/13620
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-01-31 12:55:28 +00:00
Guy Harris ddd217469d Always supply a g_mallocated error message from select_rlc_lte_session().
That way, we don't have to pass a "free this" indication separately.

While we're at it, don't just free the error message, *display* it in
all cases where rlc_graph_segment_list_get() fails.

(I wish more programming languages had a proper string type, including
some whose names consist solely of the third letter of the alphabet, but
I digress....)

Change-Id: I99f8b088aa19bc8fbb178bdb36d85ba5b89c06e0
Reviewed-on: https://code.wireshark.org/review/12902
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-29 08:01:54 +00:00
Martin Mathieson ad44f2c7b7 RLC Graph: call replot() with rpQueued to avoid lag caused by trying to draw every mouse position
Change-Id: Ibde38a1168f8d8dafbce5985a4b10ed935d95cba
Reviewed-on: https://code.wireshark.org/review/11249
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-24 20:44:18 +00:00
Martin Mathieson c70ab1a122 LTE RLC Graph: fix CID 1328485: Uninitialized members (UNINIT_CTOR)
Change-Id: Ia3d6a87ba4d8fb0ff66700d19ec30ffaeea86f2b
Reviewed-on: https://code.wireshark.org/review/11201
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-21 21:06:50 +00:00
Martin Mathieson 9768a3e8a0 LTE dialogs: tidy up some loose ends
Change-Id: I18f099311f7660c91cffdf21bbacdb88b7c0fd7e
Reviewed-on: https://code.wireshark.org/review/11182
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-20 20:02:44 +00:00
Martin Mathieson 7fc88045ea RLC LTE graph: allow switching between zoom and drag, and place limits on each
Change-Id: I9fb9fa5be25dc56810dcbf2d4d5607d79eed541e
Reviewed-on: https://code.wireshark.org/review/11146
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-19 15:48:58 +00:00
Martin Mathieson 8efd83ef82 LTE RLC Graph: add support for going to packet clicked
Change-Id: I7e1ada7508c33f7ccea5703a9ea9e2a76ecdb706
Reviewed-on: https://code.wireshark.org/review/11118
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-17 21:27:26 +00:00
Martin Mathieson b92caedf91 RLC statistics window can now launch UL or DL graphs
Change-Id: I9eb1ceacaee6aab510c5a005d40334867cafc8a4
Reviewed-on: https://code.wireshark.org/review/11059
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-16 08:31:00 +00:00
Martin Mathieson dfe1b0f054 Remove unused offset variables.
Fixes CID 1327340.

Change-Id: I1914e21ca7c0e911534a850fe2a8210b28650bee
Reviewed-on: https://code.wireshark.org/review/11055
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-15 09:03:34 +00:00
Martin Mathieson 0f27ed7ed7 Try to fix OS X buildbot but using a different QBrush constructor in the cases that were failing (where implicit conversion seems to be failing)
Change-Id: Id0393c2403ed953579c7d571e9880849b7dff8b3
Reviewed-on: https://code.wireshark.org/review/10952
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-12 08:37:16 +00:00
Martin Mathieson 3221dbf542 LTE RLC graphs - initial version
Change-Id: Ic5f2c353ae1f787ac19cb575a938cb093ff5f6dc
Reviewed-on: https://code.wireshark.org/review/10930
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-10-11 21:59:45 +00:00