diff options
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | imon.c | 14 | ||||
-rw-r--r-- | imon.h | 2 | ||||
-rw-r--r-- | po/de_DE.po | 13 | ||||
-rw-r--r-- | po/it_IT.po | 12 | ||||
-rw-r--r-- | setup.c | 30 | ||||
-rw-r--r-- | setup.h | 1 | ||||
-rw-r--r-- | watch.c | 60 | ||||
-rw-r--r-- | watch.h | 7 |
9 files changed, 120 insertions, 22 deletions
@@ -1,6 +1,9 @@ VDR Plugin 'imonlcd' Revision History ------------------------------------- +2009-xx-xx: Version 0.0.3 +- Add mode to show information on two lines provided by Sven (cokker) (Feature #161) + 2009-06-08: Version 0.0.2 - italian translation provided by Diego Pierotto (Feature #126) - new svdrp commands @@ -132,7 +132,7 @@ ciMonLCD::~ciMonLCD() { */ int ciMonLCD::open(const char* szDevice, eProtocol pro) { - if(!SetFont(theSetup.m_szFont)) { + if(!SetFont(theSetup.m_szFont,theSetup.m_bTwoLineMode)) { return -1; } @@ -636,13 +636,19 @@ int ciMonLCD::lengthToPixels(int length) return (pixLen[32 + length] ^ 0xffffffff); } -bool ciMonLCD::SetFont(const char *szFont) { +bool ciMonLCD::SetFont(const char *szFont, int bTwoLineMode) { ciMonFont* tmpFont = NULL; cString sFileName = cFont::GetFontFileName(szFont); - if(!isempty(sFileName)) { - tmpFont = new ciMonFont(sFileName,12,11); + if(!isempty(sFileName)) + { + if (bTwoLineMode) + { + tmpFont = new ciMonFont(sFileName,6,8); + } else { + tmpFont = new ciMonFont(sFileName,12,11); + } } else { esyslog("iMonLCD: unable to find file for font '%s'",szFont); } @@ -128,7 +128,7 @@ public: bool flush (); bool icons(unsigned int state); - virtual bool SetFont(const char *szFont); + virtual bool SetFont(const char *szFont, int m_bTwoLineMode); }; #endif diff --git a/po/de_DE.po b/po/de_DE.po index 7060590..e658c3b 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-imonlcd-plugin 0.0.1\n" +"Project-Id-Version: vdr-imonlcd-plugin 0.0.3\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2009-06-04 15:25+0200\n" +"POT-Creation-Date: 2009-09-29 19:13+0200\n" "PO-Revision-Date: 2009-05-21 17:13+0200\n" "Last-Translator: Andreas Brachold <vdr07 AT deltab de>\n" "Language-Team: Andreas Brachold <vdr07 AT deltab de>\n" @@ -36,6 +36,15 @@ msgstr "Schlanke Scheibe" msgid "Full disc" msgstr "Volle Scheibe" +msgid "Render mode" +msgstr "Anzeigemodus" + +msgid "Single line" +msgstr "Einzelne Zeile" + +msgid "Dual lines" +msgstr "Zwei Zeilen" + msgid "Do nothing" msgstr "Nichts unternehmen" diff --git a/po/it_IT.po b/po/it_IT.po index 18b5a0d..b01daa9 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-imonlcd-plugin 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2009-06-04 15:25+0200\n" +"POT-Creation-Date: 2009-09-29 19:55+0200\n" "PO-Revision-Date: 2009-06-07 23:30+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: \n" @@ -39,6 +39,15 @@ msgstr "Disco leggero" msgid "Full disc" msgstr "Disco pieno" +msgid "Render mode" +msgstr "" + +msgid "Single line" +msgstr "" + +msgid "Dual lines" +msgstr "" + msgid "Do nothing" msgstr "Non fare nulla" @@ -65,4 +74,3 @@ msgstr "Nessun timer attivo" msgid "Unknown title" msgstr "Titolo sconosciuto" - @@ -30,6 +30,7 @@ #define DEFAULT_HEIGHT 16 #define DEFAULT_FONT "Sans:Bold" #define DEFAULT_WAKEUP 5 +#define DEFAULT_TWO_LINE_MODE 0 /// The one and only Stored setup data cIMonSetup theSetup; @@ -45,6 +46,7 @@ cIMonSetup::cIMonSetup(void) m_nHeight = DEFAULT_HEIGHT; m_nWakeup = DEFAULT_WAKEUP; + m_bTwoLineMode = DEFAULT_TWO_LINE_MODE; strncpy(m_szFont,DEFAULT_FONT,sizeof(m_szFont)); } @@ -64,6 +66,7 @@ cIMonSetup& cIMonSetup::operator = (const cIMonSetup& x) m_nHeight = x.m_nHeight; m_nWakeup = x.m_nWakeup; + m_bTwoLineMode = x.m_bTwoLineMode; strncpy(m_szFont,x.m_szFont,sizeof(m_szFont)); @@ -152,6 +155,24 @@ bool cIMonSetup::SetupParse(const char *szName, const char *szValue) m_nWakeup = n; return true; } + + // Two Line Mode + if(!strcasecmp(szName, "TwoLineMode")) { + int n = atoi(szValue); + if ((n != 0) && (n != 1)) + { + esyslog("iMonLCD: TwoLineMode must be 0 or 1. using default %d", + DEFAULT_TWO_LINE_MODE ); + n = DEFAULT_TWO_LINE_MODE; + } + + if (n) { + m_bTwoLineMode = 1; + } else { + m_bTwoLineMode = 0; + } + return true; + } //Unknow parameter return false; } @@ -170,6 +191,7 @@ void ciMonMenuSetup::Store(void) SetupStore("Contrast", theSetup.m_nContrast); SetupStore("Font", theSetup.m_szFont); SetupStore("Wakeup", theSetup.m_nWakeup); + SetupStore("TwoLineMode",theSetup.m_bTwoLineMode); } ciMonMenuSetup::ciMonMenuSetup(ciMonWatch* pDev) @@ -193,6 +215,9 @@ ciMonMenuSetup::ciMonMenuSetup(ciMonWatch* pDev) &m_tmpSetup.m_bDiscMode, tr("Slim disc"), tr("Full disc"))); + Add(new cMenuEditBoolItem(tr("Render mode"), + &m_tmpSetup.m_bTwoLineMode, + tr("Single line"), tr("Dual lines"))); static const char * szExitModes[eOnExitMode_LASTITEM]; szExitModes[eOnExitMode_SHOWMSG] = tr("Do nothing"); @@ -225,8 +250,9 @@ eOSState ciMonMenuSetup::ProcessKey(eKeys nKey) if(nKey == kOk) { // Store edited Values Utf8Strn0Cpy(m_tmpSetup.m_szFont, fontNames[fontIndex], sizeof(m_tmpSetup.m_szFont)); - if (0 != strcmp(m_tmpSetup.m_szFont, theSetup.m_szFont)) { - m_pDev->SetFont(m_tmpSetup.m_szFont); + if (0 != strcmp(m_tmpSetup.m_szFont, theSetup.m_szFont) + || m_tmpSetup.m_bTwoLineMode != theSetup.m_bTwoLineMode) { + m_pDev->SetFont(m_tmpSetup.m_szFont, m_tmpSetup.m_bTwoLineMode); } } return cMenuSetupPage::ProcessKey(nKey); @@ -38,6 +38,7 @@ struct cIMonSetup char m_szFont[256]; int m_nWakeup; + int m_bTwoLineMode; /** enable two line mode */ cIMonSetup(void); cIMonSetup(const cIMonSetup& x); @@ -59,8 +59,10 @@ ciMonWatch::ciMonWatch() m_pControl = NULL; replayTitle = NULL; - replayShortTitle = NULL; replayTitleLast = NULL; + + currentTime = NULL; + m_eWatchMode = eLiveTV; m_eVideoMode = eVideoNone; m_eAudioMode = eAudioNone; @@ -96,9 +98,9 @@ ciMonWatch::~ciMonWatch() delete replayTitle; replayTitle = NULL; } - if(replayShortTitle) { - delete replayShortTitle; - replayShortTitle = NULL; + if(currentTime) { + delete currentTime; + currentTime = NULL; } } @@ -182,7 +184,7 @@ void ciMonWatch::Action(void) int nContrast = -1; unsigned int n; - int nCnt = 0; + unsigned int nCnt = 0; int nLastTopProgressBar = -1; int nTopProgressBar = 0; int nLastBottomProgressBar = -1; @@ -215,6 +217,13 @@ void ciMonWatch::Action(void) case eReplayAudioCD: nIcons |= eIconDiscSpin | eIconDiscEllispe | eIconTopDVD; break; } + // every second the clock need updates. + if (theSetup.m_bTwoLineMode && m_eWatchMode != eLiveTV) { + if((0 == (nCnt % 10))) { + m_bUpdateScreen |= CurrentTime(); + } + } + bFlush = RenderScreen(); if(m_eWatchMode == eLiveTV) { if((chFollowingTime - chPresentTime) > 0) { @@ -367,25 +376,32 @@ void ciMonWatch::Action(void) bool ciMonWatch::RenderScreen() { cString* scRender; + cString* scHeader = NULL; bool bForce = m_bUpdateScreen; if(osdMessage) { scRender = osdMessage; } else if(osdItem) { scRender = osdItem; } else if(m_eWatchMode == eLiveTV) { + scHeader = chName; if(Program()) { bForce = true; } if(chPresentTitle) scRender = chPresentTitle; - else + else { + scHeader = currentTime; scRender = chName; + } } else { if(Replay()) { bForce = true; } + scHeader = currentTime; scRender = replayTitle; } + + if(bForce) { m_nScrollOffset = 0; m_bScrollBackward = false; @@ -393,7 +409,14 @@ bool ciMonWatch::RenderScreen() { if(bForce || m_nScrollOffset > 0 || m_bScrollBackward) { this->clear(); if(scRender) { - int iRet = this->DrawText(0 - m_nScrollOffset,0,(*scRender)); + + int iRet = -1; + if(theSetup.m_bTwoLineMode) { + iRet = this->DrawText(0 - m_nScrollOffset,8, *scRender); + } else { + iRet = this->DrawText(0 - m_nScrollOffset,0, *scRender); + } + switch(iRet) { case 0: if(m_nScrollOffset <= 0) { @@ -415,12 +438,31 @@ bool ciMonWatch::RenderScreen() { } } + if(scHeader && theSetup.m_bTwoLineMode) { + this->DrawText(0, 0, *scHeader); + } + m_bUpdateScreen = false; return true; } return false; } +bool ciMonWatch::CurrentTime() { + time_t ts = time(NULL); + + if((ts / 60) != (tsCurrentLast / 60)) { + + if(currentTime) + delete currentTime; + + tsCurrentLast = ts; + currentTime = new cString(TimeString(ts)); + return currentTime != NULL; + } + return false; +} + bool ciMonWatch::Replay() { if(replayTitleLast != replayTitle) { @@ -810,9 +852,9 @@ void ciMonWatch::OsdStatusMessage(const char *sz) } } -bool ciMonWatch::SetFont(const char *szFont) { +bool ciMonWatch::SetFont(const char *szFont, int bTwoLineMode) { cMutexLooker m(mutex); - if(ciMonLCD::SetFont(szFont)) { + if(ciMonLCD::SetFont(szFont, bTwoLineMode)) { m_bUpdateScreen = true; return true; } @@ -115,8 +115,10 @@ private: eReplayMode m_eReplayMode; cString* replayTitle; - cString* replayShortTitle; cString* replayTitleLast; + + time_t tsCurrentLast; + cString* currentTime; protected: virtual void Action(void); bool Program(); @@ -124,6 +126,7 @@ protected: bool RenderScreen(); eReplayState ReplayMode() const; bool ReplayPosition(int ¤t, int &total) const; + bool CurrentTime(); public: ciMonWatch(); virtual ~ciMonWatch(); @@ -140,7 +143,7 @@ public: void OsdCurrentItem(const char *sz); void OsdStatusMessage(const char *sz); - virtual bool SetFont(const char *szFont); + virtual bool SetFont(const char *szFont, int bTwoLineMode); eIconState ForceIcon(unsigned int nIcon, eIconState nState); }; |