diff options
author | louis <louis.braun@gmx.de> | 2013-02-20 17:36:03 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-02-20 17:36:03 +0100 |
commit | 529719875720aa80197b95fb49bd9c712a4023f1 (patch) | |
tree | 454b08fa4914c24cbcf626842a96463052c501fc | |
parent | d60c6a242c76708b9e943ba141dbf80bb117b536 (diff) | |
download | skin-nopacity-529719875720aa80197b95fb49bd9c712a4023f1.tar.gz skin-nopacity-529719875720aa80197b95fb49bd9c712a4023f1.tar.bz2 |
display all jpegs in a recording folder in detailed recording view
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | config.c | 4 | ||||
-rw-r--r-- | config.h | 2 | ||||
-rw-r--r-- | imageloader.c | 12 | ||||
-rw-r--r-- | imageloader.h | 1 | ||||
-rw-r--r-- | menudetailview.c | 74 | ||||
-rw-r--r-- | menudetailview.h | 4 | ||||
-rw-r--r-- | po/de_DE.po | 5 | ||||
-rw-r--r-- | setup.c | 4 |
9 files changed, 103 insertions, 4 deletions
@@ -139,3 +139,4 @@ Version 0.0.7: - disabled fading for displaymenu per default - Fixed display of timers channel name in main menu if no channel logo is available +- display all jpegs in a recording folder in detailed recording view @@ -67,6 +67,8 @@ cNopacityConfig::cNopacityConfig() { useSubtitleRerun = 1; displayAdditionalEPGPictures = 1; numAdditionalEPGPictures = 9; + displayAdditionalRecEPGPictures = 1; + numAdditionalRecEPGPictures = 9; menuFadeTime = 0; menuEPGWindowFadeTime = 300; menuWidthMain = 30; @@ -250,6 +252,8 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *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, "displayAdditionalRecEPGPictures") == 0) displayAdditionalRecEPGPictures = atoi(Value); + else if (strcmp(Name, "numAdditionalRecEPGPictures") == 0) numAdditionalRecEPGPictures = atoi(Value); else if (strcmp(Name, "menuWidthMain") == 0) menuWidthMain = atoi(Value); else if (strcmp(Name, "menuWidthSchedules") == 0) menuWidthSchedules = atoi(Value); else if (strcmp(Name, "menuWidthChannels") == 0) menuWidthChannels = atoi(Value); @@ -89,6 +89,8 @@ class cNopacityConfig { int useSubtitleRerun;
int displayAdditionalEPGPictures;
int numAdditionalEPGPictures;
+ int displayAdditionalRecEPGPictures;
+ int numAdditionalRecEPGPictures;
int menuFadeTime;
int menuEPGWindowFadeTime;
int menuFrameTime;
diff --git a/imageloader.c b/imageloader.c index 6a68b5b..188100b 100644 --- a/imageloader.c +++ b/imageloader.c @@ -147,6 +147,18 @@ bool cImageLoader::LoadRecordingImage(cString Path) { return false; } +bool cImageLoader::LoadAdditionalRecordingImage(cString path, cString name) { + int width = config.epgImageWidthLarge; + int height = config.epgImageHeightLarge; + if ((width == 0)||(height==0)) + return false; + if (LoadImage(name, path, "jpg")) { + buffer.sample( Geometry(width, height)); + return true; + } + return false; +} + void cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height) { Color Back = Argb2Color(back); Color Blend = Argb2Color(blend); diff --git a/imageloader.h b/imageloader.h index 31bc692..0b3f13b 100644 --- a/imageloader.h +++ b/imageloader.h @@ -20,6 +20,7 @@ public: bool LoadEPGImage(int eventID); bool LoadAdditionalEPGImage(cString name); bool LoadRecordingImage(cString Path); + bool LoadAdditionalRecordingImage(cString path, cString name); void DrawBackground(tColor back, tColor blend, int width, int height); void DrawBackground2(tColor back, tColor blend, int width, int height); private: diff --git a/menudetailview.c b/menudetailview.c index d4b8aae..6c07b4b 100644 --- a/menudetailview.c +++ b/menudetailview.c @@ -1,6 +1,9 @@ #include "menudetailview.h" #include "services/epgsearch.h" #include <sstream> +#include <iostream> +#include <dirent.h> +#include <vector> cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd) { this->osd = osd; @@ -333,7 +336,10 @@ void cNopacityMenuDetailRecordingView::SetContentHeight(void) { int linesContent = content.Lines() + 1; linesContent+= additionalInfo.Lines() + 1; int heightContentText = linesContent * lineHeight; - + if (config.displayAdditionalRecEPGPictures) { + if (LoadEPGPics()) + heightContentText += HeightEPGPics(); + } if (heightContentText > contentHeight) { contentDrawPortHeight = heightContentText; hasScrollbar = true; @@ -342,10 +348,72 @@ void cNopacityMenuDetailRecordingView::SetContentHeight(void) { } } +bool cNopacityMenuDetailRecordingView::LoadEPGPics(void) { + DIR *dirHandle; + struct dirent *dirEntry; + dirHandle = opendir(recording->FileName()); + int picsFound = 0; + if (dirHandle != NULL) { + while ( 0 != (dirEntry = readdir(dirHandle))) { + if (endswith(dirEntry->d_name, "jpg")) { + std::string fileName = dirEntry->d_name; + if (fileName.length() > 4) { + fileName = fileName.substr(0, fileName.length() - 4); + epgpics.push_back(fileName); + picsFound++; + } + } + if (picsFound >= config.numAdditionalRecEPGPictures) + break; + } + closedir(dirHandle); + } + if (picsFound > 0) + return true; + return false; +} + +int cNopacityMenuDetailRecordingView::HeightEPGPics(void) { + int numPicsAvailable = epgpics.size(); + int picsPerLine = width / (config.epgImageWidthLarge + border); + int picLines = numPicsAvailable / picsPerLine; + if (numPicsAvailable%picsPerLine != 0) + picLines++; + return picLines * (config.epgImageHeightLarge + border) + 2*border; +} + +void cNopacityMenuDetailRecordingView::DrawEPGPictures(int height) { + int picsPerLine = width / (config.epgImageWidthLarge + border); + int currentX = border; + int currentY = height + border; + int currentPicsPerLine = 1; + cImageLoader imgLoader; + for (unsigned i=0; i < epgpics.size(); i++) { + cString path = cString::sprintf("%s/", recording->FileName()); + cString epgimage = epgpics.at(i).c_str(); + if (imgLoader.LoadAdditionalRecordingImage(path, 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; + } + } +} + void cNopacityMenuDetailRecordingView::Render(void) { DrawHeader(); - int currentHight = DrawTextWrapper(&content, 0); - DrawTextWrapper(&additionalInfo, currentHight); + int currentHeight = DrawTextWrapper(&content, 0); + currentHeight = DrawTextWrapper(&additionalInfo, currentHeight); + if (epgpics.size() > 0) { + DrawEPGPictures(currentHeight); + } } void cNopacityMenuDetailRecordingView::DrawHeader(void) { diff --git a/menudetailview.h b/menudetailview.h index 1bacda1..76d4e8f 100644 --- a/menudetailview.h +++ b/menudetailview.h @@ -58,6 +58,10 @@ private: void DrawHeader(void); void LoadRecordingInformation(void); int ReadSizeVdr(const char *strPath); + std::vector<std::string> epgpics; + bool LoadEPGPics(void); + int HeightEPGPics(void); + void DrawEPGPictures(int height); public: cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording); virtual ~cNopacityMenuDetailRecordingView(void); diff --git a/po/de_DE.po b/po/de_DE.po index 6b1cfaf..d2c02da 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-02-12 16:07+0100\n" +"POT-Creation-Date: 2013-02-20 15:36+0100\n" "PO-Revision-Date: 2012-11-11 17:49+0200\n" "Last-Translator: louis\n" "Language-Team: \n" @@ -176,6 +176,9 @@ 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 "Display additional EPG Pictures in detailed recording View" +msgstr "Weitere EPG Bilder in der detaillierten Aufnahmeansicht anzeigen" + msgid "Width of Main and Setup Menu (Percent of OSD Width)" msgstr "Breite des Haupt und Setup Menüs (Proz. der OSD Breite)" @@ -112,6 +112,8 @@ void cNopacitySetup::Store(void) { SetupStore("useSubtitleRerun", config.useSubtitleRerun); SetupStore("displayAdditionalEPGPictures", config.displayAdditionalEPGPictures); SetupStore("numAdditionalEPGPictures", config.numAdditionalEPGPictures); + SetupStore("displayAdditionalRecEPGPictures", config.displayAdditionalRecEPGPictures); + SetupStore("numAdditionalRecEPGPictures", config.numAdditionalRecEPGPictures); SetupStore("menuFadeTime", config.menuFadeTime); SetupStore("menuScrollDelay", config.menuScrollDelay); SetupStore("menuScrollSpeed", config.menuScrollSpeed); @@ -238,6 +240,8 @@ void cNopacitySetupMenuDisplay::Set(void) { 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)); + Add(new cMenuEditBoolItem(tr("Display additional EPG Pictures in detailed recording View"), &tmpNopacityConfig->displayAdditionalRecEPGPictures)); + Add(new cMenuEditIntItem(tr("Number of EPG pictures to display"), &tmpNopacityConfig->numAdditionalRecEPGPictures, 1, 9)); SetCurrent(Get(currentItem)); Display(); |