Qt: Add preference for show file load time in the status bar

This will leave more room for messages on smaller screens.  Set the
default OFF because this is probably only useful for developers.

Group Status Bar settings in the Layout frame.

Change-Id: Iea9a55b6c088aac10ee7680b1e8a882ed00c73be
Reviewed-on: https://code.wireshark.org/review/22824
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Stig Bjørlykke 2017-07-27 23:10:42 +02:00 committed by Anders Broman
parent 04748779e4
commit 66fff5df49
7 changed files with 67 additions and 6 deletions

View File

@ -37,7 +37,9 @@ since version 2.4.0:
* SMI private enterprise numbers are now read from the "enterprises.tsv" configuration file.
* QUIC dissector is rename to G(oogle) QUIC (quic => gquic)
* Selected packet number can now be shown in the Status Bar by enabling
Preferences -> Appearance -> Layout -> Show selected packet number in the Status Bar
Preferences -> Appearance -> Layout -> Show selected packet number
* File load time in Status Bar is now disabled by default and can be enabled in
Preferences -> Appearance -> Layout -> Show file load time
//=== Removed Dissectors

View File

@ -3300,6 +3300,11 @@ prefs_register_modules(void)
"Show selected packet in the Status Bar",
&prefs.gui_qt_show_selected_packet);
prefs_register_bool_preference(gui_layout_module, "show_file_load_time.enabled",
"Show file load time in the Status Bar",
"Show file load time in the Status Bar",
&prefs.gui_qt_show_file_load_time);
prefs_register_bool_preference(gui_module, "packet_editor.enabled",
"Enable Packet Editor",
"Enable Packet Editor (Experimental)",
@ -4048,6 +4053,7 @@ pre_init_prefs(void)
prefs.gui_qt_packet_list_separator = FALSE;
prefs.gui_qt_show_selected_packet = FALSE;
prefs.gui_qt_show_file_load_time = FALSE;
if (prefs.col_list) {
free_col_info(prefs.col_list);

View File

@ -228,6 +228,7 @@ typedef struct _e_prefs {
gboolean unknown_colorfilters; /* Warn when saving unknown or obsolete color filters. */
gboolean gui_qt_packet_list_separator;
gboolean gui_qt_show_selected_packet;
gboolean gui_qt_show_file_load_time;
gboolean gui_packet_editor; /* Enable Packet Editor */
elide_mode_e gui_packet_list_elide_mode;
gboolean gui_packet_list_show_related;

View File

@ -48,11 +48,23 @@ LayoutPreferencesFrame::LayoutPreferencesFrame(QWidget *parent) :
ui->layout5ToolButton->setStyleSheet(image_pad_ss);
ui->layout6ToolButton->setStyleSheet(image_pad_ss);
QStyleOption style_opt;
QString indent_ss = QString(
"QCheckBox {"
" margin-left: %1px;"
"}"
).arg(ui->packetListSeparatorCheckBox->style()->subElementRect(QStyle::SE_CheckBoxContents, &style_opt).left());
ui->statusBarShowSelectedPacketCheckBox->setStyleSheet(indent_ss);
ui->statusBarShowFileLoadTimeCheckBox->setStyleSheet(indent_ss);
pref_packet_list_separator_ = prefFromPrefPtr(&prefs.gui_qt_packet_list_separator);
ui->packetListSeparatorCheckBox->setChecked(prefs_get_bool_value(pref_packet_list_separator_, pref_stashed));
pref_show_selected_packet_ = prefFromPrefPtr(&prefs.gui_qt_show_selected_packet);
ui->statusBarShowSelectedPacketCheckBox->setChecked(prefs_get_bool_value(pref_show_selected_packet_, pref_stashed));
pref_show_file_load_time_ = prefFromPrefPtr(&prefs.gui_qt_show_file_load_time);
ui->statusBarShowFileLoadTimeCheckBox->setChecked(prefs_get_bool_value(pref_show_file_load_time_, pref_stashed));
}
LayoutPreferencesFrame::~LayoutPreferencesFrame()
@ -278,7 +290,6 @@ void LayoutPreferencesFrame::on_pane3NoneRadioButton_toggled(bool checked)
prefs_set_enum_value(pref_layout_content_3_, layout_pane_content_none, pref_stashed);
}
void LayoutPreferencesFrame::on_restoreButtonBox_clicked(QAbstractButton *)
{
reset_stashed_pref(pref_layout_type_);
@ -291,6 +302,7 @@ void LayoutPreferencesFrame::on_restoreButtonBox_clicked(QAbstractButton *)
ui->packetListSeparatorCheckBox->setChecked(prefs_get_bool_value(pref_packet_list_separator_, pref_default));
ui->statusBarShowSelectedPacketCheckBox->setChecked(prefs_get_bool_value(pref_show_selected_packet_, pref_default));
ui->statusBarShowFileLoadTimeCheckBox->setChecked(prefs_get_bool_value(pref_show_file_load_time_, pref_default));
}
void LayoutPreferencesFrame::on_packetListSeparatorCheckBox_toggled(bool checked)
@ -303,6 +315,11 @@ void LayoutPreferencesFrame::on_statusBarShowSelectedPacketCheckBox_toggled(bool
prefs_set_bool_value(pref_show_selected_packet_, (gboolean) checked, pref_stashed);
}
void LayoutPreferencesFrame::on_statusBarShowFileLoadTimeCheckBox_toggled(bool checked)
{
prefs_set_bool_value(pref_show_file_load_time_, (gboolean) checked, pref_stashed);
}
/*
* Editor modelines
*

View File

@ -51,6 +51,7 @@ private:
pref_t *pref_layout_content_3_;
pref_t *pref_packet_list_separator_;
pref_t *pref_show_selected_packet_;
pref_t *pref_show_file_load_time_;
void updateWidgets();
@ -76,7 +77,7 @@ private slots:
void on_restoreButtonBox_clicked(QAbstractButton *button);
void on_packetListSeparatorCheckBox_toggled(bool checked);
void on_statusBarShowSelectedPacketCheckBox_toggled(bool checked);
void on_statusBarShowFileLoadTimeCheckBox_toggled(bool checked);
};
#endif // LAYOUT_PREFERENCES_FRAME_H

View File

@ -352,12 +352,46 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="statusBarShowSelectedPacketCheckBox">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="statusBarSettings">
<property name="text">
<string>Show selected packet number in the status bar</string>
<string>Status Bar settings:</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="statusBarSettingsVerticalLayout">
<item>
<widget class="QCheckBox" name="statusBarShowSelectedPacketCheckBox">
<property name="text">
<string>Show selected packet number</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="statusBarShowFileLoadTimeCheckBox">
<property name="text">
<string>Show file load time</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -463,7 +463,7 @@ void MainStatusBar::showCaptureStatistics()
.arg(cap_file_->ignored_count)
.arg((100.0*cap_file_->ignored_count)/cap_file_->count, 0, 'f', 1));
}
if(!cap_file_->is_tempfile) {
if(prefs.gui_qt_show_file_load_time && !cap_file_->is_tempfile) {
/* Loading an existing file */
gulong computed_elapsed = cf_get_computed_elapsed(cap_file_);
packets_str.append(QString(tr(" %1 Load time: %2:%3.%4"))