Bsongis/issue 4400 (#4425)
[opentx.git] / companion / src / simulation / simulateduiwidgetX12.cpp
blob7a36587997434e79f71c78c5f5c74ff48bdc0210
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_simulateduiwidgetX12.h"
24 SimulatedUIWidgetX12::SimulatedUIWidgetX12(SimulatorInterface *simulator, QWidget * parent):
25 SimulatedUIWidget(simulator, parent),
26 ui(new Ui::SimulatedUIWidgetX12)
28 RadioUiAction * act;
29 QPolygon polygon;
31 ui->setupUi(this);
33 // add actions in order of appearance on the help menu
35 int x = 74, y = 190, oR = 63, iR = 40;
37 polygon << polyArc(x, y, oR, 225, 315) << polyArc(x, y, iR, 225, 315);
38 act = addRadioUiAction(0, QList<int>() << Qt::Key_PageUp, tr("PG-UP"), tr("[ PgUp ]"));
39 ui->leftbuttons->addArea(polygon, "Horus/left_btn1.png", act);
41 polygon.clear();
42 polygon << polyArc(x, y, oR, 135, 225) << polyArc(x, y, iR, 135, 225);
43 act = addRadioUiAction(1, QList<int>() << Qt::Key_PageDown, tr("PG-DN"), tr("[ PgDn ]"));
44 ui->leftbuttons->addArea(polygon, "Horus/left_btn2.png", act);
46 polygon.clear();
47 polygon << polyArc(x, y, oR, -45, 45) << polyArc(x, y, iR, -45, 45);
48 act = addRadioUiAction(3, QList<int>() << Qt::Key_Up, tr("UP"), tr("[ MDL ]"));
49 ui->rightbuttons->addArea(polygon, "Horus/right_btnU.png", act);
51 polygon.clear();
52 polygon << polyArc(x, y, oR, 135, 225) << polyArc(x, y, iR, 135, 225);
53 act = addRadioUiAction(4, QList<int>() << Qt::Key_Down << Qt::Key_Delete << Qt::Key_Escape << Qt::Key_Backspace, tr("DN/DEL/BKSP"), tr("[ RTN ]"));
54 ui->rightbuttons->addArea(polygon, "Horus/right_btnD.png", act);
56 polygon.clear();
57 polygon << polyArc(x, y, oR, 225, 315) << polyArc(x, y, iR, 225, 315);
58 act = addRadioUiAction(6, QList<int>() << Qt::Key_Left, tr("LEFT"), tr("[ SYS ]"));
59 ui->rightbuttons->addArea(polygon, "Horus/right_btnL.png", act);
61 polygon.clear();
62 polygon << polyArc(x, y, oR, 45, 135) << polyArc(x, y, iR, 45, 135);
63 act = addRadioUiAction(5, QList<int>() << Qt::Key_Right, tr("RIGHT"), tr("[ TELE ]"));
64 ui->rightbuttons->addArea(polygon, "Horus/right_btnR.png", act);
66 m_keymapHelp.append(keymapHelp_t(tr("WHEEL/PAD SCRL"), tr("Rotary Selector")));
68 m_scrollUpAction = addRadioUiAction(-1, QList<int>() << Qt::Key_Minus << Qt::Key_X, tr("-/X"), tr("Rotary UP"));
69 m_scrollDnAction = addRadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Equal << Qt::Key_C, tr("+/C"), tr("Rotary DOWN"));
71 act = addRadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, tr("ENTER/MOUSE-MID"), tr("Selector Press"));
72 ui->rightbuttons->addArea(polyArc(x, y, iR), "Horus/right_ent.png", act);
74 ui->leftbuttons->addArea(9, 259, 34, 282, "Horus/left_scrnsht.png", m_screenshotAction);
76 m_backlightColors << QColor(47, 123, 227);
78 setLcd(ui->lcd);
79 connectScrollActions();
82 SimulatedUIWidgetX12::~SimulatedUIWidgetX12()
84 delete ui;