Refactor cRecMenuSearchTimerEdit

This commit is contained in:
kamel5 2019-11-11 13:49:28 +01:00
parent 54ce728fa5
commit d24bbefe4c

View File

@ -704,7 +704,9 @@ int cRecMenuSearchTimers::GetTotalNumMenuItems(void) {
}
// --- cRecMenuSearchTimerEdit ---------------------------------------------------------
cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer, std::vector<std::string> channelGroups) {
cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer, std::vector<std::string> channelGroups) { // OK
SetWidthPercent(70);
init = true;
deleteMenuItems = false;
this->sT = searchTimer;
@ -714,7 +716,6 @@ cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer
std::string dir = sT.directory;
strncpy(directory, dir.c_str(), TEXTINPUTLENGTH);
dayOfWeek = DayOfWeek(sT.dayOfWeek);
// dsyslog("Weekday = %i, %i", sT.dayOfWeek, dayOfWeek);
indent = " ";
if (sT.useChannel == 1) {
@ -731,18 +732,11 @@ cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer
sT.GetDelModes(&delModes);
channelgroupIndex = SplitChannelGroups(&channelGroups, &channelgroups);
SetWidthPercent(70);
cString infoText;
if (sT.GetID() > -1) {
infoText = tr("Configure Search Timer Options");
} else {
infoText = tr("Create Search Timer");
}
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText, true);
infoItem->CalculateHeight(width - 2 * border);
SetHeader(infoItem);
cRecMenuItemButtonYesNo *footerButton = new cRecMenuItemButtonYesNo(tr("Save Search Timer"), tr("Cancel"), rmsSearchTimerSave, rmsSearchTimers, false);
SetFooter(footerButton);
const cString line1 = (sT.GetID() > -1) ? tr("Configure Search Timer Options") : tr("Create Search Timer");
AddHeader(new cRecMenuItemInfo(*line1, 1, "", "", "", width - 2 * border, true));
AddFooter(new cRecMenuItemButtonYesNo(tr("Save Search Timer"), tr("Cancel"), rmsSearchTimerSave, rmsSearchTimers, false));
CreateMenuItems();
}
@ -770,9 +764,9 @@ int cRecMenuSearchTimerEdit::DayOfWeek(int dayofWeek) {
int cRecMenuSearchTimerEdit::SetDayOfWeek(int VDRDayOfWeek) {
int epgSearchDayOfWeek = 0;
for (int i=0; i < 7; i++) {
for (int i = 0; i < 7; i++) {
if (VDRDayOfWeek & (1 << i)) {
epgSearchDayOfWeek += pow(2, (i+1)%7);
epgSearchDayOfWeek += pow(2, (i + 1) % 7);
}
}
return epgSearchDayOfWeek * (-1);