Telecom dialogs: Fixed issues during capture file closing

When capture file is closing/closed, dialogs do not disable buttons which
can't work without capture file. Patch fixes it.
This commit is contained in:
Jirka Novak 2021-01-06 23:49:36 +01:00 committed by AndersBroman
parent 55075f6e8d
commit 1d43b2a3aa
5 changed files with 38 additions and 15 deletions

View File

@ -376,8 +376,6 @@ RtpAnalysisDialog::RtpAnalysisDialog(QWidget &parent, CaptureFile &cf, rtpstream
this, SLOT(updateWidgets()));
connect(ui->reverseTreeWidget, SIGNAL(itemSelectionChanged()),
this, SLOT(updateWidgets()));
connect(&cap_file_, SIGNAL(captureFileClosing()),
this, SLOT(updateWidgets()));
updateWidgets();
updateStatistics();
@ -393,9 +391,9 @@ RtpAnalysisDialog::~RtpAnalysisDialog()
delete rev_tempfile_;
}
// TODO: Can be removed if not used to fix issue with disabling buttons
void RtpAnalysisDialog::captureFileClosing()
{
updateWidgets();
WiresharkDialog::captureFileClosing();
}
@ -428,8 +426,8 @@ void RtpAnalysisDialog::updateWidgets()
hint.append(tr(" G: Go to packet, N: Next problem packet"));
}
bool enable_save_fwd_audio = fwd_statinfo_.rtp_stats.total_nr && (save_payload_error_ == TAP_RTP_NO_ERROR);
bool enable_save_rev_audio = rev_statinfo_.rtp_stats.total_nr && (save_payload_error_ == TAP_RTP_NO_ERROR);
bool enable_save_fwd_audio = fwd_statinfo_.rtp_stats.total_nr && (save_payload_error_ == TAP_RTP_NO_ERROR) && !file_closed_;
bool enable_save_rev_audio = rev_statinfo_.rtp_stats.total_nr && (save_payload_error_ == TAP_RTP_NO_ERROR) && !file_closed_;
ui->actionSaveAudioUnsync->setEnabled(enable_save_fwd_audio && enable_save_rev_audio);
ui->actionSaveForwardAudioUnsync->setEnabled(enable_save_fwd_audio);
ui->actionSaveReverseAudioUnsync->setEnabled(enable_save_rev_audio);
@ -447,7 +445,7 @@ void RtpAnalysisDialog::updateWidgets()
ui->actionSaveReverseCsv->setEnabled(enable_save_rev_csv);
#if defined(QT_MULTIMEDIA_LIB)
player_button_->setEnabled(num_streams_ > 0);
player_button_->setEnabled(num_streams_ > 0 && !file_closed_);
#else
player_button_->setEnabled(false);
player_button_->setText(tr("No Audio"));

View File

@ -487,7 +487,7 @@ void RtpStreamDialog::updateWidgets()
prepare_button_->setEnabled(enable);
export_button_->setEnabled(enable);
copy_button_->setEnabled(has_data);
analyze_button_->setEnabled(selected);
analyze_button_->setEnabled(enable);
ui->actionFindReverse->setEnabled(enable);
ui->actionGoToSetup->setEnabled(enable);
@ -496,10 +496,10 @@ void RtpStreamDialog::updateWidgets()
ui->actionExportAsRtpDump->setEnabled(enable);
ui->actionCopyAsCsv->setEnabled(has_data);
ui->actionCopyAsYaml->setEnabled(has_data);
ui->actionAnalyze->setEnabled(selected);
ui->actionAnalyze->setEnabled(enable);
#if defined(QT_MULTIMEDIA_LIB)
player_button_->setEnabled(selected);
player_button_->setEnabled(enable);
#else
player_button_->setEnabled(false);
player_button_->setText(tr("No Audio"));
@ -543,12 +543,21 @@ QList<QVariant> RtpStreamDialog::streamRowData(int row) const
void RtpStreamDialog::captureFileClosing()
{
ui->todCheckBox->setEnabled(false);
ui->displayFilterCheckBox->setEnabled(false);
remove_tap_listener_rtpstream(&tapinfo_);
WiresharkDialog::captureFileClosing();
}
void RtpStreamDialog::showStreamMenu(QPoint pos)
{
ui->actionGoToSetup->setEnabled(!file_closed_);
ui->actionMarkPackets->setEnabled(!file_closed_);
ui->actionPrepareFilter->setEnabled(!file_closed_);
ui->actionExportAsRtpDump->setEnabled(!file_closed_);
ui->actionAnalyze->setEnabled(!file_closed_);
ctx_menu_.popup(ui->streamTreeWidget->viewport()->mapToGlobal(pos));
}

View File

@ -335,8 +335,8 @@ void SequenceDialog::diagramClicked(QMouseEvent *event)
ui->actionDeselectRtpStream->setEnabled(false);
if (sai) {
if (GA_INFO_TYPE_RTP == sai->info_type) {
ui->actionSelectRtpStream->setEnabled(true);
ui->actionDeselectRtpStream->setEnabled(true);
ui->actionSelectRtpStream->setEnabled(true && !file_closed_);
ui->actionDeselectRtpStream->setEnabled(true && !file_closed_);
current_rtp_sai_ = sai;
}
}

View File

@ -142,11 +142,13 @@ void VoipCallsDialog::captureFileClosing()
// the cache is active, the ToD cannot be modified.
ui->todCheckBox->setEnabled(false);
cache_model_->setSourceModel(NULL);
ui->displayFilterCheckBox->setEnabled(false);
if (!voip_calls_tap_listeners_removed_) {
voip_calls_remove_all_tap_listeners(&tapinfo_);
voip_calls_tap_listeners_removed_ = true;
}
tapinfo_.session = NULL;
WiresharkDialog::captureFileClosing();
}
@ -158,13 +160,17 @@ void VoipCallsDialog::contextMenuEvent(QContextMenuEvent *event)
return;
QMenu popupMenu;
QAction *action;
QAction * action = popupMenu.addAction(tr("Select &All"), this, SLOT(selectAll()));
action = popupMenu.addAction(tr("Select &All"), this, SLOT(selectAll()));
action->setToolTip(tr("Select all calls"));
action = popupMenu.addAction(tr("Select &None"), this, SLOT(selectNone()));
action->setToolTip(tr("Clear selection"));
popupMenu.addSeparator();
action = popupMenu.addAction(tr("Display time as time of day"), this, SLOT(switchTimeOfDay()));
action->setCheckable(true);
action->setChecked(call_infos_model_->timeOfDay());
action->setEnabled(!file_closed_);
popupMenu.addSeparator();
action = popupMenu.addAction(tr("Copy as CSV"), this, SLOT(copyAsCSV()));
action->setToolTip(tr("Copy stream list as CSV."));
@ -324,14 +330,18 @@ void VoipCallsDialog::updateWidgets()
have_ga_items = true;
}
prepare_button_->setEnabled(selected && have_ga_items);
sequence_button_->setEnabled(selected && have_ga_items);
bool enable = selected && have_ga_items && !file_closed_;
prepare_button_->setEnabled(enable);
sequence_button_->setEnabled(enable);
#if defined(QT_MULTIMEDIA_LIB)
player_button_->setEnabled(selected && have_ga_items);
player_button_->setEnabled(enable);
#else
player_button_->setEnabled(false);
player_button_->setText(tr("No Audio"));
#endif
WiresharkDialog::updateWidgets();
}
void VoipCallsDialog::prepareFilter()
@ -557,6 +567,11 @@ void VoipCallsDialog::selectAll()
ui->callTreeView->selectAll();
}
void VoipCallsDialog::selectNone()
{
ui->callTreeView->clearSelection();
}
void VoipCallsDialog::copyAsCSV()
{
QString csv;

View File

@ -92,6 +92,7 @@ private:
private slots:
void captureFileClosing();
void selectAll();
void selectNone();
void copyAsCSV();
void copyAsYAML();
void switchTimeOfDay();