Fixed dayOfWeek error in RecMenuSearchTimerEdit

This commit is contained in:
kamel5 2019-07-04 14:17:08 +02:00
parent 0b37464dd0
commit 463b6369d2
3 changed files with 15 additions and 14 deletions

View File

@ -2148,7 +2148,6 @@ cRecMenuItemDayChooser::cRecMenuItemDayChooser(cString text,
this->callback = callback;
this->indent = indent;
height = 3 * font->Height() / 2;
// height = 2 * font->Height();
selectedDay = 0;
pixmapWeekdays = NULL;
pixmapWeekdaysSelect = NULL;
@ -2189,13 +2188,13 @@ void cRecMenuItemDayChooser::Show(void) {
void cRecMenuItemDayChooser::SetSizes(void) {
days = trVDR("MTWTFSS");
int maxWidth = 0;
for (unsigned i=0; i<days.length(); ++i) {
for (unsigned i = 0; i < days.length(); ++i) {
int charWidth = font->Width(days.at(i));
if (charWidth > maxWidth)
maxWidth = charWidth;
}
daysSize = min(maxWidth + 15, height-4);
daysX = width - 10 - 7*daysSize;
daysSize = min(maxWidth + 15, height - 4);
daysX = width - 10 - 7 * daysSize;
daysY = (height - daysSize) / 2;
}
@ -2217,13 +2216,13 @@ void cRecMenuItemDayChooser::Draw(void) {
void cRecMenuItemDayChooser::DrawDays(void) {
pixmapWeekdays->Fill(clrTransparent);
int textY = (height - font->Height()) / 2;
pixmapWeekdays->DrawRectangle(cRect(daysX, daysY, 7*daysSize, daysSize), theme.Color(clrBorder));
pixmapWeekdays->DrawRectangle(cRect(daysX, daysY, 7 * daysSize, daysSize), theme.Color(clrBorder));
int currentX = daysX;
for (unsigned day=0; day<days.length(); ++day) {
for (unsigned day = 0; day < days.length(); ++day) {
cString strDay = cString::sprintf("%c", days.at(day));
pixmapWeekdays->DrawRectangle(cRect(currentX+2, daysY+2, daysSize-4, daysSize-4), theme.Color(clrBackground));
tColor colorDay = WeekDaySet(day)?theme.Color(clrRecMenuDayActive)
:theme.Color(clrRecMenuDayInactive);
pixmapWeekdays->DrawRectangle(cRect(currentX + 2, daysY + 2, daysSize - 4, daysSize - 4), theme.Color(clrBackground));
tColor colorDay = WeekDaySet(day) ? theme.Color(clrRecMenuDayActive)
: theme.Color(clrRecMenuDayInactive);
int textX = currentX + (daysSize - font->Width(*strDay)) / 2;
pixmapWeekdays->DrawText(cPoint(textX, textY), *strDay, colorDay, clrTransparent, font);
currentX += daysSize;
@ -2233,7 +2232,7 @@ void cRecMenuItemDayChooser::DrawDays(void) {
void cRecMenuItemDayChooser::DrawHighlight(int day) {
pixmapWeekdaysSelect->Fill(clrTransparent);
if (day > -1) {
int currentX = daysX + day*daysSize;
int currentX = daysX + day * daysSize;
pixmapWeekdaysSelect->DrawRectangle(cRect(currentX, daysY, daysSize, daysSize), theme.Color(clrRecMenuDayHighlight));
}
}
@ -2259,13 +2258,13 @@ eRecMenuState cRecMenuItemDayChooser::ProcessKey(eKeys Key) {
switch (Key & ~k_Repeat) {
case kLeft: {
selectedDay--;
if (selectedDay<0)
if (selectedDay < 0)
selectedDay += 7;
DrawHighlight(selectedDay);
return rmsConsumed;
break; }
case kRight: {
selectedDay = (selectedDay+1)%7;
selectedDay = (selectedDay + 1) % 7;
DrawHighlight(selectedDay);
return rmsConsumed;
break; }

View File

@ -728,6 +728,7 @@ cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer
channelgroupIndex = -1;
std::string dir = sT.directory;
strncpy(directory, dir.c_str(), TEXTINPUTLENGTH);
dayOfWeek = sT.DayOfWeek();
sT.GetSearchModes(&searchModes);
sT.GetUseChannelModes(&useChannelModes);
@ -832,7 +833,7 @@ void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
}
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use day of week"), sT.useDayOfWeek, true, false, &sT.useDayOfWeek, rmsSearchTimerSave));
if (sT.useDayOfWeek)
mainMenuItems.push_back(new cRecMenuItemDayChooser(tr("Day of week"), sT.dayOfWeek, false, &sT.dayOfWeek, 1));
mainMenuItems.push_back(new cRecMenuItemDayChooser(tr("Day of week"), dayOfWeek, false, &dayOfWeek, 1));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use in Favorites"), sT.useInFavorites, false, false, &sT.useInFavorites, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Use as search timer"), sT.useAsSearchTimer, true, false, &sT.useAsSearchTimer, rmsSearchTimerSave));
if (sT.useAsSearchTimer) {
@ -949,7 +950,7 @@ cTVGuideSearchTimer cRecMenuSearchTimerEdit::GetSearchTimer(void) {
}
searchTimer.SetUseDayOfWeek(sT.useDayOfWeek);
if (sT.useDayOfWeek) {
searchTimer.SetDayOfWeek(sT.dayOfWeek);
searchTimer.SetDayOfWeek(dayOfWeek);
}
searchTimer.SetUseAsSearchTimer(sT.useAsSearchTimer);
searchTimer.SetAction(sT.action);

View File

@ -237,6 +237,7 @@ private:
int startChannel;
int stopChannel;
int channelgroupIndex;
int dayOfWeek;
char directory[TEXTINPUTLENGTH];
int SplitChannelGroups(std::vector<std::string> *channelGroups, std::vector<std::string> *channelgroups);
public: