summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--displaychannel.c143
-rw-r--r--displaychannel.h3
-rw-r--r--helpers.c29
-rw-r--r--menuitem.c40
-rw-r--r--menuitem.h1
6 files changed, 141 insertions, 76 deletions
diff --git a/HISTORY b/HISTORY
index 0c5ccc9..b5b97da 100644
--- a/HISTORY
+++ b/HISTORY
@@ -208,3 +208,4 @@ Version 0.1.2
time in hours or free disc space in GB is displayed
- Fixed a bug that slow motion trick speed during recording replay was not
displayed
+- Added previous and next Channel Group in Channel Display
diff --git a/displaychannel.c b/displaychannel.c
index f7a3690..a6db48f 100644
--- a/displaychannel.c
+++ b/displaychannel.c
@@ -183,7 +183,7 @@ void cNopacityDisplayChannel::DrawBackground(void){
pixmapBackgroundMiddle->Fill(Theme.Color(clrChannelBackground));
DrawBlendedBackground(pixmapBackgroundBottom, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false);
- if (config.backgroundStyle == bsFull) {
+ if ((config.backgroundStyle == bsFull) && withInfo) {
pixmapLogoBackground->Fill(Theme.Color(clrChannelBackground));
DrawBlendedBackground(pixmapLogoBackgroundTop, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), true);
DrawBlendedBackground(pixmapLogoBackgroundBottom, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false);
@@ -216,11 +216,6 @@ void cNopacityDisplayChannel::DrawBackground(void){
pixmapFooter->Fill(clrTransparent);
pixmapStreamInfo->Fill(clrTransparent);
- cImageLoader imgLoader;
- if (imgLoader.LoadIcon("skinIcons/channelsymbols", iconsWidth, iconSize)) {
- pixmapStreamInfo->DrawImage(cPoint(0, 0), imgLoader.GetImage());
- }
-
}
void cNopacityDisplayChannel::DrawDate(void) {
@@ -236,9 +231,15 @@ void cNopacityDisplayChannel::DrawDate(void) {
}
}
+void cNopacityDisplayChannel::DrawIconMask(void) {
+ cImageLoader imgLoader;
+ if (imgLoader.LoadIcon("skinIcons/channelsymbols", iconsWidth, iconSize)) {
+ pixmapStreamInfo->DrawImage(cPoint(0, 0), imgLoader.GetImage());
+ }
+}
+
void cNopacityDisplayChannel::DrawIcons(const cChannel *Channel) {
isRadioChannel = ((!Channel->Vpid())&&(Channel->Apid(0)))?true:false;
- pixmapStreamInfoBack->Fill(clrTransparent);
int backX = 5;
int backY = 5;
@@ -393,7 +394,8 @@ void cNopacityDisplayChannel::DrawSignal(void) {
void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
pixmapLogo->Fill(clrTransparent);
pixmapChannelInfo->Fill(clrTransparent);
-
+ pixmapStreamInfo->Fill(clrTransparent);
+ pixmapStreamInfoBack->Fill(clrTransparent);
if (withInfo) {
pixmapProgressBar->Fill(clrTransparent);
pixmapEPGInfo->Fill(clrTransparent);
@@ -408,19 +410,22 @@ void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
if (Channel) {
ChannelName = Channel->Name();
if (!Channel->GroupSep()) {
- DrawIcons(Channel);
ChannelNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : "");
- } else
+ } else {
groupSep = true;
- } else if (Number) {
+ }
+ } else if (Number) {
ChannelNumber = cString::sprintf("%d-", Number);
} else {
ChannelName = ChannelString(NULL, 0);
}
-
- cString channelString = cString::sprintf("%s %s", *ChannelNumber, *ChannelName);
-
+
if (!groupSep) {
+ if (withInfo) {
+ DrawIconMask();
+ DrawIcons(Channel);
+ }
+ cString channelString = cString::sprintf("%s %s", *ChannelNumber, *ChannelName);
pixmapChannelInfo->DrawText(cPoint(channelInfoHeight/2, (channelInfoHeight-fontHeader->Height())/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader);
if (config.logoPosition != lpNone) {
cImageLoader imgLoader;
@@ -429,23 +434,79 @@ void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) {
}
}
} else {
- if (withInfo) {
- pixmapProgressBar->Fill(clrTransparent);
- pixmapEPGInfo->Fill(clrTransparent);
- pixmapEPGInfo->DrawText(cPoint(channelInfoHeight/2, (epgInfoHeight-fontHeader->Height())/2 - fontHeader->Height()/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader);
- } else {
- pixmapChannelInfo->DrawText(cPoint(channelInfoHeight/2, (channelInfoHeight-fontHeader->Height())/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader);
+ DrawChannelGroups(Channel, ChannelName);
+ }
+}
+
+void cNopacityDisplayChannel::DrawChannelGroups(const cChannel *Channel, cString ChannelName) {
+ int ySep;
+ cPixmap *infoPixmap;
+ cString prevSymbol = " < ";
+ cString nextSymbol = " > ";
+
+ if (withInfo) {
+ pixmapProgressBar->Fill(clrTransparent);
+ pixmapEPGInfo->Fill(clrTransparent);
+ ySep = (epgInfoHeight-fontHeader->Height())/2 - fontHeader->Height()/2;
+ infoPixmap = pixmapEPGInfo;
+ } else {
+ ySep = (channelInfoHeight-fontHeader->Height())/2;
+ infoPixmap = pixmapChannelInfo;
+ }
+
+ cString prevChannelSep = GetChannelSep(Channel, true);
+ cString nextChannelSep = GetChannelSep(Channel, false);
+ bool prevAvailable = (strlen(*prevChannelSep) > 0)?true:false;
+ bool nextAvailable = (strlen(*nextChannelSep) > 0)?true:false;
+
+ int widthSep = fontHeader->Width(*ChannelName);
+ int xSep = (infoWidth - widthSep)/2;
+ infoPixmap->DrawText(cPoint(xSep, ySep), *ChannelName, Theme.Color(clrChannelHead), clrTransparent, fontHeader);
+
+ int ySepNextPrev = ySep + (fontHeader->Height() - fontEPG->Height())/2;
+ if (prevAvailable) {
+ int xSymbol = xSep - fontHeader->Width(*prevSymbol);
+ infoPixmap->DrawText(cPoint(xSymbol, ySep), *prevSymbol, Theme.Color(clrChannelHead), clrTransparent, fontHeader);
+ int xSepPrev = xSymbol - fontEPG->Width(prevChannelSep);
+ if (xSepPrev < 0) {
+ prevChannelSep = CutText(*prevChannelSep, xSymbol, fontEPG).c_str();
+ xSepPrev = xSymbol - fontEPG->Width(prevChannelSep);
}
- if (config.logoPosition != lpNone) {
- cImageLoader imgLoader;
- cString separator = cString::sprintf("separatorlogos/%s", *ChannelName);
- if (imgLoader.LoadLogo(*separator)) {
- pixmapLogo->DrawImage(cPoint(config.logoBorder, (height-config.logoHeight)/2), imgLoader.GetImage());
- } else if (imgLoader.LoadIcon("skinIcons/Channelseparator", config.logoHeight)) {
- pixmapLogo->DrawImage(cPoint(config.logoBorder + (config.logoWidth - config.logoHeight)/2, (height-config.logoHeight)/2), imgLoader.GetImage());
- }
+ infoPixmap->DrawText(cPoint(xSepPrev, ySepNextPrev), *prevChannelSep, Theme.Color(clrChannelEPG), clrTransparent, fontEPG);
+ }
+ if (nextAvailable) {
+ int xSymbol = xSep + widthSep;
+ infoPixmap->DrawText(cPoint(xSymbol, ySep), *nextSymbol, Theme.Color(clrChannelHead), clrTransparent, fontHeader);
+ int xSepNext = xSymbol + fontHeader->Width(*nextSymbol);
+ int spaceAvailable = infoPixmap->DrawPort().Width() - xSepNext;
+ if (fontEPG->Width(nextChannelSep) > spaceAvailable) {
+ nextChannelSep = CutText(*nextChannelSep, spaceAvailable, fontEPG).c_str();
+ }
+ infoPixmap->DrawText(cPoint(xSepNext, ySepNextPrev), *nextChannelSep, Theme.Color(clrChannelEPG), clrTransparent, fontEPG);
+ }
+
+ if (config.logoPosition != lpNone) {
+ cImageLoader imgLoader;
+ cString separator = cString::sprintf("separatorlogos/%s", *ChannelName);
+ if (imgLoader.LoadLogo(*separator)) {
+ pixmapLogo->DrawImage(cPoint(config.logoBorder, (height-config.logoHeight)/2), imgLoader.GetImage());
+ } else if (imgLoader.LoadIcon("skinIcons/Channelseparator", config.logoHeight)) {
+ pixmapLogo->DrawImage(cPoint(config.logoBorder + (config.logoWidth - config.logoHeight)/2, (height-config.logoHeight)/2), imgLoader.GetImage());
+ }
+ }
+}
+
+cString cNopacityDisplayChannel::GetChannelSep(const cChannel *channel, bool prev) {
+ cString sepName("");
+ const cChannel *sep = prev ? Channels.Prev(channel) :
+ Channels.Next(channel);
+ for (; sep; (prev)?(sep = Channels.Prev(sep)):(sep = Channels.Next(sep))) {
+ if (sep->GroupSep()) {
+ sepName = sep->Name();
+ break;
}
}
+ return sepName;
}
void cNopacityDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Following) {
@@ -483,22 +544,14 @@ void cNopacityDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Fol
}
int seenWidth = fontEPG->Width(*strSeen);
int space = infoWidth - 9*indent - seenWidth - startTimeWidth - config.resolutionIconSize;
- cString strEPG;
+ cString strEPG = e->Title();
if (space < epgWidth) {
- cTextWrapper epgInfoWrapper(e->Title(), fontEPG, space);
- strEPG = epgInfoWrapper.GetLine(0);
- strEPG = cString::sprintf("%s...", *strEPG);
- } else {
- strEPG = e->Title();
+ strEPG = CutText(e->Title(), space, fontEPG).c_str();
}
- cString strEPGShort("");
+ cString strEPGShort = e->ShortText();
int spaceShort = infoWidth - 6*indent - startTimeWidth - config.resolutionIconSize;
if (spaceShort < epgWidthShort) {
- cTextWrapper epgInfoWrapper(e->ShortText(), fontEPGSmall, spaceShort);
- strEPGShort = epgInfoWrapper.GetLine(0);
- strEPGShort = cString::sprintf("%s...", *strEPGShort);
- } else {
- strEPGShort = e->ShortText();
+ strEPGShort = CutText(e->ShortText(), spaceShort, fontEPGSmall).c_str();
}
tColor fontColor = (i==0)?Theme.Color(clrChannelEPG):Theme.Color(clrChannelEPGInfo);
pixmapEPGInfo->DrawText(cPoint(indent, y * epgInfoLineHeight), *startTime, fontColor, clrTransparent, fontEPG);
@@ -572,9 +625,15 @@ void cNopacityDisplayChannel::Flush(void) {
DrawDate();
if (!groupSep)
DrawScreenResolution();
- if (config.displaySignalStrength && showSignal) {
- DrawSignal();
+ else {
+ if (pixmapScreenResolution)
+ pixmapScreenResolution->Fill(clrTransparent);
}
+
+ if (config.displaySignalStrength && showSignal && !groupSep) {
+ DrawSignal();
+ } else
+ pixmapSignalMeter->Fill(clrTransparent);
if (withInfo) {
int Current = 0;
int Total = 0;
diff --git a/displaychannel.h b/displaychannel.h
index c9b6b04..3fab23b 100644
--- a/displaychannel.h
+++ b/displaychannel.h
@@ -70,10 +70,13 @@ private:
void DrawDate(void);
void DrawProgressBar(int Current, int Total);
tColor DrawProgressbarBackground(int left, int top, int width, int height);
+ void DrawIconMask(void);
void DrawIcons(const cChannel *channel);
void DrawScreenResolution(void);
void DrawSignalMeter(void);
void DrawSignal(void);
+ void DrawChannelGroups(const cChannel *Channel, cString ChannelName);
+ cString GetChannelSep(const cChannel *channel, bool prev);
public:
cNopacityDisplayChannel(bool WithInfo);
virtual ~cNopacityDisplayChannel();
diff --git a/helpers.c b/helpers.c
index 425ebd6..54f717f 100644
--- a/helpers.c
+++ b/helpers.c
@@ -1,3 +1,6 @@
+#include <string>
+#include <sstream>
+
static cOsd *CreateOsd(int Left, int Top, int Width, int Height) {
cOsd *osd = cOsdProvider::NewOsd(Left, Top);
if (osd) {
@@ -45,4 +48,30 @@ static int Minimum(int a, int b, int c, int d, int e, int f) {
if (e < min) min = e;
if (f < min) min = f;
return min;
+}
+
+static std::string CutText(std::string text, int width, const cFont *font) {
+ if (width <= font->Size())
+ return text.c_str();
+ cTextWrapper twText;
+ twText.Set(text.c_str(), font, width);
+ std::string cuttedTextNative = twText.GetLine(0);
+ std::stringstream sstrText;
+ sstrText << cuttedTextNative << "...";
+ std::string cuttedText = sstrText.str();
+ int actWidth = font->Width(cuttedText.c_str());
+ if (actWidth > width) {
+ int overlap = actWidth - width;
+ int charWidth = font->Width(".");
+ if (charWidth == 0)
+ charWidth = 1;
+ int cutChars = overlap / charWidth;
+ if (cutChars > 0) {
+ cuttedTextNative = cuttedTextNative.substr(0, cuttedTextNative.length() - cutChars);
+ std::stringstream sstrText2;
+ sstrText2 << cuttedTextNative << "...";
+ cuttedText = sstrText2.str();
+ }
+ }
+ return cuttedText;
} \ No newline at end of file
diff --git a/menuitem.c b/menuitem.c
index 9ed5205..c4234f7 100644
--- a/menuitem.c
+++ b/menuitem.c
@@ -154,32 +154,6 @@ void cNopacityMenuItem::DoSleep(int duration) {
cCondWait::SleepMs(sleepSlice);
}
-std::string cNopacityMenuItem::CutText(std::string *text, int width, const cFont *font) {
- if (width <= font->Size())
- return text->c_str();
- cTextWrapper twText;
- twText.Set(text->c_str(), font, width);
- std::string cuttedTextNative = twText.GetLine(0);
- std::stringstream sstrText;
- sstrText << cuttedTextNative << "...";
- std::string cuttedText = sstrText.str();
- int actWidth = font->Width(cuttedText.c_str());
- if (actWidth > width) {
- int overlap = actWidth - width;
- int charWidth = font->Width(".");
- if (charWidth == 0)
- charWidth = 1;
- int cutChars = overlap / charWidth;
- if (cutChars > 0) {
- cuttedTextNative = cuttedTextNative.substr(0, cuttedTextNative.length() - cutChars);
- std::stringstream sstrText2;
- sstrText2 << cuttedTextNative << "...";
- cuttedText = sstrText2.str();
- }
- }
- return cuttedText;
-}
-
void cNopacityMenuItem::DrawRoundedCorners(tColor borderColor) {
int radius = config.cornerRadius;
@@ -304,7 +278,7 @@ int cNopacityMainMenuItem::CheckScrollable(bool hasIcon) {
scrollable = true;
totalTextWidth = max(numberWidth + textWidth, totalTextWidth);
strEntryFull = strEntry.c_str();
- strEntry = CutText(&strEntry, width - spaceLeft - numberWidth, font);
+ strEntry = CutText(strEntry, width - spaceLeft - numberWidth, font);
}
return totalTextWidth;
}
@@ -428,7 +402,7 @@ int cNopacityScheduleMenuItem::CheckScrollable(bool hasIcon) {
totalTextWidth = max(font->Width(strTitle.c_str()), totalTextWidth);
strTitleFull = strTitle.c_str();
strSubTitleFull = strSubTitle.c_str();
- strTitle = CutText(&strTitle, width - spaceLeft, font);
+ strTitle = CutText(strTitle, width - spaceLeft, font);
}
if (fontSmall->Width(strSubTitle.c_str()) > (width - spaceLeft)) {
if (!scrollable) {
@@ -438,7 +412,7 @@ int cNopacityScheduleMenuItem::CheckScrollable(bool hasIcon) {
}
scrollSubTitle = true;
totalTextWidth = max(fontSmall->Width(strSubTitle.c_str()), totalTextWidth);
- strSubTitle = CutText(&strSubTitle, width - spaceLeft, fontSmall);
+ strSubTitle = CutText(strSubTitle, width - spaceLeft, fontSmall);
}
return totalTextWidth;
@@ -598,7 +572,7 @@ int cNopacityChannelMenuItem::CheckScrollable(bool hasIcon) {
scrollable = true;
totalTextWidth = max(font->Width(strEntry.c_str()), totalTextWidth);
strEntryFull = strEntry.c_str();
- strEntry = CutText(&strEntry, width - spaceLeft, font);
+ strEntry = CutText(strEntry, width - spaceLeft, font);
}
return totalTextWidth;
}
@@ -767,7 +741,7 @@ int cNopacityTimerMenuItem::CheckScrollable(bool hasIcon) {
scrollable = true;
totalTextWidth = max(font->Width(strEntry.c_str()), totalTextWidth);
strEntryFull = strEntry.c_str();
- strEntry = CutText(&strEntry, width - spaceLeft, font);
+ strEntry = CutText(strEntry, width - spaceLeft, font);
}
return totalTextWidth;
}
@@ -926,7 +900,7 @@ int cNopacityRecordingMenuItem::CheckScrollableRecording(void) {
if (font->Width(strRecName.c_str()) + iconWidth > (width - spaceLeft)) {
scrollable = true;
totalTextWidth = max(font->Width(strRecName.c_str()) + iconWidth, totalTextWidth);
- strRecName = CutText(&strRecName, width - spaceLeft - iconWidth, font);
+ strRecName = CutText(strRecName, width - spaceLeft - iconWidth, font);
}
return totalTextWidth;
}
@@ -938,7 +912,7 @@ int cNopacityRecordingMenuItem::CheckScrollableFolder(void) {
if (font->Width(strRecName.c_str()) > (width - spaceLeft)) {
scrollable = true;
totalTextWidth = max(font->Width(strRecName.c_str()), totalTextWidth);
- strRecName = CutText(&strRecName, width - spaceLeft, font);
+ strRecName = CutText(strRecName, width - spaceLeft, font);
}
return totalTextWidth;
}
diff --git a/menuitem.h b/menuitem.h
index e4c41b1..bc59cd2 100644
--- a/menuitem.h
+++ b/menuitem.h
@@ -32,7 +32,6 @@ protected:
void DrawDelimiter(const char *del, const char *icon, int handleBgrd);
virtual void Action(void);
void DoSleep(int duration);
- std::string CutText(std::string *text, int width, const cFont *font);
void DrawRoundedCorners(tColor borderColor);
public:
cNopacityMenuItem(cOsd *osd, const char *text, bool sel);