Compile and other tweaks
This commit is contained in:
@@ -457,9 +457,7 @@ CustomFuncResetParamItemModel::CustomFuncResetParamItemModel(const GeneralSettin
|
|||||||
|
|
||||||
void CustomFuncResetParamItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
void CustomFuncResetParamItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
||||||
{
|
{
|
||||||
CustomFunctionData cfd = CustomFunctionData(AssignFunc::FuncReset);
|
item->setText(CustomFunctionData::resetToString(modelData, value));
|
||||||
cfd.param = value;
|
|
||||||
item->setText(CustomFunctionData::resetToString(modelData));
|
|
||||||
item->setData(CustomFunctionData::isResetParamAvailable(modelData, value), IMDR_Available);
|
item->setData(CustomFunctionData::isResetParamAvailable(modelData, value), IMDR_Available);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMPOUNDITEMMODELS_H
|
#pragma once
|
||||||
#define COMPOUNDITEMMODELS_H
|
|
||||||
|
|
||||||
#include "rawsource.h"
|
#include "rawsource.h"
|
||||||
#include "rawswitch.h"
|
#include "rawswitch.h"
|
||||||
@@ -361,5 +360,3 @@ class CompoundItemModelFactory
|
|||||||
private:
|
private:
|
||||||
void setSourceId(AbstractItemModel * itemModel);
|
void setSourceId(AbstractItemModel * itemModel);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMPOUNDITEMMODELS_H
|
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ QString CustomFunctionData::resetToString(const ModelData * model, int value)
|
|||||||
else
|
else
|
||||||
return QString(CPN_STR_UNKNOWN_ITEM);
|
return QString(CPN_STR_UNKNOWN_ITEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
step += reCount;
|
step += reCount;
|
||||||
|
|
||||||
if (value < step + firmware->getCapability(Sensors))
|
if (value < step + firmware->getCapability(Sensors))
|
||||||
@@ -291,8 +292,8 @@ bool CustomFunctionData::isResetParamAvailable(const ModelData * model, int inde
|
|||||||
}
|
}
|
||||||
else if (index < CPN_MAX_TIMERS + firmware->getCapability(RotaryEncoders))
|
else if (index < CPN_MAX_TIMERS + firmware->getCapability(RotaryEncoders))
|
||||||
return true;
|
return true;
|
||||||
else if (model && index < CPN_MAX_TIMERS + firmware->getCapability(RotaryEncoders) + firmware->getCapability(Sensors))
|
else if (model && index < resetParamCount())
|
||||||
return model->sensorData[index - CPN_MAX_TIMERS - firmware->getCapability(RotaryEncoders)].isAvailable();
|
return model->sensorData[index - (CPN_MAX_TIMERS + 2 + firmware->getCapability(RotaryEncoders))].isAvailable();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||||||
playIcon.addImage("stop.png", QIcon::Normal, QIcon::On);
|
playIcon.addImage("stop.png", QIcon::Normal, QIcon::On);
|
||||||
|
|
||||||
QStringList headerLabels;
|
QStringList headerLabels;
|
||||||
headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable");
|
headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << "";
|
||||||
TableLayout * tableLayout = new TableLayout(this, fswCapability, headerLabels);
|
TableLayout * tableLayout = new TableLayout(this, fswCapability, headerLabels);
|
||||||
|
|
||||||
for (int i = 0; i < fswCapability; i++) {
|
for (int i = 0; i < fswCapability; i++) {
|
||||||
@@ -119,19 +119,21 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||||||
|
|
||||||
// The switch
|
// The switch
|
||||||
fswtchSwtch[i] = new QComboBox(this);
|
fswtchSwtch[i] = new QComboBox(this);
|
||||||
|
fswtchSwtch[i]->setProperty("index", i);
|
||||||
fswtchSwtch[i]->setModel(tabFilterFactory->getItemModel(rawSwitchId));
|
fswtchSwtch[i]->setModel(tabFilterFactory->getItemModel(rawSwitchId));
|
||||||
fswtchSwtch[i]->setCurrentIndex(fswtchSwtch[i]->findData(functions[i].swtch.toValue()));
|
fswtchSwtch[i]->setCurrentIndex(fswtchSwtch[i]->findData(functions[i].swtch.toValue()));
|
||||||
fswtchSwtch[i]->setProperty("index", i);
|
|
||||||
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||||
|
fswtchSwtch[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
fswtchSwtch[i]->setMaxVisibleItems(10);
|
fswtchSwtch[i]->setMaxVisibleItems(10);
|
||||||
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||||
tableLayout->addWidget(i, 1, fswtchSwtch[i]);
|
tableLayout->addWidget(i, 1, fswtchSwtch[i]);
|
||||||
|
|
||||||
// The function
|
// The function
|
||||||
fswtchFunc[i] = new QComboBox(this);
|
fswtchFunc[i] = new QComboBox(this);
|
||||||
|
fswtchFunc[i]->setProperty("index", i);
|
||||||
fswtchFunc[i]->setModel(tabFilterFactory->getItemModel(funcActionsId));
|
fswtchFunc[i]->setModel(tabFilterFactory->getItemModel(funcActionsId));
|
||||||
fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(functions[i].func));
|
fswtchFunc[i]->setCurrentIndex(fswtchFunc[i]->findData(functions[i].func));
|
||||||
fswtchFunc[i]->setProperty("index", i);
|
fswtchFunc[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
|
connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
|
||||||
tableLayout->addWidget(i, 2, fswtchFunc[i]);
|
tableLayout->addWidget(i, 2, fswtchFunc[i]);
|
||||||
|
|
||||||
@@ -148,8 +150,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||||||
|
|
||||||
fswtchParamGV[i] = new QCheckBox(this);
|
fswtchParamGV[i] = new QCheckBox(this);
|
||||||
fswtchParamGV[i]->setProperty("index", i);
|
fswtchParamGV[i]->setProperty("index", i);
|
||||||
fswtchParamGV[i]->setText("GV");
|
fswtchParamGV[i]->setText(tr("GV"));
|
||||||
fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
|
connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
|
||||||
paramLayout->addWidget(fswtchParamGV[i]);
|
paramLayout->addWidget(fswtchParamGV[i]);
|
||||||
|
|
||||||
@@ -202,6 +204,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||||||
fswtchRepeat[i]->setProperty("index", i);
|
fswtchRepeat[i]->setProperty("index", i);
|
||||||
fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatId));
|
fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatId));
|
||||||
fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
|
fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
|
||||||
|
fswtchRepeat[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
repeatLayout->addWidget(fswtchRepeat[i], i + 1);
|
repeatLayout->addWidget(fswtchRepeat[i], i + 1);
|
||||||
connect(fswtchRepeat[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
connect(fswtchRepeat[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user