Add Jumper t12 support by 3djc (#6451)

* Jumper T12 - companion part

* more work

* Add definitions

* fix libsimulator key handling

* Fix simu keys handling

* Cosmetics

* Continued

* Fix wrong regplace

* Fix wrong regplace

* Please travis

* Please travis

* Add T12 to Travis
Switch naming and display

* Cosmetics

* Work on modules

* Work on modules

* typo

* Fix navigation

* Cosmetics

* Introduce NAVIGATION_type

* Fix

* Make NAVIGATION_type more future proof

* Lots of cleanups and improvements

* Cosmetics

* Fix internal module menu

* Cosmetics

* Fix screen reversed

* Small fixes

* Fix navigation issue

* Please travis

* Fix LCD contrast

* Fix T12 switch layout

* Fix T12 keys screen and all radios keys translations

* Complete rework of SWITCHES screen for all radios

* comsetics

* VC++ compilation
This commit is contained in:
3djc
2019-05-26 19:51:17 +02:00
committed by Andre Bernet
parent f0998ff52f
commit cd3c4ac654
80 changed files with 975 additions and 208 deletions
+2
View File
@@ -11,6 +11,7 @@ set(simulation_SRCS
simulateduiwidgetX9E.cpp
simulateduiwidgetX10.cpp
simulateduiwidgetX12.cpp
simulateduiwidgetJumperT12.cpp
simulatorinterface.cpp
simulatormainwindow.cpp
simulatorstartupdialog.cpp
@@ -32,6 +33,7 @@ set(simulation_UIS
simulateduiwidgetX9E.ui
simulateduiwidgetX10.ui
simulateduiwidgetX12.ui
simulateduiwidgetJumperT12.ui
simulatormainwindow.ui
simulatorstartupdialog.ui
simulatorwidget.ui
@@ -111,6 +111,7 @@ namespace Ui {
class SimulatedUIWidgetX9E;
class SimulatedUIWidgetX10;
class SimulatedUIWidgetX12;
class SimulatedUIWidgetJumperT12;
}
class SimulatedUIWidget9X: public SimulatedUIWidget
@@ -213,4 +214,16 @@ class SimulatedUIWidgetX12: public SimulatedUIWidget
Ui::SimulatedUIWidgetX12 * ui;
};
class SimulatedUIWidgetJumperT12: public SimulatedUIWidget
{
Q_OBJECT
public:
explicit SimulatedUIWidgetJumperT12(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetJumperT12();
private:
Ui::SimulatedUIWidgetJumperT12 * ui;
};
#endif // SIMULATEDUIWIDGET_H
@@ -0,0 +1,61 @@
#include "simulateduiwidget.h"
#include "ui_simulateduiwidgetJumperT12.h"
// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h
SimulatedUIWidgetJumperT12::SimulatedUIWidgetJumperT12(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetJumperT12)
{
RadioUiAction * act;
QPolygon polygon;
ui->setupUi(this);
act = new RadioUiAction(3, QList<int>() << Qt::Key_Up << Qt::Key_PageUp, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_UP);
addRadioWidget(ui->rightbuttons->addArea(QRect(69, 11, 60, 25), "JumperT12/right_up.png", act));
act = new RadioUiAction(2, QList<int>() << Qt::Key_Down << Qt::Key_PageDown, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_DN);
addRadioWidget(ui->rightbuttons->addArea(QRect(61, 115, 60, 25), "JumperT12/right_down.png", act));
act = new RadioUiAction(4, QList<int>() << Qt::Key_Right << Qt::Key_Plus, SIMU_STR_HLP_KEY_RGT % "|" % SIMU_STR_HLP_KEY_PLS, SIMU_STR_HLP_ACT_PLS);
addRadioWidget(ui->rightbuttons->addArea(QRect(109, 53, 30, 40), "JumperT12/right_right.png", act));
act = new RadioUiAction(5, QList<int>() << Qt::Key_Left << Qt::Key_Minus, SIMU_STR_HLP_KEY_LFT % "|" % SIMU_STR_HLP_KEY_MIN, SIMU_STR_HLP_ACT_MIN);
addRadioWidget(ui->rightbuttons->addArea(QRect(49, 62, 30, 40), "JumperT12/right_left.png", act));
m_mouseMidClickAction = new RadioUiAction(1, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ENT);
addRadioWidget(ui->leftbuttons->addArea(QRect(21, 30, 60, 25), "JumperT12/left_ent.png", m_mouseMidClickAction));
act = new RadioUiAction(0, 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(21, 80, 60, 60), "JumperT12/left_exit.png", act));
addRadioWidget(ui->leftbuttons->addArea(QRect(9, 154, 30, 30), "JumperT12/left_scrnshot.png", m_screenshotAction));
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);
}
SimulatedUIWidgetJumperT12::~SimulatedUIWidgetJumperT12()
{
delete ui;
}
@@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SimulatedUIWidgetJumperT12</class>
<widget class="QWidget" name="SimulatedUIWidgetJumperT12">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<height>208</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>570</width>
<height>208</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>570</width>
<height>208</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">Jumper T12 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>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="5" 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>
<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="1" column="2" rowspan="4">
<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>157</width>
<height>186</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>157</width>
<height>186</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT12/JumperT12-right.png)</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="4">
<widget class="ButtonsWidget" name="leftbuttons" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>157</width>
<height>186</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>157</width>
<height>186</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT12/JumperT12-left.png);</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QWidget" name="bottom" 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>10</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>10</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT12/bottom.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>256</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/images/simulator/JumperT12/JumperT12-top.png)</string>
</property>
</widget>
</item>
<item row="3" 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>424</width>
<height>128</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(215, 243, 255);</string>
</property>
</widget>
</item>
</layout>
</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/>
<connections/>
</ui>
@@ -91,6 +91,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
case Board::BOARD_X10:
radioUiWidget = new SimulatedUIWidgetX10(simulator, this);
break;
case Board::BOARD_JUMPER_T12:
radioUiWidget = new SimulatedUIWidgetJumperT12(simulator, this);
break;
default:
radioUiWidget = new SimulatedUIWidget9X(simulator, this);
break;