feat(sim): hat switches support for NV14 and EL18 (#3932)

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
Neil Horne
2024-10-22 12:56:39 +10:00
committed by GitHub
co-authored by Peter Feerick
parent dc7d329e92
commit b35223e2d4
22 changed files with 102 additions and 82 deletions
+12 -2
View File
@@ -332,10 +332,20 @@
<file>images/simulator/TX16S/left_tele.png</file>
<file>images/simulator/TX16S/right_ent.png</file>
<file>images/simulator/TX16S/right_mdl.png</file>
<file>images/simulator/NV14/left.png</file>
<file>images/simulator/NV14/right.png</file>
<file>images/simulator/NV14/top.png</file>
<file>images/simulator/NV14/bottom.png</file>
<file>images/simulator/NV14/lhs.png</file>
<file>images/simulator/NV14/rhs.png</file>
<file>images/simulator/NV14/lhs_hat_left.png</file>
<file>images/simulator/NV14/lhs_hat_right.png</file>
<file>images/simulator/NV14/lhs_hat_up.png</file>
<file>images/simulator/NV14/lhs_hat_down.png</file>
<file>images/simulator/NV14/lhs_hat_press.png</file>
<file>images/simulator/NV14/rhs_hat_left.png</file>
<file>images/simulator/NV14/rhs_hat_right.png</file>
<file>images/simulator/NV14/rhs_hat_up.png</file>
<file>images/simulator/NV14/rhs_hat_down.png</file>
<file>images/simulator/NV14/rhs_hat_press.png</file>
<file>images/simulator/PL18/left.png</file>
<file>images/simulator/PL18/right.png</file>
<file>images/simulator/PL18/top.png</file>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 794 B

@@ -34,38 +34,40 @@ SimulatedUIWidgetEL18::SimulatedUIWidgetEL18(SimulatorInterface *simulator, QWid
// add actions in order of appearance on the help menu
// Note: the EL18 has no physical buttons though at some point the trim joystick is repurposed
// allow for colorlcd key events and see what works
// the mouse click areas do not map to visual buttons on the background images
act = new RadioUiAction(KEY_SYS, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_SYS);
addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(65, 15), QSize(40, 40)), "NV14/lhs_hat_up.png", act));
act = new RadioUiAction(KEY_MODEL, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_MDL);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 1, 80, 35), "NV14/left.png", act));
//act = new RadioUiAction(13, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_EXIT);
//addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(5, 75), QSize(40, 40)), "NV14/lhs_hat_left.png", act));
m_mouseMidClickAction = new RadioUiAction(KEY_ENTER, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 40, 80, 35), "NV14/left.png", m_mouseMidClickAction));
act = new RadioUiAction(KEY_MODEL, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_MDL);
addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(130, 75), QSize(40, 40)), "NV14/lhs_hat_right.png", act));
act = new RadioUiAction(KEY_SYS, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_SYS);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 80, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_TELE, QList<int>() << Qt::Key_Down, SIMU_STR_HLP_KEY_DN, SIMU_STR_HLP_ACT_TELE);
addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(65, 140), QSize(40, 40)), "NV14/lhs_hat_down.png", act));
act = new RadioUiAction(KEY_TELE, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_TELE);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 120, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_EXIT, 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(QPoint(60, 70), QSize(50, 50)), "NV14/lhs_hat_press.png", act));
act = new RadioUiAction(KEY_PAGEDN, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 160, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_UP, QList<int>() << Qt::Key_Plus, SIMU_STR_HLP_KEY_PLS, SIMU_STR_HLP_ACT_PREVINC);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(95, 15), QSize(40, 40)), "NV14/rhs_hat_up.png", act));
act = new RadioUiAction(KEY_PAGEUP, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 200, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_PAGEUP, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(35, 75), QSize(40, 40)), "NV14/rhs_hat_left.png", act));
act = new RadioUiAction(KEY_EXIT, QList<int>() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace,
SIMU_STR_HLP_KEY_DN % "<br>" % SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_RTN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 240, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_PAGEDN, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(160, 75), QSize(40, 40)), "NV14/rhs_hat_right.png", act));
act = new RadioUiAction(KEY_DOWN, QList<int>() << Qt::Key_Minus, SIMU_STR_HLP_KEY_MIN, SIMU_STR_HLP_ACT_NEXTDEC);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(95, 140), QSize(40, 40)), "NV14/rhs_hat_down.png", act));
act = new RadioUiAction(KEY_ENTER, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ENT);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(90, 70), QSize(50, 50)), "NV14/rhs_hat_press.png", act));
m_scrollUpAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Minus, SIMU_STR_HLP_KEY_MIN % "|" % SIMU_STR_HLP_MOUSE_UP, SIMU_STR_HLP_ACT_ROT_LFT);
m_scrollDnAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Equal, SIMU_STR_HLP_KEY_PLS % "|" % SIMU_STR_HLP_MOUSE_DN, SIMU_STR_HLP_ACT_ROT_RGT);
connectScrollActions();
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 280, 30, 30), "NV14/left.png", m_screenshotAction));
m_backlightColors << QColor(47, 123, 227);
setLcd(ui->lcd);
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>500</height>
<width>724</width>
<height>506</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,14 +18,14 @@
</property>
<property name="minimumSize">
<size>
<width>520</width>
<height>500</height>
<width>724</width>
<height>506</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>520</width>
<height>500</height>
<width>724</width>
<height>506</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
@@ -54,18 +54,18 @@
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/right.png)</string>
<string notr="true">background:url(:/images/simulator/NV14/rhs.png)</string>
</property>
</widget>
</item>
@@ -106,21 +106,21 @@
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/left.png);</string>
<string notr="true">background:url(:/images/simulator/NV14/lhs.png);</string>
</property>
</widget>
</item>
@@ -135,13 +135,13 @@
<property name="minimumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="font">
@@ -165,13 +165,13 @@
<property name="minimumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="font">
@@ -34,38 +34,43 @@ SimulatedUIWidgetNV14::SimulatedUIWidgetNV14(SimulatorInterface *simulator, QWid
// add actions in order of appearance on the help menu
// Note: the NV14 has no physical buttons though at some point the trim joystick is repurposed
// allow for colorlcd key events and see what works
// the mouse click areas do not map to visual buttons on the background images
act = new RadioUiAction(KEY_SYS, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_SYS);
addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(65, 15), QSize(40, 40)), "NV14/lhs_hat_up.png", act));
act = new RadioUiAction(KEY_MODEL, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_MDL);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 1, 80, 35), "NV14/left.png", act));
// unused
//act = new RadioUiAction(13, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_EXIT);
//addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(5, 75), QSize(40, 40)), "NV14/lhs_hat_left.png", act));
m_mouseMidClickAction = new RadioUiAction(KEY_ENTER, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
addRadioWidget(ui->rightbuttons->addArea(QRect(10, 40, 80, 35), "NV14/left.png", m_mouseMidClickAction));
act = new RadioUiAction(KEY_MODEL, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_MDL);
addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(130, 75), QSize(40, 40)), "NV14/lhs_hat_right.png", act));
act = new RadioUiAction(KEY_SYS, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_SYS);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 80, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_TELE, QList<int>() << Qt::Key_Down, SIMU_STR_HLP_KEY_DN, SIMU_STR_HLP_ACT_TELE);
addRadioWidget(ui->leftbuttons->addArea(QRect(QPoint(65, 140), QSize(40, 40)), "NV14/lhs_hat_down.png", act));
act = new RadioUiAction(KEY_TELE, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_TELE);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 120, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_EXIT, 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(QPoint(60, 70), QSize(50, 50)), "NV14/lhs_hat_press.png", act));
act = new RadioUiAction(KEY_PAGEDN, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 160, 80, 35), "NV14/left.png", act));
// non-functional
// act = new RadioUiAction(KEY_UP, QList<int>() << Qt::Key_Plus, SIMU_STR_HLP_KEY_PLS, SIMU_STR_HLP_ACT_PREVINC);
// addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(95, 15), QSize(40, 40)), "NV14/rhs_hat_up.png", act));
act = new RadioUiAction(KEY_PAGEUP, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 200, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_PAGEUP, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(35, 75), QSize(40, 40)), "NV14/rhs_hat_left.png", act));
act = new RadioUiAction(KEY_EXIT, QList<int>() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace,
SIMU_STR_HLP_KEY_DN % "<br>" % SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_RTN);
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 240, 80, 35), "NV14/left.png", act));
act = new RadioUiAction(KEY_PAGEDN, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(160, 75), QSize(40, 40)), "NV14/rhs_hat_right.png", act));
// non-functional
// act = new RadioUiAction(KEY_DOWN, QList<int>() << Qt::Key_Minus, SIMU_STR_HLP_KEY_MIN, SIMU_STR_HLP_ACT_NEXTDEC);
// addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(95, 140), QSize(40, 40)), "NV14/rhs_hat_down.png", act));
act = new RadioUiAction(KEY_ENTER, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ENT);
addRadioWidget(ui->rightbuttons->addArea(QRect(QPoint(90, 70), QSize(50, 50)), "NV14/rhs_hat_press.png", act));
m_scrollUpAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Minus, SIMU_STR_HLP_KEY_MIN % "|" % SIMU_STR_HLP_MOUSE_UP, SIMU_STR_HLP_ACT_ROT_LFT);
m_scrollDnAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Equal, SIMU_STR_HLP_KEY_PLS % "|" % SIMU_STR_HLP_MOUSE_DN, SIMU_STR_HLP_ACT_ROT_RGT);
connectScrollActions();
addRadioWidget(ui->leftbuttons->addArea(QRect(10, 280, 30, 30), "NV14/left.png", m_screenshotAction));
m_backlightColors << QColor(47, 123, 227);
setLcd(ui->lcd);
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>500</height>
<width>724</width>
<height>506</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,14 +18,14 @@
</property>
<property name="minimumSize">
<size>
<width>520</width>
<height>500</height>
<width>724</width>
<height>506</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>520</width>
<height>500</height>
<width>724</width>
<height>506</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
@@ -54,18 +54,18 @@
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/right.png)</string>
<string notr="true">background:url(:/images/simulator/NV14/rhs.png)</string>
</property>
</widget>
</item>
@@ -106,21 +106,21 @@
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>500</height>
<width>202</width>
<height>506</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/NV14/left.png);</string>
<string notr="true">background:url(:/images/simulator/NV14/lhs.png);</string>
</property>
</widget>
</item>
@@ -135,13 +135,13 @@
<property name="minimumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="font">
@@ -165,13 +165,13 @@
<property name="minimumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>320</width>
<height>10</height>
<height>13</height>
</size>
</property>
<property name="font">
@@ -73,6 +73,9 @@
#define SIMU_STR_HLP_ACT_TELE QCoreApplication::translate("SimulatedUIWidget", "<pre>[ TELE ]</pre>")
#define SIMU_STR_HLP_ACT_MENU_ICN QCoreApplication::translate("SimulatedUIWidget", "<font size=+3>&#x2261;</font>") // ≡
#define SIMU_STR_HLP_ACT_PREVINC QCoreApplication::translate("SimulatedUIWidget", "<pre>[ Prev/Inc ]</pre>")
#define SIMU_STR_HLP_ACT_NEXTDEC QCoreApplication::translate("SimulatedUIWidget", "<pre>[ Next/Dec ]</pre>")
#define SIMU_STR_HLP_KEYS_EXIT SIMU_STR_HLP_KEY_DEL % "|" % SIMU_STR_HLP_KEY_BKSP % "|" % SIMU_STR_HLP_KEY_ESC
#define SIMU_STR_HLP_KEYS_ACTIVATE SIMU_STR_HLP_KEY_ENTER % "|" % SIMU_STR_HLP_MOUSE_MID