Rework cRecMenuItemInt

This commit is contained in:
kamel5 2019-07-18 16:58:43 +02:00
parent 7f8ac2a2a8
commit 0d3dd79585
3 changed files with 21 additions and 23 deletions

View File

@ -297,7 +297,6 @@ void cRecMenuItemInfo::Draw(void) {
// --- cRecMenuItemInt -------------------------------------------------------
cRecMenuItemInt::cRecMenuItemInt(cString text,
int initialVal,
int minVal,
int maxVal,
bool active,
@ -305,7 +304,7 @@ cRecMenuItemInt::cRecMenuItemInt(cString text,
eRecMenuState action) {
selectable = true;
this->text = text;
this->currentVal = initialVal;
this->currentVal = *callback;
this->minVal = minVal;
this->maxVal = maxVal;
this->active = active;

View File

@ -199,7 +199,6 @@ private:
void DrawValue(void);
public:
cRecMenuItemInt(cString text,
int initialVal,
int minVal,
int maxVal,
bool active = false,

View File

@ -445,8 +445,8 @@ cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextStat
strncpy(folder, GetDirectoryFromTimer(timer->File()).c_str(), TEXTINPUTLENGTH);
AddMenuItemInitial(new cRecMenuItemBool(tr("Timer Active"), timerActive, true, &timerActive));
AddMenuItemInitial(new cRecMenuItemInt(tr("Priority"), prio, 0, MAXPRIORITY, false, &prio));
AddMenuItemInitial(new cRecMenuItemInt(tr("Lifetime"), lifetime, 0, MAXLIFETIME, false, &lifetime));
AddMenuItemInitial(new cRecMenuItemInt(tr("Priority"), 0, MAXPRIORITY, false, &prio));
AddMenuItemInitial(new cRecMenuItemInt(tr("Lifetime"), 0, MAXLIFETIME, false, &lifetime));
AddMenuItemInitial(new cRecMenuItemDay(tr("Day"), day, false, &day));
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer start time"), start, false, &start));
AddMenuItemInitial(new cRecMenuItemTime(tr("Timer stop time"), stop, false, &stop));
@ -528,8 +528,8 @@ cRecMenuSeriesTimer::cRecMenuSeriesTimer(const cChannel *initialChannel, const c
AddMenuItem(new cRecMenuItemTime(tr("Series Timer stop time"), stop, false, &stop));
AddMenuItem(new cRecMenuItemDayChooser(tr("Days to record"), dayOfWeek, false, &dayOfWeek));
AddMenuItem(new cRecMenuItemDay(tr("Day to start"), tstart, false, &tstart));
AddMenuItem(new cRecMenuItemInt(tr("Priority"), priority, 0, MAXPRIORITY, false, &priority));
AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), lifetime, 0, MAXLIFETIME, false, &lifetime));
AddMenuItem(new cRecMenuItemInt(tr("Priority"), 0, MAXPRIORITY, false, &priority));
AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), 0, MAXLIFETIME, false, &lifetime));
AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create Timer"), tr("Cancel"), rmsSeriesTimerCreate, rmsClose, true));
@ -822,7 +822,7 @@ void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
mainMenuItems.push_back(new cRecMenuItemBool(tr("Active"), sT.useAsSearchTimer, false, &sT.useAsSearchTimer, rmsSearchTimerSave, true));
mainMenuItems.push_back(new cRecMenuItemSelect(tr("Search mode"), searchModes, false, &sT.mode, rmsSearchTimerSave, true));
if (sT.mode == 5) {
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s", *indent, tr("Tolerance")), sT.fuzzyTolerance, 1, 9, false, &sT.fuzzyTolerance, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s", *indent, tr("Tolerance")), 1, 9, false, &sT.fuzzyTolerance, rmsSearchTimerSave));
}
mainMenuItems.push_back(new cRecMenuItemBool(tr("Match case"), sT.useCase, false, &sT.useCase, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use title"), sT.useTitle, false, &sT.useTitle, rmsSearchTimerSave));
@ -855,45 +855,45 @@ void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
if (sT.useAsSearchTimer) {
mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s", *indent, tr("Action")), searchTimerModes, false, &sT.action, rmsSearchTimerSave, true));
if (sT.action == searchTimerActionSwitchOnly) {
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Switch ... minutes before start")), sT.switchMinsBefore, 0, 99, false, &sT.switchMinsBefore, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Switch ... minutes before start")), 0, 99, false, &sT.switchMinsBefore, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s", *indent, *indent, tr("Unmute sound")), sT.unmuteSoundOnSwitch, false, &sT.unmuteSoundOnSwitch, rmsSearchTimerSave));
}
if (sT.action == searchTimerActionAnnounceAndSwitch) {
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Ask ... minutes before start")), sT.switchMinsBefore, 0, 99, false, &sT.switchMinsBefore, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Ask ... minutes before start")), 0, 99, false, &sT.switchMinsBefore, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s", *indent, *indent, tr("Unmute sound")), sT.unmuteSoundOnSwitch, false, &sT.unmuteSoundOnSwitch, rmsSearchTimerSave));
}
if ((sT.action == searchTimerActionRecord) || (sT.action == searchTimerActionInactiveRecord)) {
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s", *indent, *indent, tr("Series Recording")), sT.useEpisode, false, &sT.useEpisode, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemSelectDirectory(cString::sprintf("%s%s%s", *indent, *indent, tr("Directory")), std::string(directory), false, directory, rmsSearchTimerSave, true));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Delete recordings after ... days")), sT.delAfterDays, 0, 999, false, &sT.delAfterDays, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Delete recordings after ... days")), 0, 999, false, &sT.delAfterDays, rmsSearchTimerSave));
if (sT.delAfterDays > 0) {
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Keep ... recordings")), sT.recordingsKeep, 0, 999, false, &sT.recordingsKeep, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Keep ... recordings")), 0, 999, false, &sT.recordingsKeep, rmsSearchTimerSave));
}
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Pause when ... recordings exist")), sT.pauseOnNrRecordings, 0, 999, false, &sT.pauseOnNrRecordings, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Pause when ... recordings exist")), 0, 999, false, &sT.pauseOnNrRecordings, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s", *indent, *indent, tr("Avoid Repeats")), sT.avoidRepeats, false, &sT.avoidRepeats, rmsSearchTimerSave, true));
if (sT.avoidRepeats) {
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Allowed repeats")), sT.allowedRepeats, 0, 99, false, &sT.allowedRepeats, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Allowed repeats")), 0, 99, false, &sT.allowedRepeats, rmsSearchTimerSave));
if (sT.allowedRepeats > 0) {
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s%s", *indent, *indent, *indent, *indent, tr("Only repeats within ... days")), sT.repeatsWithinDays, 0, 999, false, &sT.repeatsWithinDays, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s%s", *indent, *indent, *indent, *indent, tr("Only repeats within ... days")), 0, 999, false, &sT.repeatsWithinDays, rmsSearchTimerSave));
}
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Compare Title")), sT.compareTitle, false, &sT.compareTitle, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Compare Subtitle")), sT.compareSubtitle, false, &sT.compareSubtitle, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Compare Description")), sT.compareSummary, false, &sT.compareSummary, rmsSearchTimerSave, true));
if (sT.compareSummary) {
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s%s", *indent, *indent, *indent, *indent, tr("Min. match in %")), sT.compareSummaryMatchInPercent, 1, 100, false, &sT.compareSummaryMatchInPercent, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s%s", *indent, *indent, *indent, *indent, tr("Min. match in %")), 1, 100, false, &sT.compareSummaryMatchInPercent, rmsSearchTimerSave));
}
mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Compare date")), compareDateModes, false, &sT.compareDate, rmsSearchTimerSave, false));
}
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Priority")), sT.priority, 0, 99, false, &sT.priority, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Lifetime")), sT.lifetime, 0, 99, false, &sT.lifetime, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Time margin for start in minutes")), sT.marginStart, 0, 30, false, &sT.marginStart, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Time margin for stop in minutes")), sT.marginStop, 0, 30, false, &sT.marginStop, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Priority")), 0, 99, false, &sT.priority, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Lifetime")), 0, 99, false, &sT.lifetime, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Time margin for start in minutes")), 0, 30, false, &sT.marginStart, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s", *indent, *indent, tr("Time margin for stop in minutes")), 0, 30, false, &sT.marginStop, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s", *indent, *indent, tr("Use VPS")), sT.useVPS, false, &sT.useVPS, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s%s", *indent, *indent, tr("Auto delete")), delModes, false, &sT.delMode, rmsSearchTimerSave, true));
if (sT.delMode == 1)
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("after ... recordings")), sT.delAfterCountRecs, 0, 999, false, &sT.delAfterCountRecs, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("after ... recordings")), 0, 999, false, &sT.delAfterCountRecs, rmsSearchTimerSave));
else if (sT.delMode == 2)
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("after ... days after first rec.")), sT.delAfterDaysOfFirstRec, 0, 999, false, &sT.delAfterDaysOfFirstRec, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemInt(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("after ... days after first rec.")), 0, 999, false, &sT.delAfterDaysOfFirstRec, rmsSearchTimerSave));
}
}
mainMenuItems.push_back(new cRecMenuItemButton(tr("Display Results for Search Timer"), rmsSearchTimerTest, false));
@ -1123,7 +1123,7 @@ cRecMenuSwitchTimer::cRecMenuSwitchTimer(void) {
infoItem->CalculateHeight(width - 2 * border);
AddMenuItem(infoItem);
AddMenuItem(new cRecMenuItemInt(tr("Minutes before switching"), switchMinsBefore, 0, 10, false, &switchMinsBefore));
AddMenuItem(new cRecMenuItemInt(tr("Minutes before switching"), 0, 10, false, &switchMinsBefore));
std::vector<std::string> switchModeItems;
switchModeItems.push_back(tr("switch"));
switchModeItems.push_back(tr("announce only"));