#include <limits>
#include <QApplication>
+#include <QFormLayout>
+#include <QSpinBox>
#include "analogsignal.hpp"
#include "pv/data/analog.hpp"
const float AnalogSignal::EnvelopeThreshold = 256.0f;
+const int AnalogSignal::MaximumVDivs = 10;
+
AnalogSignal::AnalogSignal(
pv::Session &session,
shared_ptr<Channel> channel,
scale_ = div_height_ / resolution_;
}
+void AnalogSignal::populate_popup_form(QWidget *parent, QFormLayout *form)
+{
+ // Add the standard options
+ Signal::populate_popup_form(parent, form);
+
+ // Add the vdiv settings
+ QSpinBox *vdiv_sb = new QSpinBox(parent);
+ vdiv_sb->setRange(1, MaximumVDivs);
+ vdiv_sb->setValue(vdivs_);
+ connect(vdiv_sb, SIGNAL(valueChanged(int)),
+ this, SLOT(on_vdivs_changed(int)));
+ form->addRow(tr("Number of vertical divs"), vdiv_sb);
+}
+
+void AnalogSignal::on_vdivs_changed(int vdivs)
+{
+ vdivs_ = vdivs;
+
+ if (owner_)
+ owner_->extents_changed(false, true);
+}
+
+
} // namespace view
} // namespace pv
class AnalogSignal : public Signal
{
+ Q_OBJECT
+
private:
static const QColor SignalColours[4];
static const QColor GridMajorColor, GridMinorColor;
static const float EnvelopeThreshold;
+ static const int MaximumVDivs;
+
public:
AnalogSignal(pv::Session &session,
std::shared_ptr<sigrok::Channel> channel,
*/
void update_scale();
+protected:
+ void populate_popup_form(QWidget *parent, QFormLayout *form);
+
+private Q_SLOTS:
+ void on_vdivs_changed(int vdivs);
+
private:
std::shared_ptr<pv::data::Analog> data_;