fix(cpn): screen colors in simulator for B&W OLED radios (#4779)

This commit is contained in:
philmoz
2024-03-21 09:20:56 +10:00
committed by GitHub
parent 373b8e9355
commit 2ded1192a6
13 changed files with 114 additions and 224 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

@@ -29,13 +29,13 @@ SimulatedUIWidgetJumperT20::SimulatedUIWidgetJumperT20(SimulatorInterface *simul
m_backlightColors << QColor(255,195,151);
m_backlightColors << QColor(247,242,159);
ui->lcd->setBgDefaultColor(QColor(0, 0, 0));
ui->lcd->setFgDefaultColor(QColor(255, 255, 255));
setLcd(ui->lcd);
QString css = "#radioUiWidget {"
"background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1,"
"stop:0 rgba(255, 255, 255, 255),"
"stop:0.757062 rgba(241, 238, 238, 255),"
"stop:1 rgba(247, 245, 245, 255));"
"background-color: rgb(200, 200, 200);"
"}";
QTimer * tim = new QTimer(this);
@@ -1,5 +1,6 @@
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetJumperTPRO.h"
#include "eeprominterface.h"
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
@@ -31,13 +32,15 @@ SimulatedUIWidgetJumperTPRO::SimulatedUIWidgetJumperTPRO(SimulatorInterface *sim
m_backlightColors << QColor(255,195,151);
m_backlightColors << QColor(247,242,159);
if (getCurrentBoard() == Board::BOARD_JUMPER_TPROV2) {
ui->lcd->setBgDefaultColor(QColor(0, 0, 0));
ui->lcd->setFgDefaultColor(QColor(255, 255, 255));
}
setLcd(ui->lcd);
QString css = "#radioUiWidget {"
"background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1,"
"stop:0 rgba(255, 255, 255, 255),"
"stop:0.757062 rgba(241, 238, 238, 255),"
"stop:1 rgba(247, 245, 245, 255));"
"background-color: rgb(167, 167, 167);"
"}";
QTimer * tim = new QTimer(this);
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>725</width>
<height>389</height>
<width>726</width>
<height>368</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,14 +18,14 @@
</property>
<property name="minimumSize">
<size>
<width>725</width>
<height>389</height>
<width>726</width>
<height>368</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>501</width>
<height>310 </height>
<width>726</width>
<height>368</height>
</size>
</property>
<property name="windowTitle">
@@ -50,7 +50,7 @@
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0" rowspan="3">
<item row="0" column="0" rowspan="3">
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -75,7 +75,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="LcdWidget" name="lcd" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -86,13 +86,13 @@
<property name="minimumSize">
<size>
<width>256</width>
<height>231</height>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>231</height>
<height>128</height>
</size>
</property>
<property name="styleSheet">
@@ -100,7 +100,7 @@
</property>
</widget>
</item>
<item row="1" column="2" rowspan="3">
<item row="0" column="2" rowspan="3">
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -125,7 +125,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QWidget" name="top" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -135,14 +135,14 @@
</property>
<property name="minimumSize">
<size>
<width>255</width>
<height>85</height>
<width>256</width>
<height>97</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>255</width>
<height>85</height>
<width>256</width>
<height>97</height>
</size>
</property>
<property name="styleSheet">
@@ -150,7 +150,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="ButtonsWidget" name="bottombuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -160,14 +160,14 @@
</property>
<property name="minimumSize">
<size>
<width>255</width>
<height>131</height>
<width>256</width>
<height>143</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>255</width>
<height>131</height>
<width>256</width>
<height>143</height>
</size>
</property>
<property name="styleSheet">
@@ -175,68 +175,6 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>12</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>12</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(247, 245, 245);</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
@@ -37,6 +37,9 @@ SimulatedUIWidgetLR3PRO::SimulatedUIWidgetLR3PRO(SimulatorInterface *simulator,
m_backlightColors << QColor(255,195,151);
m_backlightColors << QColor(247,242,159);
ui->lcd->setBgDefaultColor(QColor(0, 0, 0));
ui->lcd->setFgDefaultColor(QColor(255, 255, 255));
setLcd(ui->lcd);
QString css = "#radioUiWidget {"
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>501</width>
<height>310</height>
<width>500</width>
<height>287</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,14 +18,14 @@
</property>
<property name="minimumSize">
<size>
<width>501</width>
<height>310</height>
<width>500</width>
<height>287</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>501</width>
<height>310</height>
<width>500</width>
<height>287</height>
</size>
</property>
<property name="windowTitle">
@@ -50,7 +50,57 @@
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0" rowspan="3">
<item row="1" column="1">
<widget class="LcdWidget" name="lcd" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>128</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(215, 243, 255);</string>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>122</width>
<height>287</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>122</width>
<height>287</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/LR3PRO/right.png)</string>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="3">
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -76,81 +126,6 @@
</widget>
</item>
<item row="2" column="1">
<widget class="LcdWidget" name="lcd" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>150</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(215, 243, 255);</string>
</property>
</widget>
</item>
<item row="1" column="2" rowspan="3">
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>122</width>
<height>287</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>122</width>
<height>287</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/LR3PRO/right.png)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="top" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>258</width>
<height>46</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>258</width>
<height>46</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/LR3PRO/top.png)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="ButtonsWidget" name="bottombuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -160,14 +135,14 @@
</property>
<property name="minimumSize">
<size>
<width>258</width>
<height>117</height>
<width>256</width>
<height>116</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>258</width>
<height>117</height>
<width>256</width>
<height>116</height>
</size>
</property>
<property name="styleSheet">
@@ -175,65 +150,28 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<item row="0" column="1">
<widget class="QWidget" name="top" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
<width>256</width>
<height>44</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>12</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>12</height>
<width>256</width>
<height>44</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(247, 245, 245);</string>
</property>
<property name="text">
<string notr="true"/>
<string notr="true">background:url(:/images/simulator/LR3PRO/top.png)</string>
</property>
</widget>
</item>
@@ -40,6 +40,11 @@ void LcdWidget::setBgDefaultColor(const QColor &color)
bgDefaultColor = color;
}
void LcdWidget::setFgDefaultColor(const QColor &color)
{
fgDefaultColor = color;
}
void LcdWidget::setBackgroundColor(const QColor &color) { bgColor = color; }
void LcdWidget::makeScreenshot(const QString &fileName)
@@ -118,7 +123,7 @@ void LcdWidget::doPaint(QPainter &p)
p.eraseRect(0, 0, 2 * lcdWidth, 2 * lcdHeight);
if (lcdDepth == 1) {
rgb = qRgb(0, 0, 0);
rgb = fgDefaultColor.rgb();
p.setPen(rgb);
p.setBrush(QBrush(rgb));
}
+4 -1
View File
@@ -46,7 +46,8 @@ class LcdWidget : public QWidget
QWidget(parent),
localBuf(NULL),
lightEnable(false),
bgDefaultColor(QColor(198, 208, 199))
bgDefaultColor(QColor(198, 208, 199)),
fgDefaultColor(QColor(0, 0, 0))
{
}
@@ -59,6 +60,7 @@ class LcdWidget : public QWidget
void setData(int width, int height, int depth = 1);
void setBgDefaultColor(const QColor &color);
void setFgDefaultColor(const QColor &color);
void setBackgroundColor(const QColor &color);
void makeScreenshot(const QString &fileName);
@@ -79,6 +81,7 @@ class LcdWidget : public QWidget
bool lightEnable;
QColor bgColor;
QColor bgDefaultColor;
QColor fgDefaultColor;
QMutex lcdMtx;
QElapsedTimer redrawTimer;