aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-08-06 12:31:21 -0700
committerGerald Combs <gerald@wireshark.org>2015-08-06 21:06:34 +0000
commit9fd3bcc25e0b6c1feaf6e20850200de4acf5637a (patch)
tree10e5c227842f3d32a26dfbb1eb8c256f80b7f8af
parentfda29e1c9521f3da0a194dbedb419d0fb796aa2e (diff)
Add an elide mode preference for the Qt packet list.
Change-Id: I081cc1e9b2a0eea7f0a3ef1157561c50beb4c4db Reviewed-on: https://code.wireshark.org/review/9902 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--epan/prefs.c14
-rw-r--r--epan/prefs.h9
-rw-r--r--ui/qt/main_window.cpp2
-rw-r--r--ui/qt/packet_list.cpp22
-rw-r--r--ui/qt/packet_list.h1
5 files changed, 48 insertions, 0 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index 16f08be70c..24cfdd8441 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -194,6 +194,14 @@ static const gchar *capture_cols[5] = {
"Possible values: INTERFACE, LINK, PMODE, SNAPLEN, FILTER\n"
#endif
+static const enum_val_t gui_packet_list_elide_mode[] = {
+ {"LEFT", "LEFT", ELIDE_LEFT},
+ {"RIGHT", "RIGHT", ELIDE_RIGHT},
+ {"MIDDLE", "MIDDLE", ELIDE_MIDDLE},
+ {"NONE", "NONE", ELIDE_NONE},
+ {NULL, NULL, -1}
+};
+
/*
* List of all modules with preference settings.
*/
@@ -2347,6 +2355,11 @@ prefs_register_modules(void)
"Enable Packet Editor (Experimental)",
&prefs.gui_packet_editor);
+ prefs_register_enum_preference(gui_module, "packet_list_elide_mode",
+ "Elide mode",
+ "The position of \"...\" in packet list text.",
+ (gint*)(void*)(&prefs.gui_packet_list_elide_mode), gui_packet_list_elide_mode, FALSE);
+
/* Console
* These are preferences that can be read/written using the
* preference module API. These preferences still use their own
@@ -2980,6 +2993,7 @@ pre_init_prefs(void)
prefs.gui_layout_content_2 = layout_pane_content_pdetails;
prefs.gui_layout_content_3 = layout_pane_content_pbytes;
prefs.gui_packet_editor = FALSE;
+ prefs.gui_packet_list_elide_mode = ELIDE_RIGHT;
prefs.gui_qt_packet_list_separator = FALSE;
diff --git a/epan/prefs.h b/epan/prefs.h
index 8794374de6..03881edfb7 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -126,6 +126,14 @@ typedef enum {
pref_current
} pref_source_t;
+typedef enum {
+ ELIDE_LEFT,
+ ELIDE_RIGHT,
+ ELIDE_MIDDLE,
+ ELIDE_NONE
+} elide_mode_e;
+
+
/*
* Update channel.
*/
@@ -214,6 +222,7 @@ typedef struct _e_prefs {
gboolean unknown_colorfilters; /* unknown or obsolete color filter(s) */
gboolean gui_qt_packet_list_separator;
gboolean gui_packet_editor; /* Enable Packet Editor */
+ elide_mode_e gui_packet_list_elide_mode;
gboolean st_enable_burstinfo;
gboolean st_burst_showcount;
gint st_burst_resolution;
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 96c3be0564..6c9d92b7d4 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -414,6 +414,8 @@ MainWindow::MainWindow(QWidget *parent) :
packet_list_, SLOT(applyRecentColumnWidths()));
connect(wsApp, SIGNAL(columnsChanged()),
packet_list_, SLOT(columnsChanged()));
+ connect(wsApp, SIGNAL(preferencesChanged()),
+ packet_list_, SLOT(elideModeChanged()));
connect(wsApp, SIGNAL(recentFilesRead()),
this, SLOT(applyRecentPaneGeometry()));
connect(wsApp, SIGNAL(packetDissectionChanged()),
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index aa223a77be..9bd99eeab6 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -678,6 +678,28 @@ void PacketList::applyRecentColumnWidths()
column_state_ = header()->saveState();
}
+// This sets the mode for the entire view. If we want to make this setting
+// per-column we'll either have to generalize RelatedPacketDelegate so that
+// we can set it for entire rows or create another delegate.
+void PacketList::elideModeChanged()
+{
+ Qt::TextElideMode elide_mode = Qt::ElideRight;
+ switch (prefs.gui_packet_list_elide_mode) {
+ case ELIDE_LEFT:
+ elide_mode = Qt::ElideLeft;
+ break;
+ case ELIDE_MIDDLE:
+ elide_mode = Qt::ElideMiddle;
+ break;
+ case ELIDE_NONE:
+ elide_mode = Qt::ElideNone;
+ break;
+ default:
+ break;
+ }
+ setTextElideMode(elide_mode);
+}
+
void PacketList::recolorPackets()
{
packet_list_model_->resetColorized();
diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h
index a8d2658577..ee1f81250f 100644
--- a/ui/qt/packet_list.h
+++ b/ui/qt/packet_list.h
@@ -149,6 +149,7 @@ public slots:
void redrawVisiblePackets();
void columnsChanged();
void applyRecentColumnWidths();
+ void elideModeChanged();
private slots:
void showHeaderMenu(QPoint pos);