void RtpPlayerDialog::addRtpStream(struct _rtp_stream_info *rtp_stream) { if (!rtp_stream) return; // Find the RTP streams associated with this conversation. // gtk/rtp_player.c:mark_rtp_stream_to_play does this differently. RtpAudioStream *audio_stream = NULL; int tli_count = ui->streamTreeWidget->topLevelItemCount(); for (int row = 0; row < tli_count; row++) { QTreeWidgetItem *ti = ui->streamTreeWidget->topLevelItem(row); RtpAudioStream *row_stream = ti->data(stream_data_col_, Qt::UserRole).value<RtpAudioStream*>(); if (row_stream->isMatch(rtp_stream)) { audio_stream = row_stream; break; } } if (!audio_stream) { audio_stream = new RtpAudioStream(this, rtp_stream); audio_stream->setColor(ColorUtils::graph_colors_[tli_count % ColorUtils::graph_colors_.length()]); QTreeWidgetItem *ti = new QTreeWidgetItem(ui->streamTreeWidget); ti->setText(src_addr_col_, address_to_qstring(&rtp_stream->src_addr)); ti->setText(src_port_col_, QString::number(rtp_stream->src_port)); ti->setText(dst_addr_col_, address_to_qstring(&rtp_stream->dest_addr)); ti->setText(dst_port_col_, QString::number(rtp_stream->dest_port)); ti->setText(ssrc_col_, int_to_qstring(rtp_stream->ssrc, 8, 16)); ti->setText(first_pkt_col_, QString::number(rtp_stream->setup_frame_number)); ti->setText(num_pkts_col_, QString::number(rtp_stream->packet_count)); ti->setData(stream_data_col_, Qt::UserRole, QVariant::fromValue(audio_stream)); for (int col = 0; col < ui->streamTreeWidget->columnCount(); col++) { ti->setTextColor(col, audio_stream->color()); } connect(ui->playButton, SIGNAL(clicked(bool)), audio_stream, SLOT(startPlaying())); connect(ui->stopButton, SIGNAL(clicked(bool)), audio_stream, SLOT(stopPlaying())); connect(audio_stream, SIGNAL(startedPlaying()), this, SLOT(updateWidgets())); connect(audio_stream, SIGNAL(finishedPlaying()), this, SLOT(updateWidgets())); connect(audio_stream, SIGNAL(processedSecs(double)), this, SLOT(setPlayPosition(double))); }
QString DecodeAsDialog::entryString(const gchar *table_name, gpointer value) { QString entry_str; ftenum_t selector_type = get_dissector_table_selector_type(table_name); switch (selector_type) { case FT_UINT8: case FT_UINT16: case FT_UINT24: case FT_UINT32: { uint num_val = GPOINTER_TO_UINT(value); switch (get_dissector_table_param(table_name)) { case BASE_DEC: entry_str = QString::number(num_val); break; case BASE_HEX: int width; switch (selector_type) { case FT_UINT8: width = 2; break; case FT_UINT16: width = 4; break; case FT_UINT24: width = 6; break; case FT_UINT32: width = 8; break; default: g_assert_not_reached(); break; } entry_str = QString("%1").arg(int_to_qstring(num_val, width, 16)); break; case BASE_OCT: entry_str = "0" + QString::number(num_val, 8); break; } break; } case FT_STRING: case FT_STRINGZ: case FT_UINT_STRING: case FT_STRINGZPAD: entry_str = (char *)value; break; default: g_assert_not_reached(); break; } return entry_str; }