Apply new CaptureEvents to statistics dialogs.
authorMichael Mann <mmann78@netscape.net>
Wed, 27 Dec 2017 00:42:08 +0000 (19:42 -0500)
committerRoland Knall <rknall@gmail.com>
Wed, 27 Dec 2017 08:08:10 +0000 (08:08 +0000)
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>
15 files changed:
ui/qt/expert_info_dialog.cpp
ui/qt/expert_info_dialog.h
ui/qt/iax2_analysis_dialog.cpp
ui/qt/iax2_analysis_dialog.h
ui/qt/io_graph_dialog.cpp
ui/qt/io_graph_dialog.h
ui/qt/multicast_statistics_dialog.cpp
ui/qt/multicast_statistics_dialog.h
ui/qt/rtp_analysis_dialog.cpp
ui/qt/rtp_analysis_dialog.h
ui/qt/show_packet_bytes_dialog.cpp
ui/qt/traffic_table_dialog.cpp
ui/qt/traffic_table_dialog.h
ui/qt/wireshark_dialog.cpp
ui/qt/wireshark_dialog.h

index 863892d7095e242b226a690b9f81b4b94cd04261..eaf7cb7370f6a5afcfe253de9fbb13062eaebae8 100644 (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()
-{
-    ui->limitCheckBox->setEnabled(false);
-    ui->groupBySummaryCheckBox->setEnabled(false);
-}
-
-void ExpertInfoDialog::retapFinished()
+void ExpertInfoDialog::captureEvent(CaptureEvent *e)
 {
-    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()
index e3fa1b58702ec8fe4873d04969d341b9613cdbc4..50901ea1ddcc1e14db1a0a4145f1960db254485f 100644 (file)
@@ -66,8 +66,7 @@ private:
 
 private slots:
     void retapPackets();
-    void retapStarted();
-    void retapFinished();
+    void captureEvent(CaptureEvent *e);
 
     void updateWidgets();
 
index 2958ad95abfc08c271131d753e39068fea5aeb0a..382bb3085caa56669d77467a6b9d0682f45f4dd2 100644 (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;
index 59e1bfad606fbab22e2d229ce8540244a70aa3b2..9e4c87d2a0e8ecfd03d91091d9f42e6535c0304e 100644 (file)
@@ -67,6 +67,7 @@ signals:
     void goToPacket(int packet_num);
 
 protected slots:
+    void captureEvent(CaptureEvent *e);
     virtual void updateWidgets();
 
 private slots:
index 0a69f9c54127f8d83442f36e4ff01a0ee252ac5a..2829220d1cd3fcbf262141670276243f47af6abb 100644 (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()
index 899d99a0e478b1803b2f664b1359968b832ef6c9..a519d49dccf9ab883b170012eb509f7a09bfdb6d 100644 (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:
index 9cea63db8a75e36ad71f21fde20d6ee78ad7ebce..6d89f9ca0083ea49554def09080aead0663deb91 100644 (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
index 530761d163c559525092ba82450a8da67b87cc1b..90bb7ab19672a22ccc219ee41e5501880c8a5caa 100644 (file)
@@ -54,7 +54,7 @@ private slots:
     void updateWidgets();
     void updateMulticastParameters();
     virtual void fillTree();
-    void captureFileClosing();
+    void captureEvent(CaptureEvent *e);
 };
 
 #endif // MULTICASTSTATISTICSDIALOG_H
index bdc8c4417923015d0d5e5d285fff48218fe65e17..9647ccf89131134d0403f733edad517ca81a3529 100644 (file)
@@ -425,6 +425,12 @@ RtpAnalysisDialog::~RtpAnalysisDialog()
     delete rev_tempfile_;
 }
 
+void RtpAnalysisDialog::captureFileClosing()
+{
+    updateWidgets();
+    WiresharkDialog::captureFileClosing();
+}
+
 void RtpAnalysisDialog::updateWidgets()
 {
     bool enable_tab = false;
index 0251281294e780842893a1205b0a9ac92c38ad92..171ee481061accd03e044e52b529bcd24b19e1cd 100644 (file)
@@ -62,6 +62,9 @@ public:
 signals:
     void goToPacket(int packet_num);
 
+protected:
+    virtual void captureFileClosing();
+
 protected slots:
     virtual void updateWidgets();
 
index 405e08774a1a059f66a1d863cf36e484f901a381..f4ed28d7397421d4a915eb925f37c45f4cfb970c 100644 (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);
index 3b836250b10b86b20834ca99a45ee68b11972689..922870b52b9f646a9f68219c39dd03419c23b525 100644 (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)
index e650d53ec12a5b2e1d386fe6d36ea7713ba95dc8..adf5c602ad6f4fb0e4c43072af31a3354b795d40 100644 (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();
index 1eea7f335bfa9b1c19345e9bd40d8b1700ceddce..6e0beb412efbfa627fa393ea72635968b609f867 100644 (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_--;
index d9482c76060ca33191c6c7b8bc0a426ffab243f3..d230a85c70df8814e2a2ce03dd640957ec816b33 100644 (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();