Apply new CaptureEvents to statistics dialogs.

Refactoring from If366d42b07dc822636404ac44ba2306ec4418b4e ignored
dialogs outside of the main window.  Searched for removed signals
from CaptureFile class and applied new CaptureEvent handling.

Change-Id: I9e0aaa0dc1c702ce04810d27c8f9273997f7ca30
Reviewed-on: https://code.wireshark.org/review/25007
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Michael Mann 2017-12-26 19:42:08 -05:00 committed by Roland Knall
parent cb7eef8ff8
commit 777acc73da
15 changed files with 120 additions and 50 deletions

View File

@ -115,11 +115,8 @@ ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) :
ctx_menu_.addAction(expand);
connect(expand, SIGNAL(triggered()), this, SLOT(expandTree()));
connect(&cap_file_, SIGNAL(captureFileRetapStarted()),
this, SLOT(retapStarted()));
connect(&cap_file_, SIGNAL(captureFileRetapFinished()),
this, SLOT(retapFinished()));
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)),
this, SLOT(captureEvent(CaptureEvent *)));
setDisplayFilter();
QTimer::singleShot(0, this, SLOT(retapPackets()));
}
@ -167,15 +164,23 @@ void ExpertInfoDialog::retapPackets()
cap_file_.retapPackets();
}
void ExpertInfoDialog::retapStarted()
void ExpertInfoDialog::captureEvent(CaptureEvent *e)
{
ui->limitCheckBox->setEnabled(false);
ui->groupBySummaryCheckBox->setEnabled(false);
}
void ExpertInfoDialog::retapFinished()
{
updateWidgets();
if (e->captureContext() == CaptureEvent::Retap)
{
switch (e->eventType())
{
case CaptureEvent::Started:
ui->limitCheckBox->setEnabled(false);
ui->groupBySummaryCheckBox->setEnabled(false);
break;
case CaptureEvent::Finished:
updateWidgets();
break;
default:
break;
}
}
}
void ExpertInfoDialog::updateWidgets()

View File

@ -66,8 +66,7 @@ private:
private slots:
void retapPackets();
void retapStarted();
void retapFinished();
void captureEvent(CaptureEvent *e);
void updateWidgets();

View File

@ -409,8 +409,8 @@ Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf) :
this, SLOT(updateWidgets()));
connect(ui->reverseTreeWidget, SIGNAL(itemSelectionChanged()),
this, SLOT(updateWidgets()));
connect(&cap_file_, SIGNAL(captureFileClosing()),
this, SLOT(updateWidgets()));
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)),
this, SLOT(captureEvent(CaptureEvent *)));
updateWidgets();
registerTapListener("IAX2", this, NULL, 0, tapReset, tapPacket, tapDraw);
@ -428,6 +428,15 @@ Iax2AnalysisDialog::~Iax2AnalysisDialog()
delete rev_tempfile_;
}
void Iax2AnalysisDialog::captureEvent(CaptureEvent *e)
{
if ((e->captureContext() == CaptureEvent::File) &&
(e->eventType() == CaptureEvent::Closing))
{
updateWidgets();
}
}
void Iax2AnalysisDialog::updateWidgets()
{
bool enable_tab = false;

View File

@ -67,6 +67,7 @@ signals:
void goToPacket(int packet_num);
protected slots:
void captureEvent(CaptureEvent *e);
virtual void updateWidgets();
private slots:

View File

@ -477,7 +477,8 @@ void IOGraphDialog::createIOGraph(int currentRow)
connect(this, SIGNAL(recalcGraphData(capture_file *, bool)), iog, SLOT(recalcGraphData(capture_file *, bool)));
connect(this, SIGNAL(reloadValueUnitFields()), iog, SLOT(reloadValueUnitField()));
connect(&cap_file_, SIGNAL(captureFileClosing()), iog, SLOT(captureFileClosing()));
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)),
iog, SLOT(captureEvent(CaptureEvent *)));
connect(iog, SIGNAL(requestRetap()), this, SLOT(scheduleRetap()));
connect(iog, SIGNAL(requestRecalc()), this, SLOT(scheduleRecalc()));
connect(iog, SIGNAL(requestReplot()), this, SLOT(scheduleReplot()));
@ -1965,9 +1966,13 @@ void IOGraph::scaleGraphData(DataMap &map, int scalar)
}
}
void IOGraph::captureFileClosing()
void IOGraph::captureEvent(CaptureEvent *e)
{
remove_tap_listener(this);
if ((e->captureContext() == CaptureEvent::File) &&
(e->eventType() == CaptureEvent::Closing))
{
remove_tap_listener(this);
}
}
void IOGraph::reloadValueUnitField()

View File

@ -92,7 +92,7 @@ public:
public slots:
void recalcGraphData(capture_file *cap_file, bool enable_scaling);
void captureFileClosing();
void captureEvent(CaptureEvent *e);
void reloadValueUnitField();
signals:

View File

@ -255,8 +255,8 @@ MulticastStatisticsDialog::MulticastStatisticsDialog(QWidget &parent, CaptureFil
connect(this, SIGNAL(updateFilter(QString)),
this, SLOT(updateMulticastParameters()));
connect(&cap_file_, SIGNAL(captureFileClosing()),
this, SLOT(captureFileClosing()));
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)),
this, SLOT(captureEvent(CaptureEvent *)));
/* Register the tap listener */
register_tap_listener_mcast_stream(tapinfo_);
@ -447,13 +447,17 @@ void MulticastStatisticsDialog::fillTree()
updateWidgets();
}
void MulticastStatisticsDialog::captureFileClosing()
void MulticastStatisticsDialog::captureEvent(CaptureEvent *e)
{
/* Remove the stream tap listener */
remove_tap_listener_mcast_stream(tapinfo_);
if ((e->captureContext() == CaptureEvent::File) &&
(e->eventType() == CaptureEvent::Closing))
{
/* Remove the stream tap listener */
remove_tap_listener_mcast_stream(tapinfo_);
updateWidgets();
WiresharkDialog::captureFileClosing();
updateWidgets();
WiresharkDialog::captureFileClosing();
}
}
// Stat command + args

View File

@ -54,7 +54,7 @@ private slots:
void updateWidgets();
void updateMulticastParameters();
virtual void fillTree();
void captureFileClosing();
void captureEvent(CaptureEvent *e);
};
#endif // MULTICASTSTATISTICSDIALOG_H

View File

@ -425,6 +425,12 @@ RtpAnalysisDialog::~RtpAnalysisDialog()
delete rev_tempfile_;
}
void RtpAnalysisDialog::captureFileClosing()
{
updateWidgets();
WiresharkDialog::captureFileClosing();
}
void RtpAnalysisDialog::updateWidgets()
{
bool enable_tab = false;

View File

@ -62,6 +62,9 @@ public:
signals:
void goToPacket(int packet_num);
protected:
virtual void captureFileClosing();
protected slots:
virtual void updateWidgets();

View File

@ -102,7 +102,6 @@ ShowPacketBytesDialog::ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf) :
connect(save_as_button_, SIGNAL(clicked()), this, SLOT(saveAs()));
connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(helpButton()));
connect(&cap_file_, SIGNAL(captureFileClosing()), this, SLOT(captureFileClosing()));
setStartAndEnd(0, finfo_->length);
updateFieldBytes(true);

View File

@ -89,10 +89,8 @@ TrafficTableDialog::TrafficTableDialog(QWidget &parent, CaptureFile &cf, const c
connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateWidgets()));
connect(ui->trafficTableTabWidget, SIGNAL(currentChanged(int)),
this, SLOT(currentTabChanged()));
connect(&cap_file_, SIGNAL(captureFileRetapStarted()),
this, SLOT(retapStarted()));
connect(&cap_file_, SIGNAL(captureFileRetapFinished()),
this, SLOT(retapFinished()));
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)),
this, SLOT(captureEvent(CaptureEvent *)));
}
TrafficTableDialog::~TrafficTableDialog()
@ -233,14 +231,23 @@ void TrafficTableDialog::on_displayFilterCheckBox_toggled(bool checked)
cap_file_.retapPackets();
}
void TrafficTableDialog::retapStarted()
void TrafficTableDialog::captureEvent(CaptureEvent *e)
{
ui->displayFilterCheckBox->setEnabled(false);
}
if (e->captureContext() == CaptureEvent::Retap)
{
switch (e->eventType())
{
case CaptureEvent::Started:
ui->displayFilterCheckBox->setEnabled(false);
break;
case CaptureEvent::Finished:
ui->displayFilterCheckBox->setEnabled(true);
break;
default:
break;
}
}
void TrafficTableDialog::retapFinished()
{
ui->displayFilterCheckBox->setEnabled(true);
}
void TrafficTableDialog::setTabText(QWidget *tree, const QString &text)

View File

@ -175,8 +175,7 @@ private slots:
void on_displayFilterCheckBox_toggled(bool checked);
void setTabText(QWidget *tree, const QString &text);
void toggleTable();
void retapStarted();
void retapFinished();
void captureEvent(CaptureEvent *e);
void copyAsCsv();
void copyAsYaml();

View File

@ -51,10 +51,8 @@ WiresharkDialog::WiresharkDialog(QWidget &parent, CaptureFile &capture_file) :
setWindowIcon(wsApp->normalIcon());
setWindowTitleFromSubtitle();
connect(&cap_file_, SIGNAL(captureFileRetapStarted()), this, SLOT(beginRetapPackets()));
connect(&cap_file_, SIGNAL(captureFileRetapFinished()), this, SLOT(endRetapPackets()));
connect(&cap_file_, SIGNAL(captureFileClosing()), this, SLOT(captureFileClosing()));
connect(&cap_file_, SIGNAL(captureFileClosed()), this, SLOT(captureFileClosed()));
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)),
this, SLOT(captureEvent(CaptureEvent *)));
}
void WiresharkDialog::accept()
@ -129,6 +127,42 @@ bool WiresharkDialog::registerTapListener(const char *tap_name, void *tap_data,
return true;
}
void WiresharkDialog::captureEvent(CaptureEvent *e)
{
switch (e->captureContext())
{
case CaptureEvent::Retap:
switch (e->eventType())
{
case CaptureEvent::Started:
beginRetapPackets();
break;
case CaptureEvent::Finished:
endRetapPackets();
break;
default:
break;
}
break;
case CaptureEvent::File:
switch (e->eventType())
{
case CaptureEvent::Closing:
captureFileClosing();
break;
case CaptureEvent::Closed:
captureFileClosed();
break;
default:
break;
}
break;
default:
break;
}
}
void WiresharkDialog::endRetapPackets()
{
retap_depth_--;

View File

@ -49,9 +49,6 @@ public:
// XXX Unlike the entire QWidget API, parent is mandatory here.
explicit WiresharkDialog(QWidget &parent, CaptureFile &capture_file);
signals:
public slots:
/**
* @brief Mark the start of a code block that retaps packets. If the user
* closes the dialog while tapping, the dialog will not be destroyed until
@ -128,7 +125,6 @@ protected:
*/
bool dialogClosed() { return dialog_closed_; }
protected slots:
/**
* @brief Called when the capture file is about to close. This can be
* used to enable or disable widgets according to the state of
@ -137,6 +133,9 @@ protected slots:
virtual void captureFileClosing();
virtual void captureFileClosed();
protected slots:
void captureEvent(CaptureEvent *e);
private:
void setWindowTitleFromSubtitle();