StatsTreeDialog::StatsTreeDialog(QWidget *parent, capture_file *cf, const char *cfg_abbr) : QDialog(parent), ui(new Ui::StatsTreeDialog), st_(NULL), st_cfg_(NULL), cap_file_(cf) { ui->setupUi(this); st_cfg_ = stats_tree_get_cfg_by_abbr(cfg_abbr); if (!st_cfg_) { QMessageBox::critical(this, tr("Configuration not found"), tr("Unable to find configuration for %1.").arg(cfg_abbr)); QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection); } ui->statsTreeWidget->addAction(ui->actionCopyToClipboard); ui->statsTreeWidget->addAction(ui->actionSaveAs); ui->statsTreeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); QPushButton *button; button = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionCopyToClipboard_triggered())); button = ui->buttonBox->addButton(tr("Save as..."), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(on_actionSaveAs_triggered())); fillTree(); }
StatsTreeDialog::StatsTreeDialog(QWidget &parent, CaptureFile &cf, const char *cfg_abbr) : TapParameterDialog(parent, cf), st_(NULL), st_cfg_(NULL) { 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"), tr("Unable to find configuration for %1.").arg(cfg_abbr)); QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection); } }
/* register a new stat_tree with default group REGISTER_STAT_GROUP_UNSORTED from a plugin */ extern void stats_tree_register_plugin(const char *tapname, const char *abbr, const char *name, guint flags, stat_tree_packet_cb packet, stat_tree_init_cb init, stat_tree_cleanup_cb cleanup) { stats_tree_cfg *cfg; stats_tree_register(tapname, abbr, name, flags, packet, init, cleanup); cfg = stats_tree_get_cfg_by_abbr((char*)abbr); cfg->plugin = TRUE; }