]> sigrok.org Git - pulseview.git/commitdiff
Introduce "logic trace height" setting
authorSoeren Apel <redacted>
Sun, 16 Jul 2017 19:29:26 +0000 (21:29 +0200)
committerSoeren Apel <redacted>
Sun, 16 Jul 2017 20:37:12 +0000 (22:37 +0200)
pv/dialogs/settings.cpp
pv/dialogs/settings.hpp
pv/globalsettings.cpp
pv/globalsettings.hpp

index 2c2ccfee4504ef5ccb93aeac80e9e089e261dbe8..ada41183becb816d47aeb973ea0697cfae4b8ba1 100644 (file)
@@ -180,6 +180,15 @@ QWidget *Settings::get_view_settings_form(QWidget *parent) const
                SLOT(on_view_defaultDivHeight_changed(int)));
        trace_view_layout->addRow(tr("Default analog trace div height"), default_div_height_sb);
 
+       QSpinBox *default_logic_height_sb = new QSpinBox();
+       default_logic_height_sb->setRange(5, 1000);
+       default_logic_height_sb->setSuffix(tr(" pixels"));
+       default_logic_height_sb->setValue(
+               settings.value(GlobalSettings::Key_View_DefaultLogicHeight).toInt());
+       connect(default_logic_height_sb, SIGNAL(valueChanged(int)), this,
+               SLOT(on_view_defaultLogicHeight_changed(int)));
+       trace_view_layout->addRow(tr("Default logic trace height"), default_logic_height_sb);
+
        return form;
 }
 
@@ -433,6 +442,12 @@ void Settings::on_view_defaultDivHeight_changed(int value)
        settings.setValue(GlobalSettings::Key_View_DefaultDivHeight, value);
 }
 
+void Settings::on_view_defaultLogicHeight_changed(int value)
+{
+       GlobalSettings settings;
+       settings.setValue(GlobalSettings::Key_View_DefaultLogicHeight, value);
+}
+
 void Settings::on_dec_initialStateConfigurable_changed(int state)
 {
        GlobalSettings settings;
index b01b5da9626b10672f4dfda1dfa54556b0e52dba..ca8291def8c7b2f496088b335d15f4025942e691 100644 (file)
@@ -57,6 +57,7 @@ private Q_SLOTS:
        void on_view_showSamplingPoints_changed(int state);
        void on_view_showAnalogMinorGrid_changed(int state);
        void on_view_defaultDivHeight_changed(int value);
+       void on_view_defaultLogicHeight_changed(int value);
        void on_dec_initialStateConfigurable_changed(int state);
 
 private:
index d437c16681983711b842678b8323e49ec9a034ed..6ec4a8e95635677b20d3afa2abf66755f41ef15b 100644 (file)
@@ -37,6 +37,7 @@ 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_View_DefaultDivHeight = "View_DefaultDivHeight";
+const QString GlobalSettings::Key_View_DefaultLogicHeight = "View_DefaultLogicHeight";
 const QString GlobalSettings::Key_Dec_InitialStateConfigurable = "Dec_InitialStateConfigurable";
 
 multimap< QString, function<void(QVariant)> > GlobalSettings::callbacks_;
@@ -66,6 +67,10 @@ void GlobalSettings::set_defaults_where_needed()
        if (!contains(Key_View_DefaultDivHeight))
                setValue(Key_View_DefaultDivHeight,
                3 * QFontMetrics(QApplication::font()).height());
+
+       if (!contains(Key_View_DefaultLogicHeight))
+               setValue(Key_View_DefaultLogicHeight,
+               2 * QFontMetrics(QApplication::font()).height());
 }
 
 void GlobalSettings::register_change_handler(const QString key,
index 317805a72f3ddc1ff5fb4fb5828048ebdaa6bdfd..7bbff59fa9068d4b2f4650b5ea35b4521ddb1e0f 100644 (file)
@@ -47,6 +47,7 @@ public:
        static const QString Key_View_ShowSamplingPoints;
        static const QString Key_View_ShowAnalogMinorGrid;
        static const QString Key_View_DefaultDivHeight;
+       static const QString Key_View_DefaultLogicHeight;
        static const QString Key_Dec_InitialStateConfigurable;
 
 public: