feat(cpn): add support for surface radios inc Radiomaster MT12 (#5381)
This commit is contained in:
@@ -49,6 +49,7 @@ set(${PROJECT_NAME}_SRCS
|
||||
simulateduiwidgetJumperTPRO.cpp
|
||||
simulateduiwidgetJumperTPROS.cpp
|
||||
simulateduiwidgetLR3PRO.cpp
|
||||
simulateduiwidgetMT12.cpp
|
||||
simulateduiwidgetNV14.cpp
|
||||
simulateduiwidgetPL18.cpp
|
||||
simulateduiwidgetPocket.cpp
|
||||
@@ -70,6 +71,7 @@ set(${PROJECT_NAME}_SRCS
|
||||
set(${PROJECT_NAME}_HDRS
|
||||
${${PROJECT_NAME}_HDRS}
|
||||
radiouiaction.h
|
||||
simulateduiwidgetGeneric.h
|
||||
widgets/buttonswidget.h
|
||||
widgets/radiofaderwidget.h
|
||||
widgets/radiokeywidget.h
|
||||
@@ -84,6 +86,11 @@ qt5_wrap_cpp(${PROJECT_NAME}_SRCS
|
||||
${${PROJECT_NAME}_HDRS}
|
||||
)
|
||||
|
||||
# AUTOUIC does not detect as ui in .h so manually process
|
||||
qt5_wrap_ui(${PROJECT_NAME}_SRCS
|
||||
simulateduiwidgetGeneric.ui
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
${${PROJECT_NAME}_SRCS}
|
||||
)
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DEBUGOUTPUT_H_
|
||||
#define _DEBUGOUTPUT_H_
|
||||
#pragma once
|
||||
|
||||
#include "simulator.h"
|
||||
#include "simulatorinterface.h"
|
||||
@@ -107,6 +106,3 @@ class DeleteComboBoxItemEventFilter : public QObject
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
};
|
||||
|
||||
#endif // _DEBUGOUTPUT_H_
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef FILTEREDTEXTBUFFER_H
|
||||
#define FILTEREDTEXTBUFFER_H
|
||||
#pragma once
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QRegularExpression>
|
||||
@@ -117,6 +116,3 @@ class FilteredTextBuffer : public FIFOBufferDevice
|
||||
bool m_lineFilterEnable;
|
||||
bool m_lineFilterExclusive;
|
||||
};
|
||||
|
||||
|
||||
#endif // FILTEREDTEXTBUFFER_H
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _JOYSTICK_H_
|
||||
#define _JOYSTICK_H_
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
@@ -82,5 +81,3 @@ class Joystick : public QObject
|
||||
public slots:
|
||||
void processEvents();
|
||||
};
|
||||
|
||||
#endif // _JOYSTICK_H_
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _JOYSTICKDIALOG_H_
|
||||
#define _JOYSTICKDIALOG_H_
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets>
|
||||
#include "appdata.h"
|
||||
@@ -79,5 +78,3 @@ class joystickDialog : public QDialog
|
||||
void on_okButton_clicked();
|
||||
|
||||
};
|
||||
|
||||
#endif // _JOYSTICKDIALOG_H_
|
||||
|
||||
@@ -222,9 +222,10 @@ void RadioOutputsWidget::setupGVarsDisplay()
|
||||
ui->globalVarsScroll->setWidget(gvarsWidget);
|
||||
|
||||
QPalette::ColorRole bgrole = QPalette::AlternateBase;
|
||||
const bool isAir = Boards::isAir();
|
||||
for (int fm=0; fm < fmodes; fm++) {
|
||||
QLabel * label = new QLabel(gvarsWidget);
|
||||
label->setText(QString(tr("FM%1")).arg(fm));
|
||||
label->setText(QString("%1%2").arg(isAir ? tr("FM") : tr("DM")).arg(fm));
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
label->setBackgroundRole(bgrole);
|
||||
gvarsLayout->addWidget(label, 0, fm+1);
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef RADIOOUTPUTSWIDGET_H
|
||||
#define RADIOOUTPUTSWIDGET_H
|
||||
#pragma once
|
||||
|
||||
#include "simulator.h"
|
||||
#include "simulatorinterface.h"
|
||||
@@ -86,5 +85,3 @@ class RadioOutputsWidget : public QWidget
|
||||
private:
|
||||
Ui::RadioOutputsWidget * ui;
|
||||
};
|
||||
|
||||
#endif // RADIOOUTPUTSWIDGET_H
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef RADIOUIACTION_H
|
||||
#define RADIOUIACTION_H
|
||||
#pragma once
|
||||
|
||||
#include <QtCore>
|
||||
#include <QWidget>
|
||||
@@ -43,7 +42,7 @@ class RadioUiAction : public QObject
|
||||
* @param text Optional title for this action. The text and description are currently used in generated help text.
|
||||
* @param descript Optional longer description text for this action.
|
||||
*/
|
||||
RadioUiAction(int index = -1, int key = 0, const QString &text = "", const QString &descript = "", QWidget * parent = NULL):
|
||||
RadioUiAction(int index = -1, int key = 0, const QString &text = "", const QString &descript = "", QWidget * parent = nullptr):
|
||||
m_hwIndex(index),
|
||||
m_active(false),
|
||||
m_keys(QList<int>()),
|
||||
@@ -57,7 +56,7 @@ class RadioUiAction : public QObject
|
||||
* @param keys QList of Qt:Key codes to use as shortcuts.
|
||||
* [See above for other params.]
|
||||
*/
|
||||
RadioUiAction(int index, QList<int> keys, const QString &text = "", const QString &descript = "", QWidget * parent = NULL):
|
||||
RadioUiAction(int index, QList<int> keys, const QString &text = "", const QString &descript = "", QWidget * parent = nullptr):
|
||||
RadioUiAction(index, 0, text, descript, parent)
|
||||
{
|
||||
addKeys(keys);
|
||||
@@ -165,15 +164,3 @@ class RadioUiAction : public QObject
|
||||
void pushed(int index); // only emitted on user interaction && when 'active' is true
|
||||
void pushed();
|
||||
};
|
||||
|
||||
#endif // RADIOUIACTION_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "radiouiaction.h"
|
||||
#include "radiokeywidget.h"
|
||||
#include "simulatorinterface.h"
|
||||
#include "buttonswidget.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
//#define FLASH_DURATION 10
|
||||
//#define CBEEP_ON "QLabel { background-color: #FF364E }"
|
||||
@@ -34,11 +38,11 @@ SimulatedUIWidget::SimulatedUIWidget(SimulatorInterface * simulator, QWidget * p
|
||||
QWidget(parent),
|
||||
m_simulator(simulator),
|
||||
m_parent(parent),
|
||||
m_lcd(NULL),
|
||||
m_scrollUpAction(NULL),
|
||||
m_scrollDnAction(NULL),
|
||||
m_mouseMidClickAction(NULL),
|
||||
m_screenshotAction(NULL),
|
||||
m_lcd(nullptr),
|
||||
m_scrollUpAction(nullptr),
|
||||
m_scrollDnAction(nullptr),
|
||||
m_mouseMidClickAction(nullptr),
|
||||
m_screenshotAction(nullptr),
|
||||
m_board(getCurrentBoard()),
|
||||
m_backLight(0),
|
||||
m_beepShow(0),
|
||||
@@ -191,11 +195,11 @@ void SimulatedUIWidget::mouseReleaseEvent(QMouseEvent * event)
|
||||
void SimulatedUIWidget::setLcd(LcdWidget * lcd)
|
||||
{
|
||||
m_lcd = lcd;
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
Board::Type board = getCurrentBoard();
|
||||
|
||||
auto width = firmware->getCapability(LcdWidth);
|
||||
auto height = firmware->getCapability(LcdHeight);
|
||||
auto depth = firmware->getCapability(LcdDepth);
|
||||
auto width = Boards::getCapability(board, Board::LcdWidth);
|
||||
auto height = Boards::getCapability(board, Board::LcdHeight);
|
||||
auto depth = Boards::getCapability(board, Board::LcdDepth);
|
||||
m_lcd->setData(width, height, depth);
|
||||
|
||||
if (!m_backlightColors.size())
|
||||
@@ -227,3 +231,141 @@ void SimulatedUIWidget::connectScrollActions()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
int SimulatedUIWidget::strKeyToInt(std::string key)
|
||||
{
|
||||
QStringList keys = {
|
||||
"KEY_MENU",
|
||||
"KEY_EXIT",
|
||||
"KEY_ENTER",
|
||||
"KEY_PAGEUP",
|
||||
"KEY_PAGEDN",
|
||||
"KEY_UP",
|
||||
"KEY_DOWN",
|
||||
"KEY_LEFT",
|
||||
"KEY_RIGHT",
|
||||
"KEY_PLUS",
|
||||
"KEY_MINUS",
|
||||
"KEY_MODEL",
|
||||
"KEY_TELE",
|
||||
"KEY_SYS",
|
||||
"KEY_SHIFT",
|
||||
"KEY_BIND"
|
||||
};
|
||||
|
||||
return keys.indexOf(key.c_str());
|
||||
}
|
||||
|
||||
void SimulatedUIWidget::addScrollActions()
|
||||
{
|
||||
// Note: the keys cannot duplicate those used for radio buttons
|
||||
m_scrollUpAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Minus,
|
||||
SIMU_STR_HLP_KEY_MIN % "|" % SIMU_STR_HLP_MOUSE_UP, SIMU_STR_HLP_ACT_ROT_LFT);
|
||||
m_scrollDnAction = new RadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Equal,
|
||||
SIMU_STR_HLP_KEY_PLS % "|" % SIMU_STR_HLP_MOUSE_DN, SIMU_STR_HLP_ACT_ROT_RGT);
|
||||
connectScrollActions();
|
||||
}
|
||||
|
||||
void SimulatedUIWidget::addMouseActions()
|
||||
{
|
||||
m_mouseMidClickAction = new RadioUiAction(KEY_ENTER, QList<int>() << Qt::Key_Enter << Qt::Key_Return,
|
||||
SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN);
|
||||
}
|
||||
|
||||
// Notes: unused rows will be hidden and squashed
|
||||
// keys cannot duplicate those used for scrolling tefer m_mouseMidClickAction
|
||||
static const QList<GenericKeyDefinition> genericKeyDefinitions = {
|
||||
{ KEY_SYS, 'R', 0, 0, QList<int>() << Qt::Key_Left, SIMU_STR_HLP_KEY_LFT, SIMU_STR_HLP_ACT_SYS },
|
||||
|
||||
{ KEY_MODEL, 'R', 0, 1, QList<int>() << Qt::Key_Up, SIMU_STR_HLP_KEY_UP, SIMU_STR_HLP_ACT_MDL },
|
||||
|
||||
{ KEY_PAGEUP, 'R', 1, 0, QList<int>() << Qt::Key_PageUp, SIMU_STR_HLP_KEY_PGUP, SIMU_STR_HLP_ACT_PGUP },
|
||||
|
||||
{ KEY_PAGEDN, 'R', 1, 1, QList<int>() << Qt::Key_PageDown, SIMU_STR_HLP_KEY_PGDN, SIMU_STR_HLP_ACT_PGDN },
|
||||
|
||||
{ KEY_UP, 'R', 2, 0, QList<int>() << Qt::Key_Up
|
||||
<< Qt::Key_PageUp, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_UP },
|
||||
|
||||
{ KEY_DOWN, 'R', 2, 1, QList<int>() << Qt::Key_Down
|
||||
<< Qt::Key_PageDown, SIMU_STR_HLP_KEYS_GO_DN, SIMU_STR_HLP_ACT_DN },
|
||||
|
||||
{ KEY_LEFT, 'R', 3, 0, QList<int>() << Qt::Key_Left
|
||||
<< Qt::Key_Minus, SIMU_STR_HLP_KEY_LFT % "|" % SIMU_STR_HLP_KEY_MIN, SIMU_STR_HLP_ACT_MIN },
|
||||
|
||||
{ KEY_RIGHT, 'R', 3, 1, QList<int>() << Qt::Key_Right
|
||||
<< Qt::Key_Plus, SIMU_STR_HLP_KEY_RGT % "|" % SIMU_STR_HLP_KEY_PLS, SIMU_STR_HLP_ACT_PLS },
|
||||
|
||||
{ KEY_MINUS, 'R', 4, 0, QList<int>() << Qt::Key_Minus
|
||||
<< Qt::Key_Right, SIMU_STR_HLP_KEY_RGT % "|" % SIMU_STR_HLP_KEY_MIN % "|" % SIMU_STR_HLP_MOUSE_DN, SIMU_STR_HLP_ACT_MIN },
|
||||
|
||||
{ KEY_PLUS, 'R', 4, 1, QList<int>() << Qt::Key_Plus
|
||||
<< Qt::Key_Equal
|
||||
<< Qt::Key_Left, SIMU_STR_HLP_KEY_LFT % "|" % SIMU_STR_HLP_KEY_PLS % "|" % SIMU_STR_HLP_MOUSE_UP, SIMU_STR_HLP_ACT_PLS },
|
||||
|
||||
{ KEY_TELE, 'R', 5, 1, QList<int>() << Qt::Key_Right, SIMU_STR_HLP_KEY_RGT, SIMU_STR_HLP_ACT_TELE },
|
||||
|
||||
{ KEY_MENU, 'R', 6, 0, QList<int>() << Qt::Key_Up
|
||||
<< Qt::Key_PageUp, SIMU_STR_HLP_KEYS_GO_UP, SIMU_STR_HLP_ACT_MENU },
|
||||
|
||||
{ KEY_SHIFT, 'R', 6, 1, QList<int>() << Qt::Key_S, SIMU_STR_HLP_KEY_SHIFT, SIMU_STR_HLP_ACT_SHIFT },
|
||||
|
||||
{ KEY_EXIT, 'R', 7, 0, QList<int>() << Qt::Key_Down
|
||||
<< Qt::Key_Delete
|
||||
<< Qt::Key_Escape
|
||||
<< Qt::Key_Backspace, SIMU_STR_HLP_KEYS_EXIT, SIMU_STR_HLP_ACT_EXIT },
|
||||
|
||||
{ KEY_ENTER, 'R', 7, 1, QList<int>() << Qt::Key_Enter
|
||||
<< Qt::Key_Return, SIMU_STR_HLP_KEYS_ACTIVATE, SIMU_STR_HLP_ACT_ROT_DN },
|
||||
};
|
||||
|
||||
void SimulatedUIWidget::addGenericPushButtons(ButtonsWidget * leftButtons, ButtonsWidget * rightButtons)
|
||||
{
|
||||
QGridLayout * leftButtonsGrid = new QGridLayout();
|
||||
QGridLayout * rightButtonsGrid = new QGridLayout();
|
||||
|
||||
for (int i = 0; i < Boards::getCapability(m_board, Board::Keys); i++) {
|
||||
Board::KeyInfo info = Boards::getKeyInfo(i, m_board);
|
||||
int idx = strKeyToInt(info.key);
|
||||
//qDebug() << "key:" << info.key.c_str() << info.name.c_str() << info.label.c_str() << idx;
|
||||
if (idx >= 0)
|
||||
addGenericPushButton(idx, info.label.c_str(), leftButtons, leftButtonsGrid, rightButtons, rightButtonsGrid);
|
||||
else
|
||||
qDebug() << "Unknown key:" << info.key.c_str() << info.name.c_str() << info.label.c_str();
|
||||
}
|
||||
|
||||
QGridLayout * gridLeft = new QGridLayout((QWidget *)leftButtons);
|
||||
gridLeft->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0);
|
||||
gridLeft->addLayout(leftButtonsGrid, 0, 1);
|
||||
//gridLeft->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
|
||||
|
||||
QGridLayout * gridRight = new QGridLayout((QWidget *)rightButtons);
|
||||
//gridRight->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0);
|
||||
gridRight->addLayout(rightButtonsGrid, 0, 1);
|
||||
gridRight->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
|
||||
}
|
||||
|
||||
void SimulatedUIWidget::addGenericPushButton(int index, QString label, ButtonsWidget * leftButtons, QGridLayout * leftButtonsGrid,
|
||||
ButtonsWidget * rightButtons, QGridLayout * rightButtonsGrid)
|
||||
{
|
||||
if (index >= genericKeyDefinitions.size())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < genericKeyDefinitions.size(); i++) {
|
||||
const GenericKeyDefinition defn = genericKeyDefinitions.at(i);
|
||||
|
||||
if (defn.index == index) {
|
||||
QPushButton * b = new QPushButton(label);
|
||||
b->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
b->setMinimumSize(60, 30);
|
||||
b->setMaximumSize(60, 30);
|
||||
RadioUiAction * act = new RadioUiAction();
|
||||
ButtonsWidget * btns = defn.side == 'L' ? leftButtons : rightButtons;
|
||||
QGridLayout * grid = defn.side == 'L' ? leftButtonsGrid : rightButtonsGrid;
|
||||
grid->addWidget(b, defn.gridRow, defn.gridCol);
|
||||
act = new RadioUiAction(defn.index, defn.keys, defn.helpKeys, defn.helpActions);
|
||||
addRadioWidget(btns->addPushButton(b, act));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef SIMULATEDUIWIDGET_H
|
||||
#define SIMULATEDUIWIDGET_H
|
||||
#pragma once
|
||||
|
||||
#include "boards.h"
|
||||
#include "constants.h"
|
||||
@@ -35,6 +34,8 @@ class SimulatorInterface;
|
||||
class LcdWidget;
|
||||
class RadioKeyWidget;
|
||||
class RadioUiAction;
|
||||
class ButtonsWidget;
|
||||
class QPushButton;
|
||||
|
||||
// Match with /radio/src/hal/key_driver.h
|
||||
enum EnumKeys {
|
||||
@@ -64,6 +65,23 @@ enum EnumKeys {
|
||||
MAX_KEYS
|
||||
};
|
||||
|
||||
struct GenericKeyDefinition {
|
||||
int index = 0;
|
||||
QChar side = 'L';
|
||||
int gridRow = 0;
|
||||
int gridCol = 0;
|
||||
QList<int> keys = QList<int>();
|
||||
QString helpKeys = "";
|
||||
QString helpActions = "";
|
||||
|
||||
GenericKeyDefinition(int index, QChar side, int gridRow, int gridCol,
|
||||
QList<int> keys, QString helpKeys, QString helpActions) :
|
||||
index(index), side(side), gridRow(gridRow), gridCol(gridCol),
|
||||
keys(keys), helpKeys(helpKeys), helpActions(helpActions) {}
|
||||
|
||||
GenericKeyDefinition() = default;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is a base class for the main hardware-specific radio user interface, including LCD screen and navigation buttons/widgets.
|
||||
* It is responsible for hanlding all interactions with this part of the simulation (vs. common radio widgets like sticks/switches/knobs).
|
||||
@@ -126,11 +144,20 @@ class SimulatedUIWidget : public QWidget
|
||||
unsigned int m_backLight;
|
||||
int m_beepShow;
|
||||
int m_beepVal;
|
||||
|
||||
static int strKeyToInt(std::string key);
|
||||
|
||||
void addGenericPushButton(int index, QString label, ButtonsWidget * leftButtons, QGridLayout * leftButtonsGrid,
|
||||
ButtonsWidget * rightButtons, QGridLayout * rightButtonsGrid);
|
||||
void addGenericPushButtons(ButtonsWidget * leftButtons, ButtonsWidget * rightButtons);
|
||||
void addScrollActions();
|
||||
void addMouseActions();
|
||||
};
|
||||
|
||||
|
||||
// Each subclass is responsible for its own Ui
|
||||
namespace Ui {
|
||||
class SimulatedUIWidgetGeneric;
|
||||
class SimulatedUIWidget9X;
|
||||
class SimulatedUIWidgetX9LITE;
|
||||
class SimulatedUIWidgetX7;
|
||||
@@ -156,6 +183,7 @@ namespace Ui {
|
||||
class SimulatedUIWidgetTX12;
|
||||
class SimulatedUIWidgetZorro;
|
||||
class SimulatedUIWidgetBoxer;
|
||||
class SimulatedUIWidgetMT12;
|
||||
class SimulatedUIWidgetPocket;
|
||||
class SimulatedUIWidgetT8;
|
||||
class SimulatedUIWidgetFatfishF16;
|
||||
@@ -165,6 +193,19 @@ namespace Ui {
|
||||
class SimulatedUIWidgetV16;
|
||||
}
|
||||
|
||||
class SimulatedUIWidgetGeneric: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SimulatedUIWidgetGeneric(SimulatorInterface * simulator, QWidget * parent = nullptr);
|
||||
virtual ~SimulatedUIWidgetGeneric();
|
||||
|
||||
private:
|
||||
Ui::SimulatedUIWidgetGeneric * ui;
|
||||
|
||||
};
|
||||
|
||||
class SimulatedUIWidget9X: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -469,6 +510,15 @@ class SimulatedUIWidgetBoxer: public SimulatedUIWidget
|
||||
Ui::SimulatedUIWidgetBoxer * ui;
|
||||
};
|
||||
|
||||
class SimulatedUIWidgetMT12: public SimulatedUIWidgetGeneric
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SimulatedUIWidgetMT12(SimulatorInterface * simulator, QWidget * parent = nullptr);
|
||||
virtual ~SimulatedUIWidgetMT12();
|
||||
};
|
||||
|
||||
class SimulatedUIWidgetPocket: public SimulatedUIWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -552,5 +602,3 @@ class SimulatedUIWidgetV16: public SimulatedUIWidget
|
||||
private:
|
||||
Ui::SimulatedUIWidgetV16 * ui;
|
||||
};
|
||||
|
||||
#endif // SIMULATEDUIWIDGET_H
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetBoxer.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetCommando8.h"
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
#include "simulateduiwidget.h"
|
||||
#include "ui_simulateduiwidgetFatfishF16.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "simulateduiwidget.h"
|
||||
#include "ui_simulateduiwidgetGeneric.h"
|
||||
|
||||
/*
|
||||
Note: This class is not expected to be instantiated directly but as the base for each firmware that uses it
|
||||
due to the methods and functions surrounding the building and loading of radio simulators
|
||||
*/
|
||||
|
||||
SimulatedUIWidgetGeneric::SimulatedUIWidgetGeneric(SimulatorInterface *simulator, QWidget * parent):
|
||||
SimulatedUIWidget(simulator, parent),
|
||||
ui(new Ui::SimulatedUIWidgetGeneric)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
addGenericPushButtons(ui->leftbuttons, ui->rightbuttons);
|
||||
|
||||
addScrollActions();
|
||||
|
||||
setLcd(ui->lcd);
|
||||
}
|
||||
|
||||
SimulatedUIWidgetGeneric::~SimulatedUIWidgetGeneric()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SimulatedUIWidgetGeneric</class>
|
||||
<widget class="QWidget" name="SimulatedUIWidgetGeneric">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>737</width>
|
||||
<height>246</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>737</width>
|
||||
<height>246</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>737</width>
|
||||
<height>246</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Generic Simulator</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<widget class="ButtonsWidget" name="leftbuttons" native="true">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>241</width>
|
||||
<height>246</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>246</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>246</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ButtonsWidget" name="rightbuttons" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>496</x>
|
||||
<y>0</y>
|
||||
<width>241</width>
|
||||
<height>246</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>246</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>246</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="bottom" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>241</x>
|
||||
<y>188</y>
|
||||
<width>255</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>255</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>255</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="LcdWidget" name="lcd" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>59</y>
|
||||
<width>256</width>
|
||||
<height>128</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>180</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(215, 243, 255);</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="top" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>241</x>
|
||||
<y>0</y>
|
||||
<width>255</width>
|
||||
<height>59</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>255</width>
|
||||
<height>59</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>255</width>
|
||||
<height>59</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>bottom</zorder>
|
||||
<zorder>top</zorder>
|
||||
<zorder>rightbuttons</zorder>
|
||||
<zorder>leftbuttons</zorder>
|
||||
<zorder>lcd</zorder>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LcdWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>lcdwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>buttonswidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../companion.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetJumperT12.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetJumperT14.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetJumperT20.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetJumperTLITE.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetJumperTPRO.h"
|
||||
#include "eeprominterface.h"
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetLR3PRO.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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 "simulateduiwidgetGeneric.h"
|
||||
|
||||
SimulatedUIWidgetMT12::SimulatedUIWidgetMT12(SimulatorInterface *simulator, QWidget * parent):
|
||||
SimulatedUIWidgetGeneric(simulator, parent)
|
||||
{
|
||||
// Perform any customisation such as loading lcd area background color lists
|
||||
}
|
||||
|
||||
SimulatedUIWidgetMT12::~SimulatedUIWidgetMT12()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetPocket.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetT8.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetTX12.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetX7.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetX9LITE.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetXLITE.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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_simulateduiwidgetZorro.h"
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef SIMULATOR_H
|
||||
#define SIMULATOR_H
|
||||
#pragma once
|
||||
|
||||
#include <QColor>
|
||||
#include <QDataStream>
|
||||
@@ -195,6 +194,3 @@ struct SimulatorOptions
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(SimulatorOptions)
|
||||
|
||||
|
||||
#endif // SIMULATOR_H
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
#ifndef SIMULATOR_STRINGS_H
|
||||
#define SIMULATOR_STRINGS_H
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -64,5 +84,3 @@
|
||||
#define SIMU_STR_HLP_ACT_ROT_LFT SIMU_STR_HLP_ROTENC % " " % SIMU_STR_HLP_ROTENC_LFT
|
||||
#define SIMU_STR_HLP_ACT_ROT_RGT SIMU_STR_HLP_ROTENC % " " % SIMU_STR_HLP_ROTENC_RGT
|
||||
#define SIMU_STR_HLP_ACT_ROT_DN SIMU_STR_HLP_ROTENC % " " % SIMU_STR_HLP_ROTENC_DN
|
||||
|
||||
#endif // SIMULATOR_STRINGS_H
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _SIMULATORINTERFACE_H_
|
||||
#define _SIMULATORINTERFACE_H_
|
||||
#pragma once
|
||||
|
||||
#include "firmwares/boards.h"
|
||||
#include "constants.h"
|
||||
@@ -204,5 +203,3 @@ class SimulatorLoader
|
||||
static int registerSimulators(const QDir & dir);
|
||||
static QMap<QString, QLibrary *> registeredSimulators;
|
||||
};
|
||||
|
||||
#endif // _SIMULATORINTERFACE_H_
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef SIMULATORMAINWINDOW_H
|
||||
#define SIMULATORMAINWINDOW_H
|
||||
#pragma once
|
||||
|
||||
#include "simulator.h"
|
||||
|
||||
@@ -114,5 +113,3 @@ class SimulatorMainWindow : public QMainWindow
|
||||
|
||||
const static quint16 m_savedUiStateVersion;
|
||||
};
|
||||
|
||||
#endif // SIMULATORMAINWINDOW_H
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>OpenTx Simulator</string>
|
||||
<string>EdgeTX Simulator</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../companion.qrc">
|
||||
@@ -37,7 +37,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>644</width>
|
||||
<height>21</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="nativeMenuBar">
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef SIMULATORSTARTUPDIALOG_H
|
||||
#define SIMULATORSTARTUPDIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "simulator.h"
|
||||
#include <QDialog>
|
||||
@@ -75,5 +74,3 @@ class SimulatorStartupDialog : public QDialog
|
||||
|
||||
void setGlobalFirmware(const QString & id);
|
||||
};
|
||||
|
||||
#endif // SIMULATORSTARTUPDIALOG_H
|
||||
|
||||
@@ -138,6 +138,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
||||
case Board::BOARD_RADIOMASTER_BOXER:
|
||||
radioUiWidget = new SimulatedUIWidgetBoxer(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_RADIOMASTER_MT12:
|
||||
radioUiWidget = new SimulatedUIWidgetMT12(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_RADIOMASTER_T8:
|
||||
radioUiWidget = new SimulatedUIWidgetT8(simulator, this);
|
||||
break;
|
||||
@@ -836,7 +839,7 @@ void SimulatorWidget::onSimulatorError(const QString & error)
|
||||
|
||||
void SimulatorWidget::onPhaseChanged(qint32 phase, const QString & name)
|
||||
{
|
||||
setWindowTitle(windowName + tr(" - Flight Mode %1 (#%2)").arg(name).arg(phase));
|
||||
setWindowTitle(windowName + QString(" - %1 %2 (#%3)").arg(Boards::getCapability(m_board, Board::Air) ? tr("Flight Mode") : tr("Drive Mode")).arg(name).arg(phase));
|
||||
}
|
||||
|
||||
void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetType type, int index, int value)
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _SIMULATORWIDGET_H_
|
||||
#define _SIMULATORWIDGET_H_
|
||||
#pragma once
|
||||
|
||||
#include "appdata.h"
|
||||
#include "constants.h"
|
||||
@@ -152,5 +151,3 @@ class SimulatorWidget : public QWidget
|
||||
int switchDirection[MAX_JS_BUTTONS];
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _SIMULATORWIDGET_H_
|
||||
|
||||
@@ -121,4 +121,3 @@ class TelemetrySimulator : public QWidget
|
||||
|
||||
LogPlaybackController *logPlayback;
|
||||
}; // TelemetrySimulator
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _TRAINERSIMU_H_
|
||||
#define _TRAINERSIMU_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QShowEvent>
|
||||
#include <QCloseEvent>
|
||||
@@ -67,6 +65,3 @@ class TrainerSimulator : public QWidget
|
||||
bool m_simuStarted;
|
||||
|
||||
};
|
||||
|
||||
#endif // _TRAINERSIMU_H_
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _BUTTONSWIDGET_H_
|
||||
#define _BUTTONSWIDGET_H_
|
||||
#pragma once
|
||||
|
||||
#include "radiouiaction.h"
|
||||
#include "radiokeywidget.h"
|
||||
@@ -46,17 +45,46 @@ class ButtonsWidget : public QWidget
|
||||
QWidget::setStyleSheet(sheet);
|
||||
}
|
||||
|
||||
RadioKeyWidget * addArea(const QRect & rect, const char * image, RadioUiAction * action = NULL)
|
||||
RadioKeyWidget * addArea(const QRect & rect, const char * image, RadioUiAction * action = nullptr)
|
||||
{
|
||||
return addArea(QPolygon(rect), image, action);
|
||||
}
|
||||
|
||||
RadioKeyWidget * addArea(const QPolygon & polygon, const char * image, RadioUiAction * action = NULL)
|
||||
RadioKeyWidget * addArea(const QPolygon & polygon, const char * image, RadioUiAction * action = nullptr)
|
||||
{
|
||||
RadioKeyWidget * btn = new RadioKeyWidget(polygon, image, action, this);
|
||||
m_buttons.append(btn);
|
||||
connect(btn, &RadioKeyWidget::imageChanged, this, &ButtonsWidget::setBitmap);
|
||||
return btn;
|
||||
RadioKeyWidget * rkw = new RadioKeyWidget(polygon, image, action, this);
|
||||
m_buttons.append(rkw);
|
||||
connect(rkw, &RadioKeyWidget::imageChanged, this, &ButtonsWidget::setBitmap);
|
||||
return rkw;
|
||||
}
|
||||
|
||||
RadioKeyWidget * addPushButton(QPushButton * pushbtn, RadioUiAction * action = nullptr)
|
||||
{
|
||||
RadioKeyWidget * rkw = new RadioKeyWidget(pushbtn, action, this);
|
||||
m_buttons.append(rkw);
|
||||
connect(pushbtn, &QPushButton::pressed, rkw, &RadioKeyWidget::press);
|
||||
connect(pushbtn, &QPushButton::released, rkw, &RadioKeyWidget::release);
|
||||
|
||||
if (action) {
|
||||
// blink push button on click or matching key(s) press
|
||||
connect(action, static_cast<void (RadioUiAction::*)(void)>(&RadioUiAction::pushed), [this, pushbtn] (void) {
|
||||
// TODO: use a palette colors
|
||||
// set to default -> blink -> default
|
||||
QString csssave = pushbtn->styleSheet();
|
||||
QString blnkcol = "background-color: rgb(239, 41, 41)";
|
||||
// pressing the same key in rapid seccession can affect the order of the events see TODO
|
||||
if (csssave != blnkcol) {
|
||||
pushbtn->setFocus();
|
||||
pushbtn->setStyleSheet(blnkcol);
|
||||
QTimer * tim = new QTimer(this);
|
||||
tim->setSingleShot(true);
|
||||
connect(tim, &QTimer::timeout, [pushbtn, csssave]() { pushbtn->setStyleSheet(csssave); });
|
||||
tim->start(300);
|
||||
}
|
||||
});
|
||||
}
|
||||
pushbtn->setFocusPolicy(Qt::ClickFocus);
|
||||
return rkw;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -111,5 +139,3 @@ class ButtonsWidget : public QWidget
|
||||
QList<RadioKeyWidget *> m_buttons;
|
||||
QString defaultStyleSheet;
|
||||
};
|
||||
|
||||
#endif // _BUTTONSWIDGET_H_
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _RADIOFADERWIDGET_H_
|
||||
#define _RADIOFADERWIDGET_H_
|
||||
#pragma once
|
||||
|
||||
#include "radiowidget.h"
|
||||
#include "sliderwidget.h"
|
||||
@@ -63,8 +62,3 @@ class RadioFaderWidget : public RadioWidget
|
||||
setWidget(sl);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _RADIOFADERWIDGET_H_
|
||||
|
||||
@@ -19,22 +19,25 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef RADIOKEYWIDGET_H
|
||||
#define RADIOKEYWIDGET_H
|
||||
#pragma once
|
||||
|
||||
#include "radiouiaction.h"
|
||||
#include "radiowidget.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
class RadioKeyWidget : public RadioWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit RadioKeyWidget(const QPolygon & polygon, const QString &image, RadioUiAction * action = NULL, QWidget * parent = NULL, Qt::WindowFlags f = Qt::WindowFlags()):
|
||||
explicit RadioKeyWidget(const QPolygon & polygon, const QString &image, RadioUiAction * action = nullptr,
|
||||
QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags(), QPushButton * pushbtn = nullptr):
|
||||
RadioWidget(action, parent, f),
|
||||
polygon(polygon),
|
||||
imgFile(image)
|
||||
imgFile(image),
|
||||
pushbtn(pushbtn)
|
||||
{
|
||||
m_type = RADIO_WIDGET_KEY;
|
||||
setValue(0);
|
||||
@@ -42,6 +45,11 @@ class RadioKeyWidget : public RadioWidget
|
||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||
}
|
||||
|
||||
explicit RadioKeyWidget(QPushButton * pushbtn = nullptr, RadioUiAction * action = nullptr,
|
||||
QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
RadioKeyWidget(QPolygon(), QString(), action, parent, f, pushbtn) {}
|
||||
|
||||
|
||||
virtual void setAction(RadioUiAction * action)
|
||||
{
|
||||
if (m_action)
|
||||
@@ -82,6 +90,7 @@ class RadioKeyWidget : public RadioWidget
|
||||
signals:
|
||||
|
||||
void imageChanged(const QString image);
|
||||
void actionTriggered();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -91,11 +100,13 @@ class RadioKeyWidget : public RadioWidget
|
||||
emit imageChanged(active ? imgFile : "");
|
||||
}
|
||||
|
||||
virtual void onActionTriggered(int index, bool active)
|
||||
{
|
||||
if (pushbtn)
|
||||
emit actionTriggered();
|
||||
}
|
||||
|
||||
QPolygon polygon;
|
||||
QString imgFile;
|
||||
|
||||
QPushButton *pushbtn;
|
||||
};
|
||||
|
||||
#endif // RADIOKEYWIDGET_H
|
||||
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _RADIOSWITCHWIDGET_H_
|
||||
#define _RADIOSWITCHWIDGET_H_
|
||||
#pragma once
|
||||
|
||||
#include "radiowidget.h"
|
||||
#include "boards.h"
|
||||
@@ -146,5 +145,3 @@ class RadioSwitchWidget : public RadioWidget
|
||||
quint16 m_stepSize;
|
||||
|
||||
};
|
||||
|
||||
#endif // _RADIOSWITCHWIDGET_H_
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _RADIOTRIMWIDGET_H_
|
||||
#define _RADIOTRIMWIDGET_H_
|
||||
#pragma once
|
||||
|
||||
#include "radiowidget.h"
|
||||
#include "boards.h"
|
||||
@@ -138,5 +137,3 @@ class RadioTrimWidget : public RadioWidget
|
||||
int m_btnDecIndex;
|
||||
int m_btnIncIndex;
|
||||
};
|
||||
|
||||
#endif // _RADIOTRIMWIDGET_H_
|
||||
|
||||
@@ -137,10 +137,10 @@ void RadioWidget::setAction(RadioUiAction * action)
|
||||
if (m_action->getIndex() > -1)
|
||||
setIndex(m_action->getIndex());
|
||||
connect(m_action, &RadioUiAction::toggled, this, &RadioWidget::onActionToggled);
|
||||
connect(m_action, &RadioUiAction::triggered, this, &RadioWidget::onActionTriggered);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int RadioWidget::getValue() const
|
||||
{
|
||||
return m_value;
|
||||
@@ -179,6 +179,10 @@ void RadioWidget::onActionToggled(int index, bool active)
|
||||
emit valueChange(m_type, index, getValue());
|
||||
}
|
||||
|
||||
void RadioWidget::onActionTriggered(int index, bool active)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void RadioWidget::addLayout()
|
||||
{
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _RADIOWIDGET_H_
|
||||
#define _RADIOWIDGET_H_
|
||||
#pragma once
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QDebug>
|
||||
@@ -109,6 +108,7 @@ class RadioWidget : public QWidget
|
||||
void addLabel();
|
||||
void setWidget(QWidget * widget = NULL, Qt::Alignment align = Qt::AlignHCenter);
|
||||
virtual void onActionToggled(int index, bool active);
|
||||
virtual void onActionTriggered(int index, bool active);
|
||||
|
||||
QGridLayout * m_gridLayout;
|
||||
QWidget * m_controlWidget;
|
||||
@@ -126,5 +126,3 @@ class RadioWidget : public QWidget
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(RadioWidget::RadioWidgetState)
|
||||
|
||||
#endif // _RADIOWIDGET_H_
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _SLIDERWIDGET_H_
|
||||
#define _SLIDERWIDGET_H_
|
||||
#pragma once
|
||||
|
||||
#include <QtGui>
|
||||
#include <QSlider>
|
||||
@@ -64,5 +63,3 @@ class SliderWidget : public QSlider
|
||||
|
||||
QString m_toolTip;
|
||||
};
|
||||
|
||||
#endif // _SLIDERWIDGET_H_
|
||||
|
||||
@@ -36,17 +36,18 @@ VirtualJoystickWidget::VirtualJoystickWidget(QWidget *parent, QChar side, bool s
|
||||
QWidget(parent),
|
||||
stickSide(side),
|
||||
prefSize(size),
|
||||
hTrimWidget(NULL),
|
||||
vTrimWidget(NULL),
|
||||
btnHoldX(NULL),
|
||||
btnHoldY(NULL),
|
||||
btnFixX(NULL),
|
||||
btnFixY(NULL),
|
||||
nodeLabelX(NULL),
|
||||
nodeLabelY(NULL),
|
||||
hTrimWidget(nullptr),
|
||||
vTrimWidget(nullptr),
|
||||
btnHoldX(nullptr),
|
||||
btnHoldY(nullptr),
|
||||
btnFixX(nullptr),
|
||||
btnFixY(nullptr),
|
||||
nodeLabelX(nullptr),
|
||||
nodeLabelY(nullptr),
|
||||
m_stickScale(1024),
|
||||
m_stickPressed(false)
|
||||
{
|
||||
isBoardSurface = Boards::isSurface(getCurrentBoard());
|
||||
ar = (float)size.width() / size.height();
|
||||
extraSize = QSize(0, 0);
|
||||
|
||||
@@ -92,6 +93,13 @@ VirtualJoystickWidget::VirtualJoystickWidget(QWidget *parent, QChar side, bool s
|
||||
hTrimWidget = createTrimWidget('H');
|
||||
vTrimWidget = createTrimWidget('V');
|
||||
|
||||
if (isBoardSurface) {
|
||||
if (stickSide == 'L')
|
||||
vTrimWidget->hide();
|
||||
else
|
||||
vTrimWidget->hide();
|
||||
}
|
||||
|
||||
layout->addWidget(vTrimWidget, 1, colvt, 1, 1);
|
||||
layout->addWidget(hTrimWidget, 2, 2, 1, 1);
|
||||
|
||||
@@ -109,6 +117,18 @@ VirtualJoystickWidget::VirtualJoystickWidget(QWidget *parent, QChar side, bool s
|
||||
btnbox->addWidget(btnFixY = createButtonWidget(FIX_Y));
|
||||
btnbox->addWidget(btnFixX = createButtonWidget(FIX_X));
|
||||
btnbox->addWidget(btnHoldX = createButtonWidget(HOLD_X));
|
||||
if (isBoardSurface) {
|
||||
if (stickSide == 'L') {
|
||||
btnHoldX->hide();
|
||||
btnFixY->hide();
|
||||
btnFixX->hide();
|
||||
}
|
||||
else {
|
||||
btnHoldY->hide();
|
||||
btnFixY->hide();
|
||||
btnFixX->hide();
|
||||
}
|
||||
}
|
||||
|
||||
layout->addLayout(btnbox, 1, colbb, 1, 1);
|
||||
|
||||
@@ -171,23 +191,37 @@ void VirtualJoystickWidget::setStickAxisValue(int index, int value)
|
||||
using namespace Board;
|
||||
qreal rvalue = value / 1024.0f;
|
||||
|
||||
switch (index) {
|
||||
case STICK_AXIS_LH :
|
||||
if (stickSide == 'L')
|
||||
setStickX(rvalue);
|
||||
break;
|
||||
case STICK_AXIS_RH :
|
||||
if (stickSide == 'R')
|
||||
setStickX(rvalue);
|
||||
break;
|
||||
case STICK_AXIS_LV :
|
||||
if (stickSide == 'L')
|
||||
setStickY(rvalue);
|
||||
break;
|
||||
case STICK_AXIS_RV :
|
||||
if (stickSide == 'R')
|
||||
setStickY(rvalue);
|
||||
break;
|
||||
if (isBoardSurface) {
|
||||
switch (index) {
|
||||
case STICK_AXIS_SURFACE_LV :
|
||||
if (stickSide == 'L')
|
||||
setStickY(rvalue);
|
||||
break;
|
||||
case STICK_AXIS_SURFACE_RH :
|
||||
if (stickSide == 'R')
|
||||
setStickX(rvalue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (index) {
|
||||
case STICK_AXIS_LH :
|
||||
if (stickSide == 'L')
|
||||
setStickX(rvalue);
|
||||
break;
|
||||
case STICK_AXIS_RH :
|
||||
if (stickSide == 'R')
|
||||
setStickX(rvalue);
|
||||
break;
|
||||
case STICK_AXIS_LV :
|
||||
if (stickSide == 'L')
|
||||
setStickY(rvalue);
|
||||
break;
|
||||
case STICK_AXIS_RV :
|
||||
if (stickSide == 'R')
|
||||
setStickY(rvalue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,10 +333,24 @@ void VirtualJoystickWidget::setStickColor(const QColor & color)
|
||||
|
||||
void VirtualJoystickWidget::loadDefaultsForMode(const unsigned mode)
|
||||
{
|
||||
if (((mode & 1) && stickSide == 'L') || (!(mode & 1) && stickSide == 'R')) {
|
||||
setStickConstraint(HOLD_Y, true);
|
||||
setStickY(-1.0);
|
||||
onNodeYChanged();
|
||||
if (isBoardSurface) {
|
||||
if (stickSide == 'L') {
|
||||
setStickX(0.0);
|
||||
setStickConstraint(FIX_X, true);
|
||||
onNodeXChanged();
|
||||
}
|
||||
else {
|
||||
setStickY(0.0);
|
||||
setStickConstraint(FIX_Y, true);
|
||||
onNodeYChanged();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (((mode & 1) && stickSide == 'L') || (!(mode & 1) && stickSide == 'R')) {
|
||||
setStickConstraint(HOLD_Y, true);
|
||||
setStickY(-1.0);
|
||||
onNodeYChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,22 +448,22 @@ QToolButton * VirtualJoystickWidget::createButtonWidget(int type)
|
||||
switch (type) {
|
||||
case HOLD_Y:
|
||||
btnLabel = tr("Hld Y");
|
||||
tooltip = tr("Hold Vertical stick position.");
|
||||
tooltip = tr("Hold Vertical position.");
|
||||
icon = Simulator::SimulatorIcon("hold_y");
|
||||
break;
|
||||
case FIX_Y:
|
||||
btnLabel = tr("Fix Y");
|
||||
tooltip = tr("Prevent Vertical movement of stick.");
|
||||
tooltip = tr("Prevent Vertical movement.");
|
||||
icon = Simulator::SimulatorIcon("fixed_y");
|
||||
break;
|
||||
case FIX_X:
|
||||
btnLabel = tr("Fix X");
|
||||
tooltip = tr("Prevent Horizontal movement of stick.");
|
||||
tooltip = tr("Prevent Horizontal movement.");
|
||||
icon = Simulator::SimulatorIcon("fixed_x");
|
||||
break;
|
||||
case HOLD_X:
|
||||
btnLabel = tr("Hld X");
|
||||
tooltip = tr("Hold Horizontal stick position.");
|
||||
tooltip = tr("Hold Horizontal position.");
|
||||
icon = Simulator::SimulatorIcon("hold_x");
|
||||
break;
|
||||
default:
|
||||
@@ -445,11 +493,7 @@ QLayout *VirtualJoystickWidget::createNodeValueLayout(QChar type, QLabel *& valL
|
||||
val->setObjectName(QString("val_%1").arg(type));
|
||||
val->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
val->setAlignment(Qt::AlignCenter);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
val->setMinimumWidth(val->fontMetrics().width("-100 "));
|
||||
#else
|
||||
val->setMinimumWidth(val->fontMetrics().horizontalAdvance("-100 "));
|
||||
#endif
|
||||
QVBoxLayout * layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(2, 2, 2, 2);
|
||||
layout->setSpacing(2);
|
||||
@@ -464,17 +508,33 @@ int VirtualJoystickWidget::getStickIndex(QChar type)
|
||||
{
|
||||
using namespace Board;
|
||||
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H')
|
||||
return STICK_AXIS_LH;
|
||||
else
|
||||
return STICK_AXIS_LV;
|
||||
if (isBoardSurface) {
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H')
|
||||
return STICK_AXIS_SURFACE_LV;
|
||||
else
|
||||
return STICK_AXIS_SURFACE_LV;
|
||||
}
|
||||
else {
|
||||
if (type == 'H')
|
||||
return STICK_AXIS_SURFACE_RH;
|
||||
else
|
||||
return STICK_AXIS_SURFACE_RH;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (type == 'H')
|
||||
return STICK_AXIS_RH;
|
||||
else
|
||||
return STICK_AXIS_RV;
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H')
|
||||
return STICK_AXIS_LH;
|
||||
else
|
||||
return STICK_AXIS_LV;
|
||||
}
|
||||
else {
|
||||
if (type == 'H')
|
||||
return STICK_AXIS_RH;
|
||||
else
|
||||
return STICK_AXIS_RV;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,17 +542,33 @@ int VirtualJoystickWidget::getTrimSliderType(QChar type)
|
||||
{
|
||||
using namespace Board;
|
||||
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H')
|
||||
return TRIM_AXIS_LH;
|
||||
else
|
||||
return TRIM_AXIS_LV;
|
||||
if (isBoardSurface) {
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H')
|
||||
return TRIM_AXIS_SURFACE_LH;
|
||||
else
|
||||
return TRIM_AXIS_SURFACE_LH;
|
||||
}
|
||||
else {
|
||||
if (type == 'H')
|
||||
return TRIM_AXIS_SURFACE_RH;
|
||||
else
|
||||
return TRIM_AXIS_SURFACE_RH;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (type == 'H')
|
||||
return TRIM_AXIS_RH;
|
||||
else
|
||||
return TRIM_AXIS_RV;
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H')
|
||||
return TRIM_AXIS_LH;
|
||||
else
|
||||
return TRIM_AXIS_LV;
|
||||
}
|
||||
else {
|
||||
if (type == 'H')
|
||||
return TRIM_AXIS_RH;
|
||||
else
|
||||
return TRIM_AXIS_RV;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,45 +576,86 @@ int VirtualJoystickWidget::getTrimButtonType(QChar type, int pos)
|
||||
{
|
||||
using namespace Board;
|
||||
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H') {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_LH_DEC;
|
||||
else
|
||||
return TRIM_SW_LH_INC;
|
||||
if (isBoardSurface) {
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H') {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_SURFACE_LH_DEC;
|
||||
else
|
||||
return TRIM_SW_SURFACE_LH_INC;
|
||||
}
|
||||
else {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_SURFACE_LH_DEC;
|
||||
else
|
||||
return TRIM_SW_SURFACE_LH_INC;
|
||||
}
|
||||
}
|
||||
// right side
|
||||
else {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_LV_DEC;
|
||||
else
|
||||
return TRIM_SW_LV_INC;
|
||||
if (type == 'H') {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_SURFACE_RH_DEC;
|
||||
else
|
||||
return TRIM_SW_SURFACE_RH_INC;
|
||||
}
|
||||
else {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_SURFACE_RH_DEC;
|
||||
else
|
||||
return TRIM_SW_SURFACE_RH_INC;
|
||||
}
|
||||
}
|
||||
}
|
||||
// right side
|
||||
else {
|
||||
if (type == 'H') {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_RH_DEC;
|
||||
else
|
||||
return TRIM_SW_RH_INC;
|
||||
if (stickSide == 'L') {
|
||||
if (type == 'H') {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_LH_DEC;
|
||||
else
|
||||
return TRIM_SW_LH_INC;
|
||||
}
|
||||
else {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_LV_DEC;
|
||||
else
|
||||
return TRIM_SW_LV_INC;
|
||||
}
|
||||
}
|
||||
// right side
|
||||
else {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_RV_DEC;
|
||||
else
|
||||
return TRIM_SW_RV_INC;
|
||||
if (type == 'H') {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_RH_DEC;
|
||||
else
|
||||
return TRIM_SW_RH_INC;
|
||||
}
|
||||
else {
|
||||
if (pos == 0)
|
||||
return TRIM_SW_RV_DEC;
|
||||
else
|
||||
return TRIM_SW_RV_INC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RadioTrimWidget * VirtualJoystickWidget::getTrimWidget(int which)
|
||||
{
|
||||
if ((stickSide == 'L' && which == Board::TRIM_AXIS_LH) || (stickSide == 'R' && which == Board::TRIM_AXIS_RH))
|
||||
return hTrimWidget;
|
||||
else if ((stickSide == 'L' && which == Board::TRIM_AXIS_LV) || (stickSide == 'R' && which == Board::TRIM_AXIS_RV))
|
||||
return vTrimWidget;
|
||||
else
|
||||
return NULL;
|
||||
if (isBoardSurface) {
|
||||
if ((stickSide == 'L' && which == Board::TRIM_AXIS_SURFACE_LH) || (stickSide == 'R' && which == Board::TRIM_AXIS_SURFACE_RH))
|
||||
return hTrimWidget;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
if ((stickSide == 'L' && which == Board::TRIM_AXIS_LH) || (stickSide == 'R' && which == Board::TRIM_AXIS_RH))
|
||||
return hTrimWidget;
|
||||
else if ((stickSide == 'L' && which == Board::TRIM_AXIS_LV) || (stickSide == 'R' && which == Board::TRIM_AXIS_RV))
|
||||
return vTrimWidget;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void VirtualJoystickWidget::onButtonChange(bool checked)
|
||||
@@ -564,10 +681,26 @@ void VirtualJoystickWidget::onButtonChange(bool checked)
|
||||
|
||||
void VirtualJoystickWidget::updateNodeValueLabels()
|
||||
{
|
||||
if (nodeLabelX)
|
||||
nodeLabelX->setText(QString("%1").arg(getStickX() * 100.0f, 2, 'f', 0));
|
||||
if (nodeLabelY)
|
||||
nodeLabelY->setText(QString("%1").arg(getStickY() * 100.0f, 2, 'f', 0));
|
||||
if (isBoardSurface) {
|
||||
if (nodeLabelX) {
|
||||
if (stickSide == 'L')
|
||||
nodeLabelX->setText(QString("%1").arg(0)); // workaround for resize event and no analog mapped to set
|
||||
else
|
||||
nodeLabelX->setText(QString("%1").arg(getStickX() * 100.0f, 2, 'f', 0));
|
||||
}
|
||||
if (nodeLabelY) {
|
||||
if (stickSide == 'L')
|
||||
nodeLabelY->setText(QString("%1").arg(getStickY() * 100.0f, 2, 'f', 0));
|
||||
else
|
||||
nodeLabelY->setText(QString("%1").arg(0)); // workaround for resize event and no analog mapped to set
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (nodeLabelX)
|
||||
nodeLabelX->setText(QString("%1").arg(getStickX() * 100.0f, 2, 'f', 0));
|
||||
if (nodeLabelY)
|
||||
nodeLabelY->setText(QString("%1").arg(getStickY() * 100.0f, 2, 'f', 0));
|
||||
}
|
||||
}
|
||||
|
||||
void VirtualJoystickWidget::onGsMouseEvent(QGraphicsSceneMouseEvent * event)
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef VIRTUALJOYSTICKWIDGET_H
|
||||
#define VIRTUALJOYSTICKWIDGET_H
|
||||
#pragma once
|
||||
|
||||
#include "radiowidget.h"
|
||||
|
||||
@@ -62,8 +61,8 @@ class VirtualJoystickWidget : public QWidget
|
||||
int getStickScale() const;
|
||||
void setStickScale(int stickScale);
|
||||
|
||||
const RadioTrimWidget *horizontalTrim() { return hTrimWidget; }
|
||||
const RadioTrimWidget *verticalTrim() { return vTrimWidget; }
|
||||
const RadioTrimWidget *horizontalTrim() { return hTrimWidget; }
|
||||
const RadioTrimWidget *verticalTrim() { return vTrimWidget; }
|
||||
|
||||
public slots:
|
||||
void setStickX(qreal x);
|
||||
@@ -120,6 +119,7 @@ class VirtualJoystickWidget : public QWidget
|
||||
int m_yIndex;
|
||||
int m_stickScale;
|
||||
bool m_stickPressed;
|
||||
bool isBoardSurface;
|
||||
};
|
||||
|
||||
|
||||
@@ -143,5 +143,3 @@ class CustomGraphicsScene : public QGraphicsScene
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
|
||||
};
|
||||
|
||||
#endif // VIRTUALJOYSTICKWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user