aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2020-01-09 12:12:57 +0100
committerRoland Knall <rknall@gmail.com>2020-01-09 12:32:34 +0000
commit936a844cc35a2ab22b49ab4bc9929fcfcdace9ab (patch)
tree976d5f4f5753c8ca1383c52832fbdac4a3baf763
parente0bb1ddea7db6e1ea8018d048ee3a9a614a13cc1 (diff)
Qt: Fix PacketListHeader column
Due to changes in #35206, if you have a lot of columns the display of all columns may be hindered depending on your screen resolution. With this change, displaying the column information can be disabled via a Preferences->Layout checkbox element. Additionaly, the column information will always be displayed as a tooltip element Bug: 16317 Change-Id: Ib8c0fc0a84deaca96631270b320f3a530ba87d89 Reviewed-on: https://code.wireshark.org/review/35706 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
-rw-r--r--epan/prefs.c6
-rw-r--r--epan/prefs.h1
-rw-r--r--ui/qt/layout_preferences_frame.cpp10
-rw-r--r--ui/qt/layout_preferences_frame.h2
-rw-r--r--ui/qt/layout_preferences_frame.ui11
-rw-r--r--ui/qt/widgets/packet_list_header.cpp11
6 files changed, 37 insertions, 4 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index dccc912e87..af5d713f2d 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -3380,6 +3380,11 @@ prefs_register_modules(void)
"Enable Packet List Separator",
&prefs.gui_qt_packet_list_separator);
+ prefs_register_bool_preference(gui_layout_module, "packet_header_column_definition.enabled",
+ "Show column definition in packet list header",
+ "Show column definition in packet list header",
+ &prefs.gui_qt_packet_header_column_definition);
+
prefs_register_bool_preference(gui_layout_module, "show_selected_packet.enabled",
"Show selected packet in the Status Bar",
"Show selected packet in the Status Bar",
@@ -4128,6 +4133,7 @@ pre_init_prefs(void)
prefs.gui_interfaces_show_hidden = FALSE;
prefs.gui_interfaces_remote_display = TRUE;
prefs.gui_qt_packet_list_separator = FALSE;
+ prefs.gui_qt_packet_header_column_definition = TRUE;
prefs.gui_qt_show_selected_packet = FALSE;
prefs.gui_qt_show_file_load_time = FALSE;
prefs.gui_max_export_objects = 1000;
diff --git a/epan/prefs.h b/epan/prefs.h
index f9a657e362..8e15673d53 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -211,6 +211,7 @@ typedef struct _e_prefs {
gboolean unknown_prefs; /* unknown or obsolete pref(s) */
gboolean unknown_colorfilters; /* Warn when saving unknown or obsolete color filters. */
gboolean gui_qt_packet_list_separator;
+ gboolean gui_qt_packet_header_column_definition;
gboolean gui_qt_show_selected_packet;
gboolean gui_qt_show_file_load_time;
gboolean gui_packet_editor; /* Enable Packet Editor */
diff --git a/ui/qt/layout_preferences_frame.cpp b/ui/qt/layout_preferences_frame.cpp
index 7ce625b9a9..bef7507062 100644
--- a/ui/qt/layout_preferences_frame.cpp
+++ b/ui/qt/layout_preferences_frame.cpp
@@ -46,12 +46,16 @@ LayoutPreferencesFrame::LayoutPreferencesFrame(QWidget *parent) :
"}"
).arg(ui->packetListSeparatorCheckBox->style()->subElementRect(QStyle::SE_CheckBoxContents, &style_opt).left());
ui->packetListSeparatorCheckBox->setStyleSheet(indent_ss);
+ ui->packetListHeaderShowColumnDefinition->setStyleSheet(indent_ss);
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_packet_header_column_definition_ = prefFromPrefPtr(&prefs.gui_qt_packet_header_column_definition);
+ ui->packetListHeaderShowColumnDefinition->setChecked(prefs_get_bool_value(pref_packet_header_column_definition_, 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));
@@ -293,6 +297,7 @@ void LayoutPreferencesFrame::on_restoreButtonBox_clicked(QAbstractButton *)
updateWidgets();
ui->packetListSeparatorCheckBox->setChecked(prefs_get_bool_value(pref_packet_list_separator_, pref_default));
+ ui->packetListHeaderShowColumnDefinition->setChecked(prefs_get_bool_value(pref_packet_header_column_definition_, 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));
}
@@ -302,6 +307,11 @@ void LayoutPreferencesFrame::on_packetListSeparatorCheckBox_toggled(bool checked
prefs_set_bool_value(pref_packet_list_separator_, (gboolean) checked, pref_stashed);
}
+void LayoutPreferencesFrame::on_packetListHeaderShowColumnDefinition_toggled(bool checked)
+{
+ prefs_set_bool_value(pref_packet_header_column_definition_, (gboolean) checked, pref_stashed);
+}
+
void LayoutPreferencesFrame::on_statusBarShowSelectedPacketCheckBox_toggled(bool checked)
{
prefs_set_bool_value(pref_show_selected_packet_, (gboolean) checked, pref_stashed);
diff --git a/ui/qt/layout_preferences_frame.h b/ui/qt/layout_preferences_frame.h
index 3e7e884004..246e8c6060 100644
--- a/ui/qt/layout_preferences_frame.h
+++ b/ui/qt/layout_preferences_frame.h
@@ -38,6 +38,7 @@ private:
pref_t *pref_layout_content_2_;
pref_t *pref_layout_content_3_;
pref_t *pref_packet_list_separator_;
+ pref_t *pref_packet_header_column_definition_;
pref_t *pref_show_selected_packet_;
pref_t *pref_show_file_load_time_;
@@ -64,6 +65,7 @@ private slots:
void on_pane3NoneRadioButton_toggled(bool checked);
void on_restoreButtonBox_clicked(QAbstractButton *button);
void on_packetListSeparatorCheckBox_toggled(bool checked);
+ void on_packetListHeaderShowColumnDefinition_toggled(bool checked);
void on_statusBarShowSelectedPacketCheckBox_toggled(bool checked);
void on_statusBarShowFileLoadTimeCheckBox_toggled(bool checked);
};
diff --git a/ui/qt/layout_preferences_frame.ui b/ui/qt/layout_preferences_frame.ui
index 1a635dedb0..02d03045cb 100644
--- a/ui/qt/layout_preferences_frame.ui
+++ b/ui/qt/layout_preferences_frame.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>414</width>
- <height>287</height>
+ <height>409</height>
</rect>
</property>
<property name="windowTitle">
@@ -359,6 +359,13 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="packetListHeaderShowColumnDefinition">
+ <property name="text">
+ <string>Show column definition in column context menu</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -423,8 +430,8 @@
<connections/>
<buttongroups>
<buttongroup name="layoutButtonGroup"/>
- <buttongroup name="pane2ButtonGroup"/>
<buttongroup name="pane3ButtonGroup"/>
+ <buttongroup name="pane2ButtonGroup"/>
<buttongroup name="pane1ButtonGroup"/>
</buttongroups>
</ui>
diff --git a/ui/qt/widgets/packet_list_header.cpp b/ui/qt/widgets/packet_list_header.cpp
index a1c3d1b0ec..251fc4e44c 100644
--- a/ui/qt/widgets/packet_list_header.cpp
+++ b/ui/qt/widgets/packet_list_header.cpp
@@ -205,18 +205,25 @@ void PacketListHeader::contextMenuEvent(QContextMenuEvent *event)
for (int cnt = 0; cnt < prefs.num_cols; cnt++) {
QString title(get_column_title(cnt));
+ QString detail;
if (get_column_format(cnt) == COL_CUSTOM) {
- title.append(QString("\t%1").arg(get_column_custom_fields(cnt)));
+ detail = get_column_custom_fields(cnt);
} else {
- title.append(QString("\t%1").arg(col_format_desc(get_column_format(cnt))));
+ detail = col_format_desc(get_column_format(cnt));
}
+
+ if (prefs.gui_qt_packet_header_column_definition)
+ title.append(QString("\t%1").arg(detail));
+
QAction *action = new QAction(title, this);
+ action->setToolTip(detail);
action->setCheckable(true);
action->setChecked(get_column_visible(cnt));
action->setData(QVariant::fromValue(cnt));
connect(action, &QAction::triggered, this, &PacketListHeader::columnVisibilityTriggered);
contextMenu->addAction(action);
}
+ contextMenu->setToolTipsVisible(true);
contextMenu->addSeparator();