Qt: Protect against unintentional "no capture file" window status

If capture file was closed and we have some WiresharkDialogs opened,
then we still need to know filename of capture file
related to specific dialog.

Change-Id: I15f0e5176b87713bf747eead64021619d0bdf039
Reviewed-on: https://code.wireshark.org/review/11025
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Michal Labedzki 2015-09-25 11:05:45 +02:00 committed by Gerald Combs
parent 08e44b8b43
commit 78978ec63f
19 changed files with 45 additions and 6 deletions

View File

@ -84,9 +84,8 @@ const QString CaptureFile::fileName()
if (isValid()) {
QFileInfo cfi(QString::fromUtf8(cap_file_->filename));
file_name_ = cfi.baseName();
} else {
file_name_ = no_capture_file_;
}
return file_name_;
}

View File

@ -103,6 +103,8 @@ void CaptureFilePropertiesDialog::updateWidgets()
fillDetails();
ui->commentsTextEdit->setText(cf_read_shb_comment(cap_file_.capFile()));
WiresharkDialog::updateWidgets();
}
static const QString section_tmpl_ = "<p><strong>%1</strong></p>\n";

View File

@ -200,6 +200,8 @@ void FollowStreamDialog::updateWidgets(bool follow_in_progress)
ui->leFind->setEnabled(enable);
ui->bFind->setEnabled(enable);
b_filter_out_->setEnabled(enable);
WiresharkDialog::updateWidgets();
}
void FollowStreamDialog::findText(bool go_back)

View File

@ -333,6 +333,8 @@ void GsmMapSummaryDialog::updateWidgets()
// }
ui->summaryTextEdit->setHtml(summaryToHtml());
WiresharkDialog::updateWidgets();
}
extern "C" {

View File

@ -460,6 +460,8 @@ void Iax2AnalysisDialog::updateWidgets()
hint.prepend("<small><i>");
hint.append("</i></small>");
ui->hintLabel->setText(hint);
WiresharkDialog::updateWidgets();
}
void Iax2AnalysisDialog::on_actionGoToPacket_triggered()

View File

@ -441,6 +441,7 @@ void IOGraphDialog::syncGraphSettings(QTreeWidgetItem *item)
void IOGraphDialog::updateWidgets()
{
WiresharkDialog::updateWidgets();
}
void IOGraphDialog::scheduleReplot(bool now)

View File

@ -831,6 +831,8 @@ void LteMacStatisticsDialog::captureFileClosing()
{
remove_tap_listener(this);
updateWidgets();
WiresharkDialog::captureFileClosing();
}
// Stat command + args

View File

@ -895,6 +895,8 @@ void LteRlcStatisticsDialog::captureFileClosing()
{
remove_tap_listener(this);
updateWidgets();
WiresharkDialog::captureFileClosing();
}
// Launch a UL graph for the currently-selected channel.

View File

@ -293,6 +293,8 @@ QString Mtp3SummaryDialog::summaryToHtml()
void Mtp3SummaryDialog::updateWidgets()
{
ui->summaryTextEdit->setHtml(summaryToHtml());
WiresharkDialog::updateWidgets();
}
extern "C" {

View File

@ -449,6 +449,7 @@ void MulticastStatisticsDialog::captureFileClosing()
remove_tap_listener_mcast_stream(tapinfo_);
updateWidgets();
WiresharkDialog::captureFileClosing();
}
// Stat command + args

View File

@ -304,6 +304,8 @@ void ProtocolHierarchyDialog::updateWidgets()
}
hint += "</i></small>";
ui->hintLabel->setText(hint);
WiresharkDialog::updateWidgets();
}
QList<QVariant> ProtocolHierarchyDialog::protoHierRowData(QTreeWidgetItem *item) const

View File

@ -449,6 +449,8 @@ void RtpAnalysisDialog::updateWidgets()
hint.prepend("<small><i>");
hint.append("</i></small>");
ui->hintLabel->setText(hint);
WiresharkDialog::updateWidgets();
}
void RtpAnalysisDialog::on_actionGoToPacket_triggered()

View File

@ -418,6 +418,8 @@ void RtpStreamDialog::updateWidgets()
ui->actionCopyAsCsv->setEnabled(has_data);
ui->actionCopyAsYaml->setEnabled(has_data);
ui->actionAnalyze->setEnabled(selected);
WiresharkDialog::updateWidgets();
}
QList<QVariant> RtpStreamDialog::streamRowData(int row) const

View File

@ -150,6 +150,7 @@ SequenceDialog::~SequenceDialog()
void SequenceDialog::updateWidgets()
{
WiresharkDialog::updateWidgets();
}
void SequenceDialog::showEvent(QShowEvent *)

View File

@ -512,6 +512,8 @@ void TapParameterDialog::updateWidgets()
}
ui->displayFilterLineEdit->setEnabled(edit_enable);
ui->applyFilterButton->setEnabled(apply_enable);
WiresharkDialog::updateWidgets();
}
void TapParameterDialog::on_applyFilterButton_clicked()

View File

@ -86,7 +86,6 @@ TrafficTableDialog::TrafficTableDialog(QWidget &parent, CaptureFile &cf, const c
connect(ui->trafficTableTabWidget, SIGNAL(currentChanged(int)),
this, SLOT(itemSelectionChanged()));
connect(&cap_file_, SIGNAL(captureFileClosing()), this, SLOT(captureFileClosing()));
}
TrafficTableDialog::~TrafficTableDialog()
@ -224,6 +223,8 @@ void TrafficTableDialog::updateWidgets()
}
ui->trafficTableTabWidget->setCurrentWidget(cur_w);
ui->trafficTableTabWidget->setUpdatesEnabled(true);
WiresharkDialog::updateWidgets();
}
QList<QVariant> TrafficTableDialog::curTreeRowData(int row) const

View File

@ -52,7 +52,7 @@ WiresharkDialog::WiresharkDialog(QWidget &, CaptureFile &capture_file) :
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(captureFileClosing()));
connect(&cap_file_, SIGNAL(captureFileClosed()), this, SLOT(captureFileClosed()));
}
void WiresharkDialog::accept()
@ -142,12 +142,23 @@ void WiresharkDialog::removeTapListeners()
void WiresharkDialog::captureFileClosing()
{
if (file_closed_)
return;
removeTapListeners();
file_closed_ = true;
setWindowTitleFromSubtitle();
updateWidgets();
}
void WiresharkDialog::captureFileClosed()
{
if (file_closed_)
return;
removeTapListeners();
updateWidgets();
file_closed_ = true;
}
/*
* Editor modelines
*

View File

@ -130,6 +130,7 @@ protected slots:
* file_closed_.
*/
virtual void captureFileClosing();
virtual void captureFileClosed();
private:
void setWindowTitleFromSubtitle();

View File

@ -639,6 +639,8 @@ void WlanStatisticsDialog::captureFileClosing()
{
remove_tap_listener(this);
updateWidgets();
WiresharkDialog::captureFileClosing();
}
// Stat command + args