| 164 | } |
| 165 | |
| 166 | void MacroScheduleEntry::Load(obs_data_t *obj) |
| 167 | { |
| 168 | const char *idStr = obs_data_get_string(obj, "id"); |
| 169 | if (idStr && *idStr) { |
| 170 | id = idStr; |
| 171 | } |
| 172 | const char *nameStr = obs_data_get_string(obj, "name"); |
| 173 | if (nameStr) { |
| 174 | name = nameStr; |
| 175 | } |
| 176 | macro.Load(obj); |
| 177 | const char *colorStr = obs_data_get_string(obj, "color"); |
| 178 | if (colorStr && *colorStr) { |
| 179 | const QColor loaded(QString::fromUtf8(colorStr)); |
| 180 | if (loaded.isValid()) { |
| 181 | color = loaded; |
| 182 | } |
| 183 | } |
| 184 | checkConditions = obs_data_get_bool(obj, "checkConditions"); |
| 185 | runElseActionsOnConditionFailure = |
| 186 | obs_data_get_bool(obj, "runElseActionsOnConditionFailure"); |
| 187 | obs_data_set_default_bool(obj, "enabled", true); |
| 188 | enabled = obs_data_get_bool(obj, "enabled"); |
| 189 | |
| 190 | startDateTime = loadDateTime(obj, "startDateTime"); |
| 191 | hasEndDate = obs_data_get_bool(obj, "hasEndDate"); |
| 192 | if (hasEndDate) { |
| 193 | endDate = loadDateTime(obj, "endDate"); |
| 194 | endDateAction = static_cast<EndDateAction>( |
| 195 | obs_data_get_int(obj, "endDateAction")); |
| 196 | } |
| 197 | |
| 198 | doesRepeat = obs_data_get_bool(obj, "doesRepeat"); |
| 199 | repeatInterval.Load(obj, "repeatInterval"); |
| 200 | repeatEndType = static_cast<RepeatEndType>( |
| 201 | obs_data_get_int(obj, "repeatEndType")); |
| 202 | obs_data_set_default_int(obj, "repeatMaxCount", 1); |
| 203 | repeatMaxCount = (int)obs_data_get_int(obj, "repeatMaxCount"); |
| 204 | repeatUntilDate = loadDateTime(obj, "repeatUntilDate"); |
| 205 | |
| 206 | timesTriggered = (int)obs_data_get_int(obj, "timesTriggered"); |
| 207 | lastTriggered = loadDateTime(obj, "lastTriggered"); |
| 208 | endDateActionApplied = obs_data_get_bool(obj, "endDateActionApplied"); |
| 209 | } |
| 210 | |
| 211 | QDateTime MacroScheduleEntry::advanceFrom(const QDateTime &base) const |
| 212 | { |
no test coverage detected