]> sigrok.org Git - pulseview.git/commitdiff
Fix #1567 by showing a custom text for the minimum range's value
authorSoeren Apel <redacted>
Mon, 13 Jul 2020 12:01:12 +0000 (14:01 +0200)
committerSoeren Apel <redacted>
Mon, 13 Jul 2020 21:36:34 +0000 (23:36 +0200)
pv/binding/device.cpp
pv/binding/device.hpp
pv/prop/bool.hpp
pv/prop/enum.hpp
pv/prop/int.cpp
pv/prop/int.hpp
pv/prop/property.hpp
pv/prop/string.hpp

index f84c1aae997a487c678709ab4a687e0409480d05..084d46511f64c6b2efedea9806220b57f2a27bdc 100644 (file)
@@ -92,7 +92,9 @@ Device::Device(shared_ptr<sigrok::Configurable> configurable) :
                        break;
 
                case SR_CONF_LIMIT_FRAMES:
-                       bind_int(name, "", "", pair<int64_t, int64_t>(0, 1000000), get, set);
+                       // Value 0 means that there is no limit
+                       bind_int(name, "", "", pair<int64_t, int64_t>(0, 1000000), get, set,
+                               tr("No Limit"));
                        break;
 
                case SR_CONF_PATTERN_MODE:
@@ -182,13 +184,13 @@ void Device::bind_enum(const QString &name, const QString &desc,
 }
 
 void Device::bind_int(const QString &name, const QString &desc, QString suffix,
-       optional< pair<int64_t, int64_t> > range,
-       Property::Getter getter, Property::Setter setter)
+       optional< pair<int64_t, int64_t> > range, Property::Getter getter,
+       Property::Setter setter, QString special_value_text)
 {
        assert(configurable_);
 
        properties_.push_back(shared_ptr<Property>(new Int(name, desc, suffix,
-               range, getter, setter)));
+               range, getter, setter, special_value_text)));
 }
 
 QString Device::print_timebase(Glib::VariantBase gvar)
index 9f5daf574a250beef9e3b5030e75599f88766fc1..30d89ddd493a106e2c423844661465dbc268df06 100644 (file)
@@ -62,7 +62,8 @@ private:
                function<QString (Glib::VariantBase)> printer = print_gvariant);
        void bind_int(const QString &name, const QString &desc, QString suffix,
                boost::optional< pair<int64_t, int64_t> > range,
-               prop::Property::Getter getter, prop::Property::Setter setter);
+               prop::Property::Getter getter, prop::Property::Setter setter,
+               QString special_value_text = "");
 
        static QString print_timebase(Glib::VariantBase gvar);
        static QString print_vdiv(Glib::VariantBase gvar);
index fd5744fe3830f0d56779b981afca4e85aae2e4ab..310eec6f06444af6905141568e1027b90b864931 100644 (file)
@@ -29,7 +29,7 @@ namespace prop {
 
 class Bool : public Property
 {
-       Q_OBJECT;
+       Q_OBJECT
 
 public:
        Bool(QString name, QString desc, Getter getter, Setter setter);
index 1434e7e9e0419aa301b03b9d21febcd2f0f66a7a..8050bcdf0f0897acea109125ad36d3a8651e2365 100644 (file)
@@ -41,7 +41,7 @@ namespace prop {
 
 class Enum : public Property
 {
-       Q_OBJECT;
+       Q_OBJECT
 
 public:
        Enum(QString name, QString desc,
index 3f29951b3d997b7b5b8a299fd34c3a0bf0d6db40..c1b2d22a6be97b4692d8254c2185e1cd076c72ea 100644 (file)
@@ -35,14 +35,12 @@ using std::pair;
 namespace pv {
 namespace prop {
 
-Int::Int(QString name,
-       QString desc,
-       QString suffix,
-       optional< pair<int64_t, int64_t> > range,
-       Getter getter,
-       Setter setter) :
+Int::Int(QString name, QString desc, QString suffix,
+       optional< pair<int64_t, int64_t> > range, Getter getter, Setter setter,
+       QString special_value_text) :
        Property(name, desc, getter, setter),
        suffix_(suffix),
+       special_value_text_(special_value_text),
        range_(range),
        spin_box_(nullptr)
 {
@@ -72,6 +70,7 @@ QWidget* Int::get_widget(QWidget *parent, bool auto_commit)
 
        spin_box_ = new QSpinBox(parent);
        spin_box_->setSuffix(suffix_);
+       spin_box_->setSpecialValueText(special_value_text_);
 
        const GVariantType *const type = g_variant_get_type(value);
        assert(type);
index f6b7c2d1f1642d64a55a575fbcd7100618cd3c46..1f6a64ca503fddf069090f9c9e03e2eaa44b2bc6 100644 (file)
@@ -35,12 +35,12 @@ namespace prop {
 
 class Int : public Property
 {
-       Q_OBJECT;
+       Q_OBJECT
 
 public:
        Int(QString name, QString desc, QString suffix,
                boost::optional< pair<int64_t, int64_t> > range,
-               Getter getter, Setter setter);
+               Getter getter, Setter setter, QString special_value_text = "");
 
        virtual ~Int() = default;
 
@@ -53,7 +53,7 @@ private Q_SLOTS:
        void on_value_changed(int);
 
 private:
-       const QString suffix_;
+       const QString suffix_, special_value_text_;
        const boost::optional< pair<int64_t, int64_t> > range_;
 
        Glib::VariantBase value_;
index 4ce352e11e5dacb2aaacfe4e726e3e94875daaef..da1c260e81302185e6c4570a8dc7fcf8e1bbde31 100644 (file)
@@ -40,7 +40,7 @@ namespace prop {
 
 class Property : public QObject
 {
-       Q_OBJECT;
+       Q_OBJECT
 
 public:
        typedef function<Glib::VariantBase ()> Getter;
index 8282cb7f5928616fb2b64da1b5420c6439948458..3e303568309e2449f1b1c564fb325770d9c60465 100644 (file)
@@ -29,7 +29,7 @@ namespace prop {
 
 class String : public Property
 {
-       Q_OBJECT;
+       Q_OBJECT
 
 public:
        String(QString name, QString desc, Getter getter, Setter setter);