diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-02-25 23:08:12 +0000 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-02-25 23:08:12 +0000 |
commit | 0a538a615d2faa693e649e04e5c0f31ac5b11ba2 (patch) | |
tree | bb2b575f116e6779aa9b27863e907d802245b68a /pages | |
parent | 3ef60cf2f005573ad9c11a7b5765e0bd4d65c5a0 (diff) | |
download | vdr-plugin-live-0a538a615d2faa693e649e04e5c0f31ac5b11ba2.tar.gz vdr-plugin-live-0a538a615d2faa693e649e04e5c0f31ac5b11ba2.tar.bz2 |
- Added posibility to switch channels from status box.
- Regouping of status box active buttons.
Diffstat (limited to 'pages')
-rw-r--r-- | pages/infobox.ecpp | 85 | ||||
-rw-r--r-- | pages/pageelems.ecpp | 9 |
2 files changed, 83 insertions, 11 deletions
diff --git a/pages/infobox.ecpp b/pages/infobox.ecpp index b338015..afc44b4 100644 --- a/pages/infobox.ecpp +++ b/pages/infobox.ecpp @@ -17,6 +17,9 @@ using namespace std; <%include>page_init.eh</%include> <{ EpgEvents epgEvents; + string EMPTY_STR; + tChannelID prev_chan; + tChannelID next_chan; if (cReplayControl::NowReplaying()) { cThreadLock RecordingsLock(&Recordings); @@ -36,37 +39,103 @@ using namespace std; } } else { + string CHANNEL_STR("channel"); ReadLock channelsLock( Channels ); + if (cDevice::CurrentChannel()) { cChannel* Channel = Channels.GetByNumber(cDevice::CurrentChannel()); if (!Channel) throw HtmlError("got invalid channel number!"); + + cChannel* tmp = Channels.GetByNumber(Channels.GetPrevNormal(cDevice::CurrentChannel())); + if (tmp) + prev_chan = tmp->GetChannelID(); + tmp = Channels.GetByNumber(Channels.GetNextNormal(cDevice::CurrentChannel())); + if (tmp) + next_chan = tmp->GetChannelID(); + + string chanName(Channel->Name()); cSchedulesLock schedulesLock; const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); const cSchedule *Schedule = Schedules->GetSchedule(Channel); + if (Schedule) { const cEvent *Event = Schedule->GetPresentEvent(); if (Event) { - EpgEventPtr epgEvent(new EpgEvent("channel", + EpgEventPtr epgEvent(new EpgEvent(CHANNEL_STR, Event, Channel->Name())); epgEvents.push_back(epgEvent); } + else { + string noInfo(tr("no epg info for current event!")); + EpgEventPtr epgEvent(new EpgEvent(CHANNEL_STR, + chanName, + noInfo, + EMPTY_STR, EMPTY_STR, + time(0), + time(0))); + epgEvents.push_back(epgEvent); + } } + else { + string noInfo(tr("no epg info for current channel!")); + EpgEventPtr epgEvent(new EpgEvent(CHANNEL_STR, + Channel->Name(), + noInfo, + EMPTY_STR, EMPTY_STR, + time(0), + time(0))); + epgEvents.push_back(epgEvent); + } + } + else { + string chanName(tr("no current channel!")); + EpgEventPtr epgEvent(new EpgEvent(CHANNEL_STR, + chanName, + chanName, + EMPTY_STR, EMPTY_STR, + time(0), + time(0))); + epgEvents.push_back(epgEvent); } } - if (epgEvents.size() > 0) { - for (vector<EpgEventPtr>::iterator i = epgEvents.begin(); i != epgEvents.end(); ++i) { - EpgEventPtr epg = *i; + if (epgEvents.size() == 0) { + string ERROR_STR("error"); + string noInfo(tr("error retrieving status info!")); + string chanName(tr("no current channel!")); + EpgEventPtr epgEvent(new EpgEvent(ERROR_STR, + chanName, + noInfo, + EMPTY_STR, EMPTY_STR, + time(0), + time(0))); + epgEvents.push_back(epgEvent); + } + for (vector<EpgEventPtr>::iterator i = epgEvents.begin(); i != epgEvents.end(); ++i) { + EpgEventPtr epg = *i; + if (prev_chan.Valid() && next_chan.Valid()) + { }> - <& pageelems.status_box type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) &> + <& pageelems.status_box type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) next_chan=(next_chan) &> <{ } - } - else { + else if (prev_chan.Valid()) { +}> + <& pageelems.status_box type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) &> +<{ + } + else if (next_chan.Valid()) { }> - No relevant information could be retrieved! + <& pageelems.status_box type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) next_chan=(next_chan) &> <{ + } + else { +}> + <& pageelems.status_box type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) &> +<{ + } + break; } }> <%include>page_exit.eh</%include> diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index 851a1c8..96b8893 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -1,5 +1,6 @@ <%pre> #include <string> +#include <vdr/menu.h> #include <vdr/epg.h> #include "tools.h" @@ -59,7 +60,7 @@ using namespace vdrlive; string tip; string param; string image; - string alt = ""; + string alt; </%args> <a href="javascript:LiveSimpleAjaxRequest('<$ action $>.xml', 'param', '<$ param $>');" <%cpp>if (!tip.empty()) { </%cpp><& tooltip.hint text=(tip) &> <%cpp> } </%cpp>><img src="<$ image $>" alt="<$ alt $>" /></a> </%def> @@ -110,18 +111,20 @@ using namespace vdrlive; string title; string duration; int elapsed; + string prev_chan; + string next_chan; </%args> <div class="statuscontent"> <div class="st_header"> <div class="caption"><$ caption $></div> - <div class="now"> <img id="statusReloadBtn" src="stop.png" alt="toggle reload on and off" onclick="LiveStatusToggleUpdate()" /> <$ currentTime $></div> + <div class="now"> <$ currentTime $></div> </div> <div class="st_content"> <div class="name"><$ title $></div> <div class="duration"> <$ duration $></div> </div> <div class="st_controls"> - <div class="buttons"> </div> + <div class="buttons"><a href="javascript:LiveStatusToggleUpdate()" ><img id="statusReloadBtn" src="stop.png" alt="" /></a><%cpp>if (!prev_chan.empty()) { </%cpp><& ajax_action_href action=("switch_channel") param=(prev_chan) image=("one_downarrow.png") &><%cpp> } if (!next_chan.empty()) { </%cpp><& ajax_action_href action=("switch_channel") param=(next_chan) image=("one_uparrow.png") &><%cpp> } </%cpp></div> % if (elapsed >= 0) { <div class="progress"><& pageelems.progressbar progress=(elapsed) &></div> % } |