#include <libsigrokcxx/libsigrokcxx.hpp>
+using std::bind;
using std::deque;
using std::div;
using std::div_t;
using std::min;
using std::numeric_limits;
using std::pair;
+using std::placeholders::_1;
using std::shared_ptr;
using std::vector;
connect(analog_data, SIGNAL(min_max_changed(float, float)),
this, SLOT(on_min_max_changed(float, float)));
+ GlobalSettings::register_change_handler(GlobalSettings::Key_View_ShowConversionThresholds,
+ bind(&AnalogSignal::on_settingViewShowConversionThresholds_changed, this, _1));
+
GlobalSettings gs;
+ show_conversion_thresholds_ =
+ gs.value(GlobalSettings::Key_View_ShowConversionThresholds).toBool();
+
div_height_ = gs.value(GlobalSettings::Key_View_DefaultDivHeight).toInt();
base_->set_colour(SignalColours[base_->index() % countof(SignalColours)]);
if (!base_->enabled())
return;
- // TODO Register a change handler instead of querying this with every repaint
- GlobalSettings settings;
- const bool show_conversion_thresholds =
- settings.value(GlobalSettings::Key_View_ShowConversionThresholds).toBool();
-
const vector<double> thresholds = base_->get_conversion_thresholds();
// Only display thresholds if we have some and we show analog samples
- if ((thresholds.size() > 0) && show_conversion_thresholds &&
+ if ((thresholds.size() > 0) && show_conversion_thresholds_ &&
((display_type_ == DisplayAnalog) || (display_type_ == DisplayBoth))) {
const int visual_y = get_visual_y();
owner_->row_item_appearance_changed(false, true);
}
+void AnalogSignal::on_settingViewShowConversionThresholds_changed(const QVariant new_value)
+{
+ show_conversion_thresholds_ = new_value.toBool();
+
+ if (owner_)
+ owner_->row_item_appearance_changed(false, true);
+}
+
} // namespace trace
} // namespace views
} // namespace pv
void on_display_type_changed(int index);
+ void on_settingViewShowConversionThresholds_changed(const QVariant new_value);
+
private:
QComboBox *resolution_cb_, *conversion_cb_, *conv_threshold_cb_,
*display_type_cb_;
DisplayType display_type_;
bool autoranging_;
+ bool show_conversion_thresholds_;
};
} // namespace trace