void LBMStreamDialog::fillTree(void) { gchar * error_string; if (m_capture_file == NULL) { return; } m_dialog_info->setDialog(this); error_string = register_tap_listener("lbm_stream", (void *)m_dialog_info, m_ui->displayFilterLineEdit->text().toUtf8().constData(), TL_REQUIRES_COLUMNS, resetTap, tapPacket, drawTreeItems); if (error_string) { QMessageBox::critical(this, tr("LBM Stream failed to attach to tap"), error_string); wmem_free(NULL, error_string); reject(); } cf_retap_packets(m_capture_file); drawTreeItems(&m_dialog_info); remove_tap_listener((void *)m_dialog_info); }
void StatsTreeDialog::fillTree() { GString *error_string; 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); // 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); st_cfg_->pr = &cfg_pr_; cfg_pr_.st_dlg = this; if (st_) { stats_tree_free(st_); } st_ = stats_tree_new(st_cfg_, NULL, ui->displayFilterLineEdit->text().toUtf8().constData()); // Add number of columns for this stats_tree QStringList headerLabels; for (int count = 0; count<st_->num_columns; count++) { headerLabels.push_back(stats_tree_get_column_name(count)); } ui->statsTreeWidget->setColumnCount(headerLabels.count()); ui->statsTreeWidget->setHeaderLabels(headerLabels); resize(st_->num_columns*80+80, height()); for (int count = 0; count<st_->num_columns; count++) { headerLabels.push_back(stats_tree_get_column_name(count)); } ui->statsTreeWidget->setSortingEnabled(false); error_string = register_tap_listener(st_cfg_->tapname, st_, st_->filter, st_cfg_->flags, resetTap, stats_tree_packet, drawTreeItems); if (error_string) { QMessageBox::critical(this, tr("%1 failed to attach to tap").arg(display_name), error_string->str); g_string_free(error_string, TRUE); reject(); } cf_retap_packets(cap_file_.capFile()); drawTreeItems(st_); ui->statsTreeWidget->setSortingEnabled(true); remove_tap_listener(st_); st_cfg_->pr = NULL; }
void StatsTreeDialog::fillTree() { if (!st_cfg_ || file_closed_) return; QString display_name = gchar_free_to_qstring(stats_tree_get_displayname(st_cfg_->name)); // 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); st_cfg_->pr = &cfg_pr_; cfg_pr_.st_dlg = this; if (st_) { stats_tree_free(st_); } QString display_filter = displayFilter(); st_ = stats_tree_new(st_cfg_, NULL, display_filter.toUtf8().constData()); // Add number of columns for this stats_tree QStringList header_labels; for (int count = 0; count<st_->num_columns; count++) { header_labels.push_back(stats_tree_get_column_name(count)); } statsTreeWidget()->setColumnCount(header_labels.count()); statsTreeWidget()->setHeaderLabels(header_labels); statsTreeWidget()->setSortingEnabled(false); if (!registerTapListener(st_cfg_->tapname, st_, st_->filter, st_cfg_->flags, resetTap, stats_tree_packet, drawTreeItems)) { reject(); // XXX Stay open instead? return; } cap_file_.retapPackets(); drawTreeItems(st_); statsTreeWidget()->setSortingEnabled(true); removeTapListeners(); st_cfg_->pr = NULL; }
void StatsTreeDialog::fillTree() { GString *error_string; if (!st_cfg_) 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")); 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 at time.")); reject(); } st_cfg_->in_use = TRUE; st_cfg_->pr = &cfg_pr_; cfg_pr_.st_dlg = this; if (st_) { stats_tree_free(st_); } st_ = stats_tree_new(st_cfg_, NULL, ui->displayFilterLineEdit->text().toUtf8().constData()); // Add number of columns for this stats_tree QStringList headerLabels; for (int count = 0; count<st_->num_columns; count++) { headerLabels.push_back(stats_tree_get_column_name(count)); } ui->statsTreeWidget->setColumnCount(headerLabels.count()); ui->statsTreeWidget->setHeaderLabels(headerLabels); resize(st_->num_columns*80+80, height()); for (int count = 0; count<st_->num_columns; count++) { headerLabels.push_back(stats_tree_get_column_name(count)); } ui->statsTreeWidget->setSortingEnabled(false); error_string = register_tap_listener(st_cfg_->tapname, st_, st_->filter, st_cfg_->flags, resetTap, stats_tree_packet, drawTreeItems); if (error_string) { QMessageBox::critical(this, tr("%1 failed to attach to tap").arg(display_name), error_string->str); g_string_free(error_string, TRUE); reject(); } cf_retap_packets(cap_file_); drawTreeItems(st_); ui->statsTreeWidget->setSortingEnabled(true); remove_tap_listener(st_); st_cfg_->in_use = FALSE; st_cfg_->pr = NULL; }