From 5a13525ea1106a991162813d27873a5acca20e5c Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 19 Jul 2015 19:39:16 +0200 Subject: [PATCH] Experimental slightly dimmer main frequency dial implmented for BladeRF plugin --- include-gpl/gui/colormapper.h | 5 +++++ plugins/samplesource/bladerf/bladerfgui.cpp | 2 ++ sdrbase/gui/colormapper.cpp | 18 ++++++++++++++++++ sdrbase/gui/valuedial.cpp | 9 ++++----- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/include-gpl/gui/colormapper.h b/include-gpl/gui/colormapper.h index 336a2aa7c..6b8674d21 100644 --- a/include-gpl/gui/colormapper.h +++ b/include-gpl/gui/colormapper.h @@ -17,6 +17,7 @@ class SDRANGELOVE_API ColorMapper public: enum Theme { Normal, + Gold, ReverseGold, }; @@ -29,6 +30,8 @@ public: const QColor& getForegroundColor() const { return m_foregroundColor; }; const QColor& getSecondaryForegroundColor() const { return m_secondaryForegroundColor; }; const QColor& getHighlightColor() const { return m_highlightColor; }; + const QColor& getBoundaryColor() const { return m_boundaryColor; }; + const QColor& getBoundaryAlphaColor() const { return m_boundaryAlphaColor; }; private: Theme m_theme; @@ -36,6 +39,8 @@ private: QColor m_foregroundColor; QColor m_secondaryForegroundColor; QColor m_highlightColor; + QColor m_boundaryColor; + QColor m_boundaryAlphaColor; }; #endif /* INCLUDE_GPL_GUI_COLORMAPPER_H_ */ diff --git a/plugins/samplesource/bladerf/bladerfgui.cpp b/plugins/samplesource/bladerf/bladerfgui.cpp index f7cbba6e6..d8dc0f5eb 100644 --- a/plugins/samplesource/bladerf/bladerfgui.cpp +++ b/plugins/samplesource/bladerf/bladerfgui.cpp @@ -19,6 +19,7 @@ #include "ui_bladerfgui.h" #include "plugin/pluginapi.h" +#include "gui/colormapper.h" #include "bladerfgui.h" BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) : @@ -29,6 +30,7 @@ BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) : m_sampleSource(NULL) { ui->setupUi(this); + ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::Gold)); ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); displaySettings(); diff --git a/sdrbase/gui/colormapper.cpp b/sdrbase/gui/colormapper.cpp index cc36c8788..781c82a66 100644 --- a/sdrbase/gui/colormapper.cpp +++ b/sdrbase/gui/colormapper.cpp @@ -12,6 +12,20 @@ ColorMapper::ColorMapper(Theme theme) : { switch (m_theme) { + case Gold: + m_dialBackgroundcolorMap.push_back(std::pair(0.0, QColor(0x40, 0x36, 0x2b))); + m_dialBackgroundcolorMap.push_back(std::pair(0.1, QColor(0xbf, 0xa3, 0x80))); + m_dialBackgroundcolorMap.push_back(std::pair(0.2, QColor(0xf0, 0xcc, 0xa1))); + m_dialBackgroundcolorMap.push_back(std::pair(0.5, QColor(0xff, 0xd9, 0xab))); + m_dialBackgroundcolorMap.push_back(std::pair(0.8, QColor(0xd1, 0xb2, 0x8c))); + m_dialBackgroundcolorMap.push_back(std::pair(0.9, QColor(0xa1, 0x89, 0x6c))); + m_dialBackgroundcolorMap.push_back(std::pair(1.0, QColor(0x40, 0x36, 0x2b))); + m_foregroundColor = QColor(0x00, 0x00, 0x00); + m_secondaryForegroundColor = QColor(0x0f, 0x0d, 0x0a); + m_highlightColor = QColor(0xff, 0xd9, 0xab, 0x80); + m_boundaryColor = QColor(0x21, 0x1c, 0x16); + m_boundaryAlphaColor = QColor(0x00, 0x00, 0x00, 0x20); + break; case ReverseGold: /* m_dialBackgroundcolorMap.push_back(std::pair(0.0, QColor(0x97, 0x54, 0x00))); @@ -32,6 +46,8 @@ ColorMapper::ColorMapper(Theme theme) : m_foregroundColor = QColor(0xff, 0x8b, 0x00); m_secondaryForegroundColor = QColor(0xff, 0xc5, 0x80); m_highlightColor = QColor(0xbf, 0x69, 0x00, 0x80); + m_boundaryColor = QColor(0x66, 0x38, 0x20); + m_boundaryAlphaColor = QColor(0xff, 0x8b, 0x00, 0x20); break; case Normal: default: @@ -45,6 +61,8 @@ ColorMapper::ColorMapper(Theme theme) : m_foregroundColor = QColor(0x00, 0x00, 0x00); m_secondaryForegroundColor = QColor(0x10, 0x10, 0x10); m_highlightColor = QColor(0xff, 0x00, 0x00, 0x20); + m_boundaryColor = QColor(0x20, 0x20, 0x20); + m_boundaryAlphaColor = QColor(0x00, 0x00, 0x00, 0x20); } } diff --git a/sdrbase/gui/valuedial.cpp b/sdrbase/gui/valuedial.cpp index 3c59f58ae..f6d516eba 100644 --- a/sdrbase/gui/valuedial.cpp +++ b/sdrbase/gui/valuedial.cpp @@ -172,22 +172,21 @@ void ValueDial::paintEvent(QPaintEvent*) painter.drawRect(0, 0, width() - 1, height() - 1); - painter.setPen(QColor(0x20, 0x20, 0x20)); + painter.setPen(m_colorMapper.getBoundaryColor()); painter.setBrush(Qt::NoBrush); for(int i = 1; i < m_numDigits + m_numDecimalPoints; i++) { - painter.setPen(QColor(0x20, 0x20, 0x20)); + painter.setPen(m_colorMapper.getBoundaryColor()); painter.drawLine(1 + i * m_digitWidth, 1, 1 + i * m_digitWidth, height() - 1); - painter.setPen(QColor(0x00, 0x00, 0x00, 0x20)); + painter.setPen(m_colorMapper.getBoundaryAlphaColor()); painter.drawLine(0 + i * m_digitWidth, 1, 0 + i * m_digitWidth, height() - 1); painter.drawLine(2 + i * m_digitWidth, 1, 2 + i * m_digitWidth, height() - 1); } - painter.setPen(QColor(0x00, 0x00, 0x00, 0x20)); + painter.setPen(m_colorMapper.getBoundaryAlphaColor()); painter.drawLine(1, 1, 1, height() - 1); painter.drawLine(width() - 2, 1, width() - 2, height() - 1); if(m_hightlightedDigit >= 0) { painter.setPen(Qt::NoPen); - painter.setBrush(QColor(0xff, 0x00, 0x00, 0x20)); painter.setBrush(m_colorMapper.getHighlightColor()); painter.drawRect(2 + m_hightlightedDigit * m_digitWidth, 1, m_digitWidth - 1, height() - 1); }