forked from osmocom/wireshark
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>
This commit is contained in:
parent
fda29e1c95
commit
9fd3bcc25e
14
epan/prefs.c
14
epan/prefs.c
|
@ -194,6 +194,14 @@ static const gchar *capture_cols[5] = {
|
||||||
"Possible values: INTERFACE, LINK, PMODE, SNAPLEN, FILTER\n"
|
"Possible values: INTERFACE, LINK, PMODE, SNAPLEN, FILTER\n"
|
||||||
#endif
|
#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.
|
* List of all modules with preference settings.
|
||||||
*/
|
*/
|
||||||
|
@ -2347,6 +2355,11 @@ prefs_register_modules(void)
|
||||||
"Enable Packet Editor (Experimental)",
|
"Enable Packet Editor (Experimental)",
|
||||||
&prefs.gui_packet_editor);
|
&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
|
/* Console
|
||||||
* These are preferences that can be read/written using the
|
* These are preferences that can be read/written using the
|
||||||
* preference module API. These preferences still use their own
|
* 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_2 = layout_pane_content_pdetails;
|
||||||
prefs.gui_layout_content_3 = layout_pane_content_pbytes;
|
prefs.gui_layout_content_3 = layout_pane_content_pbytes;
|
||||||
prefs.gui_packet_editor = FALSE;
|
prefs.gui_packet_editor = FALSE;
|
||||||
|
prefs.gui_packet_list_elide_mode = ELIDE_RIGHT;
|
||||||
|
|
||||||
prefs.gui_qt_packet_list_separator = FALSE;
|
prefs.gui_qt_packet_list_separator = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,14 @@ typedef enum {
|
||||||
pref_current
|
pref_current
|
||||||
} pref_source_t;
|
} pref_source_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ELIDE_LEFT,
|
||||||
|
ELIDE_RIGHT,
|
||||||
|
ELIDE_MIDDLE,
|
||||||
|
ELIDE_NONE
|
||||||
|
} elide_mode_e;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update channel.
|
* Update channel.
|
||||||
*/
|
*/
|
||||||
|
@ -214,6 +222,7 @@ typedef struct _e_prefs {
|
||||||
gboolean unknown_colorfilters; /* unknown or obsolete color filter(s) */
|
gboolean unknown_colorfilters; /* unknown or obsolete color filter(s) */
|
||||||
gboolean gui_qt_packet_list_separator;
|
gboolean gui_qt_packet_list_separator;
|
||||||
gboolean gui_packet_editor; /* Enable Packet Editor */
|
gboolean gui_packet_editor; /* Enable Packet Editor */
|
||||||
|
elide_mode_e gui_packet_list_elide_mode;
|
||||||
gboolean st_enable_burstinfo;
|
gboolean st_enable_burstinfo;
|
||||||
gboolean st_burst_showcount;
|
gboolean st_burst_showcount;
|
||||||
gint st_burst_resolution;
|
gint st_burst_resolution;
|
||||||
|
|
|
@ -414,6 +414,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
packet_list_, SLOT(applyRecentColumnWidths()));
|
packet_list_, SLOT(applyRecentColumnWidths()));
|
||||||
connect(wsApp, SIGNAL(columnsChanged()),
|
connect(wsApp, SIGNAL(columnsChanged()),
|
||||||
packet_list_, SLOT(columnsChanged()));
|
packet_list_, SLOT(columnsChanged()));
|
||||||
|
connect(wsApp, SIGNAL(preferencesChanged()),
|
||||||
|
packet_list_, SLOT(elideModeChanged()));
|
||||||
connect(wsApp, SIGNAL(recentFilesRead()),
|
connect(wsApp, SIGNAL(recentFilesRead()),
|
||||||
this, SLOT(applyRecentPaneGeometry()));
|
this, SLOT(applyRecentPaneGeometry()));
|
||||||
connect(wsApp, SIGNAL(packetDissectionChanged()),
|
connect(wsApp, SIGNAL(packetDissectionChanged()),
|
||||||
|
|
|
@ -678,6 +678,28 @@ void PacketList::applyRecentColumnWidths()
|
||||||
column_state_ = header()->saveState();
|
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()
|
void PacketList::recolorPackets()
|
||||||
{
|
{
|
||||||
packet_list_model_->resetColorized();
|
packet_list_model_->resetColorized();
|
||||||
|
|
|
@ -149,6 +149,7 @@ public slots:
|
||||||
void redrawVisiblePackets();
|
void redrawVisiblePackets();
|
||||||
void columnsChanged();
|
void columnsChanged();
|
||||||
void applyRecentColumnWidths();
|
void applyRecentColumnWidths();
|
||||||
|
void elideModeChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showHeaderMenu(QPoint pos);
|
void showHeaderMenu(QPoint pos);
|
||||||
|
|
Loading…
Reference in New Issue