MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / loadRuleIntoControls

Function loadRuleIntoControls

src/gui/NetSchedulerDialog.cpp:122–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void loadRuleIntoControls(EditorControls& c, const QString& rrule)
123{
124 const auto rule = NetRecurrence::parseRule(rrule);
125 c.interval->setValue(rule.interval > 0 ? rule.interval : 1);
126
127 switch (rule.freq) {
128 case NetRecurrence::ParsedRule::Freq::Daily:
129 c.freqUnit->setCurrentIndex(1);
130 break;
131 case NetRecurrence::ParsedRule::Freq::Weekly:
132 c.freqUnit->setCurrentIndex(2);
133 for (int i = 0; i < 7; ++i)
134 c.weekdayChips[i]->setChecked(rule.weekdays.contains(i + 1));
135 break;
136 case NetRecurrence::ParsedRule::Freq::Monthly: {
137 c.freqUnit->setCurrentIndex(3);
138 const int ordIdx = (rule.monthlyOrdinal == -1) ? 5 : (rule.monthlyOrdinal - 1);
139 c.monthlyOrdinal->setCurrentIndex(qBound(0, ordIdx, 5));
140 if (rule.monthlyWeekday >= 1 && rule.monthlyWeekday <= 7)
141 c.monthlyWeekday->setCurrentIndex(rule.monthlyWeekday - 1);
142 break;
143 }
144 case NetRecurrence::ParsedRule::Freq::Invalid:
145 c.freqUnit->setCurrentIndex(2);
146 break;
147 }
148}
149
150int leadMinutesFromIndex(int idx)
151{

Callers 1

editNetEntryFunction · 0.85

Calls 3

parseRuleFunction · 0.85
containsMethod · 0.80
setValueMethod · 0.45

Tested by

no test coverage detected