예제 #1
0
TapParameterDialog::TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic) :
    WiresharkDialog(parent, cf),
    ui(new Ui::TapParameterDialog),
    help_topic_(help_topic)
{
    ui->setupUi(this);

    // XXX Use recent settings instead
    resize(parent.width() * 2 / 3, parent.height() * 3 / 4);

    // Only show a hint label if a subclass provides a hint.
    ui->hintLabel->hide();

    ctx_menu_.addAction(ui->actionCopyToClipboard);
    ctx_menu_.addAction(ui->actionSaveAs);

    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" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ActionRole);
    connect(button, SIGNAL(clicked()), this, SLOT(on_actionSaveAs_triggered()));

    connect(ui->displayFilterLineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(updateWidgets()));

    ProgressFrame::addToButtonBox(ui->buttonBox, &parent);

    if (help_topic_ < 1) {
        ui->buttonBox->button(QDialogButtonBox::Help)->hide();
    }

    if (!ui->displayFilterLineEdit->text().isEmpty()) {
        QString filter = ui->displayFilterLineEdit->text();
        emit updateFilter(filter, true);
    }
    show_timer_ = new QTimer(this);
    setRetapOnShow(true);
}
RpcServiceResponseTimeDialog::RpcServiceResponseTimeDialog(QWidget &parent, CaptureFile &cf, struct register_srt *srt, RpcFamily dlg_type, const QString filter) :
    ServiceResponseTimeDialog(parent, cf, srt, filter),
    dlg_type_(dlg_type)
{
    setRetapOnShow(false);
    setHint(tr("<small><i>Select a program and version and enter a filter if desired, then press Apply.</i></small>"));

    QHBoxLayout *filter_layout = filterLayout();
    program_combo_ = new QComboBox(this);
    version_combo_ = new QComboBox(this);

    filter_layout->insertStretch(0, 1);
    filter_layout->insertWidget(0, version_combo_);
    filter_layout->insertWidget(0, new QLabel(tr("Version:")));
    filter_layout->insertWidget(0, program_combo_);
    filter_layout->insertWidget(0, new QLabel(tr("Program:")));

    if (dlg_type == DceRpc) {
        setWindowSubtitle(tr("DCE-RPC Service Response Times"));
        g_hash_table_foreach(dcerpc_uuids, dce_rpc_add_program, this);
        // This is a loooooong list. The GTK+ UI addresses this by making
        // the program combo a tree instead of a list. We might want to add a
        // full-height list to the left of the stats tree instead.
        QStringList programs = dce_name_to_uuid_key_.keys();
        std::sort(programs.begin(), programs.end(), qStringCaseLessThan);
        connect(program_combo_, SIGNAL(currentIndexChanged(QString)),
                this, SLOT(dceRpcProgramChanged(QString)));
        program_combo_->addItems(programs);
    } else {
        setWindowSubtitle(tr("ONC-RPC Service Response Times"));
        g_hash_table_foreach(rpc_progs, onc_rpc_add_program, this);
        QStringList programs = onc_name_to_program_.keys();
        std::sort(programs.begin(), programs.end(), qStringCaseLessThan);
        connect(program_combo_, SIGNAL(currentIndexChanged(QString)),
                this, SLOT(oncRpcProgramChanged(QString)));
        program_combo_->addItems(programs);
    }
}