summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-01-30 21:08:26 +0100
committerlouis <louis.braun@gmx.de>2013-01-30 21:08:26 +0100
commit80ea9ad4e3f23773da5b2c871931117f2df41145 (patch)
treefc357473b0dd440faedf1af7669cf4c551348afb
parentde9bc2df7e2418269e86abbf452d212a75cdb201 (diff)
downloadskin-nopacity-80ea9ad4e3f23773da5b2c871931117f2df41145.tar.gz
skin-nopacity-80ea9ad4e3f23773da5b2c871931117f2df41145.tar.bz2
Added displaying of additional EPG images in detailed EPG view
-rw-r--r--HISTORY4
-rw-r--r--config.c8
-rw-r--r--config.h4
-rw-r--r--displaymenu.c14
-rw-r--r--imageloader.c20
-rw-r--r--imageloader.h1
-rw-r--r--menudetailview.c525
-rw-r--r--menudetailview.h33
-rw-r--r--po/de_DE.po14
-rw-r--r--setup.c8
10 files changed, 398 insertions, 233 deletions
diff --git a/HISTORY b/HISTORY
index cc8ef35..f1981ab 100644
--- a/HISTORY
+++ b/HISTORY
@@ -109,3 +109,7 @@ Version 0.0.6
in a subdirectory in icons directory, this subdirectory has to
be named exactly as the theme (without "nOpacity-").
- Added Theme "green" and appropriate icons
+- Added displaying of additional EPG images in detailed EPG view. The epg
+ images have to be stored as EventID_number.jpg (as some external epg
+ plugins do). Whether additional images should be displayed in general is
+ configurable, just as the number of images to display.
diff --git a/config.c b/config.c
index c56d55e..9dd5989 100644
--- a/config.c
+++ b/config.c
@@ -57,6 +57,8 @@ cNopacityConfig::cNopacityConfig() {
displayRerunsDetailEPGView = 1;
numReruns = 5;
useSubtitleRerun = 1;
+ displayAdditionalEPGPictures = 1;
+ numAdditionalEPGPictures = 9;
menuFadeTime = 300;
menuEPGWindowFadeTime = 300;
menuWidthNarrow = 30;
@@ -85,6 +87,8 @@ cNopacityConfig::cNopacityConfig() {
timersLogoHeight = 70;
epgImageWidth = 210;
epgImageHeight = 160;
+ epgImageWidthLarge = 545;
+ epgImageHeightLarge = 400;
menuRecFolderSize = 128;
fontHeader = 0;
fontDate = 0;
@@ -220,6 +224,8 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value);
else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value);
else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value);
+ else if (strcmp(Name, "displayAdditionalEPGPictures") == 0) displayAdditionalEPGPictures = atoi(Value);
+ else if (strcmp(Name, "numAdditionalEPGPictures") == 0) numAdditionalEPGPictures = atoi(Value);
else if (strcmp(Name, "menuWidthNarrow") == 0) menuWidthNarrow = atoi(Value);
else if (strcmp(Name, "menuWidthRightItems") == 0) menuWidthRightItems = atoi(Value);
else if (strcmp(Name, "menuHeightInfoWindow") == 0) menuHeightInfoWindow = atoi(Value);
@@ -241,6 +247,8 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "timersLogoHeight") == 0) timersLogoHeight = atoi(Value);
else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value);
else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value);
+ else if (strcmp(Name, "epgImageWidthLarge") == 0) epgImageWidthLarge = atoi(Value);
+ else if (strcmp(Name, "epgImageHeightLarge") == 0) epgImageHeightLarge = atoi(Value);
else if (strcmp(Name, "menuRecFolderSize") == 0) menuRecFolderSize = atoi(Value);
else if (strcmp(Name, "fontHeader") == 0) fontHeader = atoi(Value);
else if (strcmp(Name, "fontDate") == 0) fontDate = atoi(Value);
diff --git a/config.h b/config.h
index 6a77e53..2568a5a 100644
--- a/config.h
+++ b/config.h
@@ -79,6 +79,8 @@ class cNopacityConfig {
int displayRerunsDetailEPGView;
int numReruns;
int useSubtitleRerun;
+ int displayAdditionalEPGPictures;
+ int numAdditionalEPGPictures;
int menuFadeTime;
int menuEPGWindowFadeTime;
int menuFrameTime;
@@ -111,6 +113,8 @@ class cNopacityConfig {
int timersLogoHeight;
int epgImageWidth;
int epgImageHeight;
+ int epgImageWidthLarge;
+ int epgImageHeightLarge;
int menuRecFolderSize;
int fontHeader;
int fontDate;
diff --git a/displaymenu.c b/displaymenu.c
index e6d6f41..be53e62 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -548,9 +548,8 @@ void cNopacityDisplayMenu::SetEvent(const cEvent *Event) {
detailView = new cNopacityMenuDetailEventView(osd, Event);
menuView->SetDetailViewSize(dvEvent, detailView);
detailView->SetFonts();
- if (config.displayRerunsDetailEPGView)
- detailView->LoadReruns(Event);
- detailView->SetContent(Event->Description());
+ detailView->SetContent();
+ detailView->SetContentHeight();
detailView->CreatePixmaps();
detailView->Render();
if (detailView->Scrollable()) {
@@ -571,8 +570,8 @@ void cNopacityDisplayMenu::SetRecording(const cRecording *Recording) {
detailView = new cNopacityMenuDetailRecordingView(osd, Recording);
menuView->SetDetailViewSize(dvRecording, detailView);
detailView->SetFonts();
- detailView->LoadRecordingInformation(Recording);
- detailView->SetContent(Recording->Info()->Description());
+ detailView->SetContent();
+ detailView->SetContentHeight();
detailView->CreatePixmaps();
detailView->Render();
if (detailView->Scrollable()) {
@@ -586,10 +585,11 @@ void cNopacityDisplayMenu::SetText(const char *Text, bool FixedFont) {
if (!Text)
return;
menuView->AdjustContentBackground(false, contentNarrowLast, videoWindowRect);
- detailView = new cNopacityMenuDetailTextView(osd);
+ detailView = new cNopacityMenuDetailTextView(osd, Text);
menuView->SetDetailViewSize(dvText, detailView);
detailView->SetFonts();
- detailView->SetContent(Text);
+ detailView->SetContent();
+ detailView->SetContentHeight();
detailView->CreatePixmaps();
detailView->Render();
if (detailView->Scrollable()) {
diff --git a/imageloader.c b/imageloader.c
index 058affa..569d9fd 100644
--- a/imageloader.c
+++ b/imageloader.c
@@ -106,6 +106,26 @@ bool cImageLoader::LoadEPGImage(int eventID) {
return true;
}
+bool cImageLoader::LoadAdditionalEPGImage(cString name) {
+ int width = config.epgImageWidthLarge;
+ int height = config.epgImageHeightLarge;
+ if ((width == 0)||(height==0))
+ return false;
+ bool success = false;
+ if (config.epgImagePathSet) {
+ success = LoadImage(name, config.epgImagePath, "jpg");
+ }
+ if (!success) {
+ success = LoadImage(name, config.epgImagePathDefault, "jpg");
+ }
+ if (!success)
+ return false;
+ if (height != 0 || width != 0) {
+ buffer.sample( Geometry(width, height));
+ }
+ return true;
+}
+
bool cImageLoader::LoadRecordingImage(cString Path) {
int width = config.epgImageWidth;
int height = config.epgImageHeight;
diff --git a/imageloader.h b/imageloader.h
index 5d22fd8..488f798 100644
--- a/imageloader.h
+++ b/imageloader.h
@@ -18,6 +18,7 @@ public:
bool LoadIcon(const char *cIcon, int size);
bool LoadIcon(const char *cIcon, int width, int height);
bool LoadEPGImage(int eventID);
+ bool LoadAdditionalEPGImage(cString name);
bool LoadRecordingImage(cString Path);
void DrawBackground(tColor back, tColor blend, int width, int height);
void DrawBackground2(tColor back, tColor blend, int width, int height);
diff --git a/menudetailview.c b/menudetailview.c
index dc8e6eb..d4b8aae 100644
--- a/menudetailview.c
+++ b/menudetailview.c
@@ -5,8 +5,6 @@
cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd) {
this->osd = osd;
hasScrollbar = false;
- additionalContent = NULL;
- additionalContentSet = false;
}
cNopacityMenuDetailView::~cNopacityMenuDetailView(void) {
@@ -26,216 +24,15 @@ void cNopacityMenuDetailView::SetGeometry(int width, int height, int top, int co
contentHeight = height - headerHeight;
}
-void cNopacityMenuDetailView::SetContent(const char *textContent) {
- if (textContent) {
- cString sContent = textContent;
- if (additionalContentSet) {
- std::stringstream sstrContent;
- sstrContent << textContent;
- sstrContent << std::endl;
- sstrContent << std::endl;
- sstrContent << *additionalContent;
- sContent = sstrContent.str().c_str();
- }
- content.Set(*sContent, font, width - 4 * border);
- } else
- content.Set("", font, width - 4 * border);
-
+int cNopacityMenuDetailView::DrawTextWrapper(cTextWrapper *wrapper, int top) {
+ int linesText = wrapper->Lines();
int textHeight = font->Height();
- int linesContent = content.Lines() + 2;
- int heightContentText = linesContent * textHeight;
- if (heightContentText > contentHeight) {
- contentDrawPortHeight = heightContentText;
- hasScrollbar = true;
- } else {
- contentDrawPortHeight = contentHeight;
- }
-}
-
-void cNopacityMenuDetailView::DrawContent(void) {
- int linesContent = content.Lines();
- int textHeight = font->Height();
- for (int i=0; i<linesContent; i++) {
- pixmapContent->DrawText(cPoint(2*border, (i+1)*textHeight), content.GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrTransparent, font);
- }
-}
-
-void cNopacityMenuDetailView::LoadReruns(const cEvent *event) {
- cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
- if (epgSearchPlugin && !isempty(event->Title())) {
- std::stringstream sstrReruns;
- Epgsearch_searchresults_v1_0 data;
- std::string strQuery = event->Title();
- if (config.useSubtitleRerun > 0) {
- if (config.useSubtitleRerun == 2 || !isempty(event->ShortText()))
- strQuery += "~";
- if (!isempty(event->ShortText()))
- strQuery += event->ShortText();
- data.useSubTitle = true;
- } else {
- data.useSubTitle = false;
- }
- data.query = (char *)strQuery.c_str();
- data.mode = 0;
- data.channelNr = 0;
- data.useTitle = true;
- data.useDescription = false;
-
- if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
- cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
- if (list && (list->Count() > 1)) {
- sstrReruns << tr("RERUNS OF THIS SHOW") << ':' << std::endl;
- int i = 0;
- for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < config.numReruns; r = list->Next(r)) {
- if ((event->ChannelID() == r->event->ChannelID()) && (event->StartTime() == r->event->StartTime()))
- continue;
- i++;
- sstrReruns << "- "
- << *DayDateTime(r->event->StartTime());
- cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true);
- if (channel)
- sstrReruns << " " << channel->ShortName(true);
- sstrReruns << ": " << r->event->Title();
- if (!isempty(r->event->ShortText()))
- sstrReruns << "~" << r->event->ShortText();
- sstrReruns << std::endl;
- }
- delete list;
- }
- }
- additionalContent = sstrReruns.str().c_str();
- additionalContentSet = true;
- }
-}
-
-void cNopacityMenuDetailView::LoadRecordingInformation(const cRecording *recording) {
- const cRecordingInfo *Info = recording->Info();
- unsigned long long nRecSize = -1;
- unsigned long long nFileSize[1000];
- nFileSize[0] = 0;
- int i = 0;
- struct stat filebuf;
- cString filename;
- int rc = 0;
- do {
- if (recording->IsPesRecording())
- filename = cString::sprintf("%s/%03d.vdr", recording->FileName(), ++i);
- else
- filename = cString::sprintf("%s/%05d.ts", recording->FileName(), ++i);
- rc = stat(filename, &filebuf);
- if (rc == 0)
- nFileSize[i] = nFileSize[i-1] + filebuf.st_size;
- else
- if (ENOENT != errno) {
- nRecSize = -1;
- }
- } while (i <= 999 && !rc);
- nRecSize = nFileSize[i-1];
-
- cMarks marks;
- bool fHasMarks = marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording()) && marks.Count();
- cIndexFile *index = new cIndexFile(recording->FileName(), false, recording->IsPesRecording());
-
- int nCutLength = 0;
- long nCutInFrame = 0;
- unsigned long long nRecSizeCut = nRecSize < 0 ? -1 : 0;
- unsigned long long nCutInOffset = 0;
-
- if (fHasMarks && index) {
- uint16_t FileNumber;
- off_t FileOffset;
-
- bool fCutIn = true;
- cMark *mark = marks.First();
- while (mark) {
- int pos = mark->Position();
- index->Get(pos, &FileNumber, &FileOffset); //TODO: will disc spin up?
- if (fCutIn) {
- nCutInFrame = pos;
- fCutIn = false;
- if (nRecSize >= 0)
- nCutInOffset = nFileSize[FileNumber-1] + FileOffset;
- } else {
- nCutLength += pos - nCutInFrame;
- fCutIn = true;
- if (nRecSize >= 0)
- nRecSizeCut += nFileSize[FileNumber-1] + FileOffset - nCutInOffset;
- }
- cMark *nextmark = marks.Next(mark);
- mark = nextmark;
- }
- if (!fCutIn) {
- nCutLength += index->Last() - nCutInFrame;
- index->Get(index->Last() - 1, &FileNumber, &FileOffset);
- if (nRecSize >= 0)
- nRecSizeCut += nFileSize[FileNumber-1] + FileOffset - nCutInOffset;
- }
- }
-
- std::stringstream sstrInfo;
-
- cChannel *channel = Channels.GetByChannelID(Info->ChannelID());
- if (channel)
- sstrInfo << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << std::endl;
- if (nRecSize < 0) {
- if ((nRecSize = ReadSizeVdr(recording->FileName())) < 0) {
- nRecSize = DirSizeMB(recording->FileName());
- }
- }
- if (nRecSize >= 0) {
- cString strRecSize = "";
- if (fHasMarks) {
- if (nRecSize > MEGABYTE(1023))
- strRecSize = cString::sprintf("%s: %.2f GB (%s: %.2f GB)", tr("Size"), (float)nRecSize / MEGABYTE(1024), tr("cut"), (float)nRecSizeCut / MEGABYTE(1024));
- else
- strRecSize = cString::sprintf("%s: %lld MB (%s: %lld MB)", tr("Size"), nRecSize / MEGABYTE(1), tr("cut"), nRecSizeCut / MEGABYTE(1));
- } else {
- if (nRecSize > MEGABYTE(1023))
- strRecSize = cString::sprintf("%s: %.2f GB", tr("Size"), (float)nRecSize / MEGABYTE(1024));
- else
- strRecSize = cString::sprintf("%s: %lld MB", tr("Size"), nRecSize / MEGABYTE(1));
- }
- sstrInfo << (const char*)strRecSize << std::endl;
+ int currentHeight = 0;
+ for (int i=0; i < linesText; i++) {
+ currentHeight = (i+1)*textHeight + top;
+ pixmapContent->DrawText(cPoint(2*border, currentHeight), wrapper->GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrTransparent, font);
}
-
- if (index) {
- int nLastIndex = index->Last();
- if (nLastIndex) {
- cString strLength;
- if (fHasMarks) {
- strLength = cString::sprintf("%s: %s (%s %s)", tr("Length"), *IndexToHMSF(nLastIndex, false, recording->FramesPerSecond()), tr("cut"), *IndexToHMSF(nCutLength, false, recording->FramesPerSecond()));
- } else {
- strLength = cString::sprintf("%s: %s", tr("Length"), *IndexToHMSF(nLastIndex, false, recording->FramesPerSecond()));
- }
- sstrInfo << (const char*)strLength << std::endl;
- cString strBitrate = cString::sprintf("%s: %s\n%s: %.2f MBit/s (Video+Audio)", tr("Format"), recording->IsPesRecording() ? "PES" : "TS", tr("Est. bitrate"), (float)nRecSize / nLastIndex * recording->FramesPerSecond() * 8 / MEGABYTE(1));
- sstrInfo << (const char*)strBitrate << std::endl;
- }
- }
- delete index;
-
- additionalContent = sstrInfo.str().c_str();
- additionalContentSet = true;
-}
-
-int cNopacityMenuDetailView::ReadSizeVdr(const char *strPath) {
- int dirSize = -1;
- char buffer[20];
- char *strFilename = NULL;
- if (-1 != asprintf(&strFilename, "%s/size.vdr", strPath)) {
- struct stat st;
- if (stat(strFilename, &st) == 0) {
- int fd = open(strFilename, O_RDONLY);
- if (fd >= 0) {
- if (safe_read(fd, &buffer, sizeof(buffer)) >= 0) {
- dirSize = atoi(buffer);
- }
- close(fd);
- }
- }
- free(strFilename);
- }
- return dirSize;
+ return currentHeight + textHeight;
}
double cNopacityMenuDetailView::ScrollbarSize(void) {
@@ -293,6 +90,7 @@ bool cNopacityMenuDetailView::Scroll(bool Up, bool Page) {
cNopacityMenuDetailEventView::cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event) : cNopacityMenuDetailView(osd) {
event = Event;
+ numEPGPics = 0;
}
cNopacityMenuDetailEventView::~cNopacityMenuDetailEventView(void) {
@@ -320,10 +118,69 @@ void cNopacityMenuDetailEventView::SetFonts(void) {
fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader);
}
+void cNopacityMenuDetailEventView::SetContent(void) {
+ if (event) {
+ content.Set(event->Description(), font, width - 4 * border);
+ if (config.displayRerunsDetailEPGView) {
+ LoadReruns();
+ }
+ }
+}
+
+void cNopacityMenuDetailEventView::SetContentHeight(void) {
+ int lineHeight = font->Height();
+ int linesContent = content.Lines() + 1;
+ if (config.displayRerunsDetailEPGView) {
+ linesContent+= reruns.Lines() + 2;
+ }
+ int heightContentText = linesContent * lineHeight;
+
+ if (config.displayAdditionalEPGPictures) {
+ heightContentText += HeightEPGPics();
+ }
+
+ if (heightContentText > contentHeight) {
+ contentDrawPortHeight = heightContentText;
+ hasScrollbar = true;
+ } else {
+ contentDrawPortHeight = contentHeight;
+ }
+}
+
+int cNopacityMenuDetailEventView::HeightEPGPics(void) {
+ int numPicsAvailable = 0;
+ for (int i=1; i <= config.numAdditionalEPGPictures; i++) {
+ cString epgimage;
+ if (config.epgImagePathSet) {
+ epgimage = cString::sprintf("%s%d_%d.jpg", *config.epgImagePath, event->EventID(), i);
+ } else {
+ epgimage = cString::sprintf("%s%d_%d.jpg", *config.epgImagePathDefault, event->EventID(), i);
+ }
+ FILE *fp = fopen(*epgimage, "r");
+ if (fp) {
+ numPicsAvailable = i;
+ fclose(fp);
+ } else {
+ break;
+ }
+ }
+ numEPGPics = numPicsAvailable;
+ int picsPerLine = width / (config.epgImageWidthLarge + border);
+ int picLines = numPicsAvailable / picsPerLine;
+ if (numPicsAvailable%picsPerLine != 0)
+ picLines++;
+ return picLines * (config.epgImageHeightLarge + border) + 2*border;
+}
void cNopacityMenuDetailEventView::Render(void) {
DrawHeader();
- DrawContent();
+ int currentHight = DrawTextWrapper(&content, 0);
+ if (config.displayRerunsDetailEPGView) {
+ currentHight = DrawTextWrapper(&reruns, currentHight);
+ }
+ if (config.displayAdditionalEPGPictures) {
+ DrawEPGPictures(currentHight);
+ }
}
void cNopacityMenuDetailEventView::DrawHeader(void) {
@@ -365,6 +222,77 @@ void cNopacityMenuDetailEventView::DrawHeader(void) {
}
+void cNopacityMenuDetailEventView::LoadReruns(void) {
+ cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
+ if (epgSearchPlugin && !isempty(event->Title())) {
+ std::stringstream sstrReruns;
+ Epgsearch_searchresults_v1_0 data;
+ std::string strQuery = event->Title();
+ if (config.useSubtitleRerun > 0) {
+ if (config.useSubtitleRerun == 2 || !isempty(event->ShortText()))
+ strQuery += "~";
+ if (!isempty(event->ShortText()))
+ strQuery += event->ShortText();
+ data.useSubTitle = true;
+ } else {
+ data.useSubTitle = false;
+ }
+ data.query = (char *)strQuery.c_str();
+ data.mode = 0;
+ data.channelNr = 0;
+ data.useTitle = true;
+ data.useDescription = false;
+
+ if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
+ cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
+ if (list && (list->Count() > 1)) {
+ sstrReruns << tr("RERUNS OF THIS SHOW") << ':' << std::endl;
+ int i = 0;
+ for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < config.numReruns; r = list->Next(r)) {
+ if ((event->ChannelID() == r->event->ChannelID()) && (event->StartTime() == r->event->StartTime()))
+ continue;
+ i++;
+ sstrReruns << "- "
+ << *DayDateTime(r->event->StartTime());
+ cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true);
+ if (channel)
+ sstrReruns << " " << channel->ShortName(true);
+ sstrReruns << ": " << r->event->Title();
+ if (!isempty(r->event->ShortText()))
+ sstrReruns << "~" << r->event->ShortText();
+ sstrReruns << std::endl;
+ }
+ delete list;
+ }
+ }
+ reruns.Set(sstrReruns.str().c_str(), font, width - 4 * border);
+ }
+}
+
+void cNopacityMenuDetailEventView::DrawEPGPictures(int height) {
+ int picsPerLine = width / (config.epgImageWidthLarge + border);
+ int currentX = border;
+ int currentY = height + border;
+ int currentPicsPerLine = 1;
+ cImageLoader imgLoader;
+ for (int i=1; i <= numEPGPics; i++) {
+ cString epgimage = cString::sprintf("%d_%d", event->EventID(), i);
+ if (imgLoader.LoadAdditionalEPGImage(epgimage)) {
+ pixmapContent->DrawImage(cPoint(currentX, currentY), imgLoader.GetImage());
+ if (currentPicsPerLine < picsPerLine) {
+ currentX += config.epgImageWidthLarge + border;
+ currentPicsPerLine++;
+ } else {
+ currentX = border;
+ currentY += config.epgImageHeightLarge + border;
+ currentPicsPerLine = 1;
+ }
+ } else {
+ break;
+ }
+ }
+}
+
//------------------cNopacityMenuDetailRecordingView------------------
cNopacityMenuDetailRecordingView::cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording) : cNopacityMenuDetailView(osd) {
@@ -393,9 +321,31 @@ void cNopacityMenuDetailRecordingView::SetFonts(void) {
fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader);
}
+void cNopacityMenuDetailRecordingView::SetContent(void) {
+ if (recording) {
+ content.Set(recording->Info()->Description(), font, width - 4 * border);
+ LoadRecordingInformation();
+ }
+}
+
+void cNopacityMenuDetailRecordingView::SetContentHeight(void) {
+ int lineHeight = font->Height();
+ int linesContent = content.Lines() + 1;
+ linesContent+= additionalInfo.Lines() + 1;
+ int heightContentText = linesContent * lineHeight;
+
+ if (heightContentText > contentHeight) {
+ contentDrawPortHeight = heightContentText;
+ hasScrollbar = true;
+ } else {
+ contentDrawPortHeight = contentHeight;
+ }
+}
+
void cNopacityMenuDetailRecordingView::Render(void) {
DrawHeader();
- DrawContent();
+ int currentHight = DrawTextWrapper(&content, 0);
+ DrawTextWrapper(&additionalInfo, currentHight);
}
void cNopacityMenuDetailRecordingView::DrawHeader(void) {
@@ -433,9 +383,139 @@ void cNopacityMenuDetailRecordingView::DrawHeader(void) {
}
}
+void cNopacityMenuDetailRecordingView::LoadRecordingInformation(void) {
+ const cRecordingInfo *Info = recording->Info();
+ unsigned long long nRecSize = -1;
+ unsigned long long nFileSize[1000];
+ nFileSize[0] = 0;
+ int i = 0;
+ struct stat filebuf;
+ cString filename;
+ int rc = 0;
+ do {
+ if (recording->IsPesRecording())
+ filename = cString::sprintf("%s/%03d.vdr", recording->FileName(), ++i);
+ else
+ filename = cString::sprintf("%s/%05d.ts", recording->FileName(), ++i);
+ rc = stat(filename, &filebuf);
+ if (rc == 0)
+ nFileSize[i] = nFileSize[i-1] + filebuf.st_size;
+ else
+ if (ENOENT != errno) {
+ nRecSize = -1;
+ }
+ } while (i <= 999 && !rc);
+ nRecSize = nFileSize[i-1];
+
+ cMarks marks;
+ bool fHasMarks = marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording()) && marks.Count();
+ cIndexFile *index = new cIndexFile(recording->FileName(), false, recording->IsPesRecording());
+
+ int nCutLength = 0;
+ long nCutInFrame = 0;
+ unsigned long long nRecSizeCut = nRecSize < 0 ? -1 : 0;
+ unsigned long long nCutInOffset = 0;
+
+ if (fHasMarks && index) {
+ uint16_t FileNumber;
+ off_t FileOffset;
+
+ bool fCutIn = true;
+ cMark *mark = marks.First();
+ while (mark) {
+ int pos = mark->Position();
+ index->Get(pos, &FileNumber, &FileOffset); //TODO: will disc spin up?
+ if (fCutIn) {
+ nCutInFrame = pos;
+ fCutIn = false;
+ if (nRecSize >= 0)
+ nCutInOffset = nFileSize[FileNumber-1] + FileOffset;
+ } else {
+ nCutLength += pos - nCutInFrame;
+ fCutIn = true;
+ if (nRecSize >= 0)
+ nRecSizeCut += nFileSize[FileNumber-1] + FileOffset - nCutInOffset;
+ }
+ cMark *nextmark = marks.Next(mark);
+ mark = nextmark;
+ }
+ if (!fCutIn) {
+ nCutLength += index->Last() - nCutInFrame;
+ index->Get(index->Last() - 1, &FileNumber, &FileOffset);
+ if (nRecSize >= 0)
+ nRecSizeCut += nFileSize[FileNumber-1] + FileOffset - nCutInOffset;
+ }
+ }
+
+ std::stringstream sstrInfo;
+
+ cChannel *channel = Channels.GetByChannelID(Info->ChannelID());
+ if (channel)
+ sstrInfo << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << std::endl;
+ if (nRecSize < 0) {
+ if ((nRecSize = ReadSizeVdr(recording->FileName())) < 0) {
+ nRecSize = DirSizeMB(recording->FileName());
+ }
+ }
+ if (nRecSize >= 0) {
+ cString strRecSize = "";
+ if (fHasMarks) {
+ if (nRecSize > MEGABYTE(1023))
+ strRecSize = cString::sprintf("%s: %.2f GB (%s: %.2f GB)", tr("Size"), (float)nRecSize / MEGABYTE(1024), tr("cut"), (float)nRecSizeCut / MEGABYTE(1024));
+ else
+ strRecSize = cString::sprintf("%s: %lld MB (%s: %lld MB)", tr("Size"), nRecSize / MEGABYTE(1), tr("cut"), nRecSizeCut / MEGABYTE(1));
+ } else {
+ if (nRecSize > MEGABYTE(1023))
+ strRecSize = cString::sprintf("%s: %.2f GB", tr("Size"), (float)nRecSize / MEGABYTE(1024));
+ else
+ strRecSize = cString::sprintf("%s: %lld MB", tr("Size"), nRecSize / MEGABYTE(1));
+ }
+ sstrInfo << (const char*)strRecSize << std::endl;
+ }
+
+ if (index) {
+ int nLastIndex = index->Last();
+ if (nLastIndex) {
+ cString strLength;
+ if (fHasMarks) {
+ strLength = cString::sprintf("%s: %s (%s %s)", tr("Length"), *IndexToHMSF(nLastIndex, false, recording->FramesPerSecond()), tr("cut"), *IndexToHMSF(nCutLength, false, recording->FramesPerSecond()));
+ } else {
+ strLength = cString::sprintf("%s: %s", tr("Length"), *IndexToHMSF(nLastIndex, false, recording->FramesPerSecond()));
+ }
+ sstrInfo << (const char*)strLength << std::endl;
+ cString strBitrate = cString::sprintf("%s: %s\n%s: %.2f MBit/s (Video+Audio)", tr("Format"), recording->IsPesRecording() ? "PES" : "TS", tr("Est. bitrate"), (float)nRecSize / nLastIndex * recording->FramesPerSecond() * 8 / MEGABYTE(1));
+ sstrInfo << (const char*)strBitrate << std::endl;
+ }
+ }
+ delete index;
+
+ additionalInfo.Set(sstrInfo.str().c_str(), font, width - 4 * border);
+}
+
+int cNopacityMenuDetailRecordingView::ReadSizeVdr(const char *strPath) {
+ int dirSize = -1;
+ char buffer[20];
+ char *strFilename = NULL;
+ if (-1 != asprintf(&strFilename, "%s/size.vdr", strPath)) {
+ struct stat st;
+ if (stat(strFilename, &st) == 0) {
+ int fd = open(strFilename, O_RDONLY);
+ if (fd >= 0) {
+ if (safe_read(fd, &buffer, sizeof(buffer)) >= 0) {
+ dirSize = atoi(buffer);
+ }
+ close(fd);
+ }
+ }
+ free(strFilename);
+ }
+ return dirSize;
+}
+
//---------------cNopacityMenuDetailTextView---------------------
-cNopacityMenuDetailTextView::cNopacityMenuDetailTextView(cOsd *osd) : cNopacityMenuDetailView(osd) {
+cNopacityMenuDetailTextView::cNopacityMenuDetailTextView(cOsd *osd, const char *text) : cNopacityMenuDetailView(osd) {
+ this->text = text;
}
cNopacityMenuDetailTextView::~cNopacityMenuDetailTextView(void) {
@@ -448,6 +528,23 @@ void cNopacityMenuDetailTextView::SetFonts(void) {
fontHeader = NULL;
}
+void cNopacityMenuDetailTextView::SetContent(void) {
+ content.Set(text, font, width - 4 * border);
+}
+
+void cNopacityMenuDetailTextView::SetContentHeight(void) {
+ int lineHeight = font->Height();
+ int linesContent = content.Lines() + 1;
+
+ int heightContentText = linesContent * lineHeight;
+ if (heightContentText > contentHeight) {
+ contentDrawPortHeight = heightContentText;
+ hasScrollbar = true;
+ } else {
+ contentDrawPortHeight = contentHeight;
+ }
+}
+
void cNopacityMenuDetailTextView::CreatePixmaps(void) {
pixmapContent = osd->CreatePixmap(3, cRect(0, top + headerHeight, width, contentHeight),
cRect(0, 0, width, contentDrawPortHeight));
@@ -456,5 +553,5 @@ void cNopacityMenuDetailTextView::CreatePixmaps(void) {
}
void cNopacityMenuDetailTextView::Render(void) {
- DrawContent();
+ DrawTextWrapper(&content, 0);
} \ No newline at end of file
diff --git a/menudetailview.h b/menudetailview.h
index bd7780f..1bacda1 100644
--- a/menudetailview.h
+++ b/menudetailview.h
@@ -10,38 +10,41 @@ protected:
int contentHeight;
int contentDrawPortHeight;
int border;
- cTextWrapper content;
- cString additionalContent;
- bool additionalContentSet;
cFont *font, *fontHeader, *fontHeaderLarge;
cPixmap *pixmapHeader;
cPixmap *pixmapLogo;
cPixmap *pixmapContent;
- int ReadSizeVdr(const char *strPath);
- void DrawContent(void);
+ cTextWrapper content;
+ int DrawTextWrapper(cTextWrapper *wrapper, int top);
public:
cNopacityMenuDetailView(cOsd *osd);
virtual ~cNopacityMenuDetailView(void);
void SetGeometry(int width, int height, int top, int contentBorder, int headerHeight);
virtual void SetFonts(void) = 0;
- void SetContent(const char *textContent);
- void LoadReruns(const cEvent *event);
- void LoadRecordingInformation(const cRecording *recording);
bool Scrollable(void) {return hasScrollbar;}
double ScrollbarSize(void);
double Offset(void);
bool Scroll(bool Up, bool Page);
+ virtual void SetContent(void) = 0;
+ virtual void SetContentHeight(void) = 0;
virtual void CreatePixmaps(void) = 0;
virtual void Render(void) = 0;
};
class cNopacityMenuDetailEventView : public cNopacityMenuDetailView {
private:
- void DrawHeader(void);
const cEvent *event;
+ cTextWrapper reruns;
+ int numEPGPics;
+ void DrawHeader(void);
+ void LoadReruns(void);
+ int HeightEPGPics(void);
+ void DrawEPGPictures(int height);
public:
cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event);
virtual ~cNopacityMenuDetailEventView(void);
+ void SetContent(void);
+ void SetContentHeight(void);
void CreatePixmaps(void);
void SetFonts(void);
void Render(void);
@@ -49,12 +52,17 @@ public:
class cNopacityMenuDetailRecordingView : public cNopacityMenuDetailView {
private:
- void DrawHeader(void);
const cRecording *recording;
const cRecordingInfo *info;
+ cTextWrapper additionalInfo;
+ void DrawHeader(void);
+ void LoadRecordingInformation(void);
+ int ReadSizeVdr(const char *strPath);
public:
cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording);
virtual ~cNopacityMenuDetailRecordingView(void);
+ void SetContent(void);
+ void SetContentHeight(void);
void CreatePixmaps(void);
void SetFonts(void);
void Render(void);
@@ -62,9 +70,12 @@ public:
class cNopacityMenuDetailTextView : public cNopacityMenuDetailView {
private:
+ const char *text;
public:
- cNopacityMenuDetailTextView(cOsd *osd);
+ cNopacityMenuDetailTextView(cOsd *osd, const char *text);
virtual ~cNopacityMenuDetailTextView(void);
+ void SetContent(void);
+ void SetContentHeight(void);
void CreatePixmaps(void);
void SetFonts(void);
void Render(void);
diff --git a/po/de_DE.po b/po/de_DE.po
index d0c7967..96cdd23 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: skinnopacity 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-01-26 13:46+0100\n"
+"POT-Creation-Date: 2013-01-30 19:45+0100\n"
"PO-Revision-Date: 2012-11-11 17:49+0200\n"
"Last-Translator: louis\n"
"Language-Team: \n"
@@ -152,6 +152,12 @@ msgstr "Anzahl der dargestellten Wiederholungen"
msgid "Use Subtitle for reruns"
msgstr "Untertitel für Wiederholungssuche nutzen"
+msgid "Display additional EPG Pictures in detailed EPG View"
+msgstr "Weitere EPG Bilder in der detaillierten EPG Ansicht anzeigen"
+
+msgid "Number of EPG pictures to display"
+msgstr "Anzahl der zusätzlichen EPG Bilder"
+
msgid "Width of narrow Menu Bar (Percent of OSD Width)"
msgstr "Breite der schmalen Menüleiste (Proz. der OSD Breite)"
@@ -206,6 +212,12 @@ msgstr "Breite der EPG Bilder in der EPG Detailanzeige"
msgid "Detail EPG View EPG Image Height"
msgstr "Höhe der EPG Bilder in der EPG Detailanzeige"
+msgid "Detail EPG View additional EPG Image Width"
+msgstr "Breite der zusätzlichen EPG Bilder"
+
+msgid "Detail EPG View additional EPG Image Height"
+msgstr "Höhe der zusätzlichen EPG Bilder"
+
msgid "Adjust Font Size - Header"
msgstr "Schriftgröße anpassen - Header"
diff --git a/setup.c b/setup.c
index 9c241df..698bd07 100644
--- a/setup.c
+++ b/setup.c
@@ -102,6 +102,8 @@ void cNopacitySetup::Store(void) {
SetupStore("displayRerunsDetailEPGView", config.displayRerunsDetailEPGView);
SetupStore("numReruns", config.numReruns);
SetupStore("useSubtitleRerun", config.useSubtitleRerun);
+ SetupStore("displayAdditionalEPGPictures", config.displayAdditionalEPGPictures);
+ SetupStore("numAdditionalEPGPictures", config.numAdditionalEPGPictures);
SetupStore("menuFadeTime", config.menuFadeTime);
SetupStore("menuScrollDelay", config.menuScrollDelay);
SetupStore("menuScrollSpeed", config.menuScrollSpeed);
@@ -130,6 +132,8 @@ void cNopacitySetup::Store(void) {
SetupStore("timersLogoHeight", config.timersLogoHeight);
SetupStore("epgImageWidth", config.epgImageWidth);
SetupStore("epgImageHeight", config.epgImageHeight);
+ SetupStore("epgImageWidthLarge", config.epgImageWidthLarge);
+ SetupStore("epgImageHeightLarge", config.epgImageHeightLarge);
SetupStore("menuRecFolderSize", config.menuRecFolderSize);
SetupStore("fontHeader", config.fontHeader);
SetupStore("fontDate", config.fontDate);
@@ -209,6 +213,8 @@ void cNopacitySetupMenuDisplay::Set(void) {
Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpNopacityConfig->displayRerunsDetailEPGView));
Add(new cMenuEditIntItem(tr("Number of reruns to display"), &tmpNopacityConfig->numReruns, 1, 10));
Add(new cMenuEditStraItem(tr("Use Subtitle for reruns"), &tmpNopacityConfig->useSubtitleRerun, 3, useSubtitleRerunTexts));
+ Add(new cMenuEditBoolItem(tr("Display additional EPG Pictures in detailed EPG View"), &tmpNopacityConfig->displayAdditionalEPGPictures));
+ Add(new cMenuEditIntItem(tr("Number of EPG pictures to display"), &tmpNopacityConfig->numAdditionalEPGPictures, 1, 9));
SetCurrent(Get(currentItem));
Display();
@@ -241,6 +247,8 @@ void cNopacitySetupMenuDisplayGeometry::Set(void) {
Add(new cMenuEditIntItem(tr("Detail EPG View Logo Height"), &tmpNopacityConfig->detailViewLogoHeight, 30, 500));
Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Width"), &tmpNopacityConfig->epgImageWidth, 30, 500));
Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Height"), &tmpNopacityConfig->epgImageHeight, 30, 500));
+ Add(new cMenuEditIntItem(tr("Detail EPG View additional EPG Image Width"), &tmpNopacityConfig->epgImageWidthLarge, 100, 800));
+ Add(new cMenuEditIntItem(tr("Detail EPG View additional EPG Image Height"), &tmpNopacityConfig->epgImageHeightLarge, 100, 800));
SetCurrent(Get(currentItem));
Display();
}