From: Soeren Apel Date: Sun, 16 Jul 2017 19:29:26 +0000 (+0200) Subject: Introduce "logic trace height" setting X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=48051ccba42d9205959658d6165546334878ad17;p=pulseview.git Introduce "logic trace height" setting --- diff --git a/pv/dialogs/settings.cpp b/pv/dialogs/settings.cpp index 2c2ccfee..ada41183 100644 --- a/pv/dialogs/settings.cpp +++ b/pv/dialogs/settings.cpp @@ -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; diff --git a/pv/dialogs/settings.hpp b/pv/dialogs/settings.hpp index b01b5da9..ca8291de 100644 --- a/pv/dialogs/settings.hpp +++ b/pv/dialogs/settings.hpp @@ -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: diff --git a/pv/globalsettings.cpp b/pv/globalsettings.cpp index d437c166..6ec4a8e9 100644 --- a/pv/globalsettings.cpp +++ b/pv/globalsettings.cpp @@ -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 > 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, diff --git a/pv/globalsettings.hpp b/pv/globalsettings.hpp index 317805a7..7bbff59f 100644 --- a/pv/globalsettings.hpp +++ b/pv/globalsettings.hpp @@ -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: