diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2016-08-22 20:38:31 +0200 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2016-08-22 20:38:31 +0200 |
commit | 61bfb702539e3337801c09d276ded41536fd3742 (patch) | |
tree | fa813b992043b790793fc5f381293c8ea8566bca /displaymenu.c | |
parent | 89ffd66a70e7d424230687281f4e42baad41572b (diff) | |
download | skin-flatplus-61bfb702539e3337801c09d276ded41536fd3742.tar.gz skin-flatplus-61bfb702539e3337801c09d276ded41536fd3742.tar.bz2 |
[add] menu recordings - add exclamation mark icon for folders if last recording is older than XX days
Diffstat (limited to 'displaymenu.c')
-rw-r--r-- | displaymenu.c | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/displaymenu.c b/displaymenu.c index af6a3aa6..20727230 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -2117,8 +2117,19 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); Left += font->Width(" 999 "); if( Config.MenuItemRecordingShowFolderDate != 0 ) { - buffer = cString::sprintf(" (%s)", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level))); - menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorExtraTextFg, ColorBg, font, menuItemWidth - Left - marginItem); + buffer = cString::sprintf("(%s) ", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level))); + menuPixmap->DrawText(cPoint(LeftWidth - font->Width(buffer) - fontHeight*2 - marginItem*2, Top), buffer, ColorExtraTextFg, ColorBg, font); + if( isRecordingOld( Recording, Level ) ) { + Left = LeftWidth - fontHeight*2 - marginItem*2; + if( Current ) + img = imgLoader.LoadIcon("recording_old_cur", fontHeight, fontHeight); + else + img = imgLoader.LoadIcon("recording_old", fontHeight, fontHeight); + if( img ) { + menuIconsPixmap->DrawImage( cPoint(Left, Top), *img ); + Left += img->Width() + marginItem; + } + } } if( Current && font->Width(RecName) > (menuItemWidth - LeftWidth - marginItem) && Config.ScrollerEnable ) { @@ -2257,8 +2268,19 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, Left += fontSml->Width(" 999 "); if( Config.MenuItemRecordingShowFolderDate != 0 ) { - buffer = cString::sprintf(" (%s)", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level))); - menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorExtraTextFg, ColorBg, fontSml, menuItemWidth - Left - marginItem); + buffer = cString::sprintf(" (%s) ", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level))); + menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorExtraTextFg, ColorBg, fontSml); + if( isRecordingOld( Recording, Level ) ) { + Left += fontSml->Width(buffer); + if( Current ) + img = imgLoader.LoadIcon("recording_old_cur", fontSmlHeight, fontSmlHeight); + else + img = imgLoader.LoadIcon("recording_old", fontSmlHeight, fontSmlHeight); + if( img ) { + menuIconsPixmap->DrawImage( cPoint(Left, Top), *img ); + } + } + } } else if( Total == -1 ) { if( Current ) @@ -3941,6 +3963,28 @@ void cFlatDisplayMenu::ItemBorderClear(void) { ItemsBorder.clear(); } +bool cFlatDisplayMenu::isRecordingOld( const cRecording *Recording, int Level ) { + std::string RecFolder = GetRecordingName(Recording, Level, true).c_str(); + + int value = Config.GetRecordingOldValue( RecFolder ); + if( value < 0 ) + return false; + + int LastRecTimeFromFolder = GetLastRecTimeFromFolder(Recording, Level); + time_t now; + time(&now); + + int diffSecs = now - LastRecTimeFromFolder; + int days = diffSecs / (60 * 60 * 24); + + //dsyslog("RecFolder: %s LastRecTimeFromFolder: %d time: %d value: %d diff: %d days: %d", RecFolder.c_str(), LastRecTimeFromFolder, now, value, diffSecs, days); + if( days > value ) + return true; + + return false; +} + + time_t cFlatDisplayMenu::GetLastRecTimeFromFolder(const cRecording *Recording, int Level) { std::string RecFolder = GetRecordingName(Recording, Level, true).c_str(); time_t RecStart = Recording->Start(); @@ -5324,12 +5368,16 @@ void cFlatDisplayMenu::PreLoadImages(void) { imgLoader.LoadIcon("recording_new", fontHeight, fontHeight); imgLoader.LoadIcon("recording_new", fontSmlHeight, fontSmlHeight); - imgLoader.LoadIcon("recording_cutted", fontHeight, fontHeight); imgLoader.LoadIcon("recording_new_cur", fontHeight, fontHeight); imgLoader.LoadIcon("recording_new_cur", fontSmlHeight, fontSmlHeight); + imgLoader.LoadIcon("recording_cutted", fontHeight, fontHeight); imgLoader.LoadIcon("recording_cutted_cur", fontHeight, fontHeight); imgLoader.LoadIcon("recording", fontHeight, fontHeight); imgLoader.LoadIcon("folder", fontHeight, fontHeight); + imgLoader.LoadIcon("recording_old", fontHeight, fontHeight); + imgLoader.LoadIcon("recording_old_cur", fontHeight, fontHeight); + imgLoader.LoadIcon("recording_old", fontSmlHeight, fontSmlHeight); + imgLoader.LoadIcon("recording_old_cur", fontSmlHeight, fontSmlHeight); } |