aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/utils
AgeCommit message (Collapse)AuthorFilesLines
2024-02-25Fix lots of spellingsMartin Mathieson1-1/+1
2024-02-18added copy as C Arrayvxcute2-0/+14
2024-02-15Qt: Implement macOS "Show in Finder" in Cocoa.Darius Davis1-27/+5
Rather than shelling out to "osascript" and telling it to tell Finder to show the file, we can directly use NSWorkspace's "activateFileViewerSelectingURLs:" method to launch Finder and highlight the chosen file. It's less code, runs faster, and should be much less risky regarding special characters, string encodings, etc.
2024-02-15Qt: Implement "Show in Folder" using DBus.Darius Davis1-2/+39
On Linux (and presumably other DBus-using Unix-like OSes), right-clicking on a file on the Welcome page and choosing "Show in Folder" would only ever open the folder, and would not highlight the chosen file. Adding DBus support to function desktop_show_in_folder allows for the file itself to be shown -- subject to support from the user's desktop environment...
2024-02-09Add Stack Overflow links for showing file in folder.Guy Harris1-0/+20
Those links are to questions with answers that indicate how to show a folder window with a particular file selected using system APIs rather than firing up programs.
2024-01-22Qt: Add back "Copy as Printable Text"Gerald Combs2-0/+14
As it turns out, "Copy as Printable Text" is useful for copying text-based protocol data. Paritally revert 2a96b3e1d1 and add it back to DataPrinter::copyActions. Fixes #19607
2023-11-15Qt: Use qstring_strdup in more placesGerald Combs1-1/+1
2023-11-13Make the code that handles the file open dialog style common code.Guy Harris1-24/+1
Move it from a some dialog boxes' code to get_open_dialog_initial_dir().
2023-11-12Work around macOS running applications in /.Guy Harris2-6/+7
If an application is launched from the Finder, it appears to get / as its current directory. This causes Wireshark open/save dialogs to open up / if the user hasn't already opened a file in another directory, so that there's no "last open directory" in the recent file. Have get_persdatafile_dir(), on UN*X, cache the personal data directory just as it does on Windows and, if nothing's been cached, have it fetch the current directory and, if that succeeds *and* it's not the root directory, use that. Otherwise, use the user's home directory. Fixes #9862. In addition, separate the notion of "last open directory" and "open dialog initial directory", where the latter is the last open directory *if* a file has been opened in this session or the recent file has the last open directory from a previous session, otherwise it's the user's personal data directory. Use the latter notion in file open/save dialogs; use the former notion when reading from and writing to the recent file. This means we don't need to set the "last open directory" at startup time. That way, running Wireshark without opening a file won't cause the "last open directory" to be set, so that if a user runs it from a directory, the "open dialog initial directory" won't be the last directory from which Wireshark was run.
2023-11-02Qt: Enforce Minimum Qt version 5.11John Thacker1-1/+1
We already strongly recommend Qt version 5.12 and enforce 5.10. Commit 06cd84a6e9f8bd0807cca35595b94b07de254b07 said "[a]lthough build support for 5.10 and 5.11 is not being removed at this point, it might be for 4.x at a later time." Move to enforcing 5.11, and update macos-setup for that as well. Remove the QT_VERSION_CHECKs for 5.10 and 5.11 (except in qcustomplot.) Hold off on enforcing 5.12 for now, because there isn't any code that needs 5.12 or greater (there are two places for a workaround for Qt 5.12.0 through 5.12.5), and because Debian Buster is on Qt 5.11.3. There are not any known supported OS distributions on Qt 5.10.
2023-10-24Add option to copy bytes as Go literalDaniël van Eeden2-0/+14
2023-09-23Qt: uninit class member in constructor (CID 1530129)Jaap Keuter1-1/+3
2023-09-08Qt: Dark mode updatesGerald Combs1-0/+8
For all platforms, use QStyleHints::colorScheme to check for a dark theme if it's available. On Windows + Qt >= 6.5, use the fusion style for dark mode as described at https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5 Although the blog post specifically mentions Windows 11, this seems to work fine here on Windows 10. Fixes #16221
2023-09-03Qt: Call EditResolvedName from the PacketListJohn Thacker2-2/+2
Allow Edit Resolved Name to be called from the packet details, for fields that are IPv4 or IPv6 addresses. Add to the combobox of possible addresses to edit all (non hidden) IPv4 or IPv6 fields. Set the index of the combobox to the selected column (if it is an address, and the packet list has focus or was selected), or to the currently selected field (if selected from the packet details, and an IP address.) Check other types of address columns (such as network address and custom columns) to see if they match the unresolved string for an IP address. Don't both redissecting the packets if the network resolution is off, because it won't do anything. There's a use case for editing several names before turning on the preference to avoid processor intensive redissects. Fix #17284
2023-08-04MAC Blocks: Use a proxy model to implement filteringJoão Valverde2-0/+14
Implement the search as a QSortFilterProxyModel filter, instead of using a simpler binary search. The only practical difference is that the dialog now shows all entries when the input is empty, instead of an empty table.
2023-06-27Qt: Replace copy "...as Printable Text" context actionJoão Valverde2-35/+20
Remove the "printable text" action because it never does the right thing. Copying bytes as text needs an encoding. Either this eats some bytes silently, which is already bad, or it actually produces UTF-8 encoding errors by omitting values outside the ASCII range. Copying as "printable text" is already correctly supported using the copy "Value" context option. This is guaranteed to be valid UTF-8 (modulo any bugs). Replace it with a C-style format using ASCII and escape sequences, that is somewhat in the spirit on printable text, produces valid output and should be really useful. I opted to remove the "Escaped String" option too because it is very similar to the C string added above and IMO less friendly, but this is just opinion and if people really like this format over escaped ASCII for some reason it can and should be added back. While here rename the "Raw Bytes" menu option to be more meaningful.
2023-06-20ftypes: Rename IS_FT_* macrosJoão Valverde1-2/+2
Rename IS_FT_*() to FT_IS_*(). I find it to be more natural and a better namespace for a public interface.
2023-05-16View bytes as decimal or octalPreben Guldberg1-2/+19
An attempt at implementing request in issue #18615. Adding octal view while at it, in case anybody happens to prefer that or compare with reference data in octal. Both decimal and octal view have three byte wide columns, which is visually distinctive from hex view. Decimal uses leading spaces, which makes it clearly different from octal view. Some ternary operators previously done based on BYTES_HEX are now using BYTES_BITS. This change is done as the new BYTES_DEC and BYTES_OCT have more in common with BYTES_HEX and are either equivalent in context or closer linked to BYTES_HEX (e.g. for calculating column widths). While translations should be updated, I am unsure if this is automated. Also, if attempted, lupdate picks up changes from unrelated commits.
2023-05-15Qt: Ensure AudioRoutingFilter is freedJohn Thacker1-0/+1
Call the base constructor so that the AudioRoutingFilter is parented, and make the comment in rtp_audio_stream.cpp regarding temp_file_ being released by audio_output_ true.
2023-05-15Qt: Ensure the AudioSilenceGenerator is freedJohn Thacker2-2/+2
Have AudioSilenceGenerator inherit the QIODevice constructor that takes a parent, and pass the parent into the constructor when creating it in RtpPlayerDialog. This ensures that it is deleted appropriately when marker_stream_ is deleted.
2022-12-31qt: Ignore gcc 12.1 optimization bug with Qt (more e1a6913a)Alexander Clouter1-0/+6
2022-12-16Windows: Use SpeexDSP binary packageJoão Valverde1-4/+0
Remove bundled code and use vcpkg binary library instead.
2022-11-16Fix build on OpenSUSE 15.3John Thacker1-0/+1
On older Qt versions (5.12?) QVector needs to be included, not just QObject. (It isn't needed on 5.15, possibly because QVector is an alias for QList in newer Qt versions.)
2022-11-14Qt: Speed up ProtoTreeModel with lots of itemsJohn Thacker4-37/+52
When creating a ProtoNode, count the (non-hidden) children and put them in a QVector. This saves time having to iterate through all of a node's children (or the parent's children) each time the model or view wants to get the row or index number. Create and delete the needed ProtoNodes when the root node is changed, instead of recreating them on demand from the proto_nodes (since they're no longer a thin wrapper.) Fix #18625
2022-11-01Qt: Move generic methods to utilsRoland Knall2-0/+57
Move the utils for checking for the last used directory and storing it out of ProfileDialog, as they are not Profiles specific
2022-10-12Qt: minizip and minizip-ng size compatibility issuesJohn Thacker1-3/+3
MS-DOS Date and MS-DOS Time are packed 16-bit values (https://learn.microsoft.com/en-us/windows/win32/sysinfo/ms-dos-date-and-time) and when combined they make a 32-bit value. In the original minizip that comes with zlib, the combined dosDate parameter is a uLong, which is 64 bits on LP64 platforms. In minizip-ng, it is a uint32_t. At one point, minizip-ng renamed the dosDate struct member of zip_fileinfo to dos_date, but more recent versions changed it back to dosDate for compatibility, except the size remains different, so our compatibility check can't distinguish the size. clang (and possibly other compilers) complain about shortening a 64 bit unsigned long to a uint32_t so make the return value from our qDateToDosDate a uint32_t as it should be to avoid warnings on distributions with minizip-ng Also the maximum year value that can be stored in the format is 127, since it occupies bits 9-15 of the MS-DOS Date. (There was probably some confusion since the maximum year is 2107, but its offset from 1980, not 1900.)
2022-10-11Qt: Properly truncate our FieldInformation strings.Gerald Combs1-1/+2
As the Qt6 QString::QString(const QByteArray &ba) documenation says: "Note: any null ('\0') bytes in the byte array will be included in this string, converted to Unicode null characters (U+0000). This behavior is different from Qt 5.x." Make sure FieldInformation::toString() truncates its display label byte array before converting it to a QString. Fixes #18428
2022-10-04Add copy as a Base64 stringMing Chen2-2/+11
2022-09-29Replace the last of PROTO_ITEM_ macro calls with function callsJaap Keuter1-1/+1
2022-07-13Qt: Recommend 5.12 and enforce 5.10Roland Knall1-6/+0
In order to phase out older versions, we recommed 5.12 as a minimum Qt version going forward. Although build support for 5.10 and 5.11 is not being removed at this point, it might be for 4.x at a later time.
2022-04-20Require Qt 5.9 or laterJohn Thacker1-4/+0
Increase the minimum required version of Qt from 5.6 to the next LTS version, 5.9. The various Linux distributions that have not released an update to 5.9 or later (SLES 12, Debian stretch) are nearing end of support, and can be supported by the Wireshark 3.6 LTS release. Qt 5.9 requires macOS 10.0, so make that the minimum macOS version as well. Remove unneeded version checks (except from QCustomPlot).
2022-04-04Qt: Split MainApplication out from WiresharkApplication.Gerald Combs1-1/+1
Move WiresharkApplication.{cpp,h} to MainApplication.{cpp,h}. Add back WiresharkApplication as a thin superclass of MainApplication, similar to LogsharkApplication. Change all of our wsApp references to mainApp. We will likely have to change many or most of them back, but that's a commit for another time.
2022-03-25Qt: Fix more Qt6-related warnings.Gerald Combs4-4/+8
2022-03-25Qt: Handle qsizetype.Gerald Combs1-3/+4
Qt 5.10 added qsizetype, aka an ssize_t and Qt 6 makes extensive use of it. Add a compatibility typedef and use it where we can. Cast it away where we can't.
2022-02-14Qt: Refactor to avoid deprecation warning on WindowsJim Young1-9/+6
2022-02-07Qt: Fix open explorerRoland Knall1-1/+11
Apparently on Windows, if a dialog contains spaces it is not properly opened via /select. But opening the file via QDesktopServices leads to the file not being selected in the open explorer windows (expectation by the user). Therefore the original change is restored, but with a differenc call which should handle the space issue in most cases better than before. See https://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt for a short explanation (bottom of post) Fixes #17927
2022-02-07Qt: Fix show in folder issueRoland Knall1-6/+2
Opening a folder on Windows lead to undesired behaviour Fixes: #17927
2022-01-05range_string: follow-up of 893290cPascal Quantin2-7/+5
2022-01-03Qt: Add a common hover color.Gerald Combs2-0/+17
2021-12-22Qt: Make utils more independent.Gerald Combs2-10/+9
Use qApp instead of wsApp in ColorUtils and StockIcon.
2021-11-30Add UI header files to DoxygenMoshe Kaplan16-17/+20
Add @file markers for UI header files so that Doxygen will generate documentation for them.
2021-11-29wsutil: Split format_size() enumJoão Valverde1-7/+2
Use an enum to select units and a bit flag for the other options, currently only prefix type.
2021-11-29Qt: Qt6.2 compatibility fixesTomasz Moń1-1/+1
Wireshark successfully compiles on Windows with Qt6.2 with following cmake options: -DUSE_qt6=ON -DDISABLE_ERROR=ON QCustomPlot QT 6.2 patch is taken from QCustomPlot forum post by miccs.
2021-11-15regex: Prefer C99/POSIX typesJoão Valverde1-0/+2
Replace 'gssize' with 'ssize_t'. Add a CMake configure check for ssize_t. Fix missing "config.h" includes.
2021-11-10Revert "Qt: Fix epan cleanup exit crash"Gerald Combs2-15/+19
This reverts commit 5f50fad289858ac84ac59e97a6af204b4f1dd534.
2021-11-09Qt: Fix epan cleanup exit crashTomasz Moń2-19/+15
Do not keep epan_dissect_t instance hanging until FrameInformation destructor is called. Simply copy the tvb data into local buffer and cleanup epan_dissect_t instance as soon as possible. Fixes #17590
2021-10-08Qt: Remove Q_OBJECT in a few places where it's not needed.Gerald Combs4-11/+0
Q_OBJECT is only needed for signals+slots, translations, and other meta-object services. Remove it in some classes, since having it means we're generating and compiling code unnecessarily.
2021-09-23Add compatibility fix for Minizip dependencyJoão Valverde1-1/+9
2021-09-11Fix spelling errors.Guy Harris1-2/+2
The Ubuntu build commented on some spelling errors in executable code files. Fix the errors that don't come from external files containing the spelling errors (USB product and vendor IDs, PCI IDs, ASN.1 specifications), and fix some errors that don't show up in the executable code files (e.g., in comments and variable names).
2021-08-25UI: Import profiles from ZIP supporting bigger files (Bugfix)Dr. Lars Völker1-0/+10
This patch allows the profile importer to recover from a file too large to import as well as adjusts the maximum allowed config file size. Closes: #17504