From 463b6369d2e71c7a80885e31287aa22798caf1f3 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Thu, 4 Jul 2019 14:17:08 +0200 Subject: Fixed dayOfWeek error in RecMenuSearchTimerEdit --- recmenuitem.c | 23 +++++++++++------------ recmenus.c | 5 +++-- recmenus.h | 1 + 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/recmenuitem.c b/recmenuitem.c index a58c428..3a0a5ab 100644 --- a/recmenuitem.c +++ b/recmenuitem.c @@ -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; iWidth(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; dayDrawRectangle(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; } diff --git a/recmenus.c b/recmenus.c index 3b1d334..29177e0 100644 --- a/recmenus.c +++ b/recmenus.c @@ -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); diff --git a/recmenus.h b/recmenus.h index 156f423..f50d2cf 100644 --- a/recmenus.h +++ b/recmenus.h @@ -237,6 +237,7 @@ private: int startChannel; int stopChannel; int channelgroupIndex; + int dayOfWeek; char directory[TEXTINPUTLENGTH]; int SplitChannelGroups(std::vector *channelGroups, std::vector *channelgroups); public: -- cgit v1.2.3