Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions l10n/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ A human-readable form has been saved to disk and was written to the log. You may
<source>Default logic trace height</source>
<translation>Standardgröße von Logikkanälen</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="390"/>
<source>Logic channel color offset</source>
<translation>Farbe des Logikkanälen</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="405"/>
<source>Allow configuration of &amp;initial signal state</source>
Expand Down
5 changes: 5 additions & 0 deletions l10n/es_MX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,11 @@ Se guardó un formulario legible para humanosen el disco y fue escrito en el log
<source>Default logic trace height</source>
<translation>Altura de trazo lógico por defecto</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="408"/>
<source>Logic channel color offset</source>
<translation>Color del canal lógico</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="423"/>
<source>Allow configuration of &amp;initial signal state</source>
Expand Down
5 changes: 5 additions & 0 deletions l10n/ja_jp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ A human-readable form has been saved to disk and was written to the log. You may
<source>Default logic trace height</source>
<translation>デフォルトのロジックトレースの高さ</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="399"/>
<source>Logic channel color offset</source>
<translation>ロジックチャンネルの色</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="414"/>
<source>Allow configuration of &amp;initial signal state</source>
Expand Down
5 changes: 5 additions & 0 deletions l10n/zh_cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ A human-readable form has been saved to disk and was written to the log. You may
<source>Default logic trace height</source>
<translation>逻辑通道垂直高度</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="404"/>
<source>Logic channel color offset</source>
<translation>逻辑通道颜色</translation>
</message>
<message>
<location filename="../pv/dialogs/settings.cpp" line="419"/>
<source>Allow configuration of &amp;initial signal state</source>
Expand Down
6 changes: 5 additions & 1 deletion pv/data/signalbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <extdef.h>
#include <pv/session.hpp>
#include <pv/globalsettings.hpp>
#include <pv/binding/decoder.hpp>

using std::dynamic_pointer_cast;
Expand Down Expand Up @@ -132,6 +133,9 @@ SignalBase::SignalBase(shared_ptr<sigrok::Channel> 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);
Expand All @@ -140,7 +144,7 @@ SignalBase::SignalBase(shared_ptr<sigrok::Channel> 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)]);
}
Expand Down
14 changes: 14 additions & 0 deletions pv/dialogs/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions pv/dialogs/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions pv/globalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions pv/globalsettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down