aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-10-15 23:14:10 +0200
committerGerald Combs <gerald@wireshark.org>2015-10-19 17:41:12 +0000
commita0113a5eb3329b815e1790f8dc42c48fa6ffbcd7 (patch)
tree98790347f65517d02597b14d6115ccd9d3f6c0e3 /ui
parent6f9801a6279f01ec004f1796bc2fd9d8f1110a99 (diff)
Qt: fix time shift
Add a timeShifted signal to TimeShiftDialog and use it to update the packet list and model. Add drawCurrentPacket to PacketList so that we can do a more thorough job of redrawing the current packet and tree. Bug: 11575 Change-Id: I960d8cdbf6872e3f71007cb4d2bbd5457f268257 Reviewed-on: https://code.wireshark.org/review/11068 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/main_window_slots.cpp1
-rw-r--r--ui/qt/packet_list.cpp23
-rw-r--r--ui/qt/packet_list.h2
-rw-r--r--ui/qt/packet_list_model.cpp6
-rw-r--r--ui/qt/packet_list_model.h1
-rw-r--r--ui/qt/time_shift_dialog.cpp8
-rw-r--r--ui/qt/time_shift_dialog.h3
7 files changed, 37 insertions, 7 deletions
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 32786a08b9..79d2961c27 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1972,6 +1972,7 @@ void MainWindow::on_actionEditTimeShift_triggered()
TimeShiftDialog ts_dialog(this, capture_file_.capFile());
connect(this, SIGNAL(setCaptureFile(capture_file*)),
&ts_dialog, SLOT(setCaptureFile(capture_file*)));
+ connect(&ts_dialog, SIGNAL(timeShifted()), packet_list_, SLOT(applyTimeShift()));
ts_dialog.exec();
}
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index e77b9a3631..304a2dff85 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -615,18 +615,22 @@ void PacketList::initHeaderContextMenu()
}
}
+void PacketList::drawCurrentPacket()
+{
+ QModelIndex current_index = currentIndex();
+ setCurrentIndex(QModelIndex());
+ if (current_index.isValid()) {
+ setCurrentIndex(current_index);
+ }
+}
+
// Redraw the packet list and detail. Called from many places.
// XXX We previously re-selected the packet here, but that seems to cause
// automatic scrolling problems.
void PacketList::redrawVisiblePackets() {
- if (!cap_file_) return;
-
- if (cap_file_->edt && cap_file_->edt->tree) {
- proto_tree_->fillProtocolTree(cap_file_->edt->tree);
- }
-
update();
header()->update();
+ drawCurrentPacket();
}
// prefs.col_list has changed.
@@ -1067,6 +1071,13 @@ void PacketList::unsetAllTimeReferences()
create_far_overlay_ = true;
}
+void PacketList::applyTimeShift()
+{
+ packet_list_model_->applyTimeShift();
+ redrawVisiblePackets();
+ // XXX emit packetDissectionChanged(); ?
+}
+
void PacketList::showHeaderMenu(QPoint pos)
{
header_ctx_column_ = header()->logicalIndexAt(pos);
diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h
index 3a3dffb8f0..13fc6990b2 100644
--- a/ui/qt/packet_list.h
+++ b/ui/qt/packet_list.h
@@ -122,6 +122,7 @@ private:
void setColumnVisibility();
int sizeHintForColumn(int column) const;
void initHeaderContextMenu();
+ void drawCurrentPacket();
signals:
void packetDissectionChanged();
@@ -147,6 +148,7 @@ public slots:
void ignoreAllDisplayedFrames(bool set);
void setTimeReference();
void unsetAllTimeReferences();
+ void applyTimeShift();
void redrawVisiblePackets();
void columnsChanged();
void fieldsChanged(capture_file *cf);
diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp
index a504ebed91..0ee0b662c7 100644
--- a/ui/qt/packet_list_model.cpp
+++ b/ui/qt/packet_list_model.cpp
@@ -244,6 +244,12 @@ void PacketListModel::unsetAllFrameRefTime()
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
+void PacketListModel::applyTimeShift()
+{
+ resetColumns();
+ dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
+}
+
void PacketListModel::setMaximiumRowHeight(int height)
{
max_row_height_ = height;
diff --git a/ui/qt/packet_list_model.h b/ui/qt/packet_list_model.h
index 5ef6e6cc2f..6562cebeee 100644
--- a/ui/qt/packet_list_model.h
+++ b/ui/qt/packet_list_model.h
@@ -72,6 +72,7 @@ public:
void setDisplayedFrameIgnore(gboolean set);
void toggleFrameRefTime(const QModelIndex &rt_index);
void unsetAllFrameRefTime();
+ void applyTimeShift();
void setMaximiumRowHeight(int height);
diff --git a/ui/qt/time_shift_dialog.cpp b/ui/qt/time_shift_dialog.cpp
index bbfbf05a0c..4b168d1c27 100644
--- a/ui/qt/time_shift_dialog.cpp
+++ b/ui/qt/time_shift_dialog.cpp
@@ -262,7 +262,13 @@ void TimeShiftDialog::applyTimeShift()
} else if (ts_ui_->unshiftAllButton->isChecked()) {
err_str = time_shift_undo(cap_file_);
}
- if (err_str) syntax_err_ = err_str;
+
+ if (err_str) {
+ syntax_err_ = err_str;
+ } else {
+ emit timeShifted();
+ }
+
enableWidgets();
}
diff --git a/ui/qt/time_shift_dialog.h b/ui/qt/time_shift_dialog.h
index adf169f76d..ee2746d791 100644
--- a/ui/qt/time_shift_dialog.h
+++ b/ui/qt/time_shift_dialog.h
@@ -48,6 +48,9 @@ public:
public slots:
void setCaptureFile(capture_file *cf) { cap_file_ = cf; }
+signals:
+ void timeShifted();
+
private:
Ui::TimeShiftDialog *ts_ui_;
capture_file *cap_file_;