summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorIrene RĂ¼ngeler <I.Ruengeler@fh-muenster.de>2013-12-17 09:51:34 +0000
committerIrene RĂ¼ngeler <I.Ruengeler@fh-muenster.de>2013-12-17 09:51:34 +0000
commit7eb50571f4fd69c7ce0ad3c39e193ad36bbcc437 (patch)
tree895e7f3388552784bec08e07ce82c9eca28d6828 /ui
parent25a74d3f2aaff7c0273d66c0313ed172d3f37662 (diff)
downloadwireshark-7eb50571f4fd69c7ce0ad3c39e193ad36bbcc437.tar.gz
Find the right frame when plottable was clicked.
svn path=/trunk/; revision=54167
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/sctp_assoc_analyse_dialog.cpp3
-rw-r--r--ui/qt/sctp_graph_arwnd_dialog.cpp3
-rw-r--r--ui/qt/sctp_graph_byte_dialog.cpp12
-rw-r--r--ui/qt/sctp_graph_dialog.cpp76
4 files changed, 59 insertions, 35 deletions
diff --git a/ui/qt/sctp_assoc_analyse_dialog.cpp b/ui/qt/sctp_assoc_analyse_dialog.cpp
index 38f571135a..2a6f9b7e7a 100644
--- a/ui/qt/sctp_assoc_analyse_dialog.cpp
+++ b/ui/qt/sctp_assoc_analyse_dialog.cpp
@@ -61,7 +61,7 @@ void SCTPAssocAnalyseDialog::findAssocForPacket()
GList *list, *framelist;
sctp_assoc_info_t *assoc;
bool frame_found = false;
- printf("findAssocForPacket\n");
+
fdata = cap_file_->current_frame;
list = g_list_first(sctp_stat_get_info()->assoc_info_list);
@@ -80,7 +80,6 @@ void SCTPAssocAnalyseDialog::findAssocForPacket()
}
if (frame_found) {
selected_assoc = assoc;
- printf("assoc_id =%d\n", selected_assoc->assoc_id);
return;
} else {
list = g_list_next(list);
diff --git a/ui/qt/sctp_graph_arwnd_dialog.cpp b/ui/qt/sctp_graph_arwnd_dialog.cpp
index 7badd8f45b..b41a4392d3 100644
--- a/ui/qt/sctp_graph_arwnd_dialog.cpp
+++ b/ui/qt/sctp_graph_arwnd_dialog.cpp
@@ -78,7 +78,6 @@ void SCTPGraphArwndDialog::drawArwndGraph()
nr_sack_header =(struct nr_sack_chunk_header *)tlist->data;
arwnd = g_ntohl(nr_sack_header->a_rwnd);
}
- // printf("frame %d arwnd=%d\n", tsn->frame_number, arwnd);
ya.append(arwnd);
xa.append(tsn->secs + tsn->usecs/1000000.0);
fa.append(tsn->frame_number);
@@ -150,7 +149,7 @@ void SCTPGraphArwndDialog::graphClicked(QCPAbstractPlottable* plottable, QMouseE
cf_goto_frame(cap_file_, frame_num);
}
- ui->hintLabel->setText(QString("<small><i>Graph %1: arwnd=%2 Time=%3 secs </i></small>")
+ ui->hintLabel->setText(QString("<small><i>Graph %1: a_rwnd=%2 Time=%3 secs </i></small>")
.arg(plottable->name())
.arg(ya.value(i))
.arg(xa.value(i)));
diff --git a/ui/qt/sctp_graph_byte_dialog.cpp b/ui/qt/sctp_graph_byte_dialog.cpp
index 8619b39b95..8c6e3da989 100644
--- a/ui/qt/sctp_graph_byte_dialog.cpp
+++ b/ui/qt/sctp_graph_byte_dialog.cpp
@@ -57,15 +57,12 @@ void SCTPGraphByteDialog::drawBytesGraph()
tsn_t *tsn;
guint8 type;
guint32 maxBytes;
- // guint32 minBytes, maxBytes;
long sumBytes = 0;
- // printf("drawBytesGraph\n");
+
if (direction == 1) {
- //minBytes = 0; //selected_assoc->min_tsn1;
maxBytes = selected_assoc->n_data_bytes_ep1;
listTSN = g_list_last(selected_assoc->tsn1);
} else {
- //minBytes = 0; //selected_assoc->min_tsn2;
maxBytes = selected_assoc->n_data_bytes_ep2;
listTSN = g_list_last(selected_assoc->tsn2);
}
@@ -83,7 +80,6 @@ void SCTPGraphByteDialog::drawBytesGraph()
sumBytes += length;
yb.append(sumBytes);
xb.append(tsn->secs + tsn->usecs/1000000.0);
- // printf("x=%f y=%ld\n", tsn->secs + tsn->usecs/1000000.0, sumBytes);
fb.append(tsn->frame_number);
}
tlist = g_list_next(tlist);
@@ -143,7 +139,7 @@ void SCTPGraphByteDialog::on_pushButton_4_clicked()
void SCTPGraphByteDialog::graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event)
{
if (plottable->name().contains("Bytes", Qt::CaseInsensitive)) {
- double bytes = (ui->sctpPlot->yAxis->pixelToCoord(event->pos().y())); // FIXME IRENE
+ double bytes = ui->sctpPlot->yAxis->pixelToCoord(event->pos().y());
int i;
for (i = 0; i < yb.size(); i++) {
if (bytes <= yb.value(i)) {
@@ -157,8 +153,8 @@ void SCTPGraphByteDialog::graphClicked(QCPAbstractPlottable* plottable, QMouseEv
ui->hintLabel->setText(QString("<small><i>Graph %1: Received bytes=%2 Time=%3 secs </i></small>")
.arg(plottable->name())
- .arg(yb.value(i))
- .arg(xb.value(i)));
+ .arg(yb.value(i))
+ .arg(xb.value(i)));
}
}
diff --git a/ui/qt/sctp_graph_dialog.cpp b/ui/qt/sctp_graph_dialog.cpp
index e149cac052..92477d0290 100644
--- a/ui/qt/sctp_graph_dialog.cpp
+++ b/ui/qt/sctp_graph_dialog.cpp
@@ -191,7 +191,8 @@ void SCTPGraphDialog::drawSACKGraph()
// Add SACK graph
if (xs.size() > 0) {
- ui->sctpPlot->addGraph();
+ QCPGraph *gr = ui->sctpPlot->addGraph();
+ gr->setName(QString("SACK"));
myScatter.setPen(QPen(Qt::red));
myScatter.setBrush(Qt::red);
ui->sctpPlot->graph(graphcount)->setScatterStyle(myScatter);
@@ -203,7 +204,8 @@ void SCTPGraphDialog::drawSACKGraph()
// Add Gap Acks
if (xg.size() > 0) {
- ui->sctpPlot->addGraph();
+ QCPGraph *gr = ui->sctpPlot->addGraph();
+ gr->setName(QString("GAP"));
myScatter.setPen(QPen(Qt::green));
myScatter.setBrush(Qt::green);
ui->sctpPlot->graph(graphcount)->setScatterStyle(myScatter);
@@ -215,7 +217,8 @@ void SCTPGraphDialog::drawSACKGraph()
// Add NR Gap Acks
if (xn.size() > 0) {
- ui->sctpPlot->addGraph();
+ QCPGraph *gr = ui->sctpPlot->addGraph();
+ gr->setName(QString("NR_GAP"));
myScatter.setPen(QPen(Qt::blue));
myScatter.setBrush(Qt::blue);
ui->sctpPlot->graph(graphcount)->setScatterStyle(myScatter);
@@ -227,7 +230,8 @@ void SCTPGraphDialog::drawSACKGraph()
// Add Duplicates
if (xd.size() > 0) {
- ui->sctpPlot->addGraph();
+ QCPGraph *gr = ui->sctpPlot->addGraph();
+ gr->setName(QString("DUP"));
myScatter.setPen(QPen(Qt::cyan));
myScatter.setBrush(Qt::cyan);
ui->sctpPlot->graph(graphcount)->setScatterStyle(myScatter);
@@ -243,13 +247,10 @@ void SCTPGraphDialog::drawTSNGraph()
tsn_t *tsn;
guint8 type;
guint32 tsnumber=0;
- // guint32 minTSN;
if (direction == 1) {
- // minTSN = selected_assoc->min_tsn1;
listTSN = g_list_last(selected_assoc->tsn1);
} else {
- // minTSN = selected_assoc->min_tsn2;
listTSN = g_list_last(selected_assoc->tsn2);
}
@@ -279,7 +280,8 @@ void SCTPGraphDialog::drawTSNGraph()
// Add TSN graph
if (xt.size() > 0) {
- ui->sctpPlot->addGraph();
+ QCPGraph *gr = ui->sctpPlot->addGraph();
+ gr->setName(QString("TSN"));
myScatter.setPen(QPen(Qt::black));
myScatter.setBrush(Qt::black);
ui->sctpPlot->graph(graphcount)->setScatterStyle(myScatter);
@@ -291,20 +293,17 @@ void SCTPGraphDialog::drawTSNGraph()
void SCTPGraphDialog::drawGraph(int which)
{
- // guint32 minTSN, maxTSN;
guint32 maxTSN;
gIsSackChunkPresent = false;
gIsNRSackChunkPresent = false;
if (direction == 1) {
- // minTSN = selected_assoc->min_tsn1;
maxTSN = selected_assoc->max_tsn1;
} else {
- // minTSN = selected_assoc->min_tsn2;
maxTSN = selected_assoc->max_tsn2;
}
-
+ ui->sctpPlot->clearGraphs();
switch (which) {
case 1: drawSACKGraph();
drawNRSACKGraph();
@@ -361,20 +360,51 @@ void SCTPGraphDialog::on_pushButton_4_clicked()
void SCTPGraphDialog::graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event)
{
- if (plottable->name().contains("Graph", Qt::CaseInsensitive)) {
- // double tsn = round(ui->sctpPlot->yAxis->pixelToCoord(event->pos().y()));
- int index = yt.indexOf((ui->sctpPlot->yAxis->pixelToCoord(event->pos().y()))); // FIXME IRENE
- // double time = xt.at(index);
- frame_num = ft.at(index);
- if (cap_file_ && frame_num > 0) {
- cf_goto_frame(cap_file_, frame_num);
+ frame_num = 0;
+ int i=0;
+ double times = ui->sctpPlot->xAxis->pixelToCoord(event->pos().x());
+ if (plottable->name().contains("TSN", Qt::CaseInsensitive)) {
+ for (i = 0; i < xt.size(); i++) {
+ if (times <= xt.value(i)) {
+ frame_num = ft.at(i);
+ break;
+ }
+ }
+ } else if (plottable->name().contains("SACK", Qt::CaseInsensitive)) {
+ for (i = 0; i < xs.size(); i++) {
+ if (times <= xs.value(i)) {
+ frame_num = fs.at(i);
+ break;
+ }
+ }
+ } else if (plottable->name().contains("DUP", Qt::CaseInsensitive)) {
+ for (i = 0; i < xd.size(); i++) {
+ if (times <= xd.value(i)) {
+ frame_num = fd.at(i);
+ break;
+ }
}
+ } else if (plottable->name().contains("NR_GAP", Qt::CaseInsensitive)) {
+ for (i = 0; i < xn.size(); i++) {
+ if (times <= xn.value(i)) {
+ frame_num = fn.at(i);
+ break;
+ }
+ }
+ } else if (plottable->name().contains("GAP", Qt::CaseInsensitive)) {
+ for (i = 0; i < xs.size(); i++) {
+ if (times <= xs.value(i)) {
+ frame_num = fs.at(i);
+ break;
+ }
+ }
+ }
+ if (cap_file_ && frame_num > 0) {
+ cf_goto_frame(cap_file_, frame_num);
}
- int num = plottable->name().remove("Graph ",Qt::CaseInsensitive).toInt();
- ui->hintLabel->setText(QString("<small><i>%1: %2: %3 Time: %4 secs </i></small>")
+ ui->hintLabel->setText(QString("<small><i>%1: %2 Time: %3 secs </i></small>")
.arg(plottable->name())
- .arg(typeStrings[num-1])
- .arg((ui->sctpPlot->yAxis->pixelToCoord(event->pos().y()))) // FIXME IRENE
+ .arg(floor(ui->sctpPlot->yAxis->pixelToCoord(event->pos().y()) + 0.5))
.arg(ui->sctpPlot->xAxis->pixelToCoord(event->pos().x())));
}