mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 17:55:19 +03:00
Inputs create filtered list once
This commit is contained in:
parent
775d8db1e9
commit
4feee9c665
4 changed files with 35 additions and 17 deletions
|
@ -24,8 +24,8 @@
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings,
|
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings,
|
||||||
Firmware * firmware, QString & inputName, RawSourceItemModel * rawSourceItemModel,
|
Firmware * firmware, QString & inputName, RawItemFilteredModel * rawSourceModel,
|
||||||
RawSwitchItemModel * rawSwitchItemModel) :
|
RawItemFilteredModel * rawSwitchModel) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::ExpoDialog),
|
ui(new Ui::ExpoDialog),
|
||||||
model(model),
|
model(model),
|
||||||
|
@ -37,8 +37,6 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||||
lock(false)
|
lock(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
rawSourceModel = new RawItemFilteredModel(rawSourceItemModel, (RawSource::InputSourceGroups & ~RawSource::InputsGroup) | RawSource::TelemGroup, this);
|
|
||||||
rawSwitchModel = new RawItemFilteredModel(rawSwitchItemModel, RawSwitch::MixesContext, this);
|
|
||||||
|
|
||||||
QLabel * lb_fp[CPN_MAX_FLIGHT_MODES] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
QLabel * lb_fp[CPN_MAX_FLIGHT_MODES] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
||||||
QCheckBox * tmp[CPN_MAX_FLIGHT_MODES] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
QCheckBox * tmp[CPN_MAX_FLIGHT_MODES] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
|
|
||||||
class GVarGroup;
|
class GVarGroup;
|
||||||
class CurveGroup;
|
class CurveGroup;
|
||||||
class RawSourceItemModel;
|
|
||||||
class RawSwitchItemModel;
|
|
||||||
class RawItemFilteredModel;
|
class RawItemFilteredModel;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -39,8 +37,8 @@ class ExpoDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, GeneralSettings & generalSettings,
|
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, GeneralSettings & generalSettings,
|
||||||
Firmware * firmware, QString & inputName, RawSourceItemModel * rawSourceItemModel,
|
Firmware * firmware, QString & inputName, RawItemFilteredModel * rawSourceItemModel,
|
||||||
RawSwitchItemModel * rawSwitchItemModel);
|
RawItemFilteredModel * rawSwitchItemModel);
|
||||||
~ExpoDialog();
|
~ExpoDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -67,8 +65,6 @@ class ExpoDialog : public QDialog {
|
||||||
ModelPrinter modelPrinter;
|
ModelPrinter modelPrinter;
|
||||||
bool lock;
|
bool lock;
|
||||||
QCheckBox * cb_fp[CPN_MAX_FLIGHT_MODES];
|
QCheckBox * cb_fp[CPN_MAX_FLIGHT_MODES];
|
||||||
RawItemFilteredModel * rawSourceModel;
|
|
||||||
RawItemFilteredModel * rawSwitchModel;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _EXPODIALOG_H_
|
#endif // _EXPODIALOG_H_
|
||||||
|
|
|
@ -21,15 +21,22 @@
|
||||||
#include "inputs.h"
|
#include "inputs.h"
|
||||||
#include "expodialog.h"
|
#include "expodialog.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
#include "rawitemfilteredmodel.h"
|
||||||
|
|
||||||
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware,
|
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware,
|
||||||
RawSourceItemModel * rawSourceItemModel, RawSwitchItemModel * rawSwitchItemModel):
|
RawSourceItemModel * rawSourceItemModel, RawSwitchItemModel * rawSwitchItemModel):
|
||||||
ModelPanel(parent, model, generalSettings, firmware),
|
ModelPanel(parent, model, generalSettings, firmware),
|
||||||
expoInserted(false),
|
expoInserted(false),
|
||||||
modelPrinter(firmware, generalSettings, model),
|
modelPrinter(firmware, generalSettings, model)
|
||||||
rawSourceItemModel(rawSourceItemModel),
|
|
||||||
rawSwitchItemModel(rawSwitchItemModel)
|
|
||||||
{
|
{
|
||||||
|
rawSourceModel = new RawItemFilteredModel(rawSourceItemModel, (RawSource::InputSourceGroups & ~RawSource::InputsGroup), this);
|
||||||
|
connect(rawSourceModel, &RawItemFilteredModel::dataAboutToBeUpdated, this, &InputsPanel::onModelDataAboutToBeUpdated);
|
||||||
|
connect(rawSourceModel, &RawItemFilteredModel::dataUpdateComplete, this, &InputsPanel::onModelDataUpdateComplete);
|
||||||
|
|
||||||
|
rawSwitchModel = new RawItemFilteredModel(rawSwitchItemModel, RawSwitch::MixesContext, this);
|
||||||
|
connect(rawSwitchModel, &RawItemFilteredModel::dataAboutToBeUpdated, this, &InputsPanel::onModelDataAboutToBeUpdated);
|
||||||
|
connect(rawSwitchModel, &RawItemFilteredModel::dataUpdateComplete, this, &InputsPanel::onModelDataUpdateComplete);
|
||||||
|
|
||||||
inputsCount = firmware->getCapability(VirtualInputs);
|
inputsCount = firmware->getCapability(VirtualInputs);
|
||||||
if (inputsCount == 0)
|
if (inputsCount == 0)
|
||||||
inputsCount = CPN_MAX_STICKS;
|
inputsCount = CPN_MAX_STICKS;
|
||||||
|
@ -68,6 +75,8 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
|
||||||
|
|
||||||
InputsPanel::~InputsPanel()
|
InputsPanel::~InputsPanel()
|
||||||
{
|
{
|
||||||
|
delete rawSourceModel;
|
||||||
|
delete rawSwitchModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputsPanel::update()
|
void InputsPanel::update()
|
||||||
|
@ -183,7 +192,7 @@ void InputsPanel::gm_openExpo(int index)
|
||||||
if (firmware->getCapability(VirtualInputs))
|
if (firmware->getCapability(VirtualInputs))
|
||||||
inputName = model->inputNames[ed.chn];
|
inputName = model->inputNames[ed.chn];
|
||||||
|
|
||||||
ExpoDialog *g = new ExpoDialog(this, *model, &ed, generalSettings, firmware, inputName, rawSourceItemModel, rawSwitchItemModel);
|
ExpoDialog *g = new ExpoDialog(this, *model, &ed, generalSettings, firmware, inputName, rawSourceModel, rawSwitchModel);
|
||||||
if (g->exec()) {
|
if (g->exec()) {
|
||||||
model->expoData[index] = ed;
|
model->expoData[index] = ed;
|
||||||
if (firmware->getCapability(VirtualInputs))
|
if (firmware->getCapability(VirtualInputs))
|
||||||
|
@ -709,3 +718,13 @@ int InputsPanel::getInputIndexFromSelected()
|
||||||
}
|
}
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputsPanel::onModelDataAboutToBeUpdated()
|
||||||
|
{
|
||||||
|
lock = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputsPanel::onModelDataUpdateComplete()
|
||||||
|
{
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
#include "modeledit.h"
|
#include "modeledit.h"
|
||||||
#include "mixerslistwidget.h"
|
#include "mixerslistwidget.h"
|
||||||
#include "modelprinter.h"
|
#include "modelprinter.h"
|
||||||
#include "rawitemdatamodels.h"
|
|
||||||
|
class RawSourceItemModel;
|
||||||
|
class RawSwitchItemModel;
|
||||||
|
class RawItemFilteredModel;
|
||||||
|
|
||||||
constexpr char MIMETYPE_EXPO[] = "application/x-companion-expo";
|
constexpr char MIMETYPE_EXPO[] = "application/x-companion-expo";
|
||||||
|
|
||||||
|
@ -61,6 +64,8 @@ class InputsPanel : public ModelPanel
|
||||||
void cmInputInsert();
|
void cmInputInsert();
|
||||||
void cmInputMoveDown();
|
void cmInputMoveDown();
|
||||||
void cmInputMoveUp();
|
void cmInputMoveUp();
|
||||||
|
void onModelDataAboutToBeUpdated();
|
||||||
|
void onModelDataUpdateComplete();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateDataModels();
|
void updateDataModels();
|
||||||
|
@ -72,8 +77,8 @@ class InputsPanel : public ModelPanel
|
||||||
ModelPrinter modelPrinter;
|
ModelPrinter modelPrinter;
|
||||||
int selectedIdx;
|
int selectedIdx;
|
||||||
int inputIdx;
|
int inputIdx;
|
||||||
RawSourceItemModel *rawSourceItemModel;
|
RawItemFilteredModel *rawSourceModel;
|
||||||
RawSwitchItemModel *rawSwitchItemModel;
|
RawItemFilteredModel *rawSwitchModel;
|
||||||
|
|
||||||
int getExpoIndex(unsigned int dch);
|
int getExpoIndex(unsigned int dch);
|
||||||
bool gm_insertExpo(int idx);
|
bool gm_insertExpo(int idx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue