Refactor to Model level ui datamodels for sources, switches and curves
This commit is contained in:
@@ -36,6 +36,15 @@ class CurveReference {
|
||||
CURVE_REF_CUSTOM
|
||||
};
|
||||
|
||||
enum CurveRefGroups {
|
||||
NoneGroup = 0x001,
|
||||
NegativeGroup = 0x002,
|
||||
PositiveGroup = 0x004,
|
||||
|
||||
AllCurveRefGroups = NoneGroup | NegativeGroup | PositiveGroup,
|
||||
PositiveCurveRefGroups = AllCurveRefGroups &~ NegativeGroup
|
||||
};
|
||||
|
||||
CurveReference() { clear(); }
|
||||
|
||||
CurveReference(CurveRefType type, int value):
|
||||
@@ -51,6 +60,14 @@ class CurveReference {
|
||||
|
||||
QString toString(const ModelData * model = NULL, bool verbose = true) const;
|
||||
bool isSet() const { return type != CURVE_REF_DIFF || value != 0; }
|
||||
|
||||
bool operator == ( const CurveReference & other) const {
|
||||
return (this->type == other.type) && (this->value == other.value);
|
||||
}
|
||||
|
||||
bool operator != ( const CurveReference & other) const {
|
||||
return (this->type != other.type) || (this->value != other.value);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CURVEREFERENCE_H
|
||||
|
||||
@@ -321,7 +321,7 @@ class ModelData {
|
||||
void updateModuleFailsafes(ModuleData * md);
|
||||
inline void updateSourceRef(RawSource & src) { updateTypeIndexRef<RawSource, RawSourceType>(src, updRefInfo.srcType); }
|
||||
inline void updateSwitchRef(RawSwitch & swtch) { updateTypeIndexRef<RawSwitch, RawSwitchType>(swtch, updRefInfo.swtchType, 1); }
|
||||
inline void updateTimerMode(RawSwitch & swtch) { updateTypeIndexRef<RawSwitch, RawSwitchType>(swtch, updRefInfo.swtchType, 1, false, (int)SWITCH_TYPE_TIMER_MODE, 0); }
|
||||
inline void updateTimerMode(RawSwitch & swtch) { updateTypeIndexRef<RawSwitch, RawSwitchType>(swtch, updRefInfo.swtchType, 1, false, (int)SWITCH_TYPE_TIMER_MODE, -1 /*adjusted by offset*/); }
|
||||
inline void updateSourceIntRef(int & value)
|
||||
{
|
||||
RawSource src = RawSource(value);
|
||||
|
||||
Reference in New Issue
Block a user