diff --git a/HISTORY b/HISTORY index 38f823c..476b9d0 100644 --- a/HISTORY +++ b/HISTORY @@ -89,3 +89,4 @@ Version 1.1.0 - fixed channel switching with blue key if detailed epg view is opened and if "close tvguide on channel switch" is configured - fixed wrong font for clock in horizontal view +- Added feature to jump to a specific channel with number keys diff --git a/Makefile b/Makefile index 01d28ac..54b9e18 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ endif ### The object files (add further files here): -OBJS = $(PLUGIN).o channelcolumn.o channelgroup.o channelgroups.o config.o detailview.o dummygrid.o epggrid.o fontmanager.o footer.o geometrymanager.o grid.o headergrid.o imagecache.o imageloader.o imagemagickwrapper.o imagescaler.o osdmanager.o recmanager.o recmenu.o recmenuitem.o recmenumanager.o recmenus.o setup.o statusheader.o styledpixmap.o switchtimer.o timeline.o timer.o tools.o tvguideosd.o +OBJS = $(PLUGIN).o channelcolumn.o channelgroup.o channelgroups.o channeljump.o config.o detailview.o dummygrid.o epggrid.o fontmanager.o footer.o geometrymanager.o grid.o headergrid.o imagecache.o imageloader.o imagemagickwrapper.o imagescaler.o osdmanager.o recmanager.o recmenu.o recmenuitem.o recmenumanager.o recmenus.o setup.o statusheader.o styledpixmap.o switchtimer.o timeline.o timer.o tools.o tvguideosd.o ### The main target: diff --git a/channelgroups.c b/channelgroups.c index 5d2d1a9..6767cee 100644 --- a/channelgroups.c +++ b/channelgroups.c @@ -130,6 +130,12 @@ void cChannelGroups::CreateGroupGrid(const char *name, int number, int start, in groupGrids.Add(groupGrid); } +int cChannelGroups::GetLastValidChannel(void) { + if (channelGroups.size() > 0) + return channelGroups[channelGroups.size()-1].StopChannel(); + return 0; +} + void cChannelGroups::DumpGroups(void) { for (std::vector::iterator group = channelGroups.begin(); group!=channelGroups.end(); ++group) { group->Dump(); diff --git a/channelgroups.h b/channelgroups.h index 3465c47..02b146d 100644 --- a/channelgroups.h +++ b/channelgroups.h @@ -23,6 +23,7 @@ public: bool IsInLastGroup(const cChannel *channel); void DrawChannelGroups(const cChannel *start, const cChannel *stop); void CreateGroupGrid(const char *name, int number, int start, int end); + int GetLastValidChannel(void); void DumpGroups(void); }; diff --git a/channeljump.c b/channeljump.c new file mode 100644 index 0000000..b23698e --- /dev/null +++ b/channeljump.c @@ -0,0 +1,90 @@ +#include +#include "config.h" +#include "geometrymanager.h" +#include "osdmanager.h" +#include "fontmanager.h" +#include "channelgroups.h" +#include "channeljump.h" + +cChannelJump::cChannelJump(cChannelGroups *channelGroups) { + this->channelGroups = channelGroups; + pixmapText = NULL; + channel = 0; + if (!tvguideConfig.hideLastGroup) { + maxChannels = Channels.MaxNumber(); + } else { + maxChannels = channelGroups->GetLastValidChannel(); + } + timeout = Setup.ChannelEntryTimeout; + startTime = cTimeMs::Now(); + SetPixmaps(); + Draw(); +} + +cChannelJump::~cChannelJump(void) { + osdManager.releasePixmap(pixmapBack); + osdManager.releasePixmap(pixmapText); +} + +void cChannelJump::SetPixmaps(void) { + int x = (geoManager.osdWidth - geoManager.channelJumpWidth)/2; + int y = (geoManager.osdHeight - geoManager.channelJumpHeight)/2; + + pixmapBack = osdManager.requestPixmap(4, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); + pixmap = osdManager.requestPixmap(5, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); + pixmapText = osdManager.requestPixmap(6, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); +} + +void cChannelJump::Draw(void) { + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgChannelJump); + } else { + pixmap->Fill(theme.Color(clrBackground)); + drawBorder(); + } + pixmapBack->Fill(clrTransparent); + pixmapBack->DrawRectangle(cRect(5, Height()/2, Width()-10, Height()-3), theme.Color(clrBackground)); +} + +void cChannelJump::DrawText(void) { + pixmapText->Fill(clrTransparent); + + cString header = cString::sprintf("%s:", tr("Channel")); + + const cFont *font = fontManager.FontMessageBox; + const cFont *fontHeader = fontManager.FontMessageBoxLarge; + + int xHeader = (Width() - fontHeader->Width(*header)) / 2; + int yHeader = (Height()/2 - fontHeader->Height()) / 2; + pixmapText->DrawText(cPoint(xHeader, yHeader), *header, theme.Color(clrFont), clrTransparent, fontHeader); + + cString strChannel = BuildChannelString(); + int xChannel = (Width() - font->Width(*strChannel)) / 2; + int yChannel = Height()/2 + (Height()/2 - font->Height()) / 2; + pixmapText->DrawText(cPoint(xChannel, yChannel), *strChannel, theme.Color(clrFont), clrTransparent, font); + +} + +void cChannelJump::Set(int num) { + startTime = cTimeMs::Now(); + if (channel == 0) { + channel = num; + return; + } + int newChannel = channel * 10 + num; + if (newChannel <= maxChannels) + channel = newChannel; +} + +cString cChannelJump::BuildChannelString(void) { + if (channel*10 <= maxChannels) + return cString::sprintf("%d-", channel); + else + return cString::sprintf("%d", channel); +} + + bool cChannelJump::TimeOut(void) { + if ((cTimeMs::Now() - startTime) > timeout) + return true; + return false; + } \ No newline at end of file diff --git a/channeljump.h b/channeljump.h new file mode 100644 index 0000000..6bb988f --- /dev/null +++ b/channeljump.h @@ -0,0 +1,29 @@ +#ifndef __TVGUIDE_CHANNELJUMP_H +#define __TVGUIDE_CHANNELJUMP_H + +#include "styledpixmap.h" + +// --- cChannelJump ------------------------------------------------------------- + +class cChannelJump : public cStyledPixmap { +private: + int channel; + cChannelGroups *channelGroups; + int maxChannels; + int startTime; + int timeout; + cPixmap *pixmapBack; + cPixmap *pixmapText; + void SetPixmaps(void); + void Draw(void); + cString BuildChannelString(void); +public: + cChannelJump(cChannelGroups *channelGroups); + virtual ~cChannelJump(void); + void Set(int num); + void DrawText(void); + bool TimeOut(void); + int GetChannel(void) { return channel; }; +}; + +#endif //__TVGUIDE_CHANNELJUMP_H \ No newline at end of file diff --git a/config.c b/config.c index d88c439..45a53b3 100644 --- a/config.c +++ b/config.c @@ -31,6 +31,7 @@ cTvguideConfig::cTvguideConfig() { jumpChannels = 0; blueKeyMode = 0; closeOnSwitch = 1; + numkeyMode = 0; useRemoteTimers = 0; hideLastGroup = 0; hideChannelLogos = 0; @@ -233,6 +234,7 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "hugeStepHours") == 0) hugeStepHours = atoi(Value); else if (strcmp(Name, "channelJumpMode") == 0) channelJumpMode = atoi(Value); else if (strcmp(Name, "blueKeyMode") == 0) blueKeyMode = atoi(Value); + else if (strcmp(Name, "numkeyMode") == 0) numkeyMode = atoi(Value); else if (strcmp(Name, "closeOnSwitch") == 0) closeOnSwitch = atoi(Value); else if (strcmp(Name, "useRemoteTimers") == 0) useRemoteTimers = atoi(Value); else if (strcmp(Name, "hideLastGroup") == 0) hideLastGroup = atoi(Value); diff --git a/config.h b/config.h index 1ac2810..31cf988 100644 --- a/config.h +++ b/config.h @@ -65,6 +65,7 @@ class cTvguideConfig { int jumpChannels; int blueKeyMode; int closeOnSwitch; + int numkeyMode; int useRemoteTimers; int hideLastGroup; int hideChannelLogos; @@ -161,7 +162,7 @@ class cTvguideConfig { THEME_CLR(theme, clrStyle, CLR_STYLE_BLENDING_DEFAULT); THEME_CLR(theme, clrBackgroundOSD, 0xB012273f); -THEME_CLR(theme, clrBackground, 0xB012273f); +THEME_CLR(theme, clrBackground, 0xFF12273f); THEME_CLR(theme, clrGrid1, 0x00000000); THEME_CLR(theme, clrGrid1Blending, 0x00000000); THEME_CLR(theme, clrGrid2, 0x00000000); diff --git a/geometrymanager.c b/geometrymanager.c index 6c9362d..875e312 100644 --- a/geometrymanager.c +++ b/geometrymanager.c @@ -66,5 +66,9 @@ bool cGeometryManager::SetGeometry(int osdWidth, int osdHeight, bool force) { epgViewHeaderHeight = tvguideConfig.epgViewHeaderPercent * osdHeight / 100; borderRecMenus = 10; + + channelJumpWidth = osdWidth * 30 / 100; + channelJumpHeight = osdHeight * 20 / 100; + return true; } \ No newline at end of file diff --git a/geometrymanager.h b/geometrymanager.h index 43ab3e5..c0c95ba 100644 --- a/geometrymanager.h +++ b/geometrymanager.h @@ -45,6 +45,9 @@ public: int epgViewHeaderHeight; //Recording Menus int borderRecMenus; + //Channel Jump + int channelJumpWidth; + int channelJumpHeight; }; #endif //__TVGUIDE_GEOMETRYMANAGER_H \ No newline at end of file diff --git a/icons/darkredNG/osdElements/channel_jump.png b/icons/darkredNG/osdElements/channel_jump.png new file mode 100644 index 0000000..7f45bd4 Binary files /dev/null and b/icons/darkredNG/osdElements/channel_jump.png differ diff --git a/icons/default/osdElements/channel_jump.png b/icons/default/osdElements/channel_jump.png new file mode 100644 index 0000000..9e417d4 Binary files /dev/null and b/icons/default/osdElements/channel_jump.png differ diff --git a/imagecache.c b/imagecache.c index 9196955..9ddbd04 100644 --- a/imagecache.c +++ b/imagecache.c @@ -9,6 +9,18 @@ cImageCache::cImageCache() : cImageMagickWrapper() { tempStaticLogo = NULL; + groupsHead = NULL; + groupsBottom = NULL; + groupsLeft = NULL; + groupsRight = NULL; + imgLeft = NULL; + imgLeftActive = NULL; + imgRight = NULL; + imgRightActive = NULL; + imgHead = NULL; + imgHeadActive = NULL; + imgBottom = NULL; + imgBottomActive = NULL; } cImageCache::~cImageCache() { @@ -110,6 +122,11 @@ void cImageCache::CreateOsdIconCache(void) { success = LoadIcon("osdElements/epgview_header"); if (success) InsertIntoOsdElementCache(oeEpgHeader, geoManager.osdWidth, geoManager.epgViewHeaderHeight); + + //Channel Jump + success = LoadIcon("osdElements/channel_jump"); + if (success) + InsertIntoOsdElementCache(oeChannelJump, geoManager.channelJumpWidth, geoManager.channelJumpHeight); } void cImageCache::PrepareGridIconCache(void) { diff --git a/imagecache.h b/imagecache.h index 1fd86f2..efe41f3 100644 --- a/imagecache.h +++ b/imagecache.h @@ -29,6 +29,7 @@ enum eOsdElementType { oeDateViewer, oeClock, oeEpgHeader, + oeChannelJump, }; class cImageCache : public cImageMagickWrapper { diff --git a/po/ca_ES.po b/po/ca_ES.po index 3dcabc4..a3ad868 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-22 10:44+0100\n" +"POT-Creation-Date: 2013-12-23 09:03+0100\n" "PO-Revision-Date: 2013-09-21 17:49+0200\n" "Last-Translator: My friend Thanks David \n" "Language-Team: \n" @@ -18,6 +18,9 @@ msgstr "" msgid "Main Program" msgstr "Programa principal" +msgid "Channel" +msgstr "Canal" + msgid "RERUNS OF THIS SHOW" msgstr "REEMISSIONS" @@ -183,9 +186,6 @@ msgstr "Cancel·la" msgid "Create Series Timer based on" msgstr "Programa enregistrament de Sèries segons" -msgid "Channel" -msgstr "Canal" - msgid "Series Timer start time" msgstr "Inici temporitzador Sèries" @@ -405,6 +405,12 @@ msgstr "Blau: Canvi de canal, OK: EPG detallat" msgid "Blue: Detailed EPG, Ok: Channel Switch" msgstr "Blau: EPG detallat, OK: Canvi de canal" +msgid "Timely Jump" +msgstr "" + +msgid "Jump to specific channel" +msgstr "" + msgid "never" msgstr "mai" @@ -438,6 +444,9 @@ msgstr "Botons Blau i OK" msgid "Close TVGuide after channel switch" msgstr "Tanca GuiaTV després del canvi de canal" +msgid "Functionality of numeric Keys" +msgstr "" + msgid "Hide last Channel Group" msgstr "Amaga el darrer grup de canals" @@ -635,6 +644,3 @@ msgstr "" msgid "Channel Groups Cache" msgstr "" - -#~ msgid "Height of Footer" -#~ msgstr "Alçada del Peu" diff --git a/po/de_DE.po b/po/de_DE.po index 7d9b3c0..84b1f97 100755 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-17 18:24+0100\n" +"POT-Creation-Date: 2013-12-23 09:03+0100\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n" "Last-Translator: Horst\n" "Language-Team: \n" @@ -15,6 +15,9 @@ msgstr "" msgid "Main Program" msgstr "Hauptprogramm" +msgid "Channel" +msgstr "Kanal" + msgid "RERUNS OF THIS SHOW" msgstr "Wiederholungen dieser Sendung" @@ -180,9 +183,6 @@ msgstr "Abbrechen" msgid "Create Series Timer based on" msgstr "Serientimer anlegen basierend auf" -msgid "Channel" -msgstr "Kanal" - msgid "Series Timer start time" msgstr "Serientimer Start Zeit" @@ -402,6 +402,12 @@ msgstr "Blau: Umschalten, OK: Detailiertes EPG" msgid "Blue: Detailed EPG, Ok: Channel Switch" msgstr "Blau: Detailiertes EPG, OK: Umschalten" +msgid "Timely Jump" +msgstr "Zeitsprung" + +msgid "Jump to specific channel" +msgstr "Sprung zu deinem bestimmten Kanal" + msgid "never" msgstr "nie" @@ -435,6 +441,9 @@ msgstr "Tasten Blau und OK" msgid "Close TVGuide after channel switch" msgstr "TVGuide nach Umschalten schließen" +msgid "Functionality of numeric Keys" +msgstr "Funktion der Nummerntasten" + msgid "Hide last Channel Group" msgstr "Letzte Kanalgruppe verstecken" diff --git a/po/ru_RU.po b/po/ru_RU.po index 0ad486b..574d4bf 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-22 10:44+0100\n" +"POT-Creation-Date: 2013-12-23 09:03+0100\n" "PO-Revision-Date: 2013-09-25 17:49+0400\n" "Last-Translator: AmiD, ilya\n" "Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n" @@ -15,6 +15,9 @@ msgstr "" msgid "Main Program" msgstr "Основная программа" +msgid "Channel" +msgstr "Канал" + msgid "RERUNS OF THIS SHOW" msgstr "ПОВТОРЫ ЭТОЙ ПЕРЕДАЧИ" @@ -180,9 +183,6 @@ msgstr "Отменить" msgid "Create Series Timer based on" msgstr "Настроить циклический таймер" -msgid "Channel" -msgstr "Канал" - msgid "Series Timer start time" msgstr "Время с" @@ -402,6 +402,12 @@ msgstr "Синяя: Переключить канал, OK: Подробный EP msgid "Blue: Detailed EPG, Ok: Channel Switch" msgstr "Синяя: Подробный EPG, OK: Переключить канал" +msgid "Timely Jump" +msgstr "" + +msgid "Jump to specific channel" +msgstr "" + msgid "never" msgstr "никогда" @@ -435,6 +441,9 @@ msgstr "Синяя кнопка и OK" msgid "Close TVGuide after channel switch" msgstr "Закрывать TVGuide при переключении канала" +msgid "Functionality of numeric Keys" +msgstr "" + msgid "Hide last Channel Group" msgstr "Скрывать последнюю группу каналов" @@ -632,6 +641,3 @@ msgstr "" msgid "Channel Groups Cache" msgstr "" - -#~ msgid "Height of Footer" -#~ msgstr "Высота нижней панели (кнопкок)" diff --git a/po/sk_SK.po b/po/sk_SK.po index b049765..a42f286 100644 --- a/po/sk_SK.po +++ b/po/sk_SK.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-22 10:44+0100\n" +"POT-Creation-Date: 2013-12-23 09:03+0100\n" "PO-Revision-Date: 2013-09-15 00:12+0100\n" "Last-Translator: Milan Hrala \n" "Language-Team: \n" @@ -15,6 +15,9 @@ msgstr "" msgid "Main Program" msgstr "Hlavn program" +msgid "Channel" +msgstr "Kanl" + msgid "RERUNS OF THIS SHOW" msgstr "Reprza tohto programu" @@ -180,9 +183,6 @@ msgstr "Zru msgid "Create Series Timer based on" msgstr "Vytvorenie plnu na zklade srie" -msgid "Channel" -msgstr "Kanl" - msgid "Series Timer start time" msgstr "Sriov pln zana" @@ -402,6 +402,12 @@ msgstr "Modr msgid "Blue: Detailed EPG, Ok: Channel Switch" msgstr "Modr: podrobn EPG, OK: prepn kanl" +msgid "Timely Jump" +msgstr "" + +msgid "Jump to specific channel" +msgstr "" + msgid "never" msgstr "nikdy" @@ -435,6 +441,9 @@ msgstr "Tla msgid "Close TVGuide after channel switch" msgstr "Zavrie TVGuide po prepnut kanlu" +msgid "Functionality of numeric Keys" +msgstr "" + msgid "Hide last Channel Group" msgstr "Skry posledn skupinu kanlov" @@ -632,6 +641,3 @@ msgstr "" msgid "Channel Groups Cache" msgstr "" - -#~ msgid "Height of Footer" -#~ msgstr "Vka zptia" diff --git a/setup.c b/setup.c index c13af68..29ddacd 100644 --- a/setup.c +++ b/setup.c @@ -78,6 +78,7 @@ void cTvguideSetup::Store(void) { SetupStore("hugeStepHours", tvguideConfig.hugeStepHours); SetupStore("channelJumpMode", tvguideConfig.channelJumpMode); SetupStore("blueKeyMode", tvguideConfig.blueKeyMode); + SetupStore("numkeyMode", tvguideConfig.numkeyMode); SetupStore("useRemoteTimers", tvguideConfig.useRemoteTimers); SetupStore("closeOnSwitch", tvguideConfig.closeOnSwitch); SetupStore("hideLastGroup", tvguideConfig.hideLastGroup); @@ -164,6 +165,8 @@ cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu( jumpMode[1] = tr("previous / next channel group"); blueMode[0] = tr("Blue: Channel Switch, Ok: Detailed EPG"); blueMode[1] = tr("Blue: Detailed EPG, Ok: Channel Switch"); + numMode[0] = tr("Timely Jump"); + numMode[1] = tr("Jump to specific channel"); useSubtitleRerunTexts[0] = tr("never"); useSubtitleRerunTexts[1] = tr("if exists"); useSubtitleRerunTexts[2] = tr("always"); @@ -185,6 +188,7 @@ void cMenuSetupGeneral::Set(void) { Add(new cMenuEditStraItem(tr("Channel Jump Mode (Keys Green / Yellow)"), &tmpTvguideConfig->channelJumpMode, 2, jumpMode)); Add(new cMenuEditStraItem(tr("Keys Blue and OK"), &tmpTvguideConfig->blueKeyMode, 2, blueMode)); Add(new cMenuEditBoolItem(tr("Close TVGuide after channel switch"), &tmpTvguideConfig->closeOnSwitch)); + Add(new cMenuEditStraItem(tr("Functionality of numeric Keys"), &tmpTvguideConfig->numkeyMode, 2, numMode)); Add(new cMenuEditBoolItem(tr("Hide last Channel Group"), &tmpTvguideConfig->hideLastGroup)); Add(new cMenuEditIntItem(tr("Time to display in minutes"), &tmpTvguideConfig->displayTime, 120, 320)); Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12)); diff --git a/setup.h b/setup.h index 07a9f71..6eef9df 100644 --- a/setup.h +++ b/setup.h @@ -35,6 +35,7 @@ class cMenuSetupGeneral : public cMenuSetupSubMenu { const char * timeFormatItems[2]; const char * jumpMode[2]; const char * blueMode[2]; + const char * numMode[2]; const char *useSubtitleRerunTexts[3]; void Set(void); public: diff --git a/styledpixmap.c b/styledpixmap.c index 41bdf28..661ca08 100644 --- a/styledpixmap.c +++ b/styledpixmap.c @@ -59,6 +59,8 @@ void cStyledPixmap::drawBackgroundGraphical(eBackgroundType type, bool active) { pixmap->Fill(clrTransparent); } return; + } else if (type == bgChannelJump) { + back = imgCache.GetOsdElement(oeChannelJump); } if (back) { pixmap->DrawImage(cPoint(0,0), *back); diff --git a/styledpixmap.h b/styledpixmap.h index 8ce094f..dbcc293 100644 --- a/styledpixmap.h +++ b/styledpixmap.h @@ -16,6 +16,7 @@ enum eBackgroundType { bgEpgHeader, bgButton, bgRecMenuBack, + bgChannelJump, }; // --- cStyledPixmap ------------------------------------------------------------- diff --git a/themes/tvguide-default.theme b/themes/tvguide-default.theme index d241874..782cf21 100644 --- a/themes/tvguide-default.theme +++ b/themes/tvguide-default.theme @@ -1,6 +1,6 @@ Description = Default clrStyle = 66666666 -clrBackground = B012273f +clrBackground = FF12273f clrBackgroundOSD = B012273f clrGrid1 = 00000000 clrGrid1Blending = 00000000 diff --git a/tvguideosd.c b/tvguideosd.c index 344c625..e1a5c34 100644 --- a/tvguideosd.c +++ b/tvguideosd.c @@ -16,6 +16,7 @@ cTvGuideOsd::cTvGuideOsd(void) { activeGrid = NULL; timeLine = NULL; recMenuManager = NULL; + channelJumper = NULL; } cTvGuideOsd::~cTvGuideOsd() { @@ -30,6 +31,8 @@ cTvGuideOsd::~cTvGuideOsd() { delete channelGroups; delete footer; delete recMenuManager; + if (channelJumper) + delete channelJumper; osdManager.deleteOsd(); } @@ -502,6 +505,7 @@ eOSState cTvGuideOsd::ChannelSwitch() { if (detailView) { delete detailView; detailView = NULL; + detailViewActive = false; } return osEnd; } @@ -522,69 +526,89 @@ void cTvGuideOsd::DetailedEPG() { } } -void cTvGuideOsd::processKey1() { - bool tooFarInPast = myTime->DelStep(tvguideConfig.bigStepHours*60); - if (tooFarInPast) +void cTvGuideOsd::processNumKey(int numKey) { + esyslog("tvguide: %d pressed", numKey); + if (tvguideConfig.numkeyMode == 0) { + //timely jumps with 1,3,4,6,7,9 + TimeJump(numKey); + } else { + //jump to specific channel + ChannelJump(numKey); + } +} + +void cTvGuideOsd::TimeJump(int mode) { + switch (mode) { + case 1: { + bool tooFarInPast = myTime->DelStep(tvguideConfig.bigStepHours*60); + if (tooFarInPast) + return; + } + break; + case 3: { + myTime->AddStep(tvguideConfig.bigStepHours*60); + } + break; + case 4: { + bool tooFarInPast = myTime->DelStep(tvguideConfig.hugeStepHours*60); + if (tooFarInPast) + return; + } + break; + case 6: { + myTime->AddStep(tvguideConfig.hugeStepHours*60); + } + break; + case 7: { + cMyTime primeChecker; + primeChecker.Now(); + time_t prevPrime = primeChecker.getPrevPrimetime(myTime->GetStart()); + if (primeChecker.tooFarInPast(prevPrime)) + return; + myTime->SetTime(prevPrime); + } + break; + case 9: { + cMyTime primeChecker; + time_t nextPrime = primeChecker.getNextPrimetime(myTime->GetStart()); + myTime->SetTime(nextPrime); + } + break; + default: + return; + } + drawGridsTimeJump(); + timeLine->drawDateViewer(); + timeLine->drawClock(); + timeLine->setTimeline(); + osdManager.flush(); +} + +void cTvGuideOsd::ChannelJump(int num) { + if (!channelJumper) { + channelJumper = new cChannelJump(channelGroups); + } + channelJumper->Set(num); + channelJumper->DrawText(); + osdManager.flush(); +} + +void cTvGuideOsd::CheckTimeout(void) { + if (!channelJumper) return; - drawGridsTimeJump(); - timeLine->drawDateViewer(); - timeLine->drawClock(); - timeLine->setTimeline(); - osdManager.flush(); -} - -void cTvGuideOsd::processKey3() { - myTime->AddStep(tvguideConfig.bigStepHours*60); - drawGridsTimeJump(); - timeLine->drawDateViewer(); - timeLine->drawClock(); - timeLine->setTimeline(); - osdManager.flush(); -} - -void cTvGuideOsd::processKey4() { - bool tooFarInPast = myTime->DelStep(tvguideConfig.hugeStepHours*60); - if (tooFarInPast) - return; - drawGridsTimeJump(); - timeLine->drawDateViewer(); - timeLine->drawClock(); - timeLine->setTimeline(); - osdManager.flush(); -} - -void cTvGuideOsd::processKey6() { - myTime->AddStep(tvguideConfig.hugeStepHours*60); - drawGridsTimeJump(); - timeLine->drawDateViewer(); - timeLine->drawClock(); - timeLine->setTimeline(); - osdManager.flush(); -} - -void cTvGuideOsd::processKey7() { - cMyTime *primeChecker = new cMyTime(); - primeChecker->Now(); - time_t prevPrime = primeChecker->getPrevPrimetime(myTime->GetStart()); - if (primeChecker->tooFarInPast(prevPrime)) - return; - myTime->SetTime(prevPrime); - drawGridsTimeJump(); - timeLine->drawDateViewer(); - timeLine->drawClock(); - timeLine->setTimeline(); - osdManager.flush(); -} - -void cTvGuideOsd::processKey9() { - cMyTime *primeChecker = new cMyTime(); - time_t nextPrime = primeChecker->getNextPrimetime(myTime->GetStart()); - myTime->SetTime(nextPrime); - drawGridsTimeJump(); - timeLine->drawDateViewer(); - timeLine->drawClock(); - timeLine->setTimeline(); - osdManager.flush(); + if (channelJumper->TimeOut()) { + int newChannelNum = channelJumper->GetChannel(); + delete channelJumper; + channelJumper = NULL; + const cChannel *newChannel = Channels.GetByNumber(newChannelNum); + if (newChannel) { + readChannels(newChannel); + if (columns.Count() > 0) { + drawGridsChannelJump(); + } + } + osdManager.flush(); + } } void cTvGuideOsd::SetTimers() { @@ -636,12 +660,8 @@ eOSState cTvGuideOsd::ProcessKey(eKeys Key) { case kBlue: state = processKeyBlue(); break; case kOk: state = processKeyOk(); break; case kBack: state=osEnd; break; - case k1: processKey1(); break; - case k3: processKey3(); break; - case k4: processKey4(); break; - case k6: processKey6(); break; - case k7: processKey7(); break; - case k9: processKey9(); break; + case k0 ... k9: processNumKey(Key - k0); break; + case kNone: if (channelJumper) CheckTimeout(); break; default: break; } } diff --git a/tvguideosd.h b/tvguideosd.h index d4d936f..cc266ef 100644 --- a/tvguideosd.h +++ b/tvguideosd.h @@ -10,6 +10,7 @@ #include "channelgroups.h" #include "footer.h" #include "recmenumanager.h" +#include "channeljump.h" // --- cTvGuideOsd ------------------------------------------------------------- @@ -24,6 +25,7 @@ private: cChannelGroups *channelGroups; cFooter *footer; cRecMenuManager *recMenuManager; + cChannelJump *channelJumper; bool detailViewActive; void drawOsd(); void readChannels(const cChannel *channelStart); @@ -38,12 +40,10 @@ private: void processKeyYellow(); eOSState processKeyBlue(); eOSState processKeyOk(); - void processKey1(); - void processKey3(); - void processKey4(); - void processKey6(); - void processKey7(); - void processKey9(); + void processNumKey(int numKey); + void TimeJump(int mode); + void ChannelJump(int num); + void CheckTimeout(void); void setNextActiveGrid(cGrid *next); void channelForward(); void channelBack();