]> sigrok.org Git - pulseview.git/commitdiff
Settings: Only show initial pin config UI elements if enabled
authorSoeren Apel <redacted>
Thu, 8 Jun 2017 20:08:19 +0000 (22:08 +0200)
committerSoeren Apel <redacted>
Thu, 8 Jun 2017 20:08:19 +0000 (22:08 +0200)
pv/dialogs/settings.cpp
pv/dialogs/settings.hpp
pv/globalsettings.cpp
pv/globalsettings.hpp
pv/view/decodetrace.cpp

index 8a3aef9c00a2103c86380f92a7c42df36d21cd3b..310b80e2147d6835ded84b10589daa4dbb89a6b8 100644 (file)
@@ -179,6 +179,11 @@ QWidget *Settings::get_decoder_settings_form(QWidget *parent) const
        QFormLayout *decoder_layout = new QFormLayout();
        decoder_group->setLayout(decoder_layout);
 
+       QCheckBox *initial_state_configurable_cb = new QCheckBox();
+       initial_state_configurable_cb->setChecked(settings.value(GlobalSettings::Key_Dec_InitialStateConfigurable).toBool());
+       connect(initial_state_configurable_cb, SIGNAL(stateChanged(int)), this, SLOT(on_dec_initialStateConfigurable_changed(int)));
+       decoder_layout->addRow(tr("Allow configuration of &initial signal state"), initial_state_configurable_cb);
+
        return form;
 #else
        (void)parent;
@@ -398,5 +403,11 @@ void Settings::on_view_showAnalogMinorGrid_changed(int state)
        settings.setValue(GlobalSettings::Key_View_ShowAnalogMinorGrid, state ? true : false);
 }
 
+void Settings::on_dec_initialStateConfigurable_changed(int state)
+{
+       GlobalSettings settings;
+       settings.setValue(GlobalSettings::Key_Dec_InitialStateConfigurable, state ? true : false);
+}
+
 } // namespace dialogs
 } // namespace pv
index 40b2a56a3e1231f3eed689e2873350ef012f71b2..bc6542d3e4243f5b90eccebcf5df9754b1418c66 100644 (file)
@@ -53,6 +53,7 @@ private Q_SLOTS:
        void on_view_stickyScrolling_changed(int state);
        void on_view_showSamplingPoints_changed(int state);
        void on_view_showAnalogMinorGrid_changed(int state);
+       void on_dec_initialStateConfigurable_changed(int state);
 
 private:
        DeviceManager &device_manager_;
index 925c48e1dff67826a0d52a038fee091a2d00479d..0eff1915d15ed5d151b4d1eb364d40247231c532 100644 (file)
@@ -30,6 +30,7 @@ const QString GlobalSettings::Key_View_ColouredBG = "View_ColouredBG";
 const QString GlobalSettings::Key_View_StickyScrolling = "View_StickyScrolling";
 const QString GlobalSettings::Key_View_ShowSamplingPoints = "View_ShowSamplingPoints";
 const QString GlobalSettings::Key_View_ShowAnalogMinorGrid = "View_ShowAnalogMinorGrid";
+const QString GlobalSettings::Key_Dec_InitialStateConfigurable = "Dec_InitialStateConfigurable";
 
 multimap< QString, function<void(QVariant)> > GlobalSettings::callbacks_;
 bool GlobalSettings::tracking_ = false;
index 1c07c308d71a5170e9c227a251fa14238aafde01..930bb5bbfcceee55f7fdea1cf9cab54831208901 100644 (file)
@@ -43,6 +43,7 @@ public:
        static const QString Key_View_StickyScrolling;
        static const QString Key_View_ShowSamplingPoints;
        static const QString Key_View_ShowAnalogMinorGrid;
+       static const QString Key_Dec_InitialStateConfigurable;
 
 public:
        GlobalSettings();
index ec441df40e055b5545f745fbe4a773904602c38b..89d335d7e0e8e572b64010c54b6bc252b212fe49 100644 (file)
@@ -40,6 +40,7 @@ extern "C" {
 
 #include "decodetrace.hpp"
 
+#include <pv/globalsettings.hpp>
 #include <pv/data/decode/annotation.hpp>
 #include <pv/data/decode/decoder.hpp>
 #include <pv/data/decoderstack.hpp>
@@ -781,6 +782,7 @@ void DecodeTrace::create_decoder_form(int index,
        QFormLayout *form)
 {
        const GSList *l;
+       GlobalSettings settings;
 
        assert(dec);
        const srd_decoder *const decoder = dec->decoder();
@@ -825,6 +827,9 @@ void DecodeTrace::create_decoder_form(int index,
                hlayout->addWidget(combo);
                hlayout->addWidget(combo_initial_pin);
 
+               if (!settings.value(GlobalSettings::Key_Dec_InitialStateConfigurable).toBool())
+                       combo_initial_pin->hide();
+
                decoder_form->addRow(tr("<b>%1</b> (%2) *")
                        .arg(QString::fromUtf8(pdch->name),
                             QString::fromUtf8(pdch->desc)), hlayout);
@@ -850,6 +855,9 @@ void DecodeTrace::create_decoder_form(int index,
                hlayout->addWidget(combo);
                hlayout->addWidget(combo_initial_pin);
 
+               if (!settings.value(GlobalSettings::Key_Dec_InitialStateConfigurable).toBool())
+                       combo_initial_pin->hide();
+
                decoder_form->addRow(tr("<b>%1</b> (%2)")
                        .arg(QString::fromUtf8(pdch->name),
                             QString::fromUtf8(pdch->desc)), hlayout);