From 5309b527a57f189c6574f73381d613770253f53a Mon Sep 17 00:00:00 2001 From: Max Paperno Date: Mon, 6 Feb 2017 22:04:05 -0500 Subject: [PATCH] [Simulator] Add X9E radio skin. --- companion/src/companion.qrc | 9 + .../{left_srnshot.png => left_scrnshot.png} | Bin companion/src/simulation/CMakeLists.txt | 2 + companion/src/simulation/simulateduiwidget.h | 15 ++ .../src/simulation/simulateduiwidgetX9E.cpp | 79 +++++++++ .../src/simulation/simulateduiwidgetX9E.ui | 166 ++++++++++++++++++ companion/src/simulation/simulatordialog.cpp | 8 +- 7 files changed, 276 insertions(+), 3 deletions(-) rename companion/src/images/simulator/X9E/{left_srnshot.png => left_scrnshot.png} (100%) create mode 100644 companion/src/simulation/simulateduiwidgetX9E.cpp create mode 100644 companion/src/simulation/simulateduiwidgetX9E.ui diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc index 848007feb..2c0d6986a 100644 --- a/companion/src/companion.qrc +++ b/companion/src/companion.qrc @@ -101,6 +101,15 @@ images/simulator/X7/right.png images/simulator/X7/right_ent.png images/simulator/X7/top.png + images/simulator/X9E/bottom.png + images/simulator/X9E/left.png + images/simulator/X9E/left_exit.png + images/simulator/X9E/left_menu.png + images/simulator/X9E/left_page.png + images/simulator/X9E/left_scrnshot.png + images/simulator/X9E/right.png + images/simulator/X9E/right_enter.png + images/simulator/X9E/top.png images/wizard/ailerons.png images/wizard/airbrakes.png images/wizard/elevons.png diff --git a/companion/src/images/simulator/X9E/left_srnshot.png b/companion/src/images/simulator/X9E/left_scrnshot.png similarity index 100% rename from companion/src/images/simulator/X9E/left_srnshot.png rename to companion/src/images/simulator/X9E/left_scrnshot.png diff --git a/companion/src/simulation/CMakeLists.txt b/companion/src/simulation/CMakeLists.txt index eddba8ea6..0b6ad1f2d 100644 --- a/companion/src/simulation/CMakeLists.txt +++ b/companion/src/simulation/CMakeLists.txt @@ -6,6 +6,7 @@ set(simulation_SRCS simulateduiwidget9X.cpp simulateduiwidgetX7.cpp simulateduiwidgetX9.cpp + simulateduiwidgetX9E.cpp simulateduiwidgetX12.cpp simulatorinterface.cpp simulatormainwindow.cpp @@ -23,6 +24,7 @@ set(simulation_UIS simulateduiwidget9X.ui simulateduiwidgetX7.ui simulateduiwidgetX9.ui + simulateduiwidgetX9E.ui simulateduiwidgetX12.ui simulatormainwindow.ui simulatorstartupdialog.ui diff --git a/companion/src/simulation/simulateduiwidget.h b/companion/src/simulation/simulateduiwidget.h index 49e97f8a4..91edf7ca4 100644 --- a/companion/src/simulation/simulateduiwidget.h +++ b/companion/src/simulation/simulateduiwidget.h @@ -100,6 +100,7 @@ namespace Ui { class SimulatedUIWidget9X; class SimulatedUIWidgetX7; class SimulatedUIWidgetX9; + class SimulatedUIWidgetX9E; class SimulatedUIWidgetX12; } @@ -149,6 +150,20 @@ class SimulatedUIWidgetX9: public SimulatedUIWidget Ui::SimulatedUIWidgetX9 * ui; }; +class SimulatedUIWidgetX9E: public SimulatedUIWidget +{ + Q_OBJECT + + public: + explicit SimulatedUIWidgetX9E(SimulatorInterface * simulator, SimulatorDialog * simuDialog = NULL, QWidget * parent = NULL); + virtual ~SimulatedUIWidgetX9E(); + + protected: + + private: + Ui::SimulatedUIWidgetX9E * ui; +}; + class SimulatedUIWidgetX12: public SimulatedUIWidget { Q_OBJECT diff --git a/companion/src/simulation/simulateduiwidgetX9E.cpp b/companion/src/simulation/simulateduiwidgetX9E.cpp new file mode 100644 index 000000000..0d848ba2e --- /dev/null +++ b/companion/src/simulation/simulateduiwidgetX9E.cpp @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#include "simulateduiwidget.h" +#include "ui_simulateduiwidgetX9E.h" + +SimulatedUIWidgetX9E::SimulatedUIWidgetX9E(SimulatorInterface *simulator, SimulatorDialog * simuDialog, QWidget * parent): + SimulatedUIWidget(simulator, simuDialog, parent), + ui(new Ui::SimulatedUIWidgetX9E) +{ + RadioUiAction * act; + QPolygon polygon; + + ui->setupUi(this); + + // add actions in order of appearance on the help menu + + QPoint ctr(70, 100); + + polygon << polyArc(ctr.x(), ctr.y(), 60, -90, 0) << ctr; + act = addRadioUiAction(0, QList() << Qt::Key_PageUp, tr("PG-UP"), tr("[ MENU ]")); + ui->leftbuttons->addArea(polygon, "X9E/left_menu.png", act); + + polygon.clear(); + polygon << polyArc(ctr.x(), ctr.y(), 45, 0, 180); + act = addRadioUiAction(3, QList() << Qt::Key_PageDown, tr("PG-DN"), tr("[ PAGE ]")); + ui->leftbuttons->addArea(polygon, "X9E/left_page.png", act); + + polygon.clear(); + polygon << polyArc(ctr.x(), ctr.y(), 60, 180, 270) << ctr; + act = addRadioUiAction(1, QList() << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, tr("DEL/BKSP/ESC"), tr("[ EXIT ]")); + ui->leftbuttons->addArea(polygon, "X9E/left_exit.png", act); + + m_keymapHelp.append(keymapHelp_t(tr("WHEEL/PAD SCRL"), tr("Rotary Selector"))); + m_scrollUpAction = addRadioUiAction(-1, QList() << Qt::Key_Minus << Qt::Key_Equal << Qt::Key_Up, tr("-/UP"), tr("Rotary UP")); + m_scrollDnAction = addRadioUiAction(-1, QList() << Qt::Key_Plus << Qt::Key_Down, tr("+/DN"), tr("Rotary DOWN")); + connectScrollActions(); + + act = addRadioUiAction(2, QList() << Qt::Key_Enter << Qt::Key_Return, tr("ENTER/MOUSE-MID"), tr("Selector Press")); + ui->rightbuttons->addArea(polyArc(90, 100, 50), "X9E/right_enter.png", act); + + ui->leftbuttons->addArea(10, 170, 40, 200, "X9E/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); + + m_simuDialog->setUiAreaStyle("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));"); +} + +SimulatedUIWidgetX9E::~SimulatedUIWidgetX9E() +{ + delete ui; +} + diff --git a/companion/src/simulation/simulateduiwidgetX9E.ui b/companion/src/simulation/simulateduiwidgetX9E.ui new file mode 100644 index 000000000..87a23e552 --- /dev/null +++ b/companion/src/simulation/simulateduiwidgetX9E.ui @@ -0,0 +1,166 @@ + + + SimulatedUIWidgetX9E + + + + 0 + 0 + 724 + 210 + + + + + 0 + 0 + + + + + 724 + 210 + + + + + 724 + 210 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 150 + 208 + + + + true + + + background:url(:/images/simulator/X9E/left.png); + + + + + + + + 0 + 0 + + + + + 424 + 40 + + + + background:url(:/images/simulator/X9E/top.png) + + + + + + + + 0 + 0 + + + + + 150 + 208 + + + + background:url(:/images/simulator/X9E/right.png) + + + + + + + + 0 + 0 + + + + + 424 + 128 + + + + + 424 + 128 + + + + + + + + + 0 + 0 + + + + + 424 + 40 + + + + background:url(:/images/simulator/X9E/bottom.png) + + + + + + + + LcdWidget + QWidget +
lcdwidget.h
+ 1 +
+ + ButtonsWidget + QWidget +
buttonswidget.h
+ 1 +
+
+ + +
diff --git a/companion/src/simulation/simulatordialog.cpp b/companion/src/simulation/simulatordialog.cpp index 973f3ed2a..716f75c77 100644 --- a/companion/src/simulation/simulatordialog.cpp +++ b/companion/src/simulation/simulatordialog.cpp @@ -81,11 +81,13 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator break; case Board::BOARD_TARANIS_X9D : case Board::BOARD_TARANIS_X9DP : - case Board::BOARD_TARANIS_X9E : radioUiWidget = new SimulatedUIWidgetX9(simulator, this); break; - case Board::BOARD_X12S: - case Board::BOARD_X10: + case Board::BOARD_TARANIS_X9E : + radioUiWidget = new SimulatedUIWidgetX9E(simulator, this); + break; + case Board::BOARD_X12S : + case Board::BOARD_X10 : radioUiWidget = new SimulatedUIWidgetX12(simulator, this); break; default: