Consistency and statics
This commit is contained in:
@@ -420,7 +420,7 @@ CustomFuncActionItemModel::CustomFuncActionItemModel(const GeneralSettings * con
|
|||||||
|
|
||||||
void CustomFuncActionItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
void CustomFuncActionItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
||||||
{
|
{
|
||||||
item->setText(CustomFunctionData(AssignFunc(value)).funcToString(modelData));
|
item->setText(CustomFunctionData::funcToString((AssignFunc)value, modelData));
|
||||||
item->setData(CustomFunctionData::isFuncAvailable(value), IMDR_Available);
|
item->setData(CustomFunctionData::isFuncAvailable(value), IMDR_Available);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,8 +457,8 @@ CustomFuncResetParamItemModel::CustomFuncResetParamItemModel(const GeneralSettin
|
|||||||
|
|
||||||
void CustomFuncResetParamItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
void CustomFuncResetParamItemModel::setDynamicItemData(QStandardItem * item, const int value) const
|
||||||
{
|
{
|
||||||
item->setText(CustomFunctionData::resetToString(modelData, value));
|
item->setText(CustomFunctionData::resetToString(value, modelData));
|
||||||
item->setData(CustomFunctionData::isResetParamAvailable(modelData, value), IMDR_Available);
|
item->setData(CustomFunctionData::isResetParamAvailable(value, modelData), IMDR_Available);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomFuncResetParamItemModel::update(const int event)
|
void CustomFuncResetParamItemModel::update(const int event)
|
||||||
|
|||||||
@@ -47,12 +47,19 @@ bool CustomFunctionData::isEmpty() const
|
|||||||
return (swtch.type == SWITCH_TYPE_NONE);
|
return (swtch.type == SWITCH_TYPE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CustomFunctionData::nameToString(int index, bool globalContext) const
|
// static
|
||||||
|
QString CustomFunctionData::nameToString(const int index, const bool globalContext)
|
||||||
{
|
{
|
||||||
return RadioData::getElementName((globalContext ? tr("GF") : tr("SF")), index + 1, 0, true);
|
return RadioData::getElementName((globalContext ? tr("GF") : tr("SF")), index + 1, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CustomFunctionData::funcToString(const ModelData * model) const
|
QString CustomFunctionData::funcToString(const ModelData * model) const
|
||||||
|
{
|
||||||
|
return funcToString(func, model);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
QString CustomFunctionData::funcToString(const AssignFunc func, const ModelData * model)
|
||||||
{
|
{
|
||||||
if (func >= FuncOverrideCH1 && func <= FuncOverrideCHLast)
|
if (func >= FuncOverrideCH1 && func <= FuncOverrideCHLast)
|
||||||
return tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
return tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
||||||
@@ -133,7 +140,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
|
|||||||
return harpicToString(param);
|
return harpicToString(param);
|
||||||
}
|
}
|
||||||
else if (func == FuncReset) {
|
else if (func == FuncReset) {
|
||||||
return resetToString(model, param);
|
return resetToString(param, model);
|
||||||
}
|
}
|
||||||
else if (func == FuncVolume || func == FuncPlayValue || func == FuncBacklight) {
|
else if (func == FuncVolume || func == FuncPlayValue || func == FuncBacklight) {
|
||||||
return RawSource(param).toString(model);
|
return RawSource(param).toString(model);
|
||||||
@@ -168,7 +175,7 @@ QString CustomFunctionData::repeatToString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString CustomFunctionData::repeatToString(int value)
|
QString CustomFunctionData::repeatToString(const int value)
|
||||||
{
|
{
|
||||||
if (value == -1) {
|
if (value == -1) {
|
||||||
return tr("Played once, not during startup");
|
return tr("Played once, not during startup");
|
||||||
@@ -198,7 +205,7 @@ QString CustomFunctionData::enabledToString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool CustomFunctionData::isFuncAvailable(int index)
|
bool CustomFunctionData::isFuncAvailable(const int index)
|
||||||
{
|
{
|
||||||
Firmware * fw = getCurrentFirmware();
|
Firmware * fw = getCurrentFirmware();
|
||||||
|
|
||||||
@@ -217,7 +224,7 @@ bool CustomFunctionData::isFuncAvailable(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
int CustomFunctionData::funcContext(int index)
|
int CustomFunctionData::funcContext(const int index)
|
||||||
{
|
{
|
||||||
int ret = AllFunctionContexts;
|
int ret = AllFunctionContexts;
|
||||||
|
|
||||||
@@ -230,7 +237,7 @@ int CustomFunctionData::funcContext(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString CustomFunctionData::resetToString(const ModelData * model, int value)
|
QString CustomFunctionData::resetToString(const int value, const ModelData * model)
|
||||||
{
|
{
|
||||||
Firmware * firmware = getCurrentFirmware();
|
Firmware * firmware = getCurrentFirmware();
|
||||||
int step = CPN_MAX_TIMERS;
|
int step = CPN_MAX_TIMERS;
|
||||||
@@ -280,7 +287,7 @@ int CustomFunctionData::resetParamCount()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool CustomFunctionData::isResetParamAvailable(const ModelData * model, int index)
|
bool CustomFunctionData::isResetParamAvailable(const int index, const ModelData * model)
|
||||||
{
|
{
|
||||||
Firmware * firmware = getCurrentFirmware();
|
Firmware * firmware = getCurrentFirmware();
|
||||||
|
|
||||||
@@ -304,7 +311,7 @@ QString CustomFunctionData::harpicToString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString CustomFunctionData::harpicToString(int value)
|
QString CustomFunctionData::harpicToString(const int value)
|
||||||
{
|
{
|
||||||
return QString("%1").arg(value);
|
return QString("%1").arg(value);
|
||||||
}
|
}
|
||||||
@@ -322,7 +329,7 @@ QString CustomFunctionData::playSoundToString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString CustomFunctionData::playSoundToString(int value)
|
QString CustomFunctionData::playSoundToString(const int value)
|
||||||
{
|
{
|
||||||
const QStringList strl = playSoundStringList();
|
const QStringList strl = playSoundStringList();
|
||||||
if (value < strl.count())
|
if (value < strl.count())
|
||||||
@@ -337,7 +344,7 @@ QString CustomFunctionData::gvarAdjustModeToString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString CustomFunctionData::gvarAdjustModeToString(int value)
|
QString CustomFunctionData::gvarAdjustModeToString(const int value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case FUNC_ADJUST_GVAR_CONSTANT:
|
case FUNC_ADJUST_GVAR_CONSTANT:
|
||||||
|
|||||||
@@ -107,26 +107,27 @@ class CustomFunctionData {
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
QString nameToString(int index, bool globalContext = false) const;
|
|
||||||
QString funcToString(const ModelData * model = nullptr) const;
|
QString funcToString(const ModelData * model = nullptr) const;
|
||||||
QString paramToString(const ModelData * model) const;
|
QString paramToString(const ModelData * model = nullptr) const;
|
||||||
QString repeatToString() const;
|
QString repeatToString() const;
|
||||||
QString enabledToString() const;
|
QString enabledToString() const;
|
||||||
QString playSoundToString() const;
|
QString playSoundToString() const;
|
||||||
QString harpicToString() const;
|
QString harpicToString() const;
|
||||||
QString gvarAdjustModeToString() const;
|
QString gvarAdjustModeToString() const;
|
||||||
|
|
||||||
static bool isFuncAvailable(int index);
|
static QString nameToString(const int index, const bool globalContext = false);
|
||||||
static int funcContext(int index);
|
static QString funcToString(const AssignFunc func, const ModelData * model = nullptr);
|
||||||
static QString resetToString(const ModelData * model, int value);
|
static bool isFuncAvailable(const int index);
|
||||||
|
static int funcContext(const int index);
|
||||||
|
static QString resetToString(const int value, const ModelData * model = nullptr);
|
||||||
static int resetParamCount();
|
static int resetParamCount();
|
||||||
static bool isResetParamAvailable(const ModelData * model, int index);
|
static bool isResetParamAvailable(const int index, const ModelData * model = nullptr);
|
||||||
static QString repeatToString(int value);
|
static QString repeatToString(const int value);
|
||||||
static QStringList playSoundStringList();
|
static QStringList playSoundStringList();
|
||||||
static QString playSoundToString(int value);
|
static QString playSoundToString(const int value);
|
||||||
static QString harpicToString(int value);
|
static QString harpicToString(const int value);
|
||||||
static QStringList gvarAdjustModeStringList();
|
static QStringList gvarAdjustModeStringList();
|
||||||
static QString gvarAdjustModeToString(int value);
|
static QString gvarAdjustModeToString(const int value);
|
||||||
static AbstractStaticItemModel * repeatItemModel();
|
static AbstractStaticItemModel * repeatItemModel();
|
||||||
static AbstractStaticItemModel * playSoundItemModel();
|
static AbstractStaticItemModel * playSoundItemModel();
|
||||||
static AbstractStaticItemModel * harpicItemModel();
|
static AbstractStaticItemModel * harpicItemModel();
|
||||||
|
|||||||
Reference in New Issue
Block a user