X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fdeviceoptions.cpp;fp=pv%2Fdialogs%2Fdeviceoptions.cpp;h=b8f4cabf2542af7175ac6819bdac77a86fe80488;hp=0000000000000000000000000000000000000000;hb=d755562ad376fc95184ff996ff8f1391c5f32b6b;hpb=3820592a018c777727a6e65bd754d113742f4462;ds=sidebyside diff --git a/pv/dialogs/deviceoptions.cpp b/pv/dialogs/deviceoptions.cpp new file mode 100644 index 00000000..b8f4cabf --- /dev/null +++ b/pv/dialogs/deviceoptions.cpp @@ -0,0 +1,53 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "deviceoptions.h" + +namespace pv { +namespace dialogs { + +DeviceOptions::DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi) : + QDialog(parent), + _layout(this), + _button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, this), + _device_options_binding(sdi) +{ + setWindowTitle(tr("Configure Device")); + + connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept())); + connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject())); + + setLayout(&_layout); + + QWidget *const form = _device_options_binding.get_form(this); + _layout.addWidget(form); + + _layout.addWidget(&_button_box); +} + +void DeviceOptions::accept() +{ + QDialog::accept(); + _device_options_binding.commit(); +} + +} // namespace dialogs +} // namespace pv