2013-01-17 13:16:44 +01:00
|
|
|
#include "footer.h"
|
|
|
|
|
2013-05-31 13:58:22 +02:00
|
|
|
cFooter::cFooter(cChannelGroups *channelGroups) {
|
|
|
|
this->channelGroups = channelGroups;
|
|
|
|
currentGroup = -1;
|
2013-01-17 14:33:53 +01:00
|
|
|
buttonBorder = 20;
|
2013-05-26 11:38:05 +02:00
|
|
|
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
|
|
|
|
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
|
2013-01-17 14:33:53 +01:00
|
|
|
buttonY = (tvguideConfig.footerHeight - buttonHeight)/2;
|
2013-05-26 11:38:05 +02:00
|
|
|
|
2013-05-24 16:23:23 +02:00
|
|
|
footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth,
|
2013-01-17 14:33:53 +01:00
|
|
|
tvguideConfig.osdHeight - tvguideConfig.footerHeight,
|
2013-05-24 16:23:23 +02:00
|
|
|
tvguideConfig.osdWidth - tvguideConfig.timeLineWidth,
|
2013-01-17 14:33:53 +01:00
|
|
|
tvguideConfig.footerHeight),
|
2013-05-20 11:37:37 +02:00
|
|
|
cRect::Null);
|
2013-01-17 14:33:53 +01:00
|
|
|
footer->Fill(clrTransparent);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cFooter::~cFooter(void) {
|
2013-05-20 11:37:37 +02:00
|
|
|
osdManager.releasePixmap(footer);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-31 13:58:22 +02:00
|
|
|
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;
|
|
|
|
footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
|
|
|
|
if (tvguideConfig.useBlending) {
|
|
|
|
cImageLoader imgLoader;
|
|
|
|
imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, buttonWidth-4, buttonHeight-4);
|
|
|
|
footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
|
|
|
|
} else {
|
|
|
|
footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
|
|
|
|
footer->DrawRectangle(cRect(left+2, buttonY+2, buttonWidth-4, buttonHeight-4), color);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-01-17 13:16:44 +01:00
|
|
|
void cFooter::drawRedButton() {
|
2013-01-17 14:33:53 +01:00
|
|
|
cString text(tr("Set Timer"));
|
|
|
|
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), 0);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cFooter::drawGreenButton() {
|
2013-01-17 14:33:53 +01:00
|
|
|
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
|
|
|
|
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-31 13:58:22 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-01-17 13:16:44 +01:00
|
|
|
void cFooter::drawYellowButton() {
|
2013-01-17 14:33:53 +01:00
|
|
|
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
|
|
|
|
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-31 13:58:22 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-01-17 13:16:44 +01:00
|
|
|
void cFooter::drawBlueButton() {
|
2013-06-01 11:08:17 +02:00
|
|
|
cString text;
|
|
|
|
if (tvguideConfig.blueKeyMode == 0)
|
|
|
|
text = tr("Switch to Channel");
|
|
|
|
else if (tvguideConfig.blueKeyMode == 1)
|
|
|
|
text = tr("Detailed EPG");
|
2013-01-17 14:33:53 +01:00
|
|
|
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), 3);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
2013-01-17 14:33:53 +01:00
|
|
|
|
2013-05-31 13:58:22 +02:00
|
|
|
void cFooter::UpdateGroupButtons(const cChannel *channel) {
|
|
|
|
int group = channelGroups->GetGroup(channel);
|
|
|
|
if (group != currentGroup) {
|
|
|
|
currentGroup = group;
|
|
|
|
drawGreenButton(channelGroups->GetPrev(group));
|
|
|
|
drawYellowButton(channelGroups->GetNext(group));
|
2013-05-26 17:04:57 +02:00
|
|
|
}
|
2013-01-17 14:33:53 +01:00
|
|
|
}
|