X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fbinding.cpp;fp=pv%2Fprop%2Fbinding%2Fbinding.cpp;h=0000000000000000000000000000000000000000;hb=61703a0124c7ace84caf415f7d491a3ad6f42599;hp=062ce6676a34fbb2d6b218b9c358ba9e061f10af;hpb=c1035a1452fa2aec5414975e83e531c10504b80c;p=pulseview.git diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp deleted file mode 100644 index 062ce66..0000000 --- a/pv/prop/binding/binding.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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 - -#include - -#include - -#include "binding.hpp" - -using std::shared_ptr; - -namespace pv { -namespace prop { -namespace binding { - -const std::vector< std::shared_ptr >& Binding::properties() -{ - return properties_; -} - -void Binding::commit() -{ - for (shared_ptr p : properties_) { - assert(p); - p->commit(); - } -} - -void Binding::add_properties_to_form(QFormLayout *layout, - bool auto_commit) const -{ - assert(layout); - - for (shared_ptr p : properties_) - { - assert(p); - - QWidget *const widget = p->get_widget(layout->parentWidget(), - auto_commit); - if (p->labeled_widget()) - layout->addRow(widget); - else - layout->addRow(p->name(), widget); - } -} - -QWidget* Binding::get_property_form(QWidget *parent, - bool auto_commit) const -{ - QWidget *const form = new QWidget(parent); - QFormLayout *const layout = new QFormLayout(form); - form->setLayout(layout); - add_properties_to_form(layout, auto_commit); - return form; -} - -QString Binding::print_gvariant(Glib::VariantBase gvar) -{ - QString s; - - if (!gvar.gobj()) - s = QString::fromStdString("(null)"); - else if (gvar.is_of_type(Glib::VariantType("s"))) - s = QString::fromStdString( - Glib::VariantBase::cast_dynamic>( - gvar).get()); - else - s = QString::fromStdString(gvar.print()); - - return s; -} - -} // binding -} // prop -} // pv