#include "deviceoptions.h"
+#include <boost/foreach.hpp>
+
+#include <QFormLayout>
#include <QListWidget>
+#include <pv/prop/property.h>
+
+using namespace boost;
+using namespace std;
+
namespace pv {
namespace dialogs {
_props_box.setLayout(&_props_box_layout);
- _props_box_layout.addWidget(_device_options_binding.get_form(this));
+ _props_box_layout.addWidget(get_property_form());
_layout.addWidget(&_props_box);
_layout.addWidget(&_button_box);
}
// Commit the properties
- _device_options_binding.commit();
+ const vector< shared_ptr<pv::prop::Property> > &properties =
+ _device_options_binding.properties();
+ BOOST_FOREACH(shared_ptr<pv::prop::Property> p, properties) {
+ assert(p);
+ p->commit();
+ }
+}
+
+QWidget* DeviceOptions::get_property_form()
+{
+ QWidget *const form = new QWidget(this);
+ QFormLayout *const layout = new QFormLayout(form);
+ form->setLayout(layout);
+
+ const vector< shared_ptr<pv::prop::Property> > &properties =
+ _device_options_binding.properties();
+ BOOST_FOREACH(shared_ptr<pv::prop::Property> p, properties)
+ {
+ assert(p);
+ const QString label = p->labeled_widget() ? QString() : p->name();
+ layout->addRow(label, p->get_widget(form));
+ }
+
+ return form;
}
void DeviceOptions::setup_probes()
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <QFormLayout>
-#include <QWidget>
-
-#include <boost/foreach.hpp>
-
#include "binding.h"
-#include <pv/prop/property.h>
-
-using namespace boost;
-
namespace pv {
namespace prop {
namespace binding {
-Binding::Binding() :
- _form(NULL)
-{
-}
-
-QWidget* Binding::get_form(QWidget *parent)
-{
- if (_form)
- return _form;
-
- _form = new QWidget(parent);
- QFormLayout *const layout = new QFormLayout(_form);
- _form->setLayout(layout);
-
- BOOST_FOREACH(shared_ptr<Property> p, _properties)
- {
- assert(p);
- const QString label = p->labeled_widget() ? QString() : p->name();
- layout->addRow(label, p->get_widget(_form));
- }
-
- return _form;
-}
-
-void Binding::commit()
+const std::vector< boost::shared_ptr<Property> >& Binding::properties()
{
- BOOST_FOREACH(shared_ptr<Property> p, _properties)
- {
- assert(p);
- p->commit();
- }
+ return _properties;
}
} // binding