chore(cpn): simulators for EL18, TProV2, Pocket, T20 (#4687)

This commit is contained in:
Peter Feerick
2024-03-14 19:07:52 +10:00
committed by GitHub
parent 46f9cfc0cd
commit ab2b773b14
20 changed files with 605 additions and 8 deletions
+2
View File
@@ -36,11 +36,13 @@ set(${PROJECT_NAME}_SRCS
simulateduiwidgetJumperT12.cpp
simulateduiwidgetJumperT16.cpp
simulateduiwidgetJumperT18.cpp
simulateduiwidgetJumperT20.cpp
simulateduiwidgetJumperTLITE.cpp
simulateduiwidgetJumperTPRO.cpp
simulateduiwidgetLR3PRO.cpp
simulateduiwidgetNV14.cpp
simulateduiwidgetPL18.cpp
simulateduiwidgetPocket.cpp
simulateduiwidgetT8.cpp
simulateduiwidgetTX12.cpp
simulateduiwidgetTX16S.cpp
@@ -118,10 +118,12 @@ namespace Ui {
class SimulatedUIWidgetJumperTPRO;
class SimulatedUIWidgetJumperT16;
class SimulatedUIWidgetJumperT18;
class SimulatedUIWidgetJumperT20;
class SimulatedUIWidgetTX16S;
class SimulatedUIWidgetTX12;
class SimulatedUIWidgetZorro;
class SimulatedUIWidgetBoxer;
class SimulatedUIWidgetPocket;
class SimulatedUIWidgetT8;
class SimulatedUIWidgetNV14;
class SimulatedUIWidgetEL18;
@@ -324,6 +326,18 @@ class SimulatedUIWidgetJumperT18: public SimulatedUIWidget
Ui::SimulatedUIWidgetJumperT18 * ui;
};
class SimulatedUIWidgetJumperT20: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetJumperT20(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetJumperT20();
private:
Ui::SimulatedUIWidgetJumperT20 * ui;
};
class SimulatedUIWidgetTX12: public SimulatedUIWidget
{
Q_OBJECT
@@ -360,6 +374,18 @@ class SimulatedUIWidgetBoxer: public SimulatedUIWidget
Ui::SimulatedUIWidgetBoxer * ui;
};
class SimulatedUIWidgetPocket: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetPocket(SimulatorInterface * simulator, QWidget * parent = nullptr);
virtual ~SimulatedUIWidgetPocket();
private:
Ui::SimulatedUIWidgetPocket * ui;
};
class SimulatedUIWidgetT8: public SimulatedUIWidget
{
Q_OBJECT
@@ -0,0 +1,52 @@
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetJumperT20.h"
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
SimulatedUIWidgetJumperT20::SimulatedUIWidgetJumperT20(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetJumperT20)
{
RadioUiAction * act;
ui->setupUi(this);
act = new RadioUiAction(0, QList<int>() << Qt::Key_PageUp << Qt::Key_Up, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_MENU_ICN);
addRadioWidget(ui->leftbuttons->addArea(QRect(0, 30, 51, 28), "JumperT20/left.png", act));
act = new RadioUiAction(3, QList<int>() << Qt::Key_PageDown << Qt::Key_Down, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_PAGE);
addRadioWidget(ui->leftbuttons->addArea(QRect(0, 70, 51, 28), "JumperT20/left.png", act));
act = new RadioUiAction(1, QList<int>() << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_EXIT);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 110, 51, 28), "JumperT20/left.png", act));
m_mouseMidClickAction = new RadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
addRadioWidget(ui->rightbuttons->addArea(QRect(130, 50, 50, 70), "JumperT20/right.png", m_mouseMidClickAction));
m_backlightColors << QColor(215, 243, 255); // X7 Blue
m_backlightColors << QColor(166,247,159);
m_backlightColors << QColor(247,159,166);
m_backlightColors << QColor(255,195,151);
m_backlightColors << QColor(247,242,159);
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));"
"}";
QTimer * tim = new QTimer(this);
tim->setSingleShot(true);
connect(tim, &QTimer::timeout, [this, css]() {
emit customStyleRequest(css);
});
tim->start(100);
}
SimulatedUIWidgetJumperT20::~SimulatedUIWidgetJumperT20()
{
delete ui;
}
@@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SimulatedUIWidgetJumperT20</class>
<widget class="QWidget" name="SimulatedUIWidgetJumperT20">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>164</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>627</width>
<height>164</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>627</width>
<height>164</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">Jumper T20 Simulator</string>
</property>
<property name="styleSheet">
<string notr="true">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));</string>
</property>
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>184</width>
<height>164</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/left.png);</string>
</property>
</widget>
<widget class="LcdWidget" name="lcd" native="true">
<property name="geometry">
<rect>
<x>184</x>
<y>19</y>
<width>256</width>
<height>128</height>
</rect>
</property>
<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>
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="geometry">
<rect>
<x>440</x>
<y>0</y>
<width>184</width>
<height>164</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>184</width>
<height>164</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/right.png)</string>
</property>
</widget>
<widget class="QWidget" name="top" native="true">
<property name="geometry">
<rect>
<x>184</x>
<y>0</y>
<width>256</width>
<height>19</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>19</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>19</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/top.png)</string>
</property>
</widget>
<widget class="QWidget" name="bottom" native="true">
<property name="geometry">
<rect>
<x>184</x>
<y>147</y>
<width>256</width>
<height>17</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>17</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>17</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT20/bottom.png)</string>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>LcdWidget</class>
<extends>QWidget</extends>
<header>lcdwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonsWidget</class>
<extends>QWidget</extends>
<header>buttonswidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../companion.qrc"/>
</resources>
<connections/>
</ui>
@@ -0,0 +1,67 @@
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetPocket.h"
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
SimulatedUIWidgetPocket::SimulatedUIWidgetPocket(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetPocket)
{
RadioUiAction * act;
ui->setupUi(this);
// add actions in order of appearance on the help menu
act = new RadioUiAction(12, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_MDL);
addRadioWidget(ui->rightbuttons->addArea(QRect(30, 95, 60, 60), "Pocket/right.png", act));
m_mouseMidClickAction = new RadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
addRadioWidget(ui->rightbuttons->addArea(QRect(130, 60, 60, 130), "Pocket/right.png", m_mouseMidClickAction));
act = new RadioUiAction(14, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_SYS);
addRadioWidget(ui->leftbuttons->addArea(QRect(150, 95, 60, 60), "Pocket/left.png", act));
act = new RadioUiAction(13, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_TELE);
addRadioWidget(ui->leftbuttons->addArea(QRect(40, 179, 60, 30), "Pocket/left.png", act));
act = new RadioUiAction(5, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
addRadioWidget(ui->leftbuttons->addArea(QRect(40, 90, 60, 30), "Pocket/left.png", act));
act = new RadioUiAction(4, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
addRadioWidget(ui->leftbuttons->addArea(QRect(40, 130, 60, 30), "Pocket/left.png", act));
act = new RadioUiAction(1, QList<int>() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_EXIT);
addRadioWidget(ui->leftbuttons->addArea(QRect(40, 40, 60, 30), "Pocket/left.png", act));
m_scrollUpAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Minus << Qt::Key_Equal << Qt::Key_Left, SIMU_STR_HLP_KEYS_GO_LFT, SIMU_STR_HLP_ACT_ROT_LFT);
m_scrollDnAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Right, SIMU_STR_HLP_KEYS_GO_RGT, SIMU_STR_HLP_ACT_ROT_RGT);
connectScrollActions();
m_backlightColors << QColor(215, 243, 255); // X7 Blue
m_backlightColors << QColor(166,247,159);
m_backlightColors << QColor(247,159,166);
m_backlightColors << QColor(255,195,151);
m_backlightColors << QColor(247,242,159);
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));"
"}";
QTimer * tim = new QTimer(this);
tim->setSingleShot(true);
connect(tim, &QTimer::timeout, [this, css]() {
emit customStyleRequest(css);
});
tim->start(100);
}
SimulatedUIWidgetPocket::~SimulatedUIWidgetPocket()
{
delete ui;
}
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SimulatedUIWidgetPocket</class>
<widget class="QWidget" name="SimulatedUIWidgetPocket">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>737</width>
<height>246</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>737</width>
<height>246</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>737</width>
<height>246</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">Radiomaster Pocket Simulator</string>
</property>
<property name="styleSheet">
<string notr="true">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));</string>
</property>
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>241</width>
<height>246</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>241</width>
<height>246</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>241</width>
<height>246</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/Pocket/left.png);</string>
</property>
</widget>
<widget class="ButtonsWidget" name="rightbuttons" native="true">
<property name="geometry">
<rect>
<x>496</x>
<y>0</y>
<width>241</width>
<height>246</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>241</width>
<height>246</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>241</width>
<height>246</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/Pocket/right.png)</string>
</property>
</widget>
<widget class="QWidget" name="bottom" native="true">
<property name="geometry">
<rect>
<x>241</x>
<y>188</y>
<width>255</width>
<height>58</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>255</width>
<height>58</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>255</width>
<height>58</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/Pocket/bottom.png)</string>
</property>
</widget>
<widget class="LcdWidget" name="lcd" native="true">
<property name="geometry">
<rect>
<x>240</x>
<y>59</y>
<width>256</width>
<height>128</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>424</width>
<height>180</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(215, 243, 255);</string>
</property>
</widget>
<widget class="QWidget" name="top" native="true">
<property name="geometry">
<rect>
<x>241</x>
<y>0</y>
<width>255</width>
<height>59</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>255</width>
<height>59</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>255</width>
<height>59</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/Pocket/top.png)</string>
</property>
</widget>
<zorder>bottom</zorder>
<zorder>top</zorder>
<zorder>rightbuttons</zorder>
<zorder>leftbuttons</zorder>
<zorder>lcd</zorder>
</widget>
<customwidgets>
<customwidget>
<class>LcdWidget</class>
<extends>QWidget</extends>
<header>lcdwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonsWidget</class>
<extends>QWidget</extends>
<header>buttonswidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../companion.qrc"/>
</resources>
<connections/>
</ui>
@@ -111,6 +111,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
case Board::BOARD_JUMPER_T18:
radioUiWidget = new SimulatedUIWidgetJumperT18(simulator, this);
break;
case Board::BOARD_JUMPER_T20:
radioUiWidget = new SimulatedUIWidgetJumperT20(simulator, this);
break;
case Board::BOARD_RADIOMASTER_TX12:
case Board::BOARD_RADIOMASTER_TX12_MK2:
radioUiWidget = new SimulatedUIWidgetTX12(simulator, this);
@@ -136,6 +139,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
case Board::BOARD_FLYSKY_PL18:
radioUiWidget = new SimulatedUIWidgetPL18(simulator, this);
break;
case Board::BOARD_RADIOMASTER_POCKET:
radioUiWidget = new SimulatedUIWidgetPocket(simulator, this);
break;
default:
radioUiWidget = new SimulatedUIWidget9X(simulator, this);
break;