summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2012-12-07 14:44:55 +0100
committerlouis <louis.braun@gmx.de>2012-12-07 14:44:55 +0100
commita8a2bd61fd2931b79c0f39812ef30a0cc7292d82 (patch)
tree30d0fc1e8ef1facc51b4ed951fed5a5484864132
parentd58b48418a7ce80d2186c720f20a06d46a78a2ec (diff)
downloadskin-nopacity-a8a2bd61fd2931b79c0f39812ef30a0cc7292d82.tar.gz
skin-nopacity-a8a2bd61fd2931b79c0f39812ef30a0cc7292d82.tar.bz2
Fixed some crashes
-rw-r--r--HISTORY6
-rw-r--r--README2
-rw-r--r--config.c2
-rw-r--r--displaymenu.c8
-rw-r--r--displaymenu.h1
-rw-r--r--epgsearchconf.c32
-rw-r--r--epgsearchconf.h2
-rw-r--r--menudetailview.c6
-rw-r--r--menudetailview.h3
-rw-r--r--menuitem.c45
10 files changed, 73 insertions, 34 deletions
diff --git a/HISTORY b/HISTORY
index f6a1ab2..310641b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -58,3 +58,9 @@ VDR Plugin 'nOpacity' Revision History
more information about epgsearch integration)
- Fixed "fade in" bug, cancelling threads correctly (Thanks to everybody who
was involved)
+
+- Fixed a crash when trying to access channel name in epg detail view
+- Fixed a crash when changing values in setup menu
+- Fixed a crash when opening and closing epg menus
+- Fixed a bug to only use epgsearchmenu.conf if lines for all possible
+ menus are set
diff --git a/README b/README
index 68c9322..e9a0faf 100644
--- a/README
+++ b/README
@@ -119,6 +119,8 @@ correct display of the progress bar in the "what's on now" view.
Beside using the default settings you can also set up your own epgsearchmenu.conf file to
control the information which is diplayed in the various menus. All tokens described in the
epgsearchmenu.conf file in the epgsearch plugin sources (subdirectory ./conf/) are supported.
+If epgsearchmenu is used, lines for all possible entries have to be set (see list below).
+Otherwise the default epgsearch settings are used.
For me these entries for the different menus showed the best result:
MenuWhatsOnNow=%chlng%:4|%progrT2S%:5|%time%:8|%status%:3|%title%:15|%subtitle%:25
diff --git a/config.c b/config.c
index a37d120..0cf2123 100644
--- a/config.c
+++ b/config.c
@@ -1,6 +1,7 @@
#include "config.h"
cNopacityConfig::cNopacityConfig() {
+ epgSearchConf = NULL;
logoPathSet = false;
epgImagePathSet = false;
iconPathSet = false;
@@ -89,7 +90,6 @@ cNopacityConfig::cNopacityConfig() {
}
cNopacityConfig::~cNopacityConfig() {
- delete epgSearchConf;
}
void cNopacityConfig::setDynamicValues() {
diff --git a/displaymenu.c b/displaymenu.c
index bbd27e1..701e749 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -17,7 +17,6 @@ cNopacityDisplayMenu::cNopacityDisplayMenu(void) {
lastTimersState = -1;
menuItemIndexLast = -1;
currentNumItems = 0;
- channelName = NULL;
menuHasIcons = true;
detailView = NULL;
contentNarrow = true;
@@ -193,7 +192,7 @@ void cNopacityDisplayMenu::SetTitle(const char *Title) {
menuHasIcons = true;
contentNarrow = true;
//EPGSearch search results
- } else if (isdigit(strTitle.at(0))) {
+ } else if ((strTitle.length() > 0) && isdigit(strTitle.at(0))) {
menuSubCategory = mcSubScheduleSearchResults;
left += menuView->DrawHeaderIcon(mcSchedule);
menuHasIcons = true;
@@ -246,9 +245,6 @@ void cNopacityDisplayMenu::SetTitle(const char *Title) {
}
menuView->AdjustContentBackground(contentNarrow, contentNarrowLast);
menuView->DrawHeaderLabel(left, title);
- if (MenuCategory() == mcEvent) {
- channelName = Title;
- }
}
}
@@ -415,7 +411,7 @@ void cNopacityDisplayMenu::SetEvent(const cEvent *Event) {
if (!Event)
return;
menuView->AdjustContentBackground(false, contentNarrowLast);
- detailView = new cNopacityMenuDetailEventView(osd, Event, *channelName);
+ detailView = new cNopacityMenuDetailEventView(osd, Event);
menuView->SetDetailViewSize(dvEvent, detailView);
detailView->SetFonts();
if (config.displayRerunsDetailEPGView)
diff --git a/displaymenu.h b/displaymenu.h
index 5231ae8..002f3a1 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -28,7 +28,6 @@ private:
void DrawDisk(void);
void DrawTimers(void);
void SplitItem(const char *Text, cString *strItems, int *tabItems);
- cString channelName;
virtual void Action(void);
protected:
int Tab(int n);
diff --git a/epgsearchconf.c b/epgsearchconf.c
index 84232f8..3073cbb 100644
--- a/epgsearchconf.c
+++ b/epgsearchconf.c
@@ -11,7 +11,6 @@ cNopacityEPGSearchConfig::cNopacityEPGSearchConfig(void) {
ReplaceSchedule = false;
ShowChannelNr = false;
ShowProgress = false;
- MaxTabs = 6;
for (int i=0; i<4; i++) {
UserSet[i] = false;
User[i] = "";
@@ -84,6 +83,12 @@ bool cNopacityEPGSearchConfig::LoadEpgSearchMenuConf(void) {
cString ConfigDir = cPlugin::ConfigDirectory("epgsearch");
cString epgsearchConf = "epgsearchmenu.conf";
cString fileName = AddDirectory(*ConfigDir, *epgsearchConf);
+ bool foundMenuWhatsOnNow = false;
+ bool foundMenuWhatsOnNext = false;
+ bool foundMenuWhatsOnElse = false;
+ bool foundMenuSchedule = false;
+ bool foundMenuSearchResults = false;
+ bool foundMenuFavorites = false;
if (access(fileName, F_OK) == 0) {
dsyslog("nopacity: config file %s found", *fileName);
FILE *f = fopen(fileName, "r");
@@ -98,35 +103,52 @@ bool cNopacityEPGSearchConfig::LoadEpgSearchMenuConf(void) {
try {
if (!isempty(s)) {
std::string line = s;
- std::string *values = new std::string[MaxTabs];
+ std::string *values = new std::string[MAXITEMTABS];
if (line.find("MenuWhatsOnNow") == 0) {
values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
SetTokens(values, eMenuWhatsOnNow);
+ foundMenuWhatsOnNow = true;
} else if (line.find("MenuWhatsOnNext") == 0) {
values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
SetTokens(values, eMenuWhatsOnNext);
+ foundMenuWhatsOnNext = true;
} else if (line.find("MenuWhatsOnElse") == 0) {
values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
SetTokens(values, eMenuWhatsOnElse);
+ foundMenuWhatsOnElse = true;
} else if (line.find("MenuSchedule") == 0) {
values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
SetTokens(values, eMenuSchedule);
+ foundMenuSchedule = true;
} else if (line.find("MenuSearchResults") == 0) {
values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
SetTokens(values, eMenuSearchResults);
+ foundMenuSearchResults = true;
} else if (line.find("MenuFavorites") == 0) {
values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
SetTokens(values, eMenuFavorites);
+ foundMenuFavorites = true;
}
delete[] values;
}
} catch (...){}
}
}
+ if (!foundMenuWhatsOnNow ||
+ !foundMenuWhatsOnNext ||
+ !foundMenuWhatsOnElse ||
+ !foundMenuSchedule ||
+ !foundMenuSearchResults ||
+ !foundMenuFavorites)
+ {
+ dsyslog("nopacity: config file not complete, using default");
+ return false;
+ }
} else {
dsyslog("nopacity: %s not available, using epgsearch default settings", *fileName);
return false;
}
+ dsyslog("nopacity: config file complete");
return true;
}
@@ -134,8 +156,8 @@ std::string *cNopacityEPGSearchConfig::SplitEpgSearchMenuLine(std::string line)
size_t posSeparator = -1;
bool found = false;
posSeparator = line.find_first_of("|") + 1;
- std::string *values = new std::string[MaxTabs];
- for (int i=0; i < MaxTabs; i++)
+ std::string *values = new std::string[MAXITEMTABS];
+ for (int i=0; i < MAXITEMTABS; i++)
values[i] = "";
std::string value;
int i=0;
@@ -164,7 +186,7 @@ std::string *cNopacityEPGSearchConfig::SplitEpgSearchMenuLine(std::string line)
}
void cNopacityEPGSearchConfig::SetTokens(std::string *values, eEPGModes mode) {
- for (int i=0; i<MaxTabs; i++) {
+ for (int i=0; i<MAXITEMTABS; i++) {
toLowerCase(values[i]);
if (values[i].find("%time%") == 0)
epgSearchConfig[mode][eEPGtime] = i;
diff --git a/epgsearchconf.h b/epgsearchconf.h
index f6a027a..d531978 100644
--- a/epgsearchconf.h
+++ b/epgsearchconf.h
@@ -3,13 +3,13 @@
#define EPGSEARCHCATS 7
#define EPGSEARCHTOKENS 17
+#define MAXITEMTABS 6
class cNopacityEPGSearchConfig {
private:
bool ReplaceSchedule;
bool ShowChannelNr;
bool ShowProgress;
- int MaxTabs;
std::string *SplitEpgSearchMenuLine(std::string line);
void SetTokens(std::string *values, eEPGModes mode);
void toLowerCase(std::string &str);
diff --git a/menudetailview.c b/menudetailview.c
index 945f940..c6d781c 100644
--- a/menudetailview.c
+++ b/menudetailview.c
@@ -160,9 +160,8 @@ bool cNopacityMenuDetailView::Scroll(bool Up, bool Page) {
//---------------cNopacityMenuDetailEventView---------------------
-cNopacityMenuDetailEventView::cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event, cString channelName) : cNopacityMenuDetailView(osd) {
+cNopacityMenuDetailEventView::cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event) : cNopacityMenuDetailView(osd) {
event = Event;
- this->channelName = channelName;
}
cNopacityMenuDetailEventView::~cNopacityMenuDetailEventView(void) {
@@ -199,7 +198,8 @@ void cNopacityMenuDetailEventView::Render(void) {
void cNopacityMenuDetailEventView::DrawHeader(void) {
cImageLoader imgLoader;
int logoWidth = config.detailViewLogoWidth;
- if (imgLoader.LoadLogo(*channelName, logoWidth, config.detailViewLogoHeight)) {
+ cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true);
+ if (channel && channel->Name() && imgLoader.LoadLogo(channel->Name(), logoWidth, config.detailViewLogoHeight)) {
pixmapLogo->DrawImage(cPoint(0, max((headerHeight - config.detailViewLogoHeight - border)/2, 0)), imgLoader.GetImage());
}
int widthTextHeader = width - 4 * border - logoWidth;
diff --git a/menudetailview.h b/menudetailview.h
index 8d1e864..16697f4 100644
--- a/menudetailview.h
+++ b/menudetailview.h
@@ -36,10 +36,9 @@ public:
class cNopacityMenuDetailEventView : public cNopacityMenuDetailView {
private:
void DrawHeader(void);
- cString channelName;
const cEvent *event;
public:
- cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event, cString channelName);
+ cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event);
virtual ~cNopacityMenuDetailEventView(void);
void CreatePixmaps(void);
void SetFonts(void);
diff --git a/menuitem.c b/menuitem.c
index 1ed2c4d..01f1685 100644
--- a/menuitem.c
+++ b/menuitem.c
@@ -221,30 +221,42 @@ void cNopacityScheduleMenuItem::Render() {
if (selectable) {
//Build Date & Time & Status
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGdate] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGdate] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGdate] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGdate]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGtime] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGstatus] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGstatus] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGstatus] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGstatus]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGt_status] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGt_status] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGt_status] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGt_status]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGv_status] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGv_status] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGv_status] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGv_status]] << " ";
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGr_status] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGr_status] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGr_status] < MAXITEMTABS))
sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGr_status]] << " ";
//Build title and subtitle
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGtitle] > -1) {
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtitle] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtitle] < MAXITEMTABS)) {
strTitle = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtitle]];
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle] > -1) {
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle] < MAXITEMTABS)) {
strSubtitle = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle]];
} else {
size_t delimiter = strTitle.find("~");
@@ -271,14 +283,17 @@ void cNopacityScheduleMenuItem::Render() {
strSubtitle = sstrSubtitle.str();
}
//Build Channel Name
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGchlng] > -1)
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGchlng] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGchlng] < MAXITEMTABS))
strChannelName = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGchlng]];
- else if (config.epgSearchConf->epgSearchConfig[mode][eEPGchsh] > -1)
+ else if ((config.epgSearchConf->epgSearchConfig[mode][eEPGchsh] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGchsh] < MAXITEMTABS))
strChannelName = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGchsh]];
else
strChannelName = "";
//Build Progressbar
- if (config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S] > -1) {
+ if ((config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S] > -1)
+ &&(config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S] < MAXITEMTABS)) {
strProgressbar = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S]];
hasProgressBar = true;
}