Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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

  address | A 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

  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())

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.

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.

const QString file_size_to_qstring | ( | const gint64 | 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.

QByteArray gchar_free_to_qbytearray | ( | gchar * | 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.

QString gchar_free_to_qstring | ( | gchar * | 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.

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.

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.

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

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

gchar* qstring_strdup | ( | QString | q_string | ) |

Create a glib-compatible copy of a QString.

Parameters

  q_string | A 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

  s1 | First string
  s2 | Second 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

  range | A 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

  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.

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

  font | The 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_time | The 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

  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.

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

  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.