Qt: Only set Packet List style sheet when relevant prefs change
Add a colorsChanged signal/slot, more precise than the generic preferencesChanged signal, and only call it when one of the color related preferences have changed. Connect it to the packetList::colorsChanged() function, instead of calling that whenever preferencesChanged() is called. We could eventually move the signals and slots some of the other GUI widgets to this. Send that signal before handling preferences that change dissection and freeze the packet list, so that when we restore the column widths due to Qt bug 122109 it takes effect. The packet_list_hover_style preference affects colors, not the layout, despite its presence in the GUI layout module.
This commit is contained in:
parent
ea38f142e8
commit
c0288ca829
|
@ -141,6 +141,7 @@ WS_DLL_PUBLIC guint32 prefs_get_max_value(pref_t *pref);
|
|||
#define PREF_EFFECT_GUI_LAYOUT (1u << 2)
|
||||
#define PREF_EFFECT_FIELDS (1u << 3)
|
||||
#define PREF_EFFECT_GUI (1u << 4)
|
||||
#define PREF_EFFECT_GUI_COLOR (1u << 5)
|
||||
|
||||
/** Fetch flags that show the effect of the preference
|
||||
*
|
||||
|
|
|
@ -3358,7 +3358,8 @@ prefs_register_modules(void)
|
|||
|
||||
/* User Interface : Colors */
|
||||
gui_color_module = prefs_register_subtree(gui_module, "Colors", "Colors", NULL);
|
||||
prefs_set_module_effect_flags(gui_color_module, gui_effect_flags);
|
||||
unsigned gui_color_effect_flags = gui_effect_flags | PREF_EFFECT_GUI_COLOR;
|
||||
prefs_set_module_effect_flags(gui_color_module, gui_color_effect_flags);
|
||||
|
||||
prefs_register_color_preference(gui_color_module, "active_frame.fg", "Foreground color for an active selected item",
|
||||
"Foreground color for an active selected item", &prefs.gui_active_fg);
|
||||
|
@ -3635,10 +3636,15 @@ prefs_register_modules(void)
|
|||
"Show column definition in packet list header",
|
||||
&prefs.gui_packet_header_column_definition);
|
||||
|
||||
/* packet_list_hover_style affects the colors, not the layout.
|
||||
* It's in the layout module to group it with the other packet list
|
||||
* preferences for the user's benefit with the dialog.
|
||||
*/
|
||||
prefs_register_bool_preference(gui_layout_module, "packet_list_hover_style.enabled",
|
||||
"Enable Packet List mouse-over colorization",
|
||||
"Enable Packet List mouse-over colorization",
|
||||
&prefs.gui_packet_list_hover_style);
|
||||
prefs_set_effect_flags_by_name(gui_layout_module, "packet_list_hover_style.enabled", gui_color_effect_flags);
|
||||
|
||||
prefs_register_bool_preference(gui_layout_module, "show_selected_packet.enabled",
|
||||
"Show selected packet in the Status Bar",
|
||||
|
|
|
@ -1010,6 +1010,7 @@ int main(int argc, char *qt_argv[])
|
|||
#endif
|
||||
splash_update(RA_PREFERENCES_APPLY, NULL, NULL);
|
||||
prefs_apply_all();
|
||||
wsApp->emitAppSignal(WiresharkApplication::ColorsChanged);
|
||||
wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
|
|
@ -503,6 +503,7 @@ void MainApplication::setConfigurationProfile(const gchar *profile_name, bool wr
|
|||
emit freezePacketList(true);
|
||||
|
||||
emit columnsChanged();
|
||||
emit colorsChanged();
|
||||
emit preferencesChanged();
|
||||
emit recentPreferencesRead();
|
||||
emit filterExpressionsChanged();
|
||||
|
@ -870,6 +871,9 @@ void MainApplication::emitAppSignal(AppSignal signal)
|
|||
case FieldsChanged:
|
||||
emit fieldsChanged();
|
||||
break;
|
||||
case ColorsChanged:
|
||||
emit colorsChanged();
|
||||
break;
|
||||
case FreezePacketList:
|
||||
emit freezePacketList(false);
|
||||
break;
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
|
||||
enum AppSignal {
|
||||
CaptureFilterListChanged,
|
||||
ColorsChanged,
|
||||
ColumnsChanged,
|
||||
DisplayFilterListChanged,
|
||||
FieldsChanged,
|
||||
|
@ -204,6 +205,7 @@ signals:
|
|||
void displayFilterListChanged();
|
||||
void filterExpressionsChanged();
|
||||
void packetDissectionChanged();
|
||||
void colorsChanged();
|
||||
void preferencesChanged();
|
||||
void addressResolutionChanged();
|
||||
void columnDataChanged();
|
||||
|
|
|
@ -1178,9 +1178,6 @@ void PacketList::applyRecentColumnWidths()
|
|||
|
||||
void PacketList::preferencesChanged()
|
||||
{
|
||||
// Update color style changes
|
||||
colorsChanged();
|
||||
|
||||
// Related packet delegate
|
||||
if (prefs.gui_packet_list_show_related) {
|
||||
setItemDelegateForColumn(0, &related_packet_delegate_);
|
||||
|
|
|
@ -156,7 +156,6 @@ private:
|
|||
void drawCurrentPacket();
|
||||
void applyRecentColumnWidths();
|
||||
void scrollViewChanged(bool at_end);
|
||||
void colorsChanged();
|
||||
QString joinSummaryRow(QStringList col_parts, int row, SummaryCopyType type);
|
||||
|
||||
signals:
|
||||
|
@ -190,6 +189,7 @@ public slots:
|
|||
void recolorPackets();
|
||||
void redrawVisiblePackets();
|
||||
void redrawVisiblePacketsDontSelectCurrent();
|
||||
void colorsChanged();
|
||||
void columnsChanged();
|
||||
void fieldsChanged(capture_file *cf);
|
||||
void preferencesChanged();
|
||||
|
|
|
@ -313,6 +313,10 @@ void PreferencesDialog::on_buttonBox_accepted()
|
|||
|
||||
mainApp->setMonospaceFont(prefs.gui_font_name);
|
||||
|
||||
if (redissect_flags & (PREF_EFFECT_GUI_COLOR)) {
|
||||
mainApp->queueAppSignal(MainApplication::ColorsChanged);
|
||||
}
|
||||
|
||||
if (redissect_flags & PREF_EFFECT_FIELDS) {
|
||||
mainApp->queueAppSignal(MainApplication::FieldsChanged);
|
||||
}
|
||||
|
|
|
@ -591,6 +591,8 @@ main_ui_->goToLineEdit->setValidator(goToLineQiv);
|
|||
packet_list_, SLOT(freezePacketList(bool)));
|
||||
connect(mainApp, SIGNAL(columnsChanged()),
|
||||
packet_list_, SLOT(columnsChanged()));
|
||||
connect(mainApp, SIGNAL(colorsChanged()),
|
||||
packet_list_, SLOT(colorsChanged()));
|
||||
connect(mainApp, SIGNAL(preferencesChanged()),
|
||||
packet_list_, SLOT(preferencesChanged()));
|
||||
connect(mainApp, SIGNAL(recentPreferencesRead()),
|
||||
|
|
Loading…
Reference in New Issue