diff options
author | louis <louis.braun@gmx.de> | 2013-04-07 10:39:42 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-04-07 10:39:42 +0200 |
commit | fba3191de71867e91eb51cde93136fcdda64c0ab (patch) | |
tree | e99221ec2c9a7dc612b7e818c4b544a0c1e65a1d /displaymenu.c | |
parent | 518e7e87332e2b53e9f3e5f9fc853abaec2b360f (diff) | |
download | skin-nopacity-fba3191de71867e91eb51cde93136fcdda64c0ab.tar.gz skin-nopacity-fba3191de71867e91eb51cde93136fcdda64c0ab.tar.bz2 |
Added RSS Feed support
Diffstat (limited to 'displaymenu.c')
-rw-r--r-- | displaymenu.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/displaymenu.c b/displaymenu.c index 0bedb00..b059707 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -9,6 +9,7 @@ namespace PluginRemoteTimers { #include <string> cNopacityDisplayMenu::cNopacityDisplayMenu(void) { +esyslog("nopacity: starting menu"); config.setDynamicValues(); menuCategoryLast = mcUndefined; FrameTime = config.menuFrameTime; @@ -32,12 +33,27 @@ cNopacityDisplayMenu::cNopacityDisplayMenu(void) { menuView->CreateBackgroundImages(handleBackgrounds, handleButtons); menuView->DrawHeaderLogo(); menuView->DrawBorderDecoration(); + currentFeed = 0; + if (config.displayRSSFeed) { + menuView->DrawRssFeed(config.rssFeeds[config.rssFeed[currentFeed]].name); + rssReader = new cRssReader(osd, menuView->GetRssFeedFont(), menuView->GetRssFeedPosition(), menuView->GetRssFeedSize()); + rssReader->SetFeed(config.rssFeeds[config.rssFeed[currentFeed]].url); + rssReader->Start(); + } else + rssReader = NULL; } cNopacityDisplayMenu::~cNopacityDisplayMenu() { Cancel(-1); while (Active()) cCondWait::SleepMs(10); + if (rssReader) { + rssReader->Stop(); + while (rssReader->Active()) + cCondWait::SleepMs(10); + delete rssReader; + rssReader = NULL; + } delete menuView; menuItems.Clear(); if (detailView) { @@ -51,6 +67,7 @@ cNopacityDisplayMenu::~cNopacityDisplayMenu() { delete osd; cDevice::PrimaryDevice()->ScaleVideo(cRect::Null); + menuActive = false; } void cNopacityDisplayMenu::DrawDisk(void) { @@ -757,3 +774,40 @@ void cNopacityDisplayMenu::Action(void) { break; } } + +void cNopacityDisplayMenu::SwitchNextRssMessage(void) { + if (!config.displayRSSFeed) + return; + if (rssReader) { + rssReader->SwitchNextMessage(); + } +} + +void cNopacityDisplayMenu::SwitchNextRssFeed(void) { + if (!config.displayRSSFeed) + return; + if (rssReader) { + rssReader->Stop(); + while (rssReader->Active()) + cCondWait::SleepMs(10); + delete rssReader; + rssReader = NULL; + } + SetNextFeed(); + int feedNum = (config.rssFeed[currentFeed]==0)?0:(config.rssFeed[currentFeed]-1); + menuView->DrawRssFeed(config.rssFeeds[feedNum].name); + rssReader = new cRssReader(osd, menuView->GetRssFeedFont(), menuView->GetRssFeedPosition(), menuView->GetRssFeedSize()); + rssReader->SetFeed(config.rssFeeds[feedNum].url); + rssReader->Start(); +} + +void cNopacityDisplayMenu::SetNextFeed(void) { + int nextFeed = 0; + for (int i = 1; i<6; i++) { + nextFeed = (currentFeed + i)%5; + if ((nextFeed == 0)||(config.rssFeed[nextFeed] > 0)) { + currentFeed = nextFeed; + break; + } + } +}
\ No newline at end of file |