forked from osmocom/wireshark
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>
This commit is contained in:
parent
6f9801a627
commit
a0113a5eb3
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
void setDisplayedFrameIgnore(gboolean set);
|
||||
void toggleFrameRefTime(const QModelIndex &rt_index);
|
||||
void unsetAllFrameRefTime();
|
||||
void applyTimeShift();
|
||||
|
||||
void setMaximiumRowHeight(int height);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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_;
|
||||
|
|
Loading…
Reference in New Issue