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>
&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",
#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>
}
}
+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()) {
}
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
}
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);