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

Function buildRrule

src/gui/NetSchedulerDialog.cpp:89–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87};
88
89QString buildRrule(const EditorControls& c)
90{
91 const int kind = c.freqUnit->currentIndex(); // 0 once, 1 daily, 2 weekly, 3 monthly
92 const int interval = c.interval->value();
93 const QString intervalPart = interval > 1 ? QString(";INTERVAL=%1").arg(interval) : QString();
94
95 if (kind == 0)
96 return QString(); // one-time / "Repeat = Never"
97
98 if (kind == 1)
99 return QString("FREQ=DAILY%1").arg(intervalPart);
100
101 if (kind == 2) {
102 QStringList codes;
103 for (int i = 0; i < 7; ++i) {
104 if (c.weekdayChips[i]->isChecked())
105 codes << kWeekdayCodes[i];
106 }
107 if (codes.isEmpty())
108 codes << kWeekdayCodes[0]; // default Monday if no chip is picked
109 return QString("FREQ=WEEKLY%1;BYDAY=%2").arg(intervalPart, codes.join(','));
110 }
111
112 // Monthly: ordinal combo maps 0..4 -> 1..5, index 5 -> -1 (last).
113 const int ordIdx = c.monthlyOrdinal->currentIndex();
114 const int ordinal = (ordIdx == 5) ? -1 : ordIdx + 1;
115 const int wdIdx = c.monthlyWeekday->currentIndex(); // 0..6 = Mon..Sun
116 return QString("FREQ=MONTHLY%1;BYDAY=%2%3")
117 .arg(intervalPart)
118 .arg(ordinal)
119 .arg(kWeekdayCodes[wdIdx]);
120}
121
122void loadRuleIntoControls(EditorControls& c, const QString& rrule)
123{

Callers 1

editNetEntryFunction · 0.85

Calls 2

valueMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected