diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc index 567b52637..32ace6a12 100644 --- a/companion/src/companion.qrc +++ b/companion/src/companion.qrc @@ -136,6 +136,14 @@ images/simulator/X9E/right.png images/simulator/X9E/right_enter.png images/simulator/X9E/top.png + images/simulator/X9D2019/bottom.png + images/simulator/X9D2019/left.png + images/simulator/X9D2019/left_exit.png + images/simulator/X9D2019/left_menu.png + images/simulator/X9D2019/left_page.png + images/simulator/X9D2019/right.png + images/simulator/X9D2019/right_enter.png + images/simulator/X9D2019/top.png images/simulator/X9LITE/bottom.png images/simulator/X9LITE/left.png images/simulator/X9LITE/left_exit.png diff --git a/companion/src/images/simulator/X9D2019/Readme.md b/companion/src/images/simulator/X9D2019/Readme.md new file mode 100644 index 000000000..75a11a3ad --- /dev/null +++ b/companion/src/images/simulator/X9D2019/Readme.md @@ -0,0 +1,28 @@ + +# "Taranis X9D+ 2019" dark blue skin for the Companion simulator +![X9D+ 2019 Image for Companion](X9DP2019_Companion_image.png "Taranis X9D+ 2019") + +## The different parts of the image + +The image is divided into 4 pieces: top, bottom, left and right. +For the images concerned, there is the version with the activated element and the version without the activated element (such as a button, a rotary encoder, clicking on the rotary encoder). + +| File name | What is this image ? | +|:---------------------|:----------------------------------------------| +| `bottom.png` | central lower band | +| `center_LCD.png` | central LCD 424x128px (useless for simulator) | +| `left.png` | left part with inactive elements | +| `left_exit.png` | left part with the EXIT button activated | +| `left_menu.png` | left part with the MENU button activated | +| `left_page.png` | left part with the PAGE button activated | +| `bottom_scrnshot.png`| central lower band with the SCREENSHOT button activated| +| `right_ent.png` | right part with the ENTER button activated | +| `right.png` | right part with inactive elements | +| `top.png` | central upper band | + +`X9DP2019_Companion_image.png` is the image displayed here. + + +## Software used : +- **Inkscape** : vector drawing software (http://www.inkscape.org/) +- **Gimp** : image editor (http://www.gimp.org/) \ No newline at end of file diff --git a/companion/src/images/simulator/X9D2019/X9DP2019_Companion_image.png b/companion/src/images/simulator/X9D2019/X9DP2019_Companion_image.png new file mode 100644 index 000000000..9f28d54a8 Binary files /dev/null and b/companion/src/images/simulator/X9D2019/X9DP2019_Companion_image.png differ diff --git a/companion/src/images/simulator/X9D2019/bottom.png b/companion/src/images/simulator/X9D2019/bottom.png new file mode 100644 index 000000000..bc812ddb0 Binary files /dev/null and b/companion/src/images/simulator/X9D2019/bottom.png differ diff --git a/companion/src/images/simulator/X9D2019/bottom_scrnshot.png b/companion/src/images/simulator/X9D2019/bottom_scrnshot.png new file mode 100644 index 000000000..b46eaa9ec Binary files /dev/null and b/companion/src/images/simulator/X9D2019/bottom_scrnshot.png differ diff --git a/companion/src/images/simulator/X9D2019/center_LCD.png b/companion/src/images/simulator/X9D2019/center_LCD.png new file mode 100644 index 000000000..3bc62efd0 Binary files /dev/null and b/companion/src/images/simulator/X9D2019/center_LCD.png differ diff --git a/companion/src/images/simulator/X9D2019/left.png b/companion/src/images/simulator/X9D2019/left.png new file mode 100644 index 000000000..113cd1611 Binary files /dev/null and b/companion/src/images/simulator/X9D2019/left.png differ diff --git a/companion/src/images/simulator/X9D2019/left_exit.png b/companion/src/images/simulator/X9D2019/left_exit.png new file mode 100644 index 000000000..4b6376c0f Binary files /dev/null and b/companion/src/images/simulator/X9D2019/left_exit.png differ diff --git a/companion/src/images/simulator/X9D2019/left_menu.png b/companion/src/images/simulator/X9D2019/left_menu.png new file mode 100644 index 000000000..9e2a74ecc Binary files /dev/null and b/companion/src/images/simulator/X9D2019/left_menu.png differ diff --git a/companion/src/images/simulator/X9D2019/left_page.png b/companion/src/images/simulator/X9D2019/left_page.png new file mode 100644 index 000000000..4ad08533f Binary files /dev/null and b/companion/src/images/simulator/X9D2019/left_page.png differ diff --git a/companion/src/images/simulator/X9D2019/right.png b/companion/src/images/simulator/X9D2019/right.png new file mode 100644 index 000000000..a16456573 Binary files /dev/null and b/companion/src/images/simulator/X9D2019/right.png differ diff --git a/companion/src/images/simulator/X9D2019/right_enter.png b/companion/src/images/simulator/X9D2019/right_enter.png new file mode 100644 index 000000000..8f9c5f1cb Binary files /dev/null and b/companion/src/images/simulator/X9D2019/right_enter.png differ diff --git a/companion/src/images/simulator/X9D2019/top.png b/companion/src/images/simulator/X9D2019/top.png new file mode 100644 index 000000000..083fd6e3c Binary files /dev/null and b/companion/src/images/simulator/X9D2019/top.png differ diff --git a/companion/src/simulation/CMakeLists.txt b/companion/src/simulation/CMakeLists.txt index 6d647aeac..7601f8f04 100644 --- a/companion/src/simulation/CMakeLists.txt +++ b/companion/src/simulation/CMakeLists.txt @@ -9,6 +9,7 @@ set(simulation_SRCS simulateduiwidgetX9.cpp simulateduiwidgetXLITE.cpp simulateduiwidgetX9E.cpp + simulateduiwidgetX9D2019.cpp simulateduiwidgetX10.cpp simulateduiwidgetX12.cpp simulateduiwidgetJumperT12.cpp @@ -32,6 +33,7 @@ set(simulation_UIS simulateduiwidgetX9.ui simulateduiwidgetXLITE.ui simulateduiwidgetX9E.ui + simulateduiwidgetX9D2019.ui simulateduiwidgetX10.ui simulateduiwidgetX12.ui simulateduiwidgetJumperT12.ui diff --git a/companion/src/simulation/simulateduiwidget.h b/companion/src/simulation/simulateduiwidget.h index 091596729..d688c641a 100644 --- a/companion/src/simulation/simulateduiwidget.h +++ b/companion/src/simulation/simulateduiwidget.h @@ -108,6 +108,7 @@ namespace Ui { class SimulatedUIWidgetX9; class SimulatedUIWidgetXLITE; class SimulatedUIWidgetX9E; + class SimulatedUIWidgetX9D2019; class SimulatedUIWidgetX10; class SimulatedUIWidgetX12; class SimulatedUIWidgetJumperT12; @@ -190,6 +191,18 @@ class SimulatedUIWidgetX9E: public SimulatedUIWidget Ui::SimulatedUIWidgetX9E * ui; }; +class SimulatedUIWidgetX9D2019: public SimulatedUIWidget +{ + Q_OBJECT + + public: + explicit SimulatedUIWidgetX9D2019(SimulatorInterface * simulator, QWidget * parent = nullptr); + virtual ~SimulatedUIWidgetX9D2019(); + + private: + Ui::SimulatedUIWidgetX9D2019 * ui; +}; + class SimulatedUIWidgetX10: public SimulatedUIWidget { Q_OBJECT diff --git a/companion/src/simulation/simulateduiwidgetX9D2019.cpp b/companion/src/simulation/simulateduiwidgetX9D2019.cpp new file mode 100644 index 000000000..828a946b8 --- /dev/null +++ b/companion/src/simulation/simulateduiwidgetX9D2019.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +// NOTE: RadioUiAction(NUMBER,...): NUMBER relates to enum EnumKeys in the specific board.h + +#include "simulateduiwidget.h" +#include "ui_simulateduiwidgetX9D2019.h" + +SimulatedUIWidgetX9D2019::SimulatedUIWidgetX9D2019(SimulatorInterface *simulator, QWidget * parent): + SimulatedUIWidget(simulator, parent), + ui(new Ui::SimulatedUIWidgetX9D2019) +{ + RadioUiAction * act; + + ui->setupUi(this); + + // add actions in order of appearance on the help menu + + QPoint ctr(70, 100); + + act = new RadioUiAction(0, QList() << Qt::Key_Up << Qt::Key_PageUp, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_MENU); + addRadioWidget(ui->leftbuttons->addArea(QRect(25, 40, 80, 35), "X9D2019/left_menu.png", act)); + + act = new RadioUiAction(3, QList() << Qt::Key_Down << Qt::Key_PageDown, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_PAGE); + addRadioWidget(ui->leftbuttons->addArea(QRect(25, 85, 80, 35), "X9D2019/left_page.png", act)); + + act = new RadioUiAction(1, QList() << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_EXIT); + addRadioWidget(ui->leftbuttons->addArea(QRect(25, 140, 80, 35), "X9D2019/left_exit.png", act)); + + m_scrollUpAction = addRadioAction(new RadioUiAction(-1, QList() << Qt::Key_Minus << Qt::Key_Left, SIMU_STR_HLP_KEYS_GO_LFT, SIMU_STR_HLP_ACT_ROT_LFT)); + m_scrollDnAction = addRadioAction(new RadioUiAction(-1, QList() << Qt::Key_Plus << Qt::Key_Equal << Qt::Key_Right, SIMU_STR_HLP_KEYS_GO_RGT, SIMU_STR_HLP_ACT_ROT_RGT)); + connectScrollActions(); + + m_mouseMidClickAction = new RadioUiAction(2, QList() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN); + addRadioWidget(ui->rightbuttons->addArea(QRect(40, 30, 80, 130), "X9D2019/right_enter.png", m_mouseMidClickAction)); + + addRadioWidget(ui->leftbuttons->addArea(QRect(10, 170, 30, 30), "X9D2019/left_scrnshot.png", m_screenshotAction)); + + m_backlightColors << QColor(47, 123, 227); // Taranis 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:pad, x1:1, y1:0.9, x2:0, y2:0," + "stop:0 rgba(255, 255, 255, 255)," + "stop:0.35 rgba(250, 250, 250, 255), stop:0.5 rgba(242, 241, 241, 255)," + "stop:0.61 rgba(241, 241, 241, 255), stop:1.0 rgba(251, 251, 251, 255));" + "}"; + + QTimer * tim = new QTimer(this); + tim->setSingleShot(true); + connect(tim, &QTimer::timeout, [this, css]() { + emit customStyleRequest(css); + }); + tim->start(100); +} + +SimulatedUIWidgetX9D2019::~SimulatedUIWidgetX9D2019() +{ + delete ui; +} + diff --git a/companion/src/simulation/simulateduiwidgetX9D2019.ui b/companion/src/simulation/simulateduiwidgetX9D2019.ui new file mode 100644 index 000000000..4333f50ca --- /dev/null +++ b/companion/src/simulation/simulateduiwidgetX9D2019.ui @@ -0,0 +1,166 @@ + + + SimulatedUIWidgetX9D2019 + + + + 0 + 0 + 756 + 258 + + + + + 0 + 0 + + + + + 756 + 258 + + + + + 756 + 258 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 166 + 258 + + + + true + + + background:url(:/images/simulator/X9D2019/left.png); + + + + + + + + 0 + 0 + + + + + 424 + 50 + + + + background:url(:/images/simulator/X9D2019/top.png) + + + + + + + + 0 + 0 + + + + + 166 + 258 + + + + background:url(:/images/simulator/X9D2019/right.png) + + + + + + + + 0 + 0 + + + + + 424 + 128 + + + + + 424 + 128 + + + + + + + + + 0 + 0 + + + + + 424 + 80 + + + + background:url(:/images/simulator/X9D2019/bottom.png) + + + + + + + + LcdWidget + QWidget +
lcdwidget.h
+ 1 +
+ + ButtonsWidget + QWidget +
buttonswidget.h
+ 1 +
+
+ + +
diff --git a/companion/src/simulation/simulatorwidget.cpp b/companion/src/simulation/simulatorwidget.cpp index f823769aa..c96cd480e 100644 --- a/companion/src/simulation/simulatorwidget.cpp +++ b/companion/src/simulation/simulatorwidget.cpp @@ -68,9 +68,11 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato break; case Board::BOARD_TARANIS_X9D: case Board::BOARD_TARANIS_X9DP: - case Board::BOARD_TARANIS_X9DP_2019: radioUiWidget = new SimulatedUIWidgetX9(simulator, this); break; + case Board::BOARD_TARANIS_X9DP_2019: + radioUiWidget = new SimulatedUIWidgetX9D2019(simulator, this); + break; case Board::BOARD_TARANIS_XLITE: case Board::BOARD_TARANIS_XLITES: radioUiWidget = new SimulatedUIWidgetXLITE(simulator, this);