[companion] Adjust GVAR not possible in global functions (fix #5425)
[opentx.git] / companion / src / simulation / simulateduiwidgetX9.cpp
blobb274089bddb0a4bc62c01ddc6617c1f0cd265fd6
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_simulateduiwidgetX9.h"
24 SimulatedUIWidgetX9::SimulatedUIWidgetX9(SimulatorInterface *simulator, QWidget * parent):
25 SimulatedUIWidget(simulator, parent),
26 ui(new Ui::SimulatedUIWidgetX9)
28 RadioUiAction * act;
30 ui->setupUi(this);
32 // add actions in order of appearance on the help menu
34 // button placement, size, spacing
35 const int btop = 45, vsp = 17;
36 QRect btn(16, btop, 46, 31);
38 // left side
40 act = new RadioUiAction(0, QList<int>() << Qt::Key_Up << Qt::Key_PageUp, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_MENU);
41 addRadioWidget(ui->leftbuttons->addArea(btn, "Taranis/x9l1.png", act));
42 btn.moveTop(btn.top() + btn.height() + vsp);
44 act = new RadioUiAction(3, QList<int>() << Qt::Key_Down << Qt::Key_PageDown, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_PAGE);
45 addRadioWidget(ui->leftbuttons->addArea(btn, "Taranis/x9l2.png", act));
46 btn.moveTop(btn.top() + btn.height() + vsp);
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(btn, "Taranis/x9l3.png", act));
51 m_scrollUpAction = new RadioUiAction(4, QList<int>() << Qt::Key_Plus << Qt::Key_Equal << Qt::Key_Left,
52 SIMU_STR_HLP_KEY_LFT % "|" % SIMU_STR_HLP_KEY_PLS % "|" % SIMU_STR_HLP_MOUSE_UP, SIMU_STR_HLP_ACT_PLS);
53 m_scrollDnAction = new RadioUiAction(5, QList<int>() << Qt::Key_Minus << Qt::Key_Right,
54 SIMU_STR_HLP_KEY_RGT % "|" % SIMU_STR_HLP_KEY_MIN % "|" % SIMU_STR_HLP_MOUSE_DN, SIMU_STR_HLP_ACT_MIN);
56 // right side
57 btn.moveTopLeft(QPoint(58, btop));
59 addRadioWidget(ui->rightbuttons->addArea(btn, "Taranis/x9r1.png", m_scrollUpAction));
60 btn.moveTop(btn.top() + btn.height() + vsp);
62 addRadioWidget(ui->rightbuttons->addArea(btn, "Taranis/x9r2.png", m_scrollDnAction));
63 btn.moveTop(btn.top() + btn.height() + vsp);
65 m_mouseMidClickAction = new RadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ENT);
66 addRadioWidget(ui->rightbuttons->addArea(btn, "Taranis/x9r3.png", m_mouseMidClickAction));
68 addRadioWidget(ui->leftbuttons->addArea(QRect(89, 177, 30, 20), "Taranis/x9l4.png", m_screenshotAction));
70 m_backlightColors << QColor(47, 123, 227); // Taranis Blue
71 m_backlightColors << QColor(166,247,159);
72 m_backlightColors << QColor(247,159,166);
73 m_backlightColors << QColor(255,195,151);
74 m_backlightColors << QColor(247,242,159);
76 setLcd(ui->lcd);
79 SimulatedUIWidgetX9::~SimulatedUIWidgetX9()
81 delete ui;