diff --git a/l10n/de.ts b/l10n/de.ts index 5553fa8b..f9436c1e 100644 --- a/l10n/de.ts +++ b/l10n/de.ts @@ -545,6 +545,11 @@ A human-readable form has been saved to disk and was written to the log. You may Default logic trace height Standardgröße von Logikkanälen + + + Logic channel color offset + Farbe des Logikkanälen + Allow configuration of &initial signal state diff --git a/l10n/es_MX.ts b/l10n/es_MX.ts index 77afc7fe..147f0968 100644 --- a/l10n/es_MX.ts +++ b/l10n/es_MX.ts @@ -596,6 +596,11 @@ Se guardó un formulario legible para humanosen el disco y fue escrito en el log Default logic trace height Altura de trazo lógico por defecto + + + Logic channel color offset + Color del canal lógico + Allow configuration of &initial signal state diff --git a/l10n/ja_jp.ts b/l10n/ja_jp.ts index 164ea30f..025be7e0 100644 --- a/l10n/ja_jp.ts +++ b/l10n/ja_jp.ts @@ -578,6 +578,11 @@ A human-readable form has been saved to disk and was written to the log. You may Default logic trace height デフォルトのロジックトレースの高さ + + + Logic channel color offset + ロジックチャンネルの色 + Allow configuration of &initial signal state diff --git a/l10n/zh_cn.ts b/l10n/zh_cn.ts index 937a96cb..e5544200 100644 --- a/l10n/zh_cn.ts +++ b/l10n/zh_cn.ts @@ -578,6 +578,11 @@ A human-readable form has been saved to disk and was written to the log. You may Default logic trace height 逻辑通道垂直高度 + + + Logic channel color offset + 逻辑通道颜色 + Allow configuration of &initial signal state diff --git a/pv/data/signalbase.cpp b/pv/data/signalbase.cpp index 97f70508..36e10358 100644 --- a/pv/data/signalbase.cpp +++ b/pv/data/signalbase.cpp @@ -30,6 +30,7 @@ #include #include +#include #include using std::dynamic_pointer_cast; @@ -132,6 +133,9 @@ SignalBase::SignalBase(shared_ptr channel, ChannelType channel_ set_index(channel_->index()); } + GlobalSettings settings; + int color_offset = settings.value(GlobalSettings::Key_View_LogicColorOffset).toInt(); + connect(&delayed_conversion_starter_, SIGNAL(timeout()), this, SLOT(on_delayed_conversion_start())); delayed_conversion_starter_.setSingleShot(true); @@ -140,7 +144,7 @@ SignalBase::SignalBase(shared_ptr channel, ChannelType channel_ // Only logic and analog SR channels can have their colors auto-set // because for them, we have an index that can be used if (channel_type == LogicChannel) - set_color(LogicSignalColors[index() % countof(LogicSignalColors)]); + set_color(LogicSignalColors[(index() + color_offset) % countof(LogicSignalColors)]); else if (channel_type == AnalogChannel) set_color(AnalogSignalColors[index() % countof(AnalogSignalColors)]); } diff --git a/pv/dialogs/settings.cpp b/pv/dialogs/settings.cpp index 55b7e826..288f7858 100644 --- a/pv/dialogs/settings.cpp +++ b/pv/dialogs/settings.cpp @@ -399,6 +399,14 @@ QWidget *Settings::get_view_settings_form(QWidget *parent) const SLOT(on_view_defaultLogicHeight_changed(int))); trace_view_layout->addRow(tr("Default logic trace height"), default_logic_height_sb); + QSpinBox *logic_color_offset_sb = new QSpinBox(); + logic_color_offset_sb->setRange(0, 10); + logic_color_offset_sb->setValue( + settings.value(GlobalSettings::Key_View_LogicColorOffset).toInt()); + connect(logic_color_offset_sb, SIGNAL(valueChanged(int)), this, + SLOT(on_view_logicColorOffset_changed(int))); + trace_view_layout->addRow(tr("Logic channel color offset"), logic_color_offset_sb); + return form; } @@ -805,6 +813,12 @@ void Settings::on_view_defaultLogicHeight_changed(int value) settings.setValue(GlobalSettings::Key_View_DefaultLogicHeight, value); } +void Settings::on_view_logicColorOffset_changed(int value) +{ + GlobalSettings settings; + settings.setValue(GlobalSettings::Key_View_LogicColorOffset, value); +} + #ifdef ENABLE_DECODE void Settings::on_dec_initialStateConfigurable_changed(int state) { diff --git a/pv/dialogs/settings.hpp b/pv/dialogs/settings.hpp index bd3572ff..3e67bfde 100644 --- a/pv/dialogs/settings.hpp +++ b/pv/dialogs/settings.hpp @@ -80,6 +80,7 @@ private Q_SLOTS: void on_view_conversionThresholdDispMode_changed(int state); void on_view_defaultDivHeight_changed(int value); void on_view_defaultLogicHeight_changed(int value); + void on_view_logicColorOffset_changed(int value); #ifdef ENABLE_DECODE void on_dec_initialStateConfigurable_changed(int state); void on_dec_exportFormat_changed(const QString &text); diff --git a/pv/globalsettings.cpp b/pv/globalsettings.cpp index ecca21d5..cd406271 100644 --- a/pv/globalsettings.cpp +++ b/pv/globalsettings.cpp @@ -66,6 +66,7 @@ const QString GlobalSettings::Key_View_ShowAnalogMinorGrid = "View_ShowAnalogMin const QString GlobalSettings::Key_View_ConversionThresholdDispMode = "View_ConversionThresholdDispMode"; const QString GlobalSettings::Key_View_DefaultDivHeight = "View_DefaultDivHeight"; const QString GlobalSettings::Key_View_DefaultLogicHeight = "View_DefaultLogicHeight"; +const QString GlobalSettings::Key_View_LogicColorOffset = "View_LogicColorOffset"; const QString GlobalSettings::Key_View_ShowHoverMarker = "View_ShowHoverMarker"; const QString GlobalSettings::Key_View_KeepRulerItemSelected = "View_KeepRulerItemSelected"; const QString GlobalSettings::Key_View_SnapDistance = "View_SnapDistance"; @@ -150,6 +151,9 @@ void GlobalSettings::set_defaults_where_needed() setValue(Key_View_DefaultLogicHeight, 2 * QFontMetrics(QApplication::font()).height()); + if (!contains(Key_View_LogicColorOffset)) + setValue(Key_View_LogicColorOffset, 0); + if (!contains(Key_View_ShowHoverMarker)) setValue(Key_View_ShowHoverMarker, true); diff --git a/pv/globalsettings.hpp b/pv/globalsettings.hpp index f6239a6b..080b519f 100644 --- a/pv/globalsettings.hpp +++ b/pv/globalsettings.hpp @@ -71,6 +71,7 @@ class GlobalSettings : public QSettings static const QString Key_View_ConversionThresholdDispMode; static const QString Key_View_DefaultDivHeight; static const QString Key_View_DefaultLogicHeight; + static const QString Key_View_LogicColorOffset; static const QString Key_View_ShowHoverMarker; static const QString Key_View_KeepRulerItemSelected; static const QString Key_View_SnapDistance;