feat(cpn): add support for surface radios inc Radiomaster MT12 (#5381)
This commit is contained in:
@@ -29,23 +29,27 @@
|
|||||||
#include "joystickdialog.h"
|
#include "joystickdialog.h"
|
||||||
#endif
|
#endif
|
||||||
#include "moduledata.h"
|
#include "moduledata.h"
|
||||||
#include "compounditemmodels.h"
|
#include "filtereditemmodels.h"
|
||||||
#include "updates/updatefactories.h"
|
#include "updates/updatefactories.h"
|
||||||
#include "updates/updateoptionsdialog.h"
|
#include "updates/updateoptionsdialog.h"
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
constexpr char FIM_TEMPLATESETUP[] {"Template Setup"};
|
||||||
|
|
||||||
AppPreferencesDialog::AppPreferencesDialog(QWidget * parent, UpdateFactories * factories) :
|
AppPreferencesDialog::AppPreferencesDialog(QWidget * parent, UpdateFactories * factories) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AppPreferencesDialog),
|
ui(new Ui::AppPreferencesDialog),
|
||||||
updateLock(false),
|
updateLock(false),
|
||||||
mainWinHasDirtyChild(false),
|
mainWinHasDirtyChild(false),
|
||||||
factories(factories)
|
factories(factories),
|
||||||
|
panelItemModels(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowIcon(CompanionIcon("apppreferences.png"));
|
setWindowIcon(CompanionIcon("apppreferences.png"));
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
|
panelItemModels = new FilteredItemModelFactory();
|
||||||
|
panelItemModels->registerItemModel(new FilteredItemModel(GeneralSettings::templateSetupItemModel()), FIM_TEMPLATESETUP);
|
||||||
|
|
||||||
initSettings();
|
initSettings();
|
||||||
connect(ui->boardCB, SIGNAL(currentIndexChanged(int)), this, SLOT(onBaseFirmwareChanged()));
|
connect(ui->boardCB, SIGNAL(currentIndexChanged(int)), this, SLOT(onBaseFirmwareChanged()));
|
||||||
connect(ui->opt_appDebugLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
connect(ui->opt_appDebugLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
||||||
@@ -65,6 +69,7 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget * parent, UpdateFactories * f
|
|||||||
AppPreferencesDialog::~AppPreferencesDialog()
|
AppPreferencesDialog::~AppPreferencesDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete panelItemModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppPreferencesDialog::setMainWinHasDirtyChild(bool value)
|
void AppPreferencesDialog::setMainWinHasDirtyChild(bool value)
|
||||||
@@ -156,8 +161,8 @@ void AppPreferencesDialog::accept()
|
|||||||
|
|
||||||
profile.defaultInternalModule(ui->defaultInternalModuleCB->currentData().toInt());
|
profile.defaultInternalModule(ui->defaultInternalModuleCB->currentData().toInt());
|
||||||
profile.externalModuleSize(ui->externalModuleSizeCB->currentData().toInt());
|
profile.externalModuleSize(ui->externalModuleSizeCB->currentData().toInt());
|
||||||
profile.channelOrder(ui->channelorderCB->currentIndex());
|
profile.channelOrder(ui->channelorderCB->currentData().toInt());
|
||||||
profile.defaultMode(ui->stickmodeCB->currentIndex());
|
profile.defaultMode(ui->stickmodeCB->currentData().toInt());
|
||||||
profile.burnFirmware(ui->burnFirmware->isChecked());
|
profile.burnFirmware(ui->burnFirmware->isChecked());
|
||||||
profile.sdPath(ui->sdPath->text());
|
profile.sdPath(ui->sdPath->text());
|
||||||
profile.pBackupDir(ui->profilebackupPath->text());
|
profile.pBackupDir(ui->profilebackupPath->text());
|
||||||
@@ -305,8 +310,12 @@ void AppPreferencesDialog::initSettings()
|
|||||||
ui->defaultInternalModuleCB->setCurrentIndex(ui->defaultInternalModuleCB->findData(profile.defaultInternalModule()));
|
ui->defaultInternalModuleCB->setCurrentIndex(ui->defaultInternalModuleCB->findData(profile.defaultInternalModule()));
|
||||||
ui->externalModuleSizeCB->setModel(Boards::externalModuleSizeItemModel());
|
ui->externalModuleSizeCB->setModel(Boards::externalModuleSizeItemModel());
|
||||||
ui->externalModuleSizeCB->setCurrentIndex(ui->externalModuleSizeCB->findData(profile.externalModuleSize()));
|
ui->externalModuleSizeCB->setCurrentIndex(ui->externalModuleSizeCB->findData(profile.externalModuleSize()));
|
||||||
ui->channelorderCB->setCurrentIndex(profile.channelOrder());
|
panelItemModels->getItemModel(FIM_TEMPLATESETUP)->setFilterFlags(Boards::isAir() ? GeneralSettings::RadioTypeContextAir :
|
||||||
ui->stickmodeCB->setCurrentIndex(profile.defaultMode());
|
GeneralSettings::RadioTypeContextSurface);
|
||||||
|
ui->channelorderCB->setModel(panelItemModels->getItemModel(FIM_TEMPLATESETUP));
|
||||||
|
ui->channelorderCB->setCurrentIndex(ui->channelorderCB->findData(profile.channelOrder()));
|
||||||
|
ui->stickmodeCB->setModel(GeneralSettings::stickModeItemModel());
|
||||||
|
ui->stickmodeCB->setCurrentIndex(ui->stickmodeCB->findData(profile.defaultMode()));
|
||||||
ui->sdPath->setText(profile.sdPath());
|
ui->sdPath->setText(profile.sdPath());
|
||||||
if (!profile.pBackupDir().isEmpty()) {
|
if (!profile.pBackupDir().isEmpty()) {
|
||||||
if (QDir(profile.pBackupDir()).exists()) {
|
if (QDir(profile.pBackupDir()).exists()) {
|
||||||
@@ -321,6 +330,11 @@ void AppPreferencesDialog::initSettings()
|
|||||||
ui->pbackupEnable->setDisabled(true);
|
ui->pbackupEnable->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Boards::isSurface()) {
|
||||||
|
ui->stickmodeLabel->hide();
|
||||||
|
ui->stickmodeCB->hide();
|
||||||
|
}
|
||||||
|
|
||||||
ui->profileNameLE->setText(profile.name());
|
ui->profileNameLE->setText(profile.name());
|
||||||
|
|
||||||
QString hwSettings;
|
QString hwSettings;
|
||||||
@@ -649,7 +663,8 @@ bool AppPreferencesDialog::displayImage(const QString & fileName)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
ui->imageLabel->setPixmap(makePixMap(image));
|
ui->imageLabel->setPixmap(makePixMap(image));
|
||||||
ui->imageLabel->setFixedSize(getCurrentFirmware()->getCapability(LcdWidth), getCurrentFirmware()->getCapability(LcdHeight));
|
ui->imageLabel->setFixedSize(Boards::getCapability(getCurrentBoard(), Board::LcdWidth),
|
||||||
|
Boards::getCapability(getCurrentBoard(), Board::LcdHeight));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,6 +705,19 @@ void AppPreferencesDialog::onBaseFirmwareChanged()
|
|||||||
profile.externalModuleSize(Boards::getDefaultExternalModuleSize(newfw->getBoard()));
|
profile.externalModuleSize(Boards::getDefaultExternalModuleSize(newfw->getBoard()));
|
||||||
ui->externalModuleSizeCB->setModel(Boards::externalModuleSizeItemModel());
|
ui->externalModuleSizeCB->setModel(Boards::externalModuleSizeItemModel());
|
||||||
ui->externalModuleSizeCB->setCurrentIndex(ui->externalModuleSizeCB->findData(profile.externalModuleSize()));
|
ui->externalModuleSizeCB->setCurrentIndex(ui->externalModuleSizeCB->findData(profile.externalModuleSize()));
|
||||||
|
|
||||||
|
if (Boards::isSurface()) {
|
||||||
|
profile.defaultMode(1);
|
||||||
|
ui->stickmodeLabel->hide();
|
||||||
|
ui->stickmodeCB->hide();
|
||||||
|
profile.channelOrder(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->stickmodeCB->setCurrentIndex(ui->stickmodeCB->findData(profile.defaultMode()));
|
||||||
|
panelItemModels->getItemModel(FIM_TEMPLATESETUP)->setFilterFlags(Boards::isAir() ? GeneralSettings::RadioTypeContextAir :
|
||||||
|
GeneralSettings::RadioTypeContextSurface);
|
||||||
|
ui->channelorderCB->setCurrentIndex(ui->channelorderCB->findData(profile.channelOrder()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Firmware *AppPreferencesDialog::getBaseFirmware() const
|
Firmware *AppPreferencesDialog::getBaseFirmware() const
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
|
class FilteredItemModelFactory;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AppPreferencesDialog;
|
class AppPreferencesDialog;
|
||||||
}
|
}
|
||||||
@@ -95,6 +97,8 @@ class AppPreferencesDialog : public QDialog
|
|||||||
QComboBox *cboReleaseChannel[MAX_COMPONENTS];
|
QComboBox *cboReleaseChannel[MAX_COMPONENTS];
|
||||||
QPushButton *btnComponentOptions[MAX_COMPONENTS];
|
QPushButton *btnComponentOptions[MAX_COMPONENTS];
|
||||||
|
|
||||||
|
FilteredItemModelFactory *panelItemModels;
|
||||||
|
|
||||||
void loadUpdatesTab();
|
void loadUpdatesTab();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -624,7 +624,7 @@ Mode 4:
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="0">
|
<item row="15" column="0">
|
||||||
<widget class="QLabel" name="label_14">
|
<widget class="QLabel" name="stickmodeLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -676,7 +676,7 @@ Mode 4:
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="16" column="0">
|
<item row="16" column="0">
|
||||||
<widget class="QLabel" name="label_13">
|
<widget class="QLabel" name="channelorderLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ ThrottleSourceItemModel::ThrottleSourceItemModel(const GeneralSettings * const g
|
|||||||
if (!modelData)
|
if (!modelData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setUpdateMask(IMUE_Timers | IMUE_Inputs | IMUE_TeleSensors);
|
setUpdateMask(IMUE_Channels);
|
||||||
|
|
||||||
for (int i = 0; i < modelData->thrTraceSrcCount(); i++) {
|
for (int i = 0; i < modelData->thrTraceSrcCount(); i++) {
|
||||||
QStandardItem * modelItem = new QStandardItem();
|
QStandardItem * modelItem = new QStandardItem();
|
||||||
@@ -407,7 +407,7 @@ ThrottleSourceItemModel::ThrottleSourceItemModel(const GeneralSettings * const g
|
|||||||
|
|
||||||
void ThrottleSourceItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
void ThrottleSourceItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
||||||
{
|
{
|
||||||
item->setText(modelData->thrTraceSrcToString(value));
|
item->setText(modelData->thrTraceSrcToString(generalSettings, value));
|
||||||
item->setData(modelData->isThrTraceSrcAvailable(generalSettings, value), IMDR_Available);
|
item->setData(modelData->isThrTraceSrcAvailable(generalSettings, value), IMDR_Available);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ BoardJson::BoardJson(Board::Type board, QString hwdefn) :
|
|||||||
m_inputs(new InputsTable),
|
m_inputs(new InputsTable),
|
||||||
m_switches(new SwitchesTable),
|
m_switches(new SwitchesTable),
|
||||||
m_trims(new TrimsTable),
|
m_trims(new TrimsTable),
|
||||||
|
m_keys(new KeysTable),
|
||||||
m_inputCnt({0, 0, 0, 0, 0, 0, 0, 0, 0}),
|
m_inputCnt({0, 0, 0, 0, 0, 0, 0, 0, 0}),
|
||||||
m_switchCnt({0, 0, 0})
|
m_switchCnt({0, 0, 0})
|
||||||
{
|
{
|
||||||
@@ -79,10 +80,12 @@ BoardJson::~BoardJson()
|
|||||||
delete m_inputs;
|
delete m_inputs;
|
||||||
delete m_switches;
|
delete m_switches;
|
||||||
delete m_trims;
|
delete m_trims;
|
||||||
|
delete m_keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void BoardJson::afterLoadFixups(Board::Type board, InputsTable * inputs, SwitchesTable * switches)
|
void BoardJson::afterLoadFixups(Board::Type board, InputsTable * inputs, SwitchesTable * switches,
|
||||||
|
KeysTable * keys, TrimsTable * trims)
|
||||||
{
|
{
|
||||||
// TODO json files do not contain gyro defs
|
// TODO json files do not contain gyro defs
|
||||||
// Radio cmake directive IMU is currently used
|
// Radio cmake directive IMU is currently used
|
||||||
@@ -114,8 +117,8 @@ void BoardJson::afterLoadFixups(Board::Type board, InputsTable * inputs, Switche
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flex switches are not listed in json file
|
// Flex switches are not listed in json file for these radios
|
||||||
int count = IS_RADIOMASTER_TX16S(board) ? 2 : 0;
|
int count = IS_RADIOMASTER_TX16S(board) || IS_RADIOMASTER_MT12(board) ? 2 : 0;
|
||||||
|
|
||||||
for (int i = 1; i <= count; i++) {
|
for (int i = 1; i <= count; i++) {
|
||||||
QString tag = QString("FL%1").arg(i);
|
QString tag = QString("FL%1").arg(i);
|
||||||
@@ -164,6 +167,9 @@ const int BoardJson::getCapability(const Board::Capability capability) const
|
|||||||
case Board::InputSwitches:
|
case Board::InputSwitches:
|
||||||
return m_inputCnt.switches;
|
return m_inputCnt.switches;
|
||||||
|
|
||||||
|
case Board::Keys:
|
||||||
|
return m_keys->size();
|
||||||
|
|
||||||
case Board::MultiposPots:
|
case Board::MultiposPots:
|
||||||
// assumes every input has potential to be one
|
// assumes every input has potential to be one
|
||||||
// index used for mapping 6 pos switches back to input
|
// index used for mapping 6 pos switches back to input
|
||||||
@@ -332,6 +338,14 @@ const int BoardJson::getInputSliderIndex(int index)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int BoardJson::getInputThrottleIndex()
|
||||||
|
{
|
||||||
|
if (getCapability(Board::Sticks) > 0)
|
||||||
|
return getInputTagOffset(m_inputs, Boards::getCapability(m_board, Board::Air) ? "RV" : "TH");
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
const int BoardJson::getInputTypeOffset(Board::AnalogInputType type)
|
const int BoardJson::getInputTypeOffset(Board::AnalogInputType type)
|
||||||
{
|
{
|
||||||
return getInputTypeOffset(m_inputs, type);
|
return getInputTypeOffset(m_inputs, type);
|
||||||
@@ -371,6 +385,42 @@ Board::InputInfo BoardJson::getInputInfo(const InputsTable * inputs, int index)
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int BoardJson::getKeyIndex(const QString key) const
|
||||||
|
{
|
||||||
|
return getKeyIndex(m_keys, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
int BoardJson::getKeyIndex(const KeysTable * keys, QString key)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (int)keys->size(); i++) {
|
||||||
|
if (keys->at(i).key.c_str() == key)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Board::KeyInfo BoardJson::getKeyInfo(int index) const
|
||||||
|
{
|
||||||
|
return getKeyInfo(m_keys, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
Board::KeyInfo BoardJson::getKeyInfo(const KeysTable * keys, int index)
|
||||||
|
{
|
||||||
|
Board::KeyInfo info;
|
||||||
|
|
||||||
|
if (index >= 0 && index < (int)keys->size()) {
|
||||||
|
KeyDefn defn = keys->at(index);
|
||||||
|
info.name = defn.name;
|
||||||
|
info.key = defn.key;
|
||||||
|
info.label = defn.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
int BoardJson::getNumericSuffix(const std::string str)
|
int BoardJson::getNumericSuffix(const std::string str)
|
||||||
{
|
{
|
||||||
@@ -771,10 +821,10 @@ bool BoardJson::loadDefinition()
|
|||||||
if (m_board == Board::BOARD_UNKNOWN)
|
if (m_board == Board::BOARD_UNKNOWN)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!loadFile(m_board, m_hwdefn, m_inputs, m_switches, m_trims))
|
if (!loadFile(m_board, m_hwdefn, m_inputs, m_switches, m_keys, m_trims))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
afterLoadFixups(m_board, m_inputs, m_switches);
|
afterLoadFixups(m_board, m_inputs, m_switches, m_keys, m_trims);
|
||||||
|
|
||||||
setInputCounts(m_inputs, m_inputCnt);
|
setInputCounts(m_inputs, m_inputCnt);
|
||||||
setSwitchCounts(m_switches, m_switchCnt);
|
setSwitchCounts(m_switches, m_switchCnt);
|
||||||
@@ -795,6 +845,7 @@ bool BoardJson::loadDefinition()
|
|||||||
"flex inputs:" << getCapability(Board::FlexInputs) <<
|
"flex inputs:" << getCapability(Board::FlexInputs) <<
|
||||||
"input switches:" << getCapability(Board::InputSwitches) <<
|
"input switches:" << getCapability(Board::InputSwitches) <<
|
||||||
"trims:" << getCapability(Board::NumTrims) <<
|
"trims:" << getCapability(Board::NumTrims) <<
|
||||||
|
"keys:" << getCapability(Board::Keys) <<
|
||||||
"std switches:" << getCapability(Board::StandardSwitches) <<
|
"std switches:" << getCapability(Board::StandardSwitches) <<
|
||||||
"flex switches:" << getCapability(Board::FlexSwitches) <<
|
"flex switches:" << getCapability(Board::FlexSwitches) <<
|
||||||
"func switches:" << getCapability(Board::FunctionSwitches) <<
|
"func switches:" << getCapability(Board::FunctionSwitches) <<
|
||||||
@@ -805,7 +856,8 @@ bool BoardJson::loadDefinition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs, SwitchesTable * switches, TrimsTable * trims)
|
bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs, SwitchesTable * switches,
|
||||||
|
KeysTable * keys, TrimsTable * trims)
|
||||||
{
|
{
|
||||||
if (board == Board::BOARD_UNKNOWN) {
|
if (board == Board::BOARD_UNKNOWN) {
|
||||||
return false;
|
return false;
|
||||||
@@ -952,6 +1004,29 @@ bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj.value("keys").isArray()) {
|
||||||
|
const QJsonArray &kys = obj.value("keys").toArray();
|
||||||
|
|
||||||
|
for (const QJsonValue &key : kys)
|
||||||
|
{
|
||||||
|
if (key.isObject()) {
|
||||||
|
const QJsonObject &o = key.toObject();
|
||||||
|
KeyDefn k;
|
||||||
|
|
||||||
|
if (!o.value("name").isUndefined()) {
|
||||||
|
k.name = o.value("name").toString().toStdString();
|
||||||
|
k.key = o.value("key").toString().toStdString();
|
||||||
|
k.label = o.value("label").toString().toStdString();
|
||||||
|
k.tag = k.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
keys->insert(keys->end(), k);
|
||||||
|
|
||||||
|
// qDebug() << "name:" << k.name.c_str() << "key:" << k.key.c_str() << "label:" << k.label.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (obj.value("trims").isArray()) {
|
if (obj.value("trims").isArray()) {
|
||||||
const QJsonArray &trms = obj.value("trims").toArray();
|
const QJsonArray &trms = obj.value("trims").toArray();
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,19 @@ class BoardJson
|
|||||||
|
|
||||||
typedef std::vector<SwitchDefn> SwitchesTable;
|
typedef std::vector<SwitchDefn> SwitchesTable;
|
||||||
|
|
||||||
|
struct KeyDefn {
|
||||||
|
std::string tag = "";
|
||||||
|
std::string name = "";
|
||||||
|
std::string key = "";
|
||||||
|
std::string label = "";
|
||||||
|
Board::LookupValueType cfgYaml = Board::LVT_TAG;
|
||||||
|
Board::LookupValueType refYaml = Board::LVT_NAME;
|
||||||
|
|
||||||
|
KeyDefn() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<KeyDefn> KeysTable;
|
||||||
|
|
||||||
struct TrimDefn {
|
struct TrimDefn {
|
||||||
std::string tag = "";
|
std::string tag = "";
|
||||||
std::string name = "";
|
std::string name = "";
|
||||||
@@ -106,6 +119,7 @@ class BoardJson
|
|||||||
const int getInputSliderIndex(int index);
|
const int getInputSliderIndex(int index);
|
||||||
const QString getInputTag(int index) const;
|
const QString getInputTag(int index) const;
|
||||||
const int getInputTagOffset(QString tag);
|
const int getInputTagOffset(QString tag);
|
||||||
|
const int getInputThrottleIndex();
|
||||||
const int getInputTypeOffset(Board::AnalogInputType type);
|
const int getInputTypeOffset(Board::AnalogInputType type);
|
||||||
const int getInputYamlIndex(const QString val, YamlLookupType ylt) const;
|
const int getInputYamlIndex(const QString val, YamlLookupType ylt) const;
|
||||||
const QString getInputYamlName(int index, YamlLookupType ylt) const;
|
const QString getInputYamlName(int index, YamlLookupType ylt) const;
|
||||||
@@ -119,6 +133,9 @@ class BoardJson
|
|||||||
const bool isInputStick(int index) const;
|
const bool isInputStick(int index) const;
|
||||||
const bool isInputSwitch(int index) const;
|
const bool isInputSwitch(int index) const;
|
||||||
|
|
||||||
|
const Board::KeyInfo getKeyInfo(int index) const;
|
||||||
|
const int getKeyIndex(const QString key) const;
|
||||||
|
|
||||||
const int getSwitchIndex(const QString val, Board::LookupValueType lvt) const;
|
const int getSwitchIndex(const QString val, Board::LookupValueType lvt) const;
|
||||||
const Board::SwitchInfo getSwitchInfo(int index) const;
|
const Board::SwitchInfo getSwitchInfo(int index) const;
|
||||||
const QString getSwitchName(int index) const;
|
const QString getSwitchName(int index) const;
|
||||||
@@ -144,6 +161,7 @@ private:
|
|||||||
InputsTable *m_inputs;
|
InputsTable *m_inputs;
|
||||||
SwitchesTable *m_switches;
|
SwitchesTable *m_switches;
|
||||||
TrimsTable *m_trims;
|
TrimsTable *m_trims;
|
||||||
|
KeysTable *m_keys;
|
||||||
|
|
||||||
struct InputCounts {
|
struct InputCounts {
|
||||||
unsigned int flexGyroAxes;
|
unsigned int flexGyroAxes;
|
||||||
@@ -167,8 +185,10 @@ private:
|
|||||||
|
|
||||||
SwitchCounts m_switchCnt;
|
SwitchCounts m_switchCnt;
|
||||||
|
|
||||||
static bool loadFile(Board::Type board, QString hwdefn, InputsTable * inputs, SwitchesTable * switches, TrimsTable * trims);
|
static bool loadFile(Board::Type board, QString hwdefn, InputsTable * inputs, SwitchesTable * switches,
|
||||||
static void afterLoadFixups(Board::Type board, InputsTable * inputs, SwitchesTable * switches);
|
KeysTable * keys, TrimsTable * trims);
|
||||||
|
static void afterLoadFixups(Board::Type board, InputsTable * inputs, SwitchesTable * switches,
|
||||||
|
KeysTable * keys, TrimsTable * trims);
|
||||||
|
|
||||||
static int getInputsCalibrated(const InputsTable * inputs);
|
static int getInputsCalibrated(const InputsTable * inputs);
|
||||||
|
|
||||||
@@ -179,6 +199,9 @@ private:
|
|||||||
static int getInputTagOffset(const InputsTable * inputs, QString tag);
|
static int getInputTagOffset(const InputsTable * inputs, QString tag);
|
||||||
static int getInputTypeOffset(const InputsTable * inputs, Board::AnalogInputType type);
|
static int getInputTypeOffset(const InputsTable * inputs, Board::AnalogInputType type);
|
||||||
|
|
||||||
|
static int getKeyIndex(const KeysTable * keys, QString key);
|
||||||
|
static Board::KeyInfo getKeyInfo(const KeysTable * keys, int index);
|
||||||
|
|
||||||
static int getSwitchIndex(const SwitchesTable * switches, QString val, Board::LookupValueType lvt);
|
static int getSwitchIndex(const SwitchesTable * switches, QString val, Board::LookupValueType lvt);
|
||||||
static Board::SwitchInfo getSwitchInfo(const SwitchesTable * switches, int index);
|
static Board::SwitchInfo getSwitchInfo(const SwitchesTable * switches, int index);
|
||||||
static QString getSwitchName(const SwitchesTable * switches, int index);
|
static QString getSwitchName(const SwitchesTable * switches, int index);
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ int Boards::getEEpromSize(Board::Type board)
|
|||||||
case BOARD_RADIOMASTER_ZORRO:
|
case BOARD_RADIOMASTER_ZORRO:
|
||||||
case BOARD_RADIOMASTER_BOXER:
|
case BOARD_RADIOMASTER_BOXER:
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
|
case BOARD_RADIOMASTER_MT12:
|
||||||
return EESIZE_TARANIS;
|
return EESIZE_TARANIS;
|
||||||
case BOARD_UNKNOWN:
|
case BOARD_UNKNOWN:
|
||||||
return EESIZE_MAX;
|
return EESIZE_MAX;
|
||||||
@@ -256,6 +257,7 @@ int Boards::getFlashSize(Type board)
|
|||||||
case BOARD_RADIOMASTER_BOXER:
|
case BOARD_RADIOMASTER_BOXER:
|
||||||
case BOARD_RADIOMASTER_T8:
|
case BOARD_RADIOMASTER_T8:
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
|
case BOARD_RADIOMASTER_MT12:
|
||||||
return FSIZE_TARANIS;
|
return FSIZE_TARANIS;
|
||||||
case BOARD_HORUS_X12S:
|
case BOARD_HORUS_X12S:
|
||||||
case BOARD_X10:
|
case BOARD_X10:
|
||||||
@@ -283,6 +285,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
|||||||
// TODO investigate usage of any that should be covered in BoardJson::getCapability or are no longer required
|
// TODO investigate usage of any that should be covered in BoardJson::getCapability or are no longer required
|
||||||
// some could be used when importing pre v2.10 configurations
|
// some could be used when importing pre v2.10 configurations
|
||||||
switch (capability) {
|
switch (capability) {
|
||||||
|
case Air:
|
||||||
|
return !getCapability(board, Surface);
|
||||||
|
|
||||||
case FactoryInstalledPots:
|
case FactoryInstalledPots:
|
||||||
if (IS_TARANIS_X9(board))
|
if (IS_TARANIS_X9(board))
|
||||||
return 2;
|
return 2;
|
||||||
@@ -340,6 +345,40 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
|||||||
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_POCKET(board)) ||
|
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_POCKET(board)) ||
|
||||||
(getCapability(board, HasExternalModuleSupport) && (IS_TARANIS(board) && !IS_FAMILY_T12(board))));
|
(getCapability(board, HasExternalModuleSupport) && (IS_TARANIS(board) && !IS_FAMILY_T12(board))));
|
||||||
|
|
||||||
|
case LcdDepth:
|
||||||
|
if (IS_FAMILY_HORUS_OR_T16(board))
|
||||||
|
return 16;
|
||||||
|
else if (IS_TARANIS_SMALL(board))
|
||||||
|
return 1;
|
||||||
|
else if (IS_TARANIS(board))
|
||||||
|
return 4;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
case LcdHeight:
|
||||||
|
if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
|
||||||
|
return 480;
|
||||||
|
else if (IS_FLYSKY_PL18(board) || IS_JUMPER_T15(board))
|
||||||
|
return 320;
|
||||||
|
else if (IS_FAMILY_HORUS_OR_T16(board))
|
||||||
|
return 272;
|
||||||
|
else
|
||||||
|
return 64;
|
||||||
|
|
||||||
|
case LcdWidth:
|
||||||
|
if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
|
||||||
|
return 320;
|
||||||
|
else if (IS_FLYSKY_PL18(board))
|
||||||
|
return 480;
|
||||||
|
else if (IS_FAMILY_HORUS_OR_T16(board))
|
||||||
|
return 480;
|
||||||
|
else if (IS_TARANIS_SMALL(board))
|
||||||
|
return 128;
|
||||||
|
else if (IS_TARANIS(board))
|
||||||
|
return 212;
|
||||||
|
else
|
||||||
|
return 128;
|
||||||
|
|
||||||
case MaxAnalogs:
|
case MaxAnalogs:
|
||||||
return getCapability(board, Board::Sticks) + getCapability(board, Board::Pots) + getCapability(board, Board::Sliders) +
|
return getCapability(board, Board::Sticks) + getCapability(board, Board::Pots) + getCapability(board, Board::Sliders) +
|
||||||
getCapability(board, Board::JoystickAxes) + getCapability(board, Board::GyroAxes);
|
getCapability(board, Board::JoystickAxes) + getCapability(board, Board::GyroAxes);
|
||||||
@@ -351,6 +390,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
|||||||
else
|
else
|
||||||
return 250000; // less than 400K
|
return 250000; // less than 400K
|
||||||
|
|
||||||
|
case Surface:
|
||||||
|
return IS_RADIOMASTER_MT12(board);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return getBoardJson(board)->getCapability(capability);
|
return getBoardJson(board)->getCapability(capability);
|
||||||
}
|
}
|
||||||
@@ -557,20 +599,22 @@ QString Boards::getBoardName(Board::Type board)
|
|||||||
return "Jumper T20";
|
return "Jumper T20";
|
||||||
case BOARD_JUMPER_T20V2:
|
case BOARD_JUMPER_T20V2:
|
||||||
return "Jumper T20 V2";
|
return "Jumper T20 V2";
|
||||||
case BOARD_RADIOMASTER_TX16S:
|
|
||||||
return "Radiomaster TX16S";
|
|
||||||
case BOARD_RADIOMASTER_TX12:
|
|
||||||
return "Radiomaster TX12";
|
|
||||||
case BOARD_RADIOMASTER_TX12_MK2:
|
|
||||||
return "Radiomaster TX12 Mark II";
|
|
||||||
case BOARD_RADIOMASTER_ZORRO:
|
|
||||||
return "Radiomaster Zorro";
|
|
||||||
case BOARD_RADIOMASTER_BOXER:
|
case BOARD_RADIOMASTER_BOXER:
|
||||||
return "Radiomaster Boxer";
|
return "Radiomaster Boxer";
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
return "Radiomaster Pocket";
|
return "Radiomaster Pocket";
|
||||||
|
case BOARD_RADIOMASTER_MT12:
|
||||||
|
return "Radiomaster MT12";
|
||||||
case BOARD_RADIOMASTER_T8:
|
case BOARD_RADIOMASTER_T8:
|
||||||
return "Radiomaster T8";
|
return "Radiomaster T8";
|
||||||
|
case BOARD_RADIOMASTER_TX12:
|
||||||
|
return "Radiomaster TX12";
|
||||||
|
case BOARD_RADIOMASTER_TX12_MK2:
|
||||||
|
return "Radiomaster TX12 Mark II";
|
||||||
|
case BOARD_RADIOMASTER_TX16S:
|
||||||
|
return "Radiomaster TX16S";
|
||||||
|
case BOARD_RADIOMASTER_ZORRO:
|
||||||
|
return "Radiomaster Zorro";
|
||||||
case BOARD_FLYSKY_NV14:
|
case BOARD_FLYSKY_NV14:
|
||||||
return "FlySky NV14";
|
return "FlySky NV14";
|
||||||
case BOARD_FLYSKY_EL18:
|
case BOARD_FLYSKY_EL18:
|
||||||
@@ -637,6 +681,11 @@ QList<int> Boards::getSupportedInternalModules(Board::Type board)
|
|||||||
(int)MODULE_TYPE_FLYSKY_AFHDS3,
|
(int)MODULE_TYPE_FLYSKY_AFHDS3,
|
||||||
(int)MODULE_TYPE_CROSSFIRE,
|
(int)MODULE_TYPE_CROSSFIRE,
|
||||||
});
|
});
|
||||||
|
} else if (IS_RADIOMASTER_MT12(board)) {
|
||||||
|
modules.append({
|
||||||
|
(int)MODULE_TYPE_CROSSFIRE,
|
||||||
|
(int)MODULE_TYPE_MULTIMODULE,
|
||||||
|
});
|
||||||
} else if (IS_FAMILY_HORUS_OR_T16(board) || IS_FAMILY_T12(board) ||
|
} else if (IS_FAMILY_HORUS_OR_T16(board) || IS_FAMILY_T12(board) ||
|
||||||
(IS_TARANIS_SMALL(board) && IS_ACCESS_RADIO(board))) {
|
(IS_TARANIS_SMALL(board) && IS_ACCESS_RADIO(board))) {
|
||||||
modules.append({
|
modules.append({
|
||||||
@@ -688,6 +737,7 @@ int Boards::getDefaultInternalModules(Board::Type board)
|
|||||||
case BOARD_BETAFPV_LR3PRO:
|
case BOARD_BETAFPV_LR3PRO:
|
||||||
case BOARD_RADIOMASTER_ZORRO:
|
case BOARD_RADIOMASTER_ZORRO:
|
||||||
case BOARD_RADIOMASTER_BOXER:
|
case BOARD_RADIOMASTER_BOXER:
|
||||||
|
case BOARD_RADIOMASTER_MT12:
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
case BOARD_RADIOMASTER_TX12_MK2:
|
case BOARD_RADIOMASTER_TX12_MK2:
|
||||||
case BOARD_IFLIGHT_COMMANDO8:
|
case BOARD_IFLIGHT_COMMANDO8:
|
||||||
@@ -729,7 +779,7 @@ void Boards::getBattRange(Board::Type board, int& vmin, int& vmax, unsigned int&
|
|||||||
case BOARD_RADIOMASTER_BOXER:
|
case BOARD_RADIOMASTER_BOXER:
|
||||||
case BOARD_RADIOMASTER_POCKET:
|
case BOARD_RADIOMASTER_POCKET:
|
||||||
case BOARD_RADIOMASTER_ZORRO:
|
case BOARD_RADIOMASTER_ZORRO:
|
||||||
// case BOARD_RADIOMASTER_MT12: // TODO
|
case BOARD_RADIOMASTER_MT12:
|
||||||
case BOARD_JUMPER_T12:
|
case BOARD_JUMPER_T12:
|
||||||
case BOARD_JUMPER_T14:
|
case BOARD_JUMPER_T14:
|
||||||
case BOARD_JUMPER_TPRO:
|
case BOARD_JUMPER_TPRO:
|
||||||
@@ -786,6 +836,7 @@ int Boards::getDefaultExternalModuleSize(Board::Type board)
|
|||||||
|
|
||||||
if (IS_TARANIS_X9LITE(board) ||
|
if (IS_TARANIS_X9LITE(board) ||
|
||||||
IS_RADIOMASTER_ZORRO(board) ||
|
IS_RADIOMASTER_ZORRO(board) ||
|
||||||
|
IS_RADIOMASTER_MT12(board) ||
|
||||||
IS_RADIOMASTER_POCKET(board) ||
|
IS_RADIOMASTER_POCKET(board) ||
|
||||||
IS_JUMPER_TLITE(board) ||
|
IS_JUMPER_TLITE(board) ||
|
||||||
IS_JUMPER_TPRO(board) ||
|
IS_JUMPER_TPRO(board) ||
|
||||||
@@ -909,6 +960,11 @@ int Boards::getInputTagOffset(QString tag, Board::Type board)
|
|||||||
return getBoardJson(board)->getInputTagOffset(tag);
|
return getBoardJson(board)->getInputTagOffset(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Boards::getInputThrottleIndex(Board::Type board)
|
||||||
|
{
|
||||||
|
return getBoardJson(board)->getInputThrottleIndex();
|
||||||
|
}
|
||||||
|
|
||||||
int Boards::getInputTypeOffset(Board::AnalogInputType type, Board::Type board)
|
int Boards::getInputTypeOffset(Board::AnalogInputType type, Board::Type board)
|
||||||
{
|
{
|
||||||
return getBoardJson(board)->getInputTypeOffset(type);
|
return getBoardJson(board)->getInputTypeOffset(type);
|
||||||
@@ -929,6 +985,16 @@ int Boards::getInputsCalibrated(Board::Type board)
|
|||||||
return getBoardJson(board)->getInputsCalibrated();
|
return getBoardJson(board)->getInputsCalibrated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Board::KeyInfo Boards::getKeyInfo(int index, Board::Type board)
|
||||||
|
{
|
||||||
|
return getBoardJson(board)->getKeyInfo(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Boards::getKeyIndex(QString key, Board::Type board)
|
||||||
|
{
|
||||||
|
return getBoardJson(board)->getKeyIndex(key);
|
||||||
|
}
|
||||||
|
|
||||||
Board::SwitchInfo Boards::getSwitchInfo(int index, Board::Type board)
|
Board::SwitchInfo Boards::getSwitchInfo(int index, Board::Type board)
|
||||||
{
|
{
|
||||||
return getBoardJson(board)->getSwitchInfo(index);
|
return getBoardJson(board)->getSwitchInfo(index);
|
||||||
@@ -1023,3 +1089,18 @@ bool Boards::isSwitchFunc(int index, Board::Type board)
|
|||||||
{
|
{
|
||||||
return getBoardJson(board)->isSwitchFunc(index);
|
return getBoardJson(board)->isSwitchFunc(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Boards::getRadioTypeString(Board::Type board)
|
||||||
|
{
|
||||||
|
return getCapability(board == Board::BOARD_UNKNOWN ? getCurrentBoard() : board, Board::Air) ? tr("Flight") : tr("Drive");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Boards::isAir(Board::Type board)
|
||||||
|
{
|
||||||
|
return getCapability(board == Board::BOARD_UNKNOWN ? getCurrentBoard() : board, Board::Air);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Boards::isSurface(Board::Type board)
|
||||||
|
{
|
||||||
|
return getCapability(board == Board::BOARD_UNKNOWN ? getCurrentBoard() : board, Board::Surface);
|
||||||
|
}
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ namespace Board {
|
|||||||
BOARD_JUMPER_T20V2,
|
BOARD_JUMPER_T20V2,
|
||||||
BOARD_FATFISH_F16,
|
BOARD_FATFISH_F16,
|
||||||
BOARD_HELLORADIOSKY_V16,
|
BOARD_HELLORADIOSKY_V16,
|
||||||
|
BOARD_RADIOMASTER_MT12,
|
||||||
BOARD_TYPE_COUNT,
|
BOARD_TYPE_COUNT,
|
||||||
BOARD_TYPE_MAX = BOARD_TYPE_COUNT - 1
|
BOARD_TYPE_MAX = BOARD_TYPE_COUNT - 1
|
||||||
};
|
};
|
||||||
@@ -160,7 +161,47 @@ namespace Board {
|
|||||||
TRIM_SW_COUNT
|
TRIM_SW_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum StickAxesSurface {
|
||||||
|
STICK_AXIS_SURFACE_RH = 0, // Steering
|
||||||
|
STICK_AXIS_SURFACE_LV, // Throttle
|
||||||
|
STICK_AXIS_SURFACE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TrimAxesSurface {
|
||||||
|
TRIM_AXIS_SURFACE_RH = 0,
|
||||||
|
TRIM_AXIS_SURFACE_LH, // Throttle axis vertical but its trim horizontal in lcd
|
||||||
|
TRIM_AXIS_SURFACE_T3,
|
||||||
|
TRIM_AXIS_SURFACE_T4,
|
||||||
|
TRIM_AXIS_SURFACE_T5,
|
||||||
|
TRIM_AXIS_SURFACE_T6,
|
||||||
|
TRIM_AXIS_SURFACE_T7,
|
||||||
|
TRIM_AXIS_SURFACE_T8,
|
||||||
|
TRIM_AXIS_SURFACE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TrimSwitchesSurface
|
||||||
|
{
|
||||||
|
TRIM_SW_SURFACE_RH_DEC,
|
||||||
|
TRIM_SW_SURFACE_RH_INC,
|
||||||
|
TRIM_SW_SURFACE_LH_DEC, // Throttle axis vertical but its trim horizontal in lcd
|
||||||
|
TRIM_SW_SURFACE_LH_INC, // Throttle axis vertical but its trim horizontal in lcd
|
||||||
|
TRIM_SW_SURFACE_T3_DEC,
|
||||||
|
TRIM_SW_SURFACE_T3_INC,
|
||||||
|
TRIM_SW_SURFACE_T4_DEC,
|
||||||
|
TRIM_SW_SURFACE_T4_INC,
|
||||||
|
TRIM_SW_SURFACE_T5_DEC,
|
||||||
|
TRIM_SW_SURFACE_T5_INC,
|
||||||
|
TRIM_SW_SURFACE_T6_DEC,
|
||||||
|
TRIM_SW_SURFACE_T6_INC,
|
||||||
|
TRIM_SW_SURFACE_T7_DEC,
|
||||||
|
TRIM_SW_SURFACE_T7_INC,
|
||||||
|
TRIM_SW_SURFACE_T8_DEC,
|
||||||
|
TRIM_SW_SURFACE_T8_INC,
|
||||||
|
TRIM_SW_SURFACE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
enum Capability {
|
enum Capability {
|
||||||
|
Air,
|
||||||
FactoryInstalledPots,
|
FactoryInstalledPots,
|
||||||
FactoryInstalledSwitches,
|
FactoryInstalledSwitches,
|
||||||
FlexInputs,
|
FlexInputs,
|
||||||
@@ -180,11 +221,15 @@ namespace Board {
|
|||||||
HasTrainerModuleCPPM,
|
HasTrainerModuleCPPM,
|
||||||
HasTrainerModuleSBUS,
|
HasTrainerModuleSBUS,
|
||||||
HasVBat,
|
HasVBat,
|
||||||
|
LcdDepth,
|
||||||
|
LcdHeight,
|
||||||
|
LcdWidth,
|
||||||
MaxAnalogs,
|
MaxAnalogs,
|
||||||
Inputs,
|
Inputs,
|
||||||
InputSwitches,
|
InputSwitches,
|
||||||
Joysticks,
|
Joysticks,
|
||||||
JoystickAxes,
|
JoystickAxes,
|
||||||
|
Keys,
|
||||||
MultiposPots,
|
MultiposPots,
|
||||||
MultiposPotsPositions,
|
MultiposPotsPositions,
|
||||||
NumFunctionSwitchesPositions,
|
NumFunctionSwitchesPositions,
|
||||||
@@ -195,6 +240,7 @@ namespace Board {
|
|||||||
SportMaxBaudRate,
|
SportMaxBaudRate,
|
||||||
StandardSwitches,
|
StandardSwitches,
|
||||||
Sticks,
|
Sticks,
|
||||||
|
Surface,
|
||||||
Switches,
|
Switches,
|
||||||
SwitchesPositions,
|
SwitchesPositions,
|
||||||
};
|
};
|
||||||
@@ -294,6 +340,26 @@ namespace Board {
|
|||||||
SwitchType dflt;
|
SwitchType dflt;
|
||||||
bool inverted;
|
bool inverted;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct KeyInfo {
|
||||||
|
KeyInfo() :
|
||||||
|
key(""),
|
||||||
|
name(""),
|
||||||
|
label("")
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string key;
|
||||||
|
std::string name;
|
||||||
|
std::string label;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TrimInfo {
|
||||||
|
TrimInfo() :
|
||||||
|
name("")
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class Boards
|
class Boards
|
||||||
@@ -343,10 +409,14 @@ class Boards
|
|||||||
static int getInputSliderIndex(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static int getInputSliderIndex(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static QString getInputTag(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static QString getInputTag(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static int getInputTagOffset(QString tag, Board::Type board = Board::BOARD_UNKNOWN);
|
static int getInputTagOffset(QString tag, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
static int getInputThrottleIndex(Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static int getInputTypeOffset(Board::AnalogInputType type, Board::Type board = Board::BOARD_UNKNOWN);
|
static int getInputTypeOffset(Board::AnalogInputType type, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static int getInputYamlIndex(QString val, int ylt, Board::Type board = Board::BOARD_UNKNOWN);
|
static int getInputYamlIndex(QString val, int ylt, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static QString getInputYamlName(int index, int ylt, Board::Type board = Board::BOARD_UNKNOWN);
|
static QString getInputYamlName(int index, int ylt, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
|
||||||
|
static Board::KeyInfo getKeyInfo(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
static int getKeyIndex(QString key, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
|
||||||
static Board::SwitchInfo getSwitchInfo(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static Board::SwitchInfo getSwitchInfo(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static int getSwitchIndex(QString val, Board::LookupValueType lvt, Board::Type board = Board::BOARD_UNKNOWN);
|
static int getSwitchIndex(QString val, Board::LookupValueType lvt, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static QString getSwitchName(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static QString getSwitchName(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
@@ -379,6 +449,9 @@ class Boards
|
|||||||
static AbstractStaticItemModel * flexTypeItemModel();
|
static AbstractStaticItemModel * flexTypeItemModel();
|
||||||
|
|
||||||
static std::string getLegacyAnalogMappedInputTag(const char * legacytag, Board::Type board = Board::BOARD_UNKNOWN);
|
static std::string getLegacyAnalogMappedInputTag(const char * legacytag, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
static QString getRadioTypeString(Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
static bool isAir(Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
static bool isSurface(Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -501,6 +574,11 @@ inline bool IS_RADIOMASTER_BOXER(Board::Type board)
|
|||||||
return board == Board::BOARD_RADIOMASTER_BOXER;
|
return board == Board::BOARD_RADIOMASTER_BOXER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool IS_RADIOMASTER_MT12(Board::Type board)
|
||||||
|
{
|
||||||
|
return board == Board::BOARD_RADIOMASTER_MT12;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool IS_RADIOMASTER_POCKET(Board::Type board)
|
inline bool IS_RADIOMASTER_POCKET(Board::Type board)
|
||||||
{
|
{
|
||||||
return board == Board::BOARD_RADIOMASTER_POCKET;
|
return board == Board::BOARD_RADIOMASTER_POCKET;
|
||||||
@@ -542,6 +620,7 @@ inline bool IS_FAMILY_T12(Board::Type board)
|
|||||||
board == Board::BOARD_RADIOMASTER_TX12_MK2 ||
|
board == Board::BOARD_RADIOMASTER_TX12_MK2 ||
|
||||||
board == Board::BOARD_RADIOMASTER_ZORRO ||
|
board == Board::BOARD_RADIOMASTER_ZORRO ||
|
||||||
board == Board::BOARD_RADIOMASTER_BOXER ||
|
board == Board::BOARD_RADIOMASTER_BOXER ||
|
||||||
|
board == Board::BOARD_RADIOMASTER_MT12 ||
|
||||||
board == Board::BOARD_RADIOMASTER_POCKET ||
|
board == Board::BOARD_RADIOMASTER_POCKET ||
|
||||||
board == Board::BOARD_RADIOMASTER_T8 ||
|
board == Board::BOARD_RADIOMASTER_T8 ||
|
||||||
board == Board::BOARD_BETAFPV_LR3PRO ||
|
board == Board::BOARD_BETAFPV_LR3PRO ||
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
|
|||||||
node["labelSingleSelect"] = rhs.labelSingleSelect;
|
node["labelSingleSelect"] = rhs.labelSingleSelect;
|
||||||
node["labelMultiMode"] = rhs.labelMultiMode;
|
node["labelMultiMode"] = rhs.labelMultiMode;
|
||||||
node["favMultiMode"] = rhs.favMultiMode;
|
node["favMultiMode"] = rhs.favMultiMode;
|
||||||
} else if (fw->getCapability(LcdWidth) == 128) {
|
} else if (Boards::getCapability(board, Board::LcdWidth) == 128) {
|
||||||
node["invertLCD"] = (int)rhs.invertLCD;
|
node["invertLCD"] = (int)rhs.invertLCD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,38 +167,42 @@ struct YamlThrTrace {
|
|||||||
|
|
||||||
YamlThrTrace(unsigned int cpn_value)
|
YamlThrTrace(unsigned int cpn_value)
|
||||||
{
|
{
|
||||||
|
Board::Type board = getCurrentBoard();
|
||||||
|
|
||||||
if (cpn_value == 0) {
|
if (cpn_value == 0) {
|
||||||
src = RawSource(SOURCE_TYPE_INPUT, 2/* throttle */);
|
if (Boards::getInputThrottleIndex(board) >= 0)
|
||||||
|
src = RawSource(SOURCE_TYPE_INPUT, Boards::getInputThrottleIndex(board) + 1);
|
||||||
|
else
|
||||||
|
src = RawSource(SOURCE_TYPE_NONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cpn_value--;
|
|
||||||
Boards board(getCurrentBoard());
|
int sticks = Boards::getCapability(board, Board::Sticks);
|
||||||
int pots = board.getCapability(Board::Pots);
|
int pots = Boards::getCapability(board, Board::Pots);
|
||||||
int sliders = board.getCapability(Board::Sliders);
|
int sliders = Boards::getCapability(board, Board::Sliders);
|
||||||
if (cpn_value < (unsigned int)(pots + sliders)) {
|
|
||||||
src = RawSource(SOURCE_TYPE_INPUT, 4/* sticks */ + cpn_value);
|
if (cpn_value <= (unsigned int)(pots + sliders))
|
||||||
}
|
src = RawSource(SOURCE_TYPE_INPUT, sticks + cpn_value);
|
||||||
else {
|
else
|
||||||
cpn_value -= pots + sliders;
|
src = RawSource(SOURCE_TYPE_CH, cpn_value - pots - sliders);
|
||||||
src = RawSource(SOURCE_TYPE_CH, cpn_value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int toCpn()
|
unsigned int toCpn()
|
||||||
{
|
{
|
||||||
|
Board::Type board = getCurrentBoard();
|
||||||
|
int sticks = Boards::getCapability(board, Board::Sticks);
|
||||||
|
|
||||||
switch (src.type) {
|
switch (src.type) {
|
||||||
case SOURCE_TYPE_INPUT:
|
case SOURCE_TYPE_INPUT:
|
||||||
if (src.index == 2 /* throttle */) {
|
if (src.index == Boards::getInputThrottleIndex(board) + 1)
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
else
|
||||||
return src.index - 4/* sticks */ + 1;
|
return src.index - sticks;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SOURCE_TYPE_CH: {
|
case SOURCE_TYPE_CH: {
|
||||||
Boards board(getCurrentBoard());
|
int pots = Boards::getCapability(board, Board::Pots);
|
||||||
int pots = board.getCapability(Board::Pots);
|
int sliders = Boards::getCapability(board, Board::Sliders);
|
||||||
int sliders = board.getCapability(Board::Sliders);
|
return pots + sliders + src.index;
|
||||||
return 1 + pots + sliders + src.index;
|
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ RawSource YamlRawSourceDecode(const std::string& src_str)
|
|||||||
|
|
||||||
} else if ((val_len == 2 &&
|
} else if ((val_len == 2 &&
|
||||||
val[0] == 'S' &&
|
val[0] == 'S' &&
|
||||||
val[1] >= 'A' && val[1] <= 'Z') ||
|
val[1] >= 'A' && val[1] <= 'S') || // ST used for surface steering
|
||||||
(val_len == 3 && (
|
(val_len == 3 && (
|
||||||
(val[0] == 'F' && val[1] == 'L') ||
|
(val[0] == 'F' && val[1] == 'L') ||
|
||||||
(val[0] == 'S' && val[1] == 'W')) &&
|
(val[0] == 'S' && val[1] == 'W')) &&
|
||||||
|
|||||||
@@ -37,11 +37,16 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
const uint8_t modn12x3[4][4]= {
|
const uint8_t modn12x3[8][4]= {
|
||||||
{1, 2, 3, 4},
|
{1, 2, 3, 4}, // air mode 1
|
||||||
{1, 3, 2, 4},
|
{1, 3, 2, 4}, // air mode 2
|
||||||
{4, 2, 3, 1},
|
{4, 2, 3, 1}, // air mode 3
|
||||||
{4, 3, 2, 1} };
|
{4, 3, 2, 1}, // air mode 4
|
||||||
|
{2, 3, 4, 1}, // surface mode 1
|
||||||
|
{2, 3, 4, 1}, // surface mode 2
|
||||||
|
{2, 3, 4, 1}, // surface mode 3
|
||||||
|
{2, 3, 4, 1} // surface mode 4
|
||||||
|
};
|
||||||
|
|
||||||
enum Capability {
|
enum Capability {
|
||||||
Models,
|
Models,
|
||||||
@@ -129,9 +134,6 @@ enum Capability {
|
|||||||
PermTimers,
|
PermTimers,
|
||||||
HasSDLogs,
|
HasSDLogs,
|
||||||
CSFunc,
|
CSFunc,
|
||||||
LcdWidth,
|
|
||||||
LcdHeight,
|
|
||||||
LcdDepth,
|
|
||||||
GetThrSwitch,
|
GetThrSwitch,
|
||||||
HasDisplayText,
|
HasDisplayText,
|
||||||
HasTopLcd,
|
HasTopLcd,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void FlightModeData::clear(const int phaseIdx)
|
|||||||
|
|
||||||
QString FlightModeData::nameToString(int phaseIdx) const
|
QString FlightModeData::nameToString(int phaseIdx) const
|
||||||
{
|
{
|
||||||
return RadioData::getElementName(tr("FM"), phaseIdx, name); // names are zero-based, FM0, FM1, etc
|
return RadioData::getElementName(Boards::isAir() ? tr("FM") : tr("DM"), phaseIdx, name); // names are zero-based, FM0, FM1, etc
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlightModeData::isEmpty(int phaseIdx) const
|
bool FlightModeData::isEmpty(int phaseIdx) const
|
||||||
|
|||||||
@@ -27,13 +27,41 @@
|
|||||||
#include "compounditemmodels.h"
|
#include "compounditemmodels.h"
|
||||||
#include "yaml_ops.h"
|
#include "yaml_ops.h"
|
||||||
|
|
||||||
const uint8_t chout_ar[] = { // First number is 0..23 -> template setup, Second is relevant channel out
|
const QList<int> channelsAir = { // First number is 0..23 -> template setup, Second is relevant channel out
|
||||||
1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2,
|
1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2,
|
||||||
2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1,
|
2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1,
|
||||||
3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
|
3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
|
||||||
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1
|
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const QList<QChar> controlsAir = { 'R', 'E', 'T', 'A' }; // channelsAir[x] - 1] entry mapping
|
||||||
|
|
||||||
|
const QList<int> channelsSurface = { // First number is 0..1 -> template setup, Second is relevant channel out
|
||||||
|
1,2 , 2,1
|
||||||
|
};
|
||||||
|
|
||||||
|
const QList<QChar> controlsSurface = { 'S', 'T' }; // channelsSurface[x] - 1] entry mapping
|
||||||
|
|
||||||
|
const QList<int> useChannels(bool isBoardAir)
|
||||||
|
{
|
||||||
|
return isBoardAir ? channelsAir : channelsSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<QChar> useControls(bool isBoardAir)
|
||||||
|
{
|
||||||
|
return isBoardAir ? controlsAir : controlsSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int channelsCount(bool isBoardAir)
|
||||||
|
{
|
||||||
|
return isBoardAir ? channelsAir.size() : channelsSurface.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
const int controlsCount(bool isBoardAir)
|
||||||
|
{
|
||||||
|
return isBoardAir ? controlsAir.size() : controlsSurface.size();
|
||||||
|
}
|
||||||
|
|
||||||
bool GeneralSettings::switchPositionAllowed(int index) const
|
bool GeneralSettings::switchPositionAllowed(int index) const
|
||||||
{
|
{
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
@@ -351,13 +379,15 @@ int GeneralSettings::getDefaultStick(unsigned int channel) const
|
|||||||
{
|
{
|
||||||
if (channel >= CPN_MAX_STICKS)
|
if (channel >= CPN_MAX_STICKS)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else {
|
||||||
return chout_ar[4 * templateSetup + channel] - 1;
|
return useChannels(Boards::isAir())[controlsCount(Boards::isAir()) * templateSetup + channel] - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
|
RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
|
||||||
{
|
{
|
||||||
int stick = getDefaultStick(channel);
|
int stick = getDefaultStick(channel);
|
||||||
|
|
||||||
if (stick >= 0)
|
if (stick >= 0)
|
||||||
return RawSource(SOURCE_TYPE_INPUT, stick + 1);
|
return RawSource(SOURCE_TYPE_INPUT, stick + 1);
|
||||||
else
|
else
|
||||||
@@ -366,7 +396,7 @@ RawSource GeneralSettings::getDefaultSource(unsigned int channel) const
|
|||||||
|
|
||||||
int GeneralSettings::getDefaultChannel(unsigned int stick) const
|
int GeneralSettings::getDefaultChannel(unsigned int stick) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++){
|
for (int i = 0; i < controlsCount(Boards::isAir()); i++) {
|
||||||
if (getDefaultStick(i) == (int)stick)
|
if (getDefaultStick(i) == (int)stick)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -959,3 +989,83 @@ AbstractStaticItemModel * TrainerMix::srcItemModel()
|
|||||||
mdl->loadItemList();
|
mdl->loadItemList();
|
||||||
return mdl;
|
return mdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GeneralSettings::stickModeToString() const
|
||||||
|
{
|
||||||
|
return stickModeToString(stickMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
QString GeneralSettings::stickModeToString(int value)
|
||||||
|
{
|
||||||
|
switch(value) {
|
||||||
|
case STICK_MODE_1:
|
||||||
|
return tr("Mode 1 (RUD ELE THR AIL)");
|
||||||
|
case STICK_MODE_2:
|
||||||
|
return tr("Mode 2 (RUD THR ELE AIL)");
|
||||||
|
case STICK_MODE_3:
|
||||||
|
return tr("Mode 3 (AIL ELE THR RUD)");
|
||||||
|
case STICK_MODE_4:
|
||||||
|
return tr("Mode 4 (AIL THR ELE RUD)");
|
||||||
|
default:
|
||||||
|
return CPN_STR_UNKNOWN_ITEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
AbstractStaticItemModel * GeneralSettings::stickModeItemModel()
|
||||||
|
{
|
||||||
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
|
mdl->setName(AIM_GS_STICKMODE);
|
||||||
|
|
||||||
|
for (int i = 0; i < STICK_MODE_COUNT; i++) {
|
||||||
|
mdl->appendToItemList(stickModeToString(i), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
mdl->loadItemList();
|
||||||
|
return mdl;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeneralSettings::templateSetupToString() const
|
||||||
|
{
|
||||||
|
return templateSetupToString(templateSetup, Boards::isAir());
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
QString GeneralSettings::templateSetupToString(int value, bool isBoardAir)
|
||||||
|
{
|
||||||
|
QString ret;
|
||||||
|
const QList<int> channels = useChannels(isBoardAir);
|
||||||
|
const QList<QChar> controls = useControls(isBoardAir);
|
||||||
|
|
||||||
|
if (value < (channels.size() / controls.size())) {
|
||||||
|
for (int i = 0; i < controls.size(); i++) {
|
||||||
|
if (i > 0)
|
||||||
|
ret.append(" ");
|
||||||
|
|
||||||
|
int idx = channels[controls.size() * value + i] - 1;
|
||||||
|
if (idx >= 0 && idx < controls.size())
|
||||||
|
ret.append(controls[channels[controls.size() * value + i] - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
AbstractStaticItemModel * GeneralSettings::templateSetupItemModel()
|
||||||
|
{
|
||||||
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
|
mdl->setName(AIM_GS_TEMPLATESETUP);
|
||||||
|
|
||||||
|
for (int i = 0; i < (channelsCount(true) / controlsCount(true)); i++) {
|
||||||
|
mdl->appendToItemList(templateSetupToString(i, true), i, true, 0, RadioTypeContextAir);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < (channelsCount(false) / controlsCount(false)); i++) {
|
||||||
|
mdl->appendToItemList(templateSetupToString(i, false), i, true, 0, RadioTypeContextSurface);
|
||||||
|
}
|
||||||
|
|
||||||
|
mdl->loadItemList();
|
||||||
|
return mdl;
|
||||||
|
}
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ constexpr char AIM_GS_INTMODULEBAUDRATE[] {"gs.intmodulebaudrate"};
|
|||||||
constexpr char AIM_GS_STICKDEADZONE[] {"gs.stickdeadzone"};
|
constexpr char AIM_GS_STICKDEADZONE[] {"gs.stickdeadzone"};
|
||||||
constexpr char AIM_GS_UARTSAMPLEMODE[] {"gs.uartsamplemode"};
|
constexpr char AIM_GS_UARTSAMPLEMODE[] {"gs.uartsamplemode"};
|
||||||
constexpr char AIM_GS_HATSMODE[] {"gs.hatsmode"};
|
constexpr char AIM_GS_HATSMODE[] {"gs.hatsmode"};
|
||||||
|
constexpr char AIM_GS_STICKMODE[] {"gs.stickmode"};
|
||||||
|
constexpr char AIM_GS_TEMPLATESETUP[] {"gs.templatesetup"};
|
||||||
|
|
||||||
constexpr char AIM_TRAINERMIX_MODE[] {"trainermix.mode"};
|
constexpr char AIM_TRAINERMIX_MODE[] {"trainermix.mode"};
|
||||||
constexpr char AIM_TRAINERMIX_SRC[] {"trainermix.src"};
|
constexpr char AIM_TRAINERMIX_SRC[] {"trainermix.src"};
|
||||||
|
|
||||||
@@ -188,6 +191,19 @@ class GeneralSettings {
|
|||||||
PPM_US
|
PPM_US
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum StickMode {
|
||||||
|
STICK_MODE_1,
|
||||||
|
STICK_MODE_2,
|
||||||
|
STICK_MODE_3,
|
||||||
|
STICK_MODE_4,
|
||||||
|
STICK_MODE_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum RadioTypeContext {
|
||||||
|
RadioTypeContextAir = 1 << 1,
|
||||||
|
RadioTypeContextSurface = 1 << 2,
|
||||||
|
};
|
||||||
|
|
||||||
GeneralSettings() { clear(); }
|
GeneralSettings() { clear(); }
|
||||||
void clear();
|
void clear();
|
||||||
void init();
|
void init();
|
||||||
@@ -394,6 +410,8 @@ class GeneralSettings {
|
|||||||
QString internalModuleBaudrateToString() const;
|
QString internalModuleBaudrateToString() const;
|
||||||
QString uartSampleModeToString() const;
|
QString uartSampleModeToString() const;
|
||||||
QString hatsModeToString() const;
|
QString hatsModeToString() const;
|
||||||
|
QString stickModeToString() const;
|
||||||
|
QString templateSetupToString() const;
|
||||||
|
|
||||||
static QString antennaModeToString(int value);
|
static QString antennaModeToString(int value);
|
||||||
static QString bluetoothModeToString(int value);
|
static QString bluetoothModeToString(int value);
|
||||||
@@ -403,6 +421,8 @@ class GeneralSettings {
|
|||||||
static FieldRange getTxCurrentCalibration();
|
static FieldRange getTxCurrentCalibration();
|
||||||
static QString uartSampleModeToString(int value);
|
static QString uartSampleModeToString(int value);
|
||||||
static QString hatsModeToString(int value);
|
static QString hatsModeToString(int value);
|
||||||
|
static QString stickModeToString(int value);
|
||||||
|
static QString templateSetupToString(int value, bool isBoardAir);
|
||||||
|
|
||||||
static AbstractStaticItemModel * antennaModeItemModel(bool model_setup = false);
|
static AbstractStaticItemModel * antennaModeItemModel(bool model_setup = false);
|
||||||
static AbstractStaticItemModel * bluetoothModeItemModel();
|
static AbstractStaticItemModel * bluetoothModeItemModel();
|
||||||
@@ -411,6 +431,8 @@ class GeneralSettings {
|
|||||||
static AbstractStaticItemModel * stickDeadZoneItemModel();
|
static AbstractStaticItemModel * stickDeadZoneItemModel();
|
||||||
static AbstractStaticItemModel * uartSampleModeItemModel();
|
static AbstractStaticItemModel * uartSampleModeItemModel();
|
||||||
static AbstractStaticItemModel * hatsModeItemModel(bool radio_setup = true);
|
static AbstractStaticItemModel * hatsModeItemModel(bool radio_setup = true);
|
||||||
|
static AbstractStaticItemModel * stickModeItemModel();
|
||||||
|
static AbstractStaticItemModel * templateSetupItemModel();
|
||||||
|
|
||||||
void validateFlexSwitches();
|
void validateFlexSwitches();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ bool ModelData::isEmpty() const
|
|||||||
|
|
||||||
void ModelData::setDefaultInputs(const GeneralSettings & settings)
|
void ModelData::setDefaultInputs(const GeneralSettings & settings)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CPN_MAX_STICKS; i++) {
|
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Sticks); i++) {
|
||||||
ExpoData * expo = &expoData[i];
|
ExpoData * expo = &expoData[i];
|
||||||
expo->chn = i;
|
expo->chn = i;
|
||||||
expo->mode = INPUT_MODE_BOTH;
|
expo->mode = INPUT_MODE_BOTH;
|
||||||
@@ -207,7 +207,7 @@ void ModelData::setDefaultMixes(const GeneralSettings & settings)
|
|||||||
{
|
{
|
||||||
setDefaultInputs(settings);
|
setDefaultInputs(settings);
|
||||||
|
|
||||||
for (int i = 0; i < CPN_MAX_STICKS; i++) {
|
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Sticks); i++) {
|
||||||
MixData * mix = &mixData[i];
|
MixData * mix = &mixData[i];
|
||||||
mix->destCh = i + 1;
|
mix->destCh = i + 1;
|
||||||
mix->weight = 100;
|
mix->weight = 100;
|
||||||
@@ -1492,20 +1492,21 @@ void ModelData::updateResetParam(CustomFunctionData * cfd)
|
|||||||
|
|
||||||
QString ModelData::thrTraceSrcToString() const
|
QString ModelData::thrTraceSrcToString() const
|
||||||
{
|
{
|
||||||
return thrTraceSrcToString((int)thrTraceSrc);
|
return thrTraceSrcToString(nullptr, (int)thrTraceSrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ModelData::thrTraceSrcToString(const int index) const
|
QString ModelData::thrTraceSrcToString(const GeneralSettings * generalSettings, const int index) const
|
||||||
{
|
{
|
||||||
const Board::Type board = getCurrentBoard();
|
const Board::Type board = getCurrentBoard();
|
||||||
const int pscnt = Boards::getCapability(board, Board::Pots) + Boards::getCapability(board, Board::Sliders);
|
const int pscnt = Boards::getCapability(board, Board::Pots) + Boards::getCapability(board, Board::Sliders);
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
return tr("THR");
|
return Boards::getCapability(board, Board::Air) ? tr("THR") : tr("TH");
|
||||||
else if (index <= pscnt)
|
else if (index <= pscnt)
|
||||||
return Boards::getInputName(index + Boards::getCapability(board, Board::Sticks) - 1, board);
|
//return Boards::getInputName(index + Boards::getCapability(board, Board::Sticks) - 1, board);
|
||||||
|
return RawSource(SOURCE_TYPE_INPUT, index + Boards::getCapability(board, Board::Sticks)).toString(this, generalSettings, board);
|
||||||
else if (index <= pscnt + getCurrentFirmware()->getCapability(Outputs))
|
else if (index <= pscnt + getCurrentFirmware()->getCapability(Outputs))
|
||||||
return RawSource(SOURCE_TYPE_CH, index - pscnt - 1).toString(this);
|
return RawSource(SOURCE_TYPE_CH, index - pscnt).toString(this);
|
||||||
|
|
||||||
return QString(CPN_STR_UNKNOWN_ITEM);
|
return QString(CPN_STR_UNKNOWN_ITEM);
|
||||||
}
|
}
|
||||||
@@ -1522,10 +1523,12 @@ bool ModelData::isThrTraceSrcAvailable(const GeneralSettings * generalSettings,
|
|||||||
{
|
{
|
||||||
const Board::Type board = getCurrentBoard();
|
const Board::Type board = getCurrentBoard();
|
||||||
|
|
||||||
if (index > 0 && index <= Boards::getCapability(board, Board::Pots) + Boards::getCapability(board, Board::Sliders))
|
if (index == 0)
|
||||||
return RawSource(SOURCE_TYPE_INPUT, index + Boards::getCapability(board, Board::Sticks) - 1).isAvailable(this, generalSettings, board);
|
|
||||||
else
|
|
||||||
return true;
|
return true;
|
||||||
|
else if (index > 0 && index <= Boards::getCapability(board, Board::Pots) + Boards::getCapability(board, Board::Sliders))
|
||||||
|
return RawSource(SOURCE_TYPE_INPUT, index + Boards::getCapability(board, Board::Sticks)).isAvailable(this, generalSettings, board);
|
||||||
|
else
|
||||||
|
return hasMixes(index - Boards::getCapability(board, Board::Pots) - Boards::getCapability(board, Board::Sliders) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelData::limitsClear(const int index)
|
void ModelData::limitsClear(const int index)
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ class ModelData {
|
|||||||
bool hasExpoSiblings(const int index);
|
bool hasExpoSiblings(const int index);
|
||||||
void removeMix(const int idx);
|
void removeMix(const int idx);
|
||||||
QString thrTraceSrcToString() const;
|
QString thrTraceSrcToString() const;
|
||||||
QString thrTraceSrcToString(const int index) const;
|
QString thrTraceSrcToString(const GeneralSettings * generalSettings, const int index) const;
|
||||||
int thrTraceSrcCount() const;
|
int thrTraceSrcCount() const;
|
||||||
bool isThrTraceSrcAvailable(const GeneralSettings * generalSettings, const int index) const;
|
bool isThrTraceSrcAvailable(const GeneralSettings * generalSettings, const int index) const;
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ class ModelData {
|
|||||||
static AbstractStaticItemModel * funcSwitchConfigItemModel();
|
static AbstractStaticItemModel * funcSwitchConfigItemModel();
|
||||||
static AbstractStaticItemModel * funcSwitchGroupStartSwitchModel(int switchcnt);
|
static AbstractStaticItemModel * funcSwitchGroupStartSwitchModel(int switchcnt);
|
||||||
static AbstractStaticItemModel * funcSwitchGroupsModel();
|
static AbstractStaticItemModel * funcSwitchGroupsModel();
|
||||||
|
|
||||||
unsigned int getFuncSwitchGroup(unsigned int index) const;
|
unsigned int getFuncSwitchGroup(unsigned int index) const;
|
||||||
void setFuncSwitchGroup(unsigned int index, unsigned int value);
|
void setFuncSwitchGroup(unsigned int index, unsigned int value);
|
||||||
|
|
||||||
|
|||||||
@@ -545,7 +545,9 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
|||||||
case FlightModesHaveFades:
|
case FlightModesHaveFades:
|
||||||
return 1;
|
return 1;
|
||||||
case Heli:
|
case Heli:
|
||||||
if (IS_HORUS_OR_TARANIS(board))
|
if (Boards::getCapability(board, Board::Surface))
|
||||||
|
return false;
|
||||||
|
else if (IS_HORUS_OR_TARANIS(board))
|
||||||
return id.contains("noheli") ? 0 : 1;
|
return id.contains("noheli") ? 0 : 1;
|
||||||
else
|
else
|
||||||
return id.contains("heli") ? 1 : 0;
|
return id.contains("heli") ? 1 : 0;
|
||||||
@@ -674,9 +676,9 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
|||||||
case OptrexDisplay:
|
case OptrexDisplay:
|
||||||
return (board == BOARD_SKY9X ? true : false);
|
return (board == BOARD_SKY9X ? true : false);
|
||||||
case HasVario:
|
case HasVario:
|
||||||
return 1;
|
return Boards::isAir(board);
|
||||||
case HasVarioSink:
|
case HasVarioSink:
|
||||||
return true;
|
return Boards::isAir(board);
|
||||||
case HasFailsafe:
|
case HasFailsafe:
|
||||||
return 32;
|
return 32;
|
||||||
case NumModules:
|
case NumModules:
|
||||||
@@ -705,37 +707,6 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
|||||||
return 18;
|
return 18;
|
||||||
case HasSDLogs:
|
case HasSDLogs:
|
||||||
return true;
|
return true;
|
||||||
case LcdWidth:
|
|
||||||
if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
|
|
||||||
return 320;
|
|
||||||
else if (IS_FLYSKY_PL18(board))
|
|
||||||
return 480;
|
|
||||||
else if (IS_FAMILY_HORUS_OR_T16(board))
|
|
||||||
return 480;
|
|
||||||
else if (IS_TARANIS_SMALL(board))
|
|
||||||
return 128;
|
|
||||||
else if (IS_TARANIS(board))
|
|
||||||
return 212;
|
|
||||||
else
|
|
||||||
return 128;
|
|
||||||
case LcdHeight:
|
|
||||||
if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))
|
|
||||||
return 480;
|
|
||||||
else if (IS_FLYSKY_PL18(board) || IS_JUMPER_T15(board))
|
|
||||||
return 320;
|
|
||||||
else if (IS_FAMILY_HORUS_OR_T16(board))
|
|
||||||
return 272;
|
|
||||||
else
|
|
||||||
return 64;
|
|
||||||
case LcdDepth:
|
|
||||||
if (IS_FAMILY_HORUS_OR_T16(board))
|
|
||||||
return 16;
|
|
||||||
else if (IS_TARANIS_SMALL(board))
|
|
||||||
return 1;
|
|
||||||
else if (IS_TARANIS(board))
|
|
||||||
return 4;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
case GetThrSwitch:
|
case GetThrSwitch:
|
||||||
return (IS_HORUS_OR_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR);
|
return (IS_HORUS_OR_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR);
|
||||||
case HasDisplayText:
|
case HasDisplayText:
|
||||||
@@ -817,12 +788,14 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
|||||||
case HasAuxSerialMode:
|
case HasAuxSerialMode:
|
||||||
return (IS_FAMILY_HORUS_OR_T16(board) && !(IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))) ||
|
return (IS_FAMILY_HORUS_OR_T16(board) && !(IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board))) ||
|
||||||
(IS_TARANIS_X9(board) && !IS_TARANIS_X9DP_2019(board)) ||
|
(IS_TARANIS_X9(board) && !IS_TARANIS_X9DP_2019(board)) ||
|
||||||
IS_RADIOMASTER_ZORRO(board) || IS_RADIOMASTER_TX12_MK2(board);
|
IS_RADIOMASTER_ZORRO(board) || IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_MT12(board);
|
||||||
case HasAux2SerialMode:
|
case HasAux2SerialMode:
|
||||||
return IS_FAMILY_T16(board);
|
return IS_FAMILY_T16(board);
|
||||||
case HasVCPSerialMode:
|
case HasVCPSerialMode:
|
||||||
return IS_FAMILY_HORUS_OR_T16(board) || IS_RADIOMASTER_ZORRO(board) ||
|
return IS_FAMILY_HORUS_OR_T16(board) || IS_RADIOMASTER_ZORRO(board) ||
|
||||||
IS_JUMPER_TPRO(board) || IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_POCKET(board);
|
IS_JUMPER_TPRO(board) || IS_RADIOMASTER_TX12_MK2(board) ||
|
||||||
|
IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_POCKET(board) ||
|
||||||
|
IS_RADIOMASTER_MT12(board);
|
||||||
case HasBluetooth:
|
case HasBluetooth:
|
||||||
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board)|| IS_TARANIS_X9E(board) ||
|
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board)|| IS_TARANIS_X9E(board) ||
|
||||||
IS_TARANIS_X9DP_2019(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board) || IS_FLYSKY_PL18(board)) ? true : false;
|
IS_TARANIS_X9DP_2019(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board) || IS_FLYSKY_PL18(board)) ? true : false;
|
||||||
@@ -831,7 +804,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
|||||||
case HasTelemetryBaudrate:
|
case HasTelemetryBaudrate:
|
||||||
return IS_HORUS_OR_TARANIS(board);
|
return IS_HORUS_OR_TARANIS(board);
|
||||||
case TopBarZones:
|
case TopBarZones:
|
||||||
return getCapability(LcdWidth) > getCapability(LcdHeight) ? 4 : 2;
|
return Boards::getCapability(board, Board::LcdWidth) > Boards::getCapability(board, Board::LcdHeight) ? 4 : 2;
|
||||||
case HasModelsList:
|
case HasModelsList:
|
||||||
return IS_FAMILY_HORUS_OR_T16(board);
|
return IS_FAMILY_HORUS_OR_T16(board);
|
||||||
case HasFlySkyGimbals:
|
case HasFlySkyGimbals:
|
||||||
@@ -843,7 +816,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
|||||||
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_ZORRO(board) ||
|
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_ZORRO(board) ||
|
||||||
IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_TX16S(board) ||
|
IS_RADIOMASTER_BOXER(board) || IS_RADIOMASTER_TX16S(board) ||
|
||||||
IS_JUMPER_T18(board) || IS_JUMPER_T20(board) ||
|
IS_JUMPER_T18(board) || IS_JUMPER_T20(board) ||
|
||||||
IS_RADIOMASTER_POCKET(board));
|
IS_RADIOMASTER_POCKET(board) || IS_RADIOMASTER_MT12(board));
|
||||||
case HasSoftwareSerialPower:
|
case HasSoftwareSerialPower:
|
||||||
return IS_RADIOMASTER_TX16S(board);
|
return IS_RADIOMASTER_TX16S(board);
|
||||||
case HasIntModuleMulti:
|
case HasIntModuleMulti:
|
||||||
@@ -851,13 +824,15 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
|||||||
IS_RADIOMASTER_TX12(board) || IS_JUMPER_TLITE(board) || IS_BETAFPV_LR3PRO(board) ||
|
IS_RADIOMASTER_TX12(board) || IS_JUMPER_TLITE(board) || IS_BETAFPV_LR3PRO(board) ||
|
||||||
(IS_RADIOMASTER_ZORRO(board) && !id.contains("internalelrs")) ||
|
(IS_RADIOMASTER_ZORRO(board) && !id.contains("internalelrs")) ||
|
||||||
(IS_RADIOMASTER_BOXER(board) && !id.contains("internalelrs")) ||
|
(IS_RADIOMASTER_BOXER(board) && !id.contains("internalelrs")) ||
|
||||||
(IS_RADIOMASTER_POCKET(board) && !id.contains("internalelrs"));
|
(IS_RADIOMASTER_POCKET(board) && !id.contains("internalelrs")) ||
|
||||||
|
(IS_RADIOMASTER_MT12(board) && !id.contains("internalelrs"));
|
||||||
case HasIntModuleCRSF:
|
case HasIntModuleCRSF:
|
||||||
return id.contains("internalcrsf");
|
return id.contains("internalcrsf");
|
||||||
case HasIntModuleELRS:
|
case HasIntModuleELRS:
|
||||||
return id.contains("internalelrs") || IS_RADIOMASTER_TX12_MK2(board) ||
|
return id.contains("internalelrs") || IS_RADIOMASTER_TX12_MK2(board) ||
|
||||||
IS_IFLIGHT_COMMANDO8(board) || IS_RADIOMASTER_BOXER(board) ||
|
IS_IFLIGHT_COMMANDO8(board) || IS_RADIOMASTER_BOXER(board) ||
|
||||||
IS_RADIOMASTER_POCKET(board) || IS_JUMPER_T20(board);
|
IS_RADIOMASTER_POCKET(board) || IS_JUMPER_T20(board) ||
|
||||||
|
IS_RADIOMASTER_MT12(board);
|
||||||
case HasIntModuleFlySky:
|
case HasIntModuleFlySky:
|
||||||
return id.contains("afhds2a") || id.contains("afhds3") ||
|
return id.contains("afhds2a") || id.contains("afhds3") ||
|
||||||
IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board);
|
IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board);
|
||||||
@@ -1529,6 +1504,15 @@ void registerOpenTxFirmwares()
|
|||||||
registerOpenTxFirmware(firmware);
|
registerOpenTxFirmware(firmware);
|
||||||
addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3);
|
addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3);
|
||||||
|
|
||||||
|
/* Radiomaster MT12 board */
|
||||||
|
firmware = new OpenTxFirmware(FIRMWAREID("mt12"), QCoreApplication::translate("Firmware", "Radiomaster MT12"), Board::BOARD_RADIOMASTER_MT12);
|
||||||
|
addOpenTxCommonOptions(firmware);
|
||||||
|
firmware->addOption("nogvars", Firmware::tr("Disable Global variables"));
|
||||||
|
firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen"));
|
||||||
|
addOpenTxFontOptions(firmware);
|
||||||
|
registerOpenTxFirmware(firmware);
|
||||||
|
addOpenTxRfOptions(firmware, NONE);
|
||||||
|
|
||||||
/* Radiomaster T8 board */
|
/* Radiomaster T8 board */
|
||||||
firmware = new OpenTxFirmware(FIRMWAREID("t8"), QCoreApplication::translate("Firmware", "Radiomaster T8"), BOARD_RADIOMASTER_T8);
|
firmware = new OpenTxFirmware(FIRMWAREID("t8"), QCoreApplication::translate("Firmware", "Radiomaster T8"), BOARD_RADIOMASTER_T8);
|
||||||
addOpenTxCommonOptions(firmware);
|
addOpenTxCommonOptions(firmware);
|
||||||
|
|||||||
@@ -137,8 +137,12 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
|||||||
if (board == Board::BOARD_UNKNOWN)
|
if (board == Board::BOARD_UNKNOWN)
|
||||||
board = getCurrentBoard();
|
board = getCurrentBoard();
|
||||||
|
|
||||||
static const QString trims[] = {
|
static const QString trimsAir[] = {
|
||||||
"", tr("TrmR"), tr("TrmE"), tr("TrmT"), tr("TrmA"), tr("Trm5"), tr("Trm6"), tr("Trm7"), tr("Trm8")
|
"", tr("Trim Rud"), tr("Trim Ele"), tr("Trim Thr"), tr("Trim Ail"), tr("Trim 5"), tr("Trim 6"), tr("Trim 7"), tr("Trim 8")
|
||||||
|
};
|
||||||
|
|
||||||
|
static const QString trimsSurface[] = {
|
||||||
|
"", tr("Trim ST"), tr("Trim TH"), tr("Trim 3"), tr("Trim 4"), tr("Trim 5"), tr("Trim 6"), tr("Trim 7"), tr("Trim 8")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const QString trims2[] = {
|
static const QString trims2[] = {
|
||||||
@@ -180,7 +184,9 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
|||||||
return DataHelpers::getCompositeName(dfltName, custName, prefixCustomName);
|
return DataHelpers::getCompositeName(dfltName, custName, prefixCustomName);
|
||||||
|
|
||||||
case SOURCE_TYPE_TRIM:
|
case SOURCE_TYPE_TRIM:
|
||||||
return (Boards::getCapability(board, Board::NumTrims) == 2 ? CHECK_IN_ARRAY(trims2, index) : CHECK_IN_ARRAY(trims, index));
|
return (Boards::getCapability(board, Board::NumTrims) == 2 ? CHECK_IN_ARRAY(trims2, index) :
|
||||||
|
(Boards::isAir(board) ? CHECK_IN_ARRAY(trimsAir, index) :
|
||||||
|
CHECK_IN_ARRAY(trimsSurface, index)));
|
||||||
|
|
||||||
case SOURCE_TYPE_ROTARY_ENCODER:
|
case SOURCE_TYPE_ROTARY_ENCODER:
|
||||||
return CHECK_IN_ARRAY(rotary, index);
|
return CHECK_IN_ARRAY(rotary, index);
|
||||||
@@ -286,6 +292,7 @@ bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings
|
|||||||
board = getCurrentBoard();
|
board = getCurrentBoard();
|
||||||
|
|
||||||
Boards b(board);
|
Boards b(board);
|
||||||
|
Firmware *firmware = getCurrentFirmware();
|
||||||
|
|
||||||
if (type == SOURCE_TYPE_CH && abs(index) > CPN_MAX_CHNOUT)
|
if (type == SOURCE_TYPE_CH && abs(index) > CPN_MAX_CHNOUT)
|
||||||
return false;
|
return false;
|
||||||
@@ -296,9 +303,6 @@ bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings
|
|||||||
if (type == SOURCE_TYPE_CUSTOM_SWITCH && abs(index) > CPN_MAX_LOGICAL_SWITCHES)
|
if (type == SOURCE_TYPE_CUSTOM_SWITCH && abs(index) > CPN_MAX_LOGICAL_SWITCHES)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (type == SOURCE_TYPE_FUNCTIONSWITCH_GROUP && b.getCapability(Board::FunctionSwitches) && model->getFuncGroupSwitchCount(abs(index), CPN_MAX_SWITCHES_FUNCTION) == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (type == SOURCE_TYPE_LUA_OUTPUT && div(abs(index - 1), 16).quot >= CPN_MAX_SCRIPTS)
|
if (type == SOURCE_TYPE_LUA_OUTPUT && div(abs(index - 1), 16).quot >= CPN_MAX_SCRIPTS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -317,6 +321,9 @@ bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings
|
|||||||
if (type == SOURCE_TYPE_TELEMETRY && div(abs(index), 3).quot > CPN_MAX_SENSORS)
|
if (type == SOURCE_TYPE_TELEMETRY && div(abs(index), 3).quot > CPN_MAX_SENSORS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (type == SOURCE_TYPE_CYC && !firmware->getCapability(Heli))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (model) {
|
if (model) {
|
||||||
if (type == SOURCE_TYPE_TIMER && model->timers[abs(index) - 1].isModeOff())
|
if (type == SOURCE_TYPE_TIMER && model->timers[abs(index) - 1].isModeOff())
|
||||||
return false;
|
return false;
|
||||||
@@ -342,6 +349,17 @@ bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings
|
|||||||
|
|
||||||
if (type == SOURCE_TYPE_CH && !model->hasMixes(abs(index) - 1))
|
if (type == SOURCE_TYPE_CH && !model->hasMixes(abs(index) - 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (type == SOURCE_TYPE_FUNCTIONSWITCH_GROUP) {
|
||||||
|
if (!b.getCapability(Board::FunctionSwitches))
|
||||||
|
return false;
|
||||||
|
else if (model->getFuncGroupSwitchCount(abs(index), CPN_MAX_SWITCHES_FUNCTION) == 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (type == SOURCE_TYPE_FUNCTIONSWITCH_GROUP && b.getCapability(Board::FunctionSwitches))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gs) {
|
if (gs) {
|
||||||
|
|||||||
@@ -37,15 +37,26 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
|||||||
QString("AIL"), QString("GEA"), QString("TRN")
|
QString("AIL"), QString("GEA"), QString("TRN")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const QString trimsSwitches[] = {
|
static const QString trimsSwitchesAir[] = {
|
||||||
tr("Rud-"), tr("Rud+"),
|
tr("Trim Rud-"), tr("Trim Rud+"),
|
||||||
tr("Ele-"), tr("Ele+"),
|
tr("Trim Ele-"), tr("Trim Ele+"),
|
||||||
tr("Thr-"), tr("Thr+"),
|
tr("Trim Thr-"), tr("Trim Thr+"),
|
||||||
tr("Ail-"), tr("Ail+"),
|
tr("Trim Ail-"), tr("Trim Ail+"),
|
||||||
tr("T5-"), tr("T5+"),
|
tr("Trim T5-"), tr("Trim T5+"),
|
||||||
tr("T6-"), tr("T6+"),
|
tr("Trim T6-"), tr("Trim T6+"),
|
||||||
tr("T7-"), tr("T7+"),
|
tr("Trim T7-"), tr("Trim T7+"),
|
||||||
tr("T8-"), tr("T8+")
|
tr("Trim T8-"), tr("Trim T8+")
|
||||||
|
};
|
||||||
|
|
||||||
|
static const QString trimsSwitchesSurface[] = {
|
||||||
|
tr("Trim ST-"), tr("Trim ST+"),
|
||||||
|
tr("Trim TH-"), tr("Trim TH+"),
|
||||||
|
tr("Trim T3-"), tr("Trim T3+"),
|
||||||
|
tr("Trim T4-"), tr("Trim T4+"),
|
||||||
|
tr("Trim T5-"), tr("Trim T5+"),
|
||||||
|
tr("Trim T6-"), tr("Trim T6+"),
|
||||||
|
tr("Trim T7-"), tr("Trim T7+"),
|
||||||
|
tr("Trim T8-"), tr("Trim T8+")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const QString trimsSwitches2[] = {
|
static const QString trimsSwitches2[] = {
|
||||||
@@ -115,7 +126,9 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
|||||||
|
|
||||||
case SWITCH_TYPE_TRIM:
|
case SWITCH_TYPE_TRIM:
|
||||||
return (Boards::getCapability(board, Board::NumTrims) == 2 ?
|
return (Boards::getCapability(board, Board::NumTrims) == 2 ?
|
||||||
CHECK_IN_ARRAY(trimsSwitches2, index - 1) : CHECK_IN_ARRAY(trimsSwitches, index - 1));
|
CHECK_IN_ARRAY(trimsSwitches2, index - 1) :
|
||||||
|
(Boards::isAir(board) ? CHECK_IN_ARRAY(trimsSwitchesAir, index - 1) :
|
||||||
|
CHECK_IN_ARRAY(trimsSwitchesSurface, index - 1)));
|
||||||
|
|
||||||
case SWITCH_TYPE_ROTARY_ENCODER:
|
case SWITCH_TYPE_ROTARY_ENCODER:
|
||||||
return CHECK_IN_ARRAY(rotaryEncoders, index - 1);
|
return CHECK_IN_ARRAY(rotaryEncoders, index - 1);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ GeneralOptionsPanel::GeneralOptionsPanel(QWidget * parent, GeneralSettings & gen
|
|||||||
addParams();
|
addParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
addLabel(tr("Flight Modes"));
|
addLabel(tr("%1 Modes").arg(Boards::getRadioTypeString(board)));
|
||||||
AutoCheckBox *fmDisable = new AutoCheckBox(this);
|
AutoCheckBox *fmDisable = new AutoCheckBox(this);
|
||||||
fmDisable->setField(generalSettings.modelFMDisabled, this, true);
|
fmDisable->setField(generalSettings.modelFMDisabled, this, true);
|
||||||
params->append(fmDisable);
|
params->append(fmDisable);
|
||||||
|
|||||||
@@ -26,6 +26,10 @@
|
|||||||
#include "autocombobox.h"
|
#include "autocombobox.h"
|
||||||
#include "namevalidator.h"
|
#include "namevalidator.h"
|
||||||
|
|
||||||
|
constexpr char FIM_HATSMODE[] {"Hats Mode"};
|
||||||
|
constexpr char FIM_STICKMODE[] {"Stick Mode"};
|
||||||
|
constexpr char FIM_TEMPLATESETUP[] {"Template Setup"};
|
||||||
|
|
||||||
GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
|
GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
|
||||||
GeneralPanel(parent, generalSettings, firmware),
|
GeneralPanel(parent, generalSettings, firmware),
|
||||||
ui(new Ui::GeneralSetup)
|
ui(new Ui::GeneralSetup)
|
||||||
@@ -34,6 +38,15 @@ ui(new Ui::GeneralSetup)
|
|||||||
|
|
||||||
Board::Type board = firmware->getBoard();
|
Board::Type board = firmware->getBoard();
|
||||||
|
|
||||||
|
panelFilteredModels = new FilteredItemModelFactory();
|
||||||
|
|
||||||
|
panelFilteredModels->registerItemModel(new FilteredItemModel(GeneralSettings::hatsModeItemModel()), FIM_HATSMODE);
|
||||||
|
panelFilteredModels->registerItemModel(new FilteredItemModel(GeneralSettings::stickModeItemModel()), FIM_STICKMODE);
|
||||||
|
panelFilteredModels->registerItemModel(new FilteredItemModel(GeneralSettings::templateSetupItemModel(),
|
||||||
|
Boards::isAir(board) ? GeneralSettings::RadioTypeContextAir :
|
||||||
|
GeneralSettings::RadioTypeContextSurface),
|
||||||
|
FIM_TEMPLATESETUP);
|
||||||
|
|
||||||
QLabel *pmsl[] = {ui->ro_label, ui->ro1_label, ui->ro2_label, ui->ro3_label, ui->ro4_label, ui->ro5_label, ui->ro6_label, ui->ro7_label, ui->ro8_label, NULL};
|
QLabel *pmsl[] = {ui->ro_label, ui->ro1_label, ui->ro2_label, ui->ro3_label, ui->ro4_label, ui->ro5_label, ui->ro6_label, ui->ro7_label, ui->ro8_label, NULL};
|
||||||
QSlider *tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
|
QSlider *tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
|
||||||
|
|
||||||
@@ -178,7 +191,7 @@ ui(new Ui::GeneralSetup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IS_FLYSKY_EL18(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_PL18(board)) {
|
if (IS_FLYSKY_EL18(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_PL18(board)) {
|
||||||
ui->hatsModeCB->setModel(new FilteredItemModel(GeneralSettings::hatsModeItemModel()));
|
ui->hatsModeCB->setModel(panelFilteredModels->getItemModel(FIM_HATSMODE));
|
||||||
ui->hatsModeCB->setField(generalSettings.hatsMode, this);
|
ui->hatsModeCB->setField(generalSettings.hatsMode, this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -204,12 +217,12 @@ ui(new Ui::GeneralSetup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!firmware->getCapability(HasVolume)) {
|
if (!firmware->getCapability(HasVolume)) {
|
||||||
ui->volume_SB->hide();
|
ui->volume_SL->hide();
|
||||||
ui->volume_SB->setDisabled(true);
|
ui->volume_SL->setDisabled(true);
|
||||||
ui->label_volume->hide();
|
ui->label_volume->hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->volume_SB->setMaximum(firmware->getCapability(MaxVolume));
|
ui->volume_SL->setMaximum(firmware->getCapability(MaxVolume));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!firmware->getCapability(HasBrightness)) {
|
if (!firmware->getCapability(HasBrightness)) {
|
||||||
@@ -264,8 +277,8 @@ ui(new Ui::GeneralSetup)
|
|||||||
ui->contrastSB->setMaximum(firmware->getCapability(MaxContrast));
|
ui->contrastSB->setMaximum(firmware->getCapability(MaxContrast));
|
||||||
ui->contrastSB->setValue(generalSettings.contrast);
|
ui->contrastSB->setValue(generalSettings.contrast);
|
||||||
|
|
||||||
ui->battwarningDSB->setValue((double)generalSettings.vBatWarn/10);
|
ui->battwarningDSB->setValue((double)generalSettings.vBatWarn / 10);
|
||||||
ui->backlightautoSB->setValue(generalSettings.backlightDelay*5);
|
ui->backlightautoSB->setValue(generalSettings.backlightDelay * 5);
|
||||||
ui->inactimerSB->setValue(generalSettings.inactivityTimer);
|
ui->inactimerSB->setValue(generalSettings.inactivityTimer);
|
||||||
|
|
||||||
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); // Default is zero=checked
|
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); // Default is zero=checked
|
||||||
@@ -274,7 +287,7 @@ ui(new Ui::GeneralSetup)
|
|||||||
ui->rssiPowerOffWarnChkB->setChecked(!generalSettings.disableRssiPoweroffAlarm); // Default is zero=checked
|
ui->rssiPowerOffWarnChkB->setChecked(!generalSettings.disableRssiPoweroffAlarm); // Default is zero=checked
|
||||||
ui->trainerPowerOffWarnChkB->setChecked(!generalSettings.disableTrainerPoweroffAlarm); // Default is zero=checked
|
ui->trainerPowerOffWarnChkB->setChecked(!generalSettings.disableTrainerPoweroffAlarm); // Default is zero=checked
|
||||||
|
|
||||||
ui->splashScreenDuration->setCurrentIndex(3-generalSettings.splashMode);
|
ui->splashScreenDuration->setCurrentIndex(3 - generalSettings.splashMode);
|
||||||
if (IS_FAMILY_HORUS_OR_T16(firmware->getBoard())) {
|
if (IS_FAMILY_HORUS_OR_T16(firmware->getBoard())) {
|
||||||
ui->splashScreenDuration->setItemText(0, QCoreApplication::translate("GeneralSetup", "1s", nullptr));
|
ui->splashScreenDuration->setItemText(0, QCoreApplication::translate("GeneralSetup", "1s", nullptr));
|
||||||
}
|
}
|
||||||
@@ -297,11 +310,14 @@ ui(new Ui::GeneralSetup)
|
|||||||
ui->registrationId->setValidator(new NameValidator(board, this));
|
ui->registrationId->setValidator(new NameValidator(board, this));
|
||||||
ui->registrationId->setMaxLength(REGISTRATION_ID_LEN);
|
ui->registrationId->setMaxLength(REGISTRATION_ID_LEN);
|
||||||
|
|
||||||
|
ui->stickmodeCB->setModel(panelFilteredModels->getItemModel(FIM_STICKMODE));
|
||||||
|
ui->channelorderCB->setModel(panelFilteredModels->getItemModel(FIM_TEMPLATESETUP));
|
||||||
|
|
||||||
setValues();
|
setValues();
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
|
|
||||||
for (int i=0; tpmsld[i]; i++) {
|
for (int i = 0; tpmsld[i]; i++) {
|
||||||
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
|
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +349,7 @@ ui(new Ui::GeneralSetup)
|
|||||||
ui->backlightColor2_label->hide();
|
ui->backlightColor2_label->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->switchesDelay->setValue(10*(generalSettings.switchesDelay+15));
|
ui->switchesDelay->setValue(10 * (generalSettings.switchesDelay + 15));
|
||||||
ui->blAlarm_ChkB->setChecked(generalSettings.alarmsFlash);
|
ui->blAlarm_ChkB->setChecked(generalSettings.alarmsFlash);
|
||||||
|
|
||||||
if (!firmware->getCapability(HasBatMeterRange)) {
|
if (!firmware->getCapability(HasBatMeterRange)) {
|
||||||
@@ -344,12 +360,30 @@ ui(new Ui::GeneralSetup)
|
|||||||
ui->vBatMaxDSB->hide();
|
ui->vBatMaxDSB->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Boards::getCapability(board, Board::Surface)) {
|
||||||
|
ui->stickModeLabel->hide();
|
||||||
|
ui->stickmodeCB->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!firmware->getCapability(HasVario)) {
|
||||||
|
ui->varioVolume_label->hide();
|
||||||
|
ui->varioVolume_SL->hide();
|
||||||
|
ui->varioP0_label->hide();
|
||||||
|
ui->varioP0_SB->hide();
|
||||||
|
ui->varioPMax_label->hide();
|
||||||
|
ui->varioPMax_SB->hide();
|
||||||
|
ui->varioR0_label->hide();
|
||||||
|
ui->varioR0_SB->hide();
|
||||||
|
}
|
||||||
|
|
||||||
disableMouseScrolling();
|
disableMouseScrolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralSetupPanel::~GeneralSetupPanel()
|
GeneralSetupPanel::~GeneralSetupPanel()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete panelFilteredModels;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_timezoneLE_textEdited(const QString &text)
|
void GeneralSetupPanel::on_timezoneLE_textEdited(const QString &text)
|
||||||
@@ -365,14 +399,15 @@ void GeneralSetupPanel::on_timezoneLE_textEdited(const QString &text)
|
|||||||
void GeneralSetupPanel::populateBacklightCB()
|
void GeneralSetupPanel::populateBacklightCB()
|
||||||
{
|
{
|
||||||
QComboBox * b = ui->backlightswCB;
|
QComboBox * b = ui->backlightswCB;
|
||||||
QString strings[] = { tr("OFF"), tr("Keys"), tr("Sticks"), tr("Keys + Sticks"), tr("ON"), NULL };
|
const QStringList strings = { tr("OFF"), tr("Keys"), tr("Controls"), tr("Keys + Controls"), tr("ON") };
|
||||||
|
|
||||||
b->clear();
|
b->clear();
|
||||||
int startValue = (firmware->getCapability(LcdDepth)>=8)?1:0;
|
int startValue = (Boards::getCapability(firmware->getBoard(), Board::LcdDepth) >= 8) ? 1 : 0;
|
||||||
for (int i=startValue; !strings[i].isNull(); i++) {
|
|
||||||
|
for (int i = startValue; i < strings.size(); i++) {
|
||||||
b->addItem(strings[i], 0);
|
b->addItem(strings[i], 0);
|
||||||
if (generalSettings.backlightMode == i) {
|
if (generalSettings.backlightMode == i) {
|
||||||
b->setCurrentIndex(b->count()-1);
|
b->setCurrentIndex(b->count() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,10 +438,10 @@ void GeneralSetupPanel::populateVoiceLangCB()
|
|||||||
{ NULL, NULL }};
|
{ NULL, NULL }};
|
||||||
|
|
||||||
b->clear();
|
b->clear();
|
||||||
for (int i=0; strings[i][0]!=NULL; i++) {
|
for (int i = 0; strings[i][0] != NULL; i++) {
|
||||||
b->addItem(strings[i][0],strings[i][1]);
|
b->addItem(strings[i][0],strings[i][1]);
|
||||||
if (generalSettings.ttsLanguage == strings[i][1]) {
|
if (generalSettings.ttsLanguage == strings[i][1]) {
|
||||||
b->setCurrentIndex(b->count()-1);
|
b->setCurrentIndex(b->count() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -455,7 +490,7 @@ void GeneralSetupPanel::on_voiceLang_CB_currentIndexChanged(int index)
|
|||||||
{
|
{
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
QString code = ui->voiceLang_CB->itemData(index).toString();
|
QString code = ui->voiceLang_CB->itemData(index).toString();
|
||||||
for (int i=0; i<2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
generalSettings.ttsLanguage[i] = code.at(i).toLatin1();
|
generalSettings.ttsLanguage[i] = code.at(i).toLatin1();
|
||||||
}
|
}
|
||||||
generalSettings.ttsLanguage[2] = '\0';
|
generalSettings.ttsLanguage[2] = '\0';
|
||||||
@@ -465,8 +500,8 @@ void GeneralSetupPanel::on_voiceLang_CB_currentIndexChanged(int index)
|
|||||||
|
|
||||||
void GeneralSetupPanel::updateVarioPitchRange()
|
void GeneralSetupPanel::updateVarioPitchRange()
|
||||||
{
|
{
|
||||||
ui->varioPMax_SB->setMaximum(700+(generalSettings.varioPitch*10)+1000+800);
|
ui->varioPMax_SB->setMaximum(700 + (generalSettings.varioPitch * 10) + 1000 + 800);
|
||||||
ui->varioPMax_SB->setMinimum(700+(generalSettings.varioPitch*10)+1000-800);
|
ui->varioPMax_SB->setMinimum(700 + (generalSettings.varioPitch * 10) + 1000 - 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::populateRotEncCB(int reCount)
|
void GeneralSetupPanel::populateRotEncCB(int reCount)
|
||||||
@@ -475,7 +510,7 @@ void GeneralSetupPanel::populateRotEncCB(int reCount)
|
|||||||
QComboBox * b = ui->re_CB;
|
QComboBox * b = ui->re_CB;
|
||||||
|
|
||||||
b->clear();
|
b->clear();
|
||||||
for (int i=0; i<=reCount; i++) {
|
for (int i = 0; i <= reCount; i++) {
|
||||||
b->addItem(strings[i]);
|
b->addItem(strings[i]);
|
||||||
}
|
}
|
||||||
b->setCurrentIndex(generalSettings.reNavigation);
|
b->setCurrentIndex(generalSettings.reNavigation);
|
||||||
@@ -495,29 +530,30 @@ int pwrDelayToYaml(int delay)
|
|||||||
|
|
||||||
void GeneralSetupPanel::setValues()
|
void GeneralSetupPanel::setValues()
|
||||||
{
|
{
|
||||||
|
Board::Type board = firmware->getBoard();
|
||||||
ui->beeperCB->setCurrentIndex(generalSettings.beeperMode+2);
|
ui->beeperCB->setCurrentIndex(generalSettings.beeperMode+2);
|
||||||
ui->channelorderCB->setCurrentIndex(generalSettings.templateSetup);
|
ui->channelorderCB->setCurrentIndex(ui->channelorderCB->findData(generalSettings.templateSetup));
|
||||||
ui->stickmodeCB->setCurrentIndex(generalSettings.stickMode);
|
ui->stickmodeCB->setCurrentIndex(ui->stickmodeCB->findData(generalSettings.stickMode));
|
||||||
if (firmware->getCapability(Haptic)) {
|
if (firmware->getCapability(Haptic)) {
|
||||||
ui->hapticLengthCB->setCurrentIndex(generalSettings.hapticLength+2);
|
ui->hapticLengthCB->setCurrentIndex(generalSettings.hapticLength + 2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->label_HL->hide();
|
ui->label_HL->hide();
|
||||||
ui->hapticLengthCB->hide();
|
ui->hapticLengthCB->hide();
|
||||||
}
|
}
|
||||||
ui->OFFBright_SB->setMinimum(firmware->getCapability(BacklightLevelMin));
|
ui->OFFBright_SB->setMinimum(firmware->getCapability(BacklightLevelMin));
|
||||||
if (generalSettings.backlightOffBright > 100-generalSettings.backlightBright)
|
if (generalSettings.backlightOffBright > 100 - generalSettings.backlightBright)
|
||||||
generalSettings.backlightOffBright = 100-generalSettings.backlightBright;
|
generalSettings.backlightOffBright = 100 - generalSettings.backlightBright;
|
||||||
ui->BLBright_SB->setValue(100-generalSettings.backlightBright);
|
ui->BLBright_SB->setValue(100 - generalSettings.backlightBright);
|
||||||
ui->OFFBright_SB->setValue(generalSettings.backlightOffBright);
|
ui->OFFBright_SB->setValue(generalSettings.backlightOffBright);
|
||||||
ui->BLBright_SB->setMinimum(ui->OFFBright_SB->value());
|
ui->BLBright_SB->setMinimum(ui->OFFBright_SB->value());
|
||||||
ui->OFFBright_SB->setMaximum(ui->BLBright_SB->value());
|
ui->OFFBright_SB->setMaximum(ui->BLBright_SB->value());
|
||||||
ui->soundModeCB->setCurrentIndex(generalSettings.speakerMode);
|
ui->soundModeCB->setCurrentIndex(generalSettings.speakerMode);
|
||||||
ui->volume_SB->setValue(generalSettings.speakerVolume + 12);
|
ui->volume_SL->setValue(generalSettings.speakerVolume + 12);
|
||||||
ui->beeperlenCB->setCurrentIndex(generalSettings.beeperLength+2);
|
ui->beeperlenCB->setCurrentIndex(generalSettings.beeperLength + 2);
|
||||||
ui->speakerPitchSB->setValue(generalSettings.speakerPitch);
|
ui->speakerPitchSB->setValue(generalSettings.speakerPitch);
|
||||||
ui->hapticStrength->setValue(generalSettings.hapticStrength);
|
ui->hapticStrength->setValue(generalSettings.hapticStrength);
|
||||||
ui->hapticmodeCB->setCurrentIndex(generalSettings.hapticMode+2);
|
ui->hapticmodeCB->setCurrentIndex(generalSettings.hapticMode + 2);
|
||||||
|
|
||||||
if (firmware->getCapability(HasBatMeterRange)) {
|
if (firmware->getCapability(HasBatMeterRange)) {
|
||||||
ui->vBatMinDSB->setValue((double)(generalSettings.vBatMin + 90) / 10);
|
ui->vBatMinDSB->setValue((double)(generalSettings.vBatMin + 90) / 10);
|
||||||
@@ -532,7 +568,7 @@ void GeneralSetupPanel::setValues()
|
|||||||
|
|
||||||
ui->startSoundCB->setChecked(!generalSettings.dontPlayHello);
|
ui->startSoundCB->setChecked(!generalSettings.dontPlayHello);
|
||||||
|
|
||||||
if (Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) {
|
if (Boards::getCapability(board, Board::HasColorLcd)) {
|
||||||
ui->modelQuickSelect_CB->setChecked(generalSettings.modelQuickSelect);
|
ui->modelQuickSelect_CB->setChecked(generalSettings.modelQuickSelect);
|
||||||
ui->modelSelectLayout_CB->setCurrentIndex(generalSettings.modelSelectLayout);
|
ui->modelSelectLayout_CB->setCurrentIndex(generalSettings.modelSelectLayout);
|
||||||
ui->labelSingleSelect_CB->setCurrentIndex(generalSettings.labelSingleSelect);
|
ui->labelSingleSelect_CB->setCurrentIndex(generalSettings.labelSingleSelect);
|
||||||
@@ -551,13 +587,6 @@ void GeneralSetupPanel::setValues()
|
|||||||
ui->label_favMultiMode->hide();
|
ui->label_favMultiMode->hide();
|
||||||
ui->favMultiMode_CB->hide();
|
ui->favMultiMode_CB->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firmware->getCapability(LcdWidth) == 128) {
|
|
||||||
ui->invertLCD_CB->setChecked(generalSettings.invertLCD);
|
|
||||||
} else {
|
|
||||||
ui->invertLCD_label->hide();
|
|
||||||
ui->invertLCD_CB->hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::showLabelSelectOptions()
|
void GeneralSetupPanel::showLabelSelectOptions()
|
||||||
@@ -582,21 +611,23 @@ void GeneralSetupPanel::showLabelSelectOptions()
|
|||||||
|
|
||||||
void GeneralSetupPanel::on_faimode_CB_stateChanged(int)
|
void GeneralSetupPanel::on_faimode_CB_stateChanged(int)
|
||||||
{
|
{
|
||||||
if (ui->faimode_CB->isChecked()) {
|
if (!lock) {
|
||||||
int ret = QMessageBox::question(this, CPN_STR_APP_NAME,
|
if (ui->faimode_CB->isChecked()) {
|
||||||
tr("If you enable FAI, only RSSI and RxBt sensors will keep working.\nThis function cannot be disabled by the radio.\nAre you sure ?") ,
|
int ret = QMessageBox::question(this, CPN_STR_APP_NAME,
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
tr("If you enable FAI, only RSSI and RxBt sensors will keep working.\nThis function cannot be disabled by the radio.\nAre you sure ?") ,
|
||||||
if (ret==QMessageBox::Yes) {
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
generalSettings.fai = true;
|
if (ret == QMessageBox::Yes) {
|
||||||
|
generalSettings.fai = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->faimode_CB->setChecked(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->faimode_CB->setChecked(false);
|
generalSettings.fai = false;
|
||||||
}
|
}
|
||||||
|
emit modified();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
generalSettings.fai = false;
|
|
||||||
}
|
|
||||||
emit modified();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::populateRotEncModeCB()
|
void GeneralSetupPanel::populateRotEncModeCB()
|
||||||
@@ -610,7 +641,7 @@ void GeneralSetupPanel::populateRotEncModeCB()
|
|||||||
}
|
}
|
||||||
|
|
||||||
b->clear();
|
b->clear();
|
||||||
for (uint8_t i=0; i < itemCount; i++) {
|
for (int i = 0; i < itemCount; i++) {
|
||||||
b->addItem(strings[i], 0);
|
b->addItem(strings[i], 0);
|
||||||
}
|
}
|
||||||
b->setCurrentIndex(generalSettings.rotEncMode);
|
b->setCurrentIndex(generalSettings.rotEncMode);
|
||||||
@@ -626,212 +657,276 @@ void GeneralSetupPanel::on_rotEncMode_CB_currentIndexChanged(int index)
|
|||||||
|
|
||||||
void GeneralSetupPanel::on_speakerPitchSB_editingFinished()
|
void GeneralSetupPanel::on_speakerPitchSB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.speakerPitch = ui->speakerPitchSB->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.speakerPitch = ui->speakerPitchSB->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_hapticStrength_valueChanged()
|
void GeneralSetupPanel::on_hapticStrength_valueChanged()
|
||||||
{
|
{
|
||||||
generalSettings.hapticStrength = ui->hapticStrength->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.hapticStrength = ui->hapticStrength->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_soundModeCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_soundModeCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.speakerMode = index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.speakerMode = index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_splashScreenDuration_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_splashScreenDuration_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.splashMode = 3-index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.splashMode = 3 - index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_pwrOnDelay_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_pwrOnDelay_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.pwrOnSpeed = pwrDelayToYaml(index);
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.pwrOnSpeed = pwrDelayToYaml(index);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_pwrOffDelay_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_pwrOffDelay_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.pwrOffSpeed = pwrDelayToYaml(index);
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.pwrOffSpeed = pwrDelayToYaml(index);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_pwrOnOffHaptic_CB_stateChanged(int)
|
void GeneralSetupPanel::on_pwrOnOffHaptic_CB_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.disablePwrOnOffHaptic = ui->pwrOnOffHaptic_CB->isChecked() ? 0 : 1;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.disablePwrOnOffHaptic = ui->pwrOnOffHaptic_CB->isChecked() ? 0 : 1;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_beepVolume_SL_valueChanged()
|
void GeneralSetupPanel::on_beepVolume_SL_valueChanged()
|
||||||
{
|
{
|
||||||
generalSettings.beepVolume=ui->beepVolume_SL->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.beepVolume = ui->beepVolume_SL->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_wavVolume_SL_valueChanged()
|
void GeneralSetupPanel::on_wavVolume_SL_valueChanged()
|
||||||
{
|
{
|
||||||
generalSettings.wavVolume=ui->wavVolume_SL->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.wavVolume = ui->wavVolume_SL->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_varioVolume_SL_valueChanged()
|
void GeneralSetupPanel::on_varioVolume_SL_valueChanged()
|
||||||
{
|
{
|
||||||
generalSettings.varioVolume=ui->varioVolume_SL->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.varioVolume = ui->varioVolume_SL->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_bgVolume_SL_valueChanged()
|
void GeneralSetupPanel::on_bgVolume_SL_valueChanged()
|
||||||
{
|
{
|
||||||
generalSettings.backgroundVolume=ui->bgVolume_SL->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.backgroundVolume = ui->bgVolume_SL->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_varioP0_SB_editingFinished()
|
void GeneralSetupPanel::on_varioP0_SB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.varioPitch = (ui->varioP0_SB->value()-700)/10;
|
if (!lock) {
|
||||||
updateVarioPitchRange();
|
generalSettings.varioPitch = (ui->varioP0_SB->value() - 700) / 10;
|
||||||
emit modified();
|
updateVarioPitchRange();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_varioPMax_SB_editingFinished()
|
void GeneralSetupPanel::on_varioPMax_SB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.varioRange = (ui->varioPMax_SB->value()-(700+(generalSettings.varioPitch*10))-1000)/10;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.varioRange = (ui->varioPMax_SB->value() - (700 + (generalSettings.varioPitch * 10)) - 1000) / 10;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_varioR0_SB_editingFinished()
|
void GeneralSetupPanel::on_varioR0_SB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.varioRepeat = (ui->varioR0_SB->value()-500)/10;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.varioRepeat = (ui->varioR0_SB->value() - 500) / 10;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_BLBright_SB_editingFinished()
|
void GeneralSetupPanel::on_BLBright_SB_editingFinished()
|
||||||
{
|
{
|
||||||
if (ui->BLBright_SB->value() < ui->OFFBright_SB->value()) {
|
if (!lock) {
|
||||||
ui->BLBright_SB->setValue(ui->OFFBright_SB->value());
|
if (ui->BLBright_SB->value() < ui->OFFBright_SB->value()) {
|
||||||
} else {
|
ui->BLBright_SB->setValue(ui->OFFBright_SB->value());
|
||||||
ui->OFFBright_SB->setMaximum(ui->BLBright_SB->value());
|
} else {
|
||||||
generalSettings.backlightBright = 100 - ui->BLBright_SB->value();
|
ui->OFFBright_SB->setMaximum(ui->BLBright_SB->value());
|
||||||
emit modified();
|
generalSettings.backlightBright = 100 - ui->BLBright_SB->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_OFFBright_SB_editingFinished()
|
void GeneralSetupPanel::on_OFFBright_SB_editingFinished()
|
||||||
{
|
{
|
||||||
if (ui->OFFBright_SB->value() > ui->BLBright_SB->value()) {
|
if (!lock) {
|
||||||
ui->OFFBright_SB->setValue(ui->BLBright_SB->value());
|
if (ui->OFFBright_SB->value() > ui->BLBright_SB->value()) {
|
||||||
} else {
|
ui->OFFBright_SB->setValue(ui->BLBright_SB->value());
|
||||||
ui->BLBright_SB->setMinimum(ui->OFFBright_SB->value());
|
} else {
|
||||||
generalSettings.backlightOffBright = ui->OFFBright_SB->value();
|
ui->BLBright_SB->setMinimum(ui->OFFBright_SB->value());
|
||||||
|
generalSettings.backlightOffBright = ui->OFFBright_SB->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSetupPanel::on_volume_SL_valueChanged()
|
||||||
|
{
|
||||||
|
if (!lock) {
|
||||||
|
generalSettings.speakerVolume = ui->volume_SL->value() - 12;
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_volume_SB_editingFinished()
|
|
||||||
{
|
|
||||||
generalSettings.speakerVolume = ui->volume_SB->value() - 12;
|
|
||||||
emit modified();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralSetupPanel::on_contrastSB_editingFinished()
|
void GeneralSetupPanel::on_contrastSB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.contrast = ui->contrastSB->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.contrast = ui->contrastSB->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_battwarningDSB_editingFinished()
|
void GeneralSetupPanel::on_battwarningDSB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.vBatWarn = (int)(ui->battwarningDSB->value()*10);
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.vBatWarn = (int)(ui->battwarningDSB->value() * 10);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_vBatMinDSB_editingFinished()
|
void GeneralSetupPanel::on_vBatMinDSB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.vBatMin = ui->vBatMinDSB->value() * 10 - 90;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.vBatMin = ui->vBatMinDSB->value() * 10 - 90;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_vBatMaxDSB_editingFinished()
|
void GeneralSetupPanel::on_vBatMaxDSB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.vBatMax = ui->vBatMaxDSB->value() * 10 - 120;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.vBatMax = ui->vBatMaxDSB->value() * 10 - 120;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_re_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_re_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.reNavigation = ui->re_CB->currentIndex();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.reNavigation = ui->re_CB->currentIndex();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_countrycode_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_countrycode_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.countryCode = ui->countrycode_CB->currentIndex();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.countryCode = ui->countrycode_CB->currentIndex();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_units_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_units_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.imperial = ui->units_CB->currentIndex();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.imperial = ui->units_CB->currentIndex();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_ppm_units_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_ppm_units_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.ppmunit = ui->ppm_units_CB->currentIndex();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.ppmunit = ui->ppm_units_CB->currentIndex();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_beeperlenCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_beeperlenCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.beeperLength = index-2;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.beeperLength = index - 2;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_hapticLengthCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_hapticLengthCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.hapticLength = index-2;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.hapticLength = index - 2;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_gpsFormatCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_gpsFormatCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.gpsFormat = index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.gpsFormat = index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_backlightautoSB_editingFinished()
|
void GeneralSetupPanel::on_backlightautoSB_editingFinished()
|
||||||
{
|
{
|
||||||
int i = ui->backlightautoSB->value()/5;
|
if (!lock) {
|
||||||
if((i*5)!=ui->backlightautoSB->value())
|
int i = ui->backlightautoSB->value() / 5;
|
||||||
ui->backlightautoSB->setValue(i*5);
|
if((i * 5) != ui->backlightautoSB->value())
|
||||||
else
|
ui->backlightautoSB->setValue(i * 5);
|
||||||
{
|
else
|
||||||
generalSettings.backlightDelay = i;
|
{
|
||||||
emit modified();
|
generalSettings.backlightDelay = i;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_switchesDelay_valueChanged(int)
|
void GeneralSetupPanel::on_switchesDelay_valueChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.switchesDelay = (ui->switchesDelay->value() / 10) - 15;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.switchesDelay = (ui->switchesDelay->value() / 10) - 15;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_adjustRTC_stateChanged(int)
|
void GeneralSetupPanel::on_adjustRTC_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.adjustRTC = ui->adjustRTC->isChecked();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.adjustRTC = ui->adjustRTC->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GeneralSetupPanel::on_inactimerSB_editingFinished()
|
void GeneralSetupPanel::on_inactimerSB_editingFinished()
|
||||||
{
|
{
|
||||||
generalSettings.inactivityTimer = ui->inactimerSB->value();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.inactivityTimer = ui->inactimerSB->value();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_pwrOffIfInactiveSB_editingFinished()
|
void GeneralSetupPanel::on_pwrOffIfInactiveSB_editingFinished()
|
||||||
@@ -842,132 +937,167 @@ void GeneralSetupPanel::on_pwrOffIfInactiveSB_editingFinished()
|
|||||||
|
|
||||||
void GeneralSetupPanel::on_memwarnChkB_stateChanged(int)
|
void GeneralSetupPanel::on_memwarnChkB_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.disableMemoryWarning = !ui->memwarnChkB->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int)
|
void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.disableAlarmWarning = ui->alarmwarnChkB->isChecked() ? 0 : 1;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.disableAlarmWarning = !ui->alarmwarnChkB->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_rssiPowerOffWarnChkB_stateChanged(int)
|
void GeneralSetupPanel::on_rssiPowerOffWarnChkB_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.disableRssiPoweroffAlarm = ui->rssiPowerOffWarnChkB->isChecked() ? 0 : 1;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.disableRssiPoweroffAlarm = !ui->rssiPowerOffWarnChkB->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_trainerPowerOffWarnChkB_stateChanged(int)
|
void GeneralSetupPanel::on_trainerPowerOffWarnChkB_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.disableTrainerPoweroffAlarm = ui->trainerPowerOffWarnChkB->isChecked() ? 0 : 1;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.disableTrainerPoweroffAlarm = !ui->trainerPowerOffWarnChkB->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_beeperCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_beeperCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.beeperMode = (GeneralSettings::BeeperMode)(index-2);
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.beeperMode = (GeneralSettings::BeeperMode)(index - 2);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_displayTypeCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_displayTypeCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.optrexDisplay = index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.optrexDisplay = index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_hapticmodeCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_hapticmodeCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.hapticMode = (GeneralSettings::BeeperMode)(index-2);
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.hapticMode = (GeneralSettings::BeeperMode)(index - 2);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GeneralSetupPanel::on_channelorderCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_channelorderCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.templateSetup = index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.templateSetup = ui->channelorderCB->currentData().toInt();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_stickmodeCB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_stickmodeCB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.stickMode = index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.stickMode = ui->stickmodeCB->currentData().toInt();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::unlockSwitchEdited()
|
void GeneralSetupPanel::unlockSwitchEdited()
|
||||||
{
|
{
|
||||||
int i=0;
|
if (!lock) {
|
||||||
i|=(((uint16_t)ui->chkSA->value()));
|
int i = 0;
|
||||||
i|=(((uint16_t)ui->chkSB->value())<<2);
|
i |= (((uint16_t)ui->chkSA->value()));
|
||||||
i|=(((uint16_t)ui->chkSC->value())<<4);
|
i |= (((uint16_t)ui->chkSB->value()) << 2);
|
||||||
i|=(((uint16_t)ui->chkSD->value())<<6);
|
i |= (((uint16_t)ui->chkSC->value()) << 4);
|
||||||
i|=(((uint16_t)ui->chkSE->value())<<8);
|
i |= (((uint16_t)ui->chkSD->value()) << 6);
|
||||||
i|=(((uint16_t)ui->chkSF->value())<<10);
|
i |= (((uint16_t)ui->chkSE->value()) << 8);
|
||||||
i|=(((uint16_t)ui->chkSG->value())<<12);
|
i |= (((uint16_t)ui->chkSF->value()) << 10);
|
||||||
i|=(((uint16_t)ui->chkSH->value())<<14);
|
i |= (((uint16_t)ui->chkSG->value()) << 12);
|
||||||
generalSettings.switchUnlockStates=i;
|
i |= (((uint16_t)ui->chkSH->value()) << 14);
|
||||||
emit modified();
|
generalSettings.switchUnlockStates=i;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_blAlarm_ChkB_stateChanged()
|
void GeneralSetupPanel::on_blAlarm_ChkB_stateChanged()
|
||||||
{
|
{
|
||||||
generalSettings.alarmsFlash = ui->blAlarm_ChkB->isChecked();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.alarmsFlash = ui->blAlarm_ChkB->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_registrationId_editingFinished()
|
void GeneralSetupPanel::on_registrationId_editingFinished()
|
||||||
{
|
{
|
||||||
strncpy(generalSettings.registrationId, ui->registrationId->text().toLatin1(), REGISTRATION_ID_LEN);
|
if (!lock) {
|
||||||
emit modified();
|
strncpy(generalSettings.registrationId, ui->registrationId->text().toLatin1(), REGISTRATION_ID_LEN);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::stickReverseEdited()
|
void GeneralSetupPanel::stickReverseEdited()
|
||||||
{
|
{
|
||||||
generalSettings.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3);
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.stickReverse = ((int)ui->stickReverse1->isChecked()) |
|
||||||
|
((int)ui->stickReverse2->isChecked() << 1) |
|
||||||
|
((int)ui->stickReverse3->isChecked() << 2) |
|
||||||
|
((int)ui->stickReverse4->isChecked() << 3);
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_modelQuickSelect_CB_stateChanged(int)
|
void GeneralSetupPanel::on_modelQuickSelect_CB_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.modelQuickSelect = ui->modelQuickSelect_CB->isChecked();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.modelQuickSelect = ui->modelQuickSelect_CB->isChecked();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_modelSelectLayout_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_modelSelectLayout_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.modelSelectLayout = index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.modelSelectLayout = index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_labelSingleSelect_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_labelSingleSelect_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.labelSingleSelect = index;
|
if (!lock) {
|
||||||
showLabelSelectOptions();
|
generalSettings.labelSingleSelect = index;
|
||||||
emit modified();
|
showLabelSelectOptions();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_labelMultiMode_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_labelMultiMode_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.labelMultiMode = index;
|
if (!lock) {
|
||||||
showLabelSelectOptions();
|
generalSettings.labelMultiMode = index;
|
||||||
emit modified();
|
showLabelSelectOptions();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_favMultiMode_CB_currentIndexChanged(int index)
|
void GeneralSetupPanel::on_favMultiMode_CB_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
generalSettings.favMultiMode = index;
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.favMultiMode = index;
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSetupPanel::on_startSoundCB_stateChanged(int)
|
void GeneralSetupPanel::on_startSoundCB_stateChanged(int)
|
||||||
{
|
{
|
||||||
generalSettings.dontPlayHello = !ui->startSoundCB->isChecked();
|
if (!lock) {
|
||||||
emit modified();
|
generalSettings.dontPlayHello = !ui->startSoundCB->isChecked();
|
||||||
}
|
emit modified();
|
||||||
|
}
|
||||||
void GeneralSetupPanel::on_invertLCD_CB_stateChanged(int)
|
|
||||||
{
|
|
||||||
generalSettings.invertLCD = ui->invertLCD_CB->isChecked();
|
|
||||||
emit modified();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include "generaledit.h"
|
#include "generaledit.h"
|
||||||
#include "eeprominterface.h"
|
#include "eeprominterface.h"
|
||||||
|
|
||||||
|
class FilteredItemModelFactory;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class GeneralSetup;
|
class GeneralSetup;
|
||||||
}
|
}
|
||||||
@@ -58,7 +60,7 @@ class GeneralSetupPanel : public GeneralPanel
|
|||||||
void on_hapticStrength_valueChanged();
|
void on_hapticStrength_valueChanged();
|
||||||
void on_soundModeCB_currentIndexChanged(int index);
|
void on_soundModeCB_currentIndexChanged(int index);
|
||||||
void on_beeperlenCB_currentIndexChanged(int index);
|
void on_beeperlenCB_currentIndexChanged(int index);
|
||||||
void on_volume_SB_editingFinished();
|
void on_volume_SL_valueChanged();
|
||||||
void on_hapticmodeCB_currentIndexChanged(int index);
|
void on_hapticmodeCB_currentIndexChanged(int index);
|
||||||
void on_hapticLengthCB_currentIndexChanged(int index);
|
void on_hapticLengthCB_currentIndexChanged(int index);
|
||||||
void on_backlightswCB_currentIndexChanged(int index);
|
void on_backlightswCB_currentIndexChanged(int index);
|
||||||
@@ -102,12 +104,12 @@ class GeneralSetupPanel : public GeneralPanel
|
|||||||
void on_labelSingleSelect_CB_currentIndexChanged(int);
|
void on_labelSingleSelect_CB_currentIndexChanged(int);
|
||||||
void on_labelMultiMode_CB_currentIndexChanged(int);
|
void on_labelMultiMode_CB_currentIndexChanged(int);
|
||||||
void on_favMultiMode_CB_currentIndexChanged(int);
|
void on_favMultiMode_CB_currentIndexChanged(int);
|
||||||
void on_invertLCD_CB_stateChanged(int);
|
|
||||||
|
|
||||||
void on_pwrOffIfInactiveSB_editingFinished();
|
void on_pwrOffIfInactiveSB_editingFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSetup *ui;
|
Ui::GeneralSetup *ui;
|
||||||
|
FilteredItemModelFactory *panelFilteredModels;
|
||||||
|
|
||||||
void showLabelSelectOptions();
|
void showLabelSelectOptions();
|
||||||
|
|
||||||
|
|||||||
+1554
-1766
File diff suppressed because it is too large
Load Diff
@@ -357,6 +357,16 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
|||||||
addParams();
|
addParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Boards::getCapability(board, Board::LcdWidth) == 128) {
|
||||||
|
addSection(tr("Screen"));
|
||||||
|
|
||||||
|
addLabel(tr("Invert"));
|
||||||
|
AutoCheckBox *screenInvert = new AutoCheckBox(this);
|
||||||
|
screenInvert->setField(generalSettings.invertLCD, this);
|
||||||
|
params->append(screenInvert);
|
||||||
|
addParams();
|
||||||
|
}
|
||||||
|
|
||||||
addVSpring(grid, 0, grid->rowCount());
|
addVSpring(grid, 0, grid->rowCount());
|
||||||
addHSpring(grid, grid->columnCount(), 0);
|
addHSpring(grid, grid->columnCount(), 0);
|
||||||
disableMouseScrolling();
|
disableMouseScrolling();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ TrainerPanel::TrainerPanel(QWidget * parent, GeneralSettings & generalSettings,
|
|||||||
addLabel(tr("Weight"), row, 2);
|
addLabel(tr("Weight"), row, 2);
|
||||||
addLabel(tr("Source"), row++, 3);
|
addLabel(tr("Source"), row++, 3);
|
||||||
|
|
||||||
for (int i = 0; i < CPN_MAX_STICKS; i++, row++) {
|
for (int i = 0; i < stickcnt; i++, row++) {
|
||||||
col = 0;
|
col = 0;
|
||||||
addLabel(Boards::getInputName(i), row, col++);
|
addLabel(Boards::getInputName(i), row, col++);
|
||||||
|
|
||||||
|
|||||||
@@ -225,17 +225,6 @@ void GVarGroup::setWeight(int val)
|
|||||||
* Helpers namespace functions
|
* Helpers namespace functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: Move lookup to GVarData class (w/out combobox)
|
|
||||||
void Helpers::populateGvarUseCB(QComboBox * b, unsigned int phase)
|
|
||||||
{
|
|
||||||
b->addItem(QCoreApplication::translate("GVarData", "Own value"));
|
|
||||||
for (int i=0; i<getCurrentFirmware()->getCapability(FlightModes); i++) {
|
|
||||||
if (i != (int)phase) {
|
|
||||||
b->addItem(QCoreApplication::translate("GVarData", "Flight mode %1 value").arg(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
|
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
|
||||||
{
|
{
|
||||||
return s1.toLower() < s2.toLower();
|
return s1.toLower() < s2.toLower();
|
||||||
@@ -413,9 +402,10 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
|
|||||||
|
|
||||||
QPixmap makePixMap(const QImage & image)
|
QPixmap makePixMap(const QImage & image)
|
||||||
{
|
{
|
||||||
Firmware * firmware = getCurrentFirmware();
|
Board::Type board = getCurrentBoard();
|
||||||
QImage result = image.scaled(firmware->getCapability(LcdWidth), firmware->getCapability(LcdHeight));
|
QImage result = image.scaled(Boards::getCapability(board, Board::LcdWidth), Boards::getCapability(board, Board::LcdHeight));
|
||||||
if (firmware->getCapability(LcdDepth) == 4) {
|
|
||||||
|
if (Boards::getCapability(board, Board::LcdDepth) == 4) {
|
||||||
result = result.convertToFormat(QImage::Format_RGB32);
|
result = result.convertToFormat(QImage::Format_RGB32);
|
||||||
for (int i = 0; i < result.width(); ++i) {
|
for (int i = 0; i < result.width(); ++i) {
|
||||||
for (int j = 0; j < result.height(); ++j) {
|
for (int j = 0; j < result.height(); ++j) {
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ extern const QColor colors[CPN_MAX_CURVES];
|
|||||||
|
|
||||||
//convert from mode 1 to mode generalSettings.stickMode
|
//convert from mode 1 to mode generalSettings.stickMode
|
||||||
//NOTICE! => 1..4 -> 1..4
|
//NOTICE! => 1..4 -> 1..4
|
||||||
#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[generalSettings.stickMode][((x)-1)] : (x))
|
#define CONVERT_AIRMODE(x) (((x)<=4) ? modn12x3[generalSettings.stickMode][((x)-1)] : (x))
|
||||||
|
#define CONVERT_SURFACEMODE(x) (((x)<=4) ? modn12x3[4 + generalSettings.stickMode][((x)-1)] : (x))
|
||||||
|
|
||||||
#define CURVE_BASE 7
|
#define CURVE_BASE 7
|
||||||
#define CH(x) (SRC_CH1+(x)-1-(SRC_SWC-SRC_3POS))
|
#define CH(x) (SRC_CH1+(x)-1-(SRC_SWC-SRC_3POS))
|
||||||
@@ -106,8 +107,6 @@ class GVarGroup: public QObject {
|
|||||||
|
|
||||||
namespace Helpers
|
namespace Helpers
|
||||||
{
|
{
|
||||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
|
||||||
|
|
||||||
void populateFileComboBox(QComboBox * b, const QSet<QString> & set, const QString & current);
|
void populateFileComboBox(QComboBox * b, const QSet<QString> & set, const QString & current);
|
||||||
void getFileComboBoxValue(QComboBox * b, char * dest, int length);
|
void getFileComboBoxValue(QComboBox * b, char * dest, int length);
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||||
ModelPanel(parent, model, generalSettings, firmware)
|
ModelPanel(parent, model, generalSettings, firmware)
|
||||||
{
|
{
|
||||||
|
Board::Type board = firmware->getBoard();
|
||||||
|
|
||||||
QString sdPath = QString(g.profile[g.id()].sdPath()).trimmed();
|
QString sdPath = QString(g.profile[g.id()].sdPath()).trimmed();
|
||||||
|
|
||||||
grid = new QGridLayout(this);
|
grid = new QGridLayout(this);
|
||||||
@@ -126,8 +128,10 @@ UserInterfacePanel::UserInterfacePanel(QWidget * parent, ModelData & model, Gene
|
|||||||
QImage image(path);
|
QImage image(path);
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
img->setText("");
|
img->setText("");
|
||||||
img->setFixedSize(QSize(firmware->getCapability(LcdWidth) / 2, firmware->getCapability(LcdHeight) / 2));
|
img->setFixedSize(QSize(Boards::getCapability(board, Board::LcdWidth) / 2,
|
||||||
img->setPixmap(QPixmap::fromImage(image.scaled(firmware->getCapability(LcdWidth) / 2, firmware->getCapability(LcdHeight) / 2)));
|
Boards::getCapability(board, Board::LcdHeight) / 2));
|
||||||
|
img->setPixmap(QPixmap::fromImage(image.scaled(Boards::getCapability(board, Board::LcdWidth) / 2,
|
||||||
|
Boards::getCapability(board, Board::LcdHeight) / 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
grid->addWidget(img, row++, col++);
|
grid->addWidget(img, row++, col++);
|
||||||
@@ -223,6 +227,7 @@ UserInterfacePanel::~UserInterfacePanel()
|
|||||||
CustomScreenPanel::CustomScreenPanel(QWidget * parent, ModelData & model, int index, GeneralSettings & generalSettings, Firmware * firmware):
|
CustomScreenPanel::CustomScreenPanel(QWidget * parent, ModelData & model, int index, GeneralSettings & generalSettings, Firmware * firmware):
|
||||||
ModelPanel(parent, model, generalSettings, firmware)
|
ModelPanel(parent, model, generalSettings, firmware)
|
||||||
{
|
{
|
||||||
|
Board::Type board = firmware->getBoard();
|
||||||
RadioLayout::CustomScreens & scrns = model.customScreens;
|
RadioLayout::CustomScreens & scrns = model.customScreens;
|
||||||
|
|
||||||
grid = new QGridLayout(this);
|
grid = new QGridLayout(this);
|
||||||
@@ -245,11 +250,14 @@ CustomScreenPanel::CustomScreenPanel(QWidget * parent, ModelData & model, int in
|
|||||||
|
|
||||||
QString path(QString(":/layouts/mask_%1.png").arg(QString(scrns.customScreenData[index].layoutId).toLower()));
|
QString path(QString(":/layouts/mask_%1.png").arg(QString(scrns.customScreenData[index].layoutId).toLower()));
|
||||||
QFile f(path);
|
QFile f(path);
|
||||||
|
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
QImage image(path);
|
QImage image(path);
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
img->setFixedSize(QSize(firmware->getCapability(LcdWidth) / 5, firmware->getCapability(LcdHeight) / 5));
|
img->setFixedSize(QSize(Boards::getCapability(board, Board::LcdWidth) / 5,
|
||||||
img->setPixmap(QPixmap::fromImage(image.scaled(firmware->getCapability(LcdWidth) / 5, firmware->getCapability(LcdHeight) / 5)));
|
Boards::getCapability(board, Board::LcdHeight) / 5));
|
||||||
|
img->setPixmap(QPixmap::fromImage(image.scaled(Boards::getCapability(board, Board::LcdWidth) / 5,
|
||||||
|
Boards::getCapability(board, Board::LcdHeight) / 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +333,7 @@ CustomScreenPanel::CustomScreenPanel(QWidget * parent, ModelData & model, int in
|
|||||||
str = tr("Top bar");
|
str = tr("Top bar");
|
||||||
break;
|
break;
|
||||||
case LAYOUT_OPTION_FM:
|
case LAYOUT_OPTION_FM:
|
||||||
str = tr("Flight mode");
|
str = tr("%1 mode").arg(Boards::getRadioTypeString(firmware->getBoard()));
|
||||||
break;
|
break;
|
||||||
case LAYOUT_OPTION_SLIDERS:
|
case LAYOUT_OPTION_SLIDERS:
|
||||||
str = tr("Sliders");
|
str = tr("Sliders");
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
<item row="8" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="label_phases">
|
<widget class="QLabel" name="label_phases">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Flight modes</string>
|
<string>Modes</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -27,11 +27,12 @@
|
|||||||
#include "namevalidator.h"
|
#include "namevalidator.h"
|
||||||
|
|
||||||
FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, Firmware * firmware,
|
FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, Firmware * firmware,
|
||||||
FilteredItemModel * rawSwitchFilteredModel):
|
FilteredItemModel * rawSwitchFilteredModel, QString radioType):
|
||||||
ModelPanel(parent, model, generalSettings, firmware),
|
ModelPanel(parent, model, generalSettings, firmware),
|
||||||
ui(new Ui::FlightMode),
|
ui(new Ui::FlightMode),
|
||||||
phaseIdx(phaseIdx),
|
phaseIdx(phaseIdx),
|
||||||
phase(model.flightModeData[phaseIdx])
|
phase(model.flightModeData[phaseIdx]),
|
||||||
|
radioType(radioType)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connectItemModelEvents(rawSwitchFilteredModel);
|
connectItemModelEvents(rawSwitchFilteredModel);
|
||||||
@@ -40,7 +41,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
ui->labelName->setToolTip(tr("Popup menu available"));
|
ui->labelName->setToolTip(tr("Popup menu available"));
|
||||||
connect(ui->labelName, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onCustomContextMenuRequested(const QPoint &)));
|
connect(ui->labelName, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onCustomContextMenuRequested(const QPoint &)));
|
||||||
|
|
||||||
board = getCurrentBoard();
|
board = firmware->getBoard();
|
||||||
fmCount = firmware->getCapability(FlightModes);
|
fmCount = firmware->getCapability(FlightModes);
|
||||||
gvCount = firmware->getCapability(Gvars);
|
gvCount = firmware->getCapability(Gvars);
|
||||||
reCount = firmware->getCapability(RotaryEncoders);
|
reCount = firmware->getCapability(RotaryEncoders);
|
||||||
@@ -85,13 +86,14 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
|
|
||||||
// The trims
|
// The trims
|
||||||
QString labels[CPN_MAX_TRIMS];
|
QString labels[CPN_MAX_TRIMS];
|
||||||
for(int i = 0; i < CPN_MAX_STICKS; i++) {
|
|
||||||
|
for (int i = 0; i < Boards::getCapability(board, Board::Sticks); i++) {
|
||||||
labels[i] = Boards::getInputName(i);
|
labels[i] = Boards::getInputName(i);
|
||||||
}
|
}
|
||||||
labels[4] = "T5"; // TODO firmware function
|
|
||||||
labels[5] = "T6"; // TODO firmware function
|
for (int i = Boards::getCapability(board, Board::Sticks); i < CPN_MAX_TRIMS; i++) {
|
||||||
labels[6] = "T7"; // TODO firmware function
|
labels[i] = QString("T%1").arg(i + 1);
|
||||||
labels[7] = "T8"; // TODO firmware function
|
}
|
||||||
|
|
||||||
trimsLabel << ui->trim1Label << ui->trim2Label << ui->trim3Label << ui->trim4Label << ui->trim5Label << ui->trim6Label << ui->trim7Label << ui->trim8Label;
|
trimsLabel << ui->trim1Label << ui->trim2Label << ui->trim3Label << ui->trim4Label << ui->trim5Label << ui->trim6Label << ui->trim7Label << ui->trim8Label;
|
||||||
trimsUse << ui->trim1Use << ui->trim2Use << ui->trim3Use << ui->trim4Use << ui->trim5Use << ui->trim6Use << ui->trim7Use << ui->trim8Use;
|
trimsUse << ui->trim1Use << ui->trim2Use << ui->trim3Use << ui->trim4Use << ui->trim5Use << ui->trim6Use << ui->trim7Use << ui->trim8Use;
|
||||||
@@ -106,7 +108,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < trimCount; i++) {
|
for (int i = 0; i < trimCount; i++) {
|
||||||
trimsLabel[i]->setText(labels[CONVERT_MODE(i + 1) - 1]);
|
trimsLabel[i]->setText(labels[Boards::isAir(board) ? CONVERT_AIRMODE(i + 1) - 1 : CONVERT_SURFACEMODE(i + 1) - 1]);
|
||||||
QComboBox * cb = trimsUse[i];
|
QComboBox * cb = trimsUse[i];
|
||||||
cb->setProperty("index", i);
|
cb->setProperty("index", i);
|
||||||
if (IS_HORUS_OR_TARANIS(board)) {
|
if (IS_HORUS_OR_TARANIS(board)) {
|
||||||
@@ -118,9 +120,9 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
cb->addItem(tr("Own Trim"), m * 2);
|
cb->addItem(tr("Own Trim"), m * 2);
|
||||||
}
|
}
|
||||||
else if (phaseIdx > 0) {
|
else if (phaseIdx > 0) {
|
||||||
cb->addItem(tr("Use Trim from Flight mode %1").arg(m), m * 2);
|
cb->addItem(tr("Use Trim from %1 Mode %2").arg(radioType).arg(m), m * 2);
|
||||||
if (IS_HORUS_OR_TARANIS(board)) {
|
if (IS_HORUS_OR_TARANIS(board)) {
|
||||||
cb->addItem(tr("Use Trim from Flight mode %1 + Own Trim as an offset").arg(m), m * 2 + 1);
|
cb->addItem(tr("Use Trim from %1 Mode %2 + Own Trim as an offset").arg(radioType).arg(m), m * 2 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,8 +139,9 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
|
|
||||||
trimsSlider[i]->setProperty("index", i);
|
trimsSlider[i]->setProperty("index", i);
|
||||||
trimsSlider[i]->setRange(-trimsMax, +trimsMax);
|
trimsSlider[i]->setRange(-trimsMax, +trimsMax);
|
||||||
int chn = CONVERT_MODE(i + 1) - 1;
|
int chn = Boards::isAir(board) ? CONVERT_AIRMODE(i + 1) - 1 : CONVERT_SURFACEMODE(i + 1) - 1;
|
||||||
if (chn == 2/*TODO constant*/ && model.throttleReversed)
|
if (model.throttleReversed && ((Boards::isAir(board) && chn == 2/*TODO constant*/) ||
|
||||||
|
(Boards::isSurface(board) && chn == 1/*TODO constant*/)))
|
||||||
trimsSlider[i]->setInvertedAppearance(true);
|
trimsSlider[i]->setInvertedAppearance(true);
|
||||||
connect(trimsSlider[i], SIGNAL(valueChanged(int)), this, SLOT(phaseTrimSlider_valueChanged()));
|
connect(trimsSlider[i], SIGNAL(valueChanged(int)), this, SLOT(phaseTrimSlider_valueChanged()));
|
||||||
}
|
}
|
||||||
@@ -155,7 +158,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
// RE link to another RE
|
// RE link to another RE
|
||||||
reUse[i] = new QComboBox(ui->reGB);
|
reUse[i] = new QComboBox(ui->reGB);
|
||||||
reUse[i]->setProperty("index", i);
|
reUse[i]->setProperty("index", i);
|
||||||
Helpers::populateGvarUseCB(reUse[i], phaseIdx);
|
populateGvarUseCB(reUse[i], phaseIdx);
|
||||||
connect(reUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseREUse_currentIndexChanged(int)));
|
connect(reUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseREUse_currentIndexChanged(int)));
|
||||||
reLayout->addWidget(reUse[i], i, 1, 1, 1);
|
reLayout->addWidget(reUse[i], i, 1, 1, 1);
|
||||||
}
|
}
|
||||||
@@ -221,7 +224,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
int col = 0;
|
int col = 0;
|
||||||
// GVar label
|
// GVar label
|
||||||
QLabel *label = new QLabel(ui->gvGB);
|
QLabel *label = new QLabel(ui->gvGB);
|
||||||
label->setText(tr("GVAR%1").arg(i + 1));
|
label->setText(tr("GV%1").arg(i + 1));
|
||||||
label->setProperty("index", i);
|
label->setProperty("index", i);
|
||||||
label->setContextMenuPolicy(Qt::CustomContextMenu);
|
label->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
label->setToolTip(tr("Popup menu available"));
|
label->setToolTip(tr("Popup menu available"));
|
||||||
@@ -241,7 +244,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
// GVar link to another GVar
|
// GVar link to another GVar
|
||||||
gvUse[i] = new QComboBox(ui->gvGB);
|
gvUse[i] = new QComboBox(ui->gvGB);
|
||||||
gvUse[i]->setProperty("index", i);
|
gvUse[i]->setProperty("index", i);
|
||||||
Helpers::populateGvarUseCB(gvUse[i], phaseIdx);
|
populateGvarUseCB(gvUse[i], phaseIdx);
|
||||||
connect(gvUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVUse_currentIndexChanged(int)));
|
connect(gvUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVUse_currentIndexChanged(int)));
|
||||||
gvLayout->addWidget(gvUse[i], i + 1, col++, 1, 1);
|
gvLayout->addWidget(gvUse[i], i + 1, col++, 1, 1);
|
||||||
}
|
}
|
||||||
@@ -348,6 +351,16 @@ void FlightModePanel::updateGVar(int index)
|
|||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlightModePanel::populateGvarUseCB(QComboBox * b, unsigned int phase)
|
||||||
|
{
|
||||||
|
b->addItem(tr("Own value"));
|
||||||
|
for (int i = 0; i < getCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||||
|
if (i != (int)phase) {
|
||||||
|
b->addItem(tr("%1 Mode %2 value").arg(radioType).arg(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FlightModePanel::setGVSB(QDoubleSpinBox * sb, int min, int max, int val)
|
void FlightModePanel::setGVSB(QDoubleSpinBox * sb, int min, int max, int val)
|
||||||
{
|
{
|
||||||
int idx = sb->property("index").toInt();
|
int idx = sb->property("index").toInt();
|
||||||
@@ -430,7 +443,7 @@ void FlightModePanel::phaseFadeOut_editingFinished()
|
|||||||
void FlightModePanel::trimUpdate(unsigned int trim)
|
void FlightModePanel::trimUpdate(unsigned int trim)
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
int chn = CONVERT_MODE(trim + 1) - 1;
|
int chn = Boards::isAir(board) ? CONVERT_AIRMODE(trim + 1) - 1 : CONVERT_SURFACEMODE(trim + 1) - 1;
|
||||||
int value = model->getTrimValue(phaseIdx, chn);
|
int value = model->getTrimValue(phaseIdx, chn);
|
||||||
trimsSlider[trim]->setValue(value);
|
trimsSlider[trim]->setValue(value);
|
||||||
trimsValue[trim]->setValue(value);
|
trimsValue[trim]->setValue(value);
|
||||||
@@ -496,7 +509,7 @@ void FlightModePanel::phaseGVUse_currentIndexChanged(int index)
|
|||||||
phase.gvars[gvar] = GVAR_MAX_VALUE + index;
|
phase.gvars[gvar] = GVAR_MAX_VALUE + index;
|
||||||
}
|
}
|
||||||
if (model->isGVarLinkedCircular(phaseIdx, gvar))
|
if (model->isGVarLinkedCircular(phaseIdx, gvar))
|
||||||
QMessageBox::warning(this, "Companion", tr("Warning: Global variable links back to itself. Flight Mode 0 value used."));
|
QMessageBox::warning(this, "Companion", tr("Warning: Global variable links back to itself. %1 Mode 0 value used.").arg(radioType));
|
||||||
updateGVar(gvar);
|
updateGVar(gvar);
|
||||||
emit modified();
|
emit modified();
|
||||||
lock = false;
|
lock = false;
|
||||||
@@ -605,7 +618,7 @@ void FlightModePanel::phaseREUse_currentIndexChanged(int index)
|
|||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
if (model->isREncLinkedCircular(phaseIdx, re))
|
if (model->isREncLinkedCircular(phaseIdx, re))
|
||||||
QMessageBox::warning(this, "Companion", tr("Warning: Rotary encoder links back to itself. Flight Mode 0 value used."));
|
QMessageBox::warning(this, "Companion", tr("Warning: Rotary encoder links back to itself. %1 Mode 0 value used.").arg(radioType));
|
||||||
emit modified();
|
emit modified();
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
@@ -616,7 +629,7 @@ void FlightModePanel::phaseTrimUse_currentIndexChanged(int index)
|
|||||||
if (!lock) {
|
if (!lock) {
|
||||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||||
int trim = comboBox->property("index").toInt();
|
int trim = comboBox->property("index").toInt();
|
||||||
int chn = CONVERT_MODE(trim + 1) - 1;
|
int chn = Boards::isAir(board) ? CONVERT_AIRMODE(trim + 1) - 1 : CONVERT_SURFACEMODE(trim + 1) - 1;
|
||||||
int data = comboBox->itemData(index).toInt();
|
int data = comboBox->itemData(index).toInt();
|
||||||
if (data < 0) {
|
if (data < 0) {
|
||||||
phase.trimMode[chn] = -1;
|
phase.trimMode[chn] = -1;
|
||||||
@@ -648,7 +661,7 @@ void FlightModePanel::phaseTrim_valueChanged()
|
|||||||
if (!lock) {
|
if (!lock) {
|
||||||
QSpinBox *spinBox = qobject_cast<QSpinBox*>(sender());
|
QSpinBox *spinBox = qobject_cast<QSpinBox*>(sender());
|
||||||
int trim = spinBox->property("index").toInt();
|
int trim = spinBox->property("index").toInt();
|
||||||
int chn = CONVERT_MODE(trim + 1) - 1;
|
int chn = Boards::isAir(board) ? CONVERT_AIRMODE(trim + 1) - 1 : CONVERT_SURFACEMODE(trim + 1) - 1;
|
||||||
int value = spinBox->value();
|
int value = spinBox->value();
|
||||||
model->setTrimValue(phaseIdx, chn, value);
|
model->setTrimValue(phaseIdx, chn, value);
|
||||||
lock = true;
|
lock = true;
|
||||||
@@ -663,7 +676,7 @@ void FlightModePanel::phaseTrimSlider_valueChanged()
|
|||||||
if (!lock) {
|
if (!lock) {
|
||||||
QSlider *slider = qobject_cast<QSlider*>(sender());
|
QSlider *slider = qobject_cast<QSlider*>(sender());
|
||||||
int trim = slider->property("index").toInt();
|
int trim = slider->property("index").toInt();
|
||||||
int chn = CONVERT_MODE(trim + 1) - 1;
|
int chn = Boards::isAir(board) ? CONVERT_AIRMODE(trim + 1) - 1 : CONVERT_SURFACEMODE(trim + 1) - 1;
|
||||||
int value = slider->value();
|
int value = slider->value();
|
||||||
model->setTrimValue(phaseIdx, chn, value);
|
model->setTrimValue(phaseIdx, chn, value);
|
||||||
lock = true;
|
lock = true;
|
||||||
@@ -724,7 +737,7 @@ bool FlightModePanel::moveUpAllowed() const
|
|||||||
void FlightModePanel::cmClear(bool prompt)
|
void FlightModePanel::cmClear(bool prompt)
|
||||||
{
|
{
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear Flight Mode. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear %1 Mode. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +774,7 @@ void FlightModePanel::cmClear(bool prompt)
|
|||||||
|
|
||||||
void FlightModePanel::cmClearAll()
|
void FlightModePanel::cmClearAll()
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Flight Modes. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all %1 Modes. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int j = 0; j < fmCount; j++) {
|
for (int j = 0; j < fmCount; j++) {
|
||||||
@@ -796,7 +809,7 @@ void FlightModePanel::cmCopy()
|
|||||||
|
|
||||||
void FlightModePanel::cmCut()
|
void FlightModePanel::cmCut()
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Cut Flight Mode. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Cut %1 Mode. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
cmCopy();
|
cmCopy();
|
||||||
cmClear(false);
|
cmClear(false);
|
||||||
@@ -804,7 +817,7 @@ void FlightModePanel::cmCut()
|
|||||||
|
|
||||||
void FlightModePanel::cmDelete()
|
void FlightModePanel::cmDelete()
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Delete Flight Mode. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Delete %1 Mode. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int maxidx = fmCount - 1;
|
const int maxidx = fmCount - 1;
|
||||||
@@ -1160,7 +1173,7 @@ void FlightModePanel::gvCmClear(bool prompt)
|
|||||||
{
|
{
|
||||||
if (phaseIdx == 0) {
|
if (phaseIdx == 0) {
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear Global Variable across all Flight Modes. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear Global Variable across all %1 Modes. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
model->gvarData[gvIdx].clear();
|
model->gvarData[gvIdx].clear();
|
||||||
@@ -1184,7 +1197,7 @@ void FlightModePanel::gvCmClear(bool prompt)
|
|||||||
void FlightModePanel::gvCmClearAll()
|
void FlightModePanel::gvCmClearAll()
|
||||||
{
|
{
|
||||||
if (phaseIdx == 0) {
|
if (phaseIdx == 0) {
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Global Variables for all Flight Modes. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Global Variables for all %1 Modes. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < gvCount; i++) {
|
for (int i = 0; i < gvCount; i++) {
|
||||||
model->gvarData[i].clear();
|
model->gvarData[i].clear();
|
||||||
@@ -1195,7 +1208,7 @@ void FlightModePanel::gvCmClearAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Global Variables for this Flight Mode. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Global Variables for this %1 Mode. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < gvCount; i++) {
|
for (int i = 0; i < gvCount; i++) {
|
||||||
phase.gvars[i] = phase.linkedGVarFlightModeZero(phaseIdx);
|
phase.gvars[i] = phase.linkedGVarFlightModeZero(phaseIdx);
|
||||||
@@ -1247,7 +1260,7 @@ void FlightModePanel::gvCmCopy()
|
|||||||
void FlightModePanel::gvCmCut()
|
void FlightModePanel::gvCmCut()
|
||||||
{
|
{
|
||||||
if (phaseIdx == 0) {
|
if (phaseIdx == 0) {
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Cut Global Variable across all Flight Modes. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Cut Global Variable across all %1 Modes. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1325,7 +1338,7 @@ void FlightModePanel::gvCmPaste()
|
|||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
if (phaseIdx == 0) {
|
if (phaseIdx == 0) {
|
||||||
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Paste to selected Global Variable across all Flight Modes. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Paste to selected Global Variable across all %1 Modes. Are you sure?").arg(radioType), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
if (gvHasDefnClipboardData(&data)) {
|
if (gvHasDefnClipboardData(&data)) {
|
||||||
memcpy(&model->gvarData[gvIdx], data.constData(), sizeof(GVarData));
|
memcpy(&model->gvarData[gvIdx], data.constData(), sizeof(GVarData));
|
||||||
@@ -1391,6 +1404,18 @@ void FlightModePanel::onItemModelUpdateComplete()
|
|||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlightModePanel::onThrottleReverseChanged()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < CPN_MAX_TRIMS; i++) {
|
||||||
|
int chn = Boards::isAir(board) ? CONVERT_AIRMODE(i + 1) - 1 : CONVERT_SURFACEMODE(i + 1) - 1;
|
||||||
|
if (model->throttleReversed && ((Boards::isAir(board) && chn == 2/*TODO constant*/) ||
|
||||||
|
(Boards::isSurface(board) && chn == 1/*TODO constant*/)))
|
||||||
|
trimsSlider[i]->setInvertedAppearance(true);
|
||||||
|
else
|
||||||
|
trimsSlider[i]->setInvertedAppearance(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
|
||||||
FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware,
|
FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware,
|
||||||
@@ -1402,11 +1427,13 @@ FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralS
|
|||||||
connectItemModelEvents(rawSwitchFilteredModel);
|
connectItemModelEvents(rawSwitchFilteredModel);
|
||||||
|
|
||||||
modesCount = firmware->getCapability(FlightModes);
|
modesCount = firmware->getCapability(FlightModes);
|
||||||
|
radioType = Boards::getRadioTypeString(firmware->getBoard());
|
||||||
|
|
||||||
QGridLayout * gridLayout = new QGridLayout(this);
|
QGridLayout * gridLayout = new QGridLayout(this);
|
||||||
tabWidget = new QTabWidget(this);
|
tabWidget = new QTabWidget(this);
|
||||||
|
|
||||||
for (int i = 0; i < modesCount; i++) {
|
for (int i = 0; i < modesCount; i++) {
|
||||||
FlightModePanel * tab = new FlightModePanel(tabWidget, model, i, generalSettings, firmware, rawSwitchFilteredModel);
|
FlightModePanel * tab = new FlightModePanel(tabWidget, model, i, generalSettings, firmware, rawSwitchFilteredModel, radioType);
|
||||||
tab->setProperty("index", i);
|
tab->setProperty("index", i);
|
||||||
connect(tab, &FlightModePanel::modified, this, &FlightModesPanel::modified);
|
connect(tab, &FlightModePanel::modified, this, &FlightModesPanel::modified);
|
||||||
connect(tab, &FlightModePanel::phaseDataChanged, this, &FlightModesPanel::onPhaseNameChanged);
|
connect(tab, &FlightModePanel::phaseDataChanged, this, &FlightModesPanel::onPhaseNameChanged);
|
||||||
@@ -1414,10 +1441,12 @@ FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralS
|
|||||||
connect(tab, &FlightModePanel::phaseSwitchChanged, this, &FlightModesPanel::updateItemModels);
|
connect(tab, &FlightModePanel::phaseSwitchChanged, this, &FlightModesPanel::updateItemModels);
|
||||||
connect(tab, &FlightModePanel::gvNameChanged, this, &FlightModesPanel::updateItemModels);
|
connect(tab, &FlightModePanel::gvNameChanged, this, &FlightModesPanel::updateItemModels);
|
||||||
|
|
||||||
connect(this, &FlightModesPanel::updated, tab, &FlightModePanel::update);
|
connect(this, &FlightModesPanel::updated, tab, &FlightModePanel::update);
|
||||||
|
connect(this, &FlightModesPanel::refreshThrottleTrim, tab, &FlightModePanel::onThrottleReverseChanged);
|
||||||
tabWidget->addTab(tab, getTabName(i));
|
tabWidget->addTab(tab, getTabName(i));
|
||||||
panels << tab;
|
panels << tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(tabWidget, &QTabWidget::currentChanged, this, &FlightModesPanel::onTabIndexChanged);
|
connect(tabWidget, &QTabWidget::currentChanged, this, &FlightModesPanel::onTabIndexChanged);
|
||||||
gridLayout->addWidget(tabWidget, 0, 0, 1, 1);
|
gridLayout->addWidget(tabWidget, 0, 0, 1, 1);
|
||||||
onTabIndexChanged(0);
|
onTabIndexChanged(0);
|
||||||
@@ -1430,7 +1459,7 @@ FlightModesPanel::~FlightModesPanel()
|
|||||||
|
|
||||||
QString FlightModesPanel::getTabName(int index)
|
QString FlightModesPanel::getTabName(int index)
|
||||||
{
|
{
|
||||||
QString result = tr("Flight Mode %1").arg(index);
|
QString result = tr("%1 Mode %2").arg(radioType).arg(index);
|
||||||
const char *name = model->flightModeData[index].name;
|
const char *name = model->flightModeData[index].name;
|
||||||
if (firmware->getCapability(FlightModesName) && strlen(name) > 0) {
|
if (firmware->getCapability(FlightModesName) && strlen(name) > 0) {
|
||||||
result += tr(" (%1)").arg(name);
|
result += tr(" (%1)").arg(name);
|
||||||
@@ -1479,3 +1508,8 @@ void FlightModesPanel::onTabIndexChanged(int index)
|
|||||||
if (index < panels.size())
|
if (index < panels.size())
|
||||||
panels.at(index)->update();
|
panels.at(index)->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlightModesPanel::onThrottleReverseChanged()
|
||||||
|
{
|
||||||
|
emit refreshThrottleTrim();
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _FLIGHTMODES_H_
|
#pragma once
|
||||||
#define _FLIGHTMODES_H_
|
|
||||||
|
|
||||||
#include "modeledit.h"
|
#include "modeledit.h"
|
||||||
#include "eeprominterface.h"
|
#include "eeprominterface.h"
|
||||||
@@ -43,7 +42,7 @@ class FlightModePanel : public ModelPanel
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FlightModePanel(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings, Firmware * firmware,
|
FlightModePanel(QWidget *parent, ModelData &model, int modeIdx, GeneralSettings & generalSettings, Firmware * firmware,
|
||||||
FilteredItemModel * rawSwitchFilteredModel);
|
FilteredItemModel * rawSwitchFilteredModel, QString radioType);
|
||||||
virtual ~FlightModePanel();
|
virtual ~FlightModePanel();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
@@ -54,6 +53,9 @@ class FlightModePanel : public ModelPanel
|
|||||||
void phaseNameChanged();
|
void phaseNameChanged();
|
||||||
void phaseSwitchChanged();
|
void phaseSwitchChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onThrottleReverseChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void phaseName_editingFinished();
|
void phaseName_editingFinished();
|
||||||
void phaseSwitch_currentIndexChanged(int index);
|
void phaseSwitch_currentIndexChanged(int index);
|
||||||
@@ -119,6 +121,7 @@ class FlightModePanel : public ModelPanel
|
|||||||
QVector<QSpinBox *> trimsValue;
|
QVector<QSpinBox *> trimsValue;
|
||||||
QVector<QSlider *> trimsSlider;
|
QVector<QSlider *> trimsSlider;
|
||||||
Board::Type board;
|
Board::Type board;
|
||||||
|
QString radioType;
|
||||||
|
|
||||||
void trimUpdate(unsigned int trim);
|
void trimUpdate(unsigned int trim);
|
||||||
void updateGVar(int index);
|
void updateGVar(int index);
|
||||||
@@ -141,6 +144,7 @@ class FlightModePanel : public ModelPanel
|
|||||||
bool gvMoveUpAllowed() const;
|
bool gvMoveUpAllowed() const;
|
||||||
void gvSwapData(int idx1, int idx2);
|
void gvSwapData(int idx1, int idx2);
|
||||||
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
||||||
|
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FlightModesPanel : public ModelPanel
|
class FlightModesPanel : public ModelPanel
|
||||||
@@ -153,9 +157,11 @@ class FlightModesPanel : public ModelPanel
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void update() override;
|
virtual void update() override;
|
||||||
|
void onThrottleReverseChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updated();
|
void updated();
|
||||||
|
void refreshThrottleTrim();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPhaseNameChanged();
|
void onPhaseNameChanged();
|
||||||
@@ -171,9 +177,8 @@ class FlightModesPanel : public ModelPanel
|
|||||||
CompoundItemModelFactory *sharedItemModels;
|
CompoundItemModelFactory *sharedItemModels;
|
||||||
FilteredItemModel *rawSwitchFilteredModel;
|
FilteredItemModel *rawSwitchFilteredModel;
|
||||||
QVector<GenericPanel *> panels;
|
QVector<GenericPanel *> panels;
|
||||||
|
QString radioType;
|
||||||
|
|
||||||
void updateItemModels();
|
void updateItemModels();
|
||||||
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _FLIGHTMODES_H_
|
|
||||||
|
|
||||||
|
|||||||
@@ -275,7 +275,7 @@
|
|||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="label_phases">
|
<widget class="QLabel" name="label_phases">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Flight modes</string>
|
<string>Modes</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
|
|||||||
|
|
||||||
s1.report("Init");
|
s1.report("Init");
|
||||||
|
|
||||||
SetupPanel * setupPanel = new SetupPanel(this, model, generalSettings, firmware, sharedItemModels);
|
SetupPanel *setupPanel = new SetupPanel(this, model, generalSettings, firmware, sharedItemModels);
|
||||||
addTab(setupPanel, tr("Setup"));
|
addTab(setupPanel, tr("Setup"));
|
||||||
s1.report("Setup");
|
s1.report("Setup");
|
||||||
|
|
||||||
@@ -81,8 +81,10 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
|
|||||||
s1.report("Heli");
|
s1.report("Heli");
|
||||||
}
|
}
|
||||||
|
|
||||||
addTab(new FlightModesPanel(this, model, generalSettings, firmware, sharedItemModels), tr("Flight Modes"));
|
QString radioType = QString("%1 Modes").arg(Boards::getRadioTypeString(firmware->getBoard()));
|
||||||
s1.report("Flight Modes");
|
FlightModesPanel *flightModesPanel = new FlightModesPanel(this, model, generalSettings, firmware, sharedItemModels);
|
||||||
|
addTab(flightModesPanel, radioType);
|
||||||
|
s1.report(radioType);
|
||||||
|
|
||||||
addTab(new InputsPanel(this, model, generalSettings, firmware, sharedItemModels), tr("Inputs"));
|
addTab(new InputsPanel(this, model, generalSettings, firmware, sharedItemModels), tr("Inputs"));
|
||||||
s1.report("Inputs");
|
s1.report("Inputs");
|
||||||
@@ -90,7 +92,7 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
|
|||||||
addTab(new MixesPanel(this, model, generalSettings, firmware, sharedItemModels), tr("Mixes"));
|
addTab(new MixesPanel(this, model, generalSettings, firmware, sharedItemModels), tr("Mixes"));
|
||||||
s1.report("Mixes");
|
s1.report("Mixes");
|
||||||
|
|
||||||
ChannelsPanel * channelsPanel = new ChannelsPanel(this, model, generalSettings, firmware, sharedItemModels);
|
ChannelsPanel *channelsPanel = new ChannelsPanel(this, model, generalSettings, firmware, sharedItemModels);
|
||||||
addTab(channelsPanel, tr("Outputs"));
|
addTab(channelsPanel, tr("Outputs"));
|
||||||
s1.report("Outputs");
|
s1.report("Outputs");
|
||||||
|
|
||||||
@@ -121,6 +123,7 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
|
|||||||
s1.report("Enabled Features");
|
s1.report("Enabled Features");
|
||||||
|
|
||||||
connect(setupPanel, &SetupPanel::extendedLimitsToggled, channelsPanel, &ChannelsPanel::refreshExtendedLimits);
|
connect(setupPanel, &SetupPanel::extendedLimitsToggled, channelsPanel, &ChannelsPanel::refreshExtendedLimits);
|
||||||
|
connect(setupPanel, &SetupPanel::throttleReverseChanged, flightModesPanel, &FlightModesPanel::onThrottleReverseChanged);
|
||||||
connect(ui->tabWidget, &QTabWidget::currentChanged, this, &ModelEdit::onTabIndexChanged);
|
connect(ui->tabWidget, &QTabWidget::currentChanged, this, &ModelEdit::onTabIndexChanged);
|
||||||
connect(ui->pushButton, &QPushButton::clicked, this, &ModelEdit::launchSimulation);
|
connect(ui->pushButton, &QPushButton::clicked, this, &ModelEdit::launchSimulation);
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ ModelOptionsPanel::ModelOptionsPanel(QWidget * parent, ModelData & model, Genera
|
|||||||
addParams();
|
addParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
addLabel(tr("Flight Modes"));
|
addLabel(tr("%1 Modes").arg(Boards::getRadioTypeString(firmware->getBoard())));
|
||||||
AutoComboBox *fmDisable = new AutoComboBox(this);
|
AutoComboBox *fmDisable = new AutoComboBox(this);
|
||||||
fmDisable->setModel(mdl);
|
fmDisable->setModel(mdl);
|
||||||
fmDisable->setField(model.modelFMDisabled, this);
|
fmDisable->setField(model.modelFMDisabled, this);
|
||||||
|
|||||||
@@ -1872,6 +1872,7 @@ void SetupPanel::on_customThrottleWarningPosition_valueChanged(int value)
|
|||||||
void SetupPanel::on_throttleReverse_toggled(bool checked)
|
void SetupPanel::on_throttleReverse_toggled(bool checked)
|
||||||
{
|
{
|
||||||
model->throttleReversed = checked;
|
model->throttleReversed = checked;
|
||||||
|
emit throttleReverseChanged();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1935,18 +1936,29 @@ void SetupPanel::on_image_currentIndexChanged(int index)
|
|||||||
void SetupPanel::populateThrottleTrimSwitchCB()
|
void SetupPanel::populateThrottleTrimSwitchCB()
|
||||||
{
|
{
|
||||||
Board::Type board = firmware->getBoard();
|
Board::Type board = firmware->getBoard();
|
||||||
|
bool isBoardSurface = Boards::isSurface(board);
|
||||||
lock = true;
|
lock = true;
|
||||||
ui->throttleTrimSwitch->clear();
|
ui->throttleTrimSwitch->clear();
|
||||||
int idx=0;
|
int idx = 0;
|
||||||
QString trim;
|
QString trim;
|
||||||
for (int i=0; i<getBoardCapability(board, Board::NumTrims); i++, idx++) {
|
for (int i = 0; i < getBoardCapability(board, Board::NumTrims); i++, idx++) {
|
||||||
// here order is TERA instead of RETA
|
if (isBoardSurface) {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
trim = RawSource(SOURCE_TYPE_TRIM, 2 + 1).toString(model, &generalSettings);
|
trim = RawSource(SOURCE_TYPE_TRIM, 1 + 1).toString(model, &generalSettings);
|
||||||
else if (i == 2)
|
else if (i == 1)
|
||||||
trim = RawSource(SOURCE_TYPE_TRIM, 0 + 1).toString(model, &generalSettings);
|
trim = RawSource(SOURCE_TYPE_TRIM, 0 + 1).toString(model, &generalSettings);
|
||||||
else
|
else
|
||||||
trim = RawSource(SOURCE_TYPE_TRIM, i + 1).toString(model, &generalSettings);
|
trim = RawSource(SOURCE_TYPE_TRIM, i + 1).toString(model, &generalSettings);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// here order is TERA instead of RETA
|
||||||
|
if (i == 0)
|
||||||
|
trim = RawSource(SOURCE_TYPE_TRIM, 2 + 1).toString(model, &generalSettings);
|
||||||
|
else if (i == 2)
|
||||||
|
trim = RawSource(SOURCE_TYPE_TRIM, 0 + 1).toString(model, &generalSettings);
|
||||||
|
else
|
||||||
|
trim = RawSource(SOURCE_TYPE_TRIM, i + 1).toString(model, &generalSettings);
|
||||||
|
}
|
||||||
ui->throttleTrimSwitch->addItem(trim, idx);
|
ui->throttleTrimSwitch->addItem(trim, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ class SetupPanel : public ModelPanel
|
|||||||
signals:
|
signals:
|
||||||
void extendedLimitsToggled();
|
void extendedLimitsToggled();
|
||||||
void updated();
|
void updated();
|
||||||
|
void throttleReverseChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_name_editingFinished();
|
void on_name_editingFinished();
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ GenericPanel::GenericPanel(QWidget * parent, ModelData * model, GeneralSettings
|
|||||||
model(model),
|
model(model),
|
||||||
generalSettings(generalSettings),
|
generalSettings(generalSettings),
|
||||||
firmware(firmware),
|
firmware(firmware),
|
||||||
|
//board(firmware->getBoard()), TODO: as part of capabilities refactor
|
||||||
lock(false)
|
lock(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ class GenericPanel : public QWidget
|
|||||||
ModelData * model;
|
ModelData * model;
|
||||||
GeneralSettings & generalSettings;
|
GeneralSettings & generalSettings;
|
||||||
Firmware * firmware;
|
Firmware * firmware;
|
||||||
|
//Board::Type board; TODO: as part of refactor to move physical capabilities from Firmware to Boards
|
||||||
bool lock;
|
bool lock;
|
||||||
|
|
||||||
void addLabel(QGridLayout * gridLayout, const QString &text, int col, bool mimimize=false);
|
void addLabel(QGridLayout * gridLayout, const QString &text, int col, bool mimimize=false);
|
||||||
void addEmptyLabel(QGridLayout * gridLayout, int col);
|
void addEmptyLabel(QGridLayout * gridLayout, int col);
|
||||||
void addHSpring(QGridLayout *, int col, int row);
|
void addHSpring(QGridLayout *, int col, int row);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ set(${PROJECT_NAME}_SRCS
|
|||||||
simulateduiwidgetJumperTPRO.cpp
|
simulateduiwidgetJumperTPRO.cpp
|
||||||
simulateduiwidgetJumperTPROS.cpp
|
simulateduiwidgetJumperTPROS.cpp
|
||||||
simulateduiwidgetLR3PRO.cpp
|
simulateduiwidgetLR3PRO.cpp
|
||||||
|
simulateduiwidgetMT12.cpp
|
||||||
simulateduiwidgetNV14.cpp
|
simulateduiwidgetNV14.cpp
|
||||||
simulateduiwidgetPL18.cpp
|
simulateduiwidgetPL18.cpp
|
||||||
simulateduiwidgetPocket.cpp
|
simulateduiwidgetPocket.cpp
|
||||||
@@ -70,6 +71,7 @@ set(${PROJECT_NAME}_SRCS
|
|||||||
set(${PROJECT_NAME}_HDRS
|
set(${PROJECT_NAME}_HDRS
|
||||||
${${PROJECT_NAME}_HDRS}
|
${${PROJECT_NAME}_HDRS}
|
||||||
radiouiaction.h
|
radiouiaction.h
|
||||||
|
simulateduiwidgetGeneric.h
|
||||||
widgets/buttonswidget.h
|
widgets/buttonswidget.h
|
||||||
widgets/radiofaderwidget.h
|
widgets/radiofaderwidget.h
|
||||||
widgets/radiokeywidget.h
|
widgets/radiokeywidget.h
|
||||||
@@ -84,6 +86,11 @@ qt5_wrap_cpp(${PROJECT_NAME}_SRCS
|
|||||||
${${PROJECT_NAME}_HDRS}
|
${${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}
|
add_library(${PROJECT_NAME}
|
||||||
${${PROJECT_NAME}_SRCS}
|
${${PROJECT_NAME}_SRCS}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DEBUGOUTPUT_H_
|
#pragma once
|
||||||
#define _DEBUGOUTPUT_H_
|
|
||||||
|
|
||||||
#include "simulator.h"
|
#include "simulator.h"
|
||||||
#include "simulatorinterface.h"
|
#include "simulatorinterface.h"
|
||||||
@@ -107,6 +106,3 @@ class DeleteComboBoxItemEventFilter : public QObject
|
|||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DEBUGOUTPUT_H_
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FILTEREDTEXTBUFFER_H
|
#pragma once
|
||||||
#define FILTEREDTEXTBUFFER_H
|
|
||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
@@ -117,6 +116,3 @@ class FilteredTextBuffer : public FIFOBufferDevice
|
|||||||
bool m_lineFilterEnable;
|
bool m_lineFilterEnable;
|
||||||
bool m_lineFilterExclusive;
|
bool m_lineFilterExclusive;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // FILTEREDTEXTBUFFER_H
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _JOYSTICK_H_
|
#pragma once
|
||||||
#define _JOYSTICK_H_
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
@@ -82,5 +81,3 @@ class Joystick : public QObject
|
|||||||
public slots:
|
public slots:
|
||||||
void processEvents();
|
void processEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _JOYSTICK_H_
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _JOYSTICKDIALOG_H_
|
#pragma once
|
||||||
#define _JOYSTICKDIALOG_H_
|
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include "appdata.h"
|
#include "appdata.h"
|
||||||
@@ -79,5 +78,3 @@ class joystickDialog : public QDialog
|
|||||||
void on_okButton_clicked();
|
void on_okButton_clicked();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _JOYSTICKDIALOG_H_
|
|
||||||
|
|||||||
@@ -222,9 +222,10 @@ void RadioOutputsWidget::setupGVarsDisplay()
|
|||||||
ui->globalVarsScroll->setWidget(gvarsWidget);
|
ui->globalVarsScroll->setWidget(gvarsWidget);
|
||||||
|
|
||||||
QPalette::ColorRole bgrole = QPalette::AlternateBase;
|
QPalette::ColorRole bgrole = QPalette::AlternateBase;
|
||||||
|
const bool isAir = Boards::isAir();
|
||||||
for (int fm=0; fm < fmodes; fm++) {
|
for (int fm=0; fm < fmodes; fm++) {
|
||||||
QLabel * label = new QLabel(gvarsWidget);
|
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->setAlignment(Qt::AlignCenter);
|
||||||
label->setBackgroundRole(bgrole);
|
label->setBackgroundRole(bgrole);
|
||||||
gvarsLayout->addWidget(label, 0, fm+1);
|
gvarsLayout->addWidget(label, 0, fm+1);
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RADIOOUTPUTSWIDGET_H
|
#pragma once
|
||||||
#define RADIOOUTPUTSWIDGET_H
|
|
||||||
|
|
||||||
#include "simulator.h"
|
#include "simulator.h"
|
||||||
#include "simulatorinterface.h"
|
#include "simulatorinterface.h"
|
||||||
@@ -86,5 +85,3 @@ class RadioOutputsWidget : public QWidget
|
|||||||
private:
|
private:
|
||||||
Ui::RadioOutputsWidget * ui;
|
Ui::RadioOutputsWidget * ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RADIOOUTPUTSWIDGET_H
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RADIOUIACTION_H
|
#pragma once
|
||||||
#define RADIOUIACTION_H
|
|
||||||
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QWidget>
|
#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 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.
|
* @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_hwIndex(index),
|
||||||
m_active(false),
|
m_active(false),
|
||||||
m_keys(QList<int>()),
|
m_keys(QList<int>()),
|
||||||
@@ -57,7 +56,7 @@ class RadioUiAction : public QObject
|
|||||||
* @param keys QList of Qt:Key codes to use as shortcuts.
|
* @param keys QList of Qt:Key codes to use as shortcuts.
|
||||||
* [See above for other params.]
|
* [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)
|
RadioUiAction(index, 0, text, descript, parent)
|
||||||
{
|
{
|
||||||
addKeys(keys);
|
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(int index); // only emitted on user interaction && when 'active' is true
|
||||||
void pushed();
|
void pushed();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RADIOUIACTION_H
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,10 @@
|
|||||||
#include "radiouiaction.h"
|
#include "radiouiaction.h"
|
||||||
#include "radiokeywidget.h"
|
#include "radiokeywidget.h"
|
||||||
#include "simulatorinterface.h"
|
#include "simulatorinterface.h"
|
||||||
|
#include "buttonswidget.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
//#define FLASH_DURATION 10
|
//#define FLASH_DURATION 10
|
||||||
//#define CBEEP_ON "QLabel { background-color: #FF364E }"
|
//#define CBEEP_ON "QLabel { background-color: #FF364E }"
|
||||||
@@ -34,11 +38,11 @@ SimulatedUIWidget::SimulatedUIWidget(SimulatorInterface * simulator, QWidget * p
|
|||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_simulator(simulator),
|
m_simulator(simulator),
|
||||||
m_parent(parent),
|
m_parent(parent),
|
||||||
m_lcd(NULL),
|
m_lcd(nullptr),
|
||||||
m_scrollUpAction(NULL),
|
m_scrollUpAction(nullptr),
|
||||||
m_scrollDnAction(NULL),
|
m_scrollDnAction(nullptr),
|
||||||
m_mouseMidClickAction(NULL),
|
m_mouseMidClickAction(nullptr),
|
||||||
m_screenshotAction(NULL),
|
m_screenshotAction(nullptr),
|
||||||
m_board(getCurrentBoard()),
|
m_board(getCurrentBoard()),
|
||||||
m_backLight(0),
|
m_backLight(0),
|
||||||
m_beepShow(0),
|
m_beepShow(0),
|
||||||
@@ -191,11 +195,11 @@ void SimulatedUIWidget::mouseReleaseEvent(QMouseEvent * event)
|
|||||||
void SimulatedUIWidget::setLcd(LcdWidget * lcd)
|
void SimulatedUIWidget::setLcd(LcdWidget * lcd)
|
||||||
{
|
{
|
||||||
m_lcd = lcd;
|
m_lcd = lcd;
|
||||||
Firmware * firmware = getCurrentFirmware();
|
Board::Type board = getCurrentBoard();
|
||||||
|
|
||||||
auto width = firmware->getCapability(LcdWidth);
|
auto width = Boards::getCapability(board, Board::LcdWidth);
|
||||||
auto height = firmware->getCapability(LcdHeight);
|
auto height = Boards::getCapability(board, Board::LcdHeight);
|
||||||
auto depth = firmware->getCapability(LcdDepth);
|
auto depth = Boards::getCapability(board, Board::LcdDepth);
|
||||||
m_lcd->setData(width, height, depth);
|
m_lcd->setData(width, height, depth);
|
||||||
|
|
||||||
if (!m_backlightColors.size())
|
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.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIMULATEDUIWIDGET_H
|
#pragma once
|
||||||
#define SIMULATEDUIWIDGET_H
|
|
||||||
|
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
@@ -35,6 +34,8 @@ class SimulatorInterface;
|
|||||||
class LcdWidget;
|
class LcdWidget;
|
||||||
class RadioKeyWidget;
|
class RadioKeyWidget;
|
||||||
class RadioUiAction;
|
class RadioUiAction;
|
||||||
|
class ButtonsWidget;
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
// Match with /radio/src/hal/key_driver.h
|
// Match with /radio/src/hal/key_driver.h
|
||||||
enum EnumKeys {
|
enum EnumKeys {
|
||||||
@@ -64,6 +65,23 @@ enum EnumKeys {
|
|||||||
MAX_KEYS
|
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.
|
* 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).
|
* 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;
|
unsigned int m_backLight;
|
||||||
int m_beepShow;
|
int m_beepShow;
|
||||||
int m_beepVal;
|
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
|
// Each subclass is responsible for its own Ui
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
class SimulatedUIWidgetGeneric;
|
||||||
class SimulatedUIWidget9X;
|
class SimulatedUIWidget9X;
|
||||||
class SimulatedUIWidgetX9LITE;
|
class SimulatedUIWidgetX9LITE;
|
||||||
class SimulatedUIWidgetX7;
|
class SimulatedUIWidgetX7;
|
||||||
@@ -156,6 +183,7 @@ namespace Ui {
|
|||||||
class SimulatedUIWidgetTX12;
|
class SimulatedUIWidgetTX12;
|
||||||
class SimulatedUIWidgetZorro;
|
class SimulatedUIWidgetZorro;
|
||||||
class SimulatedUIWidgetBoxer;
|
class SimulatedUIWidgetBoxer;
|
||||||
|
class SimulatedUIWidgetMT12;
|
||||||
class SimulatedUIWidgetPocket;
|
class SimulatedUIWidgetPocket;
|
||||||
class SimulatedUIWidgetT8;
|
class SimulatedUIWidgetT8;
|
||||||
class SimulatedUIWidgetFatfishF16;
|
class SimulatedUIWidgetFatfishF16;
|
||||||
@@ -165,6 +193,19 @@ namespace Ui {
|
|||||||
class SimulatedUIWidgetV16;
|
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
|
class SimulatedUIWidget9X: public SimulatedUIWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -469,6 +510,15 @@ class SimulatedUIWidgetBoxer: public SimulatedUIWidget
|
|||||||
Ui::SimulatedUIWidgetBoxer * ui;
|
Ui::SimulatedUIWidgetBoxer * ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SimulatedUIWidgetMT12: public SimulatedUIWidgetGeneric
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SimulatedUIWidgetMT12(SimulatorInterface * simulator, QWidget * parent = nullptr);
|
||||||
|
virtual ~SimulatedUIWidgetMT12();
|
||||||
|
};
|
||||||
|
|
||||||
class SimulatedUIWidgetPocket: public SimulatedUIWidget
|
class SimulatedUIWidgetPocket: public SimulatedUIWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -552,5 +602,3 @@ class SimulatedUIWidgetV16: public SimulatedUIWidget
|
|||||||
private:
|
private:
|
||||||
Ui::SimulatedUIWidgetV16 * ui;
|
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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetBoxer.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetCommando8.h"
|
#include "ui_simulateduiwidgetCommando8.h"
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "simulateduiwidget.h"
|
#include "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetFatfishF16.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetJumperT12.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetJumperT14.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetJumperT20.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetJumperTLITE.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetJumperTPRO.h"
|
#include "ui_simulateduiwidgetJumperTPRO.h"
|
||||||
#include "eeprominterface.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetLR3PRO.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetPocket.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetT8.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetTX12.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetX7.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetX9LITE.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetXLITE.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 "simulateduiwidget.h"
|
||||||
#include "ui_simulateduiwidgetZorro.h"
|
#include "ui_simulateduiwidgetZorro.h"
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIMULATOR_H
|
#pragma once
|
||||||
#define SIMULATOR_H
|
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
@@ -195,6 +194,3 @@ struct SimulatorOptions
|
|||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(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>
|
#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_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_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
|
#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.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SIMULATORINTERFACE_H_
|
#pragma once
|
||||||
#define _SIMULATORINTERFACE_H_
|
|
||||||
|
|
||||||
#include "firmwares/boards.h"
|
#include "firmwares/boards.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
@@ -204,5 +203,3 @@ class SimulatorLoader
|
|||||||
static int registerSimulators(const QDir & dir);
|
static int registerSimulators(const QDir & dir);
|
||||||
static QMap<QString, QLibrary *> registeredSimulators;
|
static QMap<QString, QLibrary *> registeredSimulators;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SIMULATORINTERFACE_H_
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIMULATORMAINWINDOW_H
|
#pragma once
|
||||||
#define SIMULATORMAINWINDOW_H
|
|
||||||
|
|
||||||
#include "simulator.h"
|
#include "simulator.h"
|
||||||
|
|
||||||
@@ -114,5 +113,3 @@ class SimulatorMainWindow : public QMainWindow
|
|||||||
|
|
||||||
const static quint16 m_savedUiStateVersion;
|
const static quint16 m_savedUiStateVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIMULATORMAINWINDOW_H
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>OpenTx Simulator</string>
|
<string>EdgeTX Simulator</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="../companion.qrc">
|
<iconset resource="../companion.qrc">
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>644</width>
|
<width>644</width>
|
||||||
<height>21</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="nativeMenuBar">
|
<property name="nativeMenuBar">
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIMULATORSTARTUPDIALOG_H
|
#pragma once
|
||||||
#define SIMULATORSTARTUPDIALOG_H
|
|
||||||
|
|
||||||
#include "simulator.h"
|
#include "simulator.h"
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
@@ -75,5 +74,3 @@ class SimulatorStartupDialog : public QDialog
|
|||||||
|
|
||||||
void setGlobalFirmware(const QString & id);
|
void setGlobalFirmware(const QString & id);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIMULATORSTARTUPDIALOG_H
|
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
|||||||
case Board::BOARD_RADIOMASTER_BOXER:
|
case Board::BOARD_RADIOMASTER_BOXER:
|
||||||
radioUiWidget = new SimulatedUIWidgetBoxer(simulator, this);
|
radioUiWidget = new SimulatedUIWidgetBoxer(simulator, this);
|
||||||
break;
|
break;
|
||||||
|
case Board::BOARD_RADIOMASTER_MT12:
|
||||||
|
radioUiWidget = new SimulatedUIWidgetMT12(simulator, this);
|
||||||
|
break;
|
||||||
case Board::BOARD_RADIOMASTER_T8:
|
case Board::BOARD_RADIOMASTER_T8:
|
||||||
radioUiWidget = new SimulatedUIWidgetT8(simulator, this);
|
radioUiWidget = new SimulatedUIWidgetT8(simulator, this);
|
||||||
break;
|
break;
|
||||||
@@ -836,7 +839,7 @@ void SimulatorWidget::onSimulatorError(const QString & error)
|
|||||||
|
|
||||||
void SimulatorWidget::onPhaseChanged(qint32 phase, const QString & name)
|
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)
|
void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetType type, int index, int value)
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SIMULATORWIDGET_H_
|
#pragma once
|
||||||
#define _SIMULATORWIDGET_H_
|
|
||||||
|
|
||||||
#include "appdata.h"
|
#include "appdata.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
@@ -152,5 +151,3 @@ class SimulatorWidget : public QWidget
|
|||||||
int switchDirection[MAX_JS_BUTTONS];
|
int switchDirection[MAX_JS_BUTTONS];
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SIMULATORWIDGET_H_
|
|
||||||
|
|||||||
@@ -121,4 +121,3 @@ class TelemetrySimulator : public QWidget
|
|||||||
|
|
||||||
LogPlaybackController *logPlayback;
|
LogPlaybackController *logPlayback;
|
||||||
}; // TelemetrySimulator
|
}; // TelemetrySimulator
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TRAINERSIMU_H_
|
#pragma once
|
||||||
#define _TRAINERSIMU_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
@@ -67,6 +65,3 @@ class TrainerSimulator : public QWidget
|
|||||||
bool m_simuStarted;
|
bool m_simuStarted;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _TRAINERSIMU_H_
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _BUTTONSWIDGET_H_
|
#pragma once
|
||||||
#define _BUTTONSWIDGET_H_
|
|
||||||
|
|
||||||
#include "radiouiaction.h"
|
#include "radiouiaction.h"
|
||||||
#include "radiokeywidget.h"
|
#include "radiokeywidget.h"
|
||||||
@@ -46,17 +45,46 @@ class ButtonsWidget : public QWidget
|
|||||||
QWidget::setStyleSheet(sheet);
|
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);
|
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);
|
RadioKeyWidget * rkw = new RadioKeyWidget(polygon, image, action, this);
|
||||||
m_buttons.append(btn);
|
m_buttons.append(rkw);
|
||||||
connect(btn, &RadioKeyWidget::imageChanged, this, &ButtonsWidget::setBitmap);
|
connect(rkw, &RadioKeyWidget::imageChanged, this, &ButtonsWidget::setBitmap);
|
||||||
return btn;
|
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:
|
protected:
|
||||||
@@ -111,5 +139,3 @@ class ButtonsWidget : public QWidget
|
|||||||
QList<RadioKeyWidget *> m_buttons;
|
QList<RadioKeyWidget *> m_buttons;
|
||||||
QString defaultStyleSheet;
|
QString defaultStyleSheet;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _BUTTONSWIDGET_H_
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _RADIOFADERWIDGET_H_
|
#pragma once
|
||||||
#define _RADIOFADERWIDGET_H_
|
|
||||||
|
|
||||||
#include "radiowidget.h"
|
#include "radiowidget.h"
|
||||||
#include "sliderwidget.h"
|
#include "sliderwidget.h"
|
||||||
@@ -63,8 +62,3 @@ class RadioFaderWidget : public RadioWidget
|
|||||||
setWidget(sl);
|
setWidget(sl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _RADIOFADERWIDGET_H_
|
|
||||||
|
|||||||
@@ -19,22 +19,25 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RADIOKEYWIDGET_H
|
#pragma once
|
||||||
#define RADIOKEYWIDGET_H
|
|
||||||
|
|
||||||
#include "radiouiaction.h"
|
#include "radiouiaction.h"
|
||||||
#include "radiowidget.h"
|
#include "radiowidget.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
class RadioKeyWidget : public RadioWidget
|
class RadioKeyWidget : public RadioWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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),
|
RadioWidget(action, parent, f),
|
||||||
polygon(polygon),
|
polygon(polygon),
|
||||||
imgFile(image)
|
imgFile(image),
|
||||||
|
pushbtn(pushbtn)
|
||||||
{
|
{
|
||||||
m_type = RADIO_WIDGET_KEY;
|
m_type = RADIO_WIDGET_KEY;
|
||||||
setValue(0);
|
setValue(0);
|
||||||
@@ -42,6 +45,11 @@ class RadioKeyWidget : public RadioWidget
|
|||||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
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)
|
virtual void setAction(RadioUiAction * action)
|
||||||
{
|
{
|
||||||
if (m_action)
|
if (m_action)
|
||||||
@@ -82,6 +90,7 @@ class RadioKeyWidget : public RadioWidget
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
void imageChanged(const QString image);
|
void imageChanged(const QString image);
|
||||||
|
void actionTriggered();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -91,11 +100,13 @@ class RadioKeyWidget : public RadioWidget
|
|||||||
emit imageChanged(active ? imgFile : "");
|
emit imageChanged(active ? imgFile : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void onActionTriggered(int index, bool active)
|
||||||
|
{
|
||||||
|
if (pushbtn)
|
||||||
|
emit actionTriggered();
|
||||||
|
}
|
||||||
|
|
||||||
QPolygon polygon;
|
QPolygon polygon;
|
||||||
QString imgFile;
|
QString imgFile;
|
||||||
|
QPushButton *pushbtn;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RADIOKEYWIDGET_H
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _RADIOSWITCHWIDGET_H_
|
#pragma once
|
||||||
#define _RADIOSWITCHWIDGET_H_
|
|
||||||
|
|
||||||
#include "radiowidget.h"
|
#include "radiowidget.h"
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
@@ -146,5 +145,3 @@ class RadioSwitchWidget : public RadioWidget
|
|||||||
quint16 m_stepSize;
|
quint16 m_stepSize;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _RADIOSWITCHWIDGET_H_
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _RADIOTRIMWIDGET_H_
|
#pragma once
|
||||||
#define _RADIOTRIMWIDGET_H_
|
|
||||||
|
|
||||||
#include "radiowidget.h"
|
#include "radiowidget.h"
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
@@ -138,5 +137,3 @@ class RadioTrimWidget : public RadioWidget
|
|||||||
int m_btnDecIndex;
|
int m_btnDecIndex;
|
||||||
int m_btnIncIndex;
|
int m_btnIncIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _RADIOTRIMWIDGET_H_
|
|
||||||
|
|||||||
@@ -137,10 +137,10 @@ void RadioWidget::setAction(RadioUiAction * action)
|
|||||||
if (m_action->getIndex() > -1)
|
if (m_action->getIndex() > -1)
|
||||||
setIndex(m_action->getIndex());
|
setIndex(m_action->getIndex());
|
||||||
connect(m_action, &RadioUiAction::toggled, this, &RadioWidget::onActionToggled);
|
connect(m_action, &RadioUiAction::toggled, this, &RadioWidget::onActionToggled);
|
||||||
|
connect(m_action, &RadioUiAction::triggered, this, &RadioWidget::onActionTriggered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int RadioWidget::getValue() const
|
int RadioWidget::getValue() const
|
||||||
{
|
{
|
||||||
return m_value;
|
return m_value;
|
||||||
@@ -179,6 +179,10 @@ void RadioWidget::onActionToggled(int index, bool active)
|
|||||||
emit valueChange(m_type, index, getValue());
|
emit valueChange(m_type, index, getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadioWidget::onActionTriggered(int index, bool active)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
void RadioWidget::addLayout()
|
void RadioWidget::addLayout()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _RADIOWIDGET_H_
|
#pragma once
|
||||||
#define _RADIOWIDGET_H_
|
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -109,6 +108,7 @@ class RadioWidget : public QWidget
|
|||||||
void addLabel();
|
void addLabel();
|
||||||
void setWidget(QWidget * widget = NULL, Qt::Alignment align = Qt::AlignHCenter);
|
void setWidget(QWidget * widget = NULL, Qt::Alignment align = Qt::AlignHCenter);
|
||||||
virtual void onActionToggled(int index, bool active);
|
virtual void onActionToggled(int index, bool active);
|
||||||
|
virtual void onActionTriggered(int index, bool active);
|
||||||
|
|
||||||
QGridLayout * m_gridLayout;
|
QGridLayout * m_gridLayout;
|
||||||
QWidget * m_controlWidget;
|
QWidget * m_controlWidget;
|
||||||
@@ -126,5 +126,3 @@ class RadioWidget : public QWidget
|
|||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(RadioWidget::RadioWidgetState)
|
Q_DECLARE_METATYPE(RadioWidget::RadioWidgetState)
|
||||||
|
|
||||||
#endif // _RADIOWIDGET_H_
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SLIDERWIDGET_H_
|
#pragma once
|
||||||
#define _SLIDERWIDGET_H_
|
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
@@ -64,5 +63,3 @@ class SliderWidget : public QSlider
|
|||||||
|
|
||||||
QString m_toolTip;
|
QString m_toolTip;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SLIDERWIDGET_H_
|
|
||||||
|
|||||||
@@ -36,17 +36,18 @@ VirtualJoystickWidget::VirtualJoystickWidget(QWidget *parent, QChar side, bool s
|
|||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
stickSide(side),
|
stickSide(side),
|
||||||
prefSize(size),
|
prefSize(size),
|
||||||
hTrimWidget(NULL),
|
hTrimWidget(nullptr),
|
||||||
vTrimWidget(NULL),
|
vTrimWidget(nullptr),
|
||||||
btnHoldX(NULL),
|
btnHoldX(nullptr),
|
||||||
btnHoldY(NULL),
|
btnHoldY(nullptr),
|
||||||
btnFixX(NULL),
|
btnFixX(nullptr),
|
||||||
btnFixY(NULL),
|
btnFixY(nullptr),
|
||||||
nodeLabelX(NULL),
|
nodeLabelX(nullptr),
|
||||||
nodeLabelY(NULL),
|
nodeLabelY(nullptr),
|
||||||
m_stickScale(1024),
|
m_stickScale(1024),
|
||||||
m_stickPressed(false)
|
m_stickPressed(false)
|
||||||
{
|
{
|
||||||
|
isBoardSurface = Boards::isSurface(getCurrentBoard());
|
||||||
ar = (float)size.width() / size.height();
|
ar = (float)size.width() / size.height();
|
||||||
extraSize = QSize(0, 0);
|
extraSize = QSize(0, 0);
|
||||||
|
|
||||||
@@ -92,6 +93,13 @@ VirtualJoystickWidget::VirtualJoystickWidget(QWidget *parent, QChar side, bool s
|
|||||||
hTrimWidget = createTrimWidget('H');
|
hTrimWidget = createTrimWidget('H');
|
||||||
vTrimWidget = createTrimWidget('V');
|
vTrimWidget = createTrimWidget('V');
|
||||||
|
|
||||||
|
if (isBoardSurface) {
|
||||||
|
if (stickSide == 'L')
|
||||||
|
vTrimWidget->hide();
|
||||||
|
else
|
||||||
|
vTrimWidget->hide();
|
||||||
|
}
|
||||||
|
|
||||||
layout->addWidget(vTrimWidget, 1, colvt, 1, 1);
|
layout->addWidget(vTrimWidget, 1, colvt, 1, 1);
|
||||||
layout->addWidget(hTrimWidget, 2, 2, 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(btnFixY = createButtonWidget(FIX_Y));
|
||||||
btnbox->addWidget(btnFixX = createButtonWidget(FIX_X));
|
btnbox->addWidget(btnFixX = createButtonWidget(FIX_X));
|
||||||
btnbox->addWidget(btnHoldX = createButtonWidget(HOLD_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);
|
layout->addLayout(btnbox, 1, colbb, 1, 1);
|
||||||
|
|
||||||
@@ -171,23 +191,37 @@ void VirtualJoystickWidget::setStickAxisValue(int index, int value)
|
|||||||
using namespace Board;
|
using namespace Board;
|
||||||
qreal rvalue = value / 1024.0f;
|
qreal rvalue = value / 1024.0f;
|
||||||
|
|
||||||
switch (index) {
|
if (isBoardSurface) {
|
||||||
case STICK_AXIS_LH :
|
switch (index) {
|
||||||
if (stickSide == 'L')
|
case STICK_AXIS_SURFACE_LV :
|
||||||
setStickX(rvalue);
|
if (stickSide == 'L')
|
||||||
break;
|
setStickY(rvalue);
|
||||||
case STICK_AXIS_RH :
|
break;
|
||||||
if (stickSide == 'R')
|
case STICK_AXIS_SURFACE_RH :
|
||||||
setStickX(rvalue);
|
if (stickSide == 'R')
|
||||||
break;
|
setStickX(rvalue);
|
||||||
case STICK_AXIS_LV :
|
break;
|
||||||
if (stickSide == 'L')
|
}
|
||||||
setStickY(rvalue);
|
}
|
||||||
break;
|
else {
|
||||||
case STICK_AXIS_RV :
|
switch (index) {
|
||||||
if (stickSide == 'R')
|
case STICK_AXIS_LH :
|
||||||
setStickY(rvalue);
|
if (stickSide == 'L')
|
||||||
break;
|
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)
|
void VirtualJoystickWidget::loadDefaultsForMode(const unsigned mode)
|
||||||
{
|
{
|
||||||
if (((mode & 1) && stickSide == 'L') || (!(mode & 1) && stickSide == 'R')) {
|
if (isBoardSurface) {
|
||||||
setStickConstraint(HOLD_Y, true);
|
if (stickSide == 'L') {
|
||||||
setStickY(-1.0);
|
setStickX(0.0);
|
||||||
onNodeYChanged();
|
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) {
|
switch (type) {
|
||||||
case HOLD_Y:
|
case HOLD_Y:
|
||||||
btnLabel = tr("Hld Y");
|
btnLabel = tr("Hld Y");
|
||||||
tooltip = tr("Hold Vertical stick position.");
|
tooltip = tr("Hold Vertical position.");
|
||||||
icon = Simulator::SimulatorIcon("hold_y");
|
icon = Simulator::SimulatorIcon("hold_y");
|
||||||
break;
|
break;
|
||||||
case FIX_Y:
|
case FIX_Y:
|
||||||
btnLabel = tr("Fix Y");
|
btnLabel = tr("Fix Y");
|
||||||
tooltip = tr("Prevent Vertical movement of stick.");
|
tooltip = tr("Prevent Vertical movement.");
|
||||||
icon = Simulator::SimulatorIcon("fixed_y");
|
icon = Simulator::SimulatorIcon("fixed_y");
|
||||||
break;
|
break;
|
||||||
case FIX_X:
|
case FIX_X:
|
||||||
btnLabel = tr("Fix X");
|
btnLabel = tr("Fix X");
|
||||||
tooltip = tr("Prevent Horizontal movement of stick.");
|
tooltip = tr("Prevent Horizontal movement.");
|
||||||
icon = Simulator::SimulatorIcon("fixed_x");
|
icon = Simulator::SimulatorIcon("fixed_x");
|
||||||
break;
|
break;
|
||||||
case HOLD_X:
|
case HOLD_X:
|
||||||
btnLabel = tr("Hld X");
|
btnLabel = tr("Hld X");
|
||||||
tooltip = tr("Hold Horizontal stick position.");
|
tooltip = tr("Hold Horizontal position.");
|
||||||
icon = Simulator::SimulatorIcon("hold_x");
|
icon = Simulator::SimulatorIcon("hold_x");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -445,11 +493,7 @@ QLayout *VirtualJoystickWidget::createNodeValueLayout(QChar type, QLabel *& valL
|
|||||||
val->setObjectName(QString("val_%1").arg(type));
|
val->setObjectName(QString("val_%1").arg(type));
|
||||||
val->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
val->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
val->setAlignment(Qt::AlignCenter);
|
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 "));
|
val->setMinimumWidth(val->fontMetrics().horizontalAdvance("-100 "));
|
||||||
#endif
|
|
||||||
QVBoxLayout * layout = new QVBoxLayout();
|
QVBoxLayout * layout = new QVBoxLayout();
|
||||||
layout->setContentsMargins(2, 2, 2, 2);
|
layout->setContentsMargins(2, 2, 2, 2);
|
||||||
layout->setSpacing(2);
|
layout->setSpacing(2);
|
||||||
@@ -464,17 +508,33 @@ int VirtualJoystickWidget::getStickIndex(QChar type)
|
|||||||
{
|
{
|
||||||
using namespace Board;
|
using namespace Board;
|
||||||
|
|
||||||
if (stickSide == 'L') {
|
if (isBoardSurface) {
|
||||||
if (type == 'H')
|
if (stickSide == 'L') {
|
||||||
return STICK_AXIS_LH;
|
if (type == 'H')
|
||||||
else
|
return STICK_AXIS_SURFACE_LV;
|
||||||
return STICK_AXIS_LV;
|
else
|
||||||
|
return STICK_AXIS_SURFACE_LV;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (type == 'H')
|
||||||
|
return STICK_AXIS_SURFACE_RH;
|
||||||
|
else
|
||||||
|
return STICK_AXIS_SURFACE_RH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (type == 'H')
|
if (stickSide == 'L') {
|
||||||
return STICK_AXIS_RH;
|
if (type == 'H')
|
||||||
else
|
return STICK_AXIS_LH;
|
||||||
return STICK_AXIS_RV;
|
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;
|
using namespace Board;
|
||||||
|
|
||||||
if (stickSide == 'L') {
|
if (isBoardSurface) {
|
||||||
if (type == 'H')
|
if (stickSide == 'L') {
|
||||||
return TRIM_AXIS_LH;
|
if (type == 'H')
|
||||||
else
|
return TRIM_AXIS_SURFACE_LH;
|
||||||
return TRIM_AXIS_LV;
|
else
|
||||||
|
return TRIM_AXIS_SURFACE_LH;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (type == 'H')
|
||||||
|
return TRIM_AXIS_SURFACE_RH;
|
||||||
|
else
|
||||||
|
return TRIM_AXIS_SURFACE_RH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (type == 'H')
|
if (stickSide == 'L') {
|
||||||
return TRIM_AXIS_RH;
|
if (type == 'H')
|
||||||
else
|
return TRIM_AXIS_LH;
|
||||||
return TRIM_AXIS_RV;
|
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;
|
using namespace Board;
|
||||||
|
|
||||||
if (stickSide == 'L') {
|
if (isBoardSurface) {
|
||||||
if (type == 'H') {
|
if (stickSide == 'L') {
|
||||||
if (pos == 0)
|
if (type == 'H') {
|
||||||
return TRIM_SW_LH_DEC;
|
if (pos == 0)
|
||||||
else
|
return TRIM_SW_SURFACE_LH_DEC;
|
||||||
return TRIM_SW_LH_INC;
|
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 {
|
else {
|
||||||
if (pos == 0)
|
if (type == 'H') {
|
||||||
return TRIM_SW_LV_DEC;
|
if (pos == 0)
|
||||||
else
|
return TRIM_SW_SURFACE_RH_DEC;
|
||||||
return TRIM_SW_LV_INC;
|
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 {
|
else {
|
||||||
if (type == 'H') {
|
if (stickSide == 'L') {
|
||||||
if (pos == 0)
|
if (type == 'H') {
|
||||||
return TRIM_SW_RH_DEC;
|
if (pos == 0)
|
||||||
else
|
return TRIM_SW_LH_DEC;
|
||||||
return TRIM_SW_RH_INC;
|
else
|
||||||
|
return TRIM_SW_LH_INC;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (pos == 0)
|
||||||
|
return TRIM_SW_LV_DEC;
|
||||||
|
else
|
||||||
|
return TRIM_SW_LV_INC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// right side
|
||||||
else {
|
else {
|
||||||
if (pos == 0)
|
if (type == 'H') {
|
||||||
return TRIM_SW_RV_DEC;
|
if (pos == 0)
|
||||||
else
|
return TRIM_SW_RH_DEC;
|
||||||
return TRIM_SW_RV_INC;
|
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)
|
RadioTrimWidget * VirtualJoystickWidget::getTrimWidget(int which)
|
||||||
{
|
{
|
||||||
if ((stickSide == 'L' && which == Board::TRIM_AXIS_LH) || (stickSide == 'R' && which == Board::TRIM_AXIS_RH))
|
if (isBoardSurface) {
|
||||||
return hTrimWidget;
|
if ((stickSide == 'L' && which == Board::TRIM_AXIS_SURFACE_LH) || (stickSide == 'R' && which == Board::TRIM_AXIS_SURFACE_RH))
|
||||||
else if ((stickSide == 'L' && which == Board::TRIM_AXIS_LV) || (stickSide == 'R' && which == Board::TRIM_AXIS_RV))
|
return hTrimWidget;
|
||||||
return vTrimWidget;
|
else
|
||||||
else
|
return nullptr;
|
||||||
return NULL;
|
}
|
||||||
|
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)
|
void VirtualJoystickWidget::onButtonChange(bool checked)
|
||||||
@@ -564,10 +681,26 @@ void VirtualJoystickWidget::onButtonChange(bool checked)
|
|||||||
|
|
||||||
void VirtualJoystickWidget::updateNodeValueLabels()
|
void VirtualJoystickWidget::updateNodeValueLabels()
|
||||||
{
|
{
|
||||||
if (nodeLabelX)
|
if (isBoardSurface) {
|
||||||
nodeLabelX->setText(QString("%1").arg(getStickX() * 100.0f, 2, 'f', 0));
|
if (nodeLabelX) {
|
||||||
if (nodeLabelY)
|
if (stickSide == 'L')
|
||||||
nodeLabelY->setText(QString("%1").arg(getStickY() * 100.0f, 2, 'f', 0));
|
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)
|
void VirtualJoystickWidget::onGsMouseEvent(QGraphicsSceneMouseEvent * event)
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VIRTUALJOYSTICKWIDGET_H
|
#pragma once
|
||||||
#define VIRTUALJOYSTICKWIDGET_H
|
|
||||||
|
|
||||||
#include "radiowidget.h"
|
#include "radiowidget.h"
|
||||||
|
|
||||||
@@ -62,8 +61,8 @@ class VirtualJoystickWidget : public QWidget
|
|||||||
int getStickScale() const;
|
int getStickScale() const;
|
||||||
void setStickScale(int stickScale);
|
void setStickScale(int stickScale);
|
||||||
|
|
||||||
const RadioTrimWidget *horizontalTrim() { return hTrimWidget; }
|
const RadioTrimWidget *horizontalTrim() { return hTrimWidget; }
|
||||||
const RadioTrimWidget *verticalTrim() { return vTrimWidget; }
|
const RadioTrimWidget *verticalTrim() { return vTrimWidget; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setStickX(qreal x);
|
void setStickX(qreal x);
|
||||||
@@ -120,6 +119,7 @@ class VirtualJoystickWidget : public QWidget
|
|||||||
int m_yIndex;
|
int m_yIndex;
|
||||||
int m_stickScale;
|
int m_stickScale;
|
||||||
bool m_stickPressed;
|
bool m_stickPressed;
|
||||||
|
bool isBoardSurface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -143,5 +143,3 @@ class CustomGraphicsScene : public QGraphicsScene
|
|||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VIRTUALJOYSTICKWIDGET_H
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// Match with /companion/src/simulation/simulateduiwidget.h
|
||||||
enum EnumKeys {
|
enum EnumKeys {
|
||||||
KEY_MENU,
|
KEY_MENU,
|
||||||
KEY_EXIT,
|
KEY_EXIT,
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ cd build
|
|||||||
declare -a simulator_plugins=(x9lite x9lites
|
declare -a simulator_plugins=(x9lite x9lites
|
||||||
x7 x7access
|
x7 x7access
|
||||||
t8 t12 t12max tx12 tx12mk2
|
t8 t12 t12max tx12 tx12mk2
|
||||||
zorro commando8 boxer pocket
|
zorro commando8 boxer pocket mt12
|
||||||
tlite tpro tprov2 tpros lr3pro t14
|
tlite tpro tprov2 tpros lr3pro t14
|
||||||
x9d x9dp x9dp2019 x9e
|
x9d x9dp x9dp2019 x9e
|
||||||
xlite xlites
|
xlite xlites
|
||||||
|
|||||||
Reference in New Issue
Block a user