diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/capture_file.cpp | 7 | ||||
-rw-r--r-- | ui/qt/capture_file.h | 7 | ||||
-rw-r--r-- | ui/qt/io_graph_dialog.cpp | 5 | ||||
-rw-r--r-- | ui/qt/main_window.cpp | 3 | ||||
-rw-r--r-- | ui/qt/main_window.h | 1 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 9 | ||||
-rw-r--r-- | ui/qt/progress_bar.cpp | 5 | ||||
-rw-r--r-- | ui/qt/progress_bar.h | 1 |
8 files changed, 37 insertions, 1 deletions
diff --git a/ui/qt/capture_file.cpp b/ui/qt/capture_file.cpp index 524e7145d3..8b2aacb20d 100644 --- a/ui/qt/capture_file.cpp +++ b/ui/qt/capture_file.cpp @@ -41,6 +41,8 @@ capture_file cfile; // - Add getters and (if needed) setters: // - Full filename // - Capture state (stopped, prepared, running). +// - Call common_create_progress_dlg. This would let us manage the stop +// flag here as well as emit progress signals. QString CaptureFile::no_capture_file_ = QObject::tr("[no capture file]"); @@ -83,6 +85,11 @@ void CaptureFile::retapPackets() } } +void CaptureFile::stopTapping() +{ + emit setCaptureStopFlag(true); +} + capture_file *CaptureFile::globalCapFile() { return &cfile; diff --git a/ui/qt/capture_file.h b/ui/qt/capture_file.h index 0bf87b5bb0..ea38d102c3 100644 --- a/ui/qt/capture_file.h +++ b/ui/qt/capture_file.h @@ -65,6 +65,11 @@ public: */ void retapPackets(); + /** Cancel any tapping that might be in progress. + */ + void stopTapping(); + + // XXX This shouldn't be needed. static capture_file *globalCapFile(); @@ -87,6 +92,8 @@ signals: void captureCaptureStopping(capture_session *cap_session); void captureCaptureFailed(capture_session *cap_session); + void setCaptureStopFlag(bool); + public slots: private: diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp index 06096ec840..fb7c65a16b 100644 --- a/ui/qt/io_graph_dialog.cpp +++ b/ui/qt/io_graph_dialog.cpp @@ -314,11 +314,13 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf) : IOGraphDialog::~IOGraphDialog() { + cap_file_.stopTapping(); for (int i = 0; i < ui->graphTreeWidget->topLevelItemCount(); i++) { IOGraph *iog = qvariant_cast<IOGraph *>(ui->graphTreeWidget->topLevelItem(i)->data(name_col_, Qt::UserRole)); delete iog; } delete ui; + ui = NULL; } void IOGraphDialog::addGraph(bool checked, QString name, QString dfilter, int color_idx, IOGraph::PlotStyles style, io_graph_item_unit_t value_units, QString yfield, int moving_average) @@ -953,7 +955,8 @@ void IOGraphDialog::updateStatistics() if (need_retap_ && !file_closed_) { need_retap_ = false; cap_file_.retapPackets(); - ui->ioPlot->setFocus(); + // The user might have closed the window while tapping, which means + // we might no longer exist. } else { if (need_recalc_ && !file_closed_) { need_recalc_ = false; diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 9f32f410bb..3d4702f67a 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -321,6 +321,9 @@ MainWindow::MainWindow(QWidget *parent) : connect(&capture_file_, SIGNAL(captureFileClosed()), this, SLOT(captureFileClosed())); + connect(&capture_file_, SIGNAL(setCaptureStopFlag(bool)), + this, SLOT(setCaptureStopFlag(bool))); + connect(&capture_file_, SIGNAL(captureFileReadStarted()), wsApp, SLOT(captureFileReadStarted())); connect(&capture_file_, SIGNAL(captureFileReadFinished()), diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 1d379079ce..eab44a4e57 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -193,6 +193,7 @@ public slots: // in main_window_slots.cpp void openCaptureFile(QString& cf_path = *new QString(), QString& display_filter = *new QString(), unsigned int type = WTAP_TYPE_AUTO); void filterPackets(QString& new_filter = *new QString(), bool force = false); + void setCaptureStopFlag(bool stop_flag = true); void updateForUnsavedChanges(); void layoutPanes(); void applyRecentPaneGeometry(); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 354f0b8dce..22a94563ee 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -255,6 +255,15 @@ void MainWindow::filterPackets(QString& new_filter, bool force) } } +// XXX We should probably call common_create_progress_dlg in CaptureFile and +// have it handle emitting progress signals and the stop flag. +void MainWindow::setCaptureStopFlag(bool stop_flag) +{ + ProgressBar *progress_bar = main_ui_->statusBar->findChild<ProgressBar *>(); + + if (progress_bar) progress_bar->setStopFlag(stop_flag); +} + // A new layout should be applied when it differs from the old layout AND // at the following times: // - At startup diff --git a/ui/qt/progress_bar.cpp b/ui/qt/progress_bar.cpp index 7c36c1977e..b0c237ab54 100644 --- a/ui/qt/progress_bar.cpp +++ b/ui/qt/progress_bar.cpp @@ -184,6 +184,11 @@ progdlg_t * ProgressBar::show(bool animate, bool terminate_is_stop, gboolean *st return &progress_dialog_; } +void ProgressBar::setStopFlag(bool stop_flag) +{ + if (stop_flag_) *stop_flag_ = stop_flag; +} + #ifdef QWINTASKBARPROGRESS_H void ProgressBar::hide() { diff --git a/ui/qt/progress_bar.h b/ui/qt/progress_bar.h index aed68bd904..2f83c39718 100644 --- a/ui/qt/progress_bar.h +++ b/ui/qt/progress_bar.h @@ -51,6 +51,7 @@ public: #ifdef QWINTASKBARPROGRESS_H void hide(); #endif + void setStopFlag(bool stop_flag); private: progdlg_t progress_dialog_; |