Fixed horizontal alignment in timeline

This commit is contained in:
kamel5 2020-03-05 14:46:52 +01:00
parent 7ec89bf12b
commit eb3a4113be
3 changed files with 12 additions and 20 deletions

View File

@ -2430,7 +2430,7 @@ void cRecMenuItemTimelineHeader::DrawTimeline(void) {
pixmapTimeline->Fill(clrTransparent); pixmapTimeline->Fill(clrTransparent);
width5Mins = (float)width * 5.0 / 24.0 / 60.0; width5Mins = (float)width * 5.0 / 24.0 / 60.0;
int widthHour = 12 * width5Mins; int widthHour = 12 * width5Mins;
x0 = (width - 24*widthHour)/2; x0 = (width - (24 * widthHour)) / 2;
int barHeight = fontSmall->Height(); int barHeight = fontSmall->Height();
int y = height - barHeight; int y = height - barHeight;
tColor col1 = theme.Color(clrTimeline1); tColor col1 = theme.Color(clrTimeline1);
@ -2535,7 +2535,8 @@ void cRecMenuItemTimelineTimer::SetPixmaps(void) {
} }
width5Mins = (float)width * 5.0 / 24.0 / 60.0; width5Mins = (float)width * 5.0 / 24.0 / 60.0;
x0 = (width - 24*12*width5Mins)/2; int widthHour = 12 * width5Mins;
x0 = (width - (24 * widthHour)) / 2;
} }
void cRecMenuItemTimelineTimer::Draw(void) { void cRecMenuItemTimelineTimer::Draw(void) {

View File

@ -573,7 +573,7 @@ private:
cPixmap *pixmapTimeline; cPixmap *pixmapTimeline;
cPixmap *pixmapTimerInfo; cPixmap *pixmapTimerInfo;
cPixmap *pixmapTimerConflicts; cPixmap *pixmapTimerConflicts;
int width5Mins; float width5Mins;
int x0; int x0;
int numTimersToday; int numTimersToday;
bool timelineDrawn; bool timelineDrawn;
@ -603,7 +603,7 @@ private:
cPixmap *pixmapTimerConflicts; cPixmap *pixmapTimerConflicts;
cRecMenuItemTimelineHeader *header; cRecMenuItemTimelineHeader *header;
int x0; int x0;
int width5Mins; float width5Mins;
time_t start; time_t start;
time_t stop; time_t stop;
void DrawBackground(void); void DrawBackground(void);

View File

@ -1413,7 +1413,7 @@ cRecMenuTimeline::cRecMenuTimeline(cTVGuideTimerConflicts *timerConflicts) {
SetStartStop(); SetStartStop();
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop); conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
GetTimersForDay(); GetTimersForDay();
SetWidthPercent(95); SetWidthPercent(90);
header = new cRecMenuItemTimelineHeader(timeStart, numTimersToday, conflictsToday); header = new cRecMenuItemTimelineHeader(timeStart, numTimersToday, conflictsToday);
SetHeader(header); SetHeader(header);
cRecMenuItem *footer = new cRecMenuItemButton(tr("Close"), rmsClose, false, true); cRecMenuItem *footer = new cRecMenuItemButton(tr("Close"), rmsClose, false, true);
@ -1457,10 +1457,14 @@ void cRecMenuTimeline::GetTimersForDay(void) {
void cRecMenuTimeline::SetTimers(void) { void cRecMenuTimeline::SetTimers(void) {
ClearMenu(); ClearMenu();
GetTimersForDay();
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
header->UnsetCurrentTimer();
header->SetDay(timeStart);
header->RefreshTimerDisplay();
header->SetNumTimersToday(numTimersToday);
if (numTimersToday == 0) { if (numTimersToday == 0) {
AddMenuItem(new cRecMenuItemTimelineTimer(NULL, 0, 0, conflictsToday, header, false)); AddMenuItem(new cRecMenuItemTimelineTimer(NULL, 0, 0, conflictsToday, header, false));
header->UnsetCurrentTimer();
header->SetNumTimersToday(0);
footer->setActive(); footer->setActive();
} else { } else {
for (int i = 0; i<numTimersToday; i++) { for (int i = 0; i<numTimersToday; i++) {
@ -1469,7 +1473,6 @@ void cRecMenuTimeline::SetTimers(void) {
item->setActive(); item->setActive();
if (!AddMenuItemInitial(item)) if (!AddMenuItemInitial(item))
break; break;
header->SetNumTimersToday(numTimersToday);
} }
footer->setInactive(); footer->setInactive();
} }
@ -1483,12 +1486,6 @@ void cRecMenuTimeline::PrevDay(void) {
return; return;
timeStart -= 3600*24; timeStart -= 3600*24;
timeStop -= 3600*24; timeStop -= 3600*24;
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
SetWidthPercent(95);
header->SetDay(timeStart);
header->UnsetCurrentTimer();
header->RefreshTimerDisplay();
GetTimersForDay();
SetTimers(); SetTimers();
Display(); Display();
} }
@ -1496,12 +1493,6 @@ void cRecMenuTimeline::PrevDay(void) {
void cRecMenuTimeline::NextDay(void) { void cRecMenuTimeline::NextDay(void) {
timeStart += 3600*24; timeStart += 3600*24;
timeStop += 3600*24; timeStop += 3600*24;
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
SetWidthPercent(95);
header->SetDay(timeStart);
header->UnsetCurrentTimer();
header->RefreshTimerDisplay();
GetTimersForDay();
SetTimers(); SetTimers();
Display(); Display();
} }