Qt+Gtk: Fix the -t command line flag.
Add the time format to commandline_param_info_t and apply it when we've finished application initialization. Bug: 12489 Change-Id: Ice626198a610567e945a8e53c0c1093797e8208e Reviewed-on: https://code.wireshark.org/review/16232 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
f860e8de52
commit
5cf7fcdf0f
|
@ -387,6 +387,7 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
|
|||
global_commandline_info.cf_name = NULL;
|
||||
global_commandline_info.rfilter = NULL;
|
||||
global_commandline_info.dfilter = NULL;
|
||||
global_commandline_info.time_format = TS_NOT_SET;
|
||||
#ifdef HAVE_LIBPCAP
|
||||
global_commandline_info.start_capture = FALSE;
|
||||
global_commandline_info.list_link_layer_types = FALSE;
|
||||
|
@ -537,25 +538,25 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
|
|||
break;
|
||||
case 't': /* Time stamp type */
|
||||
if (strcmp(optarg, "r") == 0)
|
||||
timestamp_set_type(TS_RELATIVE);
|
||||
global_commandline_info.time_format = TS_RELATIVE;
|
||||
else if (strcmp(optarg, "a") == 0)
|
||||
timestamp_set_type(TS_ABSOLUTE);
|
||||
global_commandline_info.time_format = TS_ABSOLUTE;
|
||||
else if (strcmp(optarg, "ad") == 0)
|
||||
timestamp_set_type(TS_ABSOLUTE_WITH_YMD);
|
||||
global_commandline_info.time_format = TS_ABSOLUTE_WITH_YMD;
|
||||
else if (strcmp(optarg, "adoy") == 0)
|
||||
timestamp_set_type(TS_ABSOLUTE_WITH_YDOY);
|
||||
global_commandline_info.time_format = TS_ABSOLUTE_WITH_YDOY;
|
||||
else if (strcmp(optarg, "d") == 0)
|
||||
timestamp_set_type(TS_DELTA);
|
||||
global_commandline_info.time_format = TS_DELTA;
|
||||
else if (strcmp(optarg, "dd") == 0)
|
||||
timestamp_set_type(TS_DELTA_DIS);
|
||||
global_commandline_info.time_format = TS_DELTA_DIS;
|
||||
else if (strcmp(optarg, "e") == 0)
|
||||
timestamp_set_type(TS_EPOCH);
|
||||
global_commandline_info.time_format = TS_EPOCH;
|
||||
else if (strcmp(optarg, "u") == 0)
|
||||
timestamp_set_type(TS_UTC);
|
||||
global_commandline_info.time_format = TS_UTC;
|
||||
else if (strcmp(optarg, "ud") == 0)
|
||||
timestamp_set_type(TS_UTC_WITH_YMD);
|
||||
global_commandline_info.time_format = TS_UTC_WITH_YMD;
|
||||
else if (strcmp(optarg, "udoy") == 0)
|
||||
timestamp_set_type(TS_UTC_WITH_YDOY);
|
||||
global_commandline_info.time_format = TS_UTC_WITH_YDOY;
|
||||
else {
|
||||
cmdarg_err("Invalid time stamp type \"%s\"", optarg);
|
||||
cmdarg_err_cont("It must be \"a\" for absolute, \"ad\" for absolute with YYYY-MM-DD date,");
|
||||
|
|
|
@ -47,6 +47,7 @@ typedef struct commandline_param_info
|
|||
gchar* cf_name;
|
||||
gchar* rfilter;
|
||||
gchar* dfilter;
|
||||
ts_type time_format;
|
||||
GSList *disable_protocol_slist;
|
||||
GSList *enable_heur_slist;
|
||||
GSList *disable_heur_slist;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "globals.h"
|
||||
#include <epan/color_filters.h>
|
||||
|
||||
#include "ui/commandline.h"
|
||||
#include "ui/main_statusbar.h"
|
||||
#include "ui/preference_utils.h"
|
||||
#include "ui/recent.h"
|
||||
|
@ -3173,6 +3174,9 @@ menus_init(void)
|
|||
G_N_ELEMENTS(main_menu_bar_toggle_action_entries), /* the number of entries */
|
||||
NULL); /* data to pass to the action callbacks */
|
||||
|
||||
if (global_commandline_info.time_format != TS_NOT_SET) {
|
||||
recent.gui_time_format = global_commandline_info.time_format;
|
||||
}
|
||||
gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
|
||||
main_menu_bar_radio_view_time_entries, /* an array of radio action descriptions */
|
||||
G_N_ELEMENTS(main_menu_bar_radio_view_time_entries), /* the number of entries */
|
||||
|
@ -4248,9 +4252,9 @@ menu_recent_read_finished(void)
|
|||
#endif
|
||||
main_widgets_rearrange();
|
||||
|
||||
/* don't change the time format, if we had a command line value */
|
||||
if (timestamp_get_type() != TS_NOT_SET) {
|
||||
recent.gui_time_format = timestamp_get_type();
|
||||
/* Update the time format if we had a command line value. */
|
||||
if (global_commandline_info.time_format != TS_NOT_SET) {
|
||||
recent.gui_time_format = global_commandline_info.time_format;
|
||||
}
|
||||
|
||||
/* XXX Fix me */
|
||||
|
|
|
@ -338,6 +338,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
//Otherwise unexpected problems may occur
|
||||
setFeaturesEnabled(false);
|
||||
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(setFeaturesEnabled()));
|
||||
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(applyGlobalCommandLineOptions()));
|
||||
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(zoomText()));
|
||||
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(initViewColorizeMenu()));
|
||||
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(addStatsPluginsToMenu()));
|
||||
|
|
|
@ -324,6 +324,7 @@ private slots:
|
|||
|
||||
void startInterfaceCapture(bool valid, const QString capture_filter);
|
||||
|
||||
void applyGlobalCommandLineOptions();
|
||||
void setFeaturesEnabled(bool enabled = true);
|
||||
|
||||
void on_actionDisplayFilterExpression_triggered();
|
||||
|
|
|
@ -494,6 +494,7 @@ void MainWindow::updateRecentActions()
|
|||
foreach (QAction* tpa, tp_actions.keys()) {
|
||||
if (recent.gui_time_precision == tp_actions[tpa]) {
|
||||
tpa->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
main_ui_->actionViewTimeDisplaySecondsWithHoursAndMinutes->setChecked(recent.gui_seconds_format == TS_SECONDS_HOUR_MIN_SEC);
|
||||
|
@ -1378,6 +1379,20 @@ void MainWindow::startInterfaceCapture(bool valid, const QString capture_filter)
|
|||
startCapture();
|
||||
}
|
||||
|
||||
void MainWindow::applyGlobalCommandLineOptions()
|
||||
{
|
||||
if (global_commandline_info.time_format != TS_NOT_SET) {
|
||||
foreach (QAction* tda, td_actions.keys()) {
|
||||
if (global_commandline_info.time_format == td_actions[tda]) {
|
||||
tda->setChecked(true);
|
||||
recent.gui_time_format = global_commandline_info.time_format;
|
||||
timestamp_set_type(global_commandline_info.time_format);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::redissectPackets()
|
||||
{
|
||||
if (capture_file_.capFile()) {
|
||||
|
|
|
@ -360,7 +360,7 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
|
|||
test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
|
||||
set_last_open_dir(recent.gui_fileopen_remembered_dir);
|
||||
}
|
||||
timestamp_set_type (recent.gui_time_format);
|
||||
timestamp_set_type(recent.gui_time_format);
|
||||
timestamp_set_precision(recent.gui_time_precision);
|
||||
timestamp_set_seconds_type (recent.gui_seconds_format);
|
||||
packet_list_enable_color(recent.packet_list_colorize);
|
||||
|
|
|
@ -606,7 +606,6 @@ int main(int argc, char *argv[])
|
|||
* https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9e277ae6154fd04bf6a0a34ec5655a73e5a736a3
|
||||
*/
|
||||
|
||||
// XXX Is there a better place to set the timestamp format & precision?
|
||||
timestamp_set_type(recent.gui_time_format);
|
||||
timestamp_set_precision(recent.gui_time_precision);
|
||||
timestamp_set_seconds_type (recent.gui_seconds_format);
|
||||
|
|
Loading…
Reference in New Issue