Qt: Convert more dialogs to WiresharkDialog.
Make the Sequence, IO Graph, Statistics Tree, and VoIP Calls dialogs subclasses of WiresharkDialog. Remove "Stats Tree" from Statistics Tree dialog titles. Don't complain if the user opens more than one instance of the dialog. Use the applicationName property in WiresharkApplication instead of a separate variable. Add a preexisting item to the IO Graph bug list (hovering when the file is closed clears the graph). Change-Id: I8411a25305d00b16e0d4a82fa50a9bad5c85b239 Reviewed-on: https://code.wireshark.org/review/6125 Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
b6ff338e81
commit
4556498f33
|
@ -140,7 +140,7 @@ struct _stats_tree_cfg {
|
|||
gchar* tapname;
|
||||
register_stat_group_t stat_group;
|
||||
|
||||
gboolean in_use;
|
||||
gboolean in_use; /* GTK+ only */
|
||||
gboolean plugin;
|
||||
|
||||
/** dissector defined callbacks */
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
explicit CaptureFile(QObject *parent = 0, capture_file *cap_file = NULL);
|
||||
~CaptureFile();
|
||||
|
||||
capture_file *capFile() const { return cap_file_; }
|
||||
capture_file *capFile() const { return isValid() ? cap_file_ : NULL; }
|
||||
void setCapFile(capture_file *cap_file) { cap_file_ = cap_file; }
|
||||
/** Check capture file validity
|
||||
*
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
// - We retap and redraw more than we should.
|
||||
// - Smoothing doesn't seem to match GTK+
|
||||
// - We don't register a tap listener ("-z io,stat", bottom of gtk/io_stat.c)
|
||||
// - Hovering over a graph when the file is closed clears the graph.
|
||||
|
||||
// To do:
|
||||
// - Use scroll bars?
|
||||
|
@ -177,10 +178,9 @@ static void io_graph_free_cb(void* p) {
|
|||
|
||||
Q_DECLARE_METATYPE(IOGraph *)
|
||||
|
||||
IOGraphDialog::IOGraphDialog(QWidget *parent, capture_file *cf) :
|
||||
QDialog(parent),
|
||||
IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf) :
|
||||
WiresharkDialog(parent, cf),
|
||||
ui(new Ui::IOGraphDialog),
|
||||
cap_file_(cf),
|
||||
name_line_edit_(NULL),
|
||||
dfilter_line_edit_(NULL),
|
||||
yfield_line_edit_(NULL),
|
||||
|
@ -199,6 +199,7 @@ IOGraphDialog::IOGraphDialog(QWidget *parent, capture_file *cf) :
|
|||
auto_axes_(true)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowSubtitle(tr("IO Graphs"));
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
QCustomPlot *iop = ui->ioPlot;
|
||||
|
||||
|
@ -247,17 +248,10 @@ IOGraphDialog::IOGraphDialog(QWidget *parent, capture_file *cf) :
|
|||
iop->setMouseTracking(true);
|
||||
iop->setEnabled(true);
|
||||
|
||||
QString dlg_title = tr("Wireshark IO Graphs: ");
|
||||
if (cap_file_) {
|
||||
dlg_title += cf_get_display_name(cap_file_);
|
||||
} else {
|
||||
dlg_title += tr("No Capture Data");
|
||||
}
|
||||
setWindowTitle(dlg_title);
|
||||
QCPPlotTitle *title = new QCPPlotTitle(iop);
|
||||
iop->plotLayout()->insertRow(0);
|
||||
iop->plotLayout()->addElement(0, 0, title);
|
||||
title->setText(dlg_title);
|
||||
title->setText(tr("Wireshark IO Graphs: %1").arg(cap_file_.fileTitle()));
|
||||
|
||||
tracer_ = new QCPItemTracer(iop);
|
||||
iop->addItem(tracer_);
|
||||
|
@ -441,11 +435,8 @@ void IOGraphDialog::syncGraphSettings(QTreeWidgetItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
void IOGraphDialog::setCaptureFile(capture_file *cf)
|
||||
void IOGraphDialog::updateWidgets()
|
||||
{
|
||||
if (!cf) { // We only want to know when the file closes.
|
||||
cap_file_ = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void IOGraphDialog::scheduleReplot(bool now)
|
||||
|
@ -826,7 +817,7 @@ void IOGraphDialog::mouseMoved(QMouseEvent *event)
|
|||
if (interval_packet > 0) {
|
||||
packet_num_ = (guint32) interval_packet;
|
||||
msg = tr("%1 %2")
|
||||
.arg(cap_file_ ? tr("Click to select packet") : tr("Packet"))
|
||||
.arg(!file_closed_ ? tr("Click to select packet") : tr("Packet"))
|
||||
.arg(packet_num_);
|
||||
val = " = " + QString::number(tracer_->position->value(), 'g', 4);
|
||||
}
|
||||
|
@ -948,15 +939,15 @@ void IOGraphDialog::updateStatistics()
|
|||
{
|
||||
if (!isVisible()) return;
|
||||
|
||||
if (need_retap_) {
|
||||
if (need_retap_ && !file_closed_) {
|
||||
need_retap_ = false;
|
||||
cf_retap_packets(cap_file_);
|
||||
cap_file_.retapPackets();
|
||||
ui->ioPlot->setFocus();
|
||||
} else {
|
||||
if (need_recalc_) {
|
||||
need_recalc_ = false;
|
||||
need_replot_ = true;
|
||||
emit recalcGraphData(cap_file_);
|
||||
emit recalcGraphData(cap_file_.capFile());
|
||||
if (!tracer_->graph()) {
|
||||
if (base_graph_ && base_graph_->data()->size() > 0) {
|
||||
tracer_->setGraph(base_graph_);
|
||||
|
@ -1431,7 +1422,7 @@ void IOGraphDialog::on_actionMoveDown1_triggered()
|
|||
|
||||
void IOGraphDialog::on_actionGoToPacket_triggered()
|
||||
{
|
||||
if (tracer_->visible() && cap_file_ && packet_num_ > 0) {
|
||||
if (tracer_->visible() && !file_closed_ && packet_num_ > 0) {
|
||||
emit goToPacket(packet_num_);
|
||||
}
|
||||
}
|
||||
|
@ -1477,8 +1468,8 @@ void IOGraphDialog::on_buttonBox_accepted()
|
|||
.arg(jpeg_filter);
|
||||
|
||||
QString save_file = path.canonicalPath();
|
||||
if (cap_file_) {
|
||||
save_file += QString("/%1").arg(cf_get_display_name(cap_file_));
|
||||
if (!file_closed_) {
|
||||
save_file += QString("/%1").arg(cap_file_.fileTitle());
|
||||
}
|
||||
file_name = QFileDialog::getSaveFileName(this, tr("Wireshark: Save Graph As..."),
|
||||
save_file, filter, &extension);
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
#include "ui/io_graph_item.h"
|
||||
|
||||
#include "syntax_line_edit.h"
|
||||
#include "wireshark_dialog.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
#include <QIcon>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
|
@ -127,12 +127,12 @@ namespace Ui {
|
|||
class IOGraphDialog;
|
||||
}
|
||||
|
||||
class IOGraphDialog : public QDialog
|
||||
class IOGraphDialog : public WiresharkDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IOGraphDialog(QWidget *parent = 0, capture_file *cf = NULL);
|
||||
explicit IOGraphDialog(QWidget &parent, CaptureFile &cf);
|
||||
~IOGraphDialog();
|
||||
|
||||
void addGraph(bool checked, QString name, QString dfilter, int color_idx, IOGraph::PlotStyles style,
|
||||
|
@ -142,7 +142,6 @@ public:
|
|||
void syncGraphSettings(QTreeWidgetItem *item);
|
||||
|
||||
public slots:
|
||||
void setCaptureFile(capture_file *cf);
|
||||
void scheduleReplot(bool now = false);
|
||||
void scheduleRecalc(bool now = false);
|
||||
void scheduleRetap(bool now = false);
|
||||
|
@ -159,7 +158,6 @@ signals:
|
|||
private:
|
||||
Ui::IOGraphDialog *ui;
|
||||
|
||||
capture_file *cap_file_;
|
||||
QLineEdit *name_line_edit_;
|
||||
SyntaxLineEdit *dfilter_line_edit_;
|
||||
SyntaxLineEdit *yfield_line_edit_;
|
||||
|
@ -194,6 +192,7 @@ private:
|
|||
void loadProfileGraphs();
|
||||
|
||||
private slots:
|
||||
void updateWidgets();
|
||||
void graphClicked(QMouseEvent *event);
|
||||
void mouseMoved(QMouseEvent *event);
|
||||
void mouseReleased(QMouseEvent *event);
|
||||
|
|
|
@ -2120,11 +2120,9 @@ void MainWindow::on_actionSCTPFilterThisAssociation_triggered()
|
|||
|
||||
void MainWindow::on_actionStatisticsFlowGraph_triggered()
|
||||
{
|
||||
SequenceDialog *sequence_dialog = new SequenceDialog(this, capture_file_.capFile());
|
||||
SequenceDialog *sequence_dialog = new SequenceDialog(*this, capture_file_);
|
||||
connect(sequence_dialog, SIGNAL(goToPacket(int)),
|
||||
packet_list_, SLOT(goToPacket(int)));
|
||||
connect(this, SIGNAL(setCaptureFile(capture_file*)),
|
||||
sequence_dialog, SLOT(setCaptureFile(capture_file*)));
|
||||
sequence_dialog->show();
|
||||
}
|
||||
|
||||
|
@ -2165,11 +2163,9 @@ void MainWindow::on_actionStatisticsTcpStreamWindowScaling_triggered()
|
|||
|
||||
void MainWindow::openStatisticsTreeDialog(const gchar *abbr)
|
||||
{
|
||||
StatsTreeDialog *st_dialog = new StatsTreeDialog(this, capture_file_.capFile(), abbr);
|
||||
StatsTreeDialog *st_dialog = new StatsTreeDialog(*this, capture_file_, abbr);
|
||||
// connect(st_dialog, SIGNAL(goToPacket(int)),
|
||||
// packet_list_, SLOT(goToPacket(int)));
|
||||
connect(this, SIGNAL(setCaptureFile(capture_file*)),
|
||||
st_dialog, SLOT(setCaptureFile(capture_file*)));
|
||||
st_dialog->show();
|
||||
}
|
||||
|
||||
|
@ -2360,10 +2356,8 @@ void MainWindow::statCommandIOGraph(const char *arg, void *userdata)
|
|||
{
|
||||
Q_UNUSED(arg);
|
||||
Q_UNUSED(userdata);
|
||||
IOGraphDialog *iog_dialog = new IOGraphDialog(this, capture_file_.capFile());
|
||||
IOGraphDialog *iog_dialog = new IOGraphDialog(*this, capture_file_);
|
||||
connect(iog_dialog, SIGNAL(goToPacket(int)), packet_list_, SLOT(goToPacket(int)));
|
||||
connect(this, SIGNAL(setCaptureFile(capture_file*)),
|
||||
iog_dialog, SLOT(setCaptureFile(capture_file*)));
|
||||
iog_dialog->show();
|
||||
}
|
||||
|
||||
|
@ -2380,13 +2374,11 @@ void MainWindow::on_actionStatisticsSametime_triggered()
|
|||
|
||||
void MainWindow::openVoipCallsDialog(bool all_flows)
|
||||
{
|
||||
VoipCallsDialog *voip_calls_dialog = new VoipCallsDialog(this, capture_file_.capFile(), all_flows);
|
||||
VoipCallsDialog *voip_calls_dialog = new VoipCallsDialog(*this, capture_file_, all_flows);
|
||||
connect(voip_calls_dialog, SIGNAL(goToPacket(int)),
|
||||
packet_list_, SLOT(goToPacket(int)));
|
||||
connect(voip_calls_dialog, SIGNAL(updateFilter(QString&, bool)),
|
||||
this, SLOT(filterPackets(QString&, bool)));
|
||||
connect(this, SIGNAL(setCaptureFile(capture_file*)),
|
||||
voip_calls_dialog, SLOT(setCaptureFile(capture_file*)));
|
||||
voip_calls_dialog->show();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,9 @@
|
|||
// - Create WSGraph subclasses with common behavior.
|
||||
// - Help button and text
|
||||
|
||||
SequenceDialog::SequenceDialog(QWidget *parent, capture_file *cf, seq_analysis_info_t *sainfo) :
|
||||
QDialog(parent),
|
||||
SequenceDialog::SequenceDialog(QWidget &parent, CaptureFile &cf, seq_analysis_info_t *sainfo) :
|
||||
WiresharkDialog(parent, cf),
|
||||
ui(new Ui::SequenceDialog),
|
||||
cap_file_(cf),
|
||||
sainfo_(sainfo),
|
||||
num_items_(0),
|
||||
packet_num_(0),
|
||||
|
@ -56,6 +55,7 @@ SequenceDialog::SequenceDialog(QWidget *parent, capture_file *cf, seq_analysis_i
|
|||
{
|
||||
ui->setupUi(this);
|
||||
QCustomPlot *sp = ui->sequencePlot;
|
||||
setWindowSubtitle(sainfo ? tr("Call Flow") : tr("Flow"));
|
||||
|
||||
if (!sainfo_) {
|
||||
sainfo_ = sequence_analysis_info_new();
|
||||
|
@ -122,9 +122,7 @@ SequenceDialog::SequenceDialog(QWidget *parent, capture_file *cf, seq_analysis_i
|
|||
save_bt->setText(tr("Save As..."));
|
||||
|
||||
// XXX Use recent settings instead
|
||||
if (parent) {
|
||||
resize(parent->width(), parent->height() * 4 / 5);
|
||||
}
|
||||
resize(parent.width(), parent.height() * 4 / 5);
|
||||
|
||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(hScrollBarChanged(int)));
|
||||
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vScrollBarChanged(int)));
|
||||
|
@ -148,11 +146,8 @@ SequenceDialog::~SequenceDialog()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void SequenceDialog::setCaptureFile(capture_file *cf)
|
||||
void SequenceDialog::updateWidgets()
|
||||
{
|
||||
if (!cf) { // We only want to know when the file closes.
|
||||
cap_file_ = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void SequenceDialog::showEvent(QShowEvent *event)
|
||||
|
@ -315,7 +310,7 @@ void SequenceDialog::on_buttonBox_accepted()
|
|||
.arg(png_filter)
|
||||
.arg(bmp_filter)
|
||||
.arg(jpeg_filter);
|
||||
if (cap_file_) {
|
||||
if (!file_closed_) {
|
||||
filter.append(QString(";;%5").arg(ascii_filter));
|
||||
}
|
||||
|
||||
|
@ -332,8 +327,8 @@ void SequenceDialog::on_buttonBox_accepted()
|
|||
save_ok = ui->sequencePlot->saveBmp(file_name);
|
||||
} else if (extension.compare(jpeg_filter) == 0) {
|
||||
save_ok = ui->sequencePlot->saveJpg(file_name);
|
||||
} else if (extension.compare(ascii_filter) == 0 && cap_file_ && sainfo_) {
|
||||
save_ok = sequence_analysis_dump_to_file(file_name.toUtf8().constData(), sainfo_, cap_file_, 0);
|
||||
} else if (extension.compare(ascii_filter) == 0 && !file_closed_ && sainfo_) {
|
||||
save_ok = sequence_analysis_dump_to_file(file_name.toUtf8().constData(), sainfo_, cap_file_.capFile(), 0);
|
||||
}
|
||||
// else error dialog?
|
||||
if (save_ok) {
|
||||
|
@ -345,7 +340,7 @@ void SequenceDialog::on_buttonBox_accepted()
|
|||
|
||||
void SequenceDialog::fillDiagram()
|
||||
{
|
||||
if (!sainfo_) return;
|
||||
if (!sainfo_ || file_closed_) return;
|
||||
|
||||
QCustomPlot *sp = ui->sequencePlot;
|
||||
|
||||
|
@ -354,7 +349,7 @@ void SequenceDialog::fillDiagram()
|
|||
} else {
|
||||
seq_diagram_->clearData();
|
||||
sequence_analysis_list_free(sainfo_);
|
||||
sequence_analysis_list_get(cap_file_, sainfo_);
|
||||
sequence_analysis_list_get(cap_file_.capFile(), sainfo_);
|
||||
num_items_ = sequence_analysis_get_nodes(sainfo_);
|
||||
seq_diagram_->setData(sainfo_);
|
||||
}
|
||||
|
@ -431,7 +426,7 @@ void SequenceDialog::on_resetButton_clicked()
|
|||
|
||||
void SequenceDialog::on_actionGoToPacket_triggered()
|
||||
{
|
||||
if (cap_file_ && packet_num_ > 0) {
|
||||
if (!file_closed_ && packet_num_ > 0) {
|
||||
emit goToPacket(packet_num_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
#include "ui/tap-sequence-analysis.h"
|
||||
|
||||
#include "qcustomplot.h"
|
||||
#include "wireshark_dialog.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Ui {
|
||||
|
@ -43,20 +43,17 @@ class SequenceDialog;
|
|||
|
||||
class SequenceDiagram;
|
||||
|
||||
class SequenceDialog : public QDialog
|
||||
class SequenceDialog : public WiresharkDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SequenceDialog(QWidget *parent = 0, capture_file *cf = NULL, seq_analysis_info_t *sainfo = NULL);
|
||||
explicit SequenceDialog(QWidget &parent, CaptureFile &cf, seq_analysis_info_t *sainfo = NULL);
|
||||
~SequenceDialog();
|
||||
|
||||
signals:
|
||||
void goToPacket(int packet_num);
|
||||
|
||||
public slots:
|
||||
void setCaptureFile(capture_file *cf);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
@ -64,6 +61,7 @@ protected:
|
|||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
private slots:
|
||||
void updateWidgets();
|
||||
void hScrollBarChanged(int value);
|
||||
void vScrollBarChanged(int value);
|
||||
void xAxisChanged(QCPRange range);
|
||||
|
@ -91,7 +89,6 @@ private slots:
|
|||
private:
|
||||
Ui::SequenceDialog *ui;
|
||||
SequenceDiagram *seq_diagram_;
|
||||
capture_file *cap_file_;
|
||||
seq_analysis_info_t *sainfo_;
|
||||
int num_items_;
|
||||
guint32 packet_num_;
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
<height>568</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Flow</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0,0,0">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
|
@ -46,7 +43,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="hintLabel">
|
||||
<widget class="ElidedLabel" name="hintLabel">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body>
|
||||
|
||||
|
@ -358,6 +355,11 @@
|
|||
<header>qcustomplot.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ElidedLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>elided_label.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
|
|
@ -44,9 +44,7 @@
|
|||
// - Add help
|
||||
// - Update to match bug 9452 / r53657
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
const int item_col_ = 0;
|
||||
const int item_col_ = 0;
|
||||
|
||||
const int expand_all_threshold_ = 100; // Arbitrary
|
||||
|
||||
|
@ -72,15 +70,15 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
StatsTreeDialog::StatsTreeDialog(QWidget *parent, capture_file *cf, const char *cfg_abbr) :
|
||||
QDialog(parent),
|
||||
StatsTreeDialog::StatsTreeDialog(QWidget &parent, CaptureFile &cf, const char *cfg_abbr) :
|
||||
WiresharkDialog(parent, cf),
|
||||
ui(new Ui::StatsTreeDialog),
|
||||
st_(NULL),
|
||||
st_cfg_(NULL),
|
||||
cap_file_(cf)
|
||||
st_cfg_(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
st_cfg_ = stats_tree_get_cfg_by_abbr(cfg_abbr);
|
||||
memset(&cfg_pr_, 0, sizeof(struct _tree_cfg_pres));
|
||||
|
||||
if (!st_cfg_) {
|
||||
QMessageBox::critical(this, tr("Configuration not found"),
|
||||
|
@ -110,35 +108,19 @@ StatsTreeDialog::~StatsTreeDialog()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void StatsTreeDialog::setCaptureFile(capture_file *cf)
|
||||
{
|
||||
if (!cf) { // We only want to know when the file closes.
|
||||
cap_file_ = NULL;
|
||||
ui->displayFilterLineEdit->setEnabled(false);
|
||||
ui->applyFilterButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void StatsTreeDialog::fillTree()
|
||||
{
|
||||
GString *error_string;
|
||||
if (!st_cfg_) return;
|
||||
if (!st_cfg_ || file_closed_) return;
|
||||
|
||||
gchar* display_name_temp = stats_tree_get_displayname(st_cfg_->name);
|
||||
QString display_name(display_name_temp);
|
||||
g_free(display_name_temp);
|
||||
|
||||
setWindowTitle(display_name + tr(" Stats Tree"));
|
||||
// The GTK+ UI appends "Stats Tree" to the window title. If we do the same
|
||||
// here we should expand the name completely, e.g. to "Statistics Tree".
|
||||
setWindowSubtitle(display_name);
|
||||
|
||||
if (!cap_file_) return;
|
||||
|
||||
if (st_cfg_->in_use) {
|
||||
QMessageBox::warning(this, tr("%1 already open").arg(display_name),
|
||||
tr("Each type of tree can only be generated one at time."));
|
||||
reject();
|
||||
}
|
||||
|
||||
st_cfg_->in_use = TRUE;
|
||||
st_cfg_->pr = &cfg_pr_;
|
||||
cfg_pr_.st_dlg = this;
|
||||
|
||||
|
@ -174,13 +156,12 @@ void StatsTreeDialog::fillTree()
|
|||
reject();
|
||||
}
|
||||
|
||||
cf_retap_packets(cap_file_);
|
||||
cf_retap_packets(cap_file_.capFile());
|
||||
drawTreeItems(st_);
|
||||
|
||||
ui->statsTreeWidget->setSortingEnabled(true);
|
||||
remove_tap_listener(st_);
|
||||
|
||||
st_cfg_->in_use = FALSE;
|
||||
st_cfg_->pr = NULL;
|
||||
}
|
||||
|
||||
|
@ -250,6 +231,14 @@ void StatsTreeDialog::drawTreeItems(void *st_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
void StatsTreeDialog::updateWidgets()
|
||||
{
|
||||
if (file_closed_) {
|
||||
ui->displayFilterLineEdit->setEnabled(false);
|
||||
ui->applyFilterButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void StatsTreeDialog::on_applyFilterButton_clicked()
|
||||
{
|
||||
fillTree();
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "epan/stats_tree_priv.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include "wireshark_dialog.h"
|
||||
|
||||
namespace Ui {
|
||||
class StatsTreeDialog;
|
||||
|
@ -41,17 +41,16 @@ struct _tree_cfg_pres {
|
|||
class StatsTreeDialog* st_dlg;
|
||||
};
|
||||
|
||||
class StatsTreeDialog : public QDialog
|
||||
class StatsTreeDialog : public WiresharkDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StatsTreeDialog(QWidget *parent = 0, capture_file *cf = NULL, const char *cfg_abbr = NULL);
|
||||
explicit StatsTreeDialog(QWidget &parent, CaptureFile &cf, const char *cfg_abbr = NULL);
|
||||
~StatsTreeDialog();
|
||||
static void setupNode(stat_node* node);
|
||||
|
||||
public slots:
|
||||
void setCaptureFile(capture_file *cf);
|
||||
|
||||
private:
|
||||
Ui::StatsTreeDialog *ui;
|
||||
|
@ -59,13 +58,13 @@ private:
|
|||
struct _tree_cfg_pres cfg_pr_;
|
||||
stats_tree *st_;
|
||||
stats_tree_cfg *st_cfg_;
|
||||
capture_file *cap_file_;
|
||||
|
||||
void fillTree();
|
||||
static void resetTap(void *st_ptr);
|
||||
static void drawTreeItems(void *st_ptr);
|
||||
|
||||
private slots:
|
||||
void updateWidgets();
|
||||
void on_applyFilterButton_clicked();
|
||||
void on_actionCopyToClipboard_triggered();
|
||||
void on_actionSaveAs_triggered();
|
||||
|
|
|
@ -157,13 +157,13 @@ public:
|
|||
|
||||
};
|
||||
|
||||
VoipCallsDialog::VoipCallsDialog(QWidget *parent, capture_file *cf, bool all_flows) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VoipCallsDialog),
|
||||
cap_file_(cf)
|
||||
VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flows) :
|
||||
WiresharkDialog(parent, cf),
|
||||
ui(new Ui::VoipCallsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->callTreeWidget->sortByColumn(start_time_col_, Qt::AscendingOrder);
|
||||
setWindowSubtitle(all_flows ? tr("SIP Flows") : tr("VoIP Calls"));
|
||||
|
||||
ctx_menu_.addActions(QList<QAction *>() << ui->actionSelect_All);
|
||||
|
||||
|
@ -173,9 +173,7 @@ VoipCallsDialog::VoipCallsDialog(QWidget *parent, capture_file *cf, bool all_flo
|
|||
player_button_->setIcon(StockIcon("media-playback-start"));
|
||||
|
||||
// XXX Use recent settings instead
|
||||
if (parent) {
|
||||
resize(parent->width() * 4 / 5, parent->height() * 2 / 3);
|
||||
}
|
||||
resize(parent.width() * 4 / 5, parent.height() * 2 / 3);
|
||||
|
||||
memset (&tapinfo_, 0, sizeof(tapinfo_));
|
||||
tapinfo_.tap_packet = tapPacket;
|
||||
|
@ -191,10 +189,8 @@ VoipCallsDialog::VoipCallsDialog(QWidget *parent, capture_file *cf, bool all_flo
|
|||
|
||||
updateWidgets();
|
||||
|
||||
if (cap_file_) {
|
||||
tapinfo_.session = cap_file_->epan;
|
||||
cf_retap_packets(cap_file_);
|
||||
}
|
||||
tapinfo_.session = cap_file_.capFile()->epan;
|
||||
cap_file_.retapPackets();
|
||||
}
|
||||
|
||||
VoipCallsDialog::~VoipCallsDialog()
|
||||
|
@ -205,15 +201,11 @@ VoipCallsDialog::~VoipCallsDialog()
|
|||
sequence_analysis_info_free(tapinfo_.graph_analysis);
|
||||
}
|
||||
|
||||
void VoipCallsDialog::setCaptureFile(capture_file *cf)
|
||||
void VoipCallsDialog::captureFileClosing()
|
||||
{
|
||||
if (!cf) { // We only want to know when the file closes.
|
||||
voip_calls_remove_all_tap_listeners(&tapinfo_);
|
||||
cap_file_ = NULL;
|
||||
tapinfo_.session = NULL;
|
||||
}
|
||||
emit captureFileChanged(cap_file_);
|
||||
updateWidgets();
|
||||
voip_calls_remove_all_tap_listeners(&tapinfo_);
|
||||
tapinfo_.session = NULL;
|
||||
WiresharkDialog::captureFileClosing();
|
||||
}
|
||||
|
||||
void VoipCallsDialog::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
@ -436,7 +428,7 @@ void VoipCallsDialog::prepareFilter()
|
|||
|
||||
void VoipCallsDialog::showSequence()
|
||||
{
|
||||
if (!cap_file_) return;
|
||||
if (file_closed_) return;
|
||||
|
||||
QSet<guint16> selected_calls;
|
||||
foreach (QTreeWidgetItem *ti, ui->callTreeWidget->selectedItems()) {
|
||||
|
@ -452,12 +444,10 @@ void VoipCallsDialog::showSequence()
|
|||
cur_ga_item = g_list_next(cur_ga_item);
|
||||
}
|
||||
|
||||
SequenceDialog *sequence_dialog = new SequenceDialog(this, cap_file_, tapinfo_.graph_analysis);
|
||||
SequenceDialog *sequence_dialog = new SequenceDialog(*parentWidget(), cap_file_, tapinfo_.graph_analysis);
|
||||
// XXX This goes away when we close the VoIP Calls dialog.
|
||||
connect(sequence_dialog, SIGNAL(goToPacket(int)),
|
||||
this, SIGNAL(goToPacket(int)));
|
||||
connect(this, SIGNAL(captureFileChanged(capture_file*)),
|
||||
sequence_dialog, SLOT(setCaptureFile(capture_file*)));
|
||||
sequence_dialog->show();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
|
||||
#include "ui/voip_calls.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include "wireshark_dialog.h"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
class QAbstractButton;
|
||||
|
@ -41,16 +42,15 @@ class VoipCallsDialog;
|
|||
}
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class VoipCallsDialog : public QDialog
|
||||
class VoipCallsDialog : public WiresharkDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VoipCallsDialog(QWidget *parent = 0, capture_file *cf = NULL, bool all_flows = false);
|
||||
explicit VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flows = false);
|
||||
~VoipCallsDialog();
|
||||
|
||||
public slots:
|
||||
void setCaptureFile(capture_file *cf);
|
||||
|
||||
signals:
|
||||
void updateFilter(QString &filter, bool force = false);
|
||||
|
@ -66,7 +66,6 @@ protected slots:
|
|||
private:
|
||||
Ui::VoipCallsDialog *ui;
|
||||
|
||||
capture_file *cap_file_;
|
||||
voip_calls_tapinfo_t tapinfo_;
|
||||
QPushButton *prepare_button_;
|
||||
QPushButton *sequence_button_;
|
||||
|
@ -84,6 +83,7 @@ private:
|
|||
void showSequence();
|
||||
|
||||
private slots:
|
||||
void captureFileClosing();
|
||||
void on_callTreeWidget_itemActivated(QTreeWidgetItem *item, int);
|
||||
void on_callTreeWidget_itemSelectionChanged();
|
||||
void on_actionSelect_All_triggered();
|
||||
|
|
|
@ -82,7 +82,6 @@ static char *last_open_dir = NULL;
|
|||
static bool updated_last_open_dir = FALSE;
|
||||
static QList<recent_item_status *> recent_items_;
|
||||
|
||||
QString WiresharkApplication::application_name_ = QString("Wireshark");
|
||||
QString WiresharkApplication::window_title_separator_ = QString::fromUtf8(" " UTF8_MIDDLE_DOT " ");
|
||||
|
||||
void
|
||||
|
@ -382,7 +381,7 @@ const QString WiresharkApplication::windowTitleString(QStringList title_parts)
|
|||
QString ti = tii.next();
|
||||
if (ti.isEmpty()) tii.remove();
|
||||
}
|
||||
title_parts.prepend(application_name_);
|
||||
title_parts.prepend(applicationName());
|
||||
return title_parts.join(window_title_separator_);
|
||||
}
|
||||
|
||||
|
@ -478,6 +477,7 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
|
|||
initialized_(false)
|
||||
{
|
||||
wsApp = this;
|
||||
setApplicationName("Wireshark");
|
||||
|
||||
Q_INIT_RESOURCE(about);
|
||||
Q_INIT_RESOURCE(display_filter);
|
||||
|
|
|
@ -93,7 +93,6 @@ public:
|
|||
bool isInitialized() { return initialized_; }
|
||||
const QIcon &normalIcon() const { return normal_icon_; }
|
||||
const QIcon &captureIcon() const { return capture_icon_; }
|
||||
const QString &applicationName() const { return application_name_; }
|
||||
const QString &windowTitleSeparator() const { return window_title_separator_; }
|
||||
const QString windowTitleString(QStringList title_parts);
|
||||
const QString windowTitleString(QString title_part) { return windowTitleString(QStringList() << title_part); }
|
||||
|
@ -112,7 +111,6 @@ private:
|
|||
QSocketNotifier *if_notifier_;
|
||||
QIcon normal_icon_;
|
||||
QIcon capture_icon_;
|
||||
static QString application_name_;
|
||||
static QString window_title_separator_;
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue