diff options
-rw-r--r-- | epan/prefs.c | 13 | ||||
-rw-r--r-- | ui/qt/column_preferences_frame.cpp | 5 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 6 | ||||
-rw-r--r-- | ui/qt/preferences_dialog.cpp | 6 | ||||
-rw-r--r-- | ui/qt/preferences_dialog.h | 4 |
5 files changed, 20 insertions, 14 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index f8a889666a..9c67bb7156 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -2794,9 +2794,9 @@ parse_column_format(fmt_data *cfmt, const char *fmt) gchar **cust_format_info; char *p; int col_fmt; - gchar *col_custom_field; - long col_custom_occurrence; - gboolean col_resolved; + gchar *col_custom_field = NULL; + long col_custom_occurrence = 0; + gboolean col_resolved = TRUE; /* * Is this a custom column? @@ -2815,22 +2815,15 @@ parse_column_format(fmt_data *cfmt, const char *fmt) g_strfreev(cust_format_info); return FALSE; } - } else { - col_custom_occurrence = 0; } if (col_custom_field && cust_format_info[1] && cust_format_info[2]) { col_resolved = (cust_format_info[2][0] == 'U') ? FALSE : TRUE; - } else { - col_resolved = TRUE; } g_strfreev(cust_format_info); } else { col_fmt = get_column_format_from_str(fmt); if (col_fmt == -1) return FALSE; - col_custom_field = NULL; - col_custom_occurrence = 0; - col_resolved = TRUE; } cfmt->fmt = col_fmt; diff --git a/ui/qt/column_preferences_frame.cpp b/ui/qt/column_preferences_frame.cpp index 6fdd8dfe47..42a148946c 100644 --- a/ui/qt/column_preferences_frame.cpp +++ b/ui/qt/column_preferences_frame.cpp @@ -84,9 +84,12 @@ void ColumnPreferencesFrame::unstash() QTreeWidgetItemIterator it(ui->columnTreeWidget); while (*it) { fmt_data *cfmt = g_new0(fmt_data, 1); - cfmt->visible = (*it)->checkState(visible_col_) == Qt::Checked ? TRUE : FALSE; + cfmt->title = g_strdup((*it)->text(title_col_).toUtf8().constData()); cfmt->fmt = (*it)->data(type_col_, Qt::UserRole).value<int>(); + cfmt->visible = (*it)->checkState(visible_col_) == Qt::Checked ? TRUE : FALSE; + cfmt->resolved = TRUE; + if (cfmt->fmt == COL_CUSTOM) { bool ok; int occurrence = (*it)->text(custom_occurrence_col_).toInt(&ok); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index b58e7e1caf..92f4ab18aa 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1673,6 +1673,12 @@ void MainWindow::on_actionEditPreferences_triggered() PreferencesDialog pref_dialog; pref_dialog.exec(); + + // Emitting PacketDissectionChanged directly from PreferencesDialog + // can cause problems. Queue them up and emit them here. + foreach (WiresharkApplication::AppSignal app_signal, pref_dialog.appSignals()) { + wsApp->emitAppSignal(app_signal); + } } // View Menu diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp index 0503db718e..663b33b96c 100644 --- a/ui/qt/preferences_dialog.cpp +++ b/ui/qt/preferences_dialog.cpp @@ -23,7 +23,6 @@ #include "ui_preferences_dialog.h" #include "module_preferences_scroll_area.h" -#include "wireshark_application.h" #ifdef HAVE_LIBPCAP #ifdef _WIN32 @@ -788,6 +787,7 @@ void PreferencesDialog::on_buttonBox_accepted() gboolean must_redissect = FALSE; // XXX - We should validate preferences as the user changes them, not here. + // XXX - We're also too enthusiastic about setting must_redissect. // if (!prefs_main_fetch_all(parent_w, &must_redissect)) // return; /* Errors in some preference setting - already reported */ prefs_modules_foreach_submodules(NULL, module_prefs_unstash, (gpointer) &must_redissect); @@ -813,15 +813,15 @@ void PreferencesDialog::on_buttonBox_accepted() #endif wsApp->setMonospaceFont(prefs.gui_qt_font_name); - wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged); /* Now destroy the "Preferences" dialog. */ // window_destroy(GTK_WIDGET(parent_w)); if (must_redissect) { /* Redissect all the packets, and re-evaluate the display filter. */ - wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged); + app_signals_ << WiresharkApplication::PacketDissectionChanged; } + app_signals_ << WiresharkApplication::PreferencesChanged; } void PreferencesDialog::on_buttonBox_helpRequested() diff --git a/ui/qt/preferences_dialog.h b/ui/qt/preferences_dialog.h index bf8cb04890..1e08d53954 100644 --- a/ui/qt/preferences_dialog.h +++ b/ui/qt/preferences_dialog.h @@ -30,6 +30,8 @@ #include <epan/prefs.h> +#include "wireshark_application.h" + #include <QDialog> #include <QTreeWidgetItem> #include <QComboBox> @@ -48,6 +50,7 @@ class PreferencesDialog : public QDialog public: explicit PreferencesDialog(QWidget *parent = 0); ~PreferencesDialog(); + const QList<WiresharkApplication::AppSignal> appSignals() const { return app_signals_; } protected: void showEvent(QShowEvent *evt); @@ -63,6 +66,7 @@ private: QString saved_string_pref_; QComboBox *cur_combo_box_; int saved_combo_idx_; + QList<WiresharkApplication::AppSignal> app_signals_; private slots: void on_prefsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); |