Qt: enable autoscroll on initial capture start

The capture timer was never enabled on capture start or disabled on
capture stop. This is now implemented.

Bug: 10601
Change-Id: Iae23a952986a2c5dddf92b6ac0d1f1bc1c83719c
Reviewed-on: https://code.wireshark.org/review/7582
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2015-03-07 17:45:00 +01:00 committed by Anders Broman
parent 5ab8490088
commit ad1b3ee110
2 changed files with 8 additions and 1 deletions

View File

@ -727,7 +727,6 @@ void MainWindow::startCapture() {
}
/* XXX - we might need to init other pref data as well... */
// main_auto_scroll_live_changed(auto_scroll_live);
/* XXX - can this ever happen? */
if (cap_session_.state != CAPTURE_STOPPED)
@ -742,6 +741,9 @@ void MainWindow::startCapture() {
CaptureFile::globalCapFile()->window = this;
if (capture_start(&global_capture_opts, &cap_session_, main_window_update)) {
/* enable autoscroll timer as needed. */
packet_list_->setAutoScroll(main_ui_->actionGoAutoScroll->isChecked());
/* The capture succeeded, which means the capture filter syntax is
valid; add this capture filter to the recent capture filter list. */
for (i = 0; i < global_capture_opts.ifaces->len; i++) {
@ -837,6 +839,9 @@ void MainWindow::stopCapture() {
#ifdef HAVE_LIBPCAP
capture_stop(&cap_session_);
#endif // HAVE_LIBPCAP
/* disable autoscroll timer if any. */
packet_list_->setAutoScroll(false);
}
// XXX - Copied from ui/gtk/menus.c

View File

@ -685,6 +685,8 @@ void PacketList::recolorPackets()
redrawVisiblePackets();
}
/* Enable autoscroll timer. Note: must be called after the capture is started,
* otherwise the timer will not be executed. */
void PacketList::setAutoScroll(bool enabled)
{
tail_at_end_ = enabled;