Added channel group support

This commit is contained in:
louis 2013-05-31 13:58:22 +02:00
parent 4f93ac2516
commit 4f960c48cb
21 changed files with 551 additions and 83 deletions

View File

@ -27,3 +27,9 @@ VDR Plugin 'tvguide' Revision History
- Fixed some Bugs (position of video, deadlock)
- setup of usage of blending now done with clrDoBlending theme color
variable and not by setup
- font color of active grid themable
- avoided nasty font pixelation effects with theme iceblue
- Display of channel groups
- Buttons green / yellow can be configured to jump to prev / next channel
group
- Added setup option to hide last channel group

View File

@ -6,10 +6,12 @@ cChannelColumn::cChannelColumn(int num, const cChannel *channel, cMyTime *myTime
this->myTime = myTime;
hasTimer = channel->HasTimer();
schedulesLock = new cSchedulesLock(false, 100);
header = NULL;
}
cChannelColumn::~cChannelColumn(void) {
delete header;
if (header)
delete header;
grids.Clear();
delete schedulesLock;
}

84
channelgroup.c Normal file
View File

@ -0,0 +1,84 @@
#include "channelgroup.h"
cChannelGroup::cChannelGroup(const char *name) {
channelStart = 0;
channelStop = 0;
this->name = name;
}
cChannelGroup::~cChannelGroup(void) {
}
void cChannelGroup::Dump(void) {
esyslog("tvguide: Group %s, startChannel %d, stopChannel %d", name, channelStart, channelStop);
}
// --- cChannelGroupGrid -------------------------------------------------------------
cChannelGroupGrid::cChannelGroupGrid(const char *name) {
this->name = name;
}
cChannelGroupGrid::~cChannelGroupGrid(void) {
}
void cChannelGroupGrid::SetBackground() {
if (isColor1) {
color = theme.Color(clrGrid1);
colorBlending = theme.Color(clrGrid1Blending);
} else {
color = theme.Color(clrGrid2);
colorBlending = theme.Color(clrGrid2Blending);
}
}
void cChannelGroupGrid::SetGeometry(int start, int end) {
int x, y, width, height;
if (tvguideConfig.displayMode == eVertical) {
x = tvguideConfig.timeLineWidth + start*tvguideConfig.colWidth;
y = tvguideConfig.statusHeaderHeight;
width = (end - start + 1) * tvguideConfig.colWidth;
height = tvguideConfig.channelGroupsHeight;
} else if (tvguideConfig.displayMode == eHorizontal) {
x = 0;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + start*tvguideConfig.rowHeight;
width = tvguideConfig.channelGroupsWidth;
height = (end - start + 1) * tvguideConfig.rowHeight;
}
pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height));
}
void cChannelGroupGrid::Draw(void) {
drawBackground();
drawBorder();
tColor colorText = theme.Color(clrFont);
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
if (tvguideConfig.displayMode == eVertical) {
int textY = (Height() - tvguideConfig.FontChannelGroups->Height()) / 2;
cString text = CutText(name, Width() - 4, tvguideConfig.FontChannelGroups).c_str();
int textWidth = tvguideConfig.FontChannelGroups->Width(*text);
int x = (Width() - textWidth) / 2;
pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, tvguideConfig.FontChannelGroups);
} else if (tvguideConfig.displayMode == eHorizontal) {
std::string nameUpper = name;
std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper);
int numChars = nameUpper.length();
int charHeight = tvguideConfig.FontChannelGroupsHorizontal->Height();
int textHeight = numChars * charHeight;
int y = 5;
if ((textHeight +5) < Height()) {
y = (Height() - textHeight) / 2;
}
for (int i=0; i < numChars; i++) {
if (((y + 2*charHeight) > Height()) && ((i+1)<numChars)) {
int x = (Width() - tvguideConfig.FontChannelGroupsHorizontal->Width("...")) / 2;
pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, tvguideConfig.FontChannelGroupsHorizontal);
break;
}
cString currentChar = cString::sprintf("%c", nameUpper.at(i));
int x = (Width() - tvguideConfig.FontChannelGroupsHorizontal->Width(*currentChar)) / 2;
pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, tvguideConfig.FontChannelGroupsHorizontal);
y += tvguideConfig.FontChannelGroupsHorizontal->Height();
}
}
}

38
channelgroup.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef __TVGUIDE_CHANNELGROUP_H
#define __TVGUIDE_CHANNELGROUP_H
// --- cChannelGroup -------------------------------------------------------------
class cChannelGroup {
private:
int channelStart;
int channelStop;
const char *name;
public:
cChannelGroup(const char *name);
virtual ~cChannelGroup(void);
void SetChannelStart(int start) { channelStart = start; };
int StartChannel(void) { return channelStart; };
void SetChannelStop(int stop) { channelStop = stop; };
int StopChannel(void) { return channelStop; };
const char* GetName(void) { return name; };
void Dump(void);
};
// --- cChannelGroupGrid -------------------------------------------------------------
class cChannelGroupGrid : public cListObject, public cStyledPixmap {
private:
const char *name;
bool isColor1;
public:
cChannelGroupGrid(const char *name);
virtual ~cChannelGroupGrid(void);
void SetColor(bool color) {isColor1 = color;};
void SetBackground(void);
void SetGeometry(int start, int end);
void Draw(void);
};
#endif //__TVGUIDE_CHANNELGROUP_H

137
channelgroups.c Normal file
View File

@ -0,0 +1,137 @@
#include <vector>
#include "channelgroups.h"
cChannelGroups::cChannelGroups(void) {
}
cChannelGroups::~cChannelGroups(void) {
}
void cChannelGroups::ReadChannelGroups(void) {
bool setStart = false;
int lastChannelNumber = 0;
const cChannel *first = Channels.First();
if (!first->GroupSep()) {
channelGroups.push_back(cChannelGroup(tr("Main Program")));
setStart = true;
}
for (const cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) {
if (setStart && (channelGroups.size() > 0)) {
channelGroups[channelGroups.size()-1].SetChannelStart(channel->Number());
setStart = false;
}
if (channel->GroupSep()) {
if (channelGroups.size() > 0) {
channelGroups[channelGroups.size()-1].SetChannelStop(lastChannelNumber);
}
channelGroups.push_back(cChannelGroup(channel->Name()));
setStart = true;
} else {
lastChannelNumber = channel->Number();
}
}
if (channelGroups.size() > 0) {
channelGroups[channelGroups.size()-1].SetChannelStop(lastChannelNumber);
if ((tvguideConfig.hideLastGroup)&&(channelGroups.size() > 1)) {
channelGroups.pop_back();
}
}
}
int cChannelGroups::GetGroup(const cChannel *channel) {
int channelNumber = channel->Number();
int numGroups = channelGroups.size();
if (numGroups) {
for (int i=0; i<numGroups; i++) {
if ((channelGroups[i].StartChannel() <= channelNumber) && ((channelGroups[i].StopChannel() >= channelNumber))) {
return i;
}
}
}
return -1;
}
const char* cChannelGroups::GetPrev(int group) {
if (group > 0) {
return channelGroups[group-1].GetName();
}
return "";
}
const char* cChannelGroups::GetNext(int group) {
if (group > -1) {
if ((group+1) < channelGroups.size())
return channelGroups[group+1].GetName();
}
return "";
}
int cChannelGroups::GetPrevGroupChannelNumber(const cChannel *channel) {
int currentGroup = GetGroup(channel);
if (currentGroup == -1)
return 0;
if (currentGroup > 0) {
return channelGroups[currentGroup-1].StartChannel();
}
return 0;
}
int cChannelGroups::GetNextGroupChannelNumber(const cChannel *channel) {
int currentGroup = GetGroup(channel);
if (currentGroup == -1)
return 0;
if ((currentGroup+1) < channelGroups.size()) {
return channelGroups[currentGroup+1].StartChannel();
}
return 0;
}
bool cChannelGroups::IsInLastGroup(const cChannel *channel) {
if (!tvguideConfig.hideLastGroup)
return false;
if (channelGroups.size() > 0) {
if (channel->Number() > channelGroups[channelGroups.size()-1].StopChannel()) {
return true;
}
}
return false;
}
void cChannelGroups::DrawChannelGroups(const cChannel *start, const cChannel *stop) {
groupGrids.Clear();
int group = GetGroup(start);
int groupLast = group;
int line = 0;
int lineStart = 0;
for (const cChannel *channel = Channels.Next(start); channel; channel = Channels.Next(channel)) {
if (channel->GroupSep())
continue;
group = GetGroup(channel);
if (group != groupLast) {
CreateGroupGrid(channelGroups[groupLast].GetName(), group, lineStart, line);
lineStart = line + 1;
}
line++;
groupLast = group;
if (channel == stop) {
CreateGroupGrid(channelGroups[groupLast].GetName(), group, lineStart, line);
break;
}
}
}
void cChannelGroups::CreateGroupGrid(const char *name, int number, int start, int end) {
cChannelGroupGrid *groupGrid = new cChannelGroupGrid(name);
groupGrid->SetColor(number%2);
groupGrid->SetBackground();
groupGrid->SetGeometry(start, end);
groupGrid->Draw();
groupGrids.Add(groupGrid);
}
void cChannelGroups::DumpGroups(void) {
for (std::vector<cChannelGroup>::iterator group = channelGroups.begin(); group!=channelGroups.end(); ++group) {
group->Dump();
}
}

25
channelgroups.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef __TVGUIDE_CHANNELGROUPS_H
#define __TVGUIDE_CHANNELGROUPS_H
// --- cChannelGroups -------------------------------------------------------------
class cChannelGroups {
private:
std::vector<cChannelGroup> channelGroups;
cList<cChannelGroupGrid> groupGrids;
public:
cChannelGroups(void);
virtual ~cChannelGroups(void);
void ReadChannelGroups(void);
const char* GetPrev(int group);
const char* GetNext(int group);
int GetGroup(const cChannel *channel);
int GetPrevGroupChannelNumber(const cChannel *channel);
int GetNextGroupChannelNumber(const cChannel *channel);
bool IsInLastGroup(const cChannel *channel);
void DrawChannelGroups(const cChannel *start, const cChannel *stop);
void CreateGroupGrid(const char *name, int number, int start, int end);
void DumpGroups(void);
};
#endif //__TVGUIDE_CHANNELGROUPS_H

View File

@ -10,6 +10,10 @@ enum {
eHorizontal
};
enum {
eNumJump,
eGroupJump
};
cTvguideConfig::cTvguideConfig() {
osdWidth = 0;
@ -22,8 +26,12 @@ cTvguideConfig::cTvguideConfig() {
displayTime = 160;
minutePixel = 0;
displayStatusHeader = 1;
displayChannelGroups = 1;
statusHeaderPercent = 20;
statusHeaderHeight = 0;
channelGroupsPercent = 5;
channelGroupsWidth = 0;
channelGroupsHeight = 0;
scaleVideo = 1;
decorateVideo = 1;
timeLineWidthPercent = 8;
@ -35,7 +43,9 @@ cTvguideConfig::cTvguideConfig() {
stepMinutes = 30;
bigStepHours = 3;
hugeStepHours = 24;
channelJumpMode = eNumJump;
jumpChannels = 10;
hideLastGroup = 0;
hideChannelLogos = 0;
logoWidthRatio = 13;
logoHeightRatio = 10;
@ -53,12 +63,14 @@ cTvguideConfig::cTvguideConfig() {
FontStatusHeaderDelta = 0;
FontStatusHeaderLargeDelta = 0;
FontChannelHeaderDelta = 0;
FontChannelGroupsDelta = 0;
FontGridDelta = 0;
FontGridSmallDelta = 0;
FontTimeLineWeekdayDelta = 0;
FontTimeLineDateDelta = 0;
FontTimeLineTimeDelta = 0;
FontChannelHeaderHorizontalDelta = 0;
FontChannelGroupsHorizontalDelta = 0;
FontGridHorizontalDelta = 0;
FontGridHorizontalSmallDelta = 0;
FontTimeLineDateHorizontalDelta = 0;
@ -103,12 +115,14 @@ cTvguideConfig::~cTvguideConfig() {
delete FontStatusHeader;
delete FontStatusHeaderLarge;
delete FontChannelHeader;
delete FontChannelGroups;
delete FontGrid;
delete FontGridSmall;
delete FontTimeLineWeekday;
delete FontTimeLineDate;
delete FontTimeLineTime;
delete FontChannelHeaderHorizontal;
delete FontChannelGroupsHorizontal;
delete FontGridHorizontal;
delete FontGridHorizontalSmall;
delete FontTimeLineDateHorizontal;
@ -124,6 +138,8 @@ void cTvguideConfig::SetGeometry(int width, int height) {
osdWidth = width;
osdHeight = height;
statusHeaderHeight = (displayStatusHeader)?(statusHeaderPercent * osdHeight / 100):0;
channelGroupsWidth = (displayChannelGroups)?(channelGroupsPercent * osdWidth / 100):0;
channelGroupsHeight = (displayChannelGroups)?(channelGroupsPercent * osdHeight / 100):0;
channelHeaderWidth = channelHeaderWidthPercent * osdWidth / 100;
channelHeaderHeight = channelHeaderHeightPercent * osdHeight / 100;
timeLineWidth = timeLineWidthPercent * osdWidth / 100;
@ -132,11 +148,11 @@ void cTvguideConfig::SetGeometry(int width, int height) {
if (displayMode == eVertical) {
colWidth = (osdWidth - timeLineWidth) / channelCols;
rowHeight = 0;
minutePixel = (osdHeight - statusHeaderHeight - channelHeaderHeight - footerHeight) / displayTime;
minutePixel = (osdHeight - statusHeaderHeight - channelGroupsHeight - channelHeaderHeight - footerHeight) / displayTime;
} else if (displayMode == eHorizontal) {
colWidth = 0;
rowHeight = (osdHeight - statusHeaderHeight - timeLineHeight - footerHeight) / channelRows;
minutePixel = (osdWidth - channelHeaderWidth) / displayTime;
minutePixel = (osdWidth - channelHeaderWidth - channelGroupsWidth) / displayTime;
}
numGrids = (displayMode == eVertical)?channelCols:channelRows;
@ -171,6 +187,7 @@ void cTvguideConfig::SetFonts(void){
FontStatusHeaderLarge = cFont::CreateFont(*fontname, statusHeaderHeight/5 + FontStatusHeaderLargeDelta);
//Fonts for vertical Display
FontChannelHeader = cFont::CreateFont(*fontname, colWidth/10 + FontChannelHeaderDelta);
FontChannelGroups = cFont::CreateFont(*fontname, colWidth/8 + FontChannelGroupsDelta);
FontGrid = cFont::CreateFont(*fontname, colWidth/12 + FontGridDelta);
FontGridSmall = cFont::CreateFont(*fontname, colWidth/12 + FontGridSmallDelta);
FontTimeLineWeekday = cFont::CreateFont(*fontname, timeLineWidth/3 + FontTimeLineWeekdayDelta);
@ -178,6 +195,7 @@ void cTvguideConfig::SetFonts(void){
FontTimeLineTime = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineTimeDelta);
//Fonts for horizontal Display
FontChannelHeaderHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + FontChannelHeaderHorizontalDelta);
FontChannelGroupsHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + 5 + FontChannelGroupsHorizontalDelta);
FontGridHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + 5 + FontGridHorizontalDelta);
FontGridHorizontalSmall = cFont::CreateFont(*fontname, rowHeight/4 + FontGridHorizontalSmallDelta);
FontTimeLineDateHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + 5 + FontTimeLineDateHorizontalDelta);
@ -217,7 +235,9 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value);
else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value);
else if (strcmp(Name, "displayStatusHeader") == 0) displayStatusHeader = atoi(Value);
else if (strcmp(Name, "displayChannelGroups") == 0) displayChannelGroups = atoi(Value);
else if (strcmp(Name, "statusHeaderPercent") == 0) statusHeaderPercent = atoi(Value);
else if (strcmp(Name, "channelGroupsPercent") == 0) channelGroupsPercent = atoi(Value);
else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value);
else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value);
else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value);
@ -230,7 +250,9 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "logoHeightRatio") == 0) logoHeightRatio = atoi(Value);
else if (strcmp(Name, "bigStepHours") == 0) bigStepHours = atoi(Value);
else if (strcmp(Name, "hugeStepHours") == 0) hugeStepHours = atoi(Value);
else if (strcmp(Name, "channelJumpMode") == 0) channelJumpMode = atoi(Value);
else if (strcmp(Name, "jumpChannels") == 0) jumpChannels = atoi(Value);
else if (strcmp(Name, "hideLastGroup") == 0) hideLastGroup = atoi(Value);
else if (strcmp(Name, "hideEpgImages") == 0) hideEpgImages = atoi(Value);
else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value);
else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value);
@ -248,13 +270,15 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "FontMessageBoxLargeDelta") == 0) FontMessageBoxLargeDelta = atoi(Value);
else if (strcmp(Name, "FontStatusHeaderDelta") == 0) FontStatusHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontStatusHeaderLargeDelta") == 0) FontStatusHeaderLargeDelta = atoi(Value);
else if (strcmp(Name, "FontChannelHeaderDelta") == 0) FontChannelHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontChannelHeaderDelta") == 0) FontChannelHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontChannelGroupsDelta") == 0) FontChannelGroupsDelta = atoi(Value);
else if (strcmp(Name, "FontGridDelta") == 0) FontGridDelta = atoi(Value);
else if (strcmp(Name, "FontGridSmallDelta") == 0) FontGridSmallDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineWeekdayDelta") == 0) FontTimeLineWeekdayDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineDateDelta") == 0) FontTimeLineDateDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineTimeDelta") == 0) FontTimeLineTimeDelta = atoi(Value);
else if (strcmp(Name, "FontChannelHeaderHorizontalDelta") == 0) FontChannelHeaderHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontChannelGroupsHorizontalDelta") == 0) FontChannelGroupsHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontGridHorizontalDelta") == 0) FontGridHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontGridHorizontalSmallDelta") == 0) FontGridHorizontalSmallDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineDateHorizontalDelta") == 0) FontTimeLineDateHorizontalDelta = atoi(Value);

View File

@ -22,8 +22,12 @@ class cTvguideConfig {
int displayTime;
int minutePixel;
int displayStatusHeader;
int displayChannelGroups;
int statusHeaderPercent;
int statusHeaderHeight;
int channelGroupsPercent;
int channelGroupsWidth;
int channelGroupsHeight;
int scaleVideo;
int decorateVideo;
int timeLineWidthPercent;
@ -39,7 +43,9 @@ class cTvguideConfig {
int stepMinutes;
int bigStepHours;
int hugeStepHours;
int channelJumpMode;
int jumpChannels;
int hideLastGroup;
int hideChannelLogos;
int logoWidthRatio;
int logoHeightRatio;
@ -59,18 +65,22 @@ class cTvguideConfig {
int FontStatusHeaderDelta;
int FontStatusHeaderLargeDelta;
int FontChannelHeaderDelta;
int FontChannelGroupsDelta;
int FontGridDelta;
int FontGridSmallDelta;
int FontTimeLineWeekdayDelta;
int FontTimeLineDateDelta;
int FontTimeLineTimeDelta;
int FontChannelHeaderHorizontalDelta;
int FontChannelGroupsHorizontalDelta;
int FontGridHorizontalDelta;
int FontGridHorizontalSmallDelta;
int FontTimeLineDateHorizontalDelta;
int FontTimeLineTimeHorizontalDelta;
const cFont *FontChannelHeader;
const cFont *FontChannelHeaderHorizontal;
const cFont *FontChannelGroups;
const cFont *FontChannelGroupsHorizontal;
const cFont *FontStatusHeader;
const cFont *FontStatusHeaderLarge;
const cFont *FontGrid;

View File

@ -21,7 +21,7 @@ void cDummyGrid::PositionPixmap() {
int x0, y0;
if (tvguideConfig.displayMode == eVertical) {
x0 = column->getX();
y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight;
y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight;
if ( column->Start() < StartTime() ) {
y0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel;
}
@ -34,7 +34,7 @@ void cDummyGrid::PositionPixmap() {
pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight));
}
} else if (tvguideConfig.displayMode == eHorizontal) {
x0 = tvguideConfig.channelHeaderWidth;
x0 = tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth;
y0 = column->getY();
if ( column->Start() < StartTime() ) {
x0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel;

View File

@ -33,7 +33,7 @@ void cEpgGrid::PositionPixmap() {
int x0, y0;
if (tvguideConfig.displayMode == eVertical) {
int x0 = column->getX();
int y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight;
int y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight;
if ( column->Start() < StartTime() ) {
y0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel;
}
@ -44,7 +44,7 @@ void cEpgGrid::PositionPixmap() {
pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight));
}
} else if (tvguideConfig.displayMode == eHorizontal) {
int x0 = tvguideConfig.channelHeaderWidth;
int x0 = tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth;
int y0 = column->getY();
if ( column->Start() < StartTime() ) {
x0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel;

View File

@ -1,6 +1,8 @@
#include "footer.h"
cFooter::cFooter() {
cFooter::cFooter(cChannelGroups *channelGroups) {
this->channelGroups = channelGroups;
currentGroup = -1;
buttonBorder = 20;
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
@ -18,26 +20,6 @@ cFooter::~cFooter(void) {
osdManager.releasePixmap(footer);
}
void cFooter::drawRedButton() {
cString text(tr("Set Timer"));
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), 0);
}
void cFooter::drawGreenButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1);
}
void cFooter::drawYellowButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2);
}
void cFooter::drawBlueButton() {
cString text(tr("Switch to Channel"));
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), 3);
}
void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) {
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
int left = num * buttonWidth + (num + 1) * buttonBorder;
@ -53,4 +35,43 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int
int textWidth = tvguideConfig.FontButton->Width(text);
int textHeight = tvguideConfig.FontButton->Height();
footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, tvguideConfig.FontButton);
}
void cFooter::drawRedButton() {
cString text(tr("Set Timer"));
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), 0);
}
void cFooter::drawGreenButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1);
}
void cFooter::drawGreenButton(const char *text) {
std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1);
}
void cFooter::drawYellowButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2);
}
void cFooter::drawYellowButton(const char *text) {
std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2);
}
void cFooter::drawBlueButton() {
cString text(tr("Switch to Channel"));
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), 3);
}
void cFooter::UpdateGroupButtons(const cChannel *channel) {
int group = channelGroups->GetGroup(channel);
if (group != currentGroup) {
currentGroup = group;
drawGreenButton(channelGroups->GetPrev(group));
drawYellowButton(channelGroups->GetNext(group));
}
}

View File

@ -10,14 +10,19 @@ private:
int buttonHeight;
int buttonY;
int buttonBorder;
cChannelGroups *channelGroups;
int currentGroup;
void DrawButton(const char *text, tColor color, tColor borderColor, int num);
public:
cFooter();
cFooter(cChannelGroups *channelGroups);
virtual ~cFooter(void);
void drawRedButton();
void drawGreenButton();
void drawYellowButton();
void drawGreenButton(const char *text);
void drawYellowButton(const char *text);
void drawBlueButton();
void UpdateGroupButtons(const cChannel *channel);
};
#endif //__TVGUIDE_FOOTER_H

View File

@ -15,11 +15,11 @@ void cHeaderGrid::createBackground(int num) {
int x, y, width, height;
if (tvguideConfig.displayMode == eVertical) {
x = tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth;
y = tvguideConfig.statusHeaderHeight;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.channelGroupsHeight;
width = tvguideConfig.colWidth;
height = tvguideConfig.channelHeaderHeight;
} else if (tvguideConfig.displayMode == eHorizontal) {
x = 0;
x = tvguideConfig.channelGroupsWidth;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight;
width = tvguideConfig.channelHeaderWidth;
height = tvguideConfig.rowHeight;
@ -114,11 +114,11 @@ void cHeaderGrid::setPosition(int num) {
int x, y, width, height;
if (tvguideConfig.displayMode == eVertical) {
x = tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth;
y = tvguideConfig.statusHeaderHeight;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.channelGroupsHeight;
width = tvguideConfig.colWidth;
height = tvguideConfig.channelHeaderHeight;
} else if (tvguideConfig.displayMode == eHorizontal) {
x = 0;
x = tvguideConfig.channelGroupsWidth;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight;
width = tvguideConfig.channelHeaderWidth;
height = tvguideConfig.rowHeight;

View File

@ -38,8 +38,6 @@ bool cOsdManager::setOsd() {
}
void cOsdManager::setBackground() {
esyslog("tvguide: %d %d", Width(), Height());
if (tvguideConfig.displayStatusHeader && tvguideConfig.scaleVideo) {
int widthStatus = cOsd::OsdWidth() - tvguideConfig.statusHeaderHeight * 16 / 9;
osd->DrawRectangle(0, 0, widthStatus, tvguideConfig.statusHeaderHeight, theme.Color(clrBackgroundOSD));

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-05-28 16:45+0200\n"
"POT-Creation-Date: 2013-05-31 11:43+0200\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n"
"Language-Team: \n"
@ -12,6 +12,9 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Main Program"
msgstr "Hauptprogramm"
msgid "RERUNS OF THIS SHOW"
msgstr "Wiederholungen dieser Sendung"
@ -39,6 +42,12 @@ msgstr "Anzeigeoptionen"
msgid "Fonts and Fontsizes"
msgstr "Schriften und Schriftgrößen"
msgid "x channels back / forward"
msgstr "x Kanäle zurück / vor"
msgid "previous / next channel group"
msgstr "vorherige / nächste Kanalgruppe"
msgid "never"
msgstr "nie"
@ -54,8 +63,14 @@ msgstr "Theme"
msgid "Rounded Corners"
msgstr "Abgerundete Ecken"
msgid "Channels to Jump (Keys Green / Yellow)"
msgstr "Kanalsprung (Tasten Grün / Gelb)"
msgid "Channel Jump Mode (Keys Green / Yellow)"
msgstr "Kanalsprung Modus (Tasten grün / gelb)"
msgid "Channels to Jump"
msgstr "Anzahl der Kanäle"
msgid "Hide last Channel Group"
msgstr "Letzte Kanalgruppe verstecken"
msgid "Time to display in minutes"
msgstr "Angezeigte Zeitspanne in Minuten"
@ -114,6 +129,15 @@ msgstr "Abgerundete Ecken um Videofenster"
msgid "Display Channel Names in Header"
msgstr "Kanalnamen im Header anzeigen"
msgid "Display channel groups"
msgstr "Kanalgruppen anzeigen"
msgid "Height of channel groups (Perc. of osd height)"
msgstr "Höhe der Kanalgruppen (% der OSD Höhe)"
msgid "Width of channel groups (Perc. of osd width)"
msgstr "Breite der Kanalgruppen (% der OSD Breite)"
msgid "Show Channel Logos"
msgstr "Kanallogos anzeigen"
@ -168,6 +192,9 @@ msgstr "Button Schriftgröße"
msgid "Channel Header Font Size"
msgstr "Kanal Header Schriftgröße"
msgid "Channel Groups Font Size"
msgstr "Kanalgruppen Schriftgröße"
msgid "Grid Font Size"
msgstr "Grid Schriftgröße"
@ -188,6 +215,3 @@ msgstr "Timer wurde nicht gesetzt! Es existiert bereits ein Timer für diese Sen
msgid "Timer set"
msgstr "Timer gesetzt"
#~ msgid "Use color gradients"
#~ msgstr "Farbverläufe verwenden"

27
setup.c
View File

@ -48,7 +48,9 @@ void cTvguideSetup::Store(void) {
SetupStore("themeIndex", tvguideConfig.themeIndex);
SetupStore("displayMode", tvguideConfig.displayMode);
SetupStore("displayStatusHeader", tvguideConfig.displayStatusHeader);
SetupStore("displayChannelGroups", tvguideConfig.displayChannelGroups);
SetupStore("statusHeaderPercent", tvguideConfig.statusHeaderPercent);
SetupStore("channelGroupsPercent", tvguideConfig.channelGroupsPercent);
SetupStore("scaleVideo", tvguideConfig.scaleVideo);
SetupStore("decorateVideo", tvguideConfig.decorateVideo);
SetupStore("roundedCorners", tvguideConfig.roundedCorners);
@ -58,7 +60,9 @@ void cTvguideSetup::Store(void) {
SetupStore("displayTime", tvguideConfig.displayTime);
SetupStore("bigStepHours", tvguideConfig.bigStepHours);
SetupStore("hugeStepHours", tvguideConfig.hugeStepHours);
SetupStore("channelJumpMode", tvguideConfig.channelJumpMode);
SetupStore("jumpChannels", tvguideConfig.jumpChannels);
SetupStore("hideLastGroup", tvguideConfig.hideLastGroup);
SetupStore("hideChannelLogos", tvguideConfig.hideChannelLogos);
SetupStore("logoExtension", tvguideConfig.logoExtension);
SetupStore("logoWidthRatio", tvguideConfig.logoWidthRatio);
@ -82,12 +86,14 @@ void cTvguideSetup::Store(void) {
SetupStore("FontStatusHeaderDelta", tvguideConfig.FontStatusHeaderDelta);
SetupStore("FontStatusHeaderLargeDelta", tvguideConfig.FontStatusHeaderLargeDelta);
SetupStore("FontChannelHeaderDelta", tvguideConfig.FontChannelHeaderDelta);
SetupStore("FontChannelGroupsDelta", tvguideConfig.FontChannelGroupsDelta);
SetupStore("FontGridDelta", tvguideConfig.FontGridDelta);
SetupStore("FontGridSmallDelta", tvguideConfig.FontGridSmallDelta);
SetupStore("FontTimeLineWeekdayDelta", tvguideConfig.FontTimeLineWeekdayDelta);
SetupStore("FontTimeLineDateDelta", tvguideConfig.FontTimeLineDateDelta);
SetupStore("FontTimeLineTimeDelta", tvguideConfig.FontTimeLineTimeDelta);
SetupStore("FontChannelHeaderHorizontalDelta", tvguideConfig.FontChannelHeaderHorizontalDelta);
SetupStore("FontChannelGroupsHorizontalDelta", tvguideConfig.FontChannelGroupsHorizontalDelta);
SetupStore("FontGridHorizontalDelta", tvguideConfig.FontGridHorizontalDelta);
SetupStore("FontGridHorizontalSmallDelta", tvguideConfig.FontGridHorizontalSmallDelta);
SetupStore("FontTimeLineDateHorizontalDelta", tvguideConfig.FontTimeLineDateHorizontalDelta);
@ -127,6 +133,8 @@ cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu(
themes.Load(*cString("tvguide"));
timeFormatItems[0] = "12h";
timeFormatItems[1] = "24h";
jumpMode[0] = tr("x channels back / forward");
jumpMode[1] = tr("previous / next channel group");
useSubtitleRerunTexts[0] = tr("never");
useSubtitleRerunTexts[1] = tr("if exists");
useSubtitleRerunTexts[2] = tr("always");
@ -140,8 +148,12 @@ void cMenuSetupGeneral::Set(void) {
if (themes.NumThemes())
Add(new cMenuEditStraItem(tr("Theme"), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions()));
Add(new cMenuEditBoolItem(tr("Rounded Corners"), &tmpTvguideConfig->roundedCorners));
Add(new cMenuEditIntItem(tr("Channels to Jump (Keys Green / Yellow)"), &tmpTvguideConfig->jumpChannels, 2, 30));
Add(new cMenuEditStraItem(tr("Channel Jump Mode (Keys Green / Yellow)"), &tmpTvguideConfig->channelJumpMode, 2, jumpMode));
if (tmpTvguideConfig->channelJumpMode == eNumJump) {
Add(new cMenuEditIntItem(cString::sprintf("%s%s", indent, tr("Channels to Jump")), &tmpTvguideConfig->jumpChannels, 2, 30));
}
Add(new cMenuEditBoolItem(tr("Hide last Channel Group"), &tmpTvguideConfig->hideLastGroup));
Add(new cMenuEditIntItem(tr("Time to display in minutes"), &tmpTvguideConfig->displayTime, 120, 320));
Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12));
Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48));
@ -203,6 +215,15 @@ void cMenuSetupScreenLayout::Set(void) {
}
Add(new cMenuEditBoolItem(tr("Display Channel Names in Header"), &tmpTvguideConfig->displayChannelName));
Add(new cMenuEditBoolItem(tr("Display channel groups"), &tmpTvguideConfig->displayChannelGroups));
if (tmpTvguideConfig->displayChannelGroups) {
if (tmpTvguideConfig->displayMode == eVertical) {
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of channel groups (Perc. of osd height)")), &tmpTvguideConfig->channelGroupsPercent, 3, 30));
} else if (tmpTvguideConfig->displayMode == eHorizontal) {
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Width of channel groups (Perc. of osd width)")), &tmpTvguideConfig->channelGroupsPercent, 3, 30));
}
}
Add(new cMenuEditStraItem(tr("Show Channel Logos"), &tmpTvguideConfig->hideChannelLogos, 2, hideChannelLogosItems));
if (!tmpTvguideConfig->hideChannelLogos) {
Add(InfoItem(tr("Logo Path used"), *tvguideConfig.logoPath));
@ -257,6 +278,7 @@ void cMenuSetupFont::Set(void) {
if (tmpTvguideConfig->displayMode == eVertical) {
Add(new cMenuEditIntItem(tr("Channel Header Font Size"), &tmpTvguideConfig->FontChannelHeaderDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Channel Groups Font Size"), &tmpTvguideConfig->FontChannelGroupsDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Grid Font Size"), &tmpTvguideConfig->FontGridDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Grid Font Small Size"), &tmpTvguideConfig->FontGridSmallDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Timeline Weekday Font Size"), &tmpTvguideConfig->FontTimeLineWeekdayDelta, -30, 30));
@ -264,6 +286,7 @@ void cMenuSetupFont::Set(void) {
Add(new cMenuEditIntItem(tr("Timeline Time Font Size"), &tmpTvguideConfig->FontTimeLineTimeDelta, -30, 30));
} else if (tmpTvguideConfig->displayMode == eHorizontal) {
Add(new cMenuEditIntItem(tr("Channel Header Font Size"), &tmpTvguideConfig->FontChannelHeaderHorizontalDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Channel Groups Font Size"), &tmpTvguideConfig->FontChannelGroupsHorizontalDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Grid Font Size"), &tmpTvguideConfig->FontGridHorizontalDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Grid Font Small Size"), &tmpTvguideConfig->FontGridHorizontalSmallDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Timeline Date Font Size"), &tmpTvguideConfig->FontTimeLineDateHorizontalDelta, -30, 30));

View File

@ -29,6 +29,7 @@ class cMenuSetupGeneral : public cMenuSetupSubMenu {
virtual eOSState ProcessKey(eKeys Key);
cThemes themes;
const char * timeFormatItems[2];
const char * jumpMode[2];
const char *useSubtitleRerunTexts[3];
void Set(void);
public:

View File

@ -6,11 +6,11 @@ cTimeLine::cTimeLine(cMyTime *myTime) {
dateViewer = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0,
tvguideConfig.statusHeaderHeight,
tvguideConfig.timeLineWidth,
tvguideConfig.channelHeaderHeight)));
tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight)));
timeline = osdManager.requestPixmap(2, cRect(0,
tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight,
tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight,
tvguideConfig.timeLineWidth,
tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)
tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight)
, cRect(0,
0,
tvguideConfig.timeLineWidth,
@ -18,11 +18,11 @@ cTimeLine::cTimeLine(cMyTime *myTime) {
} else if (tvguideConfig.displayMode == eHorizontal) {
dateViewer = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0,
tvguideConfig.statusHeaderHeight,
tvguideConfig.channelHeaderWidth,
tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth,
tvguideConfig.timeLineHeight)));
timeline = osdManager.requestPixmap(2, cRect(tvguideConfig.channelHeaderWidth,
timeline = osdManager.requestPixmap(2, cRect(tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth,
tvguideConfig.statusHeaderHeight,
tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth,
tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth,
tvguideConfig.timeLineHeight)
, cRect(0,
0,
@ -54,8 +54,8 @@ void cTimeLine::drawDateViewer() {
int textHeight = tvguideConfig.FontTimeLineWeekday->Height();
int weekdayWidth = tvguideConfig.FontTimeLineWeekday->Width(*weekDay);
int dateWidth = tvguideConfig.FontTimeLineDate->Width(*date);
dateViewer->DrawText(cPoint((tvguideConfig.timeLineWidth-weekdayWidth)/2, (tvguideConfig.channelHeaderHeight-2*textHeight)/2), *weekDay, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineWeekday);
dateViewer->DrawText(cPoint((tvguideConfig.timeLineWidth-dateWidth)/2, (tvguideConfig.channelHeaderHeight-2*textHeight)/2 + textHeight + 5), *date, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineDate);
dateViewer->DrawText(cPoint((tvguideConfig.timeLineWidth-weekdayWidth)/2, (tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight -2*textHeight)/2), *weekDay, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineWeekday);
dateViewer->DrawText(cPoint((tvguideConfig.timeLineWidth-dateWidth)/2, (tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight -2*textHeight)/2 + textHeight + 5), *date, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineDate);
} else if (tvguideConfig.displayMode == eHorizontal) {
cString strDate = cString::sprintf("%s %s", *weekDay, *date);
int x = (dateViewer->Width() - tvguideConfig.FontTimeLineDateHorizontal->Width(*strDate))/2;

View File

@ -16,9 +16,9 @@ void cMyTime::Now() {
tStart = t;
tStart = GetRounded();
if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) {
tEnd = tStart + (tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth)/tvguideConfig.minutePixel*60;
tEnd = tStart + (tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth)/tvguideConfig.minutePixel*60;
}
}
@ -39,9 +39,9 @@ bool cMyTime::DelStep(int step) {
void cMyTime::SetTime(time_t newTime) {
tStart = newTime;
if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) {
tEnd = tStart + (tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth)/tvguideConfig.minutePixel*60;
tEnd = tStart + (tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth)/tvguideConfig.minutePixel*60;
}
}

View File

@ -57,6 +57,8 @@ cOsdManager osdManager;
#include "statusheader.c"
#include "detailview.c"
#include "channelcolumn.c"
#include "channelgroup.c"
#include "channelgroups.c"
#include "footer.c"
#include "tvguideosd.h"
@ -78,6 +80,7 @@ cTvGuideOsd::~cTvGuideOsd() {
if (detailView)
delete detailView;
delete timeLine;
delete channelGroups;
delete footer;
cMessageBox::Destroy();
osdManager.deleteOsd();
@ -110,10 +113,15 @@ void cTvGuideOsd::drawOsd() {
timeLine->drawDateViewer();
timeLine->drawTimeline();
timeLine->drawClock();
footer = new cFooter();
channelGroups = new cChannelGroups();
channelGroups->ReadChannelGroups();
//channelGroups->DumpGroups();
footer = new cFooter(channelGroups);
footer->drawRedButton();
footer->drawGreenButton();
footer->drawYellowButton();
if (tvguideConfig.channelJumpMode == eNumJump) {
footer->drawGreenButton();
footer->drawYellowButton();
}
footer->drawBlueButton();
osdManager.flush();
readChannels(startChannel);
@ -124,21 +132,34 @@ void cTvGuideOsd::drawOsd() {
void cTvGuideOsd::readChannels(const cChannel *channelStart) {
int i=0;
bool foundEnough = false;
columns.Clear();
if (!channelStart)
return;
for (const cChannel *channel = channelStart; channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep()) {
cChannelColumn *column = new cChannelColumn(i, channel, myTime);
if (column->readGrids()) {
columns.Add(column);
i++;
} else {
delete column;
if (!channel->GroupSep()) {
if (channelGroups->IsInLastGroup(channel)) {
break;
}
cChannelColumn *column = new cChannelColumn(i, channel, myTime);
if (column->readGrids()) {
columns.Add(column);
i++;
} else {
delete column;
}
}
}
if (i == tvguideConfig.numGrids)
break;
if (i == tvguideConfig.numGrids) {
foundEnough = true;
break;
}
}
if (!foundEnough) {
int numCurrent = columns.Count();
int numBack = tvguideConfig.numGrids - numCurrent;
int newChannelNumber = columns.First()->getChannel()->Number() - numBack;
const cChannel *newStart = Channels.GetByNumber(newChannelNumber);
readChannels(newStart);
}
}
@ -151,6 +172,12 @@ void cTvGuideOsd::drawGridsChannelJump() {
if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid);
}
if (activeGrid && (tvguideConfig.channelJumpMode == eGroupJump)) {
footer->UpdateGroupButtons(activeGrid->column->getChannel());
}
if (tvguideConfig.displayChannelGroups) {
channelGroups->DrawChannelGroups(columns.First()->getChannel(), columns.Last()->getChannel());
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->createHeader();
column->drawGrids();
@ -197,10 +224,14 @@ void cTvGuideOsd::setNextActiveGrid(cGrid *next) {
void cTvGuideOsd::channelForward() {
cChannelColumn *colRight = columns.Next(activeGrid->column);
bool colAdded = false;
if (!colRight) {
const cChannel *channelRight = activeGrid->column->getChannel();
while (channelRight = Channels.Next(channelRight)) {
if (!channelRight->GroupSep()) {
if (channelGroups->IsInLastGroup(channelRight)) {
break;
}
colRight = new cChannelColumn(tvguideConfig.numGrids - 1, channelRight, myTime);
if (colRight->readGrids()) {
break;
@ -211,6 +242,7 @@ void cTvGuideOsd::channelForward() {
}
}
if (colRight) {
colAdded = true;
if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cFirst = columns.First();
columns.Del(cFirst);
@ -231,11 +263,18 @@ void cTvGuideOsd::channelForward() {
setNextActiveGrid(right);
}
}
if (tvguideConfig.displayChannelGroups && colAdded) {
channelGroups->DrawChannelGroups(columns.First()->getChannel(), columns.Last()->getChannel());
}
if (activeGrid && (tvguideConfig.channelJumpMode == eGroupJump)) {
footer->UpdateGroupButtons(activeGrid->column->getChannel());
}
osdManager.flush();
}
void cTvGuideOsd::channelBack() {
cChannelColumn *colLeft = columns.Prev(activeGrid->column);
bool colAdded = false;
if (!colLeft) {
const cChannel *channelLeft = activeGrid->column->getChannel();
while (channelLeft = Channels.Prev(channelLeft)) {
@ -250,6 +289,7 @@ void cTvGuideOsd::channelBack() {
}
}
if (colLeft) {
colAdded = true;
if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cLast = columns.Last();
columns.Del(cLast);
@ -271,6 +311,13 @@ void cTvGuideOsd::channelBack() {
setNextActiveGrid(left);
}
}
if (tvguideConfig.displayChannelGroups && colAdded) {
channelGroups->DrawChannelGroups(columns.First()->getChannel(), columns.Last()->getChannel());
}
if (activeGrid && (tvguideConfig.channelJumpMode == eGroupJump)) {
footer->UpdateGroupButtons(activeGrid->column->getChannel());
}
osdManager.flush();
}
@ -440,16 +487,25 @@ void cTvGuideOsd::processKeyRed() {
void cTvGuideOsd::processKeyGreen() {
if (activeGrid == NULL)
return;
const cChannel *currentChannel = activeGrid->column->getChannel();
const cChannel *prev = NULL;
int i = tvguideConfig.jumpChannels + 1;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Prev(channel)) {
if (!channel->GroupSep()) {
prev = channel;
i--;
if (tvguideConfig.channelJumpMode == eGroupJump) {
int prevNum = channelGroups->GetPrevGroupChannelNumber(currentChannel);
if (prevNum) {
prev = Channels.GetByNumber(prevNum);
}
} else if (tvguideConfig.channelJumpMode == eNumJump) {
int i = tvguideConfig.jumpChannels + 1;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Prev(channel)) {
if (!channel->GroupSep()) {
prev = channel;
i--;
}
if (i == 0)
break;
}
if (i == 0)
break;
}
if (prev) {
readChannels(prev);
@ -463,16 +519,29 @@ void cTvGuideOsd::processKeyGreen() {
void cTvGuideOsd::processKeyYellow() {
if (activeGrid == NULL)
return;
const cChannel *currentChannel = activeGrid->column->getChannel();
const cChannel *next = NULL;
int i=0;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep()) {
next = channel;
i++;
if (tvguideConfig.channelJumpMode == eGroupJump) {
int nextNum = channelGroups->GetNextGroupChannelNumber(currentChannel);
if (nextNum) {
next = Channels.GetByNumber(nextNum);
}
} else if (tvguideConfig.channelJumpMode == eNumJump) {
int i=0;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Next(channel)) {
if (channelGroups->IsInLastGroup(channel)) {
break;
}
if (!channel->GroupSep()) {
next = channel;
i++;
}
if (i == (tvguideConfig.jumpChannels+1)) {
break;
}
}
if (i == (tvguideConfig.jumpChannels+1))
break;
}
if (next) {
readChannels(next);

View File

@ -11,6 +11,7 @@ private:
cStatusHeader *statusHeader;
cDetailView *detailView;
cTimeLine *timeLine;
cChannelGroups *channelGroups;
cFooter *footer;
bool detailViewActive;
void drawOsd();