Note that the -t flag affects the recent file.

The applyGlobalCommandLineOptions() method of the Wireshark and Logray
main window will cause time stamp format and precision settings provided
by the command line to be saved in the recent file, so the next time the
user starts up Wireshark or Logray, they'll get the settings from the
previous invokation with -t.

(This code is a little tricky, so it's not obvious what *not* setting
the parameter in the recent structure would break, if anything.  And
I'm not sure anybody's complained about the behavior.)
This commit is contained in:
Guy Harris 2023-08-16 11:12:17 -07:00
parent ef14ebd180
commit bb31b5704c
2 changed files with 16 additions and 0 deletions

View File

@ -1362,6 +1362,10 @@ void LograyMainWindow::applyGlobalCommandLineOptions()
foreach(QAction* tda, td_actions.keys()) {
if (global_dissect_options.time_format == td_actions[tda]) {
tda->setChecked(true);
// XXX - this means that if the user sets the
// time stamp format with the -t flag, that
// setting will persist and will be used as
// the default the next time Logray is run.
recent.gui_time_format = global_dissect_options.time_format;
timestamp_set_type(global_dissect_options.time_format);
break;
@ -1372,6 +1376,10 @@ void LograyMainWindow::applyGlobalCommandLineOptions()
foreach(QAction* tpa, tp_actions.keys()) {
if (global_dissect_options.time_precision == tp_actions[tpa]) {
tpa->setChecked(true);
// XXX - this means that if the user sets the
// time stamp precision with the -t flag, that
// setting will persist and will be used as
// the default the next time Logray is run.
recent.gui_time_precision = global_dissect_options.time_precision;
timestamp_set_precision(global_dissect_options.time_precision);
break;

View File

@ -1469,6 +1469,10 @@ void WiresharkMainWindow::applyGlobalCommandLineOptions()
foreach(QAction* tda, td_actions.keys()) {
if (global_dissect_options.time_format == td_actions[tda]) {
tda->setChecked(true);
// XXX - this means that if the user sets the
// time stamp format with the -t flag, that
// setting will persist and will be used as
// the default the next time Wireshark is run.
recent.gui_time_format = global_dissect_options.time_format;
timestamp_set_type(global_dissect_options.time_format);
break;
@ -1479,6 +1483,10 @@ void WiresharkMainWindow::applyGlobalCommandLineOptions()
foreach(QAction* tpa, tp_actions.keys()) {
if (global_dissect_options.time_precision == tp_actions[tpa]) {
tpa->setChecked(true);
// XXX - this means that if the user sets the
// time stamp precision with the -t flag, that
// setting will persist and will be used as
// the default the next time Wireshark is run.
recent.gui_time_precision = global_dissect_options.time_precision;
timestamp_set_precision(global_dissect_options.time_precision);
break;