aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-02-18 17:18:27 -0800
committerAnders Broman <a.broman58@gmail.com>2015-02-24 09:58:03 +0000
commit30ed6a1d72f1a231e5c6cb7993239e95cd3c6038 (patch)
tree265a38525864c2514e81e998b0949562f6d1c131
parentf9fc25241ca0c735c0945bebf04669f17c3ffbff (diff)
Qt: Apply recent settings.
Add PacketList::applyRecentColumnWidths which set the packet list column widths from our recent settings. Make sure it gets called at startup and when we change profiles. Save the packet list header state so that we can restore it when we reset the model (i.e. freezing and thawing) and load a new capture file. Save the state when the user resizes a column. As a side effect this works around a weird bug that adjusts the width of column 1 at an inopportune time. Add a profileChanging signal so that we can save the main window geometry in each profile. Get rid of MainWindow::configurationProfileChanged. It was unused. Apply saved pane widths and heights. Note that we might want to add a separate pair of recent settings for the Qt panes. Use the last opened directory in the capture file dialog. Git rid of some unneeded Q_UNUSEDs while we're here. Bug: 10953 Change-Id: I812aff59818cf0b4d1598b580627d32728d2e9d7 Reviewed-on: https://code.wireshark.org/review/7247 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Michal Labedzki <michal.labedzki@tieto.com> Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--cfile.h2
-rw-r--r--ui/qt/capture_file_dialog.cpp1
-rw-r--r--ui/qt/main_status_bar.cpp2
-rw-r--r--ui/qt/main_window.cpp16
-rw-r--r--ui/qt/main_window.h17
-rw-r--r--ui/qt/main_window_slots.cpp110
-rw-r--r--ui/qt/packet_list.cpp90
-rw-r--r--ui/qt/packet_list.h5
-rw-r--r--ui/qt/packet_list_model.cpp3
-rw-r--r--ui/qt/wireshark_application.cpp10
-rw-r--r--ui/qt/wireshark_application.h5
-rw-r--r--wireshark-qt.cpp4
12 files changed, 164 insertions, 101 deletions
diff --git a/cfile.h b/cfile.h
index 130fafae6c..fda7815421 100644
--- a/cfile.h
+++ b/cfile.h
@@ -112,7 +112,7 @@ typedef struct _capture_file {
guint32 first_displayed; /* Frame number of first frame displayed */
guint32 last_displayed; /* Frame number of last frame displayed */
column_info cinfo; /* Column formatting information */
- gboolean columns_changed; /**< Have the columns been changed in the prefs? */
+ gboolean columns_changed; /**< Have the columns been changed in the prefs? (GTK+ only) */
frame_data *current_frame; /* Frame data for current frame */
gint current_row; /* Row number for current frame */
epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index c68db555d8..98c9f0ba5d 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -102,6 +102,7 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString
#endif
{
#if !defined(Q_OS_WIN)
+ setDirectory(wsApp->lastOpenDir());
// Add extra widgets
// http://qt-project.org/faq/answer/how_can_i_add_widgets_to_my_qfiledialog_instance
setOption(QFileDialog::DontUseNativeDialog, true);
diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp
index 725015a6db..7da9087927 100644
--- a/ui/qt/main_status_bar.cpp
+++ b/ui/qt/main_status_bar.cpp
@@ -174,7 +174,7 @@ MainStatusBar::MainStatusBar(QWidget *parent) :
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(pushProfileName()));
connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)),
this, SLOT(toggleBackground(bool)));
- connect(wsApp, SIGNAL(configurationProfileChanged(const gchar *)),
+ connect(wsApp, SIGNAL(profileNameChanged(const gchar *)),
this, SLOT(pushProfileName()));
connect(&profile_status_, SIGNAL(mousePressedAt(QPoint,Qt::MouseButton)),
this, SLOT(showProfileMenu(QPoint,Qt::MouseButton)));
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 08ed2befe1..7848fd6d13 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -70,7 +70,6 @@
#include <QtMacExtras/QMacNativeToolBar>
#endif
-#include <QDebug>
//menu_recent_file_write_all
@@ -200,6 +199,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(zoomText()));
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(addStatsPluginsToMenu()));
+ connect(wsApp, SIGNAL(profileChanging()), this, SLOT(saveWindowGeometry()));
connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(layoutPanes()));
connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(layoutToolbars()));
connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(updateNameResolutionActions()));
@@ -322,7 +322,9 @@ MainWindow::MainWindow(QWidget *parent) :
wsApp, SLOT(updateTaps()));
connect(wsApp, SIGNAL(columnsChanged()),
- this, SLOT(recreatePacketList()));
+ packet_list_, SLOT(applyRecentColumnWidths()));
+ connect(wsApp, SIGNAL(recentFilesRead()),
+ this, SLOT(applyRecentPaneGeometry()));
connect(wsApp, SIGNAL(packetDissectionChanged()),
this, SLOT(redissectPackets()));
connect(wsApp, SIGNAL(appInitialized()),
@@ -592,6 +594,16 @@ void MainWindow::saveWindowGeometry()
// On OS X this is false when it shouldn't be
recent.gui_geometry_main_maximized = isMaximized();
}
+
+ if (master_split_.sizes().length() > 0) {
+ recent.gui_geometry_main_upper_pane = master_split_.sizes()[0];
+ }
+
+ if (master_split_.sizes().length() > 2) {
+ recent.gui_geometry_main_lower_pane = master_split_.sizes()[1];
+ } else if (extra_split_.sizes().length() > 0) {
+ recent.gui_geometry_main_lower_pane = extra_split_.sizes()[0];
+ }
}
QWidget* MainWindow::getLayoutWidget(layout_pane_content_e type) {
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 774f32d49a..5310c00033 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -145,7 +145,6 @@ private:
QSocketNotifier *pipe_notifier_;
#endif
- void saveWindowGeometry();
QWidget* getLayoutWidget(layout_pane_content_e type);
void mergeCaptureFile();
@@ -189,16 +188,17 @@ public slots:
void filterPackets(QString& new_filter = *new QString(), bool force = false);
void updateForUnsavedChanges();
void layoutPanes();
+ void applyRecentPaneGeometry();
void layoutToolbars();
void updateNameResolutionActions();
void captureCapturePrepared(capture_session *);
- void captureCaptureUpdateStarted(capture_session *cap_session);
- void captureCaptureUpdateFinished(capture_session *cap_session);
- void captureCaptureFixedStarted(capture_session *cap_session);
+ void captureCaptureUpdateStarted(capture_session *);
+ void captureCaptureUpdateFinished(capture_session *);
+ void captureCaptureFixedStarted(capture_session *);
void captureCaptureFixedFinished(capture_session *cap_session);
- void captureCaptureStopping(capture_session *cap_session);
- void captureCaptureFailed(capture_session *cap_session);
+ void captureCaptureStopping(capture_session *);
+ void captureCaptureFailed(capture_session *);
void captureFileOpened();
void captureFileReadStarted();
@@ -206,7 +206,6 @@ public slots:
void captureFileClosing();
void captureFileClosed();
- void configurationProfileChanged(const gchar *profile_name);
void filterExpressionsChanged();
private slots:
@@ -218,6 +217,7 @@ private slots:
void stopCapture();
void loadWindowGeometry();
+ void saveWindowGeometry();
void updateRecentFiles();
void recentActionTriggered();
void setMenusForFollowStream();
@@ -226,7 +226,6 @@ private slots:
void interfaceSelectionChanged();
void captureFilterSyntaxChanged(bool valid);
void redissectPackets();
- void recreatePacketList();
void fieldsChanged();
void showColumnEditor(int column);
void addStatsPluginsToMenu();
@@ -427,7 +426,7 @@ private slots:
void on_actionStatisticsHTTPRequests_triggered();
void on_actionStatisticsHTTPLoadDistribution_triggered();
void on_actionStatisticsPacketLen_triggered();
- void statCommandIOGraph(const char *arg = NULL, void *userdata = NULL);
+ void statCommandIOGraph(const char *, void *);
void on_actionStatisticsIOGraph_triggered();
void on_actionStatisticsSametime_triggered();
void on_actionStatisticsDNS_triggered();
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index b7ccae4cd4..8291e0d3c8 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -246,6 +246,11 @@ void MainWindow::filterPackets(QString& new_filter, bool force)
}
}
+// A new layout should be applied when it differs from the old layout AND
+// at the following times:
+// - At startup
+// - When the preferences change
+// - When the profile changes
void MainWindow::layoutPanes()
{
QVector<unsigned> new_layout = QVector<unsigned>() << prefs.gui_layout_type
@@ -259,7 +264,7 @@ void MainWindow::layoutPanes()
// Reparent all widgets and add them back in the proper order below.
// This hides each widget as well.
- packet_list_->freeze(); // Clears tree and byte view tab.
+ packet_list_->freeze(); // Clears tree and byte view tabs.
packet_list_->setParent(main_ui_->mainStack);
proto_tree_->setParent(main_ui_->mainStack);
byte_view_tab_->setParent(main_ui_->mainStack);
@@ -348,6 +353,54 @@ void MainWindow::layoutPanes()
cur_layout_ = new_layout;
}
+// The recent layout geometry should be applied after the layout has been
+// applied AND at the following times:
+// - At startup
+// - When the profile changes
+void MainWindow::applyRecentPaneGeometry()
+{
+ // XXX This shrinks slightly each time the application is run. For some
+ // reason the master_split_ geometry is two pixels shorter when
+ // saveWindowGeometry is invoked.
+
+ // This is also an awful lot of trouble to go through to reuse the GTK+
+ // pane settings. We might want to add gui.geometry_main_master_sizes
+ // and gui.geometry_main_extra_sizes and save QSplitter::saveState in
+ // each.
+
+ // Force a geometry recalculation
+ QWidget *cur_w = main_ui_->mainStack->currentWidget();
+ main_ui_->mainStack->setCurrentWidget(&master_split_);
+ QRect geom = master_split_.geometry();
+ QList<int> master_sizes = master_split_.sizes();
+ QList<int> extra_sizes = extra_split_.sizes();
+ main_ui_->mainStack->setCurrentWidget(cur_w);
+
+ int master_last_size = master_split_.orientation() == Qt::Vertical ? geom.height() : geom.width();
+ int extra_last_size = extra_split_.orientation() == Qt::Vertical ? geom.height() : geom.width();
+
+ if (recent.gui_geometry_main_upper_pane > 0) {
+ master_sizes[0] = recent.gui_geometry_main_upper_pane + 1; // Add back mystery pixel
+ master_last_size -= recent.gui_geometry_main_upper_pane + master_split_.handleWidth();
+ }
+
+ if (recent.gui_geometry_main_lower_pane > 0) {
+ if (master_sizes.length() > 2) {
+ master_sizes[1] = recent.gui_geometry_main_lower_pane + 1; // Add back mystery pixel
+ master_last_size -= recent.gui_geometry_main_lower_pane + master_split_.handleWidth();
+ } else if (extra_sizes.length() > 0) {
+ extra_sizes[0] = recent.gui_geometry_main_lower_pane; // No mystery pixel
+ extra_last_size -= recent.gui_geometry_main_lower_pane + extra_split_.handleWidth();
+ extra_sizes.last() = extra_last_size;
+ }
+ }
+
+ master_sizes.last() = master_last_size;
+
+ master_split_.setSizes(master_sizes);
+ extra_split_.setSizes(extra_sizes);
+}
+
void MainWindow::layoutToolbars()
{
Qt::ToolButtonStyle tbstyle = Qt::ToolButtonIconOnly;
@@ -453,8 +506,7 @@ void MainWindow::captureCapturePrepared(capture_session *) {
#endif // HAVE_LIBPCAP
}
-void MainWindow::captureCaptureUpdateStarted(capture_session *cap_session) {
- Q_UNUSED(cap_session);
+void MainWindow::captureCaptureUpdateStarted(capture_session *) {
#ifdef HAVE_LIBPCAP
/* We've done this in "prepared" above, but it will be cleared while
@@ -466,8 +518,7 @@ void MainWindow::captureCaptureUpdateStarted(capture_session *cap_session) {
setForCapturedPackets(true);
#endif // HAVE_LIBPCAP
}
-void MainWindow::captureCaptureUpdateFinished(capture_session *cap_session) {
- Q_UNUSED(cap_session);
+void MainWindow::captureCaptureUpdateFinished(capture_session *) {
#ifdef HAVE_LIBPCAP
/* The capture isn't stopping any more - it's stopped. */
@@ -489,13 +540,11 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *cap_session) {
}
#endif // HAVE_LIBPCAP
}
-void MainWindow::captureCaptureFixedStarted(capture_session *cap_session) {
- Q_UNUSED(cap_session);
+void MainWindow::captureCaptureFixedStarted(capture_session *) {
#ifdef HAVE_LIBPCAP
#endif // HAVE_LIBPCAP
}
-void MainWindow::captureCaptureFixedFinished(capture_session *cap_session) {
- Q_UNUSED(cap_session);
+void MainWindow::captureCaptureFixedFinished(capture_session *) {
#ifdef HAVE_LIBPCAP
/* The capture isn't stopping any more - it's stopped. */
@@ -514,16 +563,14 @@ void MainWindow::captureCaptureFixedFinished(capture_session *cap_session) {
}
#endif // HAVE_LIBPCAP
}
-void MainWindow::captureCaptureStopping(capture_session *cap_session) {
- Q_UNUSED(cap_session);
+void MainWindow::captureCaptureStopping(capture_session *) {
#ifdef HAVE_LIBPCAP
capture_stopping_ = true;
setMenusForCaptureStopping();
#endif // HAVE_LIBPCAP
}
-void MainWindow::captureCaptureFailed(capture_session *cap_session) {
- Q_UNUSED(cap_session);
+void MainWindow::captureCaptureFailed(capture_session *) {
#ifdef HAVE_LIBPCAP
/* Capture isn't stopping any more. */
capture_stopping_ = false;
@@ -619,23 +666,6 @@ void MainWindow::captureFileClosed() {
setMenusForSelectedTreeRow();
}
-void MainWindow::configurationProfileChanged(const gchar *profile_name) {
- Q_UNUSED(profile_name);
- /* Update window view and redraw the toolbar */
-// main_titlebar_update();
- filterExpressionsChanged();
-// toolbar_redraw_all();
-
- /* Reload list of interfaces on welcome page */
-// welcome_if_panel_reload();
-
- /* Recreate the packet list according to new preferences */
- recreatePacketList();
-
- /* Reload pane geometry, must be done after recreating the list */
- // main_pane_load_window_geometry();
-}
-
void MainWindow::filterExpressionsChanged()
{
// Recreate filter buttons
@@ -1250,20 +1280,6 @@ void MainWindow::redissectPackets()
main_ui_->statusBar->expertUpdate();
}
-void MainWindow::recreatePacketList()
-{
- prefs.num_cols = g_list_length(prefs.col_list);
-
- col_cleanup(&CaptureFile::globalCapFile()->cinfo);
- build_column_format_array(&CaptureFile::globalCapFile()->cinfo, prefs.num_cols, FALSE);
-
- packet_list_->redrawVisiblePackets();
- packet_list_->hide();
- packet_list_->show();
-
- CaptureFile::globalCapFile()->columns_changed = FALSE; /* Reset value */
-}
-
void MainWindow::fieldsChanged()
{
// Reload color filters
@@ -1286,7 +1302,7 @@ void MainWindow::fieldsChanged()
if (have_custom_cols(&CaptureFile::globalCapFile()->cinfo)) {
/* Recreate packet list according to new/changed/deleted fields */
- recreatePacketList();
+ packet_list_->redrawVisiblePackets();
} else if (CaptureFile::globalCapFile()->state != FILE_CLOSED) {
/* Redissect packets if we have any */
redissectPackets();
@@ -2457,10 +2473,8 @@ void MainWindow::on_actionStatisticsPacketLen_triggered()
openStatisticsTreeDialog("plen");
}
-void MainWindow::statCommandIOGraph(const char *arg, void *userdata)
+void MainWindow::statCommandIOGraph(const char *, void *)
{
- Q_UNUSED(arg);
- Q_UNUSED(userdata);
IOGraphDialog *iog_dialog = new IOGraphDialog(*this, capture_file_);
connect(iog_dialog, SIGNAL(goToPacket(int)), packet_list_, SLOT(goToPacket(int)));
iog_dialog->show();
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 6b5a70b11c..91a242030a 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -93,19 +93,8 @@ packet_list_append(column_info *cinfo, frame_data *fdata)
// Copied from ui/gtk/packet_list.c
void packet_list_resize_column(gint col)
{
- Q_UNUSED(col)
- // xxx qtshark
-// gint col_width;
-// const gchar *long_str;
-
-//g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: packet_list_resize_column %d", col);
-// long_str = packet_list_get_widest_column_string(packetlist, col);
-// if(!long_str || strcmp("",long_str)==0)
-// /* If we get an empty string leave the width unchanged */
-// return;
-// column = gtk_tree_view_get_column (GTK_TREE_VIEW(packetlist->view), col);
-// col_width = get_default_col_size (packetlist->view, long_str);
-// gtk_tree_view_column_set_fixed_width(column, col_width);
+ if (!gbl_cur_packet_list) return;
+ gbl_cur_packet_list->resizeColumnToContents(col);
}
void
@@ -425,9 +414,11 @@ PacketList::PacketList(QWidget *parent) :
connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int)));
connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePackets()));
+
header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), SIGNAL(customContextMenuRequested(QPoint)),
SLOT(showHeaderMenu(QPoint)));
+ connect(header(), SIGNAL(sectionResized(int,int,int)), this, SLOT(sectionResized(int,int,int)));
}
void PacketList::setProtoTree (ProtoTree *proto_tree) {
@@ -448,22 +439,7 @@ PacketListModel *PacketList::packetListModel() const {
return packet_list_model_;
}
-void PacketList::showEvent (QShowEvent *event) {
- Q_UNUSED(event);
-
- for (int i = 0; i < prefs.num_cols; i++) {
- int fmt, col_width;
- const char *long_str;
-
- fmt = get_column_format(i);
- long_str = get_column_width_string(fmt, i);
- if (long_str) {
- col_width = packet_list_model_->columnTextSize(long_str);
- } else {
- col_width = packet_list_model_->columnTextSize(MIN_COL_WIDTH_STR);
- }
- setColumnWidth(i, col_width);
- }
+void PacketList::showEvent (QShowEvent *) {
setColumnVisibility();
}
@@ -636,6 +612,7 @@ void PacketList::redrawVisiblePackets() {
int row = currentIndex().row();
prefs.num_cols = g_list_length(prefs.col_list);
+ col_cleanup(&cap_file_->cinfo);
build_column_format_array(&cap_file_->cinfo, prefs.num_cols, FALSE);
packet_list_model_->resetColumns();
@@ -647,6 +624,37 @@ void PacketList::redrawVisiblePackets() {
header()->update();
}
+// Column widths should
+// - Load from recent when we load a new profile (including at starting up).
+// - Persist across freezes and thaws.
+// - Persist across file closing and opening.
+// - Save to recent when we save our profile (including shutting down).
+
+void PacketList::applyRecentColumnWidths()
+{
+ // Either we've just started up or a profile has changed. Read
+ // the recent settings, apply them, and save the header state.
+ for (int i = 0; i < prefs.num_cols; i++) {
+ int col_width = recent_get_column_width(i);
+
+ if (col_width < 1) {
+ int fmt;
+ const char *long_str;
+
+ fmt = get_column_format(i);
+ long_str = get_column_width_string(fmt, i);
+ if (long_str) {
+ col_width = packet_list_model_->columnTextSize(long_str);
+ } else {
+ col_width = packet_list_model_->columnTextSize(MIN_COL_WIDTH_STR);
+ }
+ }
+ setColumnWidth(i, col_width);
+ }
+ column_state_ = header()->saveState();
+ redrawVisiblePackets();
+}
+
void PacketList::recolorPackets()
{
packet_list_model_->resetColorized();
@@ -668,6 +676,12 @@ void PacketList::thaw()
{
setModel(packet_list_model_);
setUpdatesEnabled(true);
+
+ // Resetting the model resets our column widths so we restore them here.
+ // We don't reapply the recent settings because the user could have
+ // resized the columns manually since they were initially loaded.
+ header()->restoreState(column_state_);
+
setColumnVisibility();
}
@@ -690,7 +704,7 @@ void PacketList::writeRecent(FILE *rf) {
gchar xalign;
fprintf (rf, "%s:", RECENT_KEY_COL_WIDTH);
- for (col = 0; col < packet_list_model_->columnCount(); col++) {
+ for (col = 0; col < prefs.num_cols; col++) {
if (col > 0) {
fprintf (rf, ",");
}
@@ -851,6 +865,10 @@ QString PacketList::allPacketComments()
void PacketList::setCaptureFile(capture_file *cf)
{
+ if (cf) {
+ // We're opening. Restore our column widths.
+ header()->restoreState(column_state_);
+ }
cap_file_ = cf;
packet_list_model_->setCaptureFile(cf);
}
@@ -1004,7 +1022,7 @@ void PacketList::showHeaderMenu(QPoint pos)
header_actions_[caAlignLeft]->setChecked(true);
break;
case COLUMN_XALIGN_CENTER:
- header_actions_[caAlignCenter]->setChecked(true);\
+ header_actions_[caAlignCenter]->setChecked(true);
break;
case COLUMN_XALIGN_RIGHT:
header_actions_[caAlignRight]->setChecked(true);
@@ -1101,6 +1119,16 @@ void PacketList::columnVisibilityTriggered()
setColumnVisibility();
}
+void PacketList::sectionResized(int, int, int)
+{
+ // For some reason the width of column 1 gets set to 32 when we open a file after
+ // closing a previous one. I (Gerald) am not sure if this is a bug in Qt or if it's
+ // our doing. Either way this catches that and fixes it.
+ if (isVisible()) {
+ column_state_ = header()->saveState();
+ }
+}
+
/*
* Editor modelines
*
diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h
index 8641aef521..04fcf74e2e 100644
--- a/ui/qt/packet_list.h
+++ b/ui/qt/packet_list.h
@@ -65,7 +65,7 @@ public:
void recolorPackets();
protected:
- void showEvent (QShowEvent *event);
+ void showEvent (QShowEvent *);
void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
void contextMenuEvent(QContextMenuEvent *event);
@@ -78,6 +78,7 @@ private:
QMenu ctx_menu_;
QAction *decode_as_;
int ctx_column_;
+ QByteArray column_state_;
RelatedPacketDelegate related_packet_delegate_;
QMenu header_ctx_menu_;
@@ -115,12 +116,14 @@ public slots:
void setTimeReference();
void unsetAllTimeReferences();
void redrawVisiblePackets();
+ void applyRecentColumnWidths();
private slots:
void addRelatedFrame(int related_frame);
void showHeaderMenu(QPoint pos);
void headerMenuTriggered();
void columnVisibilityTriggered();
+ void sectionResized(int, int, int);
};
#endif // PACKET_LIST_H
diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp
index 473d89e1ea..b10af13a18 100644
--- a/ui/qt/packet_list_model.cpp
+++ b/ui/qt/packet_list_model.cpp
@@ -22,6 +22,7 @@
#include "packet_list_model.h"
#include <wsutil/nstime.h>
+#include <epan/column.h>
#include <epan/prefs.h>
#include "ui/packet_list_utils.h"
@@ -329,7 +330,7 @@ QVariant PacketListModel::headerData(int section, Qt::Orientation orientation,
if (orientation == Qt::Horizontal && section < prefs.num_cols) {
switch (role) {
case Qt::DisplayRole:
- return cap_file_->cinfo.col_title[section];
+ return get_column_title(section);
default:
break;
}
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 085caa5045..51c03aa9df 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -328,7 +328,7 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
}
/* Get the current geometry, before writing it to disk */
-// main_save_window_geometry(top_level);
+ emit profileChanging();
if (profile_exists(get_profile_name(), FALSE)) {
/* Write recent file for profile we are leaving, if it still exists */
@@ -337,7 +337,7 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
/* Set profile name and update the status bar */
set_profile_name (profile_name);
- emit configurationProfileChanged(profile_name);
+ emit profileNameChanged(profile_name);
/* Reset current preferences and apply the new */
prefs_reset();
@@ -362,6 +362,10 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
prefs_to_capture_opts();
prefs_apply_all();
+
+ emit preferencesChanged();
+ emit recentFilesRead();
+ emit columnsChanged();
emit filterExpressionsChanged();
// macros_post_update();
@@ -553,7 +557,7 @@ void WiresharkApplication::emitAppSignal(AppSignal signal)
case PacketDissectionChanged:
emit packetDissectionChanged();
break;
- case StaticRecentFilesRead:
+ case RecentFilesRead:
emit recentFilesRead();
break;
case FieldsChanged:
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index 239009cd8d..2255fd5ace 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -65,7 +65,7 @@ public:
FilterExpressionsChanged,
PacketDissectionChanged,
PreferencesChanged,
- StaticRecentFilesRead,
+ RecentFilesRead,
FieldsChanged
};
@@ -118,7 +118,8 @@ signals:
void recentFilesRead();
void updateRecentItemStatus(const QString &filename, qint64 size, bool accessible);
void splashUpdate(register_action_e action, const char *message);
- void configurationProfileChanged(const gchar *profile_name);
+ void profileChanging();
+ void profileNameChanged(const gchar *profile_name);
void columnsChanged(); // XXX This recreates the packet list. We might want to rename it accordingly.
void filterExpressionsChanged();
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index e6ee76f54c..32c2f0c954 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -721,7 +721,6 @@ DIAG_ON(cast-qual)
"Could not open common recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno));
}
- wsApp->emitAppSignal(WiresharkApplication::StaticRecentFilesRead);
/* Init the "Open file" dialog directory */
/* (do this after the path settings are processed) */
@@ -765,7 +764,6 @@ DIAG_ON(cast-qual)
"Could not open recent file\n\"%s\": %s.",
rf_path, g_strerror(rf_open_errno));
}
- wsApp->emitAppSignal(WiresharkApplication::StaticRecentFilesRead);
if (recent.gui_fileopen_remembered_dir &&
test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
@@ -1282,6 +1280,8 @@ DIAG_ON(cast-qual)
}
build_column_format_array(&CaptureFile::globalCapFile()->cinfo, prefs_p->num_cols, TRUE);
+ wsApp->emitAppSignal(WiresharkApplication::ColumnsChanged); // We read "recent" widths above.
+ wsApp->emitAppSignal(WiresharkApplication::RecentFilesRead); // Must be emitted after PreferencesChanged.
wsApp->setMonospaceFont(prefs.gui_qt_font_name);