X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fprop%2Fdouble.cpp;h=f4e6e443a5bb6f2e7dcf27fe29053f6daed50090;hb=fd22c71c1a9cc470b53c71c0ee131a4b2d645f80;hp=54540bc68ded41c0575c3202726ac383665b5814;hpb=e8d009288de28cb194bc7964f96677c2baf900c9;p=pulseview.git diff --git a/pv/prop/double.cpp b/pv/prop/double.cpp index 54540bc6..f4e6e443 100644 --- a/pv/prop/double.cpp +++ b/pv/prop/double.cpp @@ -22,7 +22,7 @@ #include -#include "double.h" +#include "double.hpp" using boost::optional; using std::pair; @@ -38,58 +38,54 @@ Double::Double(QString name, Getter getter, Setter setter) : Property(name, getter, setter), - _decimals(decimals), - _suffix(suffix), - _range(range), - _step(step), - _spin_box(NULL) -{ -} - -Double::~Double() + decimals_(decimals), + suffix_(suffix), + range_(range), + step_(step), + spin_box_(nullptr) { } QWidget* Double::get_widget(QWidget *parent, bool auto_commit) { - if (_spin_box) - return _spin_box; + if (spin_box_) + return spin_box_; - if (!_getter) - return NULL; + if (!getter_) + return nullptr; - Glib::VariantBase variant = _getter(); + Glib::VariantBase variant = getter_(); if (!variant.gobj()) - return NULL; + return nullptr; double value = Glib::VariantBase::cast_dynamic>( variant).get(); - _spin_box = new QDoubleSpinBox(parent); - _spin_box->setDecimals(_decimals); - _spin_box->setSuffix(_suffix); - if (_range) - _spin_box->setRange(_range->first, _range->second); - if (_step) - _spin_box->setSingleStep(*_step); + spin_box_ = new QDoubleSpinBox(parent); + spin_box_->setDecimals(decimals_); + spin_box_->setSuffix(suffix_); + if (range_) + spin_box_->setRange(range_->first, range_->second); + if (step_) + spin_box_->setSingleStep(*step_); - _spin_box->setValue(value); + spin_box_->setValue(value); if (auto_commit) - connect(_spin_box, SIGNAL(valueChanged(double)), + connect(spin_box_, SIGNAL(valueChanged(double)), this, SLOT(on_value_changed(double))); - return _spin_box; + return spin_box_; } void Double::commit() { - assert(_setter); + assert(setter_); - if (!_spin_box) + if (!spin_box_) return; - _setter(Glib::Variant::create(_spin_box->value())); + setter_(Glib::Variant::create(spin_box_->value())); } void Double::on_value_changed(double)