Rework cRecMenuItemSelect

This commit is contained in:
kamel5 2019-07-18 16:47:10 +02:00
parent 31f72f2ad8
commit 7f8ac2a2a8
3 changed files with 10 additions and 13 deletions

View File

@ -507,7 +507,6 @@ eRecMenuState cRecMenuItemBool::ProcessKey(eKeys Key) {
// --- cRecMenuItemSelect ------------------------------------------------------- // --- cRecMenuItemSelect -------------------------------------------------------
cRecMenuItemSelect::cRecMenuItemSelect(cString text, cRecMenuItemSelect::cRecMenuItemSelect(cString text,
std::vector<std::string> Strings, std::vector<std::string> Strings,
int initialVal,
bool active, bool active,
int *callback, int *callback,
eRecMenuState action, eRecMenuState action,
@ -516,10 +515,9 @@ cRecMenuItemSelect::cRecMenuItemSelect(cString text,
this->text = text; this->text = text;
strings = Strings; strings = Strings;
numValues = Strings.size(); numValues = Strings.size();
if ((initialVal < 0) || (initialVal > numValues-1)) this->currentVal = *callback;
if ((this->currentVal < 0) || (this->currentVal > numValues - 1))
this->currentVal = 0; this->currentVal = 0;
else
this->currentVal = initialVal;
this->active = active; this->active = active;
this->callback = callback; this->callback = callback;
this->refresh = refresh; this->refresh = refresh;

View File

@ -260,7 +260,6 @@ private:
public: public:
cRecMenuItemSelect(cString text, cRecMenuItemSelect(cString text,
std::vector<std::string> Strings, std::vector<std::string> Strings,
int initialVal,
bool active = false, bool active = false,
int *callback = NULL, int *callback = NULL,
eRecMenuState action = rmsNotConsumed, eRecMenuState action = rmsNotConsumed,

View File

@ -820,7 +820,7 @@ void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
mainMenuItems.push_back(new cRecMenuItemText(tr("Search term"), searchString, TEXTINPUTLENGTH, init, searchString)); mainMenuItems.push_back(new cRecMenuItemText(tr("Search term"), searchString, TEXTINPUTLENGTH, init, searchString));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Active"), sT.useAsSearchTimer, false, &sT.useAsSearchTimer, rmsSearchTimerSave, true)); mainMenuItems.push_back(new cRecMenuItemBool(tr("Active"), sT.useAsSearchTimer, false, &sT.useAsSearchTimer, rmsSearchTimerSave, true));
mainMenuItems.push_back(new cRecMenuItemSelect(tr("Search mode"), searchModes, sT.mode, false, &sT.mode, rmsSearchTimerSave, true)); mainMenuItems.push_back(new cRecMenuItemSelect(tr("Search mode"), searchModes, false, &sT.mode, rmsSearchTimerSave, true));
if (sT.mode == 5) { 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")), sT.fuzzyTolerance, 1, 9, false, &sT.fuzzyTolerance, rmsSearchTimerSave));
} }
@ -829,13 +829,13 @@ void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use subtitle"), sT.useSubtitle, false, &sT.useSubtitle, rmsSearchTimerSave)); mainMenuItems.push_back(new cRecMenuItemBool(tr("Use subtitle"), sT.useSubtitle, false, &sT.useSubtitle, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use description"), sT.useDescription, false, &sT.useDescription, rmsSearchTimerSave)); mainMenuItems.push_back(new cRecMenuItemBool(tr("Use description"), sT.useDescription, false, &sT.useDescription, rmsSearchTimerSave));
// mainMenuItems.push_back(new cRecMenuItemBool(tr("Use content descriptor"), sT.useContentDescriptors, false, &sT.useContentDescriptors, rmsSearchTimerSave)); // mainMenuItems.push_back(new cRecMenuItemBool(tr("Use content descriptor"), sT.useContentDescriptors, false, &sT.useContentDescriptors, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemSelect(tr("Use channel"), useChannelModes, sT.useChannel, false, &sT.useChannel, rmsSearchTimerSave, true)); mainMenuItems.push_back(new cRecMenuItemSelect(tr("Use channel"), useChannelModes, false, &sT.useChannel, rmsSearchTimerSave, true));
if (sT.useChannel == 1) { if (sT.useChannel == 1) {
mainMenuItems.push_back(new cRecMenuItemChannelChooser(cString::sprintf("%s%s", *indent, tr("from channel")), false, &startChannel, rmsSearchTimerSave)); mainMenuItems.push_back(new cRecMenuItemChannelChooser(cString::sprintf("%s%s", *indent, tr("from channel")), false, &startChannel, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemChannelChooser(cString::sprintf("%s%s", *indent, tr("to channel")), false, &stopChannel, rmsSearchTimerSave)); mainMenuItems.push_back(new cRecMenuItemChannelChooser(cString::sprintf("%s%s", *indent, tr("to channel")), false, &stopChannel, rmsSearchTimerSave));
} }
else if ((sT.useChannel == 2) && (channelgroups.size() > 0)) { else if ((sT.useChannel == 2) && (channelgroups.size() > 0)) {
mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s", *indent, tr("Channel group")), channelgroups, channelgroupIndex, false, &channelgroupIndex, rmsSearchTimerSave, false)); mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s", *indent, tr("Channel group")), channelgroups, false, &channelgroupIndex, rmsSearchTimerSave, false));
} }
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use time"), sT.useTime, false, &sT.useTime, rmsSearchTimerSave, true)); mainMenuItems.push_back(new cRecMenuItemBool(tr("Use time"), sT.useTime, false, &sT.useTime, rmsSearchTimerSave, true));
if (sT.useTime) { if (sT.useTime) {
@ -853,7 +853,7 @@ void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use in Favorites"), sT.useInFavorites, false, &sT.useInFavorites, rmsSearchTimerSave)); mainMenuItems.push_back(new cRecMenuItemBool(tr("Use in Favorites"), sT.useInFavorites, false, &sT.useInFavorites, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use as search timer"), sT.useAsSearchTimer, false, &sT.useAsSearchTimer, rmsSearchTimerSave, true)); mainMenuItems.push_back(new cRecMenuItemBool(tr("Use as search timer"), sT.useAsSearchTimer, false, &sT.useAsSearchTimer, rmsSearchTimerSave, true));
if (sT.useAsSearchTimer) { if (sT.useAsSearchTimer) {
mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s", *indent, tr("Action")), searchTimerModes, sT.action, false, &sT.action, rmsSearchTimerSave, true)); mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s", *indent, tr("Action")), searchTimerModes, false, &sT.action, rmsSearchTimerSave, true));
if (sT.action == searchTimerActionSwitchOnly) { 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")), sT.switchMinsBefore, 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)); mainMenuItems.push_back(new cRecMenuItemBool(cString::sprintf("%s%s%s", *indent, *indent, tr("Unmute sound")), sT.unmuteSoundOnSwitch, false, &sT.unmuteSoundOnSwitch, rmsSearchTimerSave));
@ -882,14 +882,14 @@ void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
if (sT.compareSummary) { 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 %")), sT.compareSummaryMatchInPercent, 1, 100, false, &sT.compareSummaryMatchInPercent, rmsSearchTimerSave));
} }
mainMenuItems.push_back(new cRecMenuItemSelect(cString::sprintf("%s%s%s%s", *indent, *indent, *indent, tr("Compare date")), compareDateModes, sT.compareDate, false, &sT.compareDate, rmsSearchTimerSave, false)); 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("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("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 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("Time margin for stop in minutes")), sT.marginStop, 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 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, sT.delMode, false, &sT.delMode, rmsSearchTimerSave, true)); 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) 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")), sT.delAfterCountRecs, 0, 999, false, &sT.delAfterCountRecs, rmsSearchTimerSave));
else if (sT.delMode == 2) else if (sT.delMode == 2)
@ -1128,7 +1128,7 @@ cRecMenuSwitchTimer::cRecMenuSwitchTimer(void) {
switchModeItems.push_back(tr("switch")); switchModeItems.push_back(tr("switch"));
switchModeItems.push_back(tr("announce only")); switchModeItems.push_back(tr("announce only"));
switchModeItems.push_back(tr("ask for switch")); switchModeItems.push_back(tr("ask for switch"));
AddMenuItem(new cRecMenuItemSelect(tr("Switch Mode"), switchModeItems, switchMode, false, &switchMode)); AddMenuItem(new cRecMenuItemSelect(tr("Switch Mode"), switchModeItems, false, &switchMode));
AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create"), tr("Cancel"), rmsSwitchTimerCreate, rmsClose, true)); AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create"), tr("Cancel"), rmsSwitchTimerCreate, rmsClose, true));
@ -1201,7 +1201,7 @@ cRecMenuSearch::cRecMenuSearch(std::string searchString, bool withOptions) {
std::vector<std::string> searchModes; std::vector<std::string> searchModes;
cTVGuideSearchTimer searchTimer; cTVGuideSearchTimer searchTimer;
searchTimer.GetSearchModes(&searchModes); searchTimer.GetSearchModes(&searchModes);
AddMenuItemInitial(new cRecMenuItemSelect(tr("Search Mode"), searchModes, 0, false, &mode)); AddMenuItemInitial(new cRecMenuItemSelect(tr("Search Mode"), searchModes, false, &mode));
AddMenuItemInitial(new cRecMenuItemChannelChooser(tr("Channel to Search"), false, &channelNr)); AddMenuItemInitial(new cRecMenuItemChannelChooser(tr("Channel to Search"), false, &channelNr));
AddMenuItemInitial(new cRecMenuItemBool(tr("Search in title"), true, false, &useTitle)); AddMenuItemInitial(new cRecMenuItemBool(tr("Search in title"), true, false, &useTitle));
AddMenuItemInitial(new cRecMenuItemBool(tr("Search in Subtitle"), true, false, &useSubTitle)); AddMenuItemInitial(new cRecMenuItemBool(tr("Search in Subtitle"), true, false, &useSubTitle));