[Companion] Fix a few translations. (#4890)
[opentx.git] / companion / src / simulation / simulateduiwidgetX9E.cpp
blob2c0d6adfa3a1e47adbb6b51715978ad7836817ae
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #include "simulateduiwidget.h"
22 #include "ui_simulateduiwidgetX9E.h"
24 SimulatedUIWidgetX9E::SimulatedUIWidgetX9E(SimulatorInterface *simulator, QWidget * parent):
25 SimulatedUIWidget(simulator, parent),
26 ui(new Ui::SimulatedUIWidgetX9E)
28 RadioUiAction * act;
29 QPolygon polygon;
31 ui->setupUi(this);
33 // add actions in order of appearance on the help menu
35 QPoint ctr(70, 100);
37 polygon << polyArc(ctr.x(), ctr.y(), 60, -90, 0) << ctr;
38 act = new RadioUiAction(0, QList<int>() << Qt::Key_Up << Qt::Key_PageUp, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_MENU);
39 addRadioWidget(ui->leftbuttons->addArea(polygon, "X9E/left_menu.png", act));
41 polygon.clear();
42 polygon << polyArc(ctr.x(), ctr.y(), 45, 0, 180);
43 act = new RadioUiAction(3, QList<int>() << Qt::Key_Down << Qt::Key_PageDown, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_PAGE);
44 addRadioWidget(ui->leftbuttons->addArea(polygon, "X9E/left_page.png", act));
46 polygon.clear();
47 polygon << polyArc(ctr.x(), ctr.y(), 60, 180, 270) << ctr;
48 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);
49 addRadioWidget(ui->leftbuttons->addArea(polygon, "X9E/left_exit.png", act));
51 m_scrollUpAction = addRadioAction(new RadioUiAction(-1, QList<int>() << Qt::Key_Minus << Qt::Key_Left, SIMU_STR_HLP_KEYS_GO_LFT, SIMU_STR_HLP_ACT_ROT_LFT));
52 m_scrollDnAction = addRadioAction(new RadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Equal << Qt::Key_Right, SIMU_STR_HLP_KEYS_GO_RGT, SIMU_STR_HLP_ACT_ROT_RGT));
53 connectScrollActions();
55 m_mouseMidClickAction = new RadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
56 addRadioWidget(ui->rightbuttons->addArea(polyArc(90, 100, 50), "X9E/right_enter.png", m_mouseMidClickAction));
58 addRadioWidget(ui->leftbuttons->addArea(QRect(10, 170, 30, 30), "X9E/left_scrnshot.png", m_screenshotAction));
60 m_backlightColors << QColor(47, 123, 227); // Taranis Blue
61 m_backlightColors << QColor(166,247,159);
62 m_backlightColors << QColor(247,159,166);
63 m_backlightColors << QColor(255,195,151);
64 m_backlightColors << QColor(247,242,159);
66 setLcd(ui->lcd);
68 QString css = "#radioUiWidget {"
69 "background-color: qlineargradient(spread:pad, x1:1, y1:0.9, x2:0, y2:0,"
70 "stop:0 rgba(255, 255, 255, 255),"
71 "stop:0.35 rgba(250, 250, 250, 255), stop:0.5 rgba(242, 241, 241, 255),"
72 "stop:0.61 rgba(241, 241, 241, 255), stop:1.0 rgba(251, 251, 251, 255));"
73 "}";
75 QTimer * tim = new QTimer(this);
76 tim->setSingleShot(true);
77 connect(tim, &QTimer::timeout, [this, css]() {
78 emit customStyleRequest(css);
79 });
80 tim->start(100);
83 SimulatedUIWidgetX9E::~SimulatedUIWidgetX9E()
85 delete ui;