#include <config.h>
#include <glib.h>
#include "ui/rtp_stream.h"
#include <QString>
#include <QUuid>
Go to the source code of this file.
|
|
#define | RECENT_KEY_CAPTURE_FILE "recent.capture_file" |
| |
|
#define | RECENT_KEY_REMOTE_HOST "recent.remote_host" |
| |
|
#define | gxx_list_next(list) ((list) ? ((reinterpret_cast<GList *>(list))->next) : Q_NULLPTR) |
| |
|
#define | gxx_constlist_next(list) ((list) ? ((reinterpret_cast<const GList *>(list))->next) : Q_NULLPTR) |
| |
|
#define | gxx_list_previous(list) ((list) ? ((reinterpret_cast<GList *>(list))->prev) : Q_NULLPTR) |
| |
|
#define | gxx_constlist_previous(list) ((list) ? ((reinterpret_cast<const GList *>(list))->prev) : Q_NULLPTR) |
| |
|
#define | gxx_list_data(type, list) ((list) ? ((reinterpret_cast<type>(list->data))) : Q_NULLPTR) |
| |
|
| char * | qstring_strdup (QString q_string) |
| |
| QString | gchar_free_to_qstring (char *glib_string) |
| |
| QByteArray | gchar_free_to_qbytearray (char *glib_string) |
| |
| QByteArray | gstring_free_to_qbytearray (GString *glib_gstring) |
| |
| QByteArray | gbytearray_free_to_qbytearray (GByteArray *glib_array) |
| |
| const QString | int_to_qstring (qint64 value, int field_width=0, int base=10) |
| |
| const QString | address_to_qstring (const struct _address *address, bool enclose=false) |
| |
| const QString | address_to_display_qstring (const struct _address *address) |
| |
| const QString | val_to_qstring (const uint32_t val, const struct _value_string *vs, const char *fmt) |
| |
| const QString | val_ext_to_qstring (const uint32_t val, struct _value_string_ext *vse, const char *fmt) |
| |
| const QString | range_to_qstring (const range_string *range) |
| |
| const QString | bits_s_to_qstring (const double bits_s) |
| |
| const QString | file_size_to_qstring (const int64_t size) |
| |
| const QString | time_t_to_qstring (time_t ti_time) |
| |
| QUuid | e_guid_t_to_quuid (const struct _e_guid_t &guid) |
| |
| QString | html_escape (const QString plain_string) |
| |
| QString | join_lines (const QString multiline_string) |
| |
| void | smooth_font_size (QFont &font) |
| |
| bool | qActionLessThan (const QAction *a1, const QAction *a2) |
| |
| bool | qStringCaseLessThan (const QString &s1, const QString &s2) |
| |
| void | desktop_show_in_folder (const QString file_path) |
| |
| bool | rect_on_screen (const QRect &rect) |
| |
| void | set_action_shortcuts_visible_in_context_menu (QList< QAction * > actions) |
| |
| QVector< rtpstream_id_t * > | qvector_rtpstream_ids_copy (QVector< rtpstream_id_t * > stream_ids) |
| |
| void | qvector_rtpstream_ids_free (QVector< rtpstream_id_t * > stream_ids) |
| |
| QString | make_filter_based_on_rtpstream_id (QVector< rtpstream_id_t * > stream_ids) |
| |
| QString | openDialogInitialDir () |
| | Return the last directory that had been opened.
|
| |
|
void | storeLastDir (QString dir) |
| | Store the directory as last directory being used.
|
| |
| bool | filePathsMatch (const QString &path1, const QString &path2) |
| |
Declarations of Qt-specific UI utility routines
Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs
SPDX-License-Identifier: GPL-2.0-or-later
Utility functions for working with the Wireshark and GLib APIs.
◆ address_to_display_qstring()
| const QString address_to_display_qstring |
( |
const struct _address * |
address | ) |
|
Convert an address to a QString using address_to_display().
- Parameters
-
| address | A pointer to an address. |
- Returns
- A QString representation of the address. May be the null string (QString())
◆ address_to_qstring()
| const QString address_to_qstring |
( |
const struct _address * |
address, |
|
|
bool |
enclose = false |
|
) |
| |
Convert an address to a QString using address_to_str().
- Parameters
-
| address | A pointer to an address. |
| enclose | Enclose IPv6 addresses in square brackets. |
- Returns
- A QString representation of the address. May be the null string (QString())
◆ bits_s_to_qstring()
| const QString bits_s_to_qstring |
( |
const double |
bits_s | ) |
|
Convert a bits per second value to a human-readable QString using format_size().
- Parameters
-
| bits_s | The value to convert to string. |
- Returns
- A QString representation of the data rate in SI units.
◆ desktop_show_in_folder()
| void desktop_show_in_folder |
( |
const QString |
file_path | ) |
|
Given the path to a file, open its containing folder in the desktop shell. Highlight the file if possible.
- Parameters
-
| file_path | Path to the file. |
◆ e_guid_t_to_quuid()
| QUuid e_guid_t_to_quuid |
( |
const struct _e_guid_t & |
guid | ) |
|
Convert a e_guid_t value to a QUuid.
- Parameters
-
| guid | The value to convert. |
- Returns
- A QUuid instance created from the e_guid_t.
◆ file_size_to_qstring()
| const QString file_size_to_qstring |
( |
const int64_t |
size | ) |
|
Convert a file size value to a human-readable QString using format_size().
- Parameters
-
| size | The value to convert to string. |
- Returns
- A QString representation of the file size in SI units.
◆ filePathsMatch()
| bool filePathsMatch |
( |
const QString & |
path1, |
|
|
const QString & |
path2 |
|
) |
| |
Compare two file paths for equality using platform-aware logic.
When both files exist on disk, QFileInfo::operator== is used, which resolves symlinks, normalizes paths, and respects the filesystem's case sensitivity. When at least one file is missing, absolute paths are compared with platform-appropriate case sensitivity:
- Windows: always case-insensitive.
- macOS / FreeBSD (where _PC_CASE_SENSITIVE is available): pathconf() is queried at runtime to detect whether the underlying volume is case-sensitive or not.
- Other Unix: case-sensitive.
- Parameters
-
| path1 | First file path. |
| path2 | Second file path. |
- Returns
- true if the two paths refer to the same file.
◆ gbytearray_free_to_qbytearray()
| QByteArray gbytearray_free_to_qbytearray |
( |
GByteArray * |
glib_array | ) |
|
Transfer ownership of a GbyteArray to a newly constructed QByteArray
- Parameters
-
| glib_array | A GByteArray or NULL. Will be freed. |
- Returns
- A QByteArray instance created from the input array.
◆ gchar_free_to_qbytearray()
| QByteArray gchar_free_to_qbytearray |
( |
char * |
glib_string | ) |
|
Transfer ownership of a GLib character string to a newly constructed QString
- Parameters
-
| glib_string | A string allocated with g_malloc() or NULL. Will be freed. |
- Returns
- A QByteArray instance created from the input string.
◆ gchar_free_to_qstring()
| QString gchar_free_to_qstring |
( |
char * |
glib_string | ) |
|
Transfer ownership of a GLib character string to a newly constructed QString
- Parameters
-
| glib_string | A string allocated with g_malloc() or NULL. Will be freed. |
- Returns
- A QString instance created from the input string.
◆ gstring_free_to_qbytearray()
| QByteArray gstring_free_to_qbytearray |
( |
GString * |
glib_gstring | ) |
|
Transfer ownership of a GLib character string to a newly constructed QByteArray
- Parameters
-
| glib_gstring | A string allocated with g_malloc() or NULL. Will be freed. |
- Returns
- A QByteArray instance created from the input string.
◆ html_escape()
| QString html_escape |
( |
const QString |
plain_string | ) |
|
Escape HTML metacharacters in a string.
- Parameters
-
| plain_string | String to convert. |
- Returns
- A QString with escaped metacharacters.
◆ int_to_qstring()
| const QString int_to_qstring |
( |
qint64 |
value, |
|
|
int |
field_width = 0, |
|
|
int |
base = 10 |
|
) |
| |
Convert an integer to a formatted string representation.
- Parameters
-
| value | The integer to format. |
| field_width | Width of the output, not including any base prefix. Output will be zero-padded. |
| base | Number base between 2 and 36 (limited by QString::arg). |
- Returns
- A QString representation of the integer
◆ join_lines()
| QString join_lines |
( |
const QString |
multiline_string | ) |
|
Remove line terminators from a string. Similar to QString::simplified, but does not remove long stretches of spaces or tabs where no newline or carriage return is present.
- Parameters
-
| multiline_string | String to sanitize. |
- Returns
- A QString with line terminators (and whitespace before and after) replaced with a single space.
◆ make_filter_based_on_rtpstream_id()
| QString make_filter_based_on_rtpstream_id |
( |
QVector< rtpstream_id_t * > |
stream_ids | ) |
|
Make display filter from list of rtpstream_id
- Parameters
-
- Returns
- Filter or empty string
◆ openDialogInitialDir()
| QString openDialogInitialDir |
( |
| ) |
|
Return the last directory that had been opened.
This can be influenced by prefs.gui_fileopen_style which will allow to either open the real last dir or have the user set one specifically.
- Returns
- a reference to that directory.
◆ qActionLessThan()
| bool qActionLessThan |
( |
const QAction * |
a1, |
|
|
const QAction * |
a2 |
|
) |
| |
Compare the text of two QActions. Useful for passing to std::sort.
- Parameters
-
| a1 | First action |
| a2 | Second action |
◆ qstring_strdup()
| char * qstring_strdup |
( |
QString |
q_string | ) |
|
Create a glib-compatible copy of a QString.
- Parameters
-
- Returns
- A copy of the QString. UTF-8 allocated with g_malloc().
◆ qStringCaseLessThan()
| bool qStringCaseLessThan |
( |
const QString & |
s1, |
|
|
const QString & |
s2 |
|
) |
| |
Compare two QStrings, ignoring case. Useful for passing to std::sort.
- Parameters
-
| s1 | First string |
| s2 | Second string |
◆ qvector_rtpstream_ids_copy()
Create copy of all rtpstream_ids to new QVector => caller must release it with qvector_rtpstream_ids_free()
- Parameters
-
- Returns
- Vector of rtpstream_ids
◆ qvector_rtpstream_ids_free()
| void qvector_rtpstream_ids_free |
( |
QVector< rtpstream_id_t * > |
stream_ids | ) |
|
Free all rtpstream_ids in QVector
- Parameters
-
◆ range_to_qstring()
| const QString range_to_qstring |
( |
const range_string * |
range | ) |
|
Convert a range to a QString using range_convert_range().
- Parameters
-
| range | A pointer to a range_string struct. |
- Returns
- A QString representation of the range_string. May be the null string (QString())
◆ rect_on_screen()
| bool rect_on_screen |
( |
const QRect & |
rect | ) |
|
Test to see if a rect is visible on screen.
- Parameters
-
| rect | The rect to test, typically a "recent.gui_geometry_*" setting. |
- Returns
- true if the rect is completely enclosed by one of the display screens, false otherwise.
◆ set_action_shortcuts_visible_in_context_menu()
| void set_action_shortcuts_visible_in_context_menu |
( |
QList< QAction * > |
actions | ) |
|
Set the "shortcutVisibleInContextMenu" property to true for a list of qactions.
- Parameters
-
| actions | The actions to make visible. |
◆ smooth_font_size()
| void smooth_font_size |
( |
QFont & |
font | ) |
|
Round the current size of a font up to its next "smooth" size. If a smooth size can't be found the font is left unchanged.
- Parameters
-
◆ time_t_to_qstring()
| const QString time_t_to_qstring |
( |
time_t |
ti_time | ) |
|
Convert a time_t value to a human-readable QString using QDateTime.
- Parameters
-
| ti_time | The value to convert. |
- Returns
- A QString representation of the date time value.
◆ val_ext_to_qstring()
| const QString val_ext_to_qstring |
( |
const uint32_t |
val, |
|
|
struct _value_string_ext * |
vse, |
|
|
const char * |
fmt |
|
) |
| |
Convert a value_string_ext to a QString using val_to_str_ext().
- Parameters
-
| val | The value to convert to string. |
| vse | value_string_ext array. |
| fmt | Formatting for value not in array. |
- Returns
- A QString representation of the value_string_ext.
◆ val_to_qstring()
| const QString val_to_qstring |
( |
const uint32_t |
val, |
|
|
const struct _value_string * |
vs, |
|
|
const char * |
fmt |
|
) |
| |
Convert a value_string to a QString using val_to_str().
- Parameters
-
| val | The value to convert to string. |
| vs | value_string array. |
| fmt | Formatting for value not in array. |
- Returns
- A QString representation of the value_string.