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_;