forked from osmocom/wireshark
Qt: Add some window title variables
Add some variables to be used in custom window title. %P = profile name %V = version info Change-Id: I049717432a4d3523b541bb4f6f882c75abc38ddb Reviewed-on: https://code.wireshark.org/review/13419 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
parent
32e4bd3500
commit
77046c0c2d
|
@ -2334,11 +2334,11 @@ prefs_register_modules(void)
|
|||
&prefs.gui_update_interval);
|
||||
|
||||
register_string_like_preference(gui_module, "window_title", "Custom window title",
|
||||
"Custom window title. (Appended to existing titles.)",
|
||||
"Custom window title to be appended to the existing title\n%P = profile name\n%V = version info",
|
||||
&prefs.gui_window_title, PREF_STRING, NULL, TRUE);
|
||||
|
||||
register_string_like_preference(gui_module, "prepend_window_title", "Custom window title prefix",
|
||||
"Custom window title. (Prepended to existing titles.)",
|
||||
"Custom window title to be prepended to the existing title\n%P = profile name\n%V = version info",
|
||||
&prefs.gui_prepend_window_title, PREF_STRING, NULL, TRUE);
|
||||
|
||||
register_string_like_preference(gui_module, "start_title", "Custom start page title",
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <epan/addr_resolv.h>
|
||||
#include <epan/epan_dissect.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/ws_version_info.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/stats_tree_priv.h>
|
||||
#include <epan/plugin_if.h>
|
||||
|
@ -1934,6 +1935,14 @@ void MainWindow::setTitlebarForCaptureFile()
|
|||
}
|
||||
}
|
||||
|
||||
QString MainWindow::replaceWindowTitleVariables(QString title)
|
||||
{
|
||||
title.replace ("%P", get_profile_name());
|
||||
title.replace ("%V", get_ws_vcs_version_info());
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
void MainWindow::setWSWindowTitle(QString title)
|
||||
{
|
||||
if (title.isEmpty()) {
|
||||
|
@ -1941,15 +1950,17 @@ void MainWindow::setWSWindowTitle(QString title)
|
|||
}
|
||||
|
||||
if (prefs.gui_prepend_window_title && prefs.gui_prepend_window_title[0]) {
|
||||
title.prepend(QString("[%1] ").arg(prefs.gui_prepend_window_title));
|
||||
QString customTitle = replaceWindowTitleVariables(prefs.gui_prepend_window_title);
|
||||
title.prepend(QString("[%1] ").arg(customTitle));
|
||||
}
|
||||
|
||||
if (prefs.gui_window_title && prefs.gui_window_title[0]) {
|
||||
QString customTitle = replaceWindowTitleVariables(prefs.gui_window_title);
|
||||
#ifdef __APPLE__
|
||||
// On OS X we separate the titles with a unicode em dash
|
||||
title.append(QString(" %1 %2").arg(UTF8_EM_DASH).arg(prefs.gui_window_title));
|
||||
title.append(QString(" %1 %2").arg(UTF8_EM_DASH).arg(customTitle));
|
||||
#else
|
||||
title.append(QString(" [%1]").arg(prefs.gui_window_title));
|
||||
title.append(QString(" [%1]").arg(customTitle));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -202,6 +202,7 @@ private:
|
|||
void setForCapturedPackets(bool have_captured_packets);
|
||||
void setMenusForFileSet(bool enable_list_files);
|
||||
void setWindowIcon(const QIcon &icon);
|
||||
QString replaceWindowTitleVariables(QString title);
|
||||
|
||||
void externalMenuHelper(ext_menu_t * menu, QMenu * subMenu, gint depth);
|
||||
|
||||
|
|
Loading…
Reference in New Issue