X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fprop%2Fbool.cpp;h=aab5a723c862343feee4c89db918e2b43403f956;hp=699656f75d3ab60adbd81006d0c4c692886161db;hb=9a267f8dec48c9a28472c1a3bb146c624819e98b;hpb=e8d009288de28cb194bc7964f96677c2baf900c9 diff --git a/pv/prop/bool.cpp b/pv/prop/bool.cpp index 699656f..aab5a72 100644 --- a/pv/prop/bool.cpp +++ b/pv/prop/bool.cpp @@ -14,52 +14,47 @@ * 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 + * along with this program; if not, see . */ -#include +#include #include -#include "bool.h" +#include "bool.hpp" namespace pv { namespace prop { -Bool::Bool(QString name, Getter getter, Setter setter) : - Property(name, getter, setter), - _check_box(NULL) -{ -} - -Bool::~Bool() +Bool::Bool(QString name, QString desc, Getter getter, Setter setter) : + Property(name, desc, getter, setter), + check_box_(nullptr) { } QWidget* Bool::get_widget(QWidget *parent, bool auto_commit) { - if (_check_box) - return _check_box; + if (check_box_) + return check_box_; - if (!_getter) - return NULL; + if (!getter_) + return nullptr; - Glib::VariantBase variant = _getter(); + Glib::VariantBase variant = getter_(); if (!variant.gobj()) - return NULL; + return nullptr; bool value = Glib::VariantBase::cast_dynamic>( variant).get(); - _check_box = new QCheckBox(name(), parent); - _check_box->setCheckState(value ? Qt::Checked : Qt::Unchecked); + check_box_ = new QCheckBox(name(), parent); + check_box_->setCheckState(value ? Qt::Checked : Qt::Unchecked); if (auto_commit) - connect(_check_box, SIGNAL(stateChanged(int)), + connect(check_box_, SIGNAL(stateChanged(int)), this, SLOT(on_state_changed(int))); - return _check_box; + return check_box_; } bool Bool::labeled_widget() const @@ -69,13 +64,13 @@ bool Bool::labeled_widget() const void Bool::commit() { - assert(_setter); + assert(setter_); - if (!_check_box) + if (!check_box_) return; - _setter(Glib::Variant::create( - _check_box->checkState() == Qt::Checked)); + setter_(Glib::Variant::create( + check_box_->checkState() == Qt::Checked)); } void Bool::on_state_changed(int) @@ -83,5 +78,5 @@ void Bool::on_state_changed(int) commit(); } -} // prop -} // pv +} // namespace prop +} // namespace pv