diff --git a/HISTORY b/HISTORY index 13c04da..9a8fa2c 100644 --- a/HISTORY +++ b/HISTORY @@ -65,3 +65,7 @@ VDR Plugin 'tvguide' Revision History 2013-07-23: Version 1.0.0 - added tvscraper support + +Version 1.1.0 + +- changed build system diff --git a/Makefile b/Makefile index b668830..c41f260 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ LIBS += $(shell pkg-config --libs Magick++) ### The object files (add further files here): -OBJS = $(PLUGIN).o +OBJS = $(PLUGIN).o channelcolumn.o channelgroup.o channelgroups.o config.o detailview.o dummygrid.o epggrid.o footer.o grid.o headergrid.o imageloader.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/channelcolumn.c b/channelcolumn.c index b0a1c0a..69018a7 100644 --- a/channelcolumn.c +++ b/channelcolumn.c @@ -1,4 +1,5 @@ #include "channelcolumn.h" +#include "dummygrid.h" cChannelColumn::cChannelColumn(int num, const cChannel *channel, cMyTime *myTime) { this->channel = channel; diff --git a/channelcolumn.h b/channelcolumn.h index 1dbd174..0e1d138 100644 --- a/channelcolumn.h +++ b/channelcolumn.h @@ -1,9 +1,16 @@ #ifndef __TVGUIDE_CHANNELCOLUMN_H #define __TVGUIDE_CHANNELCOLUMN_H +#include +#include "grid.h" +#include "epggrid.h" +#include "headergrid.h" +#include "switchtimer.h" + class cGrid; class cEpgGrid; class cHeaderGrid; + // --- cChannelColumn ------------------------------------------------------------- class cChannelColumn : public cListObject, public cStyledPixmap { diff --git a/channelgroup.c b/channelgroup.c index 889318e..4008a67 100644 --- a/channelgroup.c +++ b/channelgroup.c @@ -1,4 +1,6 @@ +#include #include "channelgroup.h" +#include "tools.h" cChannelGroup::cChannelGroup(const char *name) { channelStart = 0; diff --git a/channelgroup.h b/channelgroup.h index 880f24b..a8984ce 100644 --- a/channelgroup.h +++ b/channelgroup.h @@ -1,6 +1,10 @@ #ifndef __TVGUIDE_CHANNELGROUP_H #define __TVGUIDE_CHANNELGROUP_H +#include +#include "styledpixmap.h" + + // --- cChannelGroup ------------------------------------------------------------- class cChannelGroup { diff --git a/channelgroups.h b/channelgroups.h index 3bab829..3465c47 100644 --- a/channelgroups.h +++ b/channelgroups.h @@ -1,6 +1,10 @@ #ifndef __TVGUIDE_CHANNELGROUPS_H #define __TVGUIDE_CHANNELGROUPS_H +#include +#include +#include "channelgroup.h" + // --- cChannelGroups ------------------------------------------------------------- class cChannelGroups { diff --git a/config.c b/config.c index 4d74d5f..d593a40 100644 --- a/config.c +++ b/config.c @@ -1,20 +1,5 @@ #include "config.h" -enum { - e12Hours, - e24Hours -}; - -enum { - eVertical, - eHorizontal -}; - -enum { - eNumJump, - eGroupJump -}; - cTvguideConfig::cTvguideConfig() { showMainMenuEntry = 1; replaceOriginalSchedule = 0; diff --git a/config.h b/config.h index a92038c..c69710c 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,25 @@ #ifndef __TVGUIDE_CONFIG_H #define __TVGUIDE_CONFIG_H +#include +#include +#include "osdmanager.h" + +enum { + e12Hours, + e24Hours +}; + +enum { + eVertical, + eHorizontal +}; + +enum { + eNumJump, + eGroupJump +}; + class cTvguideConfig { private: void SetGeometry(int width, int height); @@ -127,4 +146,70 @@ class cTvguideConfig { void loadTheme(); }; +#ifdef DEFINE_CONFIG + cTvguideConfig tvguideConfig; + cOsdManager osdManager; + cTheme theme; + cPlugin* pRemoteTimers = NULL; +#else + extern cTvguideConfig tvguideConfig; + extern cOsdManager osdManager; + extern cTheme theme; + extern cPlugin* pRemoteTimers; +#endif + + +// --- Theme ------------------------------------------------------------- +//BLENDING SETUP +#define CLR_BLENDING_NOPACITY 0xFFFFFFFF +#define CLR_BLENDING_DEFAULT 0xAAAAAAAA +#define CLR_BLENDING_OFF 0x00000000 + +THEME_CLR(theme, clrDoBlending, CLR_BLENDING_DEFAULT); +THEME_CLR(theme, clrBackgroundOSD, clrBlack); +THEME_CLR(theme, clrBackground, clrBlack); +THEME_CLR(theme, clrGrid1, 0xFF404749); +THEME_CLR(theme, clrGrid1Blending, 0xFF000000); +THEME_CLR(theme, clrGrid2, 0xFF20293F); +THEME_CLR(theme, clrGrid2Blending, 0xFF000000); +THEME_CLR(theme, clrHighlight, 0xFFFF4D00); +THEME_CLR(theme, clrHighlightBlending, 0xFF000000); +THEME_CLR(theme, clrFont, clrWhite); +THEME_CLR(theme, clrFontActive, clrWhite); +THEME_CLR(theme, clrFontHeader, clrWhite); +THEME_CLR(theme, clrFontButtons, clrWhite); +THEME_CLR(theme, clrStatusHeader, clrBlack); +THEME_CLR(theme, clrStatusHeaderBlending, clrBlack); +THEME_CLR(theme, clrHeader, clrBlack); +THEME_CLR(theme, clrHeaderBlending, 0xFFE0E0E0); +THEME_CLR(theme, clrBorder, clrWhite); +THEME_CLR(theme, clrTimeline1, clrWhite); +THEME_CLR(theme, clrTimeline1Blending, 0xFF828282); +THEME_CLR(theme, clrTimeline2, clrBlack); +THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F); +THEME_CLR(theme, clrButtonRed, 0x99BB0000); +THEME_CLR(theme, clrButtonRedBorder, 0xFFBB0000); +THEME_CLR(theme, clrButtonGreen, 0x9900BB00); +THEME_CLR(theme, clrButtonGreenBorder, 0xFF00BB00); +THEME_CLR(theme, clrButtonYellow, 0x99BBBB00); +THEME_CLR(theme, clrButtonYellowBorder, 0xFFBBBB00); +THEME_CLR(theme, clrButtonBlue, 0x990000BB); +THEME_CLR(theme, clrButtonBlueBorder, 0xFF0000BB); +THEME_CLR(theme, clrButtonBlend, 0xDD000000); +THEME_CLR(theme, clrRecMenuBackground, 0xB0000000); +THEME_CLR(theme, clrRecMenuTimerConflictBackground, 0xFFCCCCCC); +THEME_CLR(theme, clrRecMenuTimerConflictBar, 0xFF222222); +THEME_CLR(theme, clrRecMenuTimerConflictOverlap, 0xAAFF0000); +THEME_CLR(theme, clrRecMenuDayActive, 0xFF00FF00); +THEME_CLR(theme, clrRecMenuDayInactive, 0xFFFF0000); +THEME_CLR(theme, clrRecMenuDayHighlight, 0x44FFFFFF); +THEME_CLR(theme, clrRecMenuTextBack, 0xFF000000); +THEME_CLR(theme, clrRecMenuTextActiveBack, 0xFF404749); +THEME_CLR(theme, clrRecMenuKeyboardBack, 0xFF000000); +THEME_CLR(theme, clrRecMenuKeyboardBorder, clrWhite); +THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x55FFFFFF); +THEME_CLR(theme, clrButtonRedKeyboard, 0xFFBB0000); +THEME_CLR(theme, clrButtonGreenKeyboard, 0xFF00BB00); +THEME_CLR(theme, clrButtonYellowKeyboard, 0xFFBBBB00); + #endif //__TVGUIDE_CONFIG_H \ No newline at end of file diff --git a/detailview.c b/detailview.c index abb1955..9d25449 100644 --- a/detailview.c +++ b/detailview.c @@ -1,4 +1,10 @@ #include +#include +#include "imageloader.h" +#include "services/epgsearch.h" +#include "services/remotetimers.h" +#include "config.h" +#include "tools.h" #include "detailview.h" cDetailView::cDetailView(const cEvent *event) { diff --git a/detailview.h b/detailview.h index 4cb4ee1..9aba9c1 100644 --- a/detailview.h +++ b/detailview.h @@ -1,6 +1,12 @@ #ifndef __TVGUIDE_DETAILVIEW_H #define __TVGUIDE_DETAILVIEW_H +#include +#include +#include +#include "services/tvscraper.h" +#include "styledpixmap.h" + // --- cDetailView ------------------------------------------------------------- class cEpgGrid; diff --git a/dummygrid.h b/dummygrid.h index 22d4113..f0837f6 100644 --- a/dummygrid.h +++ b/dummygrid.h @@ -1,6 +1,9 @@ #ifndef __TVGUIDE_DUMMYGRID_H #define __TVGUIDE_DUMMYGRID_H +#include "grid.h" +#include "channelcolumn.h" + // --- cDummyGrid ------------------------------------------------------------- class cDummyGrid : public cGrid { diff --git a/epggrid.c b/epggrid.c index e30d327..4f48d4d 100644 --- a/epggrid.c +++ b/epggrid.c @@ -1,4 +1,6 @@ +#include "services/remotetimers.h" #include "channelcolumn.h" +#include "tools.h" #include "epggrid.h" cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) : cGrid(c) { diff --git a/epggrid.h b/epggrid.h index 0bf7536..95f40ea 100644 --- a/epggrid.h +++ b/epggrid.h @@ -1,6 +1,9 @@ #ifndef __TVGUIDE_EPGGRID_H #define __TVGUIDE_EPGGRID_H +#include +#include "grid.h" + // --- cEpgGrid ------------------------------------------------------------- class cEpgGrid : public cGrid { diff --git a/footer.c b/footer.c index 1f273f9..36bf652 100644 --- a/footer.c +++ b/footer.c @@ -1,3 +1,6 @@ +#include +#include "imageloader.h" +#include "tools.h" #include "footer.h" cFooter::cFooter(cChannelGroups *channelGroups) { diff --git a/footer.h b/footer.h index b6b7cc6..9a640bd 100644 --- a/footer.h +++ b/footer.h @@ -1,6 +1,9 @@ #ifndef __TVGUIDE_FOOTER_H #define __TVGUIDE_FOOTER_H +#include +#include "channelgroups.h" + // --- cFooter ------------------------------------------------------------- class cFooter { diff --git a/grid.h b/grid.h index d51271b..bd35af1 100644 --- a/grid.h +++ b/grid.h @@ -1,6 +1,11 @@ #ifndef __TVGUIDE_GRID_H #define __TVGUIDE_GRID_H +#include +#include "styledpixmap.h" + +class cChannelColumn; + // --- cEpgGrid ------------------------------------------------------------- class cGrid : public cListObject, public cStyledPixmap { diff --git a/headergrid.c b/headergrid.c index 4bb25c8..d4abe59 100644 --- a/headergrid.c +++ b/headergrid.c @@ -1,3 +1,5 @@ +#include "imageloader.h" +#include "tools.h" #include "headergrid.h" cHeaderGrid::cHeaderGrid(void) : cGrid(NULL) { diff --git a/headergrid.h b/headergrid.h index 10bb42b..a4f0962 100644 --- a/headergrid.h +++ b/headergrid.h @@ -1,6 +1,8 @@ #ifndef __TVGUIDE_HEADERGRID_H #define __TVGUIDE_HEADERGRID_H +#include "grid.h" + // --- cHeaderGrid ------------------------------------------------------------- class cHeaderGrid : public cGrid { diff --git a/imageloader.c b/imageloader.c index 1b8fc71..1a25ea1 100644 --- a/imageloader.c +++ b/imageloader.c @@ -1,9 +1,11 @@ -#include "imageloader.h" #include #include #include #include +#include "config.h" +#include "imageloader.h" + using namespace Magick; cImageLoader::cImageLoader() { diff --git a/messagebox.c b/messagebox.c deleted file mode 100644 index 5d8a6b4..0000000 --- a/messagebox.c +++ /dev/null @@ -1,111 +0,0 @@ -#include "messagebox.h" - -cMessageBoxThread::cMessageBoxThread(cPixmap *content, int displayTime) { - this->content = content; - FrameTime = 30; // ms - FadeTime = 200; // ms - this->displayTime = displayTime; -} - -cMessageBoxThread::~cMessageBoxThread(void) { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); -} - -void cMessageBoxThread::Action(void) { - uint64_t Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = t * ALPHA_OPAQUE; - if (Running() && content) { - content->SetAlpha(Alpha); - osdManager.flush(); - } - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Delta < FrameTime) - cCondWait::SleepMs(FrameTime - Delta); - if ((Now - Start) > FadeTime) - break; - } - cCondWait::SleepMs(displayTime - 2*FadeTime); - Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = (1-t) * ALPHA_OPAQUE; - if (Running() && content) { - content->SetAlpha(Alpha); - osdManager.flush(); - } - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Delta < FrameTime) - cCondWait::SleepMs(FrameTime - Delta); - if ((Now - Start) > FadeTime) - break; - } - osdManager.flush(); -} - -//--cMessageBox------------------------------------------------------------- -cMessageBoxThread *cMessageBox::msgboxThread = NULL; -cPixmap *cMessageBox::content = NULL; - -bool cMessageBox::Start(int displayTime, cString msg) { - int width = (tvguideConfig.osdWidth - 600)/2; - if (!content) { - int height = 400; - content = osdManager.requestPixmap(5, cRect((tvguideConfig.osdWidth - width)/2, - (tvguideConfig.osdHeight- height)/2, - width, height)); - } - if (msgboxThread) { - delete msgboxThread; - msgboxThread = NULL; - } - if (!msgboxThread) { - msgboxThread = new cMessageBoxThread(content, displayTime); - cTextWrapper message; - message.Set(msg, tvguideConfig.FontMessageBox, width - 40); - int textHeight = tvguideConfig.FontMessageBox->Height(); - int textLines = message.Lines(); - int height = textLines * (textHeight+20); - cPixmap::Lock(); - content->SetViewPort(cRect((tvguideConfig.osdWidth - width)/2,(tvguideConfig.osdHeight- height)/2, width, height)); - content->SetAlpha(0); - content->Fill(theme.Color(clrBorder)); - content->DrawRectangle(cRect(2,2,width-4, height-4), theme.Color(clrBackground)); - int textWidth = 0; - for (int i=0; iWidth(message.GetLine(i)); - content->DrawText(cPoint((width - textWidth)/2, 20 + i*textHeight), message.GetLine(i), theme.Color(clrFont), theme.Color(clrBackground), tvguideConfig.FontMessageBox); - } - cPixmap::Unlock(); - msgboxThread->Start(); - return true; - } - return false; -} - -void cMessageBox::Stop(void) { - if (msgboxThread) { - delete msgboxThread; - msgboxThread = NULL; - } -} - -void cMessageBox::Destroy(void) { - if (msgboxThread) { - delete msgboxThread; - msgboxThread = NULL; - } - if (content) { - osdManager.releasePixmap(content); - content = NULL; - } -} diff --git a/messagebox.h b/messagebox.h deleted file mode 100644 index 364336a..0000000 --- a/messagebox.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __TVGUIDE_MESSAGEBOX_H -#define __TVGUIDE_MESSAGEBOX_H - -// --- cMessageBox ------------------------------------------------------------- - -class cMessageBoxThread : public cThread { -private: - cPixmap *content; - int FadeTime; - int FrameTime; - int displayTime; - virtual void Action(void); -public: - cMessageBoxThread(cPixmap *content, int displayTime); - virtual ~cMessageBoxThread(void); -}; - -class cMessageBox { -private: - static cMutex mutex; - static cMessageBoxThread *msgboxThread; - static cPixmap *content; -public: - static bool Start(int displayTime, cString msg); - static void Stop(void); - static void Destroy(void); -}; - -#endif //__TVGUIDE_MESSAGEBOX_H \ No newline at end of file diff --git a/osdmanager.c b/osdmanager.c index c74162d..1f2d54b 100644 --- a/osdmanager.c +++ b/osdmanager.c @@ -1,24 +1,5 @@ -#ifndef __TVGUIDE_OSDMANAGER_H -#define __TVGUIDE_OSDMANAGER_H - -class cOsdManager { - private: - cOsd *osd; - public: - cOsdManager(void); - bool setOsd(); - void setBackground(); - void flush() {osd->Flush();}; - cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); - void releasePixmap(cPixmap *pixmap); - void deleteOsd() {delete osd;}; - int Width() { return osd->Width(); }; - int Height() { return osd->Height(); }; - int Top() { return osd->Top(); }; - int Left() { return osd->Left(); }; -}; - -#endif //__TVGUIDE_OSDMANAGER_H +#include "config.h" +#include "osdmanager.h" cOsdManager::cOsdManager(void) { } diff --git a/osdmanager.h b/osdmanager.h new file mode 100644 index 0000000..a0c7936 --- /dev/null +++ b/osdmanager.h @@ -0,0 +1,23 @@ +#ifndef __TVGUIDE_OSDMANAGER_H +#define __TVGUIDE_OSDMANAGER_H + +#include + +class cOsdManager { + private: + cOsd *osd; + public: + cOsdManager(void); + bool setOsd(); + void setBackground(); + void flush() {osd->Flush();}; + cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); + void releasePixmap(cPixmap *pixmap); + void deleteOsd() {delete osd;}; + int Width() { return osd->Width(); }; + int Height() { return osd->Height(); }; + int Top() { return osd->Top(); }; + int Left() { return osd->Left(); }; +}; + +#endif //__TVGUIDE_OSDMANAGER_H diff --git a/recmanager.c b/recmanager.c index df3e815..54e05f1 100644 --- a/recmanager.c +++ b/recmanager.c @@ -1,5 +1,14 @@ #include +#include #include +#include + +#include +#include "services/epgsearch.h" +#include "services/remotetimers.h" +#include "services/tvscraper.h" +#include "tools.h" +#include "switchtimer.h" #include "recmanager.h" static int CompareRecording(const void *p1, const void *p2) { diff --git a/recmanager.h b/recmanager.h index 6deb681..158991f 100644 --- a/recmanager.h +++ b/recmanager.h @@ -1,6 +1,12 @@ #ifndef __TVGUIDE_RECMMANAGER_H #define __TVGUIDE_RECMMANAGER_H +#include +#include +#include +#include "detailview.h" +#include "recmenu.h" + class TVGuideTimerConflict { public: time_t time; diff --git a/recmenu.h b/recmenu.h index 87d3ef5..3445a63 100644 --- a/recmenu.h +++ b/recmenu.h @@ -1,6 +1,8 @@ #ifndef __TVGUIDE_RECMENU_H #define __TVGUIDE_RECMENU_H +#include "recmenuitem.h" + // --- cRecMenu ------------------------------------------------------------- class cRecMenu : public cStyledPixmap { diff --git a/recmenuitem.c b/recmenuitem.c index 082ec4c..0854a7a 100644 --- a/recmenuitem.c +++ b/recmenuitem.c @@ -1,5 +1,7 @@ #include #include +#include "imageloader.h" +#include "tools.h" #include "recmenuitem.h" // --- cRecMenuItem ------------------------------------------------------------- diff --git a/recmenuitem.h b/recmenuitem.h index 09fbbec..431b74e 100644 --- a/recmenuitem.h +++ b/recmenuitem.h @@ -3,6 +3,10 @@ #define AUTO_ADVANCE_TIMEOUT 1500 +#include +#include +#include "styledpixmap.h" + enum eRecMenuState { rmsConsumed, rmsNotConsumed, diff --git a/recmenumanager.c b/recmenumanager.c index 0e4871d..75d6555 100644 --- a/recmenumanager.c +++ b/recmenumanager.c @@ -1,3 +1,6 @@ +#include "recmenu.h" +#include "recmenus.h" +#include "switchtimer.h" #include "recmenumanager.h" cRecMenuManager::cRecMenuManager(void) { diff --git a/recmenumanager.h b/recmenumanager.h index 71d6f49..c000686 100644 --- a/recmenumanager.h +++ b/recmenumanager.h @@ -1,6 +1,10 @@ #ifndef __TVGUIDE_RECMENUMANAGER_H #define __TVGUIDE_RECMENUMANAGER_H +#include "recmenu.h" +#include "recmanager.h" +#include "services/epgsearch.h" + // --- cRecMenuManager ------------------------------------------------------------- class cRecMenuManager { private: diff --git a/recmenus.c b/recmenus.c index c321fc2..f3eff0d 100644 --- a/recmenus.c +++ b/recmenus.c @@ -1,1030 +1,849 @@ -#define TEXTINPUTLENGTH 80 +#include "services/remotetimers.h" +#include "recmenus.h" // --- cRecMenuMain --------------------------------------------------------- -class cRecMenuMain : public cRecMenu { -public: - cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) { - eRecMenuState action; - if (!timerActive) { - action = (tvguideConfig.recMenuAskFolder) - ?rmsInstantRecordFolder - :rmsInstantRecord; - AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true)); - } else { - AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true)); - AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false)); - } +cRecMenuMain::cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) { + eRecMenuState action; + if (!timerActive) { action = (tvguideConfig.recMenuAskFolder) - ?rmsSeriesTimerFolder - :rmsSeriesTimer; - AddMenuItem(new cRecMenuItemButton(tr("Create Series Timer"), action, false)); - if (epgSearchAvailable) { - AddMenuItem(new cRecMenuItemButton(tr("Create Search Timer"), rmsSearchTimer, false)); - if (!switchTimerActive) { - AddMenuItem(new cRecMenuItemButton(tr("Create Switch Timer"), rmsSwitchTimer, false)); - } else { - AddMenuItem(new cRecMenuItemButton(tr("Delete Switch Timer"), rmsSwitchTimerDelete, false)); - } + ?rmsInstantRecordFolder + :rmsInstantRecord; + AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true)); + } else { + AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true)); + AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false)); + } + action = (tvguideConfig.recMenuAskFolder) + ?rmsSeriesTimerFolder + :rmsSeriesTimer; + AddMenuItem(new cRecMenuItemButton(tr("Create Series Timer"), action, false)); + if (epgSearchAvailable) { + AddMenuItem(new cRecMenuItemButton(tr("Create Search Timer"), rmsSearchTimer, false)); + if (!switchTimerActive) { + AddMenuItem(new cRecMenuItemButton(tr("Create Switch Timer"), rmsSwitchTimer, false)); + } else { + AddMenuItem(new cRecMenuItemButton(tr("Delete Switch Timer"), rmsSwitchTimerDelete, false)); } - if (epgSearchAvailable) { - AddMenuItem(new cRecMenuItemButton(tr("Search"), rmsSearch, false)); - } - AddMenuItem(new cRecMenuItemButton(tr("Search in Recordings"), rmsRecordingSearch, false)); - if (epgSearchAvailable) { - AddMenuItem(new cRecMenuItemButton(tr("Check for Timer Conflicts"), rmsTimerConflicts, false)); - } - int menuWidth = CalculateOptimalWidth() + 4 * border; - SetWidthPixel(menuWidth); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuMain(void) {}; + } + if (epgSearchAvailable) { + AddMenuItem(new cRecMenuItemButton(tr("Search"), rmsSearch, false)); + } + AddMenuItem(new cRecMenuItemButton(tr("Search in Recordings"), rmsRecordingSearch, false)); + if (epgSearchAvailable) { + AddMenuItem(new cRecMenuItemButton(tr("Check for Timer Conflicts"), rmsTimerConflicts, false)); + } + int menuWidth = CalculateOptimalWidth() + 4 * border; + SetWidthPixel(menuWidth); + + CalculateHeight(); + CreatePixmap(); + Arrange(); }; // --- cRecMenuAskFolder --------------------------------------------------------- -class cRecMenuAskFolder: public cRecMenu { -private: - std::vector folders; - eRecMenuState NextAction; - void readFolders(cList *rootFolders, cString path) { - cList *foldersLevel = NULL; - if (rootFolders) { - foldersLevel = rootFolders; - } else { - foldersLevel = &Folders; - } - for (cNestedItem *folder = foldersLevel->First(); folder; folder = foldersLevel->Next(folder)) { - cString strFolder = cString::sprintf("%s%s", *path, folder->Text()); - folders.push_back(strFolder); - cList *subItems = folder->SubItems(); - if (subItems) { - cString newPath = cString::sprintf("%s%s/", *path, folder->Text()); - readFolders(subItems, newPath); - } +cRecMenuAskFolder::cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction) { + SetWidthPercent(80); + NextAction = nextAction; + cString message = tr("Set Folder for"); + cString headerText = cString::sprintf("%s\n\"%s\"", *message, event->Title()); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headerText); + infoItem->CalculateHeight(width - 2 * border); + SetHeader(infoItem); + + AddMenuItemScroll(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false, true)); + + readFolders(NULL, ""); + int numFolders = folders.size(); + for (int i=0; i < numFolders; i++) { + AddMenuItemScroll(new cRecMenuItemButton(*folders[i], nextAction, false, false, true)); + if (!CheckHeight()) + break; + } + + CalculateHeight(); + CreatePixmap(); + Arrange(); +} + +void cRecMenuAskFolder::readFolders(cList *rootFolders, cString path) { + cList *foldersLevel = NULL; + if (rootFolders) { + foldersLevel = rootFolders; + } else { + foldersLevel = &Folders; + } + for (cNestedItem *folder = foldersLevel->First(); folder; folder = foldersLevel->Next(folder)) { + cString strFolder = cString::sprintf("%s%s", *path, folder->Text()); + folders.push_back(strFolder); + cList *subItems = folder->SubItems(); + if (subItems) { + cString newPath = cString::sprintf("%s%s/", *path, folder->Text()); + readFolders(subItems, newPath); } } -public: - cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction) { - SetWidthPercent(80); - NextAction = nextAction; - cString message = tr("Set Folder for"); - cString headerText = cString::sprintf("%s\n\"%s\"", *message, event->Title()); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headerText); - infoItem->CalculateHeight(width - 2 * border); - SetHeader(infoItem); - - AddMenuItemScroll(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false, true)); - - readFolders(NULL, ""); - int numFolders = folders.size(); - for (int i=0; i < numFolders; i++) { - AddMenuItemScroll(new cRecMenuItemButton(*folders[i], nextAction, false, false, true)); - if (!CheckHeight()) - break; - } - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - cRecMenuItem *GetMenuItem(int number) { - if (number == 0) { - cRecMenuItem *result = new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, false, false, true); - return result; - } else if ((number > 0) && (number < folders.size()+1)) { - cRecMenuItem *result = new cRecMenuItemButton(*folders[number-1], rmsInstantRecord, false, false, true); - return result; - } - return NULL; - }; +} - int GetTotalNumMenuItems(void) { - return folders.size()+1; - }; - - virtual ~cRecMenuAskFolder(void) {}; -}; +cRecMenuItem *cRecMenuAskFolder::GetMenuItem(int number) { + if (number == 0) { + cRecMenuItem *result = new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, false, false, true); + return result; + } else if ((number > 0) && (number < folders.size()+1)) { + cRecMenuItem *result = new cRecMenuItemButton(*folders[number-1], rmsInstantRecord, false, false, true); + return result; + } + return NULL; +} +int cRecMenuAskFolder::GetTotalNumMenuItems(void) { + return folders.size()+1; +} // --- cRecMenuConfirmTimer --------------------------------------------------------- -class cRecMenuConfirmTimer: public cRecMenu { -public: - cRecMenuConfirmTimer(const cEvent *event) { - SetWidthPercent(50); - cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); - cString message; - bool eventHasTimer = false; - if (tvguideConfig.useRemoteTimers && pRemoteTimers) { - RemoteTimers_GetMatch_v1_0 rtMatch; - rtMatch.event = event; - pRemoteTimers->Service("RemoteTimers::GetMatch-v1.0", &rtMatch); - if (rtMatch.timerMatch == tmFull) { - eventHasTimer = true; - } - } else { - eventHasTimer = event->HasTimer(); +cRecMenuConfirmTimer::cRecMenuConfirmTimer(const cEvent *event) { + SetWidthPercent(50); + cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); + cString message; + bool eventHasTimer = false; + if (tvguideConfig.useRemoteTimers && pRemoteTimers) { + RemoteTimers_GetMatch_v1_0 rtMatch; + rtMatch.event = event; + pRemoteTimers->Service("RemoteTimers::GetMatch-v1.0", &rtMatch); + if (rtMatch.timerMatch == tmFull) { + eventHasTimer = true; } - if (eventHasTimer) { - message = tr("Timer created"); - } else { - message = tr("Timer NOT created"); - } - cString text = cString::sprintf("%s\n%s\n%s %s - %s\n%s", - *message, - *channelName, - *event->GetDateString(), - *event->GetTimeString(), - *event->GetEndTimeString(), - event->Title() - ); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuConfirmTimer(void) {}; -}; + } else { + eventHasTimer = event->HasTimer(); + } + if (eventHasTimer) { + message = tr("Timer created"); + } else { + message = tr("Timer NOT created"); + } + cString text = cString::sprintf("%s\n%s\n%s %s - %s\n%s", + *message, + *channelName, + *event->GetDateString(), + *event->GetTimeString(), + *event->GetEndTimeString(), + event->Title() + ); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuConfirmDeleteTimer --------------------------------------------------------- -class cRecMenuConfirmDeleteTimer: public cRecMenu { -public: - cRecMenuConfirmDeleteTimer(const cEvent *event) { - SetWidthPercent(50); - cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); - cString text = cString::sprintf("%s\n%s\n%s %s - %s\n%s", - tr("Timer deleted"), - *channelName, - *event->GetDateString(), - *event->GetTimeString(), - *event->GetEndTimeString(), - event->Title() - ); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 4 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; +cRecMenuConfirmDeleteTimer::cRecMenuConfirmDeleteTimer(const cEvent *event) { + SetWidthPercent(50); + cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); + cString text = cString::sprintf("%s\n%s\n%s %s - %s\n%s", + tr("Timer deleted"), + *channelName, + *event->GetDateString(), + *event->GetTimeString(), + *event->GetEndTimeString(), + event->Title() + ); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 4 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); - virtual ~cRecMenuConfirmDeleteTimer(void) {}; -}; + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuAskDeleteTimer --------------------------------------------------------- -class cRecMenuAskDeleteTimer: public cRecMenu { -public: - cRecMenuAskDeleteTimer(const cEvent *event) { - SetWidthPercent(50); - cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); - cString text = cString::sprintf("%s \"%s, %s\" %s", - tr("Timer"), - *channelName, - event->Title(), - tr("still recording - really delete?")); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 4 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Yes"), tr("No"), rmsDeleteTimerConfirmation, rmsClose, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuAskDeleteTimer(void) {}; -}; +cRecMenuAskDeleteTimer::cRecMenuAskDeleteTimer(const cEvent *event) { + SetWidthPercent(50); + cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); + cString text = cString::sprintf("%s \"%s, %s\" %s", + tr("Timer"), + *channelName, + event->Title(), + tr("still recording - really delete?")); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 4 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Yes"), tr("No"), rmsDeleteTimerConfirmation, rmsClose, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuTimerConflicts --------------------------------------------------------- -class cRecMenuTimerConflicts: public cRecMenu { -public: - cRecMenuTimerConflicts(std::vector conflicts) { - int numConflicts = conflicts.size(); - - cString text; - if (numConflicts == 1) { - text = cString::sprintf("%s %s %s", tr("One"), tr("Timer Conflict"), tr("detected")); - } else { - text = cString::sprintf("%d %s %s", (int)conflicts.size(), tr("Timer Conflicts"), tr("detected")); - } - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - - for (int i=0; iCalculateHeight(width - 2 * border); - SetHeader(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("Ignore Conflicts"), rmsIgnoreTimerConflict, false)); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; +cRecMenuTimerConflicts::cRecMenuTimerConflicts(std::vector conflicts) { + int numConflicts = conflicts.size(); - virtual ~cRecMenuTimerConflicts(void) {}; -}; + cString text; + if (numConflicts == 1) { + text = cString::sprintf("%s %s %s", tr("One"), tr("Timer Conflict"), tr("detected")); + } else { + text = cString::sprintf("%d %s %s", (int)conflicts.size(), tr("Timer Conflicts"), tr("detected")); + } + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + + for (int i=0; iCalculateHeight(width - 2 * border); + SetHeader(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("Ignore Conflicts"), rmsIgnoreTimerConflict, false)); + + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuTimerConflict --------------------------------------------------------- -class cRecMenuTimerConflict: public cRecMenu { -private: - TVGuideTimerConflict conflict; -public: - cRecMenuTimerConflict(TVGuideTimerConflict conflict) { - SetWidthPercent(80); - this->conflict = conflict; - SetHeader(new cRecMenuItemTimerConflictHeader(conflict.timeStart, +cRecMenuTimerConflict::cRecMenuTimerConflict(TVGuideTimerConflict conflict) { + SetWidthPercent(80); + this->conflict = conflict; + SetHeader(new cRecMenuItemTimerConflictHeader(conflict.timeStart, + conflict.timeStop, + conflict.overlapStart, + conflict.overlapStop)); + SetFooter(new cRecMenuItemButton(tr("Ignore Conflict"), rmsIgnoreTimerConflict, false, true)); + int i=0; + for(std::vector::iterator it = conflict.timerIDs.begin(); it != conflict.timerIDs.end(); it++) { + const cTimer *timer = Timers.Get(*it); + if (timer) { + AddMenuItemScroll(new cRecMenuItemTimer( timer, + rmsTimerConflictShowInfo, + rmsDeleteTimerConflictMenu, + rmsEditTimerConflictMenu, + conflict.timeStart, conflict.timeStop, conflict.overlapStart, - conflict.overlapStop)); - SetFooter(new cRecMenuItemButton(tr("Ignore Conflict"), rmsIgnoreTimerConflict, false, true)); - int i=0; - for(std::vector::iterator it = conflict.timerIDs.begin(); it != conflict.timerIDs.end(); it++) { - const cTimer *timer = Timers.Get(*it); - if (timer) { - AddMenuItemScroll(new cRecMenuItemTimer( timer, - rmsTimerConflictShowInfo, - rmsDeleteTimerConflictMenu, - rmsEditTimerConflictMenu, - conflict.timeStart, - conflict.timeStop, - conflict.overlapStart, - conflict.overlapStop, - (!i)?true:false) - ); - i++; - } - if (!CheckHeight()) - break; + conflict.overlapStop, + (!i)?true:false) + ); + i++; } - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; + if (!CheckHeight()) + break; + } + CalculateHeight(); + CreatePixmap(); + Arrange(); +} - cRecMenuItem *GetMenuItem(int number) { - if ((number >= 0) && (number < conflict.timerIDs.size())) { - const cTimer *timer = Timers.Get(conflict.timerIDs[number]); - cRecMenuItem *result = new cRecMenuItemTimer( timer, - rmsTimerConflictShowInfo, - rmsDeleteTimerConflictMenu, - rmsEditTimerConflictMenu, - conflict.timeStart, - conflict.timeStop, - conflict.overlapStart, - conflict.overlapStop, - false); - return result; - } - return NULL; - }; +cRecMenuItem *cRecMenuTimerConflict::GetMenuItem(int number) { + if ((number >= 0) && (number < conflict.timerIDs.size())) { + const cTimer *timer = Timers.Get(conflict.timerIDs[number]); + cRecMenuItem *result = new cRecMenuItemTimer( timer, + rmsTimerConflictShowInfo, + rmsDeleteTimerConflictMenu, + rmsEditTimerConflictMenu, + conflict.timeStart, + conflict.timeStop, + conflict.overlapStart, + conflict.overlapStop, + false); + return result; + } + return NULL; +} - int GetTotalNumMenuItems(void) { - return conflict.timerIDs.size(); - }; - virtual ~cRecMenuTimerConflict(void) {}; -}; +int cRecMenuTimerConflict::GetTotalNumMenuItems(void) { + return conflict.timerIDs.size(); +} // --- cRecMenuNoTimerConflict --------------------------------------------------------- -class cRecMenuNoTimerConflict: public cRecMenu { -public: - cRecMenuNoTimerConflict(void) { - SetWidthPercent(50); - cString text = tr("No Timer Conflicts found"); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 4 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("Close"), rmsClose, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuNoTimerConflict(void) {}; -}; +cRecMenuNoTimerConflict::cRecMenuNoTimerConflict(void) { + SetWidthPercent(50); + cString text = tr("No Timer Conflicts found"); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 4 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("Close"), rmsClose, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuEditTimer --------------------------------------------------------- -class cRecMenuEditTimer: public cRecMenu { -private: -public: - cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState) { - SetWidthPercent(60); - if (timer) { - cString title(""); - cString channelName(""); - if (timer->Event()) - title = timer->Event()->Title(); - if (timer->Channel()) - channelName = timer->Channel()->Name(); - cString infoText = cString::sprintf("%s:\n %s, %s", tr("Edit Timer"), *title, *channelName); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - - bool timerActive = false; - if (tvguideConfig.useRemoteTimers && pRemoteTimers) { - RemoteTimers_GetMatch_v1_0 rtMatch; - rtMatch.event = timer->Event(); - pRemoteTimers->Service("RemoteTimers::GetMatch-v1.0", &rtMatch); - if (rtMatch.timer) { - if (rtMatch.timerMatch == tmFull) - timerActive = true; - } - } else - timerActive = timer->HasFlags(tfActive); +cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState) { + SetWidthPercent(60); + if (timer) { + cString title(""); + cString channelName(""); + if (timer->Event()) + title = timer->Event()->Title(); + if (timer->Channel()) + channelName = timer->Channel()->Name(); + cString infoText = cString::sprintf("%s:\n %s, %s", tr("Edit Timer"), *title, *channelName); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + + bool timerActive = false; + if (tvguideConfig.useRemoteTimers && pRemoteTimers) { + RemoteTimers_GetMatch_v1_0 rtMatch; + rtMatch.event = timer->Event(); + pRemoteTimers->Service("RemoteTimers::GetMatch-v1.0", &rtMatch); + if (rtMatch.timer) { + if (rtMatch.timerMatch == tmFull) + timerActive = true; + } + } else + timerActive = timer->HasFlags(tfActive); - time_t day = timer->Day(); - int start = timer->Start(); - int stop = timer->Stop(); - int prio = timer->Priority(); - int lifetime = timer->Lifetime(); - - AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), timerActive, false, true)); - AddMenuItem(new cRecMenuItemInt(tr("Priority"), prio, 0, MAXPRIORITY, false)); - AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), lifetime, 0, MAXLIFETIME, false)); - AddMenuItem(new cRecMenuItemDay(tr("Day"), day, false)); - AddMenuItem(new cRecMenuItemTime(tr("Timer start time"), start, false)); - AddMenuItem(new cRecMenuItemTime(tr("Timer stop time"), stop, false)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsClose, false)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - } - }; - virtual ~cRecMenuEditTimer(void) {}; -}; + time_t day = timer->Day(); + int start = timer->Start(); + int stop = timer->Stop(); + int prio = timer->Priority(); + int lifetime = timer->Lifetime(); + + AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), timerActive, false, true)); + AddMenuItem(new cRecMenuItemInt(tr("Priority"), prio, 0, MAXPRIORITY, false)); + AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), lifetime, 0, MAXLIFETIME, false)); + AddMenuItem(new cRecMenuItemDay(tr("Day"), day, false)); + AddMenuItem(new cRecMenuItemTime(tr("Timer start time"), start, false)); + AddMenuItem(new cRecMenuItemTime(tr("Timer stop time"), stop, false)); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Save"), tr("Cancel"), nextState, rmsClose, false)); + CalculateHeight(); + CreatePixmap(); + Arrange(); + } +} // --- cRecMenuSeriesTimer --------------------------------------------------------- -class cRecMenuSeriesTimer: public cRecMenu { -private: -public: - cRecMenuSeriesTimer(cChannel *initialChannel, const cEvent *event) { - SetWidthPercent(70); - if (initialChannel) { - cString title = tr("Create Series Timer based on"); - cString infoText = cString::sprintf("%s:\n%s", *title, event->Title()); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), true, false, true)); - AddMenuItem(new cRecMenuItemChannelChooser(tr("Channel"), initialChannel, false)); - - time_t tstart = event->StartTime(); - tstart -= Setup.MarginStart * 60; - time_t tstop = tstart + event->Duration(); - tstop += Setup.MarginStop * 60; - - struct tm tm_r; - struct tm *time = localtime_r(&tstart, &tm_r); - int start = time->tm_hour * 100 + time->tm_min; - time = localtime_r(&tstop, &tm_r); - int stop = time->tm_hour * 100 + time->tm_min; - if (stop >= 2400) - stop -= 2400; - - AddMenuItem(new cRecMenuItemTime(tr("Series Timer start time"), start, false)); - AddMenuItem(new cRecMenuItemTime(tr("Series Timer stop time"), stop, false)); - AddMenuItem(new cRecMenuItemDayChooser(tr("Days to record"), 127, false)); - AddMenuItem(new cRecMenuItemDay(tr("Day to start"), tstart, false)); - AddMenuItem(new cRecMenuItemInt(tr("Priority"), MAXPRIORITY, 0, MAXPRIORITY, false)); - AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), MAXLIFETIME, 0, MAXLIFETIME, false)); +cRecMenuSeriesTimer::cRecMenuSeriesTimer(cChannel *initialChannel, const cEvent *event) { + SetWidthPercent(70); + if (initialChannel) { + cString title = tr("Create Series Timer based on"); + cString infoText = cString::sprintf("%s:\n%s", *title, event->Title()); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemBool(tr("Timer Active"), true, false, true)); + AddMenuItem(new cRecMenuItemChannelChooser(tr("Channel"), initialChannel, false)); + + time_t tstart = event->StartTime(); + tstart -= Setup.MarginStart * 60; + time_t tstop = tstart + event->Duration(); + tstop += Setup.MarginStop * 60; + + struct tm tm_r; + struct tm *time = localtime_r(&tstart, &tm_r); + int start = time->tm_hour * 100 + time->tm_min; + time = localtime_r(&tstop, &tm_r); + int stop = time->tm_hour * 100 + time->tm_min; + if (stop >= 2400) + stop -= 2400; + + AddMenuItem(new cRecMenuItemTime(tr("Series Timer start time"), start, false)); + AddMenuItem(new cRecMenuItemTime(tr("Series Timer stop time"), stop, false)); + AddMenuItem(new cRecMenuItemDayChooser(tr("Days to record"), 127, false)); + AddMenuItem(new cRecMenuItemDay(tr("Day to start"), tstart, false)); + AddMenuItem(new cRecMenuItemInt(tr("Priority"), MAXPRIORITY, 0, MAXPRIORITY, false)); + AddMenuItem(new cRecMenuItemInt(tr("Lifetime"), MAXLIFETIME, 0, MAXLIFETIME, false)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create Timer"), tr("Cancel"), rmsSeriesTimerCreate, rmsClose, false)); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create Timer"), tr("Cancel"), rmsSeriesTimerCreate, rmsClose, false)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - } - }; - virtual ~cRecMenuSeriesTimer(void) {}; -}; + CalculateHeight(); + CreatePixmap(); + Arrange(); + } +} // --- cRecMenuConfirmSeriesTimer --------------------------------------------------------- -class cRecMenuConfirmSeriesTimer: public cRecMenu { -public: - cRecMenuConfirmSeriesTimer(cTimer *seriesTimer) { - SetWidthPercent(50); - cString message = tr("Series Timer created"); - cString infoText = message; - if (seriesTimer) { - cString days = cTimer::PrintDay(seriesTimer->Day(), seriesTimer->WeekDays(), true); - infoText = cString::sprintf("%s\n%s, %s: %s, %s: %s", *message, *days, tr("Start"), *TimeString(seriesTimer->StartTime()), tr("Stop"), *TimeString(seriesTimer->StopTime())); - } - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuConfirmSeriesTimer(void) {}; -}; +cRecMenuConfirmSeriesTimer::cRecMenuConfirmSeriesTimer(cTimer *seriesTimer) { + SetWidthPercent(50); + cString message = tr("Series Timer created"); + cString infoText = message; + if (seriesTimer) { + cString days = cTimer::PrintDay(seriesTimer->Day(), seriesTimer->WeekDays(), true); + infoText = cString::sprintf("%s\n%s, %s: %s, %s: %s", *message, *days, tr("Start"), *TimeString(seriesTimer->StartTime()), tr("Stop"), *TimeString(seriesTimer->StopTime())); + } + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSearchTimer --------------------------------------------------------- -class cRecMenuSearchTimer: public cRecMenu { -private: - char initialText[TEXTINPUTLENGTH]; -public: - cRecMenuSearchTimer(const cEvent *event) { - SetWidthPercent(70); - cString message = tr("Configure Search Timer based on"); - cString infoText = cString::sprintf("%s:\n\"%s\"", *message, event->Title()); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - strn0cpy(initialText, event->Title(), sizeof(initialText)); - AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Continue"), tr("Cancel"), rmsSearchTimerOptions, rmsClose, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuSearchTimer(void) {}; -}; +cRecMenuSearchTimer::cRecMenuSearchTimer(const cEvent *event) { + SetWidthPercent(70); + cString message = tr("Configure Search Timer based on"); + cString infoText = cString::sprintf("%s:\n\"%s\"", *message, event->Title()); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + strn0cpy(initialText, event->Title(), sizeof(initialText)); + AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Continue"), tr("Cancel"), rmsSearchTimerOptions, rmsClose, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSearchTimerTemplates --------------------------------------------------------- -class cRecMenuSearchTimerTemplates: public cRecMenu { -private: - int numTemplates; - std::vector templates; -public: - cRecMenuSearchTimerTemplates(cString searchString, - std::vector templates) { - this->templates = templates; - SetWidthPercent(70); - cString message = tr("Configure Search Timer for Search String"); - cString infoText = cString::sprintf("%s:\n%s", *message, *searchString); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - SetHeader(infoItem); - - AddMenuItemScroll(new cRecMenuItemButton(tr("Manually configure Options"), rmsSearchTimerOptionsManually, true)); - - numTemplates = templates.size(); - for (int i=0; i templates) { + this->templates = templates; + SetWidthPercent(70); + cString message = tr("Configure Search Timer for Search String"); + cString infoText = cString::sprintf("%s:\n%s", *message, *searchString); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + SetHeader(infoItem); + + AddMenuItemScroll(new cRecMenuItemButton(tr("Manually configure Options"), rmsSearchTimerOptionsManually, true)); + + numTemplates = templates.size(); + for (int i=0; i 0) && (number < numTemplates + 1)) { + cString buttonText = cString::sprintf("%s \"%s\"", tr("Use Template"), templates[number-1].name.c_str()); + cRecMenuItem *templ = new cRecMenuItemButton(*buttonText, rmsSearchTimerUseTemplate, false); + return templ; + } + return NULL; +} + +int cRecMenuSearchTimerTemplates::GetTotalNumMenuItems(void) { + return numTemplates + 1; +} + +// --- cRecMenuSearchTimerTemplatesCreate --------------------------------------------------------- +cRecMenuSearchTimerTemplatesCreate::cRecMenuSearchTimerTemplatesCreate(cString searchString, cString tmplName) { + SetWidthPercent(70); + + cString message1 = tr("Creating Search Timer"); + cString message2 = tr("Search Term"); + cString message3 = tr("Using Template"); + + cString infoText = cString::sprintf("%s\n%s: \"%s\"\n%s \"%s\"", *message1, *message2, *searchString, *message3, *tmplName); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + + AddMenuItem(new cRecMenuItemButton(tr("Display Results for Search Timer"), rmsSearchTimerTestTemplate, true)); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create Search Timer"), tr("Use other Template"), rmsSearchTimerCreateTemplate, rmsSearchTimerOptionsReload, false)); + + CalculateHeight(); + CreatePixmap(); + Arrange(); +} + +// --- cRecMenuSearchTimerOptions --------------------------------------------------------- +cRecMenuSearchTimerOptions::cRecMenuSearchTimerOptions(cString searchString) { + this->searchString = searchString; + CreateMenuItems(); +} + +void cRecMenuSearchTimerOptions::CreateMenuItems(void) { + bool showChannelSelectors = false; + bool showTimeSelectors = false; + if (menuItems.Count() > 0) { + showChannelSelectors = GetBoolValue(4); + if (GetIntValue(5)>-1) { + showTimeSelectors = GetBoolValue(7); + } else { + showTimeSelectors = GetBoolValue(5); + } + osdManager.releasePixmap(pixmap); + delete header; + menuItems.Clear(); + } + SetWidthPercent(70); + cString message = tr("Configure Search Timer Options for Search String"); + cString infoText = cString::sprintf("%s:\n%s", *message, *searchString); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + SetHeader(infoItem); + + searchModes[0] = tr("whole term must appear"); + searchModes[1] = tr("all terms must exist"); + searchModes[2] = tr("one term must exist"); + searchModes[3] = tr("exact match"); + searchModes[4] = tr("regular expression"); + AddMenuItem(new cRecMenuItemSelect(tr("Search Mode"), searchModes, 0, 5, false)); + AddMenuItem(new cRecMenuItemBool(tr("Use Title"), true, false, false)); + AddMenuItem(new cRecMenuItemBool(tr("Use Subtitle"), true, false, false)); + AddMenuItem(new cRecMenuItemBool(tr("Use Description"), false, false, false)); + + AddMenuItem(new cRecMenuItemBool(tr("Limit Channels"), showChannelSelectors, true, false)); + if (showChannelSelectors) { + cChannel *startChannel = NULL; + for (startChannel = Channels.First(); startChannel; startChannel = Channels.Next(startChannel)) { + if (!startChannel->GroupSep()) + break; + } + AddMenuItem(new cRecMenuItemChannelChooser(tr("Start Channel"), startChannel, false)); + AddMenuItem(new cRecMenuItemChannelChooser(tr("Stop Channel"), startChannel, false)); + } + + AddMenuItem(new cRecMenuItemBool(tr("Use Time"), showTimeSelectors, true, false)); + if (showTimeSelectors) { + AddMenuItem(new cRecMenuItemTime(tr("Start after"), 0, false)); + AddMenuItem(new cRecMenuItemTime(tr("Start before"), 2359, false)); + } + + AddMenuItem(new cRecMenuItemButton(tr("Display Results for Search Timer"), rmsSearchTimerTestManually, true)); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create Search Timer"), tr("Cancel"), rmsSearchTimerCreateManually, rmsClose, false)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} + +// --- cRecMenuSearchTimerResults --------------------------------------------------------- +cRecMenuSearchTimerResults::cRecMenuSearchTimerResults(cString searchString, const cEvent **searchResults, int numResults, std::string templateName) { + this->searchResults = searchResults; + SetWidthPercent(70); + cString message1 = tr("search results for Search Timer"); + cString message2 = tr("search result for Search Timer"); + this->numResults = numResults; + cString message3 = tr("Using Template"); + cString infoText; + if (templateName.size() > 0) { + infoText = cString::sprintf("%d %s:\n\"%s\"\n%s \"%s\"", numResults, (numResults>1)?(*message1):(*message2), *searchString, *message3, templateName.c_str()); + } else { + infoText = cString::sprintf("%d %s:\n\"%s\"", numResults, (numResults>1)?(*message1):(*message2), *searchString); + } + cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + SetHeader(infoItem); + + cRecMenuItem *buttons = new cRecMenuItemButton(tr("Close"), rmsClose, false); + SetFooter(buttons); + if (searchResults && (numResults > 0)) { + for (int i=0; i 0) && (number < numTemplates + 1)) { - cString buttonText = cString::sprintf("%s \"%s\"", tr("Use Template"), templates[number-1].name.c_str()); - cRecMenuItem *templ = new cRecMenuItemButton(*buttonText, rmsSearchTimerUseTemplate, false); - return templ; - } - return NULL; - }; +cRecMenuItem *cRecMenuSearchTimerResults::GetMenuItem(int number) { + if ((number >= 0) && (number < numResults)) { + cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, rmsDisabled, false); + return result; + } + return NULL; +} - - int GetTotalNumMenuItems(void) { - return numTemplates + 1; - }; - - - virtual ~cRecMenuSearchTimerTemplates(void) {}; -}; - -// --- cRecMenuSearchTimerTemplatesCreate --------------------------------------------------------- -class cRecMenuSearchTimerTemplatesCreate: public cRecMenu { -private: -public: - cRecMenuSearchTimerTemplatesCreate(cString searchString, cString tmplName) { - SetWidthPercent(70); - - cString message1 = tr("Creating Search Timer"); - cString message2 = tr("Search Term"); - cString message3 = tr("Using Template"); - - cString infoText = cString::sprintf("%s\n%s: \"%s\"\n%s \"%s\"", *message1, *message2, *searchString, *message3, *tmplName); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - - AddMenuItem(new cRecMenuItemButton(tr("Display Results for Search Timer"), rmsSearchTimerTestTemplate, true)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create Search Timer"), tr("Use other Template"), rmsSearchTimerCreateTemplate, rmsSearchTimerOptionsReload, false)); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuSearchTimerTemplatesCreate(void) {}; -}; - -// --- cRecMenuSearchTimerOptions --------------------------------------------------------- -class cRecMenuSearchTimerOptions: public cRecMenu { -private: - const char * searchModes[5]; - cString searchString; -public: - cRecMenuSearchTimerOptions(cString searchString) { - this->searchString = searchString; - CreateMenuItems(); - }; - - void CreateMenuItems(void) { - bool showChannelSelectors = false; - bool showTimeSelectors = false; - if (menuItems.Count() > 0) { - showChannelSelectors = GetBoolValue(4); - if (GetIntValue(5)>-1) { - showTimeSelectors = GetBoolValue(7); - } else { - showTimeSelectors = GetBoolValue(5); - } - osdManager.releasePixmap(pixmap); - delete header; - menuItems.Clear(); - } - SetWidthPercent(70); - cString message = tr("Configure Search Timer Options for Search String"); - cString infoText = cString::sprintf("%s:\n%s", *message, *searchString); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - SetHeader(infoItem); - - searchModes[0] = tr("whole term must appear"); - searchModes[1] = tr("all terms must exist"); - searchModes[2] = tr("one term must exist"); - searchModes[3] = tr("exact match"); - searchModes[4] = tr("regular expression"); - AddMenuItem(new cRecMenuItemSelect(tr("Search Mode"), searchModes, 0, 5, false)); - AddMenuItem(new cRecMenuItemBool(tr("Use Title"), true, false, false)); - AddMenuItem(new cRecMenuItemBool(tr("Use Subtitle"), true, false, false)); - AddMenuItem(new cRecMenuItemBool(tr("Use Description"), false, false, false)); - - AddMenuItem(new cRecMenuItemBool(tr("Limit Channels"), showChannelSelectors, true, false)); - if (showChannelSelectors) { - cChannel *startChannel = NULL; - for (startChannel = Channels.First(); startChannel; startChannel = Channels.Next(startChannel)) { - if (!startChannel->GroupSep()) - break; - } - AddMenuItem(new cRecMenuItemChannelChooser(tr("Start Channel"), startChannel, false)); - AddMenuItem(new cRecMenuItemChannelChooser(tr("Stop Channel"), startChannel, false)); - } - - AddMenuItem(new cRecMenuItemBool(tr("Use Time"), showTimeSelectors, true, false)); - if (showTimeSelectors) { - AddMenuItem(new cRecMenuItemTime(tr("Start after"), 0, false)); - AddMenuItem(new cRecMenuItemTime(tr("Start before"), 2359, false)); - } - - AddMenuItem(new cRecMenuItemButton(tr("Display Results for Search Timer"), rmsSearchTimerTestManually, true)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create Search Timer"), tr("Cancel"), rmsSearchTimerCreateManually, rmsClose, false)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuSearchTimerOptions(void) {}; -}; - -// --- cRecMenuSearchTimerResults --------------------------------------------------------- -class cRecMenuSearchTimerResults: public cRecMenu { -private: - const cEvent **searchResults; - int numResults; -public: - cRecMenuSearchTimerResults(cString searchString, const cEvent **searchResults, int numResults, std::string templateName) { - this->searchResults = searchResults; - SetWidthPercent(70); - cString message1 = tr("search results for Search Timer"); - cString message2 = tr("search result for Search Timer"); - this->numResults = numResults; - cString message3 = tr("Using Template"); - cString infoText; - if (templateName.size() > 0) { - infoText = cString::sprintf("%d %s:\n\"%s\"\n%s \"%s\"", numResults, (numResults>1)?(*message1):(*message2), *searchString, *message3, templateName.c_str()); - } else { - infoText = cString::sprintf("%d %s:\n\"%s\"", numResults, (numResults>1)?(*message1):(*message2), *searchString); - } - cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - SetHeader(infoItem); - - cRecMenuItem *buttons = new cRecMenuItemButton(tr("Close"), rmsClose, false); - SetFooter(buttons); - if (searchResults && (numResults > 0)) { - for (int i=0; i= 0) && (number < numResults)) { - cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, rmsDisabled, false); - return result; - } - return NULL; - }; - - int GetTotalNumMenuItems(void) { - return numResults; - }; - - virtual ~cRecMenuSearchTimerResults(void) { - delete[] searchResults; - }; -}; +int cRecMenuSearchTimerResults::GetTotalNumMenuItems(void) { + return numResults; +} // --- cRecMenuSearchTimerNothingFound --------------------------------------------------------- -class cRecMenuSearchTimerNothingFound: public cRecMenu { -public: - cRecMenuSearchTimerNothingFound(cString searchString, std::string templateName) { - SetWidthPercent(50); - cString message = tr("Nothing found for Search String"); - cString message2 = tr("Using Template"); - cString text; - if (templateName.size() > 0) { - text = cString::sprintf("%s\n\"%s\"\n%s \"%s\"", - *message, - *searchString, - *message2, - templateName.c_str()); - } else { - text = cString::sprintf("%s\n\"%s\"", - *message, - *searchString); - } - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchTimerNothingFoundConfirm, true, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuSearchTimerNothingFound(void) {}; -}; +cRecMenuSearchTimerNothingFound::cRecMenuSearchTimerNothingFound(cString searchString, std::string templateName) { + SetWidthPercent(50); + cString message = tr("Nothing found for Search String"); + cString message2 = tr("Using Template"); + cString text; + if (templateName.size() > 0) { + text = cString::sprintf("%s\n\"%s\"\n%s \"%s\"", + *message, + *searchString, + *message2, + templateName.c_str()); + } else { + text = cString::sprintf("%s\n\"%s\"", + *message, + *searchString); + } + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchTimerNothingFoundConfirm, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSearchTimerCreateConfirm --------------------------------------------------------- -class cRecMenuSearchTimerCreateConfirm: public cRecMenu { -private: -public: - cRecMenuSearchTimerCreateConfirm(bool success) { - SetWidthPercent(50); - - cString message1a = tr("Search Timer sucessfully created."); - cString message1b = tr ("Search Timer update initialised"); - cString message1 = cString::sprintf("%s\n%s", *message1a, *message1b); - cString message2 = tr("Search Timer NOT sucessfully created"); - cString infoText = success?message1:message2; - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true)); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; +cRecMenuSearchTimerCreateConfirm::cRecMenuSearchTimerCreateConfirm(bool success) { + SetWidthPercent(50); - virtual ~cRecMenuSearchTimerCreateConfirm(void) {}; -}; + cString message1a = tr("Search Timer sucessfully created."); + cString message1b = tr ("Search Timer update initialised"); + cString message1 = cString::sprintf("%s\n%s", *message1a, *message1b); + cString message2 = tr("Search Timer NOT sucessfully created"); + cString infoText = success?message1:message2; + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true)); + + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSwitchTimer --------------------------------------------------------- -class cRecMenuSwitchTimer: public cRecMenu { -private: - const char *switchModes[3]; -public: - cRecMenuSwitchTimer(void) { - SetWidthPercent(60); - - cString infoText = tr("Configure Options for Switchtimer"); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - - AddMenuItem(new cRecMenuItemInt(tr("Minutes before switching"), 2, 0, 10, false)); - switchModes[0] = tr("switch"); - switchModes[1] = tr("announce only"); - switchModes[2] = tr("ask for switch"); - AddMenuItem(new cRecMenuItemSelect(tr("Switch Mode"), switchModes, 0, 3, false)); - - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create"), tr("Cancel"), rmsSwitchTimerCreate, rmsClose, true)); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; +cRecMenuSwitchTimer::cRecMenuSwitchTimer(void) { + SetWidthPercent(60); - virtual ~cRecMenuSwitchTimer(void) {}; -}; + cString infoText = tr("Configure Options for Switchtimer"); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + + AddMenuItem(new cRecMenuItemInt(tr("Minutes before switching"), 2, 0, 10, false)); + switchModes[0] = tr("switch"); + switchModes[1] = tr("announce only"); + switchModes[2] = tr("ask for switch"); + AddMenuItem(new cRecMenuItemSelect(tr("Switch Mode"), switchModes, 0, 3, false)); + + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Create"), tr("Cancel"), rmsSwitchTimerCreate, rmsClose, true)); + + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSwitchTimerConfirm --------------------------------------------------------- -class cRecMenuSwitchTimerConfirm: public cRecMenu { -private: -public: - cRecMenuSwitchTimerConfirm(bool success) { - SetWidthPercent(50); - - cString message1 = tr("Switch Timer sucessfully created"); - cString message2 = tr("Switch Timer NOT sucessfully created"); - cString infoText = success?message1:message2; - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true)); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; +cRecMenuSwitchTimerConfirm::cRecMenuSwitchTimerConfirm(bool success) { + SetWidthPercent(50); - virtual ~cRecMenuSwitchTimerConfirm(void) {}; -}; + cString message1 = tr("Switch Timer sucessfully created"); + cString message2 = tr("Switch Timer NOT sucessfully created"); + cString infoText = success?message1:message2; + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true)); + + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSwitchTimerDelete --------------------------------------------------------- -class cRecMenuSwitchTimerDelete: public cRecMenu { -private: -public: - cRecMenuSwitchTimerDelete(void) { - SetWidthPercent(50); - - cString infoText = tr("Switch Timer deleted"); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true)); - - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; +cRecMenuSwitchTimerDelete::cRecMenuSwitchTimerDelete(void) { + SetWidthPercent(50); - virtual ~cRecMenuSwitchTimerDelete(void) {}; -}; + cString infoText = tr("Switch Timer deleted"); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true)); + + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSearch --------------------------------------------------------- -class cRecMenuSearch: public cRecMenu { -private: - char initialText[TEXTINPUTLENGTH]; - const char * searchModes[5]; -public: - cRecMenuSearch(const cEvent *event) { - SetWidthPercent(60); - cString infoText = tr("Search"); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - strn0cpy(initialText, event->Title(), sizeof(initialText)); - AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); - AddMenuItem(new cRecMenuItemButton(tr("Show Search Options"), rmsSearchWithOptions, false)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsSearchPerform, rmsClose, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; +cRecMenuSearch::cRecMenuSearch(const cEvent *event) { + SetWidthPercent(60); + cString infoText = tr("Search"); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + strn0cpy(initialText, event->Title(), sizeof(initialText)); + AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); + AddMenuItem(new cRecMenuItemButton(tr("Show Search Options"), rmsSearchWithOptions, false)); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsSearchPerform, rmsClose, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} - cRecMenuSearch(const cEvent *event, const char *searchString) { - SetWidthPercent(60); - cString infoText = tr("Search"); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - strn0cpy(initialText, searchString, sizeof(initialText)); - AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); - searchModes[0] = tr("whole term must appear"); - searchModes[1] = tr("all terms must exist"); - searchModes[2] = tr("one term must exist"); - searchModes[3] = tr("exact match"); - searchModes[4] = tr("regular expression"); - AddMenuItem(new cRecMenuItemSelect(tr("Search Mode"), searchModes, 0, 5, false)); - AddMenuItem(new cRecMenuItemChannelChooser(tr("Channel to Search"), NULL, false)); - AddMenuItem(new cRecMenuItemBool(tr("Search in title"), true, false, false)); - AddMenuItem(new cRecMenuItemBool(tr("Search in Subtitle"), true, false, false)); - AddMenuItem(new cRecMenuItemBool(tr("Search in Description"), false, false, false)); +cRecMenuSearch::cRecMenuSearch(const cEvent *event, const char *searchString) { + SetWidthPercent(60); + cString infoText = tr("Search"); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + strn0cpy(initialText, searchString, sizeof(initialText)); + AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); + searchModes[0] = tr("whole term must appear"); + searchModes[1] = tr("all terms must exist"); + searchModes[2] = tr("one term must exist"); + searchModes[3] = tr("exact match"); + searchModes[4] = tr("regular expression"); + AddMenuItem(new cRecMenuItemSelect(tr("Search Mode"), searchModes, 0, 5, false)); + AddMenuItem(new cRecMenuItemChannelChooser(tr("Channel to Search"), NULL, false)); + AddMenuItem(new cRecMenuItemBool(tr("Search in title"), true, false, false)); + AddMenuItem(new cRecMenuItemBool(tr("Search in Subtitle"), true, false, false)); + AddMenuItem(new cRecMenuItemBool(tr("Search in Description"), false, false, false)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsSearchPerform, rmsClose, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - virtual ~cRecMenuSearch(void) {}; -}; + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsSearchPerform, rmsClose, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSearchResults --------------------------------------------------------- -class cRecMenuSearchResults: public cRecMenu { -private: - const cEvent **searchResults; - int numResults; -public: - cRecMenuSearchResults(cString searchString, const cEvent **searchResults, int numResults) { - this->searchResults = searchResults; - SetWidthPercent(70); - this->numResults = numResults; - cString message1 = tr("search results for"); - cString message2 = tr("search result for"); - cString infoText = cString::sprintf("%d %s:\n\"%s\"", numResults, (numResults>1)?(*message1):(*message2), *searchString); - cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - SetHeader(infoItem); - - cRecMenuItem *buttons = new cRecMenuItemButtonYesNo(tr("Adapt Search"), tr("Close"), rmsSearch, rmsClose, false); - SetFooter(buttons); - if (searchResults && (numResults > 0)) { - for (int i=0; isearchResults = searchResults; + SetWidthPercent(70); + this->numResults = numResults; + cString message1 = tr("search results for"); + cString message2 = tr("search result for"); + cString infoText = cString::sprintf("%d %s:\n\"%s\"", numResults, (numResults>1)?(*message1):(*message2), *searchString); + cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + SetHeader(infoItem); - cRecMenuItem *GetMenuItem(int number) { - if ((number >= 0) && (number < numResults)) { - cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, rmsSearchRecord, false); - return result; + cRecMenuItem *buttons = new cRecMenuItemButtonYesNo(tr("Adapt Search"), tr("Close"), rmsSearch, rmsClose, false); + SetFooter(buttons); + if (searchResults && (numResults > 0)) { + for (int i=0; i= 0) && (number < numResults)) { + cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, rmsSearchRecord, false); + return result; + } + return NULL; +} + +int cRecMenuSearchResults::GetTotalNumMenuItems(void) { + return numResults; +} // --- cRecMenuSearchConfirmTimer --------------------------------------------------------- -class cRecMenuSearchConfirmTimer: public cRecMenu { -public: - cRecMenuSearchConfirmTimer(const cEvent *event) { - SetWidthPercent(50); - cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); - cString message = tr("Timer created"); - cString text = cString::sprintf("%s\n%s\n%s %s - %s\n%s", - *message, - *channelName, - *event->GetDateString(), - *event->GetTimeString(), - *event->GetEndTimeString(), - event->Title() - ); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchRecordConfirm, true, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuSearchConfirmTimer(void) {}; -}; +cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event) { + SetWidthPercent(50); + cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); + cString message = tr("Timer created"); + cString text = cString::sprintf("%s\n%s\n%s %s - %s\n%s", + *message, + *channelName, + *event->GetDateString(), + *event->GetTimeString(), + *event->GetEndTimeString(), + event->Title() + ); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchRecordConfirm, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuSearchNothingFound --------------------------------------------------------- -class cRecMenuSearchNothingFound: public cRecMenu { -public: - cRecMenuSearchNothingFound(cString searchString) { - SetWidthPercent(50); - cString message = tr("Nothing found for Search String"); - cString text = cString::sprintf("%s\n\"%s\"", - *message, - *searchString); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchNothingFoundConfirm, true, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuSearchNothingFound(void) {}; -}; - - +cRecMenuSearchNothingFound::cRecMenuSearchNothingFound(cString searchString) { + SetWidthPercent(50); + cString message = tr("Nothing found for Search String"); + cString text = cString::sprintf("%s\n\"%s\"", + *message, + *searchString); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchNothingFoundConfirm, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuRecordingSearch --------------------------------------------------------- -class cRecMenuRecordingSearch: public cRecMenu { -private: - char initialText[TEXTINPUTLENGTH]; -public: - cRecMenuRecordingSearch(const cEvent *event) { - SetWidthPercent(60); - cString infoText = tr("Search in Recordings"); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - strn0cpy(initialText, event->Title(), sizeof(initialText)); - AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); - AddMenuItem(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsRecordingSearchResult, rmsClose, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - virtual ~cRecMenuRecordingSearch(void) {}; -}; +cRecMenuRecordingSearch::cRecMenuRecordingSearch(const cEvent *event) { + SetWidthPercent(60); + cString infoText = tr("Search in Recordings"); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + strn0cpy(initialText, event->Title(), sizeof(initialText)); + AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), initialText, sizeof(initialText), false)); + AddMenuItem(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsRecordingSearchResult, rmsClose, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} // --- cRecMenuRecordingSearchResults --------------------------------------------------------- - -class cRecMenuRecordingSearchResults: public cRecMenu { -private: - cRecording **searchResults; - int numResults; -public: - cRecMenuRecordingSearchResults(cString searchString, cRecording **searchResults, int numResults) { - this->searchResults = searchResults; - SetWidthPercent(80); - cString message1 = tr("Found"); - cString message2 = tr("recording"); - cString message3 = tr("recordings"); - cString message4 = tr("for"); - this->numResults = numResults; - cString infoText = cString::sprintf("%s %d %s %s:\n\"%s\"", *message1, numResults, (numResults>1)?(*message3):(*message2), *message4, *searchString); - cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText); - infoItem->CalculateHeight(width - 2 * border); - SetHeader(infoItem); - - cRecMenuItem *buttons = new cRecMenuItemButtonYesNo(tr("Adapt Search"), tr("Close"), rmsRecordingSearch, rmsClose, false); - SetFooter(buttons); - if (searchResults && (numResults > 0)) { - for (int i=0; isearchResults = searchResults; + SetWidthPercent(80); + cString message1 = tr("Found"); + cString message2 = tr("recording"); + cString message3 = tr("recordings"); + cString message4 = tr("for"); + this->numResults = numResults; + cString infoText = cString::sprintf("%s %d %s %s:\n\"%s\"", *message1, numResults, (numResults>1)?(*message3):(*message2), *message4, *searchString); + cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + SetHeader(infoItem); - cRecMenuItem *GetMenuItem(int number) { - if ((number >= 0) && (number < numResults)) { - cRecMenuItem *result = new cRecMenuItemRecording(searchResults[number], false); - return result; + cRecMenuItem *buttons = new cRecMenuItemButtonYesNo(tr("Adapt Search"), tr("Close"), rmsRecordingSearch, rmsClose, false); + SetFooter(buttons); + if (searchResults && (numResults > 0)) { + for (int i=0; i= 0) && (number < numResults)) { + cRecMenuItem *result = new cRecMenuItemRecording(searchResults[number], false); + return result; + } + return NULL; +} + +int cRecMenuRecordingSearchResults::GetTotalNumMenuItems(void) { + return numResults; +} // --- cRecMenuRecordingSearchNotFound --------------------------------------------------------- -class cRecMenuRecordingSearchNotFound: public cRecMenu { -public: - cRecMenuRecordingSearchNotFound(cString searchString) { - SetWidthPercent(50); - cString message = tr("No recordings found for"); - cString text = cString::sprintf("%s\n\"%s\"", - *message, - *searchString); - cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); - infoItem->CalculateHeight(width - 2 * border); - AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); - CalculateHeight(); - CreatePixmap(); - Arrange(); - }; - - virtual ~cRecMenuRecordingSearchNotFound(void) {}; -}; +cRecMenuRecordingSearchNotFound::cRecMenuRecordingSearchNotFound(cString searchString) { + SetWidthPercent(50); + cString message = tr("No recordings found for"); + cString text = cString::sprintf("%s\n\"%s\"", + *message, + *searchString); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} \ No newline at end of file diff --git a/recmenus.h b/recmenus.h new file mode 100644 index 0000000..def944d --- /dev/null +++ b/recmenus.h @@ -0,0 +1,266 @@ +#ifndef __TVGUIDE_RECMENUS_H +#define __TVGUIDE_RECMENUS_H + +#define TEXTINPUTLENGTH 80 + +#include +#include +#include "recmanager.h" + +// --- cRecMenuMain --------------------------------------------------------- +class cRecMenuMain : public cRecMenu { +public: + cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive); + virtual ~cRecMenuMain(void) {}; +}; + +// --- cRecMenuAskFolder --------------------------------------------------------- +class cRecMenuAskFolder: public cRecMenu { +private: + std::vector folders; + eRecMenuState NextAction; + void readFolders(cList *rootFolders, cString path); +public: + cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction); + cRecMenuItem *GetMenuItem(int number); + int GetTotalNumMenuItems(void); + virtual ~cRecMenuAskFolder(void) {}; +}; + +// --- cRecMenuConfirmTimer --------------------------------------------------------- +class cRecMenuConfirmTimer: public cRecMenu { +public: + cRecMenuConfirmTimer(const cEvent *event); + virtual ~cRecMenuConfirmTimer(void) {}; +}; + +// --- cRecMenuConfirmDeleteTimer --------------------------------------------------------- +class cRecMenuConfirmDeleteTimer: public cRecMenu { +public: + cRecMenuConfirmDeleteTimer(const cEvent *event); + virtual ~cRecMenuConfirmDeleteTimer(void) {}; +}; + +// --- cRecMenuAskDeleteTimer --------------------------------------------------------- +class cRecMenuAskDeleteTimer: public cRecMenu { +public: + cRecMenuAskDeleteTimer(const cEvent *event); + virtual ~cRecMenuAskDeleteTimer(void) {}; +}; + +// --- cRecMenuTimerConflicts --------------------------------------------------------- +class cRecMenuTimerConflicts: public cRecMenu { +public: + cRecMenuTimerConflicts(std::vector conflicts); + virtual ~cRecMenuTimerConflicts(void) {}; +}; + +// --- cRecMenuTimerConflict --------------------------------------------------------- +class cRecMenuTimerConflict: public cRecMenu { +private: + TVGuideTimerConflict conflict; +public: + cRecMenuTimerConflict(TVGuideTimerConflict conflict); + cRecMenuItem *GetMenuItem(int number); + int GetTotalNumMenuItems(void); + virtual ~cRecMenuTimerConflict(void) {}; +}; + +// --- cRecMenuNoTimerConflict --------------------------------------------------------- +class cRecMenuNoTimerConflict: public cRecMenu { +public: + cRecMenuNoTimerConflict(void); + virtual ~cRecMenuNoTimerConflict(void) {}; +}; + +// --- cRecMenuEditTimer --------------------------------------------------------- +class cRecMenuEditTimer: public cRecMenu { +public: + cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState); + virtual ~cRecMenuEditTimer(void) {}; +}; + + +// --- cRecMenuSeriesTimer --------------------------------------------------------- +class cRecMenuSeriesTimer: public cRecMenu { +public: + cRecMenuSeriesTimer(cChannel *initialChannel, const cEvent *event); + virtual ~cRecMenuSeriesTimer(void) {}; +}; + +// --- cRecMenuConfirmSeriesTimer --------------------------------------------------------- +class cRecMenuConfirmSeriesTimer: public cRecMenu { +public: + cRecMenuConfirmSeriesTimer(cTimer *seriesTimer); + virtual ~cRecMenuConfirmSeriesTimer(void) {}; +}; + +// --- cRecMenuSearchTimer --------------------------------------------------------- +class cRecMenuSearchTimer: public cRecMenu { +private: + char initialText[TEXTINPUTLENGTH]; +public: + cRecMenuSearchTimer(const cEvent *event); + virtual ~cRecMenuSearchTimer(void) {}; +}; + +// --- cRecMenuSearchTimerTemplates --------------------------------------------------------- +class cRecMenuSearchTimerTemplates: public cRecMenu { +private: + int numTemplates; + std::vector templates; +public: + cRecMenuSearchTimerTemplates(cString searchString, std::vector templates); + cRecMenuItem *GetMenuItem(int number); + int GetTotalNumMenuItems(void); + virtual ~cRecMenuSearchTimerTemplates(void) {}; +}; + +// --- cRecMenuSearchTimerTemplatesCreate --------------------------------------------------------- +class cRecMenuSearchTimerTemplatesCreate: public cRecMenu { +private: +public: + cRecMenuSearchTimerTemplatesCreate(cString searchString, cString tmplName); + virtual ~cRecMenuSearchTimerTemplatesCreate(void) {}; +}; + +// --- cRecMenuSearchTimerOptions --------------------------------------------------------- +class cRecMenuSearchTimerOptions: public cRecMenu { +private: + const char * searchModes[5]; + cString searchString; +public: + cRecMenuSearchTimerOptions(cString searchString); + void CreateMenuItems(void); + virtual ~cRecMenuSearchTimerOptions(void) {}; +}; + +// --- cRecMenuSearchTimerResults --------------------------------------------------------- +class cRecMenuSearchTimerResults: public cRecMenu { +private: + const cEvent **searchResults; + int numResults; +public: + cRecMenuSearchTimerResults(cString searchString, const cEvent **searchResults, int numResults, std::string templateName); + cRecMenuItem *GetMenuItem(int number); + int GetTotalNumMenuItems(void); + virtual ~cRecMenuSearchTimerResults(void) { + delete[] searchResults; + }; +}; + +// --- cRecMenuSearchTimerNothingFound --------------------------------------------------------- +class cRecMenuSearchTimerNothingFound: public cRecMenu { +public: + cRecMenuSearchTimerNothingFound(cString searchString, std::string templateName); + virtual ~cRecMenuSearchTimerNothingFound(void) {}; +}; + +// --- cRecMenuSearchTimerCreateConfirm --------------------------------------------------------- +class cRecMenuSearchTimerCreateConfirm: public cRecMenu { +private: +public: + cRecMenuSearchTimerCreateConfirm(bool success); + virtual ~cRecMenuSearchTimerCreateConfirm(void) {}; +}; + +// --- cRecMenuSwitchTimer --------------------------------------------------------- +class cRecMenuSwitchTimer: public cRecMenu { +private: + const char *switchModes[3]; +public: + cRecMenuSwitchTimer(void); + virtual ~cRecMenuSwitchTimer(void) {}; +}; + +// --- cRecMenuSwitchTimerConfirm --------------------------------------------------------- +class cRecMenuSwitchTimerConfirm: public cRecMenu { +private: +public: + cRecMenuSwitchTimerConfirm(bool success); + virtual ~cRecMenuSwitchTimerConfirm(void) {}; +}; + +// --- cRecMenuSwitchTimerDelete --------------------------------------------------------- +class cRecMenuSwitchTimerDelete: public cRecMenu { +private: +public: + cRecMenuSwitchTimerDelete(void); + virtual ~cRecMenuSwitchTimerDelete(void) {}; +}; + + +// --- cRecMenuSearch --------------------------------------------------------- +class cRecMenuSearch: public cRecMenu { +private: + char initialText[TEXTINPUTLENGTH]; + const char * searchModes[5]; +public: + cRecMenuSearch(const cEvent *event); + cRecMenuSearch(const cEvent *event, const char *searchString); + virtual ~cRecMenuSearch(void) {}; +}; + +// --- cRecMenuSearchResults --------------------------------------------------------- +class cRecMenuSearchResults: public cRecMenu { +private: + const cEvent **searchResults; + int numResults; +public: + cRecMenuSearchResults(cString searchString, const cEvent **searchResults, int numResults); + cRecMenuItem *GetMenuItem(int number); + int GetTotalNumMenuItems(void); + virtual ~cRecMenuSearchResults(void) { + delete[] searchResults; + }; +}; + +// --- cRecMenuSearchConfirmTimer --------------------------------------------------------- +class cRecMenuSearchConfirmTimer: public cRecMenu { +public: + cRecMenuSearchConfirmTimer(const cEvent *event); + virtual ~cRecMenuSearchConfirmTimer(void) {}; +}; + +// --- cRecMenuSearchNothingFound --------------------------------------------------------- +class cRecMenuSearchNothingFound: public cRecMenu { +public: + cRecMenuSearchNothingFound(cString searchString); + virtual ~cRecMenuSearchNothingFound(void) {}; +}; + + + +// --- cRecMenuRecordingSearch --------------------------------------------------------- +class cRecMenuRecordingSearch: public cRecMenu { +private: + char initialText[TEXTINPUTLENGTH]; +public: + cRecMenuRecordingSearch(const cEvent *event); + virtual ~cRecMenuRecordingSearch(void) {}; +}; + +// --- cRecMenuRecordingSearchResults --------------------------------------------------------- + +class cRecMenuRecordingSearchResults: public cRecMenu { +private: + cRecording **searchResults; + int numResults; +public: + cRecMenuRecordingSearchResults(cString searchString, cRecording **searchResults, int numResults); + cRecMenuItem *GetMenuItem(int number); + int GetTotalNumMenuItems(void); + virtual ~cRecMenuRecordingSearchResults(void) { + delete[] searchResults; + }; +}; + +// --- cRecMenuRecordingSearchNotFound --------------------------------------------------------- +class cRecMenuRecordingSearchNotFound: public cRecMenu { +public: + cRecMenuRecordingSearchNotFound(cString searchString); + virtual ~cRecMenuRecordingSearchNotFound(void) {}; +}; + + +#endif //__TVGUIDE_RECMENUS_H \ No newline at end of file diff --git a/services/remotetimers.h b/services/remotetimers.h index 59a0592..cd86b7a 100644 --- a/services/remotetimers.h +++ b/services/remotetimers.h @@ -1,3 +1,9 @@ +#ifndef REMOTETIMERSERVICES_INC +#define REMOTETIMERSERVICES_INC + +#include +#include + // RemoteTimers services struct RemoteTimers_Event_v1_0 { //in @@ -22,4 +28,6 @@ struct RemoteTimers_Timer_v1_0 { cTimer *timer; //out cString errorMsg; -}; \ No newline at end of file +}; + +#endif //REMOTETIMERSERVICES_INC \ No newline at end of file diff --git a/services/tvscraper.h b/services/tvscraper.h index fc278ad..9ebb84b 100644 --- a/services/tvscraper.h +++ b/services/tvscraper.h @@ -1,3 +1,10 @@ +#ifndef __TVGUIDE_TVSCRAPER_H +#define __TVGUIDE_TVSCRAPER_H + +#include +#include +#include + enum tvMediaType { typeSeries, typeMovie, @@ -53,4 +60,6 @@ struct TVScraperGetFullInformation std::vector fanart; std::vector actors; std::string description; -}; \ No newline at end of file +}; + +#endif //__TVGUIDE_TVSCRAPER_H \ No newline at end of file diff --git a/setup.h b/setup.h index fa2166e..936d2a1 100644 --- a/setup.h +++ b/setup.h @@ -1,6 +1,9 @@ #ifndef __TVGUIDE_SETUP_H #define __TVGUIDE_SETUP_H +#include +#include "config.h" + class cTvguideSetup : public cMenuSetupPage { public: cTvguideSetup(void); diff --git a/statusheader.c b/statusheader.c index 0e16d3f..b964911 100644 --- a/statusheader.c +++ b/statusheader.c @@ -1,3 +1,6 @@ +#include "tools.h" +#include "services/tvscraper.h" +#include "imageloader.h" #include "statusheader.h" cStatusHeader::cStatusHeader(void) { diff --git a/statusheader.h b/statusheader.h index 06bd601..de44315 100644 --- a/statusheader.h +++ b/statusheader.h @@ -1,6 +1,9 @@ #ifndef __TVGUIDE_STATUSHEADER_H #define __TVGUIDE_STATUSHEADER_H +#include "styledpixmap.h" +#include "grid.h" + // --- cStatusHeader ------------------------------------------------------------- class cStatusHeader : public cStyledPixmap { diff --git a/styledpixmap.c b/styledpixmap.c index d57ee54..6acc1d0 100644 --- a/styledpixmap.c +++ b/styledpixmap.c @@ -1,3 +1,4 @@ +#include "imageloader.h" #include "styledpixmap.h" cStyledPixmap::cStyledPixmap(void) { diff --git a/styledpixmap.h b/styledpixmap.h index af09994..ab488e6 100644 --- a/styledpixmap.h +++ b/styledpixmap.h @@ -1,6 +1,11 @@ #ifndef __TVGUIDE_STYLEDPIXMAP_H #define __TVGUIDE_STYLEDPIXMAP_H +#include +#include +#include "timer.h" +#include "config.h" + // --- cStyledPixmap ------------------------------------------------------------- class cStyledPixmap { diff --git a/timeline.c b/timeline.c index fbbff62..8dae868 100644 --- a/timeline.c +++ b/timeline.c @@ -1,3 +1,4 @@ +#include "imageloader.h" #include "timeline.h" cTimeLine::cTimeLine(cMyTime *myTime) { diff --git a/timeline.h b/timeline.h index 6733322..172ef4f 100644 --- a/timeline.h +++ b/timeline.h @@ -1,6 +1,9 @@ #ifndef __TVGUIDE_TIMELINE_H #define __TVGUIDE_TIMELINE_H +#include "timer.h" +#include "styledpixmap.h" + // --- cTimeLine ------------------------------------------------------------- class cTimeLine { diff --git a/timer.c b/timer.c index f6d9925..11a6a43 100644 --- a/timer.c +++ b/timer.c @@ -1,3 +1,6 @@ +#include +#include +#include "config.h" #include "timer.h" cMyTime::~cMyTime(void) { diff --git a/timer.h b/timer.h index 2ab5045..5966ac5 100644 --- a/timer.h +++ b/timer.h @@ -1,6 +1,8 @@ #ifndef __TVGUIDE_TIMER_H #define __TVGUIDE_TIMER_H +#include + // --- cMyTime ------------------------------------------------------------- class cMyTime { diff --git a/tools.c b/tools.c index 2a3815e..5c0242a 100644 --- a/tools.c +++ b/tools.c @@ -1,11 +1,17 @@ #include #include #include +#include +#include +#include +#include + +#include "tools.h" /**************************************************************************************** * CUTTEXT ****************************************************************************************/ -static std::string CutText(std::string text, int width, const cFont *font) { +std::string CutText(std::string text, int width, const cFont *font) { if (width <= font->Size()) return text.c_str(); if (font->Width(text.c_str()) < width) @@ -35,13 +41,6 @@ static std::string CutText(std::string text, int width, const cFont *font) { /**************************************************************************************** * SPLTSTRING ****************************************************************************************/ -class splitstring : public std::string { - std::vector flds; -public: - splitstring(const char *s) : std::string(s) { }; - std::vector& split(char delim, int rep=0); -}; - // split: receives a char delimiter; returns a vector of strings // By default ignores repeated delimiters, unless argument rep == 1. std::vector& splitstring::split(char delim, int rep) { @@ -82,53 +81,6 @@ int FindIgnoreCase(const std::string& expr, const std::string& query) /**************************************************************************************** * FUZZYSEARCH ****************************************************************************************/ -#include -#include -#include -#include - -#ifndef _AFUZZY_H -#define _AFUZZY_H - -// source from: -/* - Leonid Boitsov 2002. (itman@narod.ru) - C version of Stas Namin. - This code is a GPL software and is distributed under GNU - public licence without any warranty. -*/ - -typedef unsigned int Uint; - -#define MaxPatSize (sizeof(Uint) * 8) - -typedef struct -{ - Uint *R, - *R1, - *RP, - *S, - *RI; - Uint *FilterS; - - int Map[256]; - int FilterMap[256]; - int k; - Uint mask_ok; - Uint filter_ok; - Uint filter_shift; - int r_size; - int FilterSet; -} AFUZZY; - -void afuzzy_init(const char *p, int kerr, int UseFilter, AFUZZY *fuzzy); -void afuzzy_free(AFUZZY *fuzzy); -int afuzzy_checkSUB(const char *t, AFUZZY *fuzzy); - -#endif - - -static int afuzzy_checkFLT(const char *t, AFUZZY *fuzzy); /****************************************************************************** FUNCTION afuzzy_init() diff --git a/tools.h b/tools.h new file mode 100644 index 0000000..f9bdb4e --- /dev/null +++ b/tools.h @@ -0,0 +1,59 @@ +#ifndef __TVGUIDETOOLS_H +#define __TVGUIDETOOLS_H + +#include +#include +#include + +std::string CutText(std::string text, int width, const cFont *font); + +class splitstring : public std::string { + std::vector flds; +public: + splitstring(const char *s) : std::string(s) { }; + std::vector& split(char delim, int rep=0); +}; + +int FindIgnoreCase(const std::string& expr, const std::string& query); + +#ifndef _AFUZZY_H +#define _AFUZZY_H + +// source from: +/* + Leonid Boitsov 2002. (itman@narod.ru) + C version of Stas Namin. + This code is a GPL software and is distributed under GNU + public licence without any warranty. +*/ + +typedef unsigned int Uint; + +#define MaxPatSize (sizeof(Uint) * 8) + +typedef struct +{ + Uint *R, + *R1, + *RP, + *S, + *RI; + Uint *FilterS; + + int Map[256]; + int FilterMap[256]; + int k; + Uint mask_ok; + Uint filter_ok; + Uint filter_shift; + int r_size; + int FilterSet; +} AFUZZY; + +void afuzzy_init(const char *p, int kerr, int UseFilter, AFUZZY *fuzzy); +void afuzzy_free(AFUZZY *fuzzy); +int afuzzy_checkSUB(const char *t, AFUZZY *fuzzy); +static int afuzzy_checkFLT(const char *t, AFUZZY *fuzzy); +#endif + +#endif // __TVGUIDETOOLS_H \ No newline at end of file diff --git a/tvguide.c b/tvguide.c index 1d180b0..a22fb37 100644 --- a/tvguide.c +++ b/tvguide.c @@ -13,14 +13,16 @@ #include #include -#include "tvguideosd.c" +#define DEFINE_CONFIG 1 +#include "config.h" +#include "setup.h" +#include "tvguideosd.h" + #if defined(APIVERSNUM) && APIVERSNUM < 20000 #error "VDR-2.0.0 API version or greater is required!" #endif - - static const char *VERSION = "1.1.0"; static const char *DESCRIPTION = "A fancy 2d EPG Viewer"; static const char *MAINMENUENTRY = "Tvguide"; @@ -115,10 +117,11 @@ bool cPluginTvguide::ProcessArgs(int argc, char *argv[]) return true; } -bool cPluginTvguide::Initialize(void) -{ - // Initialize any background activities the plugin shall perform. - return true; +bool cPluginTvguide::Initialize(void) { + esyslog("tvguide: Initialize"); + esyslog("tvguide: OSD Wwidth %d, OSD Height %d", cOsd::OsdWidth(), cOsd::OsdHeight()); + esyslog("tvguide: numRows: %d, numCols: %d", tvguideConfig.channelRows, tvguideConfig.channelCols); + return true; } bool cPluginTvguide::Start(void) diff --git a/tvguideosd.c b/tvguideosd.c index 7598118..67b3c33 100644 --- a/tvguideosd.c +++ b/tvguideosd.c @@ -1,94 +1,14 @@ -// --- Theme ------------------------------------------------------------- -static cTheme theme; - -//BLENDING SETUP -#define CLR_BLENDING_NOPACITY 0xFFFFFFFF -#define CLR_BLENDING_DEFAULT 0xAAAAAAAA -#define CLR_BLENDING_OFF 0x00000000 - -THEME_CLR(theme, clrDoBlending, CLR_BLENDING_DEFAULT); -THEME_CLR(theme, clrBackgroundOSD, clrBlack); -THEME_CLR(theme, clrBackground, clrBlack); -THEME_CLR(theme, clrGrid1, 0xFF404749); -THEME_CLR(theme, clrGrid1Blending, 0xFF000000); -THEME_CLR(theme, clrGrid2, 0xFF20293F); -THEME_CLR(theme, clrGrid2Blending, 0xFF000000); -THEME_CLR(theme, clrHighlight, 0xFFFF4D00); -THEME_CLR(theme, clrHighlightBlending, 0xFF000000); -THEME_CLR(theme, clrFont, clrWhite); -THEME_CLR(theme, clrFontActive, clrWhite); -THEME_CLR(theme, clrFontHeader, clrWhite); -THEME_CLR(theme, clrFontButtons, clrWhite); -THEME_CLR(theme, clrStatusHeader, clrBlack); -THEME_CLR(theme, clrStatusHeaderBlending, clrBlack); -THEME_CLR(theme, clrHeader, clrBlack); -THEME_CLR(theme, clrHeaderBlending, 0xFFE0E0E0); -THEME_CLR(theme, clrBorder, clrWhite); -THEME_CLR(theme, clrTimeline1, clrWhite); -THEME_CLR(theme, clrTimeline1Blending, 0xFF828282); -THEME_CLR(theme, clrTimeline2, clrBlack); -THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F); -THEME_CLR(theme, clrButtonRed, 0x99BB0000); -THEME_CLR(theme, clrButtonRedBorder, 0xFFBB0000); -THEME_CLR(theme, clrButtonGreen, 0x9900BB00); -THEME_CLR(theme, clrButtonGreenBorder, 0xFF00BB00); -THEME_CLR(theme, clrButtonYellow, 0x99BBBB00); -THEME_CLR(theme, clrButtonYellowBorder, 0xFFBBBB00); -THEME_CLR(theme, clrButtonBlue, 0x990000BB); -THEME_CLR(theme, clrButtonBlueBorder, 0xFF0000BB); -THEME_CLR(theme, clrButtonBlend, 0xDD000000); -THEME_CLR(theme, clrRecMenuBackground, 0xB0000000); -THEME_CLR(theme, clrRecMenuTimerConflictBackground, 0xFFCCCCCC); -THEME_CLR(theme, clrRecMenuTimerConflictBar, 0xFF222222); -THEME_CLR(theme, clrRecMenuTimerConflictOverlap, 0xAAFF0000); -THEME_CLR(theme, clrRecMenuDayActive, 0xFF00FF00); -THEME_CLR(theme, clrRecMenuDayInactive, 0xFFFF0000); -THEME_CLR(theme, clrRecMenuDayHighlight, 0x44FFFFFF); -THEME_CLR(theme, clrRecMenuTextBack, 0xFF000000); -THEME_CLR(theme, clrRecMenuTextActiveBack, 0xFF404749); -THEME_CLR(theme, clrRecMenuKeyboardBack, 0xFF000000); -THEME_CLR(theme, clrRecMenuKeyboardBorder, clrWhite); -THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x55FFFFFF); -THEME_CLR(theme, clrButtonRedKeyboard, 0xFFBB0000); -THEME_CLR(theme, clrButtonGreenKeyboard, 0xFF00BB00); -THEME_CLR(theme, clrButtonYellowKeyboard, 0xFFBBBB00); - -#include "config.c" -cTvguideConfig tvguideConfig; - -#include "osdmanager.c" -cOsdManager osdManager; +#include +#include +#include "config.h" #include "services/epgsearch.h" #include "services/remotetimers.h" -cPlugin* pRemoteTimers = NULL; -#include -#include "services/tvscraper.h" -#include "tools.c" -#include "switchtimer.c" -#include "setup.c" -#include "imageloader.c" -#include "styledpixmap.c" -#include "timer.c" -#include "timeline.c" -#include "grid.c" -#include "headergrid.c" -#include "dummygrid.c" -#include "epggrid.c" -#include "statusheader.c" -#include "detailview.c" -#include "channelcolumn.c" -#include "channelgroup.c" -#include "channelgroups.c" -#include "footer.c" -#include "recmenuitem.c" -#include "recmenu.c" -#include "recmanager.c" -#include "recmenus.c" -#include "recmenumanager.c" + +#include "tools.h" +#include "setup.h" #include "tvguideosd.h" -#include cTvGuideOsd::cTvGuideOsd(void) { detailView = NULL; diff --git a/tvguideosd.h b/tvguideosd.h index 82a8193..d4d936f 100644 --- a/tvguideosd.h +++ b/tvguideosd.h @@ -1,6 +1,16 @@ #ifndef __TVGUIDE_TVGUIDEOSD_H #define __TVGUIDE_TVGUIDEOSD_H +#include "timer.h" +#include "grid.h" +#include "channelcolumn.h" +#include "statusheader.h" +#include "detailview.h" +#include "timeline.h" +#include "channelgroups.h" +#include "footer.h" +#include "recmenumanager.h" + // --- cTvGuideOsd ------------------------------------------------------------- class cTvGuideOsd : public cOsdObject {