| 53 | namespace dialogs { |
| 54 | |
| 55 | ProtocolExp::ProtocolExp(QWidget *parent, SigSession *session) : |
| 56 | DSDialog(parent), |
| 57 | _session(session), |
| 58 | _button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, |
| 59 | Qt::Horizontal, this), |
| 60 | _export_cancel(false) |
| 61 | { |
| 62 | _format_combobox = new DsComboBox(this); |
| 63 | //tr |
| 64 | _format_combobox->addItem("Comma-Separated Values (*.csv)"); |
| 65 | _format_combobox->addItem("Text files (*.txt)"); |
| 66 | |
| 67 | _flayout = new QFormLayout(); |
| 68 | _flayout->setVerticalSpacing(5); |
| 69 | _flayout->setFormAlignment(Qt::AlignLeft); |
| 70 | _flayout->setLabelAlignment(Qt::AlignLeft); |
| 71 | _flayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); |
| 72 | _flayout->addRow(new QLabel(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_EXPORT_FORMAT), "Export Format: "), this), _format_combobox); |
| 73 | |
| 74 | pv::data::DecoderModel* decoder_model = _session->get_decoder_model(); |
| 75 | |
| 76 | const auto decoder_stack = decoder_model->getDecoderStack(); |
| 77 | if (decoder_stack) { |
| 78 | int row_index = 0; |
| 79 | auto rows = decoder_stack->get_rows_lshow(); |
| 80 | |
| 81 | for (auto i = rows.begin();i != rows.end(); i++) { |
| 82 | if ((*i).second) { |
| 83 | QLabel *row_label = new QLabel((*i).first.title(), this); |
| 84 | QCheckBox *row_sel = new QCheckBox(this); |
| 85 | if (row_index == 0) { |
| 86 | row_sel->setChecked(true); |
| 87 | } |
| 88 | _row_label_list.push_back(row_label); |
| 89 | _row_sel_list.push_back(row_sel); |
| 90 | _flayout->addRow(row_label, row_sel); |
| 91 | row_sel->setProperty("index", row_index); |
| 92 | row_sel->setProperty("title", (*i).first.title()); |
| 93 | row_index++; |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | _layout = new QVBoxLayout(); |
| 99 | _layout->addLayout(_flayout); |
| 100 | _layout->addWidget(&_button_box); |
| 101 | |
| 102 | layout()->addLayout(_layout); |
| 103 | setTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_PROTOCOL_EXPORT), "Protocol Export")); |
| 104 | |
| 105 | connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept())); |
| 106 | connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject())); |
| 107 | connect(_session->device_event_object(), SIGNAL(device_updated()), this, SLOT(reject())); |
| 108 | |
| 109 | } |
| 110 | |
| 111 | void ProtocolExp::accept() |
| 112 | { |
nothing calls this directly
no test coverage detected