diff --git a/epan/prefs.c b/epan/prefs.c index 0ca84c3636..4b993001ef 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -2337,10 +2337,16 @@ prefs_register_modules(void) "Layout content of the pane 3", (gint*)(void*)(&prefs.gui_layout_content_3), gui_layout_content, FALSE); + prefs_register_bool_preference(gui_layout_module, "packet_list_separator.enabled", + "Enable Packet List Separator", + "Enable Packet List Separator", + &prefs.gui_qt_packet_list_separator); + prefs_register_bool_preference(gui_module, "packet_editor.enabled", "Enable Packet Editor", "Enable Packet Editor (Experimental)", &prefs.gui_packet_editor); + /* Console * These are preferences that can be read/written using the * preference module API. These preferences still use their own @@ -2975,6 +2981,8 @@ pre_init_prefs(void) prefs.gui_layout_content_3 = layout_pane_content_pbytes; prefs.gui_packet_editor = FALSE; + prefs.gui_qt_packet_list_separator = FALSE; + if (!prefs.col_list) { /* First time through */ for (i = 0; i < DEF_NUM_COLS; i++) { diff --git a/epan/prefs.h b/epan/prefs.h index cd6398560e..8794374de6 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -212,7 +212,7 @@ typedef struct _e_prefs { gchar *saved_at_version; gboolean unknown_prefs; /* unknown or obsolete pref(s) */ gboolean unknown_colorfilters; /* unknown or obsolete color filter(s) */ - guint gui_qt_language; /* Qt Translation language selection */ + gboolean gui_qt_packet_list_separator; gboolean gui_packet_editor; /* Enable Packet Editor */ gboolean st_enable_burstinfo; gboolean st_burst_showcount; diff --git a/ui/qt/layout_preferences_frame.cpp b/ui/qt/layout_preferences_frame.cpp index 12c220d69c..814803dd3a 100644 --- a/ui/qt/layout_preferences_frame.cpp +++ b/ui/qt/layout_preferences_frame.cpp @@ -47,6 +47,9 @@ LayoutPreferencesFrame::LayoutPreferencesFrame(QWidget *parent) : ui->layout4ToolButton->setStyleSheet(image_pad_ss); ui->layout5ToolButton->setStyleSheet(image_pad_ss); ui->layout6ToolButton->setStyleSheet(image_pad_ss); + + pref_packet_list_separator_ = prefFromPrefPtr(&prefs.gui_qt_packet_list_separator); + ui->packetListSeparatorCheckBox->setChecked(pref_packet_list_separator_->stashed_val.boolval); } LayoutPreferencesFrame::~LayoutPreferencesFrame() @@ -282,6 +285,13 @@ void LayoutPreferencesFrame::on_restoreButtonBox_clicked(QAbstractButton *) updateWidgets(); pref_layout_content_3_->stashed_val.enumval = pref_layout_content_3_->default_val.enumval; updateWidgets(); + + ui->packetListSeparatorCheckBox->setChecked(pref_packet_list_separator_->default_val.boolval); +} + +void LayoutPreferencesFrame::on_packetListSeparatorCheckBox_toggled(bool checked) +{ + pref_packet_list_separator_->stashed_val.boolval = (gboolean) checked; } /* diff --git a/ui/qt/layout_preferences_frame.h b/ui/qt/layout_preferences_frame.h index cc04b5dab3..5fe260df6d 100644 --- a/ui/qt/layout_preferences_frame.h +++ b/ui/qt/layout_preferences_frame.h @@ -49,6 +49,7 @@ private: pref_t *pref_layout_content_1_; pref_t *pref_layout_content_2_; pref_t *pref_layout_content_3_; + pref_t *pref_packet_list_separator_; void updateWidgets(); @@ -72,6 +73,7 @@ private slots: void on_pane3PacketBytesRadioButton_toggled(bool checked); void on_pane3NoneRadioButton_toggled(bool checked); void on_restoreButtonBox_clicked(QAbstractButton *button); + void on_packetListSeparatorCheckBox_toggled(bool checked); }; diff --git a/ui/qt/layout_preferences_frame.ui b/ui/qt/layout_preferences_frame.ui index edd5abbb60..00d7906595 100644 --- a/ui/qt/layout_preferences_frame.ui +++ b/ui/qt/layout_preferences_frame.ui @@ -7,7 +7,7 @@ 0 0 414 - 259 + 287 @@ -328,6 +328,29 @@ + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + Show packet separator on Packet List + + + diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 8aee922ace..96c3ae1408 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -442,6 +442,18 @@ PacketList::PacketList(QWidget *parent) : this, SIGNAL(editProtocolPreference(preference*,pref_module*))); } +void PacketList::drawRow (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + QTreeView::drawRow(painter, option, index); + + if (prefs.gui_qt_packet_list_separator) { + QRect rect = visualRect(index); + + painter->setPen(QColor(Qt::white)); + painter->drawLine(0, rect.y() + rect.height() - 1, width(), rect.y() + rect.height() - 1); + } +} + void PacketList::setProtoTree (ProtoTree *proto_tree) { proto_tree_ = proto_tree; diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h index ae7b751281..67b9022d65 100644 --- a/ui/qt/packet_list.h +++ b/ui/qt/packet_list.h @@ -32,6 +32,7 @@ #include #include #include +#include class OverlayScrollBar; @@ -81,6 +82,7 @@ protected: protected slots: void rowsInserted(const QModelIndex &parent, int start, int end); + void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const; private: PacketListModel *packet_list_model_;