X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdialogs%2Finputoutputoptions.cpp;fp=pv%2Fdialogs%2Finputoutputoptions.cpp;h=8f013a26c0a504a760fe5e2c2811962c9eb11d25;hb=e93f553816d1938ab1917dff497a36acec4257e3;hp=0000000000000000000000000000000000000000;hpb=0c9136370d062b08e47657e12f77518197d89339;p=pulseview.git diff --git a/pv/dialogs/inputoutputoptions.cpp b/pv/dialogs/inputoutputoptions.cpp new file mode 100644 index 0000000..8f013a2 --- /dev/null +++ b/pv/dialogs/inputoutputoptions.cpp @@ -0,0 +1,69 @@ +/* + * 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 "inputoutputoptions.hpp" + +#include + +using std::map; +using std::shared_ptr; +using std::string; + +using Glib::VariantBase; + +using sigrok::Option; + +namespace pv { +namespace dialogs { + +InputOutputOptions::InputOutputOptions(const QString &title, + const map> &options, QWidget *parent) : + QDialog(parent), + layout_(this), + button_box_(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, this), + binding_(options) +{ + setWindowTitle(title); + + connect(&button_box_, SIGNAL(accepted()), this, SLOT(accept())); + connect(&button_box_, SIGNAL(rejected()), this, SLOT(reject())); + + setLayout(&layout_); + + layout_.addWidget(binding_.get_property_form(this)); + layout_.addWidget(&button_box_); +} + +const map& InputOutputOptions::options() const +{ + return binding_.options(); +} + +void InputOutputOptions::accept() +{ + QDialog::accept(); + + // Commit the properties + binding_.commit(); +} + +} // namespace dialogs +} // namespace pv