Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
Macros | Functions
qt_ui_utils.h File Reference
#include <config.h>
#include <glib.h>
#include <QString>

Go to the source code of this file.

Macros

#define RECENT_KEY_CAPTURE_FILE   "recent.capture_file"
 
#define RECENT_KEY_REMOTE_HOST   "recent.remote_host"
 
#define qUtf8Printable(str)   str.toUtf8().constData()
 

Functions

gchar * qstring_strdup (QString q_string)
 
QString gchar_free_to_qstring (gchar *glib_string)
 
QByteArray gchar_free_to_qbytearray (gchar *glib_string)
 
QByteArray gstring_free_to_qbytearray (GString *glib_gstring)
 
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 guint32 val, const struct _value_string *vs, const char *fmt) G_GNUC_PRINTF(3
 
const QString const QString val_ext_to_qstring (const guint32 val, struct _value_string_ext *vse, const char *fmt) G_GNUC_PRINTF(3
 
const QString const QString const QString range_to_qstring (const struct epan_range *range)
 
const QString bits_s_to_qstring (const double bits_s)
 
const QString file_size_to_qstring (const gint64 size)
 
const QString time_t_to_qstring (time_t ti_time)
 
QString html_escape (const QString plain_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)
 

Detailed Description

Utility functions for working with the Wireshark and GLib APIs.

Function Documentation

const QString address_to_display_qstring ( const struct _address address)

Convert an address to a QString using address_to_display().

Parameters
addressA pointer to an address.
Returns
A QString representation of the address. May be the null string (QString())
const QString address_to_qstring ( const struct _address address,
bool  enclose = false 
)

Convert an address to a QString using address_to_str().

Parameters
addressA pointer to an address.
encloseEnclose IPv6 addresses in square brackets.
Returns
A QString representation of the address. May be the null string (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_sThe value to convert to string.
Returns
A QString representation of the data rate in SI units.
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_pathPath to the file.
const QString file_size_to_qstring ( const gint64  size)

Convert a file size value to a human-readable QString using format_size().

Parameters
sizeThe value to convert to string.
Returns
A QString representation of the file size in SI units.
QByteArray gchar_free_to_qbytearray ( gchar *  glib_string)

Transfer ownership of a GLib character string to a newly constructed QString

Parameters
glib_stringA string allocated with g_malloc() or NULL. Will be freed.
Returns
A QByteArray instance created from the input string.
QString gchar_free_to_qstring ( gchar *  glib_string)

Transfer ownership of a GLib character string to a newly constructed QString

Parameters
glib_stringA string allocated with g_malloc() or NULL. Will be freed.
Returns
A QString instance created from the input string.
QByteArray gstring_free_to_qbytearray ( GString *  glib_gstring)

Transfer ownership of a GLib character string to a newly constructed QByteArray

Parameters
glib_gstringA string allocated with g_malloc() or NULL. Will be freed.
Returns
A QByteArray instance created from the input string.
QString html_escape ( const QString  plain_string)

Escape HTML metacharacters in a string.

Parameters
plain_stringString to convert.
Returns
A QString with escaped metacharacters.
const QString int_to_qstring ( qint64  value,
int  field_width = 0,
int  base = 10 
)

Convert an integer to a formatted string representation.

Parameters
valueThe integer to format.
field_widthWidth of the output, not including any base prefix. Output will be zero-padded.
baseNumber base between 2 and 36 (limited by QString::arg).
Returns
A QString representation of the integer
bool qActionLessThan ( const QAction *  a1,
const QAction *  a2 
)

Compare the text of two QActions. Useful for passing to std::sort.

Parameters
a1First action
a2Second action
gchar* qstring_strdup ( QString  q_string)

Create a glib-compatible copy of a QString.

Parameters
q_stringA QString.
Returns
A copy of the QString. UTF-8 allocated with g_malloc().
bool qStringCaseLessThan ( const QString &  s1,
const QString &  s2 
)

Compare two QStrings, ignoring case. Useful for passing to std::sort.

Parameters
s1First string
s2Second string
const QString const QString const QString range_to_qstring ( const struct epan_range range)

Convert a range to a QString using range_convert_range().

Parameters
rangeA pointer to an range struct.
Returns
A QString representation of the address. May be the null string (QString())
bool rect_on_screen ( const QRect &  rect)

Test to see if a rect is visible on screen.

Parameters
rectThe 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.
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
fontThe font to smooth.
const QString time_t_to_qstring ( time_t  ti_time)

Convert a time_t value to a human-readable QString using QDateTime.

Parameters
ti_timeThe value to convert.
Returns
A QString representation of the file size in SI units.
const QString const QString val_ext_to_qstring ( const guint32  val,
struct _value_string_ext vse,
const char *  fmt 
)

Convert a value_string_ext to a QString using val_to_str_ext_wmem().

Parameters
valThe value to convert to string.
vsevalue_string_ext array.
fmtFormatting for value not in array.
Returns
A QString representation of the value_string_ext.
const QString val_to_qstring ( const guint32  val,
const struct _value_string vs,
const char *  fmt 
)

Convert a value_string to a QString using val_to_str_wmem().

Parameters
valThe value to convert to string.
vsvalue_string array.
fmtFormatting for value not in array.
Returns
A QString representation of the value_string.